@tamagui/animate-presence 1.111.8 → 1.111.9

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.
@@ -1,74 +1,89 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useForceUpdate } from "@tamagui/use-force-update";
3
3
  import { Children, cloneElement, isValidElement, useContext, useRef } from "react";
4
- import { LayoutGroupContext } from "./LayoutGroupContext";
5
- import { PresenceChild } from "./PresenceChild";
6
- var getChildKey = function(child) {
4
+ import { LayoutGroupContext } from "./LayoutGroupContext.native.js";
5
+ import { PresenceChild } from "./PresenceChild.native.js";
6
+ var getChildKey = function (child) {
7
7
  return child.key || "";
8
8
  };
9
9
  function updateChildLookup(children, allChildren) {
10
- children.forEach(function(child) {
10
+ children.forEach(function (child) {
11
11
  var key = getChildKey(child);
12
12
  allChildren.set(key, child);
13
13
  });
14
14
  }
15
15
  function onlyElements(children) {
16
16
  var filtered = [];
17
- return Children.forEach(children, function(child) {
18
- /* @__PURE__ */ isValidElement(child) && filtered.push(child);
17
+ return Children.forEach(children, function (child) {
18
+ /* @__PURE__ */isValidElement(child) && filtered.push(child);
19
19
  }), filtered;
20
20
  }
21
- var AnimatePresence = function(param) {
22
- var { children, enterVariant, exitVariant, enterExitVariant, initial = !0, onExitComplete, exitBeforeEnter, presenceAffectsLayout = !0, custom } = param, _useContext_forceRender, forceRender = (_useContext_forceRender = useContext(LayoutGroupContext).forceRender) !== null && _useContext_forceRender !== void 0 ? _useContext_forceRender : useForceUpdate(), filteredChildren = onlyElements(children), presentChildren = useRef(filteredChildren), allChildren = useRef(/* @__PURE__ */ new Map()).current, exiting = useRef(/* @__PURE__ */ new Set()).current;
21
+ var AnimatePresence = function (param) {
22
+ var {
23
+ children,
24
+ enterVariant,
25
+ exitVariant,
26
+ enterExitVariant,
27
+ initial = !0,
28
+ onExitComplete,
29
+ exitBeforeEnter,
30
+ presenceAffectsLayout = !0,
31
+ custom
32
+ } = param,
33
+ _useContext_forceRender,
34
+ forceRender = (_useContext_forceRender = useContext(LayoutGroupContext).forceRender) !== null && _useContext_forceRender !== void 0 ? _useContext_forceRender : useForceUpdate(),
35
+ filteredChildren = onlyElements(children),
36
+ presentChildren = useRef(filteredChildren),
37
+ allChildren = useRef(/* @__PURE__ */new Map()).current,
38
+ exiting = useRef(/* @__PURE__ */new Set()).current;
23
39
  updateChildLookup(filteredChildren, allChildren);
24
40
  var isInitialRender = useRef(!0);
25
- if (isInitialRender.current)
26
- return isInitialRender.current = !1, /* @__PURE__ */ _jsx(_Fragment, {
27
- children: filteredChildren.map(function(child) {
28
- return /* @__PURE__ */ _jsx(PresenceChild, {
29
- isPresent: !0,
30
- enterExitVariant,
31
- exitVariant,
32
- enterVariant,
33
- initial: initial ? void 0 : !1,
34
- presenceAffectsLayout,
35
- custom,
36
- children: child
37
- }, getChildKey(child));
38
- })
39
- });
40
- for (var childrenToRender = [
41
- ...filteredChildren
42
- ], presentKeys = presentChildren.current.map(getChildKey), targetKeys = filteredChildren.map(getChildKey), numPresent = presentKeys.length, i = 0; i < numPresent; i++) {
41
+ if (isInitialRender.current) return isInitialRender.current = !1, /* @__PURE__ */_jsx(_Fragment, {
42
+ children: filteredChildren.map(function (child) {
43
+ return /* @__PURE__ */_jsx(PresenceChild, {
44
+ isPresent: !0,
45
+ enterExitVariant,
46
+ exitVariant,
47
+ enterVariant,
48
+ initial: initial ? void 0 : !1,
49
+ presenceAffectsLayout,
50
+ custom,
51
+ children: child
52
+ }, getChildKey(child));
53
+ })
54
+ });
55
+ for (var childrenToRender = [...filteredChildren], presentKeys = presentChildren.current.map(getChildKey), targetKeys = filteredChildren.map(getChildKey), numPresent = presentKeys.length, i = 0; i < numPresent; i++) {
43
56
  var key = presentKeys[i];
44
57
  targetKeys.indexOf(key) === -1 ? exiting.add(key) : exiting.delete(key);
45
58
  }
46
- return exitBeforeEnter && exiting.size && (childrenToRender = []), exiting.forEach(function(key2) {
59
+ return exitBeforeEnter && exiting.size && (childrenToRender = []), exiting.forEach(function (key2) {
47
60
  if (targetKeys.indexOf(key2) === -1) {
48
61
  var child = allChildren.get(key2);
49
62
  if (child) {
50
- var insertionIndex = presentKeys.indexOf(key2), onExit = function() {
51
- allChildren.delete(key2), exiting.delete(key2);
52
- var removeIndex = presentChildren.current.findIndex(function(presentChild) {
53
- return presentChild.key === key2;
54
- });
55
- presentChildren.current.splice(removeIndex, 1), exiting.size || (presentChildren.current = filteredChildren, forceRender(), onExitComplete?.());
56
- }, exitingComponent = /* @__PURE__ */ _jsx(PresenceChild, {
57
- isPresent: !1,
58
- onExitComplete: onExit,
59
- presenceAffectsLayout,
60
- enterExitVariant,
61
- enterVariant,
62
- exitVariant,
63
- custom,
64
- children: child
65
- }, getChildKey(child));
63
+ var insertionIndex = presentKeys.indexOf(key2),
64
+ onExit = function () {
65
+ allChildren.delete(key2), exiting.delete(key2);
66
+ var removeIndex = presentChildren.current.findIndex(function (presentChild) {
67
+ return presentChild.key === key2;
68
+ });
69
+ presentChildren.current.splice(removeIndex, 1), exiting.size || (presentChildren.current = filteredChildren, forceRender(), onExitComplete?.());
70
+ },
71
+ exitingComponent = /* @__PURE__ */_jsx(PresenceChild, {
72
+ isPresent: !1,
73
+ onExitComplete: onExit,
74
+ presenceAffectsLayout,
75
+ enterExitVariant,
76
+ enterVariant,
77
+ exitVariant,
78
+ custom,
79
+ children: child
80
+ }, getChildKey(child));
66
81
  childrenToRender.splice(insertionIndex, 0, exitingComponent);
67
82
  }
68
83
  }
69
- }), childrenToRender = childrenToRender.map(function(child) {
84
+ }), childrenToRender = childrenToRender.map(function (child) {
70
85
  var key2 = child.key;
71
- return exiting.has(key2) ? child : /* @__PURE__ */ _jsx(PresenceChild, {
86
+ return exiting.has(key2) ? child : /* @__PURE__ */_jsx(PresenceChild, {
72
87
  isPresent: !0,
73
88
  exitVariant,
74
89
  enterVariant,
@@ -77,17 +92,14 @@ var AnimatePresence = function(param) {
77
92
  custom,
78
93
  children: child
79
94
  }, getChildKey(child));
80
- }), presentChildren.current = childrenToRender, /* @__PURE__ */ _jsx(_Fragment, {
81
- children: exiting.size ? childrenToRender : (
82
- // biome-ignore lint/correctness/useJsxKeyInIterable: <explanation>
83
- childrenToRender.map(function(child) {
84
- return /* @__PURE__ */ cloneElement(child);
85
- })
86
- )
95
+ }), presentChildren.current = childrenToRender, /* @__PURE__ */_jsx(_Fragment, {
96
+ children: exiting.size ? childrenToRender :
97
+ // biome-ignore lint/correctness/useJsxKeyInIterable: <explanation>
98
+ childrenToRender.map(function (child) {
99
+ return /* @__PURE__ */cloneElement(child);
100
+ })
87
101
  });
88
102
  };
89
103
  AnimatePresence.displayName = "AnimatePresence";
90
- export {
91
- AnimatePresence
92
- };
93
- //# sourceMappingURL=AnimatePresence.js.map
104
+ export { AnimatePresence };
105
+ //# sourceMappingURL=AnimatePresence.native.js.map
@@ -1,6 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/Users/n8/tamagui/code/ui/animate-presence/src/AnimatePresence.tsx"],
4
- "mappings": ";AAAA,SAASA,sBAAsB;AAG/B,SAASC,UAAUC,cAAcC,gBAAgBC,YAAYC,cAAc;AAE3E,SAASC,0BAA0B;AACnC,SAASC,qBAAqB;AAK9B,IAAMC,cAAc,SAACC,OAAAA;SAA2CA,MAAMC,OAAO;;AAE7E,SAASC,kBACPC,UACAC,aAAiD;AAEjDD,WAASE,QAAQ,SAACL,OAAAA;AAChB,QAAMC,MAAMF,YAAYC,KAAAA;AACxBI,gBAAYE,IAAIL,KAAKD,KAAAA;EACvB,CAAA;AACF;AAEA,SAASO,aAAaJ,UAAmB;AACvC,MAAMK,WAAgC,CAAA;AAEtChB,kBAASa,QAAQF,UAAU,SAACH,OAAAA;AAC1B,IAAIN,+BAAeM,KAAAA,KAAQQ,SAASC,KAAKT,KAAAA;EAC3C,CAAA,GACOQ;AACT;AAEO,IAAME,kBAET,SAAA,OAAA;MAAC,EACHP,UACAQ,cACAC,aACAC,kBACAC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nC,IAAAA,GAErCyC,SAAS,WAAA;AACbtC,sBAAYkC,OAAOrC,IAAAA,GACnBuB,QAAQc,OAAOrC,IAAAA;AACf,cAAM0C,cAActB,gBAAgBE,QAAQqB,UAC1C,SAACC,cAAAA;mBAAiBA,aAAa5C,QAAQA;;AAEzCoB,0BAAgBE,QAAQuB,OAAOH,aAAa,CAAA,GAEvCnB,QAAQe,SACXlB,gBAAgBE,UAAUH,kBAC1BD,YAAAA,GACAJ,iBAAAA;QAEJ,GAEMgC,mBACJ,qBAACjD,eAAAA;UAEC8B,WAAW;UACXb,gBAAgB2B;UAChBzB;UACAJ;UACAF;UACAC;UACAM;oBAEClB;WATID,YAAYC,KAAAA,CAAAA;AAarB8B,yBAAiBgB,OAAOL,gBAAgB,GAAGM,gBAAAA;;;EAC7C,CAAA,GAIAjB,mBAAmBA,iBAAiBH,IAAI,SAAC3B,OAAAA;AACvC,QAAMC,OAAMD,MAAMC;AAClB,WAAOuB,QAAQwB,IAAI/C,IAAAA,IACjBD,QAEA,qBAACF,eAAAA;MAEC8B,WAAS;MACThB;MACAD;MACAE;MACAI;MACAC;gBAEClB;OARID,YAAYC,KAAAA,CAAAA;EAWvB,CAAA,GAEAqB,gBAAgBE,UAAUO,kBAGxB,qBAAA,WAAA;cACGN,QAAQe,OACLT;;MAEAA,iBAAiBH,IAAI,SAAC3B,OAAAA;eAAUP,6BAAaO,KAAAA;;;;AAGvD;AAEAU,gBAAgBuC,cAAc;",
5
- "names": ["useForceUpdate", "Children", "cloneElement", "isValidElement", "useContext", "useRef", "LayoutGroupContext", "PresenceChild", "getChildKey", "child", "key", "updateChildLookup", "children", "allChildren", "forEach", "set", "onlyElements", "filtered", "push", "AnimatePresence", "enterVariant", "exitVariant", "enterExitVariant", "initial", "onExitComplete", "exitBeforeEnter", "presenceAffectsLayout", "custom", "forceRender", "filteredChildren", "presentChildren", "Map", "current", "exiting", "Set", "isInitialRender", "map", "isPresent", "undefined", "childrenToRender", "presentKeys", "targetKeys", "numPresent", "length", "i", "indexOf", "add", "delete", "size", "get", "insertionIndex", "onExit", "removeIndex", "findIndex", "presentChild", "splice", "exitingComponent", "has", "displayName"]
6
- }
1
+ {"version":3,"names":["jsx","_jsx","Fragment","_Fragment","useForceUpdate","Children","cloneElement","isValidElement","useContext","useRef","LayoutGroupContext","PresenceChild","getChildKey","child","key","updateChildLookup","children","allChildren","forEach","set","onlyElements","filtered","push","AnimatePresence","param","enterVariant","exitVariant","enterExitVariant","initial","onExitComplete","exitBeforeEnter","presenceAffectsLayout","custom","_useContext_forceRender","forceRender","filteredChildren","presentChildren","Map","current","exiting","Set","isInitialRender","map","isPresent","childrenToRender","presentKeys","targetKeys","numPresent","length","i","indexOf","add","delete","size","key2","get","insertionIndex","onExit","removeIndex","findIndex","presentChild","splice","exitingComponent","has","displayName"],"sources":["../../src/AnimatePresence.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAsBC,SAAA;AAG/B,SAASC,cAAU,mCAA8B;AAEjD,SAASC,QAAA,EAAAC,YAAA,EAAAC,cAA0B,EAAAC,UAAA,EAAAC,MAAA;AACnC,SAASC,kBAAA,QAAqB;AA+DxB,SAAAC,aAEI,QAFJ;AA1DN,IAAAC,WAAM,YAAAA,CAAeC,KAA2C;EAEhE,OAASA,KAAA,CAAAC,GAAA;AAIP;AACE,SAAAC,iBAAYA,CAAAC,QAAiB,EAAAC,WAAA;EAC7BD,QAAA,CAAAE,OAAY,WAASL,KAAK;IAC3B,IAAAC,GAAA,GAAAF,WAAA,CAAAC,KAAA;IACHI,WAAA,CAAAE,GAAA,CAAAL,GAAA,EAAAD,KAAA;EAEA;AACE;AAEA,SAAAO,YAASA,CAAAJ,QAAQ;EACf,IAAIK,QAAA,KAAe;EACrB,OACOhB,QAAA,CAAAa,OAAA,CAAAF,QAAA,YAAAH,KAAA;IACT,eAAAN,cAAA,CAAAM,KAAA,KAAAQ,QAAA,CAAAC,IAAA,CAAAT,KA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AF,GAAA,WAAA7B,KAAA;IAAA,IAOIyC,IAAA,GAAAzC,KAAA,CAAAC,GAAA;IAAA,OACAyB,OAAA,CAAAwB,GAAA,CAAAT,IAAA,IAAAzC,KAAA,kBAAAZ,IAAA,CAAAU,aAAA;MAAAgC,SACA;MAAAjB,WACA;MAAAD,YACA;MAAAE,gBAEC;MAAAI,qBAAA;MATIC,MAAA;MAUPhB,QAAA,EAAAH;IAGF,GAAAD,WAAA,CAAAC,KAAiB;EACnB,CAAC,GAIDuB,eAAA,CAAAE,OAAmB,GAAAM,gBAAsB,iBAAU3C,IAAA,CAAAE,SAAA;IACjDa,QAAM,EAAAuB,OAAM,CAAMc,IAAA,GAAAT,gBAAA;IAClB;IAGGA,gBAAA,CAAAF,GAAA,WAAA7B,KAAA;MAAA,sBAAAP,YAAA,CAAAO,KAAA;IAAA;EAGC;AACA;AACAU,eACA,CAAAyC,WAAA;AAAA,SACAzC,eAEC","ignoreList":[]}
@@ -1,6 +1,4 @@
1
1
  import React from "react";
2
- var LayoutGroupContext = /* @__PURE__ */ React.createContext({});
3
- export {
4
- LayoutGroupContext
5
- };
6
- //# sourceMappingURL=LayoutGroupContext.js.map
2
+ var LayoutGroupContext = /* @__PURE__ */React.createContext({});
3
+ export { LayoutGroupContext };
4
+ //# sourceMappingURL=LayoutGroupContext.native.js.map
@@ -1,6 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/Users/n8/tamagui/code/ui/animate-presence/src/LayoutGroupContext.tsx"],
4
- "mappings": "AAAA,OAAOA,WAAW;AAOX,IAAMC,qBAAqBD,sBAAME,cAAuC,CAAC,CAAA;",
5
- "names": ["React", "LayoutGroupContext", "createContext"]
6
- }
1
+ {"version":3,"names":["React","LayoutGroupContext","createContext"],"sources":["../../src/LayoutGroupContext.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAOX,IAAAC,kBAAM,kBAA2BD,KAAA,CAAuCE,aAAE","ignoreList":[]}
@@ -3,9 +3,21 @@ import { useConstant } from "@tamagui/use-constant";
3
3
  import { PresenceContext } from "@tamagui/use-presence";
4
4
  import * as React from "react";
5
5
  import { useId } from "react";
6
- var PresenceChild = /* @__PURE__ */ React.memo(function(param) {
7
- var { children, initial, isPresent, onExitComplete, exitVariant, enterVariant, enterExitVariant, presenceAffectsLayout, custom } = param, presenceChildren = useConstant(newChildrenMap), id = useId() || "", context = React.useMemo(
8
- function() {
6
+ var PresenceChild = /* @__PURE__ */React.memo(function (param) {
7
+ var {
8
+ children,
9
+ initial,
10
+ isPresent,
11
+ onExitComplete,
12
+ exitVariant,
13
+ enterVariant,
14
+ enterExitVariant,
15
+ presenceAffectsLayout,
16
+ custom
17
+ } = param,
18
+ presenceChildren = useConstant(newChildrenMap),
19
+ id = useId() || "",
20
+ context = React.useMemo(function () {
9
21
  return {
10
22
  id,
11
23
  initial,
@@ -14,14 +26,15 @@ var PresenceChild = /* @__PURE__ */ React.memo(function(param) {
14
26
  exitVariant,
15
27
  enterVariant,
16
28
  enterExitVariant,
17
- onExitComplete: function() {
29
+ onExitComplete: function () {
18
30
  presenceChildren.set(id, !0);
19
- var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
31
+ var _iteratorNormalCompletion = !0,
32
+ _didIteratorError = !1,
33
+ _iteratorError = void 0;
20
34
  try {
21
35
  for (var _iterator = presenceChildren.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
22
36
  var isComplete = _step.value;
23
- if (!isComplete)
24
- return;
37
+ if (!isComplete) return;
25
38
  }
26
39
  } catch (err) {
27
40
  _didIteratorError = !0, _iteratorError = err;
@@ -29,14 +42,13 @@ var PresenceChild = /* @__PURE__ */ React.memo(function(param) {
29
42
  try {
30
43
  !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
31
44
  } finally {
32
- if (_didIteratorError)
33
- throw _iteratorError;
45
+ if (_didIteratorError) throw _iteratorError;
34
46
  }
35
47
  }
36
48
  onExitComplete?.();
37
49
  },
38
- register: function() {
39
- return presenceChildren.set(id, !1), function() {
50
+ register: function () {
51
+ return presenceChildren.set(id, !1), function () {
40
52
  return presenceChildren.delete(id);
41
53
  };
42
54
  }
@@ -48,31 +60,20 @@ var PresenceChild = /* @__PURE__ */ React.memo(function(param) {
48
60
  * so they can detect that layout change.
49
61
  */
50
62
  // @ts-expect-error its ok
51
- presenceAffectsLayout ? void 0 : [
52
- isPresent,
53
- exitVariant,
54
- enterVariant
55
- ]
56
- );
57
- return React.useMemo(function() {
58
- presenceChildren.forEach(function(_, key) {
63
+ presenceAffectsLayout ? void 0 : [isPresent, exitVariant, enterVariant]);
64
+ return React.useMemo(function () {
65
+ presenceChildren.forEach(function (_, key) {
59
66
  return presenceChildren.set(key, !1);
60
67
  });
61
- }, [
62
- isPresent
63
- ]), React.useEffect(function() {
68
+ }, [isPresent]), React.useEffect(function () {
64
69
  !isPresent && !presenceChildren.size && onExitComplete?.();
65
- }, [
66
- isPresent
67
- ]), /* @__PURE__ */ _jsx(PresenceContext.Provider, {
70
+ }, [isPresent]), /* @__PURE__ */_jsx(PresenceContext.Provider, {
68
71
  value: context,
69
72
  children
70
73
  });
71
74
  });
72
75
  function newChildrenMap() {
73
- return /* @__PURE__ */ new Map();
76
+ return /* @__PURE__ */new Map();
74
77
  }
75
- export {
76
- PresenceChild
77
- };
78
- //# sourceMappingURL=PresenceChild.js.map
78
+ export { PresenceChild };
79
+ //# sourceMappingURL=PresenceChild.native.js.map
@@ -1,6 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/Users/n8/tamagui/code/ui/animate-presence/src/PresenceChild.tsx"],
4
- "mappings": ";AAAA,SAASA,mBAAmB;AAC5B,SAASC,uBAAuB;AAEhC,YAAYC,WAAW;AACvB,SAASC,aAAa;AAiBf,IAAMC,gBAAgBF,sBAAMG,KACjC,SAAA,OAAA;MAAC,EACCC,UACAC,SACAC,WACAC,gBACAC,aACAC,cACAC,kBACAC,uBACAC,OAAM,IACa,OACbC,mBAAmBf,YAAYgB,cAAAA,GAC/BC,KAAKd,MAAAA,KAAW,IAEhBe,UAAUhB,MAAMiB;IACpB,WAAA;AACE,aAAO;QACLF;QACAV;QACAC;QACAM;QACAJ;QACAC;QACAC;QACAH,gBAAgB,WAAA;AACdM,2BAAiBK,IAAIH,IAAI,EAAA;cACpB,4BAAA,IAAA,oBAAA,IAAA,iBAAA;;AAAL,qBAAK,YAAoBF,iBAAiBM,OAAM,EAAA,OAAA,QAAA,EAAA,GAA3C,OAAA,EAAA,6BAAA,QAAA,UAAA,KAAA,GAAA,OAAA,4BAAA,IAA+C;AAA/C,kBAAMC,aAAN,MAAA;AACH,kBAAI,CAACA;AACH;YAEJ;;AAJK,gCAAA,IAAA,iBAAA;;;eAAA,6BAAA,UAAA,UAAA,QAAA,UAAA,OAAA;;kBAAA;sBAAA;;;AAKLb,UAAAA,iBAAAA;QACF;QACAc,UAAU,WAAA;AACRR,kCAAiBK,IAAIH,IAAI,EAAA,GAClB,WAAA;mBAAMF,iBAAiBS,OAAOP,EAAAA;;QACvC;MACF;IACF;;;;;;;IAQAJ,wBAAwBY,SAAY;MAACjB;MAAWE;MAAaC;;EAAa;AAG5ET,eAAMiB,QAAQ,WAAA;AACZJ,qBAAiBW,QAAQ,SAACC,GAAGC,KAAAA;aAAQb,iBAAiBK,IAAIQ,KAAK,EAAA;;EACjE,GAAG;IAACpB;GAAU,GAMdN,MAAM2B,UAAU,WAAA;AACd,KAACrB,aAAa,CAACO,iBAAiBe,QAAQrB,iBAAAA;EAC1C,GAAG;IAACD;GAAU,GAEP,qBAACP,gBAAgB8B,UAAQ;IAACC,OAAOd;;;AAC1C,CAAA;AAGF,SAASF,iBAAAA;AACP,SAAO,oBAAIiB,IAAAA;AACb;",
5
- "names": ["useConstant", "PresenceContext", "React", "useId", "PresenceChild", "memo", "children", "initial", "isPresent", "onExitComplete", "exitVariant", "enterVariant", "enterExitVariant", "presenceAffectsLayout", "custom", "presenceChildren", "newChildrenMap", "id", "context", "useMemo", "set", "values", "isComplete", "register", "delete", "undefined", "forEach", "_", "key", "useEffect", "size", "Provider", "value", "Map"]
6
- }
1
+ {"version":3,"names":["jsx","_jsx","useConstant","PresenceContext","React","useId","PresenceChild","memo","param","children","initial","isPresent","onExitComplete","exitVariant","enterVariant","enterExitVariant","presenceAffectsLayout","custom","presenceChildren","newChildrenMap","id","context","useMemo","set","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","values","Symbol","iterator","_step","next","done","isComplete","value","err","return","register","delete"],"sources":["../../src/PresenceChild.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,GAAA,IAAAC,IAAA,QAAmB;AAC5B,SAASC,WAAA,+BAAuB;AAEhC,SAAAC,eAAuB;AACvB,YAASC,KAAA,MAAa;AA+EX,SAAAC,KAAA;AA9DJ,IAAAC,aAAM,kBAAsBF,KAAA,CAAAG,IAAA,WAAAC,KAAA;EACjC,IAAC;MAAAC,QAAA;MAAAC,OAAA;MAAAC,SAAA;MAAAC,cAAA;MAAAC,WAAA;MAAAC,YAAA;MAAAC,gBAAA;MAAAC,qBAAA;MAAAC;IAAA,IAAAT,KAAA;IAAAU,gBAAA,GAAAhB,WAAA,CAAAiB,cAAA;IAAAC,EAAA,GAAAf,KAAA;IAAAgB,OAAA,GAAAjB,KAAA,CAAAkB,OAAA,CACC;MACA;QACAF,EAAA;QACAV,OAAA;QACAC,SAAA;QACAM,MAAA;QACAJ,WAAA;QACAC,YAAA;QACAC,gBAAA;QACwBH,cAAA,WAAAA,CAAA;UAClBM,gBAAA,CAAAK,GAAmB,CAAAH,EAAA;UAIvB,IACSI,yBAAA;YAAAC,iBAAA;YAAAC,cAAA;UACL;YACA,SAAAC,SAAA,GAAAT,gBAAA,CAAAU,MAAA,GAAAC,MAAA,CAAAC,QAAA,KAAAC,KAAA,IAAAP,yBAAA,IAAAO,KAAA,GAAAJ,SAAA,CAAAK,IAAA,IAAAC,IAAA,GAAAT,yBAAA;cACA,IAAAU,UAAA,GAAAH,KAAA,CAAAI,KAAA;cACA,KAAAD,UAAA,EACA;YACA;UACA,SAAAE,GAAA;YACAX,iBAAgB,GAAM,IAAAC,cAAA,GAAAU,GAAA;UACpB;YACA;cACE,CAAAZ,yBAAK,IAAAG,SAAA,CAAAU,MAAA,YAAAV,SAAA,CAAAU,MAAA;YACH;cAGJ,IAAAZ,iBAAiB,EACnB,MAAAC,cAAA;YACA;UAIF;UAAAd,cAAA;QAAA;QAAA0B,QAAA,WAAAA,CAAA;UAAA,OAAApB,gBAAA,CAAAK,GAAA,CAAAH,EAAA;YAAA,OAAAF,gBAAA,CAAAqB,MAAA,CAAAnB,EAAA;UAAA;QASF;MACF;IAEA;IACE;AAAqE;AAQrE;AAAyD;AAGA;IAE/D;IAEAJ,qBAAS,GAAuC,UAC9CL,SAAO,EACTE,WAAA,E","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- export * from "./AnimatePresence";
1
+ export * from "./AnimatePresence.native.js";
2
2
  export * from "@tamagui/use-presence";
3
- export * from "./types";
4
- export * from "./PresenceChild";
5
- //# sourceMappingURL=index.js.map
3
+ export * from "./types.native.js";
4
+ export * from "./PresenceChild.native.js";
5
+ //# sourceMappingURL=index.native.js.map
@@ -1,6 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/Users/n8/tamagui/code/ui/animate-presence/src/index.ts"],
4
- "mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
5
- "names": []
6
- }
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc","ignoreList":[]}
@@ -1 +1,2 @@
1
- //# sourceMappingURL=types.js.map
1
+
2
+ //# sourceMappingURL=types.native.js.map
@@ -1,6 +1 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "mappings": "",
5
- "names": []
6
- }
1
+ {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/animate-presence",
3
- "version": "1.111.8",
3
+ "version": "1.111.9",
4
4
  "source": "src/index.ts",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -13,14 +13,14 @@
13
13
  "dist"
14
14
  ],
15
15
  "dependencies": {
16
- "@tamagui/helpers": "1.111.8",
17
- "@tamagui/use-constant": "1.111.8",
18
- "@tamagui/use-force-update": "1.111.8",
19
- "@tamagui/use-presence": "1.111.8",
20
- "@tamagui/web": "1.111.8"
16
+ "@tamagui/helpers": "1.111.9",
17
+ "@tamagui/use-constant": "1.111.9",
18
+ "@tamagui/use-force-update": "1.111.9",
19
+ "@tamagui/use-presence": "1.111.9",
20
+ "@tamagui/web": "1.111.9"
21
21
  },
22
22
  "devDependencies": {
23
- "@tamagui/build": "1.111.8"
23
+ "@tamagui/build": "1.111.9"
24
24
  },
25
25
  "scripts": {
26
26
  "build": "tamagui-build",
@@ -33,7 +33,7 @@
33
33
  "exports": {
34
34
  "./package.json": "./package.json",
35
35
  ".": {
36
- "react-native-import": "./dist/esm/index.native.mjs",
36
+ "react-native-import": "./dist/esm/index.native.js",
37
37
  "react-native": "./dist/cjs/index.native.js",
38
38
  "types": "./types/index.d.ts",
39
39
  "import": "./dist/esm/index.mjs",
@@ -1,105 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useForceUpdate } from "@tamagui/use-force-update";
3
- import { Children, cloneElement, isValidElement, useContext, useRef } from "react";
4
- import { LayoutGroupContext } from "./LayoutGroupContext.native.mjs";
5
- import { PresenceChild } from "./PresenceChild.native.mjs";
6
- var getChildKey = function (child) {
7
- return child.key || "";
8
- };
9
- function updateChildLookup(children, allChildren) {
10
- children.forEach(function (child) {
11
- var key = getChildKey(child);
12
- allChildren.set(key, child);
13
- });
14
- }
15
- function onlyElements(children) {
16
- var filtered = [];
17
- return Children.forEach(children, function (child) {
18
- /* @__PURE__ */isValidElement(child) && filtered.push(child);
19
- }), filtered;
20
- }
21
- var AnimatePresence = function (param) {
22
- var {
23
- children,
24
- enterVariant,
25
- exitVariant,
26
- enterExitVariant,
27
- initial = !0,
28
- onExitComplete,
29
- exitBeforeEnter,
30
- presenceAffectsLayout = !0,
31
- custom
32
- } = param,
33
- _useContext_forceRender,
34
- forceRender = (_useContext_forceRender = useContext(LayoutGroupContext).forceRender) !== null && _useContext_forceRender !== void 0 ? _useContext_forceRender : useForceUpdate(),
35
- filteredChildren = onlyElements(children),
36
- presentChildren = useRef(filteredChildren),
37
- allChildren = useRef(/* @__PURE__ */new Map()).current,
38
- exiting = useRef(/* @__PURE__ */new Set()).current;
39
- updateChildLookup(filteredChildren, allChildren);
40
- var isInitialRender = useRef(!0);
41
- if (isInitialRender.current) return isInitialRender.current = !1, /* @__PURE__ */_jsx(_Fragment, {
42
- children: filteredChildren.map(function (child) {
43
- return /* @__PURE__ */_jsx(PresenceChild, {
44
- isPresent: !0,
45
- enterExitVariant,
46
- exitVariant,
47
- enterVariant,
48
- initial: initial ? void 0 : !1,
49
- presenceAffectsLayout,
50
- custom,
51
- children: child
52
- }, getChildKey(child));
53
- })
54
- });
55
- for (var childrenToRender = [...filteredChildren], presentKeys = presentChildren.current.map(getChildKey), targetKeys = filteredChildren.map(getChildKey), numPresent = presentKeys.length, i = 0; i < numPresent; i++) {
56
- var key = presentKeys[i];
57
- targetKeys.indexOf(key) === -1 ? exiting.add(key) : exiting.delete(key);
58
- }
59
- return exitBeforeEnter && exiting.size && (childrenToRender = []), exiting.forEach(function (key2) {
60
- if (targetKeys.indexOf(key2) === -1) {
61
- var child = allChildren.get(key2);
62
- if (child) {
63
- var insertionIndex = presentKeys.indexOf(key2),
64
- onExit = function () {
65
- allChildren.delete(key2), exiting.delete(key2);
66
- var removeIndex = presentChildren.current.findIndex(function (presentChild) {
67
- return presentChild.key === key2;
68
- });
69
- presentChildren.current.splice(removeIndex, 1), exiting.size || (presentChildren.current = filteredChildren, forceRender(), onExitComplete?.());
70
- },
71
- exitingComponent = /* @__PURE__ */_jsx(PresenceChild, {
72
- isPresent: !1,
73
- onExitComplete: onExit,
74
- presenceAffectsLayout,
75
- enterExitVariant,
76
- enterVariant,
77
- exitVariant,
78
- custom,
79
- children: child
80
- }, getChildKey(child));
81
- childrenToRender.splice(insertionIndex, 0, exitingComponent);
82
- }
83
- }
84
- }), childrenToRender = childrenToRender.map(function (child) {
85
- var key2 = child.key;
86
- return exiting.has(key2) ? child : /* @__PURE__ */_jsx(PresenceChild, {
87
- isPresent: !0,
88
- exitVariant,
89
- enterVariant,
90
- enterExitVariant,
91
- presenceAffectsLayout,
92
- custom,
93
- children: child
94
- }, getChildKey(child));
95
- }), presentChildren.current = childrenToRender, /* @__PURE__ */_jsx(_Fragment, {
96
- children: exiting.size ? childrenToRender :
97
- // biome-ignore lint/correctness/useJsxKeyInIterable: <explanation>
98
- childrenToRender.map(function (child) {
99
- return /* @__PURE__ */cloneElement(child);
100
- })
101
- });
102
- };
103
- AnimatePresence.displayName = "AnimatePresence";
104
- export { AnimatePresence };
105
- //# sourceMappingURL=AnimatePresence.native.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["jsx","_jsx","Fragment","_Fragment","useForceUpdate","Children","cloneElement","isValidElement","useContext","useRef","LayoutGroupContext","PresenceChild","getChildKey","child","key","updateChildLookup","children","allChildren","forEach","set","onlyElements","filtered","push","AnimatePresence","param","enterVariant","exitVariant","enterExitVariant","initial","onExitComplete","exitBeforeEnter","presenceAffectsLayout","custom","_useContext_forceRender","forceRender","filteredChildren","presentChildren","Map","current","exiting","Set","isInitialRender","map","isPresent","childrenToRender","presentKeys","targetKeys","numPresent","length","i","indexOf","add","delete","size","key2","get","insertionIndex","onExit","removeIndex","findIndex","presentChild","splice","exitingComponent","has","displayName"],"sources":["../../src/AnimatePresence.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,GAAA,IAAAC,IAAA,EAAAC,QAAA,IA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,4 +0,0 @@
1
- import React from "react";
2
- var LayoutGroupContext = /* @__PURE__ */React.createContext({});
3
- export { LayoutGroupContext };
4
- //# sourceMappingURL=LayoutGroupContext.native.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","LayoutGroupContext","createContext"],"sources":["../../src/LayoutGroupContext.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAOX,IAAAC,kBAAM,kBAA2BD,KAAA,CAAuCE,aAAE","ignoreList":[]}
@@ -1,79 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useConstant } from "@tamagui/use-constant";
3
- import { PresenceContext } from "@tamagui/use-presence";
4
- import * as React from "react";
5
- import { useId } from "react";
6
- var PresenceChild = /* @__PURE__ */React.memo(function (param) {
7
- var {
8
- children,
9
- initial,
10
- isPresent,
11
- onExitComplete,
12
- exitVariant,
13
- enterVariant,
14
- enterExitVariant,
15
- presenceAffectsLayout,
16
- custom
17
- } = param,
18
- presenceChildren = useConstant(newChildrenMap),
19
- id = useId() || "",
20
- context = React.useMemo(function () {
21
- return {
22
- id,
23
- initial,
24
- isPresent,
25
- custom,
26
- exitVariant,
27
- enterVariant,
28
- enterExitVariant,
29
- onExitComplete: function () {
30
- presenceChildren.set(id, !0);
31
- var _iteratorNormalCompletion = !0,
32
- _didIteratorError = !1,
33
- _iteratorError = void 0;
34
- try {
35
- for (var _iterator = presenceChildren.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
36
- var isComplete = _step.value;
37
- if (!isComplete) return;
38
- }
39
- } catch (err) {
40
- _didIteratorError = !0, _iteratorError = err;
41
- } finally {
42
- try {
43
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
44
- } finally {
45
- if (_didIteratorError) throw _iteratorError;
46
- }
47
- }
48
- onExitComplete?.();
49
- },
50
- register: function () {
51
- return presenceChildren.set(id, !1), function () {
52
- return presenceChildren.delete(id);
53
- };
54
- }
55
- };
56
- },
57
- /**
58
- * If the presence of a child affects the layout of the components around it,
59
- * we want to make a new context value to ensure they get re-rendered
60
- * so they can detect that layout change.
61
- */
62
- // @ts-expect-error its ok
63
- presenceAffectsLayout ? void 0 : [isPresent, exitVariant, enterVariant]);
64
- return React.useMemo(function () {
65
- presenceChildren.forEach(function (_, key) {
66
- return presenceChildren.set(key, !1);
67
- });
68
- }, [isPresent]), React.useEffect(function () {
69
- !isPresent && !presenceChildren.size && onExitComplete?.();
70
- }, [isPresent]), /* @__PURE__ */_jsx(PresenceContext.Provider, {
71
- value: context,
72
- children
73
- });
74
- });
75
- function newChildrenMap() {
76
- return /* @__PURE__ */new Map();
77
- }
78
- export { PresenceChild };
79
- //# sourceMappingURL=PresenceChild.native.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["jsx","_jsx","useConstant","PresenceContext","React","useId","PresenceChild","memo","param","children","initial","isPresent","onExitComplete","exitVariant","enterVariant","enterExitVariant","presenceAffectsLayout","custom","presenceChildren","newChildrenMap","id","context","useMemo","set","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","values","Symbol","iterator","_step","next","done","isComplete","value","err","return","register","delete"],"sources":["../../src/PresenceChild.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,GAAA,IAAAC,IAAA,QAAmB;AAC5B,SAASC,WAAA,+BAAuB;AAEhC,SAAAC,eAAuB;AACvB,YAASC,KAAA,MAAa;AA+EX,SAAAC,KAAA;AA9DJ,IAAAC,aAAM,kBAAsBF,KAAA,CAAAG,IAAA,WAAAC,KAAA;EACjC,IAAC;MAAAC,QAAA;MAAAC,OAAA;MAAAC,SAAA;MAAAC,cAAA;MAAAC,WAAA;MAAAC,YAAA;MAAAC,gBAAA;MAAAC,qBAAA;MAAAC;IAAA,IAAAT,KAAA;IAAAU,gBAAA,GAAAhB,WAAA,CAAAiB,cAAA;IAAAC,EAAA,GAAAf,KAAA;IAAAgB,OAAA,GAAAjB,KAAA,CAAAkB,OAAA,CACC;MACA;QACAF,EAAA;QACAV,OAAA;QACAC,SAAA;QACAM,MAAA;QACAJ,WAAA;QACAC,YAAA;QACAC,gBAAA;QACwBH,cAAA,WAAAA,CAAA;UAClBM,gBAAA,CAAAK,GAAmB,CAAAH,EAAA;UAIvB,IACSI,yBAAA;YAAAC,iBAAA;YAAAC,cAAA;UACL;YACA,SAAAC,SAAA,GAAAT,gBAAA,CAAAU,MAAA,GAAAC,MAAA,CAAAC,QAAA,KAAAC,KAAA,IAAAP,yBAAA,IAAAO,KAAA,GAAAJ,SAAA,CAAAK,IAAA,IAAAC,IAAA,GAAAT,yBAAA;cACA,IAAAU,UAAA,GAAAH,KAAA,CAAAI,KAAA;cACA,KAAAD,UAAA,EACA;YACA;UACA,SAAAE,GAAA;YACAX,iBAAgB,GAAM,IAAAC,cAAA,GAAAU,GAAA;UACpB;YACA;cACE,CAAAZ,yBAAK,IAAAG,SAAA,CAAAU,MAAA,YAAAV,SAAA,CAAAU,MAAA;YACH;cAGJ,IAAAZ,iBAAiB,EACnB,MAAAC,cAAA;YACA;UAIF;UAAAd,cAAA;QAAA;QAAA0B,QAAA,WAAAA,CAAA;UAAA,OAAApB,gBAAA,CAAAK,GAAA,CAAAH,EAAA;YAAA,OAAAF,gBAAA,CAAAqB,MAAA,CAAAnB,EAAA;UAAA;QASF;MACF;IAEA;IACE;AAAqE;AAQrE;AAAyD;AAGA;IAE/D;IAEAJ,qBAAS,GAAuC,UAC9CL,SAAO,EACTE,WAAA,E","ignoreList":[]}
@@ -1,5 +0,0 @@
1
- export * from "./AnimatePresence.native.mjs";
2
- export * from "@tamagui/use-presence";
3
- export * from "./types.native.mjs";
4
- export * from "./PresenceChild.native.mjs";
5
- //# sourceMappingURL=index.native.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc","ignoreList":[]}
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=types.native.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}