@tamagui/animate-presence 1.0.0-beta.8 → 1.0.1-beta.100

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 (69) hide show
  1. package/dist/cjs/AnimatePresence.js +21 -17
  2. package/dist/cjs/AnimatePresence.js.map +2 -2
  3. package/dist/cjs/PresenceChild.js +16 -20
  4. package/dist/cjs/PresenceChild.js.map +2 -2
  5. package/dist/cjs/{AnimatePresenceContext.js → PresenceContext.js} +7 -7
  6. package/dist/cjs/PresenceContext.js.map +7 -0
  7. package/dist/cjs/index.js +4 -4
  8. package/dist/cjs/index.js.map +2 -2
  9. package/dist/cjs/types.js.map +1 -1
  10. package/dist/cjs/usePresence.js +51 -0
  11. package/dist/cjs/usePresence.js.map +7 -0
  12. package/dist/esm/AnimatePresence.js +28 -21
  13. package/dist/esm/AnimatePresence.js.map +2 -2
  14. package/dist/esm/PresenceChild.js +16 -21
  15. package/dist/esm/PresenceChild.js.map +2 -2
  16. package/dist/esm/PresenceContext.js +6 -0
  17. package/dist/esm/PresenceContext.js.map +7 -0
  18. package/dist/esm/index.js +3 -3
  19. package/dist/esm/index.js.map +1 -1
  20. package/dist/esm/usePresence.js +26 -0
  21. package/dist/esm/usePresence.js.map +7 -0
  22. package/dist/jsx/AnimatePresence.js +29 -21
  23. package/dist/jsx/AnimatePresence.js.map +7 -0
  24. package/dist/jsx/LayoutGroupContext.js +1 -0
  25. package/dist/jsx/LayoutGroupContext.js.map +7 -0
  26. package/dist/jsx/PresenceChild.js +17 -21
  27. package/dist/jsx/PresenceChild.js.map +7 -0
  28. package/dist/jsx/PresenceContext.js +6 -0
  29. package/dist/jsx/PresenceContext.js.map +7 -0
  30. package/dist/jsx/index.js +4 -3
  31. package/dist/jsx/index.js.map +7 -0
  32. package/dist/jsx/types.js +1 -0
  33. package/dist/jsx/types.js.map +7 -0
  34. package/dist/jsx/usePresence.js +26 -0
  35. package/dist/jsx/usePresence.js.map +7 -0
  36. package/package.json +9 -5
  37. package/src/AnimatePresence.tsx +271 -0
  38. package/src/LayoutGroupContext.tsx +8 -0
  39. package/src/PresenceChild.tsx +78 -0
  40. package/src/PresenceContext.tsx +16 -0
  41. package/src/index.ts +3 -0
  42. package/src/types.ts +81 -0
  43. package/src/usePresence.ts +37 -0
  44. package/types/AnimatePresence.d.ts +1 -8
  45. package/types/AnimatePresence.d.ts.map +1 -1
  46. package/types/LayoutGroupContext.d.ts +0 -0
  47. package/types/LayoutGroupContext.d.ts.map +0 -0
  48. package/types/PresenceChild.d.ts +4 -3
  49. package/types/PresenceChild.d.ts.map +1 -1
  50. package/types/{AnimatePresenceContext.d.ts → PresenceContext.d.ts} +5 -4
  51. package/types/PresenceContext.d.ts.map +1 -0
  52. package/types/index.d.ts +2 -2
  53. package/types/index.d.ts.map +1 -1
  54. package/types/types.d.ts +9 -0
  55. package/types/types.d.ts.map +1 -1
  56. package/types/usePresence.d.ts +10 -0
  57. package/types/usePresence.d.ts.map +1 -0
  58. package/dist/cjs/AnimatePresenceContext.js.map +0 -7
  59. package/dist/cjs/useEntering.js +0 -57
  60. package/dist/cjs/useEntering.js.map +0 -7
  61. package/dist/esm/AnimatePresenceContext.js +0 -6
  62. package/dist/esm/AnimatePresenceContext.js.map +0 -7
  63. package/dist/esm/useEntering.js +0 -33
  64. package/dist/esm/useEntering.js.map +0 -7
  65. package/dist/jsx/AnimatePresenceContext.js +0 -5
  66. package/dist/jsx/useEntering.js +0 -32
  67. package/types/AnimatePresenceContext.d.ts.map +0 -1
  68. package/types/useEntering.d.ts +0 -6
  69. package/types/useEntering.d.ts.map +0 -1
@@ -4,7 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -29,7 +28,7 @@ var import_react = __toESM(require("react"));
29
28
  var import_LayoutGroupContext = require("./LayoutGroupContext");
30
29
  var import_PresenceChild = require("./PresenceChild");
31
30
  import_react.default["keep"];
32
- const getChildKey = /* @__PURE__ */ __name((child) => child.key || "", "getChildKey");
31
+ const getChildKey = (child) => child.key || "";
33
32
  const isDev = process.env.NODE_ENV !== "production";
34
33
  function updateChildLookup(children, allChildren) {
35
34
  const seenChildren = isDev ? /* @__PURE__ */ new Set() : null;
@@ -42,17 +41,25 @@ function updateChildLookup(children, allChildren) {
42
41
  allChildren.set(key, child);
43
42
  });
44
43
  }
