@tamagui/animate-presence 1.113.0 → 1.113.2

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,89 +1,74 @@
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.native.js";
5
- import { PresenceChild } from "./PresenceChild.native.js";
6
- var getChildKey = function (child) {
4
+ import { LayoutGroupContext } from "./LayoutGroupContext";
5
+ import { PresenceChild } from "./PresenceChild";
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 {
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;
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;
39
23
  updateChildLookup(filteredChildren, allChildren);
40
24
  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++) {
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++) {
56
43
  var key = presentKeys[i];
57
44
  targetKeys.indexOf(key) === -1 ? exiting.add(key) : exiting.delete(key);
58
45
  }
59
- return exitBeforeEnter && exiting.size && (childrenToRender = []), exiting.forEach(function (key2) {
46
+ return exitBeforeEnter && exiting.size && (childrenToRender = []), exiting.forEach(function(key2) {
60
47
  if (targetKeys.indexOf(key2) === -1) {
61
48
  var child = allChildren.get(key2);
62
49
  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));
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));
81
66
  childrenToRender.splice(insertionIndex, 0, exitingComponent);
82
67
  }
83
68
  }
84
- }), childrenToRender = childrenToRender.map(function (child) {
69
+ }), childrenToRender = childrenToRender.map(function(child) {
85
70
  var key2 = child.key;
86
- return exiting.has(key2) ? child : /* @__PURE__ */_jsx(PresenceChild, {
71
+ return exiting.has(key2) ? child : /* @__PURE__ */ _jsx(PresenceChild, {
87
72
  isPresent: !0,
88
73
  exitVariant,
89
74
  enterVariant,
@@ -92,14 +77,17 @@ var AnimatePresence = function (param) {
92
77
  custom,
93
78
  children: child
94
79
  }, 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
- })
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
+ )
101
87
  });
102
88
  };
103
89
  AnimatePresence.displayName = "AnimatePresence";
104
- export { AnimatePresence };
105
- //# sourceMappingURL=AnimatePresence.native.js.map
90
+ export {
91
+ AnimatePresence
92
+ };
93
+ //# sourceMappingURL=AnimatePresence.js.map
@@ -1 +1,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,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E,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,4 +1,6 @@
1
1
  import React from "react";
2
- var LayoutGroupContext = /* @__PURE__ */React.createContext({});
3
- export { LayoutGroupContext };
4
- //# sourceMappingURL=LayoutGroupContext.native.js.map
2
+ var LayoutGroupContext = /* @__PURE__ */ React.createContext({});
3
+ export {
4
+ LayoutGroupContext
5
+ };
6
+ //# sourceMappingURL=LayoutGroupContext.js.map
@@ -1 +1,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":[]}
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
+ }
@@ -3,21 +3,9 @@ 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 {
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 () {
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() {
21
9
  return {
22
10
  id,
23
11
  initial,
@@ -26,15 +14,14 @@ var PresenceChild = /* @__PURE__ */React.memo(function (param) {
26
14
  exitVariant,
27
15
  enterVariant,
28
16
  enterExitVariant,
29
- onExitComplete: function () {
17
+ onExitComplete: function() {
30
18
  presenceChildren.set(id, !0);
31
- var _iteratorNormalCompletion = !0,
32
- _didIteratorError = !1,
33
- _iteratorError = void 0;
19
+ var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
34
20
  try {
35
21
  for (var _iterator = presenceChildren.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
36
22
  var isComplete = _step.value;
37
- if (!isComplete) return;
23
+ if (!isComplete)
24
+ return;
38
25
  }
39
26
  } catch (err) {
40
27
  _didIteratorError = !0, _iteratorError = err;
@@ -42,13 +29,14 @@ var PresenceChild = /* @__PURE__ */React.memo(function (param) {
42
29
  try {
43
30
  !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
44
31
  } finally {
45
- if (_didIteratorError) throw _iteratorError;
32
+ if (_didIteratorError)
33
+ throw _iteratorError;
46
34
  }
47
35
  }
48
36
  onExitComplete?.();
49
37
  },
50
- register: function () {
51
- return presenceChildren.set(id, !1), function () {
38
+ register: function() {
39
+ return presenceChildren.set(id, !1), function() {
52
40
  return presenceChildren.delete(id);
53
41
  };
54
42
  }
@@ -60,20 +48,31 @@ var PresenceChild = /* @__PURE__ */React.memo(function (param) {
60
48
  * so they can detect that layout change.
61
49
  */
62
50
  // @ts-expect-error its ok
63
- presenceAffectsLayout ? void 0 : [isPresent, exitVariant, enterVariant]);
64
- return React.useMemo(function () {
65
- presenceChildren.forEach(function (_, key) {
51
+ presenceAffectsLayout ? void 0 : [
52
+ isPresent,
53
+ exitVariant,
54
+ enterVariant
55
+ ]
56
+ );
57
+ return React.useMemo(function() {
58
+ presenceChildren.forEach(function(_, key) {
66
59
  return presenceChildren.set(key, !1);
67
60
  });
68
- }, [isPresent]), React.useEffect(function () {
61
+ }, [
62
+ isPresent
63
+ ]), React.useEffect(function() {
69
64
  !isPresent && !presenceChildren.size && onExitComplete?.();
70
- }, [isPresent]), /* @__PURE__ */_jsx(PresenceContext.Provider, {
65
+ }, [
66
+ isPresent
67
+ ]), /* @__PURE__ */ _jsx(PresenceContext.Provider, {
71
68
  value: context,
72
69
  children
73
70
  });
74
71
  });
75
72
  function newChildrenMap() {
76
- return /* @__PURE__ */new Map();
73
+ return /* @__PURE__ */ new Map();
77
74
  }
78
- export { PresenceChild };
79
- //# sourceMappingURL=PresenceChild.native.js.map
75
+ export {
76
+ PresenceChild
77
+ };
78
+ //# sourceMappingURL=PresenceChild.js.map
@@ -1 +1,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":"AAA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,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
+ {
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,5 +1,5 @@
1
- export * from "./AnimatePresence.native.js";
1
+ export * from "./AnimatePresence";
2
2
  export * from "@tamagui/use-presence";
3
- export * from "./types.native.js";
4
- export * from "./PresenceChild.native.js";
5
- //# sourceMappingURL=index.native.js.map
3
+ export * from "./types";
4
+ export * from "./PresenceChild";
5
+ //# sourceMappingURL=index.js.map
@@ -1 +1,6 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc","ignoreList":[]}
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,2 +1 @@
1
-
2
- //# sourceMappingURL=types.native.js.map
1
+ //# sourceMappingURL=types.js.map
@@ -1 +1,6 @@
1
- {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "mappings": "",
5
+ "names": []
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/animate-presence",
3
- "version": "1.113.0",
3
+ "version": "1.113.2",
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.113.0",
17
- "@tamagui/use-constant": "1.113.0",
18
- "@tamagui/use-force-update": "1.113.0",
19
- "@tamagui/use-presence": "1.113.0",
20
- "@tamagui/web": "1.113.0"
16
+ "@tamagui/helpers": "1.113.2",
17
+ "@tamagui/use-constant": "1.113.2",
18
+ "@tamagui/use-force-update": "1.113.2",
19
+ "@tamagui/use-presence": "1.113.2",
20
+ "@tamagui/web": "1.113.2"
21
21
  },
22
22
  "devDependencies": {
23
- "@tamagui/build": "1.113.0"
23
+ "@tamagui/build": "1.113.2"
24
24
  },
25
25
  "scripts": {
26
26
  "build": "tamagui-build",