@hanzogui/animate-presence 3.0.1 → 7.0.0

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 (40) hide show
  1. package/package.json +13 -13
  2. package/src/AnimatePresence.tsx +1 -1
  3. package/types/index.d.ts +1 -1
  4. package/dist/cjs/AnimatePresence.cjs +0 -111
  5. package/dist/cjs/AnimatePresence.native.js +0 -129
  6. package/dist/cjs/AnimatePresence.native.js.map +0 -1
  7. package/dist/cjs/LayoutGroupContext.cjs +0 -38
  8. package/dist/cjs/LayoutGroupContext.native.js +0 -41
  9. package/dist/cjs/LayoutGroupContext.native.js.map +0 -1
  10. package/dist/cjs/PresenceChild.cjs +0 -88
  11. package/dist/cjs/PresenceChild.native.js +0 -116
  12. package/dist/cjs/PresenceChild.native.js.map +0 -1
  13. package/dist/cjs/index.cjs +0 -21
  14. package/dist/cjs/index.native.js +0 -24
  15. package/dist/cjs/index.native.js.map +0 -1
  16. package/dist/cjs/types.cjs +0 -16
  17. package/dist/cjs/types.native.js +0 -19
  18. package/dist/cjs/types.native.js.map +0 -1
  19. package/dist/esm/AnimatePresence.mjs +0 -88
  20. package/dist/esm/AnimatePresence.mjs.map +0 -1
  21. package/dist/esm/AnimatePresence.native.js +0 -103
  22. package/dist/esm/AnimatePresence.native.js.map +0 -1
  23. package/dist/esm/LayoutGroupContext.mjs +0 -4
  24. package/dist/esm/LayoutGroupContext.mjs.map +0 -1
  25. package/dist/esm/LayoutGroupContext.native.js +0 -4
  26. package/dist/esm/LayoutGroupContext.native.js.map +0 -1
  27. package/dist/esm/PresenceChild.mjs +0 -54
  28. package/dist/esm/PresenceChild.mjs.map +0 -1
  29. package/dist/esm/PresenceChild.native.js +0 -79
  30. package/dist/esm/PresenceChild.native.js.map +0 -1
  31. package/dist/esm/index.js +0 -5
  32. package/dist/esm/index.js.map +0 -1
  33. package/dist/esm/index.mjs +0 -5
  34. package/dist/esm/index.mjs.map +0 -1
  35. package/dist/esm/index.native.js +0 -5
  36. package/dist/esm/index.native.js.map +0 -1
  37. package/dist/esm/types.mjs +0 -2
  38. package/dist/esm/types.mjs.map +0 -1
  39. package/dist/esm/types.native.js +0 -2
  40. package/dist/esm/types.native.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzogui/animate-presence",
3
- "version": "3.0.1",
3
+ "version": "7.0.0",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "license": "MIT",
6
6
  "source": "src/index.ts",
@@ -32,24 +32,24 @@
32
32
  "access": "public"
33
33
  },
34
34
  "scripts": {
35
- "build": "hanzo-gui-build",
36
- "watch": "hanzo-gui-build --watch",
37
- "clean": "hanzo-gui-build clean",
38
- "clean:build": "hanzo-gui-build clean:build"
35
+ "build": "hanzogui-build",
36
+ "watch": "hanzogui-build --watch",
37
+ "clean": "hanzogui-build clean",
38
+ "clean:build": "hanzogui-build clean:build"
39
39
  },
40
40
  "dependencies": {
41
- "@hanzogui/constants": "3.0.0",
42
- "@hanzogui/helpers": "3.0.0",
43
- "@hanzogui/use-constant": "3.0.0",
44
- "@hanzogui/use-force-update": "3.0.0",
45
- "@hanzogui/use-presence": "3.0.0",
46
- "@hanzogui/web": "3.0.0"
41
+ "@hanzogui/constants": "^7.0.0",
42
+ "@hanzogui/helpers": "^7.0.0",
43
+ "@hanzogui/use-constant": "^7.0.0",
44
+ "@hanzogui/use-force-update": "^7.0.0",
45
+ "@hanzogui/use-presence": "^7.0.0",
46
+ "@hanzogui/web": "^7.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@hanzogui/build": "3.0.0",
49
+ "@hanzogui/build": "^7.0.0",
50
50
  "react": ">=19"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "react": ">=19"
54
54
  }
