@tamagui/animate-presence 1.0.1-beta.21 → 1.0.1-beta.211

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.
Files changed (71) hide show
  1. package/dist/cjs/AnimatePresence.js +81 -54
  2. package/dist/cjs/AnimatePresence.js.map +3 -3
  3. package/dist/cjs/LayoutGroupContext.js +1 -0
  4. package/dist/cjs/LayoutGroupContext.js.map +1 -1
  5. package/dist/cjs/PresenceChild.js +43 -38
  6. package/dist/cjs/PresenceChild.js.map +3 -3
  7. package/dist/cjs/{AnimatePresenceContext.js → PresenceContext.js} +8 -7
  8. package/dist/cjs/PresenceContext.js.map +7 -0
  9. package/dist/cjs/index.js +2 -13
  10. package/dist/cjs/index.js.map +2 -2
  11. package/dist/cjs/types.js +1 -0
  12. package/dist/cjs/types.js.map +2 -2
  13. package/dist/cjs/usePresence.js +52 -0
  14. package/dist/cjs/usePresence.js.map +7 -0
  15. package/dist/esm/AnimatePresence.js +79 -57
  16. package/dist/esm/AnimatePresence.js.map +2 -2
  17. package/dist/esm/LayoutGroupContext.js +0 -0
  18. package/dist/esm/LayoutGroupContext.js.map +1 -1
  19. package/dist/esm/PresenceChild.js +38 -38
  20. package/dist/esm/PresenceChild.js.map +3 -3
  21. package/dist/esm/PresenceContext.js +6 -0
  22. package/dist/esm/PresenceContext.js.map +7 -0
  23. package/dist/esm/index.js +1 -5
  24. package/dist/esm/index.js.map +2 -2
  25. package/dist/esm/types.js +0 -0
  26. package/dist/esm/types.js.map +0 -0
  27. package/dist/esm/usePresence.js +26 -0
  28. package/dist/esm/usePresence.js.map +7 -0
  29. package/dist/jsx/AnimatePresence.js +56 -38
  30. package/dist/jsx/AnimatePresence.js.map +7 -0
  31. package/dist/jsx/LayoutGroupContext.js +1 -0
  32. package/dist/jsx/LayoutGroupContext.js.map +7 -0
  33. package/dist/jsx/PresenceChild.js +35 -36
  34. package/dist/jsx/PresenceChild.js.map +7 -0
  35. package/dist/jsx/PresenceContext.js +6 -0
  36. package/dist/jsx/PresenceContext.js.map +7 -0
  37. package/dist/jsx/index.js +2 -5
  38. package/dist/jsx/index.js.map +7 -0
  39. package/dist/jsx/types.js +1 -0
  40. package/dist/jsx/types.js.map +7 -0
  41. package/dist/jsx/usePresence.js +26 -0
  42. package/dist/jsx/usePresence.js.map +7 -0
  43. package/package.json +10 -5
  44. package/src/AnimatePresence.tsx +275 -0
  45. package/src/LayoutGroupContext.tsx +8 -0
  46. package/src/PresenceChild.tsx +81 -0
  47. package/src/index.ts +2 -0
  48. package/src/types.ts +81 -0
  49. package/types/AnimatePresence.d.ts +34 -8
  50. package/types/PresenceChild.d.ts +4 -3
  51. package/types/{AnimatePresenceContext.d.ts → PresenceContext.d.ts} +5 -4
  52. package/types/index.d.ts +1 -2
  53. package/types/types.d.ts +63 -0
  54. package/types/usePresence.d.ts +14 -0
  55. package/dist/cjs/AnimatePresenceContext.js.map +0 -7
  56. package/dist/cjs/useEntering.js +0 -57
  57. package/dist/cjs/useEntering.js.map +0 -7
  58. package/dist/esm/AnimatePresenceContext.js +0 -6
  59. package/dist/esm/AnimatePresenceContext.js.map +0 -7
  60. package/dist/esm/useEntering.js +0 -33
  61. package/dist/esm/useEntering.js.map +0 -7
  62. package/dist/jsx/AnimatePresenceContext.js +0 -5
  63. package/dist/jsx/useEntering.js +0 -32
  64. package/types/AnimatePresence.d.ts.map +0 -1
  65. package/types/AnimatePresenceContext.d.ts.map +0 -1
  66. package/types/LayoutGroupContext.d.ts.map +0 -1
  67. package/types/PresenceChild.d.ts.map +0 -1
  68. package/types/index.d.ts.map +0 -1
  69. package/types/types.d.ts.map +0 -1
  70. package/types/useEntering.d.ts +0 -6
  71. package/types/useEntering.d.ts.map +0 -1
