@tamagui/animate-presence 1.13.2 → 1.13.4
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.
- package/dist/cjs/AnimatePresence.js +1 -204
- package/dist/cjs/AnimatePresence.js.map +2 -2
- package/dist/cjs/LayoutGroupContext.js +1 -29
- package/dist/cjs/LayoutGroupContext.js.map +2 -2
- package/dist/cjs/PresenceChild.js +1 -94
- package/dist/cjs/PresenceChild.js.map +2 -2
- package/dist/cjs/index.js +1 -19
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/types.js +1 -16
- package/dist/cjs/types.js.map +2 -2
- package/dist/esm/AnimatePresence.js +1 -177
- package/dist/esm/AnimatePresence.js.map +2 -2
- package/dist/esm/AnimatePresence.mjs +1 -177
- package/dist/esm/AnimatePresence.mjs.map +2 -2
- package/dist/esm/LayoutGroupContext.js +1 -5
- package/dist/esm/LayoutGroupContext.js.map +2 -2
- package/dist/esm/LayoutGroupContext.mjs +1 -5
- package/dist/esm/LayoutGroupContext.mjs.map +2 -2
- package/dist/esm/PresenceChild.js +1 -60
- package/dist/esm/PresenceChild.js.map +2 -2
- package/dist/esm/PresenceChild.mjs +1 -60
- package/dist/esm/PresenceChild.mjs.map +2 -2
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +1 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/jsx/AnimatePresence.js +1 -164
- package/dist/jsx/AnimatePresence.js.map +2 -2
- package/dist/jsx/AnimatePresence.mjs +1 -164
- package/dist/jsx/AnimatePresence.mjs.map +2 -2
- package/dist/jsx/LayoutGroupContext.js +1 -5
- package/dist/jsx/LayoutGroupContext.js.map +2 -2
- package/dist/jsx/LayoutGroupContext.mjs +1 -5
- package/dist/jsx/LayoutGroupContext.mjs.map +2 -2
- package/dist/jsx/PresenceChild.js +1 -59
- package/dist/jsx/PresenceChild.js.map +2 -2
- package/dist/jsx/PresenceChild.mjs +1 -59
- package/dist/jsx/PresenceChild.mjs.map +2 -2
- package/dist/jsx/index.js +1 -2
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +1 -2
- package/dist/jsx/index.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -1,60 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { useId } from "react";
|
|
4
|
-
const PresenceChild = ({
|
|
5
|
-
children,
|
|
6
|
-
initial,
|
|
7
|
-
isPresent,
|
|
8
|
-
onExitComplete,
|
|
9
|
-
exitVariant,
|
|
10
|
-
enterVariant,
|
|
11
|
-
presenceAffectsLayout
|
|
12
|
-
}) => {
|
|
13
|
-
const presenceChildren = React.useMemo(newChildrenMap, []);
|
|
14
|
-
const id = useId() || "";
|
|
15
|
-
const context = React.useMemo(
|
|
16
|
-
() => {
|
|
17
|
-
return {
|
|
18
|
-
id,
|
|
19
|
-
initial,
|
|
20
|
-
isPresent,
|
|
21
|
-
exitVariant,
|
|
22
|
-
enterVariant,
|
|
23
|
-
onExitComplete: (id2) => {
|
|
24
|
-
presenceChildren.set(id2, true);
|
|
25
|
-
for (const isComplete of presenceChildren.values()) {
|
|
26
|
-
if (!isComplete) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
onExitComplete?.();
|
|
31
|
-
},
|
|
32
|
-
register: (id2) => {
|
|
33
|
-
presenceChildren.set(id2, false);
|
|
34
|
-
return () => presenceChildren.delete(id2);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
/**
|
|
39
|
-
* If the presence of a child affects the layout of the components around it,
|
|
40
|
-
* we want to make a new context value to ensure they get re-rendered
|
|
41
|
-
* so they can detect that layout change.
|
|
42
|
-
*/
|
|
43
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44
|
-
presenceAffectsLayout ? void 0 : [isPresent, exitVariant, enterVariant]
|
|
45
|
-
);
|
|
46
|
-
React.useMemo(() => {
|
|
47
|
-
presenceChildren.forEach((_, key) => presenceChildren.set(key, false));
|
|
48
|
-
}, [isPresent]);
|
|
49
|
-
React.useEffect(() => {
|
|
50
|
-
!(isPresent || presenceChildren.size) && onExitComplete?.();
|
|
51
|
-
}, [isPresent]);
|
|
52
|
-
return <PresenceContext.Provider value={context}>{children}</PresenceContext.Provider>;
|
|
53
|
-
};
|
|
54
|
-
function newChildrenMap() {
|
|
55
|
-
return /* @__PURE__ */ new Map();
|
|
56
|
-
}
|
|
57
|
-
export {
|
|
58
|
-
PresenceChild
|
|
59
|
-
};
|
|
1
|
+
import{PresenceContext as p}from"@tamagui/use-presence";import*as n from"react";import{useId as d}from"react";const b=({children:c,initial:l,isPresent:t,onExitComplete:s,exitVariant:i,enterVariant:a,presenceAffectsLayout:u})=>{const e=n.useMemo(C,[]),f=d()||"",m=n.useMemo(()=>({id:f,initial:l,isPresent:t,exitVariant:i,enterVariant:a,onExitComplete:r=>{e.set(r,!0);for(const o of e.values())if(!o)return;s?.()},register:r=>(e.set(r,!1),()=>e.delete(r))}),u?void 0:[t,i,a]);return n.useMemo(()=>{e.forEach((r,o)=>e.set(o,!1))},[t]),n.useEffect(()=>{!(t||e.size)&&s?.()},[t]),<p.Provider value={m}>{c}</p.Provider>};function C(){return new Map}export{b as PresenceChild};
|
|
60
2
|
//# sourceMappingURL=PresenceChild.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/PresenceChild.tsx"],
|
|
4
4
|
"sourcesContent": ["import { PresenceContext } from '@tamagui/use-presence'\nimport type { PresenceContextProps } from '@tamagui/web'\nimport * as React from 'react'\nimport { useId } from 'react'\n\nimport { VariantLabels } from './types'\n\ninterface PresenceChildProps {\n children: React.ReactElement<any>\n isPresent: boolean\n onExitComplete?: () => void\n initial?: false | VariantLabels\n custom?: any\n presenceAffectsLayout: boolean\n exitVariant?: string | null\n enterVariant?: string | null\n}\n\nexport const PresenceChild = ({\n children,\n initial,\n isPresent,\n onExitComplete,\n exitVariant,\n enterVariant,\n presenceAffectsLayout,\n}: PresenceChildProps) => {\n const presenceChildren = React.useMemo(newChildrenMap, [])\n const id = useId() || ''\n\n const context = React.useMemo(\n (): PresenceContextProps => {\n return {\n id,\n initial,\n isPresent,\n exitVariant,\n enterVariant,\n onExitComplete: (id: string) => {\n presenceChildren.set(id, true)\n for (const isComplete of presenceChildren.values()) {\n if (!isComplete) {\n return // can stop searching when any is incomplete\n }\n }\n onExitComplete?.()\n },\n register: (id: string) => {\n presenceChildren.set(id, false)\n return () => presenceChildren.delete(id)\n },\n }\n },\n /**\n * If the presence of a child affects the layout of the components around it,\n * we want to make a new context value to ensure they get re-rendered\n * so they can detect that layout change.\n */\n // eslint-disable-next-line react-hooks/exhaustive-deps\n presenceAffectsLayout ? undefined : [isPresent, exitVariant, enterVariant]\n )\n\n React.useMemo(() => {\n presenceChildren.forEach((_, key) => presenceChildren.set(key, false))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isPresent])\n\n /**\n * If there's no animated components to fire exit animations, we want to remove this\n * component immediately.\n */\n React.useEffect(() => {\n !(isPresent || presenceChildren.size) && onExitComplete?.()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isPresent])\n\n return <PresenceContext.Provider value={context}>{children}</PresenceContext.Provider>\n}\n\nfunction newChildrenMap(): Map<string, boolean> {\n return new Map()\n}\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": ["id"]
|
|
5
|
+
"mappings": "AAAA,OAAS,mBAAAA,MAAuB,wBAEhC,UAAYC,MAAW,QACvB,OAAS,SAAAC,MAAa,QAef,MAAMC,EAAgB,CAAC,CAC5B,SAAAC,EACA,QAAAC,EACA,UAAAC,EACA,eAAAC,EACA,YAAAC,EACA,aAAAC,EACA,sBAAAC,CACF,IAA0B,CACxB,MAAMC,EAAmBV,EAAM,QAAQW,EAAgB,CAAC,CAAC,EACnDC,EAAKX,EAAM,GAAK,GAEhBY,EAAUb,EAAM,QACpB,KACS,CACL,GAAAY,EACA,QAAAR,EACA,UAAAC,EACA,YAAAE,EACA,aAAAC,EACA,eAAiBI,GAAe,CAC9BF,EAAiB,IAAIE,EAAI,EAAI,EAC7B,UAAWE,KAAcJ,EAAiB,OAAO,EAC/C,GAAI,CAACI,EACH,OAGJR,IAAiB,CACnB,EACA,SAAWM,IACTF,EAAiB,IAAIE,EAAI,EAAK,EACvB,IAAMF,EAAiB,OAAOE,CAAE,EAE3C,GAQFH,EAAwB,OAAY,CAACJ,EAAWE,EAAaC,CAAY,CAC3E,EAEA,OAAAR,EAAM,QAAQ,IAAM,CAClBU,EAAiB,QAAQ,CAACK,EAAGC,IAAQN,EAAiB,IAAIM,EAAK,EAAK,CAAC,CAEvE,EAAG,CAACX,CAAS,CAAC,EAMdL,EAAM,UAAU,IAAM,CACpB,EAAEK,GAAaK,EAAiB,OAASJ,IAAiB,CAE5D,EAAG,CAACD,CAAS,CAAC,EAEP,CAACN,EAAgB,SAAS,OAAOc,IAAUV,EAAS,EAAnDJ,EAAgB,SAC1B,EAEA,SAASY,GAAuC,CAC9C,OAAO,IAAI,GACb",
|
|
6
|
+
"names": ["PresenceContext", "React", "useId", "PresenceChild", "children", "initial", "isPresent", "onExitComplete", "exitVariant", "enterVariant", "presenceAffectsLayout", "presenceChildren", "newChildrenMap", "id", "context", "isComplete", "_", "key"]
|
|
7
7
|
}
|
|
@@ -1,60 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { useId } from "react";
|
|
4
|
-
const PresenceChild = ({
|
|
5
|
-
children,
|
|
6
|
-
initial,
|
|
7
|
-
isPresent,
|
|
8
|
-
onExitComplete,
|
|
9
|
-
exitVariant,
|
|
10
|
-
enterVariant,
|
|
11
|
-
presenceAffectsLayout
|
|
12
|
-
}) => {
|
|
13
|
-
const presenceChildren = React.useMemo(newChildrenMap, []);
|
|
14
|
-
const id = useId() || "";
|
|
15
|
-
const context = React.useMemo(
|
|
16
|
-
() => {
|
|
17
|
-
return {
|
|
18
|
-
id,
|
|
19
|
-
initial,
|
|
20
|
-
isPresent,
|
|
21
|
-
exitVariant,
|
|
22
|
-
enterVariant,
|
|
23
|
-
onExitComplete: (id2) => {
|
|
24
|
-
presenceChildren.set(id2, true);
|
|
25
|
-
for (const isComplete of presenceChildren.values()) {
|
|
26
|
-
if (!isComplete) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
onExitComplete?.();
|
|
31
|
-
},
|
|
32
|
-
register: (id2) => {
|
|
33
|
-
presenceChildren.set(id2, false);
|
|
34
|
-
return () => presenceChildren.delete(id2);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
/**
|
|
39
|
-
* If the presence of a child affects the layout of the components around it,
|
|
40
|
-
* we want to make a new context value to ensure they get re-rendered
|
|
41
|
-
* so they can detect that layout change.
|
|
42
|
-
*/
|
|
43
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44
|
-
presenceAffectsLayout ? void 0 : [isPresent, exitVariant, enterVariant]
|
|
45
|
-
);
|
|
46
|
-
React.useMemo(() => {
|
|
47
|
-
presenceChildren.forEach((_, key) => presenceChildren.set(key, false));
|
|
48
|
-
}, [isPresent]);
|
|
49
|
-
React.useEffect(() => {
|
|
50
|
-
!(isPresent || presenceChildren.size) && onExitComplete?.();
|
|
51
|
-
}, [isPresent]);
|
|
52
|
-
return <PresenceContext.Provider value={context}>{children}</PresenceContext.Provider>;
|
|
53
|
-
};
|
|
54
|
-
function newChildrenMap() {
|
|
55
|
-
return /* @__PURE__ */ new Map();
|
|
56
|
-
}
|
|
57
|
-
export {
|
|
58
|
-
PresenceChild
|
|
59
|
-
};
|
|
1
|
+
import{PresenceContext as p}from"@tamagui/use-presence";import*as n from"react";import{useId as d}from"react";const b=({children:c,initial:l,isPresent:t,onExitComplete:s,exitVariant:i,enterVariant:a,presenceAffectsLayout:u})=>{const e=n.useMemo(C,[]),f=d()||"",m=n.useMemo(()=>({id:f,initial:l,isPresent:t,exitVariant:i,enterVariant:a,onExitComplete:r=>{e.set(r,!0);for(const o of e.values())if(!o)return;s?.()},register:r=>(e.set(r,!1),()=>e.delete(r))}),u?void 0:[t,i,a]);return n.useMemo(()=>{e.forEach((r,o)=>e.set(o,!1))},[t]),n.useEffect(()=>{!(t||e.size)&&s?.()},[t]),<p.Provider value={m}>{c}</p.Provider>};function C(){return new Map}export{b as PresenceChild};
|
|
60
2
|
//# sourceMappingURL=PresenceChild.mjs.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/PresenceChild.tsx"],
|
|
4
4
|
"sourcesContent": ["import { PresenceContext } from '@tamagui/use-presence'\nimport type { PresenceContextProps } from '@tamagui/web'\nimport * as React from 'react'\nimport { useId } from 'react'\n\nimport { VariantLabels } from './types'\n\ninterface PresenceChildProps {\n children: React.ReactElement<any>\n isPresent: boolean\n onExitComplete?: () => void\n initial?: false | VariantLabels\n custom?: any\n presenceAffectsLayout: boolean\n exitVariant?: string | null\n enterVariant?: string | null\n}\n\nexport const PresenceChild = ({\n children,\n initial,\n isPresent,\n onExitComplete,\n exitVariant,\n enterVariant,\n presenceAffectsLayout,\n}: PresenceChildProps) => {\n const presenceChildren = React.useMemo(newChildrenMap, [])\n const id = useId() || ''\n\n const context = React.useMemo(\n (): PresenceContextProps => {\n return {\n id,\n initial,\n isPresent,\n exitVariant,\n enterVariant,\n onExitComplete: (id: string) => {\n presenceChildren.set(id, true)\n for (const isComplete of presenceChildren.values()) {\n if (!isComplete) {\n return // can stop searching when any is incomplete\n }\n }\n onExitComplete?.()\n },\n register: (id: string) => {\n presenceChildren.set(id, false)\n return () => presenceChildren.delete(id)\n },\n }\n },\n /**\n * If the presence of a child affects the layout of the components around it,\n * we want to make a new context value to ensure they get re-rendered\n * so they can detect that layout change.\n */\n // eslint-disable-next-line react-hooks/exhaustive-deps\n presenceAffectsLayout ? undefined : [isPresent, exitVariant, enterVariant]\n )\n\n React.useMemo(() => {\n presenceChildren.forEach((_, key) => presenceChildren.set(key, false))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isPresent])\n\n /**\n * If there's no animated components to fire exit animations, we want to remove this\n * component immediately.\n */\n React.useEffect(() => {\n !(isPresent || presenceChildren.size) && onExitComplete?.()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isPresent])\n\n return <PresenceContext.Provider value={context}>{children}</PresenceContext.Provider>\n}\n\nfunction newChildrenMap(): Map<string, boolean> {\n return new Map()\n}\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": ["id"]
|
|
5
|
+
"mappings": "AAAA,OAAS,mBAAAA,MAAuB,wBAEhC,UAAYC,MAAW,QACvB,OAAS,SAAAC,MAAa,QAef,MAAMC,EAAgB,CAAC,CAC5B,SAAAC,EACA,QAAAC,EACA,UAAAC,EACA,eAAAC,EACA,YAAAC,EACA,aAAAC,EACA,sBAAAC,CACF,IAA0B,CACxB,MAAMC,EAAmBV,EAAM,QAAQW,EAAgB,CAAC,CAAC,EACnDC,EAAKX,EAAM,GAAK,GAEhBY,EAAUb,EAAM,QACpB,KACS,CACL,GAAAY,EACA,QAAAR,EACA,UAAAC,EACA,YAAAE,EACA,aAAAC,EACA,eAAiBI,GAAe,CAC9BF,EAAiB,IAAIE,EAAI,EAAI,EAC7B,UAAWE,KAAcJ,EAAiB,OAAO,EAC/C,GAAI,CAACI,EACH,OAGJR,IAAiB,CACnB,EACA,SAAWM,IACTF,EAAiB,IAAIE,EAAI,EAAK,EACvB,IAAMF,EAAiB,OAAOE,CAAE,EAE3C,GAQFH,EAAwB,OAAY,CAACJ,EAAWE,EAAaC,CAAY,CAC3E,EAEA,OAAAR,EAAM,QAAQ,IAAM,CAClBU,EAAiB,QAAQ,CAACK,EAAGC,IAAQN,EAAiB,IAAIM,EAAK,EAAK,CAAC,CAEvE,EAAG,CAACX,CAAS,CAAC,EAMdL,EAAM,UAAU,IAAM,CACpB,EAAEK,GAAaK,EAAiB,OAASJ,IAAiB,CAE5D,EAAG,CAACD,CAAS,CAAC,EAEP,CAACN,EAAgB,SAAS,OAAOc,IAAUV,EAAS,EAAnDJ,EAAgB,SAC1B,EAEA,SAASY,GAAuC,CAC9C,OAAO,IAAI,GACb",
|
|
6
|
+
"names": ["PresenceContext", "React", "useId", "PresenceChild", "children", "initial", "isPresent", "onExitComplete", "exitVariant", "enterVariant", "presenceAffectsLayout", "presenceChildren", "newChildrenMap", "id", "context", "isComplete", "_", "key"]
|
|
7
7
|
}
|
package/dist/jsx/index.js
CHANGED
package/dist/jsx/index.js.map
CHANGED
package/dist/jsx/index.mjs
CHANGED
package/dist/jsx/index.mjs.map
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/animate-presence",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.4",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@tamagui/use-presence": "1.13.
|
|
18
|
-
"@tamagui/web": "1.13.
|
|
17
|
+
"@tamagui/use-presence": "1.13.4",
|
|
18
|
+
"@tamagui/web": "1.13.4"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@tamagui/build": "1.13.
|
|
21
|
+
"@tamagui/build": "1.13.4"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "tamagui-build",
|