45
- __name(updateChildLookup, "updateChildLookup");
46
44
  function onlyElements(children) {
47
45
  const filtered = [];
48
- import_react.Children.forEach(children, (child) => {
49
- if ((0, import_react.isValidElement)(child))
50
- filtered.push(child);
46
+ import_react.Children.forEach(children, (child, index) => {
47
+ if ((0, import_react.isValidElement)(child)) {
48
+ if (!child.key) {
49
+ if (process.env.NODE_ENV === "development") {
50
+ console.warn(`No key given to AnimatePresence child, assigning index as key`);
51
+ }
52
+ filtered.push(import_react.default.cloneElement(child, {
53
+ key: index
54
+ }));
55
+ } else {
56
+ filtered.push(child);
57
+ }
58
+ }
51
59
  });
52
60
  return filtered;
53
61
  }
54
- __name(onlyElements, "onlyElements");
55
- const AnimatePresence = /* @__PURE__ */ __name(({
62
+ const AnimatePresence = ({
56
63
  children,
57
64
  enterVariant,
58
65
  exitVariant,
@@ -65,10 +72,7 @@ const AnimatePresence = /* @__PURE__ */ __name(({
65
72
  const forceRenderLayoutGroup = (0, import_react.useContext)(import_LayoutGroupContext.LayoutGroupContext).forceRender;
66
73
  if (forceRenderLayoutGroup)
67
74
  forceRender = forceRenderLayoutGroup;
68
- const [isMounted, setIsMounted] = (0, import_react.useState)(false);
69
- (0, import_core.useIsomorphicLayoutEffect)(() => {
70
- setIsMounted(true);
71
- }, []);
75
+ const isMounted = (0, import_core.useIsMounted)();
72
76
  const filteredChildren = onlyElements(children);
73
77
  let childrenToRender = filteredChildren;
74
78
  const exiting = /* @__PURE__ */ new Set();
@@ -88,7 +92,7 @@ const AnimatePresence = /* @__PURE__ */ __name(({
88
92
  if (isInitialRender.current) {
89
93
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, childrenToRender.map((child) => /* @__PURE__ */ import_react.default.createElement(import_PresenceChild.PresenceChild, {
90
94
  key: getChildKey(child),
91
- isEntering: true,
95
+ isPresent: true,
92
96
  exitVariant,
93
97
  enterVariant,
94
98
  initial: initial ? void 0 : false,
@@ -117,7 +121,7 @@ const AnimatePresence = /* @__PURE__ */ __name(({
117
121
  const insertionIndex = presentKeys.indexOf(key);
118
122
  childrenToRender.splice(insertionIndex, 0, /* @__PURE__ */ import_react.default.createElement(import_PresenceChild.PresenceChild, {
119
123
  key: getChildKey(child),
120
- isEntering: false,
124
+ isPresent: false,
121
125
  onExitComplete: () => {
122
126
  allChildren.delete(key);
123
127
  exiting.delete(key);
@@ -125,7 +129,7 @@ const AnimatePresence = /* @__PURE__ */ __name(({
125
129
  presentChildren.current.splice(removeIndex, 1);
126
130
  if (!exiting.size) {
127
131
  presentChildren.current = filteredChildren;
128
- if (isMounted === false)
132
+ if (isMounted.current === false)
129
133
  return;
130
134
  forceRender();
131
135
  onExitComplete == null ? void 0 : onExitComplete();
@@ -140,7 +144,7 @@ const AnimatePresence = /* @__PURE__ */ __name(({
140
144
  const key = child.key;
141
145
  return exiting.has(key) ? child : /* @__PURE__ */ import_react.default.createElement(import_PresenceChild.PresenceChild, {
142
146
  key: getChildKey(child),
143
- isEntering: void 0,
147
+ isPresent: true,
144
148
  exitVariant,
145
149
  enterVariant,
146
150
  presenceAffectsLayout
@@ -150,7 +154,7 @@ const AnimatePresence = /* @__PURE__ */ __name(({
150
154
  console.warn(`You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour.`);
151
155
  }
152
156
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, exiting.size ? childrenToRender : childrenToRender.map((child) => (0, import_react.cloneElement)(child)));
153
- }, "AnimatePresence");
157
+ };
154
158
  AnimatePresence.displayName = "AnimatePresence";
155
159
  // Annotate the CommonJS export names for ESM import in node:
156
160
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/AnimatePresence.tsx"],
4
- "sourcesContent": ["import { useForceUpdate, useIsomorphicLayoutEffect, useUnmountEffect } from '@tamagui/core'\nimport React, {\n Children,\n ReactElement,\n ReactNode,\n cloneElement,\n isValidElement,\n useContext,\n useRef,\n useState,\n} from 'react'\n\nimport { LayoutGroupContext } from './LayoutGroupContext'\nimport { PresenceChild } from './PresenceChild'\n\nReact['keep']\n\nexport interface AnimatePresenceProps {\n /**\n * By passing `initial={false}`, `AnimatePresence` will disable any initial animations on children\n * that are present when the component is first rendered.\n */\n initial?: boolean\n\n /**\n * When a component is removed, there's no longer a chance to update its props. So if a component's `exit`\n * prop is defined as a dynamic variant and you want to pass a new `custom` prop, you can do so via `AnimatePresence`.\n * This will ensure all leaving components animate using the latest data.\n */\n exitVariant?: string | null\n\n enterVariant?: string | null\n\n /**\n * Fires when all exiting nodes have completed animating out.\n */\n onExitComplete?: () => void\n\n /**\n * If set to `true`, `AnimatePresence` will only render one component at a time. The exiting component\n * will finish its exit animation before the entering component is rendered.\n */\n exitBeforeEnter?: boolean\n\n /**\n * Used in Framer to flag that sibling children *shouldn't* re-render as a result of a\n * child being removed.\n */\n presenceAffectsLayout?: boolean\n}\n\ntype ComponentKey = string | number\n\nconst getChildKey = (child: ReactElement<any>): ComponentKey => child.key || ''\n\nconst isDev = process.env.NODE_ENV !== 'production'\n\nfunction updateChildLookup(\n children: ReactElement<any>[],\n allChildren: Map<ComponentKey, ReactElement<any>>\n) {\n const seenChildren = isDev ? new Set<ComponentKey>() : null\n\n children.forEach((child) => {\n const key = getChildKey(child)\n\n if (isDev && seenChildren && seenChildren.has(key)) {\n console.warn(`Children of AnimatePresence require unique keys. \"${key}\" is a duplicate.`)\n\n seenChildren.add(key)\n }\n\n allChildren.set(key, child)\n })\n}\n\nfunction onlyElements(children: ReactNode): ReactElement<any>[] {\n const filtered: ReactElement<any>[] = []\n\n // We use forEach here instead of map as map mutates the component key by preprending `.$`\n Children.forEach(children, (child) => {\n if (isValidElement(child)) filtered.push(child)\n })\n\n return filtered\n}\n\n/**\n * `AnimatePresence` enables the animation of components that have been removed from the tree.\n *\n * When adding/removing more than a single child, every child **must** be given a unique `key` prop.\n *\n * Any `motion` components that have an `exit` property defined will animate out when removed from\n * the tree.\n *\n * ```jsx\n * import { motion, AnimatePresence } from 'framer-motion'\n *\n * export const Items = ({ items }) => (\n * <AnimatePresence>\n * {items.map(item => (\n * <motion.div\n * key={item.id}\n * initial={{ opacity: 0 }}\n * animate={{ opacity: 1 }}\n * exit={{ opacity: 0 }}\n * />\n * ))}\n * </AnimatePresence>\n * )\n * ```\n *\n * You can sequence exit animations throughout a tree using variants.\n *\n * If a child contains multiple `motion` components with `exit` props, it will only unmount the child\n * once all `motion` components have finished animating out. Likewise, any components using\n * `useEntering` all need to call `safeToRemove`.\n *\n * @public\n */\nexport const AnimatePresence: React.FunctionComponent<\n React.PropsWithChildren<AnimatePresenceProps>\n> = ({\n children,\n enterVariant,\n exitVariant,\n initial = true,\n onExitComplete,\n exitBeforeEnter,\n presenceAffectsLayout = true,\n}) => {\n // We want to force a re-render once all exiting animations have finished. We\n // either use a local forceRender function, or one from a parent context if it exists.\n let forceRender = useForceUpdate()\n const forceRenderLayoutGroup = useContext(LayoutGroupContext).forceRender\n if (forceRenderLayoutGroup) forceRender = forceRenderLayoutGroup\n\n const [isMounted, setIsMounted] = useState(false)\n\n useIsomorphicLayoutEffect(() => {\n setIsMounted(true)\n }, [])\n\n // Filter out any children that aren't ReactElements. We can only track ReactElements with a props.key\n const filteredChildren = onlyElements(children)\n let childrenToRender = filteredChildren\n\n const exiting = new Set<ComponentKey>()\n\n // Keep a living record of the children we're actually rendering so we\n // can diff to figure out which are entering and exiting\n const presentChildren = useRef(childrenToRender)\n\n // A lookup table to quickly reference components by key\n const allChildren = useRef(new Map<ComponentKey, ReactElement<any>>()).current\n\n // If this is the initial component render, just deal with logic surrounding whether\n // we play onMount animations or not.\n const isInitialRender = useRef(true)\n\n useIsomorphicLayoutEffect(() => {\n isInitialRender.current = false\n updateChildLookup(filteredChildren, allChildren)\n presentChildren.current = childrenToRender\n })\n\n useUnmountEffect(() => {\n isInitialRender.current = true\n allChildren.clear()\n exiting.clear()\n })\n\n if (isInitialRender.current) {\n return (\n <>\n {childrenToRender.map((child) => (\n <PresenceChild\n key={getChildKey(child)}\n isEntering\n exitVariant={exitVariant}\n enterVariant={enterVariant}\n initial={initial ? undefined : false}\n presenceAffectsLayout={presenceAffectsLayout}\n >\n {child}\n </PresenceChild>\n ))}\n </>\n )\n }\n\n // If this is a subsequent render, deal with entering and exiting children\n childrenToRender = [...childrenToRender]\n\n // Diff the keys of the currently-present and target children to update our\n // exiting list.\n const presentKeys = presentChildren.current.map(getChildKey)\n const targetKeys = filteredChildren.map(getChildKey)\n\n // Diff the present children with our target children and mark those that are exiting\n const numPresent = presentKeys.length\n for (let i = 0; i < numPresent; i++) {\n const key = presentKeys[i]\n\n if (targetKeys.indexOf(key) === -1) {\n exiting.add(key)\n }\n }\n\n // If we currently have exiting children, and we're deferring rendering incoming children\n // until after all current children have exiting, empty the childrenToRender array\n if (exitBeforeEnter && exiting.size) {\n childrenToRender = []\n }\n\n // Loop through all currently exiting components and clone them to overwrite `animate`\n // with any `exit` prop they might have defined.\n exiting.forEach((key) => {\n // If this component is actually entering again, early return\n if (targetKeys.indexOf(key) !== -1) return\n\n const child = allChildren.get(key)\n if (!child) return\n\n const insertionIndex = presentKeys.indexOf(key)\n\n childrenToRender.splice(\n insertionIndex,\n 0,\n <PresenceChild\n key={getChildKey(child)}\n isEntering={false}\n onExitComplete={() => {\n allChildren.delete(key)\n exiting.delete(key)\n\n // Remove this child from the present children\n const removeIndex = presentChildren.current.findIndex(\n (presentChild) => presentChild.key === key\n )\n presentChildren.current.splice(removeIndex, 1)\n\n // Defer re-rendering until all exiting children have indeed left\n if (!exiting.size) {\n presentChildren.current = filteredChildren\n\n if (isMounted === false) return\n\n forceRender()\n onExitComplete?.()\n }\n }}\n exitVariant={exitVariant}\n enterVariant={enterVariant}\n presenceAffectsLayout={presenceAffectsLayout}\n >\n {child}\n </PresenceChild>\n )\n })\n\n // Add `MotionContext` even to children that don't need it to ensure we're rendering\n // the same tree between renders\n childrenToRender = childrenToRender.map((child) => {\n const key = child.key as string | number\n return exiting.has(key) ? (\n child\n ) : (\n <PresenceChild\n key={getChildKey(child)}\n isEntering={undefined}\n exitVariant={exitVariant}\n enterVariant={enterVariant}\n presenceAffectsLayout={presenceAffectsLayout}\n >\n {child}\n </PresenceChild>\n )\n })\n\n if (process.env.NODE_ENV !== 'production' && exitBeforeEnter && childrenToRender.length > 1) {\n console.warn(\n `You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour.`\n )\n }\n\n return (\n <>{exiting.size ? childrenToRender : childrenToRender.map((child) => cloneElement(child))}</>\n )\n}\n\nAnimatePresence.displayName = 'AnimatePresence'\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA4E;AAC5E,mBASO;AAEP,gCAAmC;AACnC,2BAA8B;AAE9B,qBAAM;AAsCN,MAAM,cAAc,wBAAC,UAA2C,MAAM,OAAO,IAAzD;AAEpB,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAEvC,2BACE,UACA,aACA;AACA,QAAM,eAAe,QAAQ,oBAAI,IAAkB,IAAI;AAEvD,WAAS,QAAQ,CAAC,UAAU;AAC1B,UAAM,MAAM,YAAY,KAAK;AAE7B,QAAI,SAAS,gBAAgB,aAAa,IAAI,GAAG,GAAG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YAAY,KAAK;AAAA,MACtB,YAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,OAEC,KACH;AAAA,EAEJ,CAAC;AAED,MAAI,QAAQ,IAAI,aAAa,gBAAgB,mBAAmB,iBAAiB,SAAS,GAAG;AAC3F,YAAQ,KACN,6JACF;AAAA,EACF;AAEA,SACE,wFAAG,QAAQ,OAAO,mBAAmB,iBAAiB,IAAI,CAAC,UAAU,+BAAa,KAAK,CAAC,CAAE;AAE9F,GAvKI;AAyKJ,gBAAgB,cAAc;",
4
+ "sourcesContent": ["import {\n useForceUpdate,\n useIsMounted,\n useIsomorphicLayoutEffect,\n useUnmountEffect,\n} from '@tamagui/core'\nimport React, {\n Children,\n ReactElement,\n ReactNode,\n cloneElement,\n isValidElement,\n useContext,\n useRef,\n} from 'react'\n\nimport { LayoutGroupContext } from './LayoutGroupContext'\nimport { PresenceChild } from './PresenceChild'\nimport { AnimatePresenceProps } from './types'\n\nReact['keep']\n\ntype ComponentKey = string | number\n\nconst getChildKey = (child: ReactElement<any>): ComponentKey => child.key || ''\n\nconst isDev = process.env.NODE_ENV !== 'production'\n\nfunction updateChildLookup(\n children: ReactElement<any>[],\n allChildren: Map<ComponentKey, ReactElement<any>>\n) {\n const seenChildren = isDev ? new Set<ComponentKey>() : null\n\n children.forEach((child) => {\n const key = getChildKey(child)\n\n if (isDev && seenChildren && seenChildren.has(key)) {\n console.warn(`Children of AnimatePresence require unique keys. \"${key}\" is a duplicate.`)\n\n seenChildren.add(key)\n }\n\n allChildren.set(key, child)\n })\n}\n\nfunction onlyElements(children: ReactNode): ReactElement<any>[] {\n const filtered: ReactElement<any>[] = []\n\n // We use forEach here instead of map as map mutates the component key by preprending `.$`\n Children.forEach(children, (child, index) => {\n if (isValidElement(child)) {\n if (!child.key) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(`No key given to AnimatePresence child, assigning index as key`)\n }\n filtered.push(\n React.cloneElement(child, {\n key: index,\n })\n )\n } else {\n filtered.push(child)\n }\n }\n })\n\n return filtered\n}\n\n/**\n * `AnimatePresence` enables the animation of components that have been removed from the tree.\n *\n * When adding/removing more than a single child, every child **must** be given a unique `key` prop.\n *\n * Any `motion` components that have an `exit` property defined will animate out when removed from\n * the tree.\n *\n * ```tsx\n * import { motion, AnimatePresence } from 'framer-motion'\n *\n * export const Items = ({ items }) => (\n * <AnimatePresence>\n * {items.map(item => (\n * <motion.div\n * key={item.id}\n * initial={{ opacity: 0 }}\n * animate={{ opacity: 1 }}\n * exit={{ opacity: 0 }}\n * />\n * ))}\n * </AnimatePresence>\n * )\n * ```\n *\n * You can sequence exit animations throughout a tree using variants.\n *\n * If a child contains multiple `motion` components with `exit` props, it will only unmount the child\n * once all `motion` components have finished animating out. Likewise, any components using\n * `usePresence` all need to call `safeToRemove`.\n *\n * @public\n */\nexport const AnimatePresence: React.FunctionComponent<\n React.PropsWithChildren<AnimatePresenceProps>\n> = ({\n children,\n enterVariant,\n exitVariant,\n initial = true,\n onExitComplete,\n exitBeforeEnter,\n presenceAffectsLayout = true,\n}) => {\n // We want to force a re-render once all exiting animations have finished. We\n // either use a local forceRender function, or one from a parent context if it exists.\n let forceRender = useForceUpdate()\n const forceRenderLayoutGroup = useContext(LayoutGroupContext).forceRender\n if (forceRenderLayoutGroup) forceRender = forceRenderLayoutGroup\n\n const isMounted = useIsMounted()\n\n // Filter out any children that aren't ReactElements. We can only track ReactElements with a props.key\n const filteredChildren = onlyElements(children)\n let childrenToRender = filteredChildren\n\n const exiting = new Set<ComponentKey>()\n\n // Keep a living record of the children we're actually rendering so we\n // can diff to figure out which are entering and exiting\n const presentChildren = useRef(childrenToRender)\n\n // A lookup table to quickly reference components by key\n const allChildren = useRef(new Map<ComponentKey, ReactElement<any>>()).current\n\n // If this is the initial component render, just deal with logic surrounding whether\n // we play onMount animations or not.\n const isInitialRender = useRef(true)\n\n useIsomorphicLayoutEffect(() => {\n isInitialRender.current = false\n updateChildLookup(filteredChildren, allChildren)\n presentChildren.current = childrenToRender\n })\n\n useUnmountEffect(() => {\n isInitialRender.current = true\n allChildren.clear()\n exiting.clear()\n })\n\n if (isInitialRender.current) {\n return (\n <>\n {childrenToRender.map((child) => (\n <PresenceChild\n key={getChildKey(child)}\n isPresent\n exitVariant={exitVariant}\n enterVariant={enterVariant}\n initial={initial ? undefined : false}\n presenceAffectsLayout={presenceAffectsLayout}\n >\n {child}\n </PresenceChild>\n ))}\n </>\n )\n }\n\n // If this is a subsequent render, deal with entering and exiting children\n childrenToRender = [...childrenToRender]\n\n // Diff the keys of the currently-present and target children to update our\n // exiting list.\n const presentKeys = presentChildren.current.map(getChildKey)\n const targetKeys = filteredChildren.map(getChildKey)\n\n // Diff the present children with our target children and mark those that are exiting\n const numPresent = presentKeys.length\n for (let i = 0; i < numPresent; i++) {\n const key = presentKeys[i]\n if (targetKeys.indexOf(key) === -1) {\n exiting.add(key)\n }\n }\n\n // If we currently have exiting children, and we're deferring rendering incoming children\n // until after all current children have exiting, empty the childrenToRender array\n if (exitBeforeEnter && exiting.size) {\n childrenToRender = []\n }\n\n // Loop through all currently exiting components and clone them to overwrite `animate`\n // with any `exit` prop they might have defined.\n exiting.forEach((key) => {\n // If this component is actually entering again, early return\n if (targetKeys.indexOf(key) !== -1) return\n\n const child = allChildren.get(key)\n if (!child) return\n\n const insertionIndex = presentKeys.indexOf(key)\n\n childrenToRender.splice(\n insertionIndex,\n 0,\n <PresenceChild\n key={getChildKey(child)}\n isPresent={false}\n onExitComplete={() => {\n allChildren.delete(key)\n exiting.delete(key)\n\n // Remove this child from the present children\n const removeIndex = presentChildren.current.findIndex(\n (presentChild) => presentChild.key === key\n )\n presentChildren.current.splice(removeIndex, 1)\n\n // Defer re-rendering until all exiting children have indeed left\n if (!exiting.size) {\n presentChildren.current = filteredChildren\n\n if (isMounted.current === false) return\n\n forceRender()\n onExitComplete?.()\n }\n }}\n exitVariant={exitVariant}\n enterVariant={enterVariant}\n presenceAffectsLayout={presenceAffectsLayout}\n >\n {child}\n </PresenceChild>\n )\n })\n\n // Add `MotionContext` even to children that don't need it to ensure we're rendering\n // the same tree between renders\n childrenToRender = childrenToRender.map((child) => {\n const key = child.key as string | number\n return exiting.has(key) ? (\n child\n ) : (\n <PresenceChild\n key={getChildKey(child)}\n isPresent\n exitVariant={exitVariant}\n enterVariant={enterVariant}\n presenceAffectsLayout={presenceAffectsLayout}\n >\n {child}\n </PresenceChild>\n )\n })\n\n if (process.env.NODE_ENV !== 'production' && exitBeforeEnter && childrenToRender.length > 1) {\n console.warn(\n `You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour.`\n )\n }\n\n return (\n <>{exiting.size ? childrenToRender : childrenToRender.map((child) => cloneElement(child))}</>\n )\n}\n\nAnimatePresence.displayName = 'AnimatePresence'\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAKO;AACP,mBAQO;AAEP,gCAAmC;AACnC,2BAA8B;AAG9B,qBAAM;AAIN,MAAM,cAAc,CAAC,UAA2C,MAAM,OAAO;AAE7E,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAEvC,2BACE,UACA,aACA;AACA,QAAM,eAAe,QAAQ,oBAAI,IAAkB,IAAI;AAEvD,WAAS,QAAQ,CAAC,UAAU;AAC1B,UAAM,MAAM,YAAY,KAAK;AAE7B,QAAI,SAAS,gBAAgB,aAAa,IAAI,GAAG,GAAG;AAClD,cAAQ,KAAK,qDAAqD,sBAAsB;AAExF,mBAAa,IAAI,GAAG;AAAA,IACtB;AAEA,gBAAY,IAAI,KAAK,KAAK;AAAA,EAC5B,CAAC;AACH;AAEA,sBAAsB,UAA0C;AAC9D,QAAM,WAAgC,CAAC;AAGvC,wBAAS,QAAQ,UAAU,CAAC,OAAO,UAAU;AAC3C,QAAI,iCAAe,KAAK,GAAG;AACzB,UAAI,CAAC,MAAM,KAAK;AACd,YAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,kBAAQ,KA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EA,SACE,wFAAG,QAAQ,OAAO,mBAAmB,iBAAiB,IAAI,CAAC,UAAU,+BAAa,KAAK,CAAC,CAAE;AAE9F;AAEA,gBAAgB,cAAc;",
6
6
  "names": []
7
7
  }
@@ -4,7 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -26,27 +25,27 @@ __export(PresenceChild_exports, {
26
25
  module.exports = __toCommonJS(PresenceChild_exports);
27
26
  var import_core = require("@tamagui/core");
28
27
  var React = __toESM(require("react"));
29
- var import_AnimatePresenceContext = require("./AnimatePresenceContext");
30
- const PresenceChild = /* @__PURE__ */ __name(({
28
+ var import_PresenceContext = require("./PresenceContext");
29
+ const PresenceChild = ({
31
30
  children,
32
31
  initial,
33
- isEntering,
32
+ isPresent,
34
33
  onExitComplete,
35
34
  exitVariant,
36
35
  enterVariant,
37
36
  presenceAffectsLayout
38
37
  }) => {
39
38
  const presenceChildren = (0, import_core.useConstant)(newChildrenMap);
40
- const id = (0, import_core.useId)();
39
+ const id = (0, import_core.useId)() || "";
41
40
  const context = React.useMemo(() => {
42
41
  return {
43
42
  id,
44
43
  initial,
45
- isEntering,
44
+ isPresent,
46
45
  exitVariant,
47
46
  enterVariant,
48
- onExitComplete: (childId) => {
49
- presenceChildren.set(childId, true);
47
+ onExitComplete: (id2) => {
48
+ presenceChildren.set(id2, true);
50
49
  for (const isComplete of presenceChildren.values()) {
51
50
  if (!isComplete) {
52
51
  return;
@@ -54,28 +53,25 @@ const PresenceChild = /* @__PURE__ */ __name(({
54
53
  }
55
54
  onExitComplete == null ? void 0 : onExitComplete();
56
55
  },
57
- register: (childId) => {
58
- presenceChildren.set(childId, false);
59
- return () => presenceChildren.delete(childId);
56
+ register: (id2) => {
57
+ presenceChildren.set(id2, false);
58
+ return () => presenceChildren.delete(id2);
60
59
  }
61
60
  };
62
- }, presenceAffectsLayout ? void 0 : [isEntering, onExitComplete, exitVariant, enterVariant]);
61
+ }, presenceAffectsLayout ? void 0 : [isPresent, exitVariant, enterVariant]);
63
62
  React.useMemo(() => {
64
63
  presenceChildren.forEach((_, key) => presenceChildren.set(key, false));
65
- }, [isEntering]);
64
+ }, [isPresent]);
66
65
  React.useEffect(() => {
67
- if (isEntering === false && !presenceChildren.size) {
68
- onExitComplete == null ? void 0 : onExitComplete();
69
- }
70
- }, [isEntering]);
71
- return /* @__PURE__ */ React.createElement(import_AnimatePresenceContext.AnimatePresenceContext.Provider, {
66
+ !isPresent && !presenceChildren.size && (onExitComplete == null ? void 0 : onExitComplete());
67
+ }, [isPresent]);
68
+ return /* @__PURE__ */ React.createElement(import_PresenceContext.PresenceContext.Provider, {
72
69
  value: context
73
70
  }, children);
74
- }, "PresenceChild");
71
+ };
75
72
  function newChildrenMap() {
76
73
  return /* @__PURE__ */ new Map();
77
74
  }
78
- __name(newChildrenMap, "newChildrenMap");
79
75
  // Annotate the CommonJS export names for ESM import in node:
80
76
  0 && (module.exports = {
81
77
  PresenceChild
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/PresenceChild.tsx"],
4
- "sourcesContent": ["import { useConstant, useId } from '@tamagui/core'\nimport * as React from 'react'\n\nimport { AnimatePresenceContext, AnimatePresenceContextProps } from './AnimatePresenceContext'\nimport { VariantLabels } from './types'\n\ninterface PresenceChildProps {\n children: React.ReactElement<any>\n isEntering: boolean | undefined\n onExitComplete?: () => void\n initial?: false | VariantLabels\n exitVariant?: string | null\n enterVariant?: string | null\n presenceAffectsLayout: boolean\n}\n\nexport const PresenceChild = ({\n children,\n initial,\n isEntering,\n onExitComplete,\n exitVariant,\n enterVariant,\n presenceAffectsLayout,\n}: PresenceChildProps) => {\n const presenceChildren = useConstant(newChildrenMap)\n const id = useId()\n\n const context = React.useMemo(\n (): AnimatePresenceContextProps => {\n return {\n id,\n initial,\n isEntering,\n exitVariant,\n enterVariant,\n onExitComplete: (childId: string) => {\n presenceChildren.set(childId, true)\n for (const isComplete of presenceChildren.values()) {\n if (!isComplete) {\n return // can stop searching when any is incomplete\n }\n }\n onExitComplete?.()\n },\n register: (childId: string) => {\n presenceChildren.set(childId, false)\n return () => presenceChildren.delete(childId)\n },\n }\n },\n /**\n * If the presence of a child affects the layout of the components around it,\n * we want to make a new context value to ensure they get re-rendered\n * so they can detect that layout change.\n */\n presenceAffectsLayout ? undefined : [isEntering, onExitComplete, exitVariant, enterVariant]\n )\n\n // cant this be a useEffect?\n React.useMemo(() => {\n presenceChildren.forEach((_, key) => presenceChildren.set(key, false))\n }, [isEntering])\n\n /**\n * If there's no animated components to fire exit animations, we want to remove this\n * component immediately.\n */\n React.useEffect(() => {\n if (isEntering === false && !presenceChildren.size) {\n onExitComplete?.()\n }\n }, [isEntering])\n\n return (\n <AnimatePresenceContext.Provider value={context}>{children}</AnimatePresenceContext.Provider>\n )\n}\n\nfunction newChildrenMap(): Map<string, boolean> {\n return new Map()\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmC;AACnC,YAAuB;AAEvB,oCAAoE;AAa7D,MAAM,gBAAgB,wBAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MACwB;AACxB,QAAM,mBAAmB,6BAAY,cAAc;AACnD,QAAM,KAAK,uBAAM;AAEjB,QAAM,UAAU,MAAM,QACpB,MAAmC;AACjC,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAgB,CAAC,YAAoB;AACnC,yBAAiB,IAAI,SAAS,IAAI;AAClC,mBAAW,cAAc,iBAAiB,OAAO,GAAG;AAClD,cAAI,CAAC,YAAY;AACf;AAAA,UACF;AAAA,QACF;AACA;AAAA,MACF;AAAA,MACA,UAAU,CAAC,YAAoB;AAC7B,yBAAiB,IAAI,SAAS,KAAK;AACnC,eAAO,MAAM,iBAAiB,OAAO,OAAO;AAAA,MAC9C;AAAA,IACF;AAAA,EACF,GAMA,wBAAwB,SAAY,CAAC,YAAY,gBAAgB,aAAa,YAAY,CAC5F;AAGA,QAAM,QAAQ,MAAM;AAClB,qBAAiB,QAAQ,CAAC,GAAG,QAAQ,iBAAiB,IAAI,KAAK,KAAK,CAAC;AAAA,EACvE,GAAG,CAAC,UAAU,CAAC;AAMf,QAAM,UAAU,MAAM;AACpB,QAAI,eAAe,SAAS,CAAC,iBAAiB,MAAM;AAClD;AAAA,IACF;AAAA,EACF,GAAG,CAAC,UAAU,CAAC;AAEf,SACE,oCAAC,qDAAuB,UAAvB;AAAA,IAAgC,OAAO;AAAA,KAAU,QAAS;AAE/D,GA7D6B;AA+D7B,0BAAgD;AAC9C,SAAO,oBAAI,IAAI;AACjB;AAFS;",
4
+ "sourcesContent": ["import { useConstant, useId } from '@tamagui/core'\nimport * as React from 'react'\n\nimport { PresenceContext, PresenceContextProps } from './PresenceContext'\nimport { VariantLabels } from './types'\n\ninterface PresenceChildProps {\n children: React.ReactElement<any>\n isPresent: boolean\n onExitComplete?: () => void\n initial?: false | VariantLabels\n custom?: any\n presenceAffectsLayout: boolean\n exitVariant?: string | null\n enterVariant?: string | null\n}\n\nexport const PresenceChild = ({\n children,\n initial,\n isPresent,\n onExitComplete,\n exitVariant,\n enterVariant,\n presenceAffectsLayout,\n}: PresenceChildProps) => {\n const presenceChildren = useConstant(newChildrenMap)\n const id = useId() || ''\n\n const context = React.useMemo(\n (): PresenceContextProps => {\n return {\n id,\n initial,\n isPresent,\n exitVariant,\n enterVariant,\n onExitComplete: (id: string) => {\n presenceChildren.set(id, true)\n for (const isComplete of presenceChildren.values()) {\n if (!isComplete) {\n return // can stop searching when any is incomplete\n }\n }\n onExitComplete?.()\n },\n register: (id: string) => {\n presenceChildren.set(id, false)\n return () => presenceChildren.delete(id)\n },\n }\n },\n /**\n * If the presence of a child affects the layout of the components around it,\n * we want to make a new context value to ensure they get re-rendered\n * so they can detect that layout change.\n */\n presenceAffectsLayout ? undefined : [isPresent, exitVariant, enterVariant]\n )\n\n React.useMemo(() => {\n presenceChildren.forEach((_, key) => presenceChildren.set(key, false))\n }, [isPresent])\n\n /**\n * If there's no animated components to fire exit animations, we want to remove this\n * component immediately.\n */\n React.useEffect(() => {\n !isPresent && !presenceChildren.size && onExitComplete?.()\n }, [isPresent])\n\n return <PresenceContext.Provider value={context}>{children}</PresenceContext.Provider>\n}\n\nfunction newChildrenMap(): Map<string, boolean> {\n return new Map()\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmC;AACnC,YAAuB;AAEvB,6BAAsD;AAc/C,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MACwB;AACxB,QAAM,mBAAmB,6BAAY,cAAc;AACnD,QAAM,KAAK,uBAAM,KAAK;AAEtB,QAAM,UAAU,MAAM,QACpB,MAA4B;AAC1B,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAgB,CAAC,QAAe;AAC9B,yBAAiB,IAAI,KAAI,IAAI;AAC7B,mBAAW,cAAc,iBAAiB,OAAO,GAAG;AAClD,cAAI,CAAC,YAAY;AACf;AAAA,UACF;AAAA,QACF;AACA;AAAA,MACF;AAAA,MACA,UAAU,CAAC,QAAe;AACxB,yBAAiB,IAAI,KAAI,KAAK;AAC9B,eAAO,MAAM,iBAAiB,OAAO,GAAE;AAAA,MACzC;AAAA,IACF;AAAA,EACF,GAMA,wBAAwB,SAAY,CAAC,WAAW,aAAa,YAAY,CAC3E;AAEA,QAAM,QAAQ,MAAM;AAClB,qBAAiB,QAAQ,CAAC,GAAG,QAAQ,iBAAiB,IAAI,KAAK,KAAK,CAAC;AAAA,EACvE,GAAG,CAAC,SAAS,CAAC;AAMd,QAAM,UAAU,MAAM;AACpB,KAAC,aAAa,CAAC,iBAAiB,QAAQ;AAAA,EAC1C,GAAG,CAAC,SAAS,CAAC;AAEd,SAAO,oCAAC,uCAAgB,UAAhB;AAAA,IAAyB,OAAO;AAAA,KAAU,QAAS;AAC7D;AAEA,0BAAgD;AAC9C,SAAO,oBAAI,IAAI;AACjB;",
6
6
  "names": []
7
7
  }
@@ -15,15 +15,15 @@ var __copyProps = (to, from, except, desc) => {
15
15
  return to;
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var AnimatePresenceContext_exports = {};
19
- __export(AnimatePresenceContext_exports, {
20
- AnimatePresenceContext: () => AnimatePresenceContext
18
+ var PresenceContext_exports = {};
19
+ __export(PresenceContext_exports, {
20
+ PresenceContext: () => PresenceContext
21
21
  });
22
- module.exports = __toCommonJS(AnimatePresenceContext_exports);
22
+ module.exports = __toCommonJS(PresenceContext_exports);
23
23
  var import_react = require("react");
24
- const AnimatePresenceContext = (0, import_react.createContext)(null);
24
+ const PresenceContext = (0, import_react.createContext)(null);
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
- AnimatePresenceContext
27
+ PresenceContext
28
28
  });
29
- //# sourceMappingURL=AnimatePresenceContext.js.map
29
+ //# sourceMappingURL=PresenceContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/PresenceContext.tsx"],
4
+ "sourcesContent": ["import { createContext } from 'react'\n\nimport { VariantLabels } from './types'\n\nexport interface PresenceContextProps {\n id: string\n isPresent: boolean\n register: (id: string) => () => void\n onExitComplete?: (id: string) => void\n initial?: false | VariantLabels\n custom?: any\n exitVariant?: string | null\n enterVariant?: string | null\n}\n\nexport const PresenceContext = createContext<PresenceContextProps | null>(null)\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8B;AAevB,MAAM,kBAAkB,gCAA2C,IAAI;",
6
+ "names": []
7
+ }
package/dist/cjs/index.js CHANGED
@@ -18,14 +18,14 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var src_exports = {};
20
20
  __export(src_exports, {
21
- AnimatePresenceContext: () => import_AnimatePresenceContext.AnimatePresenceContext
21
+ PresenceContext: () => import_PresenceContext.PresenceContext
22
22
  });
23
23
  module.exports = __toCommonJS(src_exports);
24
24
  __reExport(src_exports, require("./AnimatePresence"), module.exports);
25
- __reExport(src_exports, require("./useEntering"), module.exports);
26
- var import_AnimatePresenceContext = require("./AnimatePresenceContext");
25
+ __reExport(src_exports, require("./usePresence"), module.exports);
26
+ var import_PresenceContext = require("./PresenceContext");
27
27
  // Annotate the CommonJS export names for ESM import in node:
28
28
  0 && (module.exports = {
29
- AnimatePresenceContext
29
+ PresenceContext
30
30
  });
31
31
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["export * from './AnimatePresence'\nexport * from './useEntering'\nexport { AnimatePresenceContext } from './AnimatePresenceContext'\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAc,8BAAd;AACA,wBAAc,0BADd;AAEA,oCAAuC;",
4
+ "sourcesContent": ["export * from './AnimatePresence'\nexport * from './usePresence'\nexport { PresenceContext } from './PresenceContext'\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAc,8BAAd;AACA,wBAAc,0BADd;AAEA,6BAAgC;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/types.ts"],
4
- "sourcesContent": ["export interface Axis {\n min: number\n max: number\n}\n\nexport interface Box {\n x: Axis\n y: Axis\n}\n\nexport type VariantLabels = string | string[]\n"],
4
+ "sourcesContent": ["export interface Axis {\n min: number\n max: number\n}\n\nexport interface Box {\n x: Axis\n y: Axis\n}\n\nexport type VariantLabels = string | string[]\n\n/**\n * @public\n */\nexport interface AnimatePresenceProps {\n /**\n * By passing `initial={false}`, `AnimatePresence` will disable any initial animations on children\n * that are present when the component is first rendered.\n *\n * ```jsx\n * <AnimatePresence initial={false}>\n * {isVisible && (\n * <motion.div\n * key=\"modal\"\n * initial={{ opacity: 0 }}\n * animate={{ opacity: 1 }}\n * exit={{ opacity: 0 }}\n * />\n * )}\n * </AnimatePresence>\n * ```\n *\n * @public\n */\n initial?: boolean\n\n /**\n * When a component is removed, there's no longer a chance to update its props. So if a component's `exit`\n * prop is defined as a dynamic variant and you want to pass a new `custom` prop, you can do so via `AnimatePresence`.\n * This will ensure all leaving components animate using the latest data.\n *\n * @public\n */\n custom?: any\n\n /**\n * Fires when all exiting nodes have completed animating out.\n *\n * @public\n */\n onExitComplete?: () => void\n\n /**\n * If set to `true`, `AnimatePresence` will only render one component at a time. The exiting component\n * will finish its exit animation before the entering component is rendered.\n *\n * ```jsx\n * const MyComponent = ({ currentItem }) => (\n * <AnimatePresence exitBeforeEnter>\n * <motion.div key={currentItem} exit={{ opacity: 0 }} />\n * </AnimatePresence>\n * )\n * ```\n *\n * @beta\n */\n exitBeforeEnter?: boolean\n\n /**\n * Used in Framer to flag that sibling children *shouldn't* re-render as a result of a\n * child being removed.\n *\n * @internal\n */\n presenceAffectsLayout?: boolean\n\n exitVariant?: string | null\n\n enterVariant?: string | null\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,51 @@
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)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var usePresence_exports = {};
19
+ __export(usePresence_exports, {
20
+ isPresent: () => isPresent,
21
+ useIsPresent: () => useIsPresent,
22
+ usePresence: () => usePresence
23
+ });
24
+ module.exports = __toCommonJS(usePresence_exports);
25
+ var import_core = require("@tamagui/core");
26
+ var import_react = require("react");
27
+ var import_PresenceContext = require("./PresenceContext");
28
+ function usePresence() {
29
+ const context = (0, import_react.useContext)(import_PresenceContext.PresenceContext);
30
+ if (context === null) {
31
+ return [true, null];
32
+ }
33
+ const { isPresent: isPresent2, onExitComplete, register } = context;
34
+ const id = (0, import_core.useId)() || "";
35
+ (0, import_react.useEffect)(() => register(id), []);
36
+ const safeToRemove = () => onExitComplete == null ? void 0 : onExitComplete(id);
37
+ return !isPresent2 && onExitComplete ? [false, safeToRemove] : [true];
38
+ }
39
+ function useIsPresent() {
40
+ return isPresent((0, import_react.useContext)(import_PresenceContext.PresenceContext));
41
+ }
42
+ function isPresent(context) {
43
+ return context === null ? true : context.isPresent;
44
+ }
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ isPresent,
48
+ useIsPresent,
49
+ usePresence
50
+ });
51
+ //# sourceMappingURL=usePresence.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/usePresence.ts"],
4
+ "sourcesContent": ["import { useId } from '@tamagui/core'\nimport { useContext, useEffect } from 'react'\n\nimport { PresenceContext, PresenceContextProps } from './PresenceContext'\n\nexport type SafeToRemove = () => void\ntype AlwaysPresent = [true, null]\ntype Present = [true]\ntype NotPresent = [false, SafeToRemove]\n\nexport function usePresence(): AlwaysPresent | Present | NotPresent {\n const context = useContext(PresenceContext)\n\n if (context === null) {\n return [true, null]\n }\n\n const { isPresent, onExitComplete, register } = context\n const id = useId() || ''\n useEffect(() => register(id), [])\n\n const safeToRemove = () => onExitComplete?.(id)\n\n return !isPresent && onExitComplete ? [false, safeToRemove] : [true]\n}\n\n/**\n * Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present.\n * There is no `safeToRemove` function. ```\n */\nexport function useIsPresent() {\n return isPresent(useContext(PresenceContext))\n}\n\nexport function isPresent(context: PresenceContextProps | null) {\n return context === null ? true : context.isPresent\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAsB;AACtB,mBAAsC;AAEtC,6BAAsD;AAO/C,uBAA6D;AAClE,QAAM,UAAU,6BAAW,sCAAe;AAE1C,MAAI,YAAY,MAAM;AACpB,WAAO,CAAC,MAAM,IAAI;AAAA,EACpB;AAEA,QAAM,EAAE,uBAAW,gBAAgB,aAAa;AAChD,QAAM,KAAK,uBAAM,KAAK;AACtB,8BAAU,MAAM,SAAS,EAAE,GAAG,CAAC,CAAC;AAEhC,QAAM,eAAe,MAAM,iDAAiB;AAE5C,SAAO,CAAC,cAAa,iBAAiB,CAAC,OAAO,YAAY,IAAI,CAAC,IAAI;AACrE;AAMO,wBAAwB;AAC7B,SAAO,UAAU,6BAAW,sCAAe,CAAC;AAC9C;AAEO,mBAAmB,SAAsC;AAC9D,SAAO,YAAY,OAAO,OAAO,QAAQ;AAC3C;",
6
+ "names": []
7
+ }
@@ -1,18 +1,20 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { useForceUpdate, useIsomorphicLayoutEffect, useUnmountEffect } from "@tamagui/core";
1
+ import {
2
+ useForceUpdate,
3
+ useIsMounted,
4
+ useIsomorphicLayoutEffect,
5
+ useUnmountEffect
6
+ } from "@tamagui/core";
4
7
  import React, {
5
8
  Children,
6
9
  cloneElement,
7
10
  isValidElement,
8
11
  useContext,
9
- useRef,
10
- useState
12
+ useRef
11
13
  } from "react";
12
14
  import { LayoutGroupContext } from "./LayoutGroupContext";
13
15
  import { PresenceChild } from "./PresenceChild";
14
16
  React["keep"];
15
- const getChildKey = /* @__PURE__ */ __name((child) => child.key || "", "getChildKey");
17
+ const getChildKey = (child) => child.key || "";
16
18
  const isDev = process.env.NODE_ENV !== "production";
17
19
  function updateChildLookup(children, allChildren) {
18
20
  const seenChildren = isDev ? /* @__PURE__ */ new Set() : null;
@@ -25,17 +27,25 @@ function updateChildLookup(children, allChildren) {
25
27
  allChildren.set(key, child);
26
28
  });
27
29
  }
28
- __name(updateChildLookup, "updateChildLookup");
29
30
  function onlyElements(children) {
30
31
  const filtered = [];
31
- Children.forEach(children, (child) => {
32
- if (isValidElement(child))
33
- filtered.push(child);
32
+ Children.forEach(children, (child, index) => {
33
+ if (isValidElement(child)) {
34
+ if (!child.key) {
35
+ if (process.env.NODE_ENV === "development") {
36
+ console.warn(`No key given to AnimatePresence child, assigning index as key`);
37
+ }
38
+ filtered.push(React.cloneElement(child, {
39
+ key: index
40
+ }));
41
+ } else {
42
+ filtered.push(child);
43
+ }
44
+ }
34
45
  });
35
46
  return filtered;
36
47
  }
37
- __name(onlyElements, "onlyElements");
38
- const AnimatePresence = /* @__PURE__ */ __name(({
48
+ const AnimatePresence = ({
39
49
  children,
40
50
  enterVariant,
41
51
  exitVariant,
@@ -48,10 +58,7 @@ const AnimatePresence = /* @__PURE__ */ __name(({
48
58
  const forceRenderLayoutGroup = useContext(LayoutGroupContext).forceRender;
49
59
  if (forceRenderLayoutGroup)
50
60
  forceRender = forceRenderLayoutGroup;
51
- const [isMounted, setIsMounted] = useState(false);
52
- useIsomorphicLayoutEffect(() => {
53
- setIsMounted(true);
54
- }, []);
61
+ const isMounted = useIsMounted();
55
62
  const filteredChildren = onlyElements(children);
56
63
  let childrenToRender = filteredChildren;
57
64
  const exiting = /* @__PURE__ */ new Set();
@@ -71,7 +78,7 @@ const AnimatePresence = /* @__PURE__ */ __name(({
71
78
  if (isInitialRender.current) {
72
79
  return /* @__PURE__ */ React.createElement(React.Fragment, null, childrenToRender.map((child) => /* @__PURE__ */ React.createElement(PresenceChild, {
73
80
  key: getChildKey(child),
74
- isEntering: true,
81
+ isPresent: true,
75
82
  exitVariant,
76
83
  enterVariant,
77
84
  initial: initial ? void 0 : false,
@@ -100,7 +107,7 @@ const AnimatePresence = /* @__PURE__ */ __name(({
100
107
  const insertionIndex = presentKeys.indexOf(key);
101
108
  childrenToRender.splice(insertionIndex, 0, /* @__PURE__ */ React.createElement(PresenceChild, {
102
109
  key: getChildKey(child),
103
- isEntering: false,
110
+ isPresent: false,
104
111
  onExitComplete: () => {
105
112
  allChildren.delete(key);
106
113
  exiting.delete(key);
@@ -108,7 +115,7 @@ const AnimatePresence = /* @__PURE__ */ __name(({
108
115
  presentChildren.current.splice(removeIndex, 1);
109
116
  if (!exiting.size) {
110
117
  presentChildren.current = filteredChildren;
111
- if (isMounted === false)
118
+ if (isMounted.current === false)
112
119
  return;
113
120
  forceRender();
114
121
  onExitComplete == null ? void 0 : onExitComplete();
@@ -123,7 +130,7 @@ const AnimatePresence = /* @__PURE__ */ __name(({
123
130
  const key = child.key;
124
131
  return exiting.has(key) ? child : /* @__PURE__ */ React.createElement(PresenceChild, {
125
132
  key: getChildKey(child),
126
- isEntering: void 0,
133
+ isPresent: true,
127
134
  exitVariant,
128
135
  enterVariant,
129
136
  presenceAffectsLayout
@@ -133,7 +140,7 @@ const AnimatePresence = /* @__PURE__ */ __name(({
133
140
  console.warn(`You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour.`);
134
141
  }
135
142
  return /* @__PURE__ */ React.createElement(React.Fragment, null, exiting.size ? childrenToRender : childrenToRender.map((child) => cloneElement(child)));
136
- }, "AnimatePresence");
143
+ };
137
144
  AnimatePresence.displayName = "AnimatePresence";
138
145
  export {
139
146
  AnimatePresence
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/AnimatePresence.tsx"],
4
- "sourcesContent": ["import { useForceUpdate, useIsomorphicLayoutEffect, useUnmountEffect } from '@tamagui/core'\nimport React, {\n Children,\n ReactElement,\n ReactNode,\n cloneElement,\n isValidElement,\n useContext,\n useRef,\n useState,\n} from 'react'\n\nimport { LayoutGroupContext } from './LayoutGroupContext'\nimport { PresenceChild } from './PresenceChild'\n\nReact['keep']\n\nexport interface AnimatePresenceProps {\n /**\n * By passing `initial={false}`, `AnimatePresence` will disable any initial animations on children\n * that are present when the component is first rendered.\n */\n initial?: boolean\n\n /**\n * When a component is removed, there's no longer a chance to update its props. So if a component's `exit`\n * prop is defined as a dynamic variant and you want to pass a new `custom` prop, you can do so via `AnimatePresence`.\n * This will ensure all leaving components animate using the latest data.\n */\n exitVariant?: string | null\n\n enterVariant?: string | null\n\n /**\n * Fires when all exiting nodes have completed animating out.\n */\n onExitComplete?: () => void\n\n /**\n * If set to `true`, `AnimatePresence` will only render one component at a time. The exiting component\n * will finish its exit animation before the entering component is rendered.\n */\n exitBeforeEnter?: boolean\n\n /**\n * Used in Framer to flag that sibling children *shouldn't* re-render as a result of a\n * child being removed.\n */\n presenceAffectsLayout?: boolean\n}\n\ntype ComponentKey = string | number\n\nconst getChildKey = (child: ReactElement<any>): ComponentKey => child.key || ''\n\nconst isDev = process.env.NODE_ENV !== 'production'\n\nfunction updateChildLookup(\n children: ReactElement<any>[],\n allChildren: Map<ComponentKey, ReactElement<any>>\n) {\n const seenChildren = isDev ? new Set<ComponentKey>() : null\n\n children.forEach((child) => {\n const key = getChildKey(child)\n\n if (isDev && seenChildren && seenChildren.has(key)) {\n console.warn(`Children of AnimatePresence require unique keys. \"${key}\" is a duplicate.`)\n\n seenChildren.add(key)\n }\n\n allChildren.set(key, child)\n })\n}\n\nfunction onlyElements(children: ReactNode): ReactElement<any>[] {\n const filtered: ReactElement<any>[] = []\n\n // We use forEach here instead of map as map mutates the component key by preprending `.$`\n Children.forEach(children, (child) => {\n if (isValidElement(child)) filtered.push(child)\n })\n\n return filtered\n}\n\n/**\n * `AnimatePresence` enables the animation of components that have been removed from the tree.\n *\n * When adding/removing more than a single child, every child **must** be given a unique `key` prop.\n *\n * Any `motion` components that have an `exit` property defined will animate out when removed from\n * the tree.\n *\n * ```jsx\n * import { motion, AnimatePresence } from 'framer-motion'\n *\n * export const Items = ({ items }) => (\n * <AnimatePresence>\n * {items.map(item => (\n * <motion.div\n * key={item.id}\n * initial={{ opacity: 0 }}\n * animate={{ opacity: 1 }}\n * exit={{ opacity: 0 }}\n * />\n * ))}\n * </AnimatePresence>\n * )\n * ```\n *\n * You can sequence exit animations throughout a tree using variants.\n *\n * If a child contains multiple `motion` components with `exit` props, it will only unmount the child\n * once all `motion` components have finished animating out. Likewise, any components using\n * `useEntering` all need to call `safeToRemove`.\n *\n * @public\n */\nexport const AnimatePresence: React.FunctionComponent<\n React.PropsWithChildren<AnimatePresenceProps>\n> = ({\n children,\n enterVariant,\n exitVariant,\n initial = true,\n onExitComplete,\n exitBeforeEnter,\n presenceAffectsLayout = true,\n}) => {\n // We want to force a re-render once all exiting animations have finished. We\n // either use a local forceRender function, or one from a parent context if it exists.\n let forceRender = useForceUpdate()\n const forceRenderLayoutGroup = useContext(LayoutGroupContext).forceRender\n if (forceRenderLayoutGroup) forceRender = forceRenderLayoutGroup\n\n const [isMounted, setIsMounted] = useState(false)\n\n useIsomorphicLayoutEffect(() => {\n setIsMounted(true)\n }, [])\n\n // Filter out any children that aren't ReactElements. We can only track ReactElements with a props.key\n const filteredChildren = onlyElements(children)\n let childrenToRender = filteredChildren\n\n const exiting = new Set<ComponentKey>()\n\n // Keep a living record of the children we're actually rendering so we\n // can diff to figure out which are entering and exiting\n const presentChildren = useRef(childrenToRender)\n\n // A lookup table to quickly reference components by key\n const allChildren = useRef(new Map<ComponentKey, ReactElement<any>>()).current\n\n // If this is the initial component render, just deal with logic surrounding whether\n // we play onMount animations or not.\n const isInitialRender = useRef(true)\n\n useIsomorphicLayoutEffect(() => {\n isInitialRender.current = false\n updateChildLookup(filteredChildren, allChildren)\n presentChildren.current = childrenToRender\n })\n\n useUnmountEffect(() => {\n isInitialRender.current = true\n allChildren.clear()\n exiting.clear()\n })\n\n if (isInitialRender.current) {\n return (\n <>\n {childrenToRender.map((child) => (\n <PresenceChild\n key={getChildKey(child)}\n isEntering\n exitVariant={exitVariant}\n enterVariant={enterVariant}\n initial={initial ? undefined : false}\n presenceAffectsLayout={presenceAffectsLayout}\n >\n {child}\n </PresenceChild>\n ))}\n </>\n )\n }\n\n // If this is a subsequent render, deal with entering and exiting children\n childrenToRender = [...childrenToRender]\n\n // Diff the keys of the currently-present and target children to update our\n // exiting list.\n const presentKeys = presentChildren.current.map(getChildKey)\n const targetKeys = filteredChildren.map(getChildKey)\n\n // Diff the present children with our target children and mark those that are exiting\n const numPresent = presentKeys.length\n for (let i = 0; i < numPresent; i++) {\n const key = presentKeys[i]\n\n if (targetKeys.indexOf(key) === -1) {\n exiting.add(key)\n }\n }\n\n // If we currently have exiting children, and we're deferring rendering incoming children\n // until after all current children have exiting, empty the childrenToRender array\n if (exitBeforeEnter && exiting.size) {\n childrenToRender = []\n }\n\n // Loop through all currently exiting components and clone them to overwrite `animate`\n // with any `exit` prop they might have defined.\n exiting.forEach((key) => {\n // If this component is actually entering again, early return\n if (targetKeys.indexOf(key) !== -1) return\n\n const child = allChildren.get(key)\n if (!child) return\n\n const insertionIndex = presentKeys.indexOf(key)\n\n childrenToRender.splice(\n insertionIndex,\n 0,\n <PresenceChild\n key={getChildKey(child)}\n isEntering={false}\n onExitComplete={() => {\n allChildren.delete(key)\n exiting.delete(key)\n\n // Remove this child from the present children\n const removeIndex = presentChildren.current.findIndex(\n (presentChild) => presentChild.key === key\n )\n presentChildren.current.splice(removeIndex, 1)\n\n // Defer re-rendering until all exiting children have indeed left\n if (!exiting.size) {\n presentChildren.current = filteredChildren\n\n if (isMounted === false) return\n\n forceRender()\n onExitComplete?.()\n }\n }}\n exitVariant={exitVariant}\n enterVariant={enterVariant}\n presenceAffectsLayout={presenceAffectsLayout}\n >\n {child}\n </PresenceChild>\n )\n })\n\n // Add `MotionContext` even to children that don't need it to ensure we're rendering\n // the same tree between renders\n childrenToRender = childrenToRender.map((child) => {\n const key = child.key as string | number\n return exiting.has(key) ? (\n child\n ) : (\n <PresenceChild\n key={getChildKey(child)}\n isEntering={undefined}\n exitVariant={exitVariant}\n enterVariant={enterVariant}\n presenceAffectsLayout={presenceAffectsLayout}\n >\n {child}\n </PresenceChild>\n )\n })\n\n if (process.env.NODE_ENV !== 'production' && exitBeforeEnter && childrenToRender.length > 1) {\n console.warn(\n `You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour.`\n )\n }\n\n return (\n <>{exiting.size ? childrenToRender : childrenToRender.map((child) => cloneElement(child))}</>\n )\n}\n\nAnimatePresence.displayName = 'AnimatePresence'\n"],
5
- "mappings": ";;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA;AACA;AAEA,MAAM;AAsCN,MAAM,cAAc,wBAAC,UAA2C,MAAM,OAAO,IAAzD;AAEpB,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAEvC,2BACE,UACA,aACA;AACA,QAAM,eAAe,QAAQ,oBAAI,IAAkB,IAAI;AAEvD,WAAS,QAAQ,CAAC,UAAU;AAC1B,UAAM,M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O,QAAQ,IAAI,GAAG,IACpB,QAEA,oCAAC;AAAA,MACC,KAAK,YAAY,KAAK;AAAA,MACtB,YAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,OAEC,KACH;AAAA,EAEJ,CAAC;AAED,MAAI,QAAQ,IAAI,aAAa,gBAAgB,mBAAmB,iBAAiB,SAAS,GAAG;AAC3F,YAAQ,KACN,6JACF;AAAA,EACF;AAEA,SACE,0DAAG,QAAQ,OAAO,mBAAmB,iBAAiB,IAAI,CAAC,UAAU,aAAa,KAAK,CAAC,CAAE;AAE9F,GAvKI;AAyKJ,gBAAgB,cAAc;",
4
+ "sourcesContent": ["import {\n useForceUpdate,\n useIsMounted,\n useIsomorphicLayoutEffect,\n useUnmountEffect,\n} from '@tamagui/core'\nimport React, {\n Children,\n ReactElement,\n ReactNode,\n cloneElement,\n isValidElement,\n useContext,\n useRef,\n} from 'react'\n\nimport { LayoutGroupContext } from './LayoutGroupContext'\nimport { PresenceChild } from './PresenceChild'\nimport { AnimatePresenceProps } from './types'\n\nReact['keep']\n\ntype ComponentKey = string | number\n\nconst getChildKey = (child: ReactElement<any>): ComponentKey => child.key || ''\n\nconst isDev = process.env.NODE_ENV !== 'production'\n\nfunction updateChildLookup(\n children: ReactElement<any>[],\n allChildren: Map<ComponentKey, ReactElement<any>>\n) {\n const seenChildren = isDev ? new Set<ComponentKey>() : null\n\n children.forEach((child) => {\n const key = getChildKey(child)\n\n if (isDev && seenChildren && seenChildren.has(key)) {\n console.warn(`Children of AnimatePresence require unique keys. \"${key}\" is a duplicate.`)\n\n seenChildren.add(key)\n }\n\n allChildren.set(key, child)\n })\n}\n\nfunction onlyElements(children: ReactNode): ReactElement<any>[] {\n const filtered: ReactElement<any>[] = []\n\n // We use forEach here instead of map as map mutates the component key by preprending `.$`\n Children.forEach(children, (child, index) => {\n if (isValidElement(child)) {\n if (!child.key) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(`No key given to AnimatePresence child, assigning index as key`)\n }\n filtered.push(\n React.cloneElement(child, {\n key: index,\n })\n )\n } else {\n filtered.push(child)\n }\n }\n })\n\n return filtered\n}\n\n/**\n * `AnimatePresence` enables the animation of components that have been removed from the tree.\n *\n * When adding/removing more than a single child, every child **must** be given a unique `key` prop.\n *\n * Any `motion` components that have an `exit` property defined will animate out when removed from\n * the tree.\n *\n * ```tsx\n * import { motion, AnimatePresence } from 'framer-motion'\n *\n * export const Items = ({ items }) => (\n * <AnimatePresence>\n * {items.map(item => (\n * <motion.div\n * key={item.id}\n * initial={{ opacity: 0 }}\n * animate={{ opacity: 1 }}\n * exit={{ opacity: 0 }}\n * />\n * ))}\n * </AnimatePresence>\n * )\n * ```\n *\n * You can sequence exit animations throughout a tree using variants.\n *\n * If a child contains multiple `motion` components with `exit` props, it will only unmount the child\n * once all `motion` components have finished animating out. Likewise, any components using\n * `usePresence` all need to call `safeToRemove`.\n *\n * @public\n */\nexport const AnimatePresence: React.FunctionComponent<\n React.PropsWithChildren<AnimatePresenceProps>\n> = ({\n children,\n enterVariant,\n exitVariant,\n initial = true,\n onExitComplete,\n exitBeforeEnter,\n presenceAffectsLayout = true,\n}) => {\n // We want to force a re-render once all exiting animations have finished. We\n // either use a local forceRender function, or one from a parent context if it exists.\n let forceRender = useForceUpdate()\n const forceRenderLayoutGroup = useContext(LayoutGroupContext).forceRender\n if (forceRenderLayoutGroup) forceRender = forceRenderLayoutGroup\n\n const isMounted = useIsMounted()\n\n // Filter out any children that aren't ReactElements. We can only track ReactElements with a props.key\n const filteredChildren = onlyElements(children)\n let childrenToRender = filteredChildren\n\n const exiting = new Set<ComponentKey>()\n\n // Keep a living record of the children we're actually rendering so we\n // can diff to figure out which are entering and exiting\n const presentChildren = useRef(childrenToRender)\n\n // A lookup table to quickly reference components by key\n const allChildren = useRef(new Map<ComponentKey, ReactElement<any>>()).current\n\n // If this is the initial component render, just deal with logic surrounding whether\n // we play onMount animations or not.\n const isInitialRender = useRef(true)\n\n useIsomorphicLayoutEffect(() => {\n isInitialRender.current = false\n updateChildLookup(filteredChildren, allChildren)\n presentChildren.current = childrenToRender\n })\n\n useUnmountEffect(() => {\n isInitialRender.current = true\n allChildren.clear()\n exiting.clear()\n })\n\n if (isInitialRender.current) {\n return (\n <>\n {childrenToRender.map((child) => (\n <PresenceChild\n key={getChildKey(child)}\n isPresent\n exitVariant={exitVariant}\n enterVariant={enterVariant}\n initial={initial ? undefined : false}\n presenceAffectsLayout={presenceAffectsLayout}\n >\n {child}\n </PresenceChild>\n ))}\n </>\n )\n }\n\n // If this is a subsequent render, deal with entering and exiting children\n childrenToRender = [...childrenToRender]\n\n // Diff the keys of the currently-present and target children to update our\n // exiting list.\n const presentKeys = presentChildren.current.map(getChildKey)\n const targetKeys = filteredChildren.map(getChildKey)\n\n // Diff the present children with our target children and mark those that are exiting\n const numPresent = presentKeys.length\n for (let i = 0; i < numPresent; i++) {\n const key = presentKeys[i]\n if (targetKeys.indexOf(key) === -1) {\n exiting.add(key)\n }\n }\n\n // If we currently have exiting children, and we're deferring rendering incoming children\n // until after all current children have exiting, empty the childrenToRender array\n if (exitBeforeEnter && exiting.size) {\n childrenToRender = []\n }\n\n // Loop through all currently exiting components and clone them to overwrite `animate`\n // with any `exit` prop they might have defined.\n exiting.forEach((key) => {\n // If this component is actually entering again, early return\n if (targetKeys.indexOf(key) !== -1) return\n\n const child = allChildren.get(key)\n if (!child) return\n\n const insertionIndex = presentKeys.indexOf(key)\n\n childrenToRender.splice(\n insertionIndex,\n 0,\n <PresenceChild\n key={getChildKey(child)}\n isPresent={false}\n onExitComplete={() => {\n allChildren.delete(key)\n exiting.delete(key)\n\n // Remove this child from the present children\n const removeIndex = presentChildren.current.findIndex(\n (presentChild) => presentChild.key === key\n )\n presentChildren.current.splice(removeIndex, 1)\n\n // Defer re-rendering until all exiting children have indeed left\n if (!exiting.size) {\n presentChildren.current = filteredChildren\n\n if (isMounted.current === false) return\n\n forceRender()\n onExitComplete?.()\n }\n }}\n exitVariant={exitVariant}\n enterVariant={enterVariant}\n presenceAffectsLayout={presenceAffectsLayout}\n >\n {child}\n </PresenceChild>\n )\n })\n\n // Add `MotionContext` even to children that don't need it to ensure we're rendering\n // the same tree between renders\n childrenToRender = childrenToRender.map((child) => {\n const key = child.key as string | number\n return exiting.has(key) ? (\n child\n ) : (\n <PresenceChild\n key={getChildKey(child)}\n isPresent\n exitVariant={exitVariant}\n enterVariant={enterVariant}\n presenceAffectsLayout={presenceAffectsLayout}\n >\n {child}\n </PresenceChild>\n )\n })\n\n if (process.env.NODE_ENV !== 'production' && exitBeforeEnter && childrenToRender.length > 1) {\n console.warn(\n `You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour.`\n )\n }\n\n return (\n <>{exiting.size ? childrenToRender : childrenToRender.map((child) => cloneElement(child))}</>\n )\n}\n\nAnimatePresence.displayName = 'AnimatePresence'\n"],
5
+ "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA;AACA;AAGA,MAAM;AAIN,MAAM,cAAc,CAAC,UAA2C,MAAM,OAAO;AAE7E,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAEvC,2BACE,UACA,aACA;AACA,QAAM,eAAe,QAAQ,oBAAI,IAAkB,IAAI;AAEvD,WAAS,QAAQ,CAAC,UAAU;AAC1B,UAAM,MAAM,YAAY,KAAK;AAE7B,QAAI,SAAS,gBAAgB,aAAa,IAAI,GAAG,GAAG;AAClD,cAAQ,KAAK,qDAAqD,sBAAsB;AAExF,mBAAa,IAAI,GAAG;AAAA,IACtB;AAEA,gBAAY,IAAI,KAAK,KAAK;AAAA,EAC5B,CAAC;AACH;AAEA,sBAAsB,UAA0C;AAC9D,QAAM,WAAgC,CAAC;AAGvC,WAAS,QAAQ,UAAU,CAAC,OAAO,UAAU;AAC3C,QAAI,eAAe,KAAK,GAAG;AACzB,UAAI,CAAC,MAAM,KAAK;AACd,YAAI,QAAQ,IAA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