package/src/types.ts ADDED
@@ -0,0 +1,81 @@
1
+ export interface Axis {
2
+ min: number
3
+ max: number
4
+ }
5
+
6
+ export interface Box {
7
+ x: Axis
8
+ y: Axis
9
+ }
10
+
11
+ export type VariantLabels = string | string[]
12
+
13
+ /**
14
+ * @public
15
+ */
16
+ export interface AnimatePresenceProps {
17
+ /**
18
+ * By passing `initial={false}`, `AnimatePresence` will disable any initial animations on children
19
+ * that are present when the component is first rendered.
20
+ *
21
+ * ```jsx
22
+ * <AnimatePresence initial={false}>
23
+ * {isVisible && (
24
+ * <motion.div
25
+ * key="modal"
26
+ * initial={{ opacity: 0 }}
27
+ * animate={{ opacity: 1 }}
28
+ * exit={{ opacity: 0 }}
29
+ * />
30
+ * )}
31
+ * </AnimatePresence>
32
+ * ```
33
+ *
34
+ * @public
35
+ */
36
+ initial?: boolean
37
+
38
+ /**
39
+ * When a component is removed, there's no longer a chance to update its props. So if a component's `exit`
40
+ * prop is defined as a dynamic variant and you want to pass a new `custom` prop, you can do so via `AnimatePresence`.
41
+ * This will ensure all leaving components animate using the latest data.
42
+ *
43
+ * @public
44
+ */
45
+ custom?: any
46
+
47
+ /**
48
+ * Fires when all exiting nodes have completed animating out.
49
+ *
50
+ * @public
51
+ */
52
+ onExitComplete?: () => void
53
+
54
+ /**
55
+ * If set to `true`, `AnimatePresence` will only render one component at a time. The exiting component
56
+ * will finish its exit animation before the entering component is rendered.
57
+ *
58
+ * ```jsx
59
+ * const MyComponent = ({ currentItem }) => (
60
+ * <AnimatePresence exitBeforeEnter>
61
+ * <motion.div key={currentItem} exit={{ opacity: 0 }} />
62
+ * </AnimatePresence>
63
+ * )
64
+ * ```
65
+ *
66
+ * @beta
67
+ */
68
+ exitBeforeEnter?: boolean
69
+
70
+ /**
71
+ * Used in Framer to flag that sibling children *shouldn't* re-render as a result of a
72
+ * child being removed.
73
+ *
74
+ * @internal
75
+ */
76
+ presenceAffectsLayout?: boolean
77
+
78
+ exitVariant?: string | null
79
+
80
+ enterVariant?: string | null
81
+ }
@@ -1,11 +1,37 @@
1
1
  import React from 'react';
2
- export interface AnimatePresenceProps {
3
- initial?: boolean;
4
- exitVariant?: string | null;
5
- enterVariant?: string | null;
6
- onExitComplete?: () => void;
7
- exitBeforeEnter?: boolean;
8
- presenceAffectsLayout?: boolean;
9
- }
2
+ import { AnimatePresenceProps } from './types';
3
+ /**
4
+ * `AnimatePresence` enables the animation of components that have been removed from the tree.
5
+ *
6
+ * When adding/removing more than a single child, every child **must** be given a unique `key` prop.
7
+ *
8
+ * Any `motion` components that have an `exit` property defined will animate out when removed from
9
+ * the tree.
10
+ *
11
+ * ```tsx
12
+ * import { motion, AnimatePresence } from 'framer-motion'
13
+ *
14
+ * export const Items = ({ items }) => (
15
+ * <AnimatePresence>
16
+ * {items.map(item => (
17
+ * <motion.div
18
+ * key={item.id}
19
+ * initial={{ opacity: 0 }}
20
+ * animate={{ opacity: 1 }}
21
+ * exit={{ opacity: 0 }}
22
+ * />
23
+ * ))}
24
+ * </AnimatePresence>
25
+ * )
26
+ * ```
27
+ *
28
+ * You can sequence exit animations throughout a tree using variants.
29
+ *
30
+ * If a child contains multiple `motion` components with `exit` props, it will only unmount the child
31
+ * once all `motion` components have finished animating out. Likewise, any components using
32
+ * `usePresence` all need to call `safeToRemove`.
33
+ *
34
+ * @public
35
+ */
10
36
  export declare const AnimatePresence: React.FunctionComponent<React.PropsWithChildren<AnimatePresenceProps>>;
