@hanzogui/animate 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 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/README.md ADDED
@@ -0,0 +1 @@
1
+ Much of this is taken from framer-motion.
@@ -0,0 +1,77 @@
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 Animate_exports = {};
24
+ __export(Animate_exports, {
25
+ Animate: () => Animate
26
+ });
27
+ module.exports = __toCommonJS(Animate_exports);
28
+ var import_animate_presence = require("@hanzogui/animate-presence");
29
+ var import_react = require("react");
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ function Animate({
32
+ children,
33
+ lazyMount,
34
+ type,
35
+ present,
36
+ passThrough,
37
+ ...props
38
+ }) {
39
+ const [lazyMounted, setLazyMounted] = (0, import_react.useState)(lazyMount ? false : present);
40
+ (0, import_react.useEffect)(() => {
41
+ if (passThrough) return;
42
+ if (!lazyMount) return;
43
+ if (!present) return;
44
+ (0, import_react.startTransition)(() => {
45
+ setLazyMounted(present);
46
+ });
47
+ }, [lazyMount, present]);
48
+ const mounted = !present ? false : lazyMount ? lazyMounted : present;
49
+ if (type === "presence") {
50
+ if (props.keepChildrenMounted) {
51
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_animate_presence.PresenceChild, {
52
+ isPresent: true,
53
+ ...(!passThrough && {
54
+ initial: props.initial ? void 0 : false,
55
+ onExitComplete: props.onExitComplete,
56
+ enterVariant: props.enterVariant,
57
+ exitVariant: props.exitVariant,
58
+ enterExitVariant: props.enterExitVariant,
59
+ // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
60
+ // but since we always re-render this component on open changes this should be fine to leave off?
61
+ presenceAffectsLayout: false,
62
+ isPresent: present,
63
+ custom: props.custom
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
+ }
@@ -0,0 +1,81 @@
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 Animate_exports = {};
26
+ __export(Animate_exports, {
27
+ Animate: () => Animate
28
+ });
29
+ module.exports = __toCommonJS(Animate_exports);
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ var import_animate_presence = require("@hanzogui/animate-presence");
32
+ var import_react = require("react");
33
+ function Animate(param) {
34
+ var {
35
+ children,
36
+ lazyMount,
37
+ type,
38
+ present,
39
+ passThrough,
40
+ ...props
41
+ } = param;
42
+ var [lazyMounted, setLazyMounted] = (0, import_react.useState)(lazyMount ? false : present);
43
+ (0, import_react.useEffect)(function () {
44
+ if (passThrough) return;
45
+ if (!lazyMount) return;
46
+ if (!present) return;
47
+ (0, import_react.startTransition)(function () {
48
+ setLazyMounted(present);
49
+ });
50
+ }, [lazyMount, present]);
51
+ var mounted = !present ? false : lazyMount ? lazyMounted : present;
52
+ if (type === "presence") {
53
+ if (props.keepChildrenMounted) {
54
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_animate_presence.PresenceChild, {
55
+ isPresent: true,
56
+ ...(!passThrough && {
57
+ initial: props.initial ? void 0 : false,
58
+ onExitComplete: props.onExitComplete,
59
+ enterVariant: props.enterVariant,
60
+ exitVariant: props.exitVariant,
61
+ enterExitVariant: props.enterExitVariant,
62
+ // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
63
+ // but since we always re-render this component on open changes this should be fine to leave off?
64
+ presenceAffectsLayout: false,
65
+ isPresent: present,
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
+ });
80
+ }
81
+ //# sourceMappingURL=Animate.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","Animate_exports","Animate","module","exports","import_jsx_runtime","require","import_animate_presence","import_react","param","children","lazyMount","type","present","passThrough","props","lazyMounted","setLazyMounted","useState","useEffect","startTransition","mounted","keepChildrenMounted","jsx","PresenceChild","isPresent","initial","onExitComplete","enterVariant","exitVariant","enterExitVariant","presenceAffectsLayout","custom","AnimatePresence","Fragment"],"sources":["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(\"@hanzogui/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 enterVariant: props.enterVariant,\n exitVariant: props.exitVariant,\n enterExitVariant: props.enterExitVariant,\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"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AEX,KAAK,CAACW,OAAO,GAAG,KAAK,CAAC,GAAG,KAAK;UACvCC,cAAc,EAAEZ,KAAK,CAACY,cAAc;UACpCC,YAAY,EAAEb,KAAK,CAACa,YAAY;UAChCC,WAAW,EAAEd,KAAK,CAACc,WAAW;UAC9BC,gBAAgB,EAAEf,KAAK,CAACe,gBAAgB;UACxC;UACA;UACAC,qBAAqB,EAAE,KAAK;UAC5BN,SAAS,EAAEZ,OAAO;UAClBmB,MAAM,EAAEjB,KAAK,CAACiB;QAChB,CAAC;QACDtB;MACF,CAAC,CAAC;IACJ;IACA,OAAO,eAAgB,CAAC,CAAC,EAAEL,kBAAkB,CAACkB,GAAG,EAAEhB,uBAAuB,CAAC0B,eAAe,EAAE;MAC1FnB,WAAW;MACX,GAAGC,KAAK;MACRL,QAAQ,EAAEW,OAAO,IAAIP,WAAW,GAAGJ,QAAQ,GAAG;IAChD,CAAC,CAAC;EACJ;EACA,OAAO,eAAgB,CAAC,CAAC,EAAEL,kBAAkB,CAACkB,GAAG,EAAElB,kBAAkB,CAAC6B,QAAQ,EAAE;IAC9ExB;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
+ get: () => from[key],
9
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
+ });
11
+ }
12
+ return to;
13
+ };
14
+ 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);
18
+ var index_exports = {};
19
+ module.exports = __toCommonJS(index_exports);
20
+ __reExport(index_exports, require("./Animate.cjs"), module.exports);
@@ -0,0 +1,23 @@
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 __copyProps = (to, from, except, desc) => {
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
+ get: () => from[key],
11
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
+ });
13
+ }
14
+ return to;
15
+ };
16
+ 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);
20
+ var index_exports = {};
21
+ module.exports = __toCommonJS(index_exports);
22
+ __reExport(index_exports, require("./Animate.native.js"), module.exports);
23
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__copyProps","to","from","except","desc","key","call","get","enumerable","__reExport","target","mod","secondTarget","__toCommonJS","value","index_exports","module","exports","require"],"sources":["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":"AAAA,YAAY;;AACZ,IAAIA,SAAS,GAAGC,MAAM,CAACC,cAAc;AACrC,IAAIC,gBAAgB,GAAGF,MAAM,CAACG,wBAAwB;AACtD,IAAIC,iBAAiB,GAAGJ,MAAM,CAACK,mBAAmB;AAClD,IAAIC,YAAY,GAAGN,MAAM,CAACO,SAAS,CAACC,cAAc;AAClD,IAAIC,WAAW,GAAGA,CAACC,EAAE,EAAEC,IAAI,EAAEC,MAAM,EAAEC,IAAI,KAAK;EAC5C,IAAIF,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAI,OAAOA,IAAI,KAAK,UAAU,EAAE;IAClE,KAAK,IAAIG,GAAG,IAAIV,iBAAiB,CAACO,IAAI,CAAC,EACrC,IAAI,CAACL,YAAY,CAACS,IAAI,CAACL,EAAE,EAAEI,GAAG,CAAC,IAAIA,GAAG,KAAKF,MAAM,EAC/Cb,SAAS,CAACW,EAAE,EAAEI,GAAG,EAAE;MAAEE,GAAG,EAAEA,CAAA,KAAML,IAAI,CAACG,GAAG,CAAC;MAAEG,UAAU,EAAE,EAAEJ,IAAI,GAAGX,gBAAgB,CAACS,IAAI,EAAEG,GAAG,CAAC,CAAC,IAAID,IAAI,CAACI;IAAW,CAAC,CAAC;EACxH;EACA,OAAOP,EAAE;AACX,CAAC;AACD,IAAIQ,UAAU,GAAGA,CAACC,MAAM,EAAEC,GAAG,EAAEC,YAAY,MAAMZ,WAAW,CAACU,MAAM,EAAEC,GAAG,EAAE,SAAS,CAAC,EAAEC,YAAY,IAAIZ,WAAW,CAACY,YAAY,EAAED,GAAG,EAAE,SAAS,CAAC,CAAC;AAChJ,IAAIE,YAAY,GAAIF,GAAG,IAAKX,WAAW,CAACV,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE;EAAEwB,KAAK,EAAE;AAAK,CAAC,CAAC,EAAEH,GAAG,CAAC;AAC1F,IAAII,aAAa,GAAG,CAAC,CAAC;AACtBC,MAAM,CAACC,OAAO,GAAGJ,YAAY,CAACE,aAAa,CAAC;AAC5CN,UAAU,CAACM,aAAa,EAAEG,OAAO,CAAC,qBAAW,CAAC,EAAEF,MAAM,CAACC,OAAO,CAAC","ignoreList":[]}
@@ -0,0 +1,52 @@
1
+ import { AnimatePresence, PresenceChild } from "@hanzogui/animate-presence";
2
+ import { startTransition, useEffect, useState } from "react";
3
+ import { Fragment, jsx } from "react/jsx-runtime";
4
+ function Animate({
5
+ children,
6
+ lazyMount,
7
+ type,
8
+ present,
9
+ passThrough,
10
+ ...props
11
+ }) {
12
+ const [lazyMounted, setLazyMounted] = useState(lazyMount ? false : present);
13
+ useEffect(() => {
14
+ if (passThrough) return;
15
+ if (!lazyMount) return;
16
+ if (!present) return;
17
+ startTransition(() => {
18
+ setLazyMounted(present);
19
+ });
20
+ }, [lazyMount, present]);
21
+ const mounted = !present ? false : lazyMount ? lazyMounted : present;
22
+ if (type === "presence") {
23
+ if (props.keepChildrenMounted) {
24
+ return /* @__PURE__ */jsx(PresenceChild, {
25
+ isPresent: true,
26
+ ...(!passThrough && {
27
+ initial: props.initial ? void 0 : false,
28
+ onExitComplete: props.onExitComplete,
29
+ enterVariant: props.enterVariant,
30
+ exitVariant: props.exitVariant,
31
+ enterExitVariant: props.enterExitVariant,
32
+ // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
33
+ // but since we always re-render this component on open changes this should be fine to leave off?
34
+ presenceAffectsLayout: false,
35
+ isPresent: present,
36
+ custom: props.custom
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
+ });
50
+ }
51
+ export { Animate };
52
+ //# sourceMappingURL=Animate.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AnimatePresence","PresenceChild","startTransition","useEffect","useState","Fragment","jsx","Animate","children","lazyMount","type","present","passThrough","props","lazyMounted","setLazyMounted","mounted","keepChildrenMounted","isPresent","initial","onExitComplete","enterVariant","exitVariant","enterExitVariant","presenceAffectsLayout","custom"],"sources":["../../src/Animate.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,eAAA,EAAiBC,aAAA,QAAqB;AAC/C,SAASC,eAAA,EAAiBC,SAAA,EAAWC,QAAA,QAAgB;AA4D7C,SA2BCC,QAAA,EA3BDC,GAAA;AAzBD,SAASC,QAAQ;EACtBC,QAAA;EACAC,SAAA;EACAC,IAAA;EACAC,OAAA;EACAC,WAAA;EACA,GAAGC;AACL,GAAkC;EAChC,MAAM,CAACC,WAAA,EAAaC,cAAc,IAAIX,QAAA,CAASK,SAAA,GAAY,QAAQE,OAAO;EAE1ER,SAAA,CAAU,MAAM;IACd,IAAIS,WAAA,EAAa;IACjB,IAAI,CAACH,SAAA,EAAW;IAChB,IAAI,CAACE,OAAA,EAAS;IACdT,eAAA,CAAgB,MAAM;MACpBa,cAAA,CAAeJ,OAAO;IACxB,CAAC;EACH,GAAG,CAACF,SAAA,EAAWE,OAAO,CAAC;EAGvB,MAAMK,OAAA,GAAU,CAACL,OAAA,GAAU,QAAQF,SAAA,GAAYK,WAAA,GAAcH,OAAA;EAE7D,IAAID,IAAA,KAAS,YAAY;IACvB,IAAIG,KAAA,CAAMI,mBAAA,EAAqB;MAC7B,OACE,eAAAX,GAAA,CAACL,aAAA;QACCiB,SAAA,EAAS;QACR,IAAI,CAACN,WAAA,IAAe;UACnBO,OAAA,EAASN,KAAA,CAAMM,OAAA,GAAU,SAAY;UACrCC,cAAA,EAAgBP,KAAA,CAAMO,cAAA;UACtBC,YAAA,EAAcR,KAAA,CAAMQ,YAAA;UACpBC,WAAA,EAAaT,KAAA,CAAMS,WAAA;UACnBC,gBAAA,EAAkBV,KAAA,CAAMU,gBAAA;UAAA;UAAA;UAGxBC,qBAAA,EAAuB;UACvBN,SAAA,EAAWP,OAAA;UACXc,MAAA,EAAQZ,KAAA,CAAMY;QAChB;QAECjB;MAAA,CACH;IAEJ;IAEA,OACE,eAAAF,GAAA,CAACN,eAAA;MAAgBY,WAAA;MAA2B,GAAGC,KAAA;MAC5CL,QAAA,EAAAQ,OAAA,IAAWJ,WAAA,GAAcJ,QAAA,GAAW;IAAA,CACvC;EAEJ;EAEA,OAAO,eAAAF,GAAA,CAAAD,QAAA;IAAGG;EAAA,CAAS;AACrB","ignoreList":[]}
@@ -0,0 +1,53 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { AnimatePresence, PresenceChild } from "@hanzogui/animate-presence";
3
+ import { startTransition, useEffect, useState } from "react";
4
+ function Animate(param) {
5
+ var {
6
+ children,
7
+ lazyMount,
8
+ type,
9
+ present,
10
+ passThrough,
11
+ ...props
12
+ } = param;
13
+ var [lazyMounted, setLazyMounted] = useState(lazyMount ? false : present);
14
+ useEffect(function () {
15
+ if (passThrough) return;
16
+ if (!lazyMount) return;
17
+ if (!present) return;
18
+ startTransition(function () {
19
+ setLazyMounted(present);
20
+ });
21
+ }, [lazyMount, present]);
22
+ var mounted = !present ? false : lazyMount ? lazyMounted : present;
23
+ if (type === "presence") {
24
+ if (props.keepChildrenMounted) {
25
+ return /* @__PURE__ */_jsx(PresenceChild, {
26
+ isPresent: true,
27
+ ...(!passThrough && {
28
+ initial: props.initial ? void 0 : false,
29
+ onExitComplete: props.onExitComplete,
30
+ enterVariant: props.enterVariant,
31
+ exitVariant: props.exitVariant,
32
+ enterExitVariant: props.enterExitVariant,
33
+ // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
34
+ // but since we always re-render this component on open changes this should be fine to leave off?
35
+ presenceAffectsLayout: false,
36
+ isPresent: present,
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
+ });
51
+ }
52
+ export { Animate };
53
+ //# sourceMappingURL=Animate.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["jsx","_jsx","Fragment","_Fragment","AnimatePresence","PresenceChild","startTransition","useEffect","useState","Animate","param","children","lazyMount","type","present","passThrough","props","lazyMounted","setLazyMounted","mounted","keepChildrenMounted","isPresent","initial","onExitComplete","enterVariant","exitVariant","enterExitVariant","presenceAffectsLayout","custom"],"sources":["../../src/Animate.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,GAAA,IAAAC,IAAA,EAAAC,QAAiB,IAAAC,SAAA,QAAqB;AAC/C,SAASC,eAAA,EAAiBC,aAAW,oCAAgB;AA4D7C,SA2BCC,eA3BD,EAAAC,SAAA,EAAAC,QAAA;AAzBD,SAASC,QAAQC,KAAA;EACtB;IAAAC,QAAA;IAAAC,SAAA;IAAAC,IAAA;IAAAC,OAAA;IAAAC,WAAA;IAAA,GAAAC;EAAA,IAAAN,KAAA;EACA,KAAAO,WAAA,EAAAC,cAAA,IAAAV,QAAA,CAAAI,SAAA,WAAAE,OAAA;EACAP,SAAA;IACA,IAAAQ,WAAA;IACA,KAAAH,SAAA;IACA,IAAG,CAAAE,OAAA;IAC6BR,eAAA;MAChCY,cAAO,CAAAJ,OAAa;IAEpB;EACE,IACAF,SAAK,EACLE,OAAK,CACL;EACE,IAAAK,OAAA,IAAAL,OAAe,QAAO,GAAAF,SAAA,GAAAK,WAAA,GAAAH,OAAA;EAAA,IACvBD,IAAA;IACH,IAAIG,KAAA,CAAAI,mBAAmB;MAGvB,OAAM,eAAqBnB,IAAA,CAAAI,aAAQ,EAAY;QAE3CgB,SAAS;QACP,KAAAN,WAAM;UACRO,OACE,EAAAN,KAAA,CAAAM,OAAA;UAACC,cAAA,EAAAP,KAAA,CAAAO,cAAA;UAAAC,YAAA,EAAAR,KAAA,CAAAQ,YAAA;UACCC,WAAS,EAAAT,KAAA,CAAAS,WAAA;UACRC,gBAAK,EAAAV,KAAe,CAAAU,gBAAA;UAAA;UACkB;UACfC,qBACR,EAAM;UAAAN,SACpB,EAAAP,OAAa;UAAMc,MACnB,EAAAZ,KAAA,CAAAY;QAAwB;QAAAjB;MAAA;IAGD;IACZ,sBACGV,IAAA,CAAAG,eAAA;MAAAW,WAChB;MAAA,GAAAC,KAEC;MAAAL,QAAA,EAAAQ,OAAA,IAAAJ,WAAA,GAAAJ,QAAA;IAAA,EACH;EAAA;EAIJ,sBACEV,IAAA,CAAAE,SAAC;IAILQ;EAEA;AACF","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./Animate.mjs";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./Animate.mjs";
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./Animate.native.js";
2
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@hanzogui/animate",
3
+ "version": "2.0.0-rc.41-hanzoai.3",
4
+ "license": "MIT",
5
+ "source": "src/index.ts",
6
+ "files": [
7
+ "src",
8
+ "types",
9
+ "dist"
10
+ ],
11
+ "type": "module",
12
+ "sideEffects": [
13
+ "*.css"
14
+ ],
15
+ "main": "dist/cjs",
16
+ "module": "dist/esm",
17
+ "types": "./types/index.d.ts",
18
+ "exports": {
19
+ "./package.json": "./package.json",
20
+ ".": {
21
+ "types": "./types/index.d.ts",
22
+ "react-native": "./dist/esm/index.native.js",
23
+ "browser": "./dist/esm/index.mjs",
24
+ "module": "./dist/esm/index.mjs",
25
+ "import": "./dist/esm/index.mjs",
26
+ "require": "./dist/cjs/index.cjs",
27
+ "default": "./dist/esm/index.mjs"
28
+ }
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "scripts": {
34
+ "build": "hanzogui-build",
35
+ "watch": "hanzogui-build --watch",
36
+ "clean": "hanzogui-build clean",
37
+ "clean:build": "hanzogui-build clean:build"
38
+ },
39
+ "dependencies": {
40
+ "@hanzogui/animate-presence": "2.0.0-rc.41-hanzoai.3"
41
+ },
42
+ "devDependencies": {
43
+ "@hanzogui/build": "2.0.0-rc.41-hanzoai.3",
44
+ "react": ">=19"
45
+ },
46
+ "peerDependencies": {
47
+ "react": ">=19"
48
+ }
49
+ }
@@ -0,0 +1,91 @@
1
+ import type { AnimatePresenceProps } from '@hanzogui/animate-presence'
2
+ import { AnimatePresence, PresenceChild } from '@hanzogui/animate-presence'
3
+ import { startTransition, useEffect, useState } from 'react'
4
+
5
+ type BaseProps = {
6
+ children: React.ReactNode
7
+ passThrough?: boolean
8
+ }
9
+
10
+ type PresenceProps = AnimatePresenceProps & {
11
+ type: 'presence'
12
+ present: boolean
13
+ keepChildrenMounted?: boolean
14
+ lazyMount?: boolean
15
+ }
16
+
17
+ export type AnimateProps = BaseProps & PresenceProps
18
+
19
+ /**
20
+ * Because mounting and unmounting children can be expensive, this gives us the
21
+ * option to avoid that.
22
+ *
23
+ * type: 'presence' will act just like AnimatePresence, except you use `present`
24
+ * instead of conditional children.
25
+ * Note that this does avoid reconciling the children even when present={false}
26
+ * so no extra cost to perf over AnimatePresence.
27
+ *
28
+ * type: 'presence' with keepChildrenMounted true *always* render the children so you pay
29
+ * the cost up-front to mount them, but then you avoid the mount cost at the start
30
+ * of the animation.
31
+ *
32
+ * There's no "right way" it just depends on the use case, this component just makes
33
+ * it easier to choose the strategy yourself.
34
+ *
35
+ *
36
+ */
37
+
38
+ export function Animate({
39
+ children,
40
+ lazyMount,
41
+ type,
42
+ present,
43
+ passThrough,
44
+ ...props
45
+ }: AnimateProps): React.ReactNode {
46
+ const [lazyMounted, setLazyMounted] = useState(lazyMount ? false : present)
47
+
48
+ useEffect(() => {
49
+ if (passThrough) return
50
+ if (!lazyMount) return
51
+ if (!present) return
52
+ startTransition(() => {
53
+ setLazyMounted(present)
54
+ })
55
+ }, [lazyMount, present])
56
+
57
+ // always immediately unmount
58
+ const mounted = !present ? false : lazyMount ? lazyMounted : present
59
+
60
+ if (type === 'presence') {
61
+ if (props.keepChildrenMounted) {
62
+ return (
63
+ <PresenceChild
64
+ isPresent
65
+ {...(!passThrough && {
66
+ initial: props.initial ? undefined : false,
67
+ onExitComplete: props.onExitComplete,
68
+ enterVariant: props.enterVariant,
69
+ exitVariant: props.exitVariant,
70
+ enterExitVariant: props.enterExitVariant,
71
+ // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
72
+ // but since we always re-render this component on open changes this should be fine to leave off?
73
+ presenceAffectsLayout: false,
74
+ isPresent: present,
75
+ custom: props.custom,
76
+ })}
77
+ >
78
+ {children as any}
79
+ </PresenceChild>
80
+ )
81
+ }
82
+
83
+ return (
84
+ <AnimatePresence passThrough={passThrough} {...props}>
85
+ {mounted || passThrough ? children : null}
86
+ </AnimatePresence>
87
+ )
88
+ }
89
+
90
+ return <>{children}</>
91
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './Animate'
@@ -0,0 +1,34 @@
1
+ import type { AnimatePresenceProps } from "@hanzogui/animate-presence";
2
+ type BaseProps = {
3
+ children: React.ReactNode;
4
+ passThrough?: boolean;
5
+ };
6
+ type PresenceProps = AnimatePresenceProps & {
7
+ type: "presence";
8
+ present: boolean;
9
+ keepChildrenMounted?: boolean;
10
+ lazyMount?: boolean;
11
+ };
12
+ export type AnimateProps = BaseProps & PresenceProps;
13
+ /**
14
+ * Because mounting and unmounting children can be expensive, this gives us the
15
+ * option to avoid that.
16
+ *
17
+ * type: 'presence' will act just like AnimatePresence, except you use `present`
18
+ * instead of conditional children.
19
+ * Note that this does avoid reconciling the children even when present={false}
20
+ * so no extra cost to perf over AnimatePresence.
21
+ *
22
+ * type: 'presence' with keepChildrenMounted true *always* render the children so you pay
23
+ * the cost up-front to mount them, but then you avoid the mount cost at the start
24
+ * of the animation.
25
+ *
26
+ * There's no "right way" it just depends on the use case, this component just makes
27
+ * it easier to choose the strategy yourself.
28
+ *
29
+ *
30
+ */
31
+ export declare function Animate({ children, lazyMount, type, present, passThrough, ...props }: AnimateProps): React.ReactNode;
32
+ export {};
33
+
34
+ //# sourceMappingURL=Animate.d.ts.map
@@ -0,0 +1,11 @@
1
+ {
2
+ "mappings": "AAAA,cAAc,4BAA4B;KAIrC,YAAY;CACf,UAAU,MAAM;CAChB;;KAGG,gBAAgB,uBAAuB;CAC1C,MAAM;CACN;CACA;CACA;;AAGF,YAAY,eAAe,YAAY;;;;;;;;;;;;;;;;;;;AAqBvC,OAAO,iBAAS,QAAQ,EACtB,UACA,WACA,MACA,SACA,aACA,GAAG,SACF,eAAe,MAAM",
3
+ "names": [],
4
+ "sources": [
5
+ "src/Animate.tsx"
6
+ ],
7
+ "version": 3,
8
+ "sourcesContent": [
9
+ "import type { AnimatePresenceProps } from '@hanzogui/animate-presence'\nimport { AnimatePresence, PresenceChild } from '@hanzogui/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 enterVariant: props.enterVariant,\n exitVariant: props.exitVariant,\n enterExitVariant: props.enterExitVariant,\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
+ ]
11
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./Animate";
2
+
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,11 @@
1
+ {
2
+ "mappings": "AAAA,cAAc",
3
+ "names": [],
4
+ "sources": [
5
+ "src/index.ts"
6
+ ],
7
+ "version": 3,
8
+ "sourcesContent": [
9
+ "export * from './Animate'\n"
10
+ ]
11
+ }