@tamagui/animations-css 2.0.0-1768983999155 → 2.0.0-1769035103261
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/createAnimations.cjs +4 -2
- package/dist/cjs/createAnimations.js +3 -2
- package/dist/cjs/createAnimations.js.map +1 -1
- package/dist/cjs/createAnimations.native.js +4 -3
- package/dist/cjs/createAnimations.native.js.map +1 -1
- package/dist/esm/createAnimations.js +3 -2
- package/dist/esm/createAnimations.js.map +1 -1
- package/dist/esm/createAnimations.mjs +4 -2
- package/dist/esm/createAnimations.mjs.map +1 -1
- package/dist/esm/createAnimations.native.js +4 -3
- package/dist/esm/createAnimations.native.js.map +1 -1
- package/package.json +7 -7
- package/src/createAnimations.tsx +20 -5
- package/types/createAnimations.d.ts.map +1 -1
|
@@ -104,8 +104,10 @@ function createAnimations(animations) {
|
|
|
104
104
|
normalized = (0, import_animation_helpers.normalizeTransition)(props.transition),
|
|
105
105
|
defaultAnimation = normalized.default ? animations[normalized.default] : null,
|
|
106
106
|
animatedProperties = (0, import_animation_helpers.getAnimatedProperties)(normalized),
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
hasDefault = normalized.default !== null,
|
|
108
|
+
hasPerPropertyConfigs = animatedProperties.length > 0;
|
|
109
|
+
let keys;
|
|
110
|
+
if (props.animateOnly ? keys = props.animateOnly : hasPerPropertyConfigs && !hasDefault ? keys = animatedProperties : hasPerPropertyConfigs && hasDefault ? keys = [...animatedProperties, "all"] : keys = ["all"], (0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
109
111
|
const host = stateRef.current.host;
|
|
110
112
|
if (!sendExitComplete || !isExiting || !host) return;
|
|
111
113
|
const node = host,
|
|
@@ -78,8 +78,9 @@ function createAnimations(animations) {
|
|
|
78
78
|
return getStyle(val.getValue());
|
|
79
79
|
},
|
|
80
80
|
useAnimations: ({ props, presence, style, componentState, stateRef }) => {
|
|
81
|
-
const isEntering = !!componentState.unmounted, isExiting = presence?.[0] === !1, sendExitComplete = presence?.[1], normalized = (0, import_animation_helpers.normalizeTransition)(props.transition), defaultAnimation = normalized.default ? animations[normalized.default] : null, animatedProperties = (0, import_animation_helpers.getAnimatedProperties)(normalized),
|
|
82
|
-
|
|
81
|
+
const isEntering = !!componentState.unmounted, isExiting = presence?.[0] === !1, sendExitComplete = presence?.[1], normalized = (0, import_animation_helpers.normalizeTransition)(props.transition), defaultAnimation = normalized.default ? animations[normalized.default] : null, animatedProperties = (0, import_animation_helpers.getAnimatedProperties)(normalized), hasDefault = normalized.default !== null, hasPerPropertyConfigs = animatedProperties.length > 0;
|
|
82
|
+
let keys;
|
|
83
|
+
if (props.animateOnly ? keys = props.animateOnly : hasPerPropertyConfigs && !hasDefault ? keys = animatedProperties : hasPerPropertyConfigs && hasDefault ? keys = [...animatedProperties, "all"] : keys = ["all"], (0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
83
84
|
const host = stateRef.current.host;
|
|
84
85
|
if (!sendExitComplete || !isExiting || !host) return;
|
|
85
86
|
const node = host, animationDuration = defaultAnimation ? extractDuration(defaultAnimation) : 200, delay = normalized.delay ?? 0, fallbackTimeout = animationDuration + delay, timeoutId = setTimeout(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/createAnimations.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAIO,uCACP,mBAA0C,+BAC1C,sBAA2C,kCAE3C,aAAmC,yBACnC,eAAgC;AAOhC,SAAS,gBAAgB,WAA2B;AAElD,QAAM,UAAU,UAAU,MAAM,sBAAsB;AACtD,MAAI;AACF,WAAO,OAAO,SAAS,QAAQ,CAAC,GAAG,EAAE;AAIvC,QAAM,SAAS,UAAU,MAAM,qBAAqB;AACpD,SAAI,SACK,KAAK,MAAM,OAAO,WAAW,OAAO,CAAC,CA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asNormalizedAnimation"]
|
|
6
6
|
}
|
|
@@ -115,9 +115,10 @@ function createAnimations(animations) {
|
|
|
115
115
|
normalized = (0, import_animation_helpers.normalizeTransition)(props.transition),
|
|
116
116
|
defaultAnimation = normalized.default ? animations[normalized.default] : null,
|
|
117
117
|
animatedProperties = (0, import_animation_helpers.getAnimatedProperties)(normalized),
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
hasDefault = normalized.default !== null,
|
|
119
|
+
hasPerPropertyConfigs = animatedProperties.length > 0,
|
|
120
|
+
keys;
|
|
121
|
+
if (props.animateOnly ? keys = props.animateOnly : hasPerPropertyConfigs && !hasDefault ? keys = animatedProperties : hasPerPropertyConfigs && hasDefault ? keys = [...animatedProperties, "all"] : keys = ["all"], (0, import_constants.useIsomorphicLayoutEffect)(function () {
|
|
121
122
|
var host = stateRef.current.host;
|
|
122
123
|
if (!(!sendExitComplete || !isExiting || !host)) {
|
|
123
124
|
var node = host,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","createAnimations_exports","__export","createAnimations","module","exports","import_animation_helpers","require","import_constants","import_use_presence","import_web","import_react","__toESM","_type_of","obj","Symbol","constructor","extractDuration","animation","msMatch","match","Number","parseInt","sMatch","Math","round","parseFloat","animations","reactionListeners","WeakMap","usePresence","ResetPresence","supportsCSS","classNameAnimation","useAnimatedNumber","initial","val","setVal","default","useState","onFinish","setOnFinish","useIsomorphicLayoutEffect","getInstance","getValue","setValue","next","config","onFinish2","listeners","get","forEach","listener","stop","useAnimatedNumberReaction","param","onValue","useEffect","instance","queue","Set","set","add","delete","useAnimatedNumberStyle","getStyle","useAnimations","props","presence","style","componentState","stateRef","isEntering","unmounted","isExiting","sendExitComplete","normalized","normalizeTransition","transition","defaultAnimation","animatedProperties","getAnimatedProperties","
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","createAnimations_exports","__export","createAnimations","module","exports","import_animation_helpers","require","import_constants","import_use_presence","import_web","import_react","__toESM","_type_of","obj","Symbol","constructor","extractDuration","animation","msMatch","match","Number","parseInt","sMatch","Math","round","parseFloat","animations","reactionListeners","WeakMap","usePresence","ResetPresence","supportsCSS","classNameAnimation","useAnimatedNumber","initial","val","setVal","default","useState","onFinish","setOnFinish","useIsomorphicLayoutEffect","getInstance","getValue","setValue","next","config","onFinish2","listeners","get","forEach","listener","stop","useAnimatedNumberReaction","param","onValue","useEffect","instance","queue","Set","set","add","delete","useAnimatedNumberStyle","getStyle","useAnimations","props","presence","style","componentState","stateRef","isEntering","unmounted","isExiting","sendExitComplete","normalized","normalizeTransition","transition","defaultAnimation","animatedProperties","getAnimatedProperties","hasDefault","hasPerPropertyConfigs","length","keys","animateOnly","host","current","node","animationDuration","_normalized_delay","delay","fallbackTimeout","timeoutId","setTimeout","onFinishAnimation","clearTimeout","addEventListener","removeEventListener","hasAnimation","Array","isArray","transform","transformsToString"],"sources":["../../src/createAnimations.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,wBAAA;AAAAC,QAAA,CAAAD,wBAAA;EAAAE,gBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAA,CAAAK,wBAIO;AAYP,IAAAK,wBAAyB,GAAAC,OAA2B;EAAAC,gBAAA,GAAAD,OAAA;EAAAE,mBAAA,GAAAF,OAAA;EAAAG,UAAA,GAAAH,OAAA;EAAAI,YAAA,GAAAC,OAAA,CAAAL,OAAA;AAElD,SAAMM,SAAUC,GAAA;EAChB,uBAAI;;EACF,OAAAA,GAAO,WAAOC,MAAS,MAAQ,IAAID,GAAE,CAAAE,WAAA,KAAAD,MAAA,qBAAAD,GAAA;AAIvC;AACA,SAAIG,eACUA,CAAAC,SA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MACF,GAAIK,IAAA,IAIF,MAGE,MAAM7E,gBAAc,CAAAkC,yBAChB,cAAY;QAMpB,IAAM6C,IAAA,GAAAhB,QAAW,CAAAiB,OAAW,CAAAD,IAAA;QAC5B,OAAAZ,gBAAM,IAAa,CAAAD,SACX,KAAQa,IAAA;UAEZ,IAAME,IAAA,GAAAF,IAAA;YAAAG,iBAA2B,GAAAX,gBAAc,GAAA9D,eAAA,CAAA8D,gBAAA;YAAAY,iBAAA;YAAAC,KAAA,IAAAD,iBAAA,GAAAf,UAAA,CAAAgB,KAAA,cAAAD,iBAAA,cAAAA,iBAAA;YAAAE,eAAA,GAAAH,iBAAA,GAAAE,KAAA;YAAAE,SAAA,GAAAC,UAAA;cAC3CpB,gBAAA,GAAgC;YAEpC,GAAAkB,eAAW;YAAAG,iBAAkB,GAC3B,SAAAA,CAAA;cAaHC,YAAc,CACdH,SAAS,GAERnB,gBAAY;YAEZ;UACA,OAAAc,IAAA,CAAAS,gBAAA,kBAAAF,iBAAA,GAAAP,IAAA,CAAAS,gBAAA,qBAAAF,iBAAA;YACAC,YAAA,CAAAH,SAAA,GAAAL,IAAA,CAAAU,mBAAA,kBAAAH,iBAAA,GAAAP,IAAA,CAAAU,mBAAA,qBAAAH,iBAAA;UACA;QACA;MAAA,GACA,CACArB,gBAAA,EACDD,SAGM,CACX,QAAApE,wBAAA,CAAA8F,YAAA,EAAAxB,UAAA,GACF;MACFyB,KAAA,CAAAC,OAAA,CAAAjC,KAAA,CAAAkC,SAAA,MAAAlC,KAAA,CAAAkC,SAAA,OAAA7F,UAAA,CAAA8F,kBAAA,EAAAnC,KAAA,CAAAkC,SAAA","ignoreList":[]}
|
|
@@ -59,8 +59,9 @@ function createAnimations(animations) {
|
|
|
59
59
|
return getStyle(val.getValue());
|
|
60
60
|
},
|
|
61
61
|
useAnimations: ({ props, presence, style, componentState, stateRef }) => {
|
|
62
|
-
const isEntering = !!componentState.unmounted, isExiting = presence?.[0] === !1, sendExitComplete = presence?.[1], normalized = normalizeTransition(props.transition), defaultAnimation = normalized.default ? animations[normalized.default] : null, animatedProperties = getAnimatedProperties(normalized),
|
|
63
|
-
|
|
62
|
+
const isEntering = !!componentState.unmounted, isExiting = presence?.[0] === !1, sendExitComplete = presence?.[1], normalized = normalizeTransition(props.transition), defaultAnimation = normalized.default ? animations[normalized.default] : null, animatedProperties = getAnimatedProperties(normalized), hasDefault = normalized.default !== null, hasPerPropertyConfigs = animatedProperties.length > 0;
|
|
63
|
+
let keys;
|
|
64
|
+
if (props.animateOnly ? keys = props.animateOnly : hasPerPropertyConfigs && !hasDefault ? keys = animatedProperties : hasPerPropertyConfigs && hasDefault ? keys = [...animatedProperties, "all"] : keys = ["all"], useIsomorphicLayoutEffect(() => {
|
|
64
65
|
const host = stateRef.current.host;
|
|
65
66
|
if (!sendExitComplete || !isExiting || !host) return;
|
|
66
67
|
const node = host, animationDuration = defaultAnimation ? extractDuration(defaultAnimation) : 200, delay = normalized.delay ?? 0, fallbackTimeout = animationDuration + delay, timeoutId = setTimeout(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/createAnimations.tsx"],
|
|
4
|
-
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,OACX;AACP,SAAS,iCAAiC;AAC1C,SAAS,eAAe,mBAAmB;AAE3C,SAAS,0BAA0B;AACnC,OAAO,SAAS,gBAAgB;AAOhC,SAAS,gBAAgB,WAA2B;AAElD,QAAM,UAAU,UAAU,MAAM,sBAAsB;AACtD,MAAI;AACF,WAAO,OAAO,SAAS,QAAQ,CAAC,GAAG,EAAE;AAIvC,QAAM,SAAS,UAAU,MAAM,qBAAqB;AACpD,SAAI,SACK,KAAK,MAAM,OAAO,WAAW,OAAO,CAAC,CAAC,IAAI,GAAI,IAIhD;AACT;AAEO,SAAS,iBAAmC,YAAmC;AACpF,QAAM,oBAAoB,oBAAI,QAA4B;AAE1D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BAAoB,MAAM;AAC9B,uBAAa,SAAS,GACtB,mBAAmB;AAAA,QACrB;AAEA,oBAAK,iBAAiB,iBAAiB,iBAAiB,GACxD,KAAK,iBAAiB,oBAAoB,iBAAiB,GAEpD,MAAM;AACX,uBAAa,SAAS,GACtB,KAAK,oBAAoB,iBAAiB,iBAAiB,GAC3D,KAAK,oBAAoB,oBAAoB,iBAAiB;AAAA,QAChE;AAAA,MACF,GAAG,CAAC,kBAAkB,SAAS,CAAC,GAG5B,CAAC,uBAAuB,UAAU;AACpC,eAAO;AAGT,MAAI,MAAM,QAAQ,MAAM,SAAS,MAC/B,MAAM,YAAY,mBAAmB,MAAM,SAAS;AAMtD,YAAM,WAAW,WAAW,QAAQ,IAAI,WAAW,KAAK,OAAO;AAC/D,mBAAM,aAAa,KAChB,IAAI,CAAC,QAAQ;AAEZ,cAAM,gBAAgB,WAAW,WAAW,GAAG;AAC/C,YAAI,iBAAgC;AAEpC,eAAI,OAAO,iBAAkB,WAC3B,iBAAiB,WAAW,aAAa,IAEzC,iBACA,OAAO,iBAAkB,YACzB,cAAc,OAEd,iBAAiB,WAAW,cAAc,IAAI,IACrC,qBACT,iBAAiB,mBAGZ,iBAAiB,GAAG,GAAG,IAAI,cAAc,GAAG,QAAQ,KAAK;AAAA,MAClE,CAAC,EACA,OAAO,OAAO,EACd,KAAK,IAAI,GAER,QAAQ,IAAI,aAAa,iBAAiB,MAAM,UAAa,aAC/D,QAAQ,KAAK,iBAAiB;AAAA,QAC5B;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC,GAGI,EAAE,OAAO,WAAW,aAAa,gBAAgB,GAAG;AAAA,IAC7D;AAAA,EACF;AACF;",
|
|
5
5
|
"names": ["onFinish"]
|
|
6
6
|
}
|
|
@@ -68,8 +68,10 @@ function createAnimations(animations) {
|
|
|
68
68
|
normalized = normalizeTransition(props.transition),
|
|
69
69
|
defaultAnimation = normalized.default ? animations[normalized.default] : null,
|
|
70
70
|
animatedProperties = getAnimatedProperties(normalized),
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
hasDefault = normalized.default !== null,
|
|
72
|
+
hasPerPropertyConfigs = animatedProperties.length > 0;
|
|
73
|
+
let keys;
|
|
74
|
+
if (props.animateOnly ? keys = props.animateOnly : hasPerPropertyConfigs && !hasDefault ? keys = animatedProperties : hasPerPropertyConfigs && hasDefault ? keys = [...animatedProperties, "all"] : keys = ["all"], useIsomorphicLayoutEffect(() => {
|
|
73
75
|
const host = stateRef.current.host;
|
|
74
76
|
if (!sendExitComplete || !isExiting || !host) return;
|
|
75
77
|
const node = host,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["normalizeTransition","getAnimatedProperties","hasAnimation","hasNormalizedAnimation","useIsomorphicLayoutEffect","ResetPresence","usePresence","transformsToString","React","useState","extractDuration","animation","msMatch","match","Number","parseInt","sMatch","Math","round","parseFloat","createAnimations","animations","reactionListeners","WeakMap","supportsCSS","classNameAnimation","useAnimatedNumber","initial","val","setVal","onFinish","setOnFinish","getInstance","getValue","setValue","next","config","onFinish2","listeners","get","forEach","listener","stop","useAnimatedNumberReaction","value","onValue","useEffect","instance","queue","Set","set","add","delete","useAnimatedNumberStyle","getStyle","useAnimations","props","presence","style","componentState","stateRef","isEntering","unmounted","isExiting","sendExitComplete","normalized","transition","defaultAnimation","default","animatedProperties","
|
|
1
|
+
{"version":3,"names":["normalizeTransition","getAnimatedProperties","hasAnimation","hasNormalizedAnimation","useIsomorphicLayoutEffect","ResetPresence","usePresence","transformsToString","React","useState","extractDuration","animation","msMatch","match","Number","parseInt","sMatch","Math","round","parseFloat","createAnimations","animations","reactionListeners","WeakMap","supportsCSS","classNameAnimation","useAnimatedNumber","initial","val","setVal","onFinish","setOnFinish","getInstance","getValue","setValue","next","config","onFinish2","listeners","get","forEach","listener","stop","useAnimatedNumberReaction","value","onValue","useEffect","instance","queue","Set","set","add","delete","useAnimatedNumberStyle","getStyle","useAnimations","props","presence","style","componentState","stateRef","isEntering","unmounted","isExiting","sendExitComplete","normalized","transition","defaultAnimation","default","animatedProperties","hasDefault","hasPerPropertyConfigs","length","keys","animateOnly","host","current","node","animationDuration","delay","fallbackTimeout","timeoutId","setTimeout","onFinishAnimation","clearTimeout","addEventListener","removeEventListener","Array","isArray","transform","delayStr","map","key","propAnimation","properties","animationValue","type","filter","Boolean","join","process","env","NODE_ENV","debug","console","info","className"],"sources":["../../src/createAnimations.tsx"],"sourcesContent":[null],"mappings":"AAAA,SACEA,mBAAA,EACAC,qBAAA,EACAC,YAAA,IAAgBC,sBAAA,QACX;AACP,SAASC,yBAAA,QAAiC;AAC1C,SAASC,aAAA,EAAeC,WAAA,QAAmB;AAE3C,SAASC,kBAAA,QAA0B;AACnC,OAAOC,KAAA,IAASC,QAAA,QAAgB;AAOhC,SAASC,gBAAgBC,SAAA,EAA2B;EAElD,MAAMC,OAAA,GAAUD,SAAA,CAAUE,KAAA,CAAM,sBAAsB;EACtD,IAAID,OAAA,EACF,OAAOE,MAAA,CAAOC,QAAA,CAASH,OAAA,CAAQ,CAAC,GAAG,EAAE;EAIvC,MAAMI,MAAA,GAASL,SAAA,CAAUE,KAAA,CAAM,qBAAqB;EACpD,OAAIG,MAAA,GACKC,IAAA,CAAKC,KAAA,CAAMJ,MAAA,CAAOK,UAAA,CAAWH,MAAA,CAAO,CAAC,CAAC,IAAI,GAAI,IAIhD;AACT;AAEO,SAASI,iBAAmCC,UAAA,EAAmC;EACpF,MAAMC,iBAAA,GAAoB,mBAAIC,OAAA,CAA4B;EAE1D,OAAO;IACLF,UAAA;IACAf,WAAA;IACAD,aAAA;IACAmB,WAAA,EAAa;IACbC,kBAAA,EAAoB;IAEpBC,kBAAkBC,OAAA,EAA4C;MAC5D,MAAM,CAACC,GAAA,EAAKC,MAAM,IAAIrB,KAAA,CAAMC,QAAA,CAASkB,OAAO;QACtC,CAACG,QAAA,EAAUC,WAAW,IAAItB,QAAA,CAA+B;MAE/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,CAAK,iBAAiB;QAC5BjD,KAAA;QACAnC,UAAA;QACA4C,UAAA;QACAE,gBAAA;QACAT,KAAA;QACAG,UAAA;QACAE;MACF,CAAC,GAGI;QAAEL,KAAA;QAAOgD,SAAA,EAAW7C,UAAA,GAAa,gBAAgB;MAAG;IAC7D;EACF;AACF","ignoreList":[]}
|
|
@@ -77,9 +77,10 @@ function createAnimations(animations) {
|
|
|
77
77
|
normalized = normalizeTransition(props.transition),
|
|
78
78
|
defaultAnimation = normalized.default ? animations[normalized.default] : null,
|
|
79
79
|
animatedProperties = getAnimatedProperties(normalized),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
hasDefault = normalized.default !== null,
|
|
81
|
+
hasPerPropertyConfigs = animatedProperties.length > 0,
|
|
82
|
+
keys;
|
|
83
|
+
if (props.animateOnly ? keys = props.animateOnly : hasPerPropertyConfigs && !hasDefault ? keys = animatedProperties : hasPerPropertyConfigs && hasDefault ? keys = [...animatedProperties, "all"] : keys = ["all"], useIsomorphicLayoutEffect(function () {
|
|
83
84
|
var host = stateRef.current.host;
|
|
84
85
|
if (!(!sendExitComplete || !isExiting || !host)) {
|
|
85
86
|
var node = host,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["normalizeTransition","getAnimatedProperties","hasAnimation","hasNormalizedAnimation","useIsomorphicLayoutEffect","ResetPresence","usePresence","transformsToString","React","useState","_type_of","obj","Symbol","constructor","extractDuration","animation","msMatch","match","Number","parseInt","sMatch","Math","round","parseFloat","createAnimations","animations","reactionListeners","WeakMap","supportsCSS","classNameAnimation","useAnimatedNumber","initial","val","setVal","onFinish","setOnFinish","getInstance","getValue","setValue","next","config","onFinish2","listeners","get","forEach","listener","stop","useAnimatedNumberReaction","param","onValue","value","useEffect","instance","queue","Set","set","add","delete","useAnimatedNumberStyle","getStyle","useAnimations","props","presence","style","componentState","stateRef","isEntering","unmounted","isExiting","sendExitComplete","normalized","transition","defaultAnimation","default","animatedProperties","
|
|
1
|
+
{"version":3,"names":["normalizeTransition","getAnimatedProperties","hasAnimation","hasNormalizedAnimation","useIsomorphicLayoutEffect","ResetPresence","usePresence","transformsToString","React","useState","_type_of","obj","Symbol","constructor","extractDuration","animation","msMatch","match","Number","parseInt","sMatch","Math","round","parseFloat","createAnimations","animations","reactionListeners","WeakMap","supportsCSS","classNameAnimation","useAnimatedNumber","initial","val","setVal","onFinish","setOnFinish","getInstance","getValue","setValue","next","config","onFinish2","listeners","get","forEach","listener","stop","useAnimatedNumberReaction","param","onValue","value","useEffect","instance","queue","Set","set","add","delete","useAnimatedNumberStyle","getStyle","useAnimations","props","presence","style","componentState","stateRef","isEntering","unmounted","isExiting","sendExitComplete","normalized","transition","defaultAnimation","default","animatedProperties","hasDefault","hasPerPropertyConfigs","length","keys","animateOnly","host","current","node","animationDuration","_normalized_delay","delay","fallbackTimeout","timeoutId","setTimeout","onFinishAnimation","clearTimeout","addEventListener","removeEventListener","Array","isArray","transform","delayStr","map","key","propAnimation","properties","animationValue","type","filter","Boolean","join","process","env","NODE_ENV","debug","console","info"],"sources":["../../src/createAnimations.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAAAA,mBAAA,EAAAC,qBAAA,EAAAC,YAAA,IAAAC,sBAAA;AAAA,SACEC,yBAAA;AAAA,SACAC,aAAA,EAAAC,WAAA;AAAA,SACAC,kBAAgB;AAAA,OACXC,KAAA,IAAAC,QAAA;AACP,SAASC,SAAAC,GAAA;EACT,uBAAwB;;EAExB,OAASA,GAAA,WAAAC,MAAA,MAA0B,IAAAD,GAAA,CAAAE,WAAA,KAAAD,MAAA,qBAAAD,GAAA;AACnC;AAOA,SAASG,gBAAgBC,SAAA,EAA2B;EAElD,IAAAC,OAAM,GAAAD,SAAU,CAAAE,KAAU,uBAAM;EAChC,IAAID,OAAA,EACF,OAAOE,MAAA,CAAOC,QAAA,CAASH,OAAA,CAAQ,CAAC,GAAG,EAAE;EAIvC,IAAAI,MAAM,GAAAL,SAAS,CAAAE,KAAU,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AAH,GAAA,IAAAG,cAAA,GAAAL,QAAA;MACF,GAAAO,MAAA,CAAAC,OAAA,EAAAC,IAAA,QAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,sBAAA/C,KAAA,CAAAgD,KAAA,kBAAAC,OAAA,CAAAC,IAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/animations-css",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-1769035103261",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@tamagui/animation-helpers": "2.0.0-
|
|
33
|
-
"@tamagui/constants": "2.0.0-
|
|
34
|
-
"@tamagui/cubic-bezier-animator": "2.0.0-
|
|
35
|
-
"@tamagui/use-presence": "2.0.0-
|
|
36
|
-
"@tamagui/web": "2.0.0-
|
|
32
|
+
"@tamagui/animation-helpers": "2.0.0-1769035103261",
|
|
33
|
+
"@tamagui/constants": "2.0.0-1769035103261",
|
|
34
|
+
"@tamagui/cubic-bezier-animator": "2.0.0-1769035103261",
|
|
35
|
+
"@tamagui/use-presence": "2.0.0-1769035103261",
|
|
36
|
+
"@tamagui/web": "2.0.0-1769035103261"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@tamagui/build": "2.0.0-
|
|
39
|
+
"@tamagui/build": "2.0.0-1769035103261",
|
|
40
40
|
"react": "*",
|
|
41
41
|
"react-dom": "*"
|
|
42
42
|
},
|
package/src/createAnimations.tsx
CHANGED
|
@@ -102,11 +102,26 @@ export function createAnimations<A extends Object>(animations: A): AnimationDriv
|
|
|
102
102
|
const animatedProperties = getAnimatedProperties(normalized)
|
|
103
103
|
|
|
104
104
|
// Determine which properties to animate
|
|
105
|
-
//
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
// - animateOnly prop is an exclusive filter (only animate those properties)
|
|
106
|
+
// - per-property configs WITHOUT a default = only animate those specific properties
|
|
107
|
+
// - per-property configs WITH a default = per-property overrides + default for rest
|
|
108
|
+
const hasDefault = normalized.default !== null
|
|
109
|
+
const hasPerPropertyConfigs = animatedProperties.length > 0
|
|
110
|
+
|
|
111
|
+
let keys: string[]
|
|
112
|
+
if (props.animateOnly) {
|
|
113
|
+
// animateOnly is explicit filter
|
|
114
|
+
keys = props.animateOnly
|
|
115
|
+
} else if (hasPerPropertyConfigs && !hasDefault) {
|
|
116
|
+
// object format without default: { opacity: '200ms' } = only animate opacity
|
|
117
|
+
keys = animatedProperties
|
|
118
|
+
} else if (hasPerPropertyConfigs && hasDefault) {
|
|
119
|
+
// array format or object with default: per-property overrides + 'all' for rest
|
|
120
|
+
keys = [...animatedProperties, 'all']
|
|
121
|
+
} else {
|
|
122
|
+
// simple string format: 'quick' = animate all
|
|
123
|
+
keys = ['all']
|
|
124
|
+
}
|
|
110
125
|
|
|
111
126
|
useIsomorphicLayoutEffect(() => {
|
|
112
127
|
const host = stateRef.current.host
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"src/createAnimations.tsx"
|
|
6
6
|
],
|
|
7
7
|
"sourcesContent": [
|
|
8
|
-
"import {\n normalizeTransition,\n getAnimatedProperties,\n hasAnimation as hasNormalizedAnimation,\n} from '@tamagui/animation-helpers'\nimport { useIsomorphicLayoutEffect } from '@tamagui/constants'\nimport { ResetPresence, usePresence } from '@tamagui/use-presence'\nimport type { AnimationDriver, UniversalAnimatedNumber } from '@tamagui/web'\nimport { transformsToString } from '@tamagui/web'\nimport React, { useState } from 'react' // import { animate } from '@tamagui/cubic-bezier-animator'\n\n/**\n * Helper function to extract duration from CSS animation string\n * Examples: \"ease-in 200ms\" -> 200, \"cubic-bezier(0.215, 0.610, 0.355, 1.000) 400ms\" -> 400\n * \"ease-in 0.5s\" -> 500, \"slow 2s\" -> 2000\n */\nfunction extractDuration(animation: string): number {\n // Try to match milliseconds first\n const msMatch = animation.match(/(\\d+(?:\\.\\d+)?)\\s*ms/)\n if (msMatch) {\n return Number.parseInt(msMatch[1], 10)\n }\n\n // Try to match seconds and convert to milliseconds\n const sMatch = animation.match(/(\\d+(?:\\.\\d+)?)\\s*s/)\n if (sMatch) {\n return Math.round(Number.parseFloat(sMatch[1]) * 1000)\n }\n\n // Default to 300ms if no duration found\n return 300\n}\n\nexport function createAnimations<A extends Object>(animations: A): AnimationDriver<A> {\n const reactionListeners = new WeakMap<any, Set<Function>>()\n\n return {\n animations,\n usePresence,\n ResetPresence,\n supportsCSS: true,\n classNameAnimation: true,\n\n useAnimatedNumber(initial): UniversalAnimatedNumber<Function> {\n const [val, setVal] = React.useState(initial)\n const [onFinish, setOnFinish] = useState<Function | undefined>()\n\n useIsomorphicLayoutEffect(() => {\n if (onFinish) {\n onFinish?.()\n setOnFinish(undefined)\n }\n }, [onFinish])\n\n return {\n getInstance() {\n return setVal\n },\n getValue() {\n return val\n },\n setValue(next, config, onFinish) {\n setVal(next)\n setOnFinish(onFinish)\n // call reaction listeners with the new value\n const listeners = reactionListeners.get(setVal)\n if (listeners) {\n listeners.forEach((listener) => listener(next))\n }\n },\n stop() {},\n }\n },\n\n useAnimatedNumberReaction({ value }, onValue) {\n React.useEffect(() => {\n const instance = value.getInstance()\n let queue = reactionListeners.get(instance)\n if (!queue) {\n const next = new Set<Function>()\n reactionListeners.set(instance, next)\n queue = next!\n }\n queue.add(onValue)\n return () => {\n queue?.delete(onValue)\n }\n }, [])\n },\n\n useAnimatedNumberStyle(val, getStyle) {\n return getStyle(val.getValue())\n },\n\n useAnimations: ({ props, presence, style, componentState, stateRef }) => {\n const isEntering = !!componentState.unmounted\n const isExiting = presence?.[0] === false\n const sendExitComplete = presence?.[1]\n // Normalize the transition prop to a consistent format\n const normalized = normalizeTransition(props.transition)\n const defaultAnimation = normalized.default ? animations[normalized.default] : null\n const animatedProperties = getAnimatedProperties(normalized)\n\n // Determine which properties to animate\n //
|
|
8
|
+
"import {\n normalizeTransition,\n getAnimatedProperties,\n hasAnimation as hasNormalizedAnimation,\n} from '@tamagui/animation-helpers'\nimport { useIsomorphicLayoutEffect } from '@tamagui/constants'\nimport { ResetPresence, usePresence } from '@tamagui/use-presence'\nimport type { AnimationDriver, UniversalAnimatedNumber } from '@tamagui/web'\nimport { transformsToString } from '@tamagui/web'\nimport React, { useState } from 'react' // import { animate } from '@tamagui/cubic-bezier-animator'\n\n/**\n * Helper function to extract duration from CSS animation string\n * Examples: \"ease-in 200ms\" -> 200, \"cubic-bezier(0.215, 0.610, 0.355, 1.000) 400ms\" -> 400\n * \"ease-in 0.5s\" -> 500, \"slow 2s\" -> 2000\n */\nfunction extractDuration(animation: string): number {\n // Try to match milliseconds first\n const msMatch = animation.match(/(\\d+(?:\\.\\d+)?)\\s*ms/)\n if (msMatch) {\n return Number.parseInt(msMatch[1], 10)\n }\n\n // Try to match seconds and convert to milliseconds\n const sMatch = animation.match(/(\\d+(?:\\.\\d+)?)\\s*s/)\n if (sMatch) {\n return Math.round(Number.parseFloat(sMatch[1]) * 1000)\n }\n\n // Default to 300ms if no duration found\n return 300\n}\n\nexport function createAnimations<A extends Object>(animations: A): AnimationDriver<A> {\n const reactionListeners = new WeakMap<any, Set<Function>>()\n\n return {\n animations,\n usePresence,\n ResetPresence,\n supportsCSS: true,\n classNameAnimation: true,\n\n useAnimatedNumber(initial): UniversalAnimatedNumber<Function> {\n const [val, setVal] = React.useState(initial)\n const [onFinish, setOnFinish] = useState<Function | undefined>()\n\n useIsomorphicLayoutEffect(() => {\n if (onFinish) {\n onFinish?.()\n setOnFinish(undefined)\n }\n }, [onFinish])\n\n return {\n getInstance() {\n return setVal\n },\n getValue() {\n return val\n },\n setValue(next, config, onFinish) {\n setVal(next)\n setOnFinish(onFinish)\n // call reaction listeners with the new value\n const listeners = reactionListeners.get(setVal)\n if (listeners) {\n listeners.forEach((listener) => listener(next))\n }\n },\n stop() {},\n }\n },\n\n useAnimatedNumberReaction({ value }, onValue) {\n React.useEffect(() => {\n const instance = value.getInstance()\n let queue = reactionListeners.get(instance)\n if (!queue) {\n const next = new Set<Function>()\n reactionListeners.set(instance, next)\n queue = next!\n }\n queue.add(onValue)\n return () => {\n queue?.delete(onValue)\n }\n }, [])\n },\n\n useAnimatedNumberStyle(val, getStyle) {\n return getStyle(val.getValue())\n },\n\n useAnimations: ({ props, presence, style, componentState, stateRef }) => {\n const isEntering = !!componentState.unmounted\n const isExiting = presence?.[0] === false\n const sendExitComplete = presence?.[1]\n // Normalize the transition prop to a consistent format\n const normalized = normalizeTransition(props.transition)\n const defaultAnimation = normalized.default ? animations[normalized.default] : null\n const animatedProperties = getAnimatedProperties(normalized)\n\n // Determine which properties to animate\n // - animateOnly prop is an exclusive filter (only animate those properties)\n // - per-property configs WITHOUT a default = only animate those specific properties\n // - per-property configs WITH a default = per-property overrides + default for rest\n const hasDefault = normalized.default !== null\n const hasPerPropertyConfigs = animatedProperties.length > 0\n\n let keys: string[]\n if (props.animateOnly) {\n // animateOnly is explicit filter\n keys = props.animateOnly\n } else if (hasPerPropertyConfigs && !hasDefault) {\n // object format without default: { opacity: '200ms' } = only animate opacity\n keys = animatedProperties\n } else if (hasPerPropertyConfigs && hasDefault) {\n // array format or object with default: per-property overrides + 'all' for rest\n keys = [...animatedProperties, 'all']\n } else {\n // simple string format: 'quick' = animate all\n keys = ['all']\n }\n\n useIsomorphicLayoutEffect(() => {\n const host = stateRef.current.host\n if (!sendExitComplete || !isExiting || !host) return\n const node = host as HTMLElement\n\n /**\n * Exit animation handling for Dialog/Modal components\n *\n * The Challenge: When users close dialogs (via Escape key or clicking outside),\n * the element can disappear from the DOM before CSS transitions finish, which causes:\n * 1. Dialogs to stick around on screen\n * 2. Event handlers to stop working\n */\n\n // Use timeout as primary, transition events as backup for reliable exit handling\n const animationDuration = defaultAnimation\n ? extractDuration(defaultAnimation)\n : 200\n const delay = normalized.delay ?? 0\n const fallbackTimeout = animationDuration + delay\n\n const timeoutId = setTimeout(() => {\n sendExitComplete?.()\n }, fallbackTimeout)\n\n // Listen for transition completion events as backup\n const onFinishAnimation = () => {\n clearTimeout(timeoutId)\n sendExitComplete?.()\n }\n\n node.addEventListener('transitionend', onFinishAnimation)\n node.addEventListener('transitioncancel', onFinishAnimation)\n\n return () => {\n clearTimeout(timeoutId)\n node.removeEventListener('transitionend', onFinishAnimation)\n node.removeEventListener('transitioncancel', onFinishAnimation)\n }\n }, [sendExitComplete, isExiting])\n\n // Check if we have any animation to apply\n if (!hasNormalizedAnimation(normalized)) {\n return null\n }\n\n if (Array.isArray(style.transform)) {\n style.transform = transformsToString(style.transform)\n }\n\n // Build CSS transition string\n // TODO: we disabled the transform transition, because it will create issue for inverse function and animate function\n // for non layout transform properties either use animate function or find a workaround to do it with css\n const delayStr = normalized.delay ? ` ${normalized.delay}ms` : ''\n style.transition = keys\n .map((key) => {\n // Check for property-specific animation, fall back to default\n const propAnimation = normalized.properties[key]\n let animationValue: string | null = null\n\n if (typeof propAnimation === 'string') {\n animationValue = animations[propAnimation]\n } else if (\n propAnimation &&\n typeof propAnimation === 'object' &&\n propAnimation.type\n ) {\n animationValue = animations[propAnimation.type]\n } else if (defaultAnimation) {\n animationValue = defaultAnimation\n }\n\n return animationValue ? `${key} ${animationValue}${delayStr}` : null\n })\n .filter(Boolean)\n .join(', ')\n\n if (process.env.NODE_ENV === 'development' && props['debug'] === 'verbose') {\n console.info('CSS animation', {\n props,\n animations,\n normalized,\n defaultAnimation,\n style,\n isEntering,\n isExiting,\n })\n }\n\n return { style, className: isEntering ? 't_unmounted' : '' }\n },\n }\n}\n\n// layout animations\n// useIsomorphicLayoutEffect(() => {\n// if (!host || !props.layout) {\n// return\n// }\n// // @ts-ignore\n// const boundingBox = host?.getBoundingClientRect()\n// if (isChanged(initialPositionRef.current, boundingBox)) {\n// const transform = invert(\n// host,\n// boundingBox,\n// initialPositionRef.current\n// )\n\n// animate({\n// from: transform,\n// to: { x: 0, y: 0, scaleX: 1, scaleY: 1 },\n// duration: 1000,\n// onUpdate: ({ x, y, scaleX, scaleY }) => {\n// // @ts-ignore\n// host.style.transform = `translate(${x}px, ${y}px) scaleX(${scaleX}) scaleY(${scaleY})`\n// // TODO: handle childRef inverse scale\n// // childRef.current.style.transform = `scaleX(${1 / scaleX}) scaleY(${\n// // 1 / scaleY\n// // })`\n// },\n// // TODO: extract ease-in from string and convert/map it to a cubicBezier array\n// cubicBezier: [0, 1.38, 1, -0.41],\n// })\n// }\n// initialPositionRef.current = boundingBox\n// })\n\n// style.transition = `${keys} ${animation}${\n// props.layout ? ',width 0s, height 0s, margin 0s, padding 0s, transform' : ''\n// }`\n\n// const isChanged = (initialBox: any, finalBox: any) => {\n// // we just mounted, so we don't have complete data yet\n// if (!initialBox || !finalBox) return false\n\n// // deep compare the two boxes\n// return JSON.stringify(initialBox) !== JSON.stringify(finalBox)\n// }\n\n// const invert = (el, from, to) => {\n// const { x: fromX, y: fromY, width: fromWidth, height: fromHeight } = from\n// const { x, y, width, height } = to\n\n// const transform = {\n// x: x - fromX - (fromWidth - width) / 2,\n// y: y - fromY - (fromHeight - height) / 2,\n// scaleX: width / fromWidth,\n// scaleY: height / fromHeight,\n// }\n\n// el.style.transform = `\n"
|
|
9
9
|
],
|
|
10
10
|
"version": 3
|
|
11
11
|
}
|