55
- }
55
+ }
@@ -13,7 +13,7 @@ const getChildKey = (child: ReactElement<any>): ComponentKey => {
13
13
  return (
14
14
  child.key ||
15
15
  (() => {
16
- // we can help a bit by falling back to gui name or component name
16
+ // we can help a bit by falling back to hanzogui name or component name
17
17
  const ct = child.type
18
18
  const defaultName = ct['displayName'] || ct['name'] || ''
19
19
  if (ct && typeof ct === 'object' && 'staticConfig' in ct) {
package/types/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './AnimatePresence';
2
- export * from '@gui/use-presence';
2
+ export * from '@hanzogui/use-presence';
3
3
  export * from './types';
4
4
  export * from './PresenceChild';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1,111 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
- get: () => from[key],
14
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
- });
16
- return to;
17
- };
18
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
20
- }), mod);
21
- var AnimatePresence_exports = {};
22
- __export(AnimatePresence_exports, {
23
- AnimatePresence: () => AnimatePresence
24
- });
25
- module.exports = __toCommonJS(AnimatePresence_exports);
26
- var import_react = require("react"),
27
- import_gui_use_constant = require("@hanzogui/use-constant"),
28
- import_gui_use_force_update = require("@hanzogui/use-force-update"),
29
- import_react2 = require("react"),
30
- import_LayoutGroupContext = require("./LayoutGroupContext.cjs"),
31
- import_PresenceChild = require("./PresenceChild.cjs"),
32
- import_jsx_runtime = require("react/jsx-runtime");
33
- const getChildKey = child => child.key || (() => {
34
- const ct = child.type,
35
- defaultName = ct.displayName || ct.name || "";
36
- return ct && typeof ct == "object" && "staticConfig" in ct && ct.staticConfig.componentName || defaultName;
37
- })();
38
- function onlyElements(children) {
39
- const filtered = [];
40
- return import_react2.Children.forEach(children, child => {
41
- (0, import_react2.isValidElement)(child) && filtered.push(child);
42
- }), filtered;
43
- }
44
- const AnimatePresence = ({
45
- children,
46
- enterVariant,
47
- exitVariant,
48
- enterExitVariant,
49
- initial = !0,
50
- onExitComplete,
51
- exitBeforeEnter,
52
- mode,
53
- presenceAffectsLayout = !0,
54
- custom,
55
- passThrough
56
- }) => {
57
- const effectiveMode = mode ?? (exitBeforeEnter ? "wait" : "sync"),
58
- presentChildren = (0, import_react2.useMemo)(() => onlyElements(children), [children]),
59
- presentKeys = presentChildren.map(getChildKey),
60
- isInitialRender = (0, import_react2.useRef)(!0),
61
- frozenCustomRef = (0, import_react2.useRef)(/* @__PURE__ */new Map()),
62
- pendingPresentChildren = (0, import_react2.useRef)(presentChildren),
63
- exitComplete = (0, import_gui_use_constant.useConstant)(() => /* @__PURE__ */new Map()),
64
- [diffedChildren, setDiffedChildren] = (0, import_react2.useState)(presentChildren),
65
- [renderedChildren, setRenderedChildren] = (0, import_react2.useState)(presentChildren),
66
- forceRender = (0, import_react2.useContext)(import_LayoutGroupContext.LayoutGroupContext).forceRender ?? (0, import_gui_use_force_update.useForceUpdate)();
67
- if (passThrough) return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
68
- children
69
- });
70
- if ((0, import_react.useInsertionEffect)(() => {
71
- isInitialRender.current = !1, pendingPresentChildren.current = presentChildren;
72
- for (let i = 0; i < renderedChildren.length; i++) {
73
- const key = getChildKey(renderedChildren[i]);
74
- presentKeys.includes(key) ? (exitComplete.delete(key), frozenCustomRef.current.delete(key)) : exitComplete.get(key) !== !0 && exitComplete.set(key, !1);
75
- }
76
- }, [renderedChildren, presentKeys.length, presentKeys.join("-")]), presentChildren !== diffedChildren) {
77
- let nextChildren = [...presentChildren];
78
- for (let i = 0; i < renderedChildren.length; i++) {
79
- const child = renderedChildren[i],
80
- key = getChildKey(child);
81
- presentKeys.includes(key) || (nextChildren.splice(i, 0, child), frozenCustomRef.current.has(key) || frozenCustomRef.current.set(key, custom));
82
- }
83
- const exitingChildren = renderedChildren.filter(child => !presentKeys.includes(getChildKey(child)));
84
- return effectiveMode === "wait" && exitingChildren.length && (nextChildren = exitingChildren), setRenderedChildren(onlyElements(nextChildren)), setDiffedChildren(presentChildren), null;
85
- }
86
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
87
- children: renderedChildren.map(child => {
88
- const key = getChildKey(child),
89
- isPresent = presentChildren === renderedChildren || presentKeys.includes(key),
90
- onExit = () => {
91
- if (exitComplete.has(key)) exitComplete.set(key, !0);else return;
92
- let isEveryExitComplete = !0;
93
- exitComplete.forEach(isExitComplete => {
94
- isExitComplete || (isEveryExitComplete = !1);
95
- }), isEveryExitComplete && (forceRender?.(), setRenderedChildren(pendingPresentChildren.current), onExitComplete?.());
96
- };
97
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_PresenceChild.PresenceChild, {
98
- isPresent,
99
- initial: !isInitialRender.current || initial ? void 0 : !1,
100
- custom: isPresent ? custom : frozenCustomRef.current.get(key) ?? custom,
101
- presenceAffectsLayout,
102
- enterExitVariant,
103
- enterVariant,
104
- exitVariant,
105
- onExitComplete: isPresent ? void 0 : onExit,
106
- children: child
107
- }, key);
108
- })
109
- });
110
- };
111
- AnimatePresence.displayName = "AnimatePresence";
@@ -1,129 +0,0 @@
1
- "use strict";
2
-
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
- get: () => from[key],
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- return to;
19
- };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: !0
22
- }), mod);
23
- var AnimatePresence_exports = {};
24
- __export(AnimatePresence_exports, {
25
- AnimatePresence: () => AnimatePresence
26
- });
27
- module.exports = __toCommonJS(AnimatePresence_exports);
28
- var import_jsx_runtime = require("react/jsx-runtime"),
29
- import_react = require("react"),
30
- import_gui_use_constant = require("@hanzogui/use-constant"),
31
- import_gui_use_force_update = require("@hanzogui/use-force-update"),
32
- import_react2 = require("react"),
33
- import_LayoutGroupContext = require("./LayoutGroupContext.native.js"),
34
- import_PresenceChild = require("./PresenceChild.native.js");
35
- function _type_of(obj) {
36
- "@swc/helpers - typeof";
37
-
38
- return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
39
- }
40
- var getChildKey = function (child) {
41
- return child.key || function () {
42
- var ct = child.type,
43
- defaultName = ct.displayName || ct.name || "";
44
- return ct && (typeof ct > "u" ? "undefined" : _type_of(ct)) === "object" && "staticConfig" in ct && ct.staticConfig.componentName || defaultName;
45
- }();
46
- };
47
- function onlyElements(children) {
48
- var filtered = [];
49
- return import_react2.Children.forEach(children, function (child) {
50
- /* @__PURE__ */(0, import_react2.isValidElement)(child) && filtered.push(child);
51
- }), filtered;
52
- }
53
- var AnimatePresence = function (param) {
54
- var {
55
- children,
56
- enterVariant,
57
- exitVariant,
58
- enterExitVariant,
59
- initial = !0,
60
- onExitComplete,
61
- exitBeforeEnter,
62
- mode,
63
- presenceAffectsLayout = !0,
64
- custom,
65
- passThrough
66
- } = param,
67
- effectiveMode = mode ?? (exitBeforeEnter ? "wait" : "sync"),
68
- presentChildren = (0, import_react2.useMemo)(function () {
69
- return onlyElements(children);
70
- }, [children]),
71
- presentKeys = presentChildren.map(getChildKey),
72
- isInitialRender = (0, import_react2.useRef)(!0),
73
- frozenCustomRef = (0, import_react2.useRef)(/* @__PURE__ */new Map()),
74
- pendingPresentChildren = (0, import_react2.useRef)(presentChildren),
75
- exitComplete = (0, import_gui_use_constant.useConstant)(function () {
76
- return /* @__PURE__ */new Map();
77
- }),
78
- [diffedChildren, setDiffedChildren] = (0, import_react2.useState)(presentChildren),
79
- [renderedChildren, setRenderedChildren] = (0, import_react2.useState)(presentChildren),
80
- _useContext_forceRender,
81
- forceRender = (_useContext_forceRender = (0, import_react2.useContext)(import_LayoutGroupContext.LayoutGroupContext).forceRender) !== null && _useContext_forceRender !== void 0 ? _useContext_forceRender : (0, import_gui_use_force_update.useForceUpdate)();
82
- if (passThrough) return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
83
- children
84
- });
85
- if ((0, import_react.useInsertionEffect)(function () {
86
- isInitialRender.current = !1, pendingPresentChildren.current = presentChildren;
87
- for (var i2 = 0; i2 < renderedChildren.length; i2++) {
88
- var key2 = getChildKey(renderedChildren[i2]);
89
- presentKeys.includes(key2) ? (exitComplete.delete(key2), frozenCustomRef.current.delete(key2)) : exitComplete.get(key2) !== !0 && exitComplete.set(key2, !1);
90
- }
91
- }, [renderedChildren, presentKeys.length, presentKeys.join("-")]), presentChildren !== diffedChildren) {
92
- for (var nextChildren = [...presentChildren], i = 0; i < renderedChildren.length; i++) {
93
- var child = renderedChildren[i],
94
- key = getChildKey(child);
95
- presentKeys.includes(key) || (nextChildren.splice(i, 0, child), frozenCustomRef.current.has(key) || frozenCustomRef.current.set(key, custom));
96
- }
97
- var exitingChildren = renderedChildren.filter(function (child2) {
98
- return !presentKeys.includes(getChildKey(child2));
99
- });
100
- return effectiveMode === "wait" && exitingChildren.length && (nextChildren = exitingChildren), setRenderedChildren(onlyElements(nextChildren)), setDiffedChildren(presentChildren), null;
101
- }
102
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
103
- children: renderedChildren.map(function (child2) {
104
- var key2 = getChildKey(child2),
105
- isPresent = presentChildren === renderedChildren || presentKeys.includes(key2),
106
- onExit = function () {
107
- if (exitComplete.has(key2)) exitComplete.set(key2, !0);else return;
108
- var isEveryExitComplete = !0;
109
- exitComplete.forEach(function (isExitComplete) {
110
- isExitComplete || (isEveryExitComplete = !1);
111
- }), isEveryExitComplete && (forceRender?.(), setRenderedChildren(pendingPresentChildren.current), onExitComplete?.());
112
- },
113
- _frozenCustomRef_current_get;
114
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_PresenceChild.PresenceChild, {
115
- isPresent,
116
- initial: !isInitialRender.current || initial ? void 0 : !1,
117
- custom: isPresent ? custom : (_frozenCustomRef_current_get = frozenCustomRef.current.get(key2)) !== null && _frozenCustomRef_current_get !== void 0 ? _frozenCustomRef_current_get : custom,
118
- presenceAffectsLayout,
119
- enterExitVariant,
120
- enterVariant,
121
- exitVariant,
122
- onExitComplete: isPresent ? void 0 : onExit,
123
- children: child2
124
- }, key2);
125
- })
126
- });
127
- };
128
- AnimatePresence.displayName = "AnimatePresence";
129
- //# sourceMappingURL=AnimatePresence.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","AnimatePresence_exports","__export","AnimatePresence","module","exports","import_jsx_runtime","require","import_react","import_gui_use_constant","import_gui_use_force_update","import_react2","import_LayoutGroupContext","import_PresenceChild","_type_of","obj","Symbol","constructor","getChildKey","child","key","ct","type","defaultName","displayName","name","staticConfig","componentName","onlyElements","children","filtered","Children","forEach","isValidElement","push","param","enterVariant","exitVariant","enterExitVariant","initial","onExitComplete","exitBeforeEnter","mode","presenceAffectsLayout","custom","passThrough","effectiveMode","presentChildren","useMemo","presentKeys","map","isInitialRender","useRef","frozenCustomRef","Map","pendingPresentChildren","exitComplete","useConstant","diffedChildren","setDiffedChildren","useState","renderedChildren","setRenderedChildren","_useContext_forceRender","forceRender","useContext","LayoutGroupContext","useForceUpdate","jsx","Fragment","useInsertionEffect","current","i2","length","key2","includes","delete","get","set","join","nextChildren","i","splice","has","exitingChildren","filter","child2","isPresent","onExit","isEveryExitComplete","isExitComplete","_frozenCustomRef_current_get","PresenceChild"],"sources":["../../src/AnimatePresence.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,uBAAA;AAAAC,QAAA,CAAAD,uBAAA;EAAAE,eAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAmC,CAAAK,uBACnC;AAUA,IAAAK,kBAAqB,GAAAC,OAEjB,oBACO;EAAAC,YAAA,GAAAD,OAAA;EAAAE,uBAAA,GAAAF,OAAA;EAAAG,2BAAA,GAAAH,OAAA;EAAAI,aAAA,GAAAJ,OAAA;EAAAK,yBAAA,GAAAL,OAAA;EAAAM,oBAAA,GAAAN,OAAA;AAEL,SAAMO,QAAKA,CAAAC,GAAM;EAEjB,uBAAiB;;EAKnB,OAAGA,GAAA,WAAAC,MAAA,UAAAD,GAAA,CAAAE,WAAA,KAAAD,MAAA,qBAAAD,GAAA;AAIP;AACE,IAAAG,WAAM,YAAAA,CAAiCC,KAAA;EAEvC,OAAAA,KAAA,CAAAC,GAAA,gBAAS;IACP,IAAIC,EAAA,GAAAF,KAAA,CAAAG,IAAA;MAAAC,WAAA,GAAeF,EAAA,CAAAG,WAAQ,IAASH,EAAA,CAAAI,IAAK,IAAK;IAC/C,OACMJ,EAAA,YAAAA,EAAA,uBAAAP,QAAA,CAAAO,EAAA,qCAAAA,EAAA,IAAAA,EAAA,CAAAK,YAAA,CAAAC,aAAA,IAAAJ,WAAA;EACT;AAEO;AAEF,SACHK,aAAAC,QAAA;EACA,IAAAC,QAAA;EACA,OAAAnB,aAAA,CAAAoB,QAAA,CAAAC,OAAA,CAAAH,QAAA,YAAAV,KAAA;IACA,m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AA,CAAAlC,YAAA,CAAAoD,YAAA,IAAArB,iBAAA,CAAAZ,eAAA;EAC1B;EACE,OAAK,iBAAgB,EAAAzC,kBAAA,CAAA8D,GAAsB,EAAA9D,kBAAA,CAAA+D,QAAA;IAAAxC,QAGzC,EAAAgC,gBAAA,CAAAX,GACF,WAAAoC,MAAc,EACd;MAGJ,IAAAZ,IAAA,GAAAxD,WAAA,CAAAoE,MAAA;QAAAC,SAAA,GAAAxC,eAAA,KAAAc,gBAAA,IAAAZ,WAAA,CAAA0B,QAAA,CAAAD,IAAA;QAAAc,MAAA,YAAAA,CAAA;UAEA,IACEhC,YAAA,CAAA2B,GAAA,CAAAT,IAAA,GAAClB,YAAA,CAAAsB,GAAA,CAAAJ,IAAA,WAEC;UACA,IAAAe,mBAAU,GAAgB;UAC1BjC,YAAQ,CAAAxB,OAAY,WAAU0D,cAAA,EAAgB;YAC9CA,cAAA,KAAAD,mBAAA;UACA,IAAAA,mBAAA,KAAAzB,WAAA,MAAAF,mBAAA,CAAAP,sBAAA,CAAAgB,OAAA,GAAA/B,cAAA;QAAA;QACAmD,4BAAA;MAAA,OACA,mBAAArF,kBAAA,CAAA8D,GAAA,EAAAvD,oBAAA,CAAA+E,aAAA;QACAL,SAAA;QAEChD,OAAA,GAAAY,eAAA,CAAAoB,OAAA,IAAAhC,OAAA;QAAAK,MAAA,EAAA2C,SAAA,GAAA3C,MAAA,IAAA+C,4BAAA,GAAAtC,eAAA,CAAAkB,OAAA,CAAAM,GAAA,CAAAH,IAAA,eAAAiB,4BAAA,cAAAA,4BAAA,GAAA/C,MAAA;QAVID,qBAAA;QAWPL,gBAAA;QAGNF,YAAA;QAEJC,WAAA;QAEAG,cAAgB,EAAA+C,SAAc,YAAAC,MAAA","ignoreList":[]}
@@ -1,38 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
- get: () => from[key],
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
32
- var LayoutGroupContext_exports = {};
33
- __export(LayoutGroupContext_exports, {
34
- LayoutGroupContext: () => LayoutGroupContext
35
- });
36
- module.exports = __toCommonJS(LayoutGroupContext_exports);
37
- var import_react = __toESM(require("react"), 1);
38
- const LayoutGroupContext = import_react.default.createContext({});
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf,
8
- __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: !0
13
- });
14
- },
15
- __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
- get: () => from[key],
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
- value: mod,
29
- enumerable: !0
30
- }) : target, mod)),
31
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: !0
33
- }), mod);
34
- var LayoutGroupContext_exports = {};
35
- __export(LayoutGroupContext_exports, {
36
- LayoutGroupContext: () => LayoutGroupContext
37
- });
38
- module.exports = __toCommonJS(LayoutGroupContext_exports);
39
- var import_react = __toESM(require("react"), 1),
40
- LayoutGroupContext = /* @__PURE__ */import_react.default.createContext({});
41
- //# sourceMappingURL=LayoutGroupContext.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","LayoutGroupContext_exports","__export","LayoutGroupContext","module","exports","import_react","__toESM","require","default","createContext"],"sources":["../../src/LayoutGroupContext.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,0BAAA;AAAAC,QAAA,CAAAD,0BAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAkB,CAAAK,0BAAA;AAOX,IAAAK,YAAM,GAAAC,OAAA,CAAqBC,OAAA;EAAML,kBAAyC,kBAAAG,YAAA,CAAAG,OAAA,CAAAC,aAAA","ignoreList":[]}
@@ -1,88 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
- get: () => from[key],
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
32
- var PresenceChild_exports = {};
33
- __export(PresenceChild_exports, {
34
- PresenceChild: () => PresenceChild
35
- });
36
- module.exports = __toCommonJS(PresenceChild_exports);
37
- var import_gui_use_constant = require("@hanzogui/use-constant"),
38
- import_gui_use_presence = require("@hanzogui/use-presence"),
39
- React = __toESM(require("react"), 1),
40
- import_react = require("react"),
41
- import_jsx_runtime = require("react/jsx-runtime");
42
- const PresenceChild = React.memo(({
43
- children,
44
- initial,
45
- isPresent,
46
- onExitComplete,
47
- exitVariant,
48
- enterVariant,
49
- enterExitVariant,
50
- presenceAffectsLayout,
51
- custom
52
- }) => {
53
- const presenceChildren = (0, import_gui_use_constant.useConstant)(newChildrenMap),
54
- id = (0, import_react.useId)() || "",
55
- context = React.useMemo(() => ({
56
- id,
57
- initial,
58
- isPresent,
59
- custom,
60
- exitVariant,
61
- enterVariant,
62
- enterExitVariant,
63
- onExitComplete: () => {
64
- presenceChildren.set(id, !0);
65
- for (const isComplete of presenceChildren.values()) if (!isComplete) return;
66
- onExitComplete?.();
67
- },
68
- register: () => (presenceChildren.set(id, !1), () => presenceChildren.delete(id))
69
- }),
70
- /**
71
- * If the presence of a child affects the layout of the components around it,
72
- * we want to make a new context value to ensure they get re-rendered
73
- * so they can detect that layout change.
74
- */
75
- // @ts-expect-error its ok
76
- presenceAffectsLayout ? void 0 : [isPresent, exitVariant, enterVariant]);
77
- return React.useMemo(() => {
78
- presenceChildren.forEach((_, key) => presenceChildren.set(key, !1));
79
- }, [isPresent]), React.useEffect(() => {
80
- !isPresent && !presenceChildren.size && onExitComplete?.();
81
- }, [isPresent]), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_use_presence.PresenceContext.Provider, {
82
- value: context,
83
- children
84
- });
85
- });
86
- function newChildrenMap() {
87
- return /* @__PURE__ */new Map();
88
- }
@@ -1,116 +0,0 @@
1
- "use strict";
2
-
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf,
8
- __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: !0
13
- });
14
- },
15
- __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
- get: () => from[key],
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
- value: mod,
29
- enumerable: !0
30
- }) : target, mod)),
31
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: !0
33
- }), mod);
34
- var PresenceChild_exports = {};
35
- __export(PresenceChild_exports, {
36
- PresenceChild: () => PresenceChild
37
- });
38
- module.exports = __toCommonJS(PresenceChild_exports);
39
- var import_jsx_runtime = require("react/jsx-runtime"),
40
- import_gui_use_constant = require("@hanzogui/use-constant"),
41
- import_gui_use_presence = require("@hanzogui/use-presence"),
42
- React = __toESM(require("react"), 1),
43
- import_react = require("react"),
44
- PresenceChild = /* @__PURE__ */React.memo(function (param) {
45
- var {
46
- children,
47
- initial,
48
- isPresent,
49
- onExitComplete,
50
- exitVariant,
51
- enterVariant,
52
- enterExitVariant,
53
- presenceAffectsLayout,
54
- custom
55
- } = param,
56
- presenceChildren = (0, import_gui_use_constant.useConstant)(newChildrenMap),
57
- id = (0, import_react.useId)() || "",
58
- context = React.useMemo(function () {
59
- return {
60
- id,
61
- initial,
62
- isPresent,
63
- custom,
64
- exitVariant,
65
- enterVariant,
66
- enterExitVariant,
67
- onExitComplete: function () {
68
- presenceChildren.set(id, !0);
69
- var _iteratorNormalCompletion = !0,
70
- _didIteratorError = !1,
71
- _iteratorError = void 0;
72
- try {
73
- for (var _iterator = presenceChildren.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
74
- var isComplete = _step.value;
75
- if (!isComplete) return;
76
- }
77
- } catch (err) {
78
- _didIteratorError = !0, _iteratorError = err;
79
- } finally {
80
- try {
81
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
82
- } finally {
83
- if (_didIteratorError) throw _iteratorError;
84
- }
85
- }
86
- onExitComplete?.();
87
- },
88
- register: function () {
89
- return presenceChildren.set(id, !1), function () {
90
- return presenceChildren.delete(id);
91
- };
92
- }
93
- };
94
- },
95
- /**
96
- * If the presence of a child affects the layout of the components around it,
97
- * we want to make a new context value to ensure they get re-rendered
98
- * so they can detect that layout change.
99
- */
100
- // @ts-expect-error its ok
101
- presenceAffectsLayout ? void 0 : [isPresent, exitVariant, enterVariant]);
102
- return React.useMemo(function () {
103
- presenceChildren.forEach(function (_, key) {
104
- return presenceChildren.set(key, !1);
105
- });
106
- }, [isPresent]), React.useEffect(function () {
107
- !isPresent && !presenceChildren.size && onExitComplete?.();
108
- }, [isPresent]), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_use_presence.PresenceContext.Provider, {
109
- value: context,
110
- children
111
- });
112
- });
113
- function newChildrenMap() {
114
- return /* @__PURE__ */new Map();
115
- }
116
- //# sourceMappingURL=PresenceChild.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","PresenceChild_exports","__export","PresenceChild","module","exports","import_jsx_runtime","require","import_gui_use_constant","import_gui_use_presence","React","__toESM","import_react","memo","param","children","initial","isPresent","onExitComplete","exitVariant","enterVariant","enterExitVariant","presenceAffectsLayout","custom","presenceChildren","useConstant","newChildrenMap","id","useId","context","useMemo","set","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","values","Symbol","iterator","_step","next","done","isComplete","err","return","register","delete"],"sources":["../../src/PresenceChild.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,qBAAA;AAAAC,QAAA,CAAAD,qBAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,M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AAA;UAAA;UAAA2B,QAAA,WAAAA,CAAA;YAAA,OAAArB,gBAAA,CAAAO,GAAA,CAAAJ,EAAA;cAAA,OAAAH,gBAAA,CAAAsB,MAAA,CAAAnB,EAAA;YAAA;UASF;QACF;MAEA;MACE;AAAqE;AAQrE;AAAyD;AAGA;MAE/D;MAEAL,qBAAS,GAAuC,UAC9CL,SAAO,EACTE,WAAA,E","ignoreList":[]}
@@ -1,21 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
- get: () => from[key],
8
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
- });
10
- return to;
11
- },
12
- __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
- value: !0
15
- }), mod);
16
- var index_exports = {};
17
- module.exports = __toCommonJS(index_exports);
18
- __reExport(index_exports, require("./AnimatePresence.cjs"), module.exports);
19
- __reExport(index_exports, require("@hanzogui/use-presence"), module.exports);
20
- __reExport(index_exports, require("./types.cjs"), module.exports);
21
- __reExport(index_exports, require("./PresenceChild.cjs"), module.exports);
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
9
- get: () => from[key],
10
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
- });
12
- return to;
13
- },
14
- __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
- value: !0
17
- }), mod);
18
- var index_exports = {};
19
- module.exports = __toCommonJS(index_exports);
20
- __reExport(index_exports, require("./AnimatePresence.native.js"), module.exports);
21
- __reExport(index_exports, require("@hanzogui/use-presence"), module.exports);
22
- __reExport(index_exports, require("./types.native.js"), module.exports);
23
- __reExport(index_exports, require("./PresenceChild.native.js"), module.exports);
24
- //# sourceMappingURL=index.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports","__reExport","require"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA;AACdG,UAAA,CAAAH,aAAA,EAAcI,OAAA,iCAAAH,MADd,CAAAC,OAAA;AAEAC,UAAA,CAAAH,aAAA,EAAcI,OAAA,0BAFd,GAAAH,MAAA,CAAAC,OAAA;AAGAC,UAAA,CAAAH,aAAA,EAAcI,OAAA,uBAAAH,MAAA,CAAAC,OAHd","ignoreList":[]}
@@ -1,16 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
- get: () => from[key],
8
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
- });
10
- return to;
11
- };
12
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
13
- value: !0
14
- }), mod);
15
- var types_exports = {};
16
- module.exports = __toCommonJS(types_exports);
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
9
- get: () => from[key],
10
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
- });
12
- return to;
13
- };
14
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
- value: !0
16
- }), mod);
17
- var types_exports = {};
18
- module.exports = __toCommonJS(types_exports);
19
- //# sourceMappingURL=types.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","types_exports"],"sources":["../../src/types.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA","ignoreList":[]}
@@ -1,88 +0,0 @@
1
- import { useInsertionEffect } from "react";
2
- import { useConstant } from "@hanzogui/use-constant";
3
- import { useForceUpdate } from "@hanzogui/use-force-update";
4
- import { Children, isValidElement, useContext, useMemo, useRef, useState } from "react";
5
- import { LayoutGroupContext } from "./LayoutGroupContext.mjs";
6
- import { PresenceChild } from "./PresenceChild.mjs";
7
- import { Fragment, jsx } from "react/jsx-runtime";
8
- const getChildKey = child => child.key || (() => {
9
- const ct = child.type,
10
- defaultName = ct.displayName || ct.name || "";
11
- return ct && typeof ct == "object" && "staticConfig" in ct && ct.staticConfig.componentName || defaultName;
12
- })();
13
- function onlyElements(children) {
14
- const filtered = [];
15
- return Children.forEach(children, child => {
16
- isValidElement(child) && filtered.push(child);
17
- }), filtered;
18
- }
19
- const AnimatePresence = ({
20
- children,
21
- enterVariant,
22
- exitVariant,
23
- enterExitVariant,
24
- initial = !0,
25
- onExitComplete,
26
- exitBeforeEnter,
27
- mode,
28
- presenceAffectsLayout = !0,
29
- custom,
30
- passThrough
31
- }) => {
32
- const effectiveMode = mode ?? (exitBeforeEnter ? "wait" : "sync"),
33
- presentChildren = useMemo(() => onlyElements(children), [children]),
34
- presentKeys = presentChildren.map(getChildKey),
35
- isInitialRender = useRef(!0),
36
- frozenCustomRef = useRef(/* @__PURE__ */new Map()),
37
- pendingPresentChildren = useRef(presentChildren),
38
- exitComplete = useConstant(() => /* @__PURE__ */new Map()),
39
- [diffedChildren, setDiffedChildren] = useState(presentChildren),
40
- [renderedChildren, setRenderedChildren] = useState(presentChildren),
41
- forceRender = useContext(LayoutGroupContext).forceRender ?? useForceUpdate();
42
- if (passThrough) return /* @__PURE__ */jsx(Fragment, {
43
- children
44
- });
45
- if (useInsertionEffect(() => {
46
- isInitialRender.current = !1, pendingPresentChildren.current = presentChildren;
47
- for (let i = 0; i < renderedChildren.length; i++) {
48
- const key = getChildKey(renderedChildren[i]);
49
- presentKeys.includes(key) ? (exitComplete.delete(key), frozenCustomRef.current.delete(key)) : exitComplete.get(key) !== !0 && exitComplete.set(key, !1);
50
- }
51
- }, [renderedChildren, presentKeys.length, presentKeys.join("-")]), presentChildren !== diffedChildren) {
52
- let nextChildren = [...presentChildren];
53
- for (let i = 0; i < renderedChildren.length; i++) {
54
- const child = renderedChildren[i],
55
- key = getChildKey(child);
56
- presentKeys.includes(key) || (nextChildren.splice(i, 0, child), frozenCustomRef.current.has(key) || frozenCustomRef.current.set(key, custom));
57
- }
58
- const exitingChildren = renderedChildren.filter(child => !presentKeys.includes(getChildKey(child)));
59
- return effectiveMode === "wait" && exitingChildren.length && (nextChildren = exitingChildren), setRenderedChildren(onlyElements(nextChildren)), setDiffedChildren(presentChildren), null;
60
- }
61
- return /* @__PURE__ */jsx(Fragment, {
62
- children: renderedChildren.map(child => {
63
- const key = getChildKey(child),
64
- isPresent = presentChildren === renderedChildren || presentKeys.includes(key),
65
- onExit = () => {
66
- if (exitComplete.has(key)) exitComplete.set(key, !0);else return;
67
- let isEveryExitComplete = !0;
68
- exitComplete.forEach(isExitComplete => {
69
- isExitComplete || (isEveryExitComplete = !1);
70
- }), isEveryExitComplete && (forceRender?.(), setRenderedChildren(pendingPresentChildren.current), onExitComplete?.());
71
- };
72
- return /* @__PURE__ */jsx(PresenceChild, {
73
- isPresent,
74
- initial: !isInitialRender.current || initial ? void 0 : !1,
75
- custom: isPresent ? custom : frozenCustomRef.current.get(key) ?? custom,
76
- presenceAffectsLayout,
77
- enterExitVariant,
78
- enterVariant,
79
- exitVariant,
80
- onExitComplete: isPresent ? void 0 : onExit,
81
- children: child
82
- }, key);
83
- })
84
- });
85
- };
86
- AnimatePresence.displayName = "AnimatePresence";
87
- export { AnimatePresence };
88
- //# sourceMappingURL=AnimatePresence.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useInsertionEffect","useConstant","useForceUpdate","Children","isValidElement","useContext","useMemo","useRef","useState","LayoutGroupContext","PresenceChild","Fragment","jsx","getChildKey","child","key","ct","type","defaultName","displayName","name","staticConfig","componentName","onlyElements","children","filtered","forEach","push","AnimatePresence","enterVariant","exitVariant","enterExitVariant","initial","onExitComplete","exitBeforeEnter","mode","presenceAffectsLayout","custom","passThrough","effectiveMode","presentChildren","presentKeys","map","isInitialRender","frozenCustomRef","Map","pendingPresentChildren","exitComplete","diffedChildren","setDiffedChildren","renderedChildren","setRenderedChildren","forceRender","current","i","length","includes","delete","get","set","join","nextChildren","splice","has","exitingChildren","filter","isPresent","onExit","isEveryExitComplete","isExitComplete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,mBAAA,GAAsB;UAC7C,CAAC,GAEGA,mBAAA,KACFhB,WAAA,GAAc,GACdD,mBAAA,CAAoBL,sBAAA,CAAuBO,OAAO,GAClDpB,cAAA,GAAiB;QAErB;MAEA,OACE,eAAArB,GAAA,CAACF,aAAA;QAECwD,SAAA;QACAlC,OAAA,EAAS,CAACW,eAAA,CAAgBU,OAAA,IAAWrB,OAAA,GAAU,SAAY;QAC3DK,MAAA,EAAQ6B,SAAA,GAAY7B,MAAA,GAAUO,eAAA,CAAgBS,OAAA,CAAQK,GAAA,CAAI3C,GAAG,KAAKsB,MAAA;QAClED,qBAAA;QACAL,gBAAA;QACAF,YAAA;QACAC,WAAA;QACAG,cAAA,EAAgBiC,SAAA,GAAY,SAAYC,MAAA;QAEvC3C,QAAA,EAAAV;MAAA,GAVIC,GAWP;IAEJ,CAAC;EAAA,CACH;AAEJ;AAEAa,eAAA,CAAgBT,WAAA,GAAc","ignoreList":[]}
@@ -1,103 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useInsertionEffect } from "react";
3
- import { useConstant } from "@hanzogui/use-constant";
4
- import { useForceUpdate } from "@hanzogui/use-force-update";
5
- import { Children, isValidElement, useContext, useMemo, useRef, useState } from "react";
6
- import { LayoutGroupContext } from "./LayoutGroupContext.native.js";
7
- import { PresenceChild } from "./PresenceChild.native.js";
8
- function _type_of(obj) {
9
- "@swc/helpers - typeof";
10
-
11
- return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
12
- }
13
- var getChildKey = function (child) {
14
- return child.key || function () {
15
- var ct = child.type,
16
- defaultName = ct.displayName || ct.name || "";
17
- return ct && (typeof ct > "u" ? "undefined" : _type_of(ct)) === "object" && "staticConfig" in ct && ct.staticConfig.componentName || defaultName;
18
- }();
19
- };
20
- function onlyElements(children) {
21
- var filtered = [];
22
- return Children.forEach(children, function (child) {
23
- /* @__PURE__ */isValidElement(child) && filtered.push(child);
24
- }), filtered;
25
- }
26
- var AnimatePresence = function (param) {
27
- var {
28
- children,
29
- enterVariant,
30
- exitVariant,
31
- enterExitVariant,
32
- initial = !0,
33
- onExitComplete,
34
- exitBeforeEnter,
35
- mode,
36
- presenceAffectsLayout = !0,
37
- custom,
38
- passThrough
39
- } = param,
40
- effectiveMode = mode ?? (exitBeforeEnter ? "wait" : "sync"),
41
- presentChildren = useMemo(function () {
42
- return onlyElements(children);
43
- }, [children]),
44
- presentKeys = presentChildren.map(getChildKey),
45
- isInitialRender = useRef(!0),
46
- frozenCustomRef = useRef(/* @__PURE__ */new Map()),
47
- pendingPresentChildren = useRef(presentChildren),
48
- exitComplete = useConstant(function () {
49
- return /* @__PURE__ */new Map();
50
- }),
51
- [diffedChildren, setDiffedChildren] = useState(presentChildren),
52
- [renderedChildren, setRenderedChildren] = useState(presentChildren),
53
- _useContext_forceRender,
54
- forceRender = (_useContext_forceRender = useContext(LayoutGroupContext).forceRender) !== null && _useContext_forceRender !== void 0 ? _useContext_forceRender : useForceUpdate();
55
- if (passThrough) return /* @__PURE__ */_jsx(_Fragment, {
56
- children
57
- });
58
- if (useInsertionEffect(function () {
59
- isInitialRender.current = !1, pendingPresentChildren.current = presentChildren;
60
- for (var i2 = 0; i2 < renderedChildren.length; i2++) {
61
- var key2 = getChildKey(renderedChildren[i2]);
62
- presentKeys.includes(key2) ? (exitComplete.delete(key2), frozenCustomRef.current.delete(key2)) : exitComplete.get(key2) !== !0 && exitComplete.set(key2, !1);
63
- }
64
- }, [renderedChildren, presentKeys.length, presentKeys.join("-")]), presentChildren !== diffedChildren) {
65
- for (var nextChildren = [...presentChildren], i = 0; i < renderedChildren.length; i++) {
66
- var child = renderedChildren[i],
67
- key = getChildKey(child);
68
- presentKeys.includes(key) || (nextChildren.splice(i, 0, child), frozenCustomRef.current.has(key) || frozenCustomRef.current.set(key, custom));
69
- }
70
- var exitingChildren = renderedChildren.filter(function (child2) {
71
- return !presentKeys.includes(getChildKey(child2));
72
- });
73
- return effectiveMode === "wait" && exitingChildren.length && (nextChildren = exitingChildren), setRenderedChildren(onlyElements(nextChildren)), setDiffedChildren(presentChildren), null;
74
- }
75
- return /* @__PURE__ */_jsx(_Fragment, {
76
- children: renderedChildren.map(function (child2) {
77
- var key2 = getChildKey(child2),
78
- isPresent = presentChildren === renderedChildren || presentKeys.includes(key2),
79
- onExit = function () {
80
- if (exitComplete.has(key2)) exitComplete.set(key2, !0);else return;
81
- var isEveryExitComplete = !0;
82
- exitComplete.forEach(function (isExitComplete) {
83
- isExitComplete || (isEveryExitComplete = !1);
84
- }), isEveryExitComplete && (forceRender?.(), setRenderedChildren(pendingPresentChildren.current), onExitComplete?.());
85
- },
86
- _frozenCustomRef_current_get;
87
- return /* @__PURE__ */_jsx(PresenceChild, {
88
- isPresent,
89
- initial: !isInitialRender.current || initial ? void 0 : !1,
90
- custom: isPresent ? custom : (_frozenCustomRef_current_get = frozenCustomRef.current.get(key2)) !== null && _frozenCustomRef_current_get !== void 0 ? _frozenCustomRef_current_get : custom,
91
- presenceAffectsLayout,
92
- enterExitVariant,
93
- enterVariant,
94
- exitVariant,
95
- onExitComplete: isPresent ? void 0 : onExit,
96
- children: child2
97
- }, key2);
98
- })
99
- });
100
- };
101
- AnimatePresence.displayName = "AnimatePresence";
102
- export { AnimatePresence };
103
- //# sourceMappingURL=AnimatePresence.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["jsx","_jsx","Fragment","_Fragment","useInsertionEffect","useConstant","useForceUpdate","Children","isValidElement","useContext","useMemo","useRef","useState","LayoutGroupContext","PresenceChild","_type_of","obj","Symbol","constructor","getChildKey","child","key","ct","type","defaultName","displayName","name","staticConfig","componentName","onlyElements","children","filtered","forEach","push","AnimatePresence","param","enterVariant","exitVariant","enterExitVariant","initial","onExitComplete","exitBeforeEnter","mode","presenceAffectsLayout","custom","passThrough","effectiveMode","presentChildren","presentKeys","map","isInitialRender","frozenCustomRef","Map","pendingPresentChildren","exitComplete","diffedChildren","setDiffedChildren","renderedChildren","setRenderedChildren","_useContext_forceRender","forceRender","current","i2","length","key2","includes","delete","get","set","join","nextChildren","i","splice","has","exitingChildren","filter","child2","isPresent","onExit","isEveryExitComplete","isExitComplete","_frozenCustomRef_current_get"],"sources":["../../src/AnimatePresence.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAA0B;AACnC,SAASC,kBAAA,QAAmB;AAC5B,SAASC,WAAA,iCAAsB;AAE/B,SAASC,cAAU,qCAAqC;AACxD,SAASC,QAAA,EAAAC,cAAA,EAA0BC,UAAA,EAAAC,OAAA,EAAAC,MAAA,EAAAC,QAAA;AACnC,SAASC,kBAAA,QAAqB;AAiGnB,SAAAC,aAAA;AA5FX,SAAMC,SAAAC,GAAe;EAKf,uBACM;;EACN,OAAIA,GAAA,IAAM,OAAOC,MAAO,UAAAD,GAAY,CAAAE,WAAA,KAAkBD,MAE7C,GAAG,kBAAaD,GAAA;AAG3B;AAIJ,IAAAG,WAAS,YAAAA,CAAaC,KAA0C;EAC9D,OAAMA,KAAA,CAAAC,GAAA,IAAiC;IAEvC,IAAAC,EAAA,GAAAF,KAAS,CAAAG,IAAA;MAAAC,WAAkB,GAACF,EAAA,CAAAG,WAAU,IAAAH,EAAA,CAAAI,IAAA;IAChC,OAAAJ,EAAA,YAAoBA,EAAA,GAAG,iBAAc,GAAKP,QAAA,CAAAO,EAAA,qCAAAA,EAAA,IAAAA,EAAA,CAAAK,YAAA,CAAAC,aAAA,IAAAJ,WAAA;EAChD,CAAC,EACM;AACT;AAEO,SAAMK,aAAAC,QAER;EACH,IAAAC,QAAA;EACA,OAAAxB,QAAA,CAAAyB,OAAA,CAAAF,QAAA,YAAAV,KAAA;IACA,eAAAZ,cAAA,CAAAY,KAAA,KAAAW,QAAA,CAAAE,IAAA,CAAAb,KAAA;EACA,IAAAW,QAAA;AAAA;AACU,IACVG,eAAA,YAAAA,CAAAC,KAAA;EACA;MAAAL,QAAA;MAAAM,YAAA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AAxB,YAAA,CAAAmB,GAAA,CAAAT,IAAA,GAEAV,YACE,CAAAc,GAAA,CAAAJ,IAAA,WAAC;UAEC,IAAAe,mBAAA;UACAzB,YAAU,CAAAtB,OAAA,WAAgBgD,cAAW;YACrCA,cAAQ,KAAYD,mBAAU,KAAgB;UAC9C,IAAAA,mBAAA,KAAAnB,WAAA,MAAAF,mBAAA,CAAAL,sBAAA,CAAAQ,OAAA,GAAArB,cAAA;QAAA;QACAyC,4BAAA;MAAA,OACA,eAAAhF,IAAA,CAAAa,aAAA;QACA+D,SAAA;QACAtC,OAAA,GAAAW,eAAgB,CAAAW,OAAY,IAAYtB,OAAA;QAEvCK,MAAA,EAAAiC,SAAA,GAAAjC,MAAA,IAAAqC,4BAAA,GAAA9B,eAAA,CAAAU,OAAA,CAAAM,GAAA,CAAAH,IAAA,eAAAiB,4BAAA,cAAAA,4BAAA,GAAArC,MAAA;QAAAD,qBAAA;QAVIL,gBAAA;QAWPF,YAAA;QAGNC,WAAA;QAEJG,cAAA,EAAAqC,SAAA,YAAAC,MAAA;QAEAhD,QAAgB,EAAA8C","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- const LayoutGroupContext = React.createContext({});
3
- export { LayoutGroupContext };
4
- //# sourceMappingURL=LayoutGroupContext.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","LayoutGroupContext","createContext"],"sources":["../../src/LayoutGroupContext.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAOX,MAAMC,kBAAA,GAAqBD,KAAA,CAAME,aAAA,CAAuC,CAAC,CAAC","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- var LayoutGroupContext = /* @__PURE__ */React.createContext({});
3
- export { LayoutGroupContext };
4
- //# sourceMappingURL=LayoutGroupContext.native.js.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,54 +0,0 @@
1
- import { useConstant } from "@hanzogui/use-constant";
2
- import { PresenceContext } from "@hanzogui/use-presence";
3
- import * as React from "react";
4
- import { useId } from "react";
5
- import { jsx } from "react/jsx-runtime";
6
- const PresenceChild = React.memo(({
7
- children,
8
- initial,
9
- isPresent,
10
- onExitComplete,
11
- exitVariant,
12
- enterVariant,
13
- enterExitVariant,
14
- presenceAffectsLayout,
15
- custom
16
- }) => {
17
- const presenceChildren = useConstant(newChildrenMap),
18
- id = useId() || "",
19
- context = React.useMemo(() => ({
20
- id,
21
- initial,
22
- isPresent,
23
- custom,
24
- exitVariant,
25
- enterVariant,
26
- enterExitVariant,
27
- onExitComplete: () => {
28
- presenceChildren.set(id, !0);
29
- for (const isComplete of presenceChildren.values()) if (!isComplete) return;
30
- onExitComplete?.();
31
- },
32
- register: () => (presenceChildren.set(id, !1), () => presenceChildren.delete(id))
33
- }),
34
- /**
35
- * If the presence of a child affects the layout of the components around it,
36
- * we want to make a new context value to ensure they get re-rendered
37
- * so they can detect that layout change.
38
- */
39
- // @ts-expect-error its ok
40
- presenceAffectsLayout ? void 0 : [isPresent, exitVariant, enterVariant]);
41
- return React.useMemo(() => {
42
- presenceChildren.forEach((_, key) => presenceChildren.set(key, !1));
43
- }, [isPresent]), React.useEffect(() => {
44
- !isPresent && !presenceChildren.size && onExitComplete?.();
45
- }, [isPresent]), /* @__PURE__ */jsx(PresenceContext.Provider, {
46
- value: context,
47
- children
48
- });
49
- });
50
- function newChildrenMap() {
51
- return /* @__PURE__ */new Map();
52
- }
53
- export { PresenceChild };
54
- //# sourceMappingURL=PresenceChild.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useConstant","PresenceContext","React","useId","jsx","PresenceChild","memo","children","initial","isPresent","onExitComplete","exitVariant","enterVariant","enterExitVariant","presenceAffectsLayout","custom","presenceChildren","newChildrenMap","id","context","useMemo","set","isComplete","values","register","delete","forEach","_","key","useEffect","size","Provider","value","Map"],"sources":["../../src/PresenceChild.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,WAAA,QAAmB;AAC5B,SAASC,eAAA,QAAuB;AAEhC,YAAYC,KAAA,MAAW;AACvB,SAASC,KAAA,QAAa;AA+EX,SAAAC,GAAA;AA9DJ,MAAMC,aAAA,GAAgBH,KAAA,CAAMI,IAAA,CACjC,CAAC;EACCC,QAAA;EACAC,OAAA;EACAC,SAAA;EACAC,cAAA;EACAC,WAAA;EACAC,YAAA;EACAC,gBAAA;EACAC,qBAAA;EACAC;AACF,MAA0B;EACxB,MAAMC,gBAAA,GAAmBhB,WAAA,CAAYiB,cAAc;IAC7CC,EAAA,GAAKf,KAAA,CAAM,KAAK;IAEhBgB,OAAA,GAAUjB,KAAA,CAAMkB,OAAA,CACpB,OACS;MACLF,EAAA;MACAV,OAAA;MACAC,SAAA;MACAM,MAAA;MACAJ,WAAA;MACAC,YAAA;MACAC,gBAAA;MACAH,cAAA,EAAgBA,CAAA,KAAM;QACpBM,gBAAA,CAAiBK,GAAA,CAAIH,EAAA,EAAI,EAAI;QAC7B,WAAWI,UAAA,IAAcN,gBAAA,CAAiBO,MAAA,CAAO,GAC/C,IAAI,CAACD,UAAA,EACH;QAGJZ,cAAA,GAAiB;MACnB;MACAc,QAAA,EAAUA,CAAA,MACRR,gBAAA,CAAiBK,GAAA,CAAIH,EAAA,EAAI,EAAK,GACvB,MAAMF,gBAAA,CAAiBS,MAAA,CAAOP,EAAE;IAE3C;IAAA;AAAA;AAAA;AAAA;AAAA;IAAA;IASFJ,qBAAA,GAAwB,SAAY,CAACL,SAAA,EAAWE,WAAA,EAAaC,YAAY,CAC3E;EAEA,OAAAV,KAAA,CAAMkB,OAAA,CAAQ,MAAM;IAClBJ,gBAAA,CAAiBU,OAAA,CAAQ,CAACC,CAAA,EAAGC,GAAA,KAAQZ,gBAAA,CAAiBK,GAAA,CAAIO,GAAA,EAAK,EAAK,CAAC;EACvE,GAAG,CAACnB,SAAS,CAAC,GAMdP,KAAA,CAAM2B,SAAA,CAAU,MAAM;IACpB,CAACpB,SAAA,IAAa,CAACO,gBAAA,CAAiBc,IAAA,IAAQpB,cAAA,GAAiB;EAC3D,GAAG,CAACD,SAAS,CAAC,GAEP,eAAAL,GAAA,CAACH,eAAA,CAAgB8B,QAAA,EAAhB;IAAyBC,KAAA,EAAOb,OAAA;IAAUZ;EAAA,CAAS;AAC7D,CACF;AAEA,SAASU,eAAA,EAAuC;EAC9C,OAAO,mBAAIgB,GAAA,CAAI;AACjB","ignoreList":[]}
@@ -1,79 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useConstant } from "@hanzogui/use-constant";
3
- import { PresenceContext } from "@hanzogui/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.js.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,iCAAuB;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":[]}
package/dist/esm/index.js DELETED
@@ -1,5 +0,0 @@
1
- export * from "./AnimatePresence.mjs";
2
- export * from "@hanzogui/use-presence";
3
- export * from "./types.mjs";
4
- export * from "./PresenceChild.mjs";
5
- //# sourceMappingURL=index.js.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,5 +0,0 @@
1
- export * from "./AnimatePresence.mjs";
2
- export * from "@hanzogui/use-presence";
3
- export * from "./types.mjs";
4
- export * from "./PresenceChild.mjs";
5
- //# sourceMappingURL=index.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,5 +0,0 @@
1
- export * from "./AnimatePresence.native.js";
2
- export * from "@hanzogui/use-presence";
3
- export * from "./types.native.js";
4
- export * from "./PresenceChild.native.js";
5
- //# sourceMappingURL=index.native.js.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.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=types.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}