11
37
  //# sourceMappingURL=AnimatePresence.d.ts.map
@@ -2,13 +2,14 @@ import * as React from 'react';
2
2
  import { VariantLabels } from './types';
3
3
  interface PresenceChildProps {
4
4
  children: React.ReactElement<any>;
5
- isEntering: boolean | undefined;
5
+ isPresent: boolean;
6
6
  onExitComplete?: () => void;
7
7
  initial?: false | VariantLabels;
8
+ custom?: any;
9
+ presenceAffectsLayout: boolean;
8
10
  exitVariant?: string | null;
9
11
  enterVariant?: string | null;
10
- presenceAffectsLayout: boolean;
11
12
  }
12
- export declare const PresenceChild: ({ children, initial, isEntering, onExitComplete, exitVariant, enterVariant, presenceAffectsLayout, }: PresenceChildProps) => JSX.Element;
13
+ export declare const PresenceChild: ({ children, initial, isPresent, onExitComplete, exitVariant, enterVariant, presenceAffectsLayout, }: PresenceChildProps) => JSX.Element;
13
14
  export {};
14
15
  //# sourceMappingURL=PresenceChild.d.ts.map
@@ -1,13 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  import { VariantLabels } from './types';
3
- export interface AnimatePresenceContextProps {
3
+ export interface PresenceContextProps {
4
4
  id: string;
5
- isEntering: boolean | undefined;
5
+ isPresent: boolean;
6
6
  register: (id: string) => () => void;
7
7
  onExitComplete?: (id: string) => void;
8
8
  initial?: false | VariantLabels;
9
+ custom?: any;
9
10
  exitVariant?: string | null;
10
11
  enterVariant?: string | null;
11
12
  }
12
- export declare const AnimatePresenceContext: import("react").Context<AnimatePresenceContextProps | null>;
13
- //# sourceMappingURL=AnimatePresenceContext.d.ts.map
13
+ export declare const PresenceContext: import("react").Context<PresenceContextProps | null>;
14
+ //# sourceMappingURL=PresenceContext.d.ts.map
package/types/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from './AnimatePresence';
2
- export * from './useEntering';
3
- export { AnimatePresenceContext } from './AnimatePresenceContext';
2
+ export * from '@tamagui/use-presence';
4
3
  //# sourceMappingURL=index.d.ts.map
package/types/types.d.ts CHANGED
@@ -7,4 +7,67 @@ export interface Box {
7
7
  y: Axis;
8
8
  }
9
9
  export declare type VariantLabels = string | string[];
10
+ /**
11
+ * @public
12
+ */
13
+ export interface AnimatePresenceProps {
14
+ /**
15
+ * By passing `initial={false}`, `AnimatePresence` will disable any initial animations on children
16
+ * that are present when the component is first rendered.
17
+ *
18
+ * ```jsx
19
+ * <AnimatePresence initial={false}>
20
+ * {isVisible && (
21
+ * <motion.div
22
+ * key="modal"
23
+ * initial={{ opacity: 0 }}
24
+ * animate={{ opacity: 1 }}
25
+ * exit={{ opacity: 0 }}
26
+ * />
27
+ * )}
28
+ * </AnimatePresence>
29
+ * ```
30
+ *
31
+ * @public
32
+ */
33
+ initial?: boolean;
34
+ /**
35
+ * When a component is removed, there's no longer a chance to update its props. So if a component's `exit`
36
+ * prop is defined as a dynamic variant and you want to pass a new `custom` prop, you can do so via `AnimatePresence`.
37
+ * This will ensure all leaving components animate using the latest data.
38
+ *
39
+ * @public
40
+ */
41
+ custom?: any;
42
+ /**
43
+ * Fires when all exiting nodes have completed animating out.
44
+ *
45
+ * @public
46
+ */
47
+ onExitComplete?: () => void;
48
+ /**
49
+ * If set to `true`, `AnimatePresence` will only render one component at a time. The exiting component
50
+ * will finish its exit animation before the entering component is rendered.
51
+ *
52
+ * ```jsx
53
+ * const MyComponent = ({ currentItem }) => (
54
+ * <AnimatePresence exitBeforeEnter>
55
+ * <motion.div key={currentItem} exit={{ opacity: 0 }} />
56
+ * </AnimatePresence>
57
+ * )
58
+ * ```
59
+ *
60
+ * @beta
61
+ */
62
+ exitBeforeEnter?: boolean;
63
+ /**
64
+ * Used in Framer to flag that sibling children *shouldn't* re-render as a result of a
65
+ * child being removed.
66
+ *
67
+ * @internal
68
+ */
69
+ presenceAffectsLayout?: boolean;
70
+ exitVariant?: string | null;
71
+ enterVariant?: string | null;
72
+ }
10
73
  //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { PresenceContextProps } from './PresenceContext';
2
+ export declare type SafeToRemove = () => void;
3
+ declare type AlwaysPresent = [true, null];
4
+ declare type Present = [true];
5
+ declare type NotPresent = [false, SafeToRemove];
6
+ export declare function usePresence(): AlwaysPresent | Present | NotPresent;
7
+ /**
8
+ * Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present.
9
+ * There is no `safeToRemove` function. ```
10
+ */
11
+ export declare function useIsPresent(): boolean;
12
+ export declare function isPresent(context: PresenceContextProps | null): boolean;
13
+ export {};
14
+ //# sourceMappingURL=usePresence.d.ts.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/AnimatePresenceContext.tsx"],
4
- "sourcesContent": ["import { createContext } from 'react'\n\nimport { VariantLabels } from './types'\n\nexport interface AnimatePresenceContextProps {\n id: string\n isEntering: boolean | undefined\n register: (id: string) => () => void\n onExitComplete?: (id: string) => void\n initial?: false | VariantLabels\n exitVariant?: string | null\n enterVariant?: string | null\n}\n\nexport const AnimatePresenceContext = createContext<AnimatePresenceContextProps | null>(null)\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8B;AAcvB,MAAM,yBAAyB,gCAAkD,IAAI;",
6
- "names": []
7
- }
@@ -1,57 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var useEntering_exports = {};
20
- __export(useEntering_exports, {
21
- isEntering: () => isEntering,
22
- useEntering: () => useEntering,
23
- useIsEntering: () => useIsEntering
24
- });
25
- module.exports = __toCommonJS(useEntering_exports);
26
- var import_core = require("@tamagui/core");
27
- var import_react = require("react");
28
- var import_AnimatePresenceContext = require("./AnimatePresenceContext");
29
- function useEntering() {
30
- const context = (0, import_react.useContext)(import_AnimatePresenceContext.AnimatePresenceContext);
31
- if (context === null) {
32
- return [void 0, void 0];
33
- }
34
- const { isEntering: isEntering2, onExitComplete, register } = context;
35
- const id = (0, import_core.useId)();
36
- const safeToRemove = /* @__PURE__ */ __name(() => onExitComplete == null ? void 0 : onExitComplete(id), "safeToRemove");
37
- (0, import_react.useEffect)(() => {
38
- register(id);
39
- }, []);
40
- return isEntering2 === false ? [false, safeToRemove] : isEntering2 === true ? [true, safeToRemove] : [void 0, safeToRemove];
41
- }
42
- __name(useEntering, "useEntering");
43
- function useIsEntering() {
44
- return isEntering((0, import_react.useContext)(import_AnimatePresenceContext.AnimatePresenceContext));
45
- }
46
- __name(useIsEntering, "useIsEntering");
47
- function isEntering(context) {
48
- return context === null ? void 0 : context.isEntering;
49
- }
50
- __name(isEntering, "isEntering");
51
- // Annotate the CommonJS export names for ESM import in node:
52
- 0 && (module.exports = {
53
- isEntering,
54
- useEntering,
55
- useIsEntering
56
- });
57
- //# sourceMappingURL=useEntering.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/useEntering.ts"],
4
- "sourcesContent": ["import { useId } from '@tamagui/core'\nimport { useContext, useEffect } from 'react'\n\nimport { AnimatePresenceContext, AnimatePresenceContextProps } from './AnimatePresenceContext'\n\nexport type SafeToRemove = () => void\n\nexport function useEntering(): [boolean | undefined, undefined | (() => void)] {\n const context = useContext(AnimatePresenceContext)\n\n if (context === null) {\n return [undefined, undefined]\n }\n\n const { isEntering, onExitComplete, register } = context\n const id = useId()\n const safeToRemove = () => onExitComplete?.(id)\n\n // It's safe to call the following hooks conditionally (after an early return) because the context will always\n // either be null or non-null for the lifespan of the component.\n\n useEffect(() => {\n register(id)\n }, [])\n\n return isEntering === false\n ? [false, safeToRemove]\n : isEntering === true\n ? [true, safeToRemove]\n : [undefined, safeToRemove]\n}\n\n/**\n * Similar to `useEntering`, except `useIsEntering` simply returns whether or not the component is present.\n * There is no `safeToRemove` function. ```\n */\nexport function useIsEntering() {\n return isEntering(useContext(AnimatePresenceContext))\n}\n\nexport function isEntering(context: AnimatePresenceContextProps | null) {\n return context === null ? undefined : context.isEntering\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAsB;AACtB,mBAAsC;AAEtC,oCAAoE;AAI7D,uBAAwE;AAC7E,QAAM,UAAU,6BAAW,oDAAsB;AAEjD,MAAI,YAAY,MAAM;AACpB,WAAO,CAAC,QAAW,MAAS;AAAA,EAC9B;AAEA,QAAM,EAAE,yBAAY,gBAAgB,aAAa;AACjD,QAAM,KAAK,uBAAM;AACjB,QAAM,eAAe,6BAAM,iDAAiB,KAAvB;AAKrB,8BAAU,MAAM;AACd,aAAS,EAAE;AAAA,EACb,GAAG,CAAC,CAAC;AAEL,SAAO,gBAAe,QAClB,CAAC,OAAO,YAAY,IACpB,gBAAe,OACf,CAAC,MAAM,YAAY,IACnB,CAAC,QAAW,YAAY;AAC9B;AAvBgB;AA6BT,yBAAyB;AAC9B,SAAO,WAAW,6BAAW,oDAAsB,CAAC;AACtD;AAFgB;AAIT,oBAAoB,SAA6C;AACtE,SAAO,YAAY,OAAO,SAAY,QAAQ;AAChD;AAFgB;",
6
- "names": []
7
- }
@@ -1,6 +0,0 @@
1
- import { createContext } from "react";
2
- const AnimatePresenceContext = createContext(null);
3
- export {
4
- AnimatePresenceContext
5
- };
6
- //# sourceMappingURL=AnimatePresenceContext.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/AnimatePresenceContext.tsx"],
4
- "sourcesContent": ["import { createContext } from 'react'\n\nimport { VariantLabels } from './types'\n\nexport interface AnimatePresenceContextProps {\n id: string\n isEntering: boolean | undefined\n register: (id: string) => () => void\n onExitComplete?: (id: string) => void\n initial?: false | VariantLabels\n exitVariant?: string | null\n enterVariant?: string | null\n}\n\nexport const AnimatePresenceContext = createContext<AnimatePresenceContextProps | null>(null)\n"],
5
- "mappings": "AAAA;AAcO,MAAM,yBAAyB,cAAkD,IAAI;",
6
- "names": []
7
- }
@@ -1,33 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { useId } from "@tamagui/core";
4
- import { useContext, useEffect } from "react";
5
- import { AnimatePresenceContext } from "./AnimatePresenceContext";
6
- function useEntering() {
7
- const context = useContext(AnimatePresenceContext);
8
- if (context === null) {
9
- return [void 0, void 0];
10
- }
11
- const { isEntering: isEntering2, onExitComplete, register } = context;
12
- const id = useId();
13
- const safeToRemove = /* @__PURE__ */ __name(() => onExitComplete == null ? void 0 : onExitComplete(id), "safeToRemove");
14
- useEffect(() => {
15
- register(id);
16
- }, []);
17
- return isEntering2 === false ? [false, safeToRemove] : isEntering2 === true ? [true, safeToRemove] : [void 0, safeToRemove];
18
- }
19
- __name(useEntering, "useEntering");
20
- function useIsEntering() {
21
- return isEntering(useContext(AnimatePresenceContext));
22
- }
23
- __name(useIsEntering, "useIsEntering");
24
- function isEntering(context) {
25
- return context === null ? void 0 : context.isEntering;
26
- }
27
- __name(isEntering, "isEntering");
28
- export {
29
- isEntering,
30
- useEntering,
31
- useIsEntering
32
- };
33
- //# sourceMappingURL=useEntering.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/useEntering.ts"],
4
- "sourcesContent": ["import { useId } from '@tamagui/core'\nimport { useContext, useEffect } from 'react'\n\nimport { AnimatePresenceContext, AnimatePresenceContextProps } from './AnimatePresenceContext'\n\nexport type SafeToRemove = () => void\n\nexport function useEntering(): [boolean | undefined, undefined | (() => void)] {\n const context = useContext(AnimatePresenceContext)\n\n if (context === null) {\n return [undefined, undefined]\n }\n\n const { isEntering, onExitComplete, register } = context\n const id = useId()\n const safeToRemove = () => onExitComplete?.(id)\n\n // It's safe to call the following hooks conditionally (after an early return) because the context will always\n // either be null or non-null for the lifespan of the component.\n\n useEffect(() => {\n register(id)\n }, [])\n\n return isEntering === false\n ? [false, safeToRemove]\n : isEntering === true\n ? [true, safeToRemove]\n : [undefined, safeToRemove]\n}\n\n/**\n * Similar to `useEntering`, except `useIsEntering` simply returns whether or not the component is present.\n * There is no `safeToRemove` function. ```\n */\nexport function useIsEntering() {\n return isEntering(useContext(AnimatePresenceContext))\n}\n\nexport function isEntering(context: AnimatePresenceContextProps | null) {\n return context === null ? undefined : context.isEntering\n}\n"],
5
- "mappings": ";;AAAA;AACA;AAEA;AAIO,uBAAwE;AAC7E,QAAM,UAAU,WAAW,sBAAsB;AAEjD,MAAI,YAAY,MAAM;AACpB,WAAO,CAAC,QAAW,MAAS;AAAA,EAC9B;AAEA,QAAM,EAAE,yBAAY,gBAAgB,aAAa;AACjD,QAAM,KAAK,MAAM;AACjB,QAAM,eAAe,6BAAM,iDAAiB,KAAvB;AAKrB,YAAU,MAAM;AACd,aAAS,EAAE;AAAA,EACb,GAAG,CAAC,CAAC;AAEL,SAAO,gBAAe,QAClB,CAAC,OAAO,YAAY,IACpB,gBAAe,OACf,CAAC,MAAM,YAAY,IACnB,CAAC,QAAW,YAAY;AAC9B;AAvBgB;AA6BT,yBAAyB;AAC9B,SAAO,WAAW,WAAW,sBAAsB,CAAC;AACtD;AAFgB;AAIT,oBAAoB,SAA6C;AACtE,SAAO,YAAY,OAAO,SAAY,QAAQ;AAChD;AAFgB;",
6
- "names": []
7
- }
@@ -1,5 +0,0 @@
1
- import { createContext } from "react";
2
- const AnimatePresenceContext = createContext(null);
3
- export {
4
- AnimatePresenceContext
5
- };
@@ -1,32 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { useId } from "@tamagui/core";
4
- import { useContext, useEffect } from "react";
5
- import { AnimatePresenceContext } from "./AnimatePresenceContext";
6
- function useEntering() {
7
- const context = useContext(AnimatePresenceContext);
8
- if (context === null) {
9
- return [void 0, void 0];
10
- }
11
- const { isEntering: isEntering2, onExitComplete, register } = context;
12
- const id = useId();
13
- const safeToRemove = /* @__PURE__ */ __name(() => onExitComplete == null ? void 0 : onExitComplete(id), "safeToRemove");
14
- useEffect(() => {
15
- register(id);
16
- }, []);
17
- return isEntering2 === false ? [false, safeToRemove] : isEntering2 === true ? [true, safeToRemove] : [void 0, safeToRemove];
18
- }
19
- __name(useEntering, "useEntering");
20
- function useIsEntering() {
21
- return isEntering(useContext(AnimatePresenceContext));
22
- }
23
- __name(useIsEntering, "useIsEntering");
24
- function isEntering(context) {
25
- return context === null ? void 0 : context.isEntering;
26
- }
27
- __name(isEntering, "isEntering");
28
- export {
29
- isEntering,
30
- useEntering,
31
- useIsEntering
32
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnimatePresence.d.ts","sourceRoot":"","sources":["../src/AnimatePresence.tsx"],"names":[],"mappings":"AACA,OAAO,KASN,MAAM,OAAO,CAAA;AAOd,MAAM,WAAW,oBAAoB;IAKnC,OAAO,CAAC,EAAE,OAAO,CAAA;IAOjB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAE3B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAK5B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAA;IAM3B,eAAe,CAAC,EAAE,OAAO,CAAA;IAMzB,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC;AAuED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,iBAAiB,CACnD,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAwK9C,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnimatePresenceContext.d.ts","sourceRoot":"","sources":["../src/AnimatePresenceContext.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,IAAI,CAAA;IACpC,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,OAAO,CAAC,EAAE,KAAK,GAAG,aAAa,CAAA;IAC/B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B;AAED,eAAO,MAAM,sBAAsB,6DAA0D,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LayoutGroupContext.d.ts","sourceRoot":"","sources":["../src/LayoutGroupContext.tsx"],"names":[],"mappings":";AAEA,MAAM,WAAW,uBAAuB;IACtC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,WAAW,CAAC,EAAE,YAAY,CAAA;CAC3B;AAED,eAAO,MAAM,kBAAkB,kDAA6C,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PresenceChild.d.ts","sourceRoot":"","sources":["../src/PresenceChild.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IACjC,UAAU,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAA;IAC3B,OAAO,CAAC,EAAE,KAAK,GAAG,aAAa,CAAA;IAC/B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,qBAAqB,EAAE,OAAO,CAAA;CAC/B;AAED,eAAO,MAAM,aAAa,yGAQvB,kBAAkB,gBAqDpB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,IAAI,CAAA;IACP,CAAC,EAAE,IAAI,CAAA;CACR;AAED,oBAAY,aAAa,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA"}
@@ -1,6 +0,0 @@
1
- import { AnimatePresenceContextProps } from './AnimatePresenceContext';
2
- export declare type SafeToRemove = () => void;
3
- export declare function useEntering(): [boolean | undefined, undefined | (() => void)];
4
- export declare function useIsEntering(): boolean | undefined;
5
- export declare function isEntering(context: AnimatePresenceContextProps | null): boolean | undefined;
6
- //# sourceMappingURL=useEntering.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useEntering.d.ts","sourceRoot":"","sources":["../src/useEntering.ts"],"names":[],"mappings":"AAGA,OAAO,EAA0B,2BAA2B,EAAE,MAAM,0BAA0B,CAAA;AAE9F,oBAAY,YAAY,GAAG,MAAM,IAAI,CAAA;AAErC,wBAAgB,WAAW,IAAI,CAAC,OAAO,GAAG,SAAS,EAAE,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAuB7E;AAMD,wBAAgB,aAAa,wBAE5B;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI,uBAErE"}