@tamagui/animation-helpers 2.0.0-rc.8 → 2.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.
- package/dist/cjs/index.cjs +13 -10
- package/dist/cjs/index.native.js +13 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/normalizeTransition.cjs +102 -41
- package/dist/cjs/normalizeTransition.native.js +141 -55
- package/dist/cjs/normalizeTransition.native.js.map +1 -1
- package/dist/cjs/types.cjs +7 -5
- package/dist/cjs/types.native.js +7 -5
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/esm/index.js +2 -14
- package/dist/esm/index.js.map +1 -6
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +2 -2
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/normalizeTransition.mjs +90 -32
- package/dist/esm/normalizeTransition.mjs.map +1 -1
- package/dist/esm/normalizeTransition.native.js +129 -46
- package/dist/esm/normalizeTransition.native.js.map +1 -1
- package/package.json +5 -8
- package/src/index.ts +1 -0
- package/src/normalizeTransition.ts +43 -0
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +4 -4
- package/types/normalizeTransition.d.ts +11 -0
- package/types/normalizeTransition.d.ts.map +4 -4
- package/types/types.d.ts.map +2 -2
- package/dist/cjs/index.js +0 -25
- package/dist/cjs/index.js.map +0 -6
- package/dist/cjs/normalizeTransition.js +0 -106
- package/dist/cjs/normalizeTransition.js.map +0 -6
- package/dist/cjs/types.js +0 -14
- package/dist/cjs/types.js.map +0 -6
- package/dist/esm/normalizeTransition.js +0 -90
- package/dist/esm/normalizeTransition.js.map +0 -6
- package/dist/esm/types.js +0 -1
- package/dist/esm/types.js.map +0 -6
package/dist/esm/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { normalizeTransition, getAnimationForProperty, hasAnimation, getAnimatedProperties, getEffectiveAnimation } from "./normalizeTransition.mjs";
|
|
2
|
-
export { getAnimatedProperties, getAnimationForProperty, getEffectiveAnimation, hasAnimation, normalizeTransition };
|
|
1
|
+
import { normalizeTransition, getAnimationForProperty, hasAnimation, getAnimatedProperties, getEffectiveAnimation, getAnimationConfigsForKeys } from "./normalizeTransition.mjs";
|
|
2
|
+
export { getAnimatedProperties, getAnimationConfigsForKeys, getAnimationForProperty, getEffectiveAnimation, hasAnimation, normalizeTransition };
|
|
3
3
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["normalizeTransition","getAnimationForProperty","hasAnimation","getAnimatedProperties","getEffectiveAnimation"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SACEA,mBAAA,EACAC,uBAAA,EACAC,YAAA,EACAC,qBAAA,EACAC,qBAAA,QACK","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["normalizeTransition","getAnimationForProperty","hasAnimation","getAnimatedProperties","getEffectiveAnimation","getAnimationConfigsForKeys"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SACEA,mBAAA,EACAC,uBAAA,EACAC,YAAA,EACAC,qBAAA,EACAC,qBAAA,EACAC,0BAAA,QACK","ignoreList":[]}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { normalizeTransition, getAnimationForProperty, hasAnimation, getAnimatedProperties, getEffectiveAnimation } from "./normalizeTransition.native.js";
|
|
2
|
-
export { getAnimatedProperties, getAnimationForProperty, getEffectiveAnimation, hasAnimation, normalizeTransition };
|
|
1
|
+
import { normalizeTransition, getAnimationForProperty, hasAnimation, getAnimatedProperties, getEffectiveAnimation, getAnimationConfigsForKeys } from "./normalizeTransition.native.js";
|
|
2
|
+
export { getAnimatedProperties, getAnimationConfigsForKeys, getAnimationForProperty, getEffectiveAnimation, hasAnimation, normalizeTransition };
|
|
3
3
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["normalizeTransition","getAnimationForProperty","hasAnimation","getAnimatedProperties","getEffectiveAnimation"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAAAA,mBAAA,EAAAC,uBAAA,EAAAC,YAAA,EAAAC,qBAAA,EAAAC,qBAAA;AAAA,
|
|
1
|
+
{"version":3,"names":["normalizeTransition","getAnimationForProperty","hasAnimation","getAnimatedProperties","getEffectiveAnimation","getAnimationConfigsForKeys"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAAAA,mBAAA,EAAAC,uBAAA,EAAAC,YAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAAC,0BAAA;AAAA,SAEEF,qBAAA,EACAE,0BAAA,EACAJ,uBAAA,EACAG,qBAAA,EACAF,YAAA,EAAAF,mBACK","ignoreList":[]}
|
|
@@ -3,28 +3,46 @@ function isSpringConfigKey(key) {
|
|
|
3
3
|
return SPRING_CONFIG_KEYS.has(key);
|
|
4
4
|
}
|
|
5
5
|
function normalizeTransition(transition) {
|
|
6
|
-
if (!transition)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
if (!transition) {
|
|
7
|
+
return {
|
|
8
|
+
default: null,
|
|
9
|
+
enter: null,
|
|
10
|
+
exit: null,
|
|
11
|
+
delay: void 0,
|
|
12
|
+
properties: {}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
if (typeof transition === "string") {
|
|
16
|
+
return {
|
|
17
|
+
default: transition,
|
|
18
|
+
enter: null,
|
|
19
|
+
exit: null,
|
|
20
|
+
delay: void 0,
|
|
21
|
+
properties: {}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
20
24
|
if (Array.isArray(transition)) {
|
|
21
|
-
const [defaultAnimation, configObj] = transition
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
let delay
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (configObj && typeof configObj
|
|
25
|
+
const [defaultAnimation, configObj] = transition;
|
|
26
|
+
const properties = {};
|
|
27
|
+
const springConfig = {};
|
|
28
|
+
let delay;
|
|
29
|
+
let enter = null;
|
|
30
|
+
let exit = null;
|
|
31
|
+
if (configObj && typeof configObj === "object") {
|
|
32
|
+
for (const [key, value] of Object.entries(configObj)) {
|
|
33
|
+
if (key === "delay" && typeof value === "number") {
|
|
34
|
+
delay = value;
|
|
35
|
+
} else if (key === "enter" && typeof value === "string") {
|
|
36
|
+
enter = value;
|
|
37
|
+
} else if (key === "exit" && typeof value === "string") {
|
|
38
|
+
exit = value;
|
|
39
|
+
} else if (isSpringConfigKey(key) && value !== void 0) {
|
|
40
|
+
springConfig[key] = value;
|
|
41
|
+
} else if (value !== void 0) {
|
|
42
|
+
properties[key] = value;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
28
46
|
return {
|
|
29
47
|
default: defaultAnimation,
|
|
30
48
|
enter,
|
|
@@ -34,14 +52,28 @@ function normalizeTransition(transition) {
|
|
|
34
52
|
config: Object.keys(springConfig).length > 0 ? springConfig : void 0
|
|
35
53
|
};
|
|
36
54
|
}
|
|
37
|
-
if (typeof transition
|
|
38
|
-
const properties = {}
|
|
39
|
-
|
|
40
|
-
let defaultAnimation = null
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
for (const [key, value] of Object.entries(transition))
|
|
55
|
+
if (typeof transition === "object") {
|
|
56
|
+
const properties = {};
|
|
57
|
+
const springConfig = {};
|
|
58
|
+
let defaultAnimation = null;
|
|
59
|
+
let enter = null;
|
|
60
|
+
let exit = null;
|
|
61
|
+
let delay;
|
|
62
|
+
for (const [key, value] of Object.entries(transition)) {
|
|
63
|
+
if (key === "default" && typeof value === "string") {
|
|
64
|
+
defaultAnimation = value;
|
|
65
|
+
} else if (key === "enter" && typeof value === "string") {
|
|
66
|
+
enter = value;
|
|
67
|
+
} else if (key === "exit" && typeof value === "string") {
|
|
68
|
+
exit = value;
|
|
69
|
+
} else if (key === "delay" && typeof value === "number") {
|
|
70
|
+
delay = value;
|
|
71
|
+
} else if (isSpringConfigKey(key) && value !== void 0) {
|
|
72
|
+
springConfig[key] = value;
|
|
73
|
+
} else if (value !== void 0) {
|
|
74
|
+
properties[key] = value;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
45
77
|
return {
|
|
46
78
|
default: defaultAnimation,
|
|
47
79
|
enter,
|
|
@@ -61,7 +93,10 @@ function normalizeTransition(transition) {
|
|
|
61
93
|
}
|
|
62
94
|
function getAnimationForProperty(normalized, property) {
|
|
63
95
|
const propertyAnimation = normalized.properties[property];
|
|
64
|
-
|
|
96
|
+
if (propertyAnimation !== void 0) {
|
|
97
|
+
return propertyAnimation;
|
|
98
|
+
}
|
|
99
|
+
return normalized.default;
|
|
65
100
|
}
|
|
66
101
|
function hasAnimation(normalized) {
|
|
67
102
|
return normalized.default !== null || normalized.enter !== null || normalized.exit !== null || Object.keys(normalized.properties).length > 0;
|
|
@@ -70,7 +105,30 @@ function getAnimatedProperties(normalized) {
|
|
|
70
105
|
return Object.keys(normalized.properties);
|
|
71
106
|
}
|
|
72
107
|
function getEffectiveAnimation(normalized, state) {
|
|
73
|
-
|
|
108
|
+
if (state === "enter" && normalized.enter) {
|
|
109
|
+
return normalized.enter;
|
|
110
|
+
}
|
|
111
|
+
if (state === "exit" && normalized.exit) {
|
|
112
|
+
return normalized.exit;
|
|
113
|
+
}
|
|
114
|
+
return normalized.default;
|
|
115
|
+
}
|
|
116
|
+
function getAnimationConfigsForKeys(normalized, animations, keys, defaultAnimation) {
|
|
117
|
+
const result = /* @__PURE__ */new Map();
|
|
118
|
+
for (const key of keys) {
|
|
119
|
+
const propAnimation = normalized.properties[key];
|
|
120
|
+
let animationValue = null;
|
|
121
|
+
if (typeof propAnimation === "string") {
|
|
122
|
+
animationValue = animations[propAnimation] ?? null;
|
|
123
|
+
} else if (propAnimation && typeof propAnimation === "object" && propAnimation.type) {
|
|
124
|
+
animationValue = animations[propAnimation.type] ?? null;
|
|
125
|
+
}
|
|
126
|
+
if (animationValue === null) {
|
|
127
|
+
animationValue = defaultAnimation;
|
|
128
|
+
}
|
|
129
|
+
result.set(key, animationValue);
|
|
130
|
+
}
|
|
131
|
+
return result;
|
|
74
132
|
}
|
|
75
|
-
export { getAnimatedProperties, getAnimationForProperty, getEffectiveAnimation, hasAnimation, normalizeTransition };
|
|
133
|
+
export { getAnimatedProperties, getAnimationConfigsForKeys, getAnimationForProperty, getEffectiveAnimation, hasAnimation, normalizeTransition };
|
|
76
134
|
//# sourceMappingURL=normalizeTransition.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SPRING_CONFIG_KEYS","Set","isSpringConfigKey","key","has","normalizeTransition","transition","default","enter","exit","delay","properties","Array","isArray","defaultAnimation","configObj","springConfig","value","Object","entries","config","keys","length","getAnimationForProperty","normalized","property","propertyAnimation","hasAnimation","getAnimatedProperties","getEffectiveAnimation","state"],"sources":["../../src/normalizeTransition.ts"],"sourcesContent":[null],"mappings":"AAOA,MAAMA,kBAAA,GAAkC,mBAAIC,GAAA,CAAI,CAC9C,aACA,WACA,QACA,WACA,YACA,YACA,qBACA,YACA,cACA,QACD;AAKD,SAASC,kBAAkBC,GAAA,EAAwC;EACjE,OAAOH,kBAAA,CAAmBI,GAAA,CAAID,GAAG;AACnC;AAcO,SAASE,oBACdC,UAAA,EACsB;EAEtB,IAAI,CAACA,UAAA,
|
|
1
|
+
{"version":3,"names":["SPRING_CONFIG_KEYS","Set","isSpringConfigKey","key","has","normalizeTransition","transition","default","enter","exit","delay","properties","Array","isArray","defaultAnimation","configObj","springConfig","value","Object","entries","config","keys","length","getAnimationForProperty","normalized","property","propertyAnimation","hasAnimation","getAnimatedProperties","getEffectiveAnimation","state","getAnimationConfigsForKeys","animations","result","Map","propAnimation","animationValue","type","set"],"sources":["../../src/normalizeTransition.ts"],"sourcesContent":[null],"mappings":"AAOA,MAAMA,kBAAA,GAAkC,mBAAIC,GAAA,CAAI,CAC9C,aACA,WACA,QACA,WACA,YACA,YACA,qBACA,YACA,cACA,QACD;AAKD,SAASC,kBAAkBC,GAAA,EAAwC;EACjE,OAAOH,kBAAA,CAAmBI,GAAA,CAAID,GAAG;AACnC;AAcO,SAASE,oBACdC,UAAA,EACsB;EAEtB,IAAI,CAACA,UAAA,EAAY;IACf,OAAO;MACLC,OAAA,EAAS;MACTC,KAAA,EAAO;MACPC,IAAA,EAAM;MACNC,KAAA,EAAO;MACPC,UAAA,EAAY,CAAC;IACf;EACF;EAGA,IAAI,OAAOL,UAAA,KAAe,UAAU;IAClC,OAAO;MACLC,OAAA,EAASD,UAAA;MACTE,KAAA,EAAO;MACPC,IAAA,EAAM;MACNC,KAAA,EAAO;MACPC,UAAA,EAAY,CAAC;IACf;EACF;EAIA,IAAIC,KAAA,CAAMC,OAAA,CAAQP,UAAU,GAAG;IAC7B,MAAM,CAACQ,gBAAA,EAAkBC,SAAS,IAAIT,UAAA;IACtC,MAAMK,UAAA,GAAuD,CAAC;IAC9D,MAAMK,YAAA,GAA6B,CAAC;IACpC,IAAIN,KAAA;IACJ,IAAIF,KAAA,GAAuB;IAC3B,IAAIC,IAAA,GAAsB;IAE1B,IAAIM,SAAA,IAAa,OAAOA,SAAA,KAAc,UAAU;MAC9C,WAAW,CAACZ,GAAA,EAAKc,KAAK,KAAKC,MAAA,CAAOC,OAAA,CAAQJ,SAAS,GAAG;QACpD,IAAIZ,GAAA,KAAQ,WAAW,OAAOc,KAAA,KAAU,UAAU;UAChDP,KAAA,GAAQO,KAAA;QACV,WAAWd,GAAA,KAAQ,WAAW,OAAOc,KAAA,KAAU,UAAU;UACvDT,KAAA,GAAQS,KAAA;QACV,WAAWd,GAAA,KAAQ,UAAU,OAAOc,KAAA,KAAU,UAAU;UACtDR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,EAAM;IACtB,MAAMc,aAAA,GAAgBX,UAAA,CAAWb,UAAA,CAAWR,GAAG;IAC/C,IAAIiC,cAAA,GAA2B;IAE/B,IAAI,OAAOD,aAAA,KAAkB,UAAU;MACrCC,cAAA,GAAiBJ,UAAA,CAAWG,aAAa,KAAK;IAChD,WACEA,aAAA,IACA,OAAOA,aAAA,KAAkB,YACxBA,aAAA,CAAsBE,IAAA,EACvB;MACAD,cAAA,GAAiBJ,UAAA,CAAYG,aAAA,CAAsBE,IAAI,KAAK;IAC9D;IAGA,IAAID,cAAA,KAAmB,MAAM;MAC3BA,cAAA,GAAiBtB,gBAAA;IACnB;IAEAmB,MAAA,CAAOK,GAAA,CAAInC,GAAA,EAAKiC,cAAc;EAChC;EAEA,OAAOH,MAAA;AACT","ignoreList":[]}
|
|
@@ -1,50 +1,69 @@
|
|
|
1
1
|
function _type_of(obj) {
|
|
2
2
|
"@swc/helpers - typeof";
|
|
3
3
|
|
|
4
|
-
return obj && typeof Symbol
|
|
4
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
5
5
|
}
|
|
6
6
|
var SPRING_CONFIG_KEYS = /* @__PURE__ */new Set(["stiffness", "damping", "mass", "tension", "friction", "velocity", "overshootClamping", "duration", "bounciness", "speed"]);
|
|
7
7
|
function isSpringConfigKey(key) {
|
|
8
8
|
return SPRING_CONFIG_KEYS.has(key);
|
|
9
9
|
}
|
|
10
10
|
function normalizeTransition(transition) {
|
|
11
|
-
if (!transition)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
if (!transition) {
|
|
12
|
+
return {
|
|
13
|
+
default: null,
|
|
14
|
+
enter: null,
|
|
15
|
+
exit: null,
|
|
16
|
+
delay: void 0,
|
|
17
|
+
properties: {}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
if (typeof transition === "string") {
|
|
21
|
+
return {
|
|
22
|
+
default: transition,
|
|
23
|
+
enter: null,
|
|
24
|
+
exit: null,
|
|
25
|
+
delay: void 0,
|
|
26
|
+
properties: {}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
25
29
|
if (Array.isArray(transition)) {
|
|
26
|
-
var [defaultAnimation, configObj] = transition
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (configObj && (typeof configObj
|
|
33
|
-
var _iteratorNormalCompletion =
|
|
34
|
-
_didIteratorError =
|
|
30
|
+
var [defaultAnimation, configObj] = transition;
|
|
31
|
+
var properties = {};
|
|
32
|
+
var springConfig = {};
|
|
33
|
+
var delay;
|
|
34
|
+
var enter = null;
|
|
35
|
+
var exit = null;
|
|
36
|
+
if (configObj && (typeof configObj === "undefined" ? "undefined" : _type_of(configObj)) === "object") {
|
|
37
|
+
var _iteratorNormalCompletion = true,
|
|
38
|
+
_didIteratorError = false,
|
|
35
39
|
_iteratorError = void 0;
|
|
36
40
|
try {
|
|
37
|
-
for (var _iterator = Object.entries(configObj)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion =
|
|
41
|
+
for (var _iterator = Object.entries(configObj)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
38
42
|
var [key, value] = _step.value;
|
|
39
|
-
key === "delay" && typeof value
|
|
43
|
+
if (key === "delay" && typeof value === "number") {
|
|
44
|
+
delay = value;
|
|
45
|
+
} else if (key === "enter" && typeof value === "string") {
|
|
46
|
+
enter = value;
|
|
47
|
+
} else if (key === "exit" && typeof value === "string") {
|
|
48
|
+
exit = value;
|
|
49
|
+
} else if (isSpringConfigKey(key) && value !== void 0) {
|
|
50
|
+
springConfig[key] = value;
|
|
51
|
+
} else if (value !== void 0) {
|
|
52
|
+
properties[key] = value;
|
|
53
|
+
}
|
|
40
54
|
}
|
|
41
55
|
} catch (err) {
|
|
42
|
-
_didIteratorError =
|
|
56
|
+
_didIteratorError = true;
|
|
57
|
+
_iteratorError = err;
|
|
43
58
|
} finally {
|
|
44
59
|
try {
|
|
45
|
-
!_iteratorNormalCompletion && _iterator.return != null
|
|
60
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
61
|
+
_iterator.return();
|
|
62
|
+
}
|
|
46
63
|
} finally {
|
|
47
|
-
if (_didIteratorError)
|
|
64
|
+
if (_didIteratorError) {
|
|
65
|
+
throw _iteratorError;
|
|
66
|
+
}
|
|
48
67
|
}
|
|
49
68
|
}
|
|
50
69
|
}
|
|
@@ -57,28 +76,45 @@ function normalizeTransition(transition) {
|
|
|
57
76
|
config: Object.keys(springConfig).length > 0 ? springConfig : void 0
|
|
58
77
|
};
|
|
59
78
|
}
|
|
60
|
-
if ((typeof transition
|
|
61
|
-
var properties1 = {}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
_didIteratorError1 =
|
|
79
|
+
if ((typeof transition === "undefined" ? "undefined" : _type_of(transition)) === "object") {
|
|
80
|
+
var properties1 = {};
|
|
81
|
+
var springConfig1 = {};
|
|
82
|
+
var defaultAnimation1 = null;
|
|
83
|
+
var enter1 = null;
|
|
84
|
+
var exit1 = null;
|
|
85
|
+
var delay1;
|
|
86
|
+
var _iteratorNormalCompletion1 = true,
|
|
87
|
+
_didIteratorError1 = false,
|
|
69
88
|
_iteratorError1 = void 0;
|
|
70
89
|
try {
|
|
71
|
-
for (var _iterator1 = Object.entries(transition)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 =
|
|
90
|
+
for (var _iterator1 = Object.entries(transition)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
|
|
72
91
|
var [key1, value1] = _step1.value;
|
|
73
|
-
key1 === "default" && typeof value1
|
|
92
|
+
if (key1 === "default" && typeof value1 === "string") {
|
|
93
|
+
defaultAnimation1 = value1;
|
|
94
|
+
} else if (key1 === "enter" && typeof value1 === "string") {
|
|
95
|
+
enter1 = value1;
|
|
96
|
+
} else if (key1 === "exit" && typeof value1 === "string") {
|
|
97
|
+
exit1 = value1;
|
|
98
|
+
} else if (key1 === "delay" && typeof value1 === "number") {
|
|
99
|
+
delay1 = value1;
|
|
100
|
+
} else if (isSpringConfigKey(key1) && value1 !== void 0) {
|
|
101
|
+
springConfig1[key1] = value1;
|
|
102
|
+
} else if (value1 !== void 0) {
|
|
103
|
+
properties1[key1] = value1;
|
|
104
|
+
}
|
|
74
105
|
}
|
|
75
106
|
} catch (err) {
|
|
76
|
-
_didIteratorError1 =
|
|
107
|
+
_didIteratorError1 = true;
|
|
108
|
+
_iteratorError1 = err;
|
|
77
109
|
} finally {
|
|
78
110
|
try {
|
|
79
|
-
!_iteratorNormalCompletion1 && _iterator1.return != null
|
|
111
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
112
|
+
_iterator1.return();
|
|
113
|
+
}
|
|
80
114
|
} finally {
|
|
81
|
-
if (_didIteratorError1)
|
|
115
|
+
if (_didIteratorError1) {
|
|
116
|
+
throw _iteratorError1;
|
|
117
|
+
}
|
|
82
118
|
}
|
|
83
119
|
}
|
|
84
120
|
return {
|
|
@@ -100,7 +136,10 @@ function normalizeTransition(transition) {
|
|
|
100
136
|
}
|
|
101
137
|
function getAnimationForProperty(normalized, property) {
|
|
102
138
|
var propertyAnimation = normalized.properties[property];
|
|
103
|
-
|
|
139
|
+
if (propertyAnimation !== void 0) {
|
|
140
|
+
return propertyAnimation;
|
|
141
|
+
}
|
|
142
|
+
return normalized.default;
|
|
104
143
|
}
|
|
105
144
|
function hasAnimation(normalized) {
|
|
106
145
|
return normalized.default !== null || normalized.enter !== null || normalized.exit !== null || Object.keys(normalized.properties).length > 0;
|
|
@@ -109,7 +148,51 @@ function getAnimatedProperties(normalized) {
|
|
|
109
148
|
return Object.keys(normalized.properties);
|
|
110
149
|
}
|
|
111
150
|
function getEffectiveAnimation(normalized, state) {
|
|
112
|
-
|
|
151
|
+
if (state === "enter" && normalized.enter) {
|
|
152
|
+
return normalized.enter;
|
|
153
|
+
}
|
|
154
|
+
if (state === "exit" && normalized.exit) {
|
|
155
|
+
return normalized.exit;
|
|
156
|
+
}
|
|
157
|
+
return normalized.default;
|
|
158
|
+
}
|
|
159
|
+
function getAnimationConfigsForKeys(normalized, animations, keys, defaultAnimation) {
|
|
160
|
+
var result = /* @__PURE__ */new Map();
|
|
161
|
+
var _iteratorNormalCompletion = true,
|
|
162
|
+
_didIteratorError = false,
|
|
163
|
+
_iteratorError = void 0;
|
|
164
|
+
try {
|
|
165
|
+
for (var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
166
|
+
var key = _step.value;
|
|
167
|
+
var propAnimation = normalized.properties[key];
|
|
168
|
+
var animationValue = null;
|
|
169
|
+
if (typeof propAnimation === "string") {
|
|
170
|
+
var _animations_propAnimation;
|
|
171
|
+
animationValue = (_animations_propAnimation = animations[propAnimation]) !== null && _animations_propAnimation !== void 0 ? _animations_propAnimation : null;
|
|
172
|
+
} else if (propAnimation && (typeof propAnimation === "undefined" ? "undefined" : _type_of(propAnimation)) === "object" && propAnimation.type) {
|
|
173
|
+
var _animations_propAnimation_type;
|
|
174
|
+
animationValue = (_animations_propAnimation_type = animations[propAnimation.type]) !== null && _animations_propAnimation_type !== void 0 ? _animations_propAnimation_type : null;
|
|
175
|
+
}
|
|
176
|
+
if (animationValue === null) {
|
|
177
|
+
animationValue = defaultAnimation;
|
|
178
|
+
}
|
|
179
|
+
result.set(key, animationValue);
|
|
180
|
+
}
|
|
181
|
+
} catch (err) {
|
|
182
|
+
_didIteratorError = true;
|
|
183
|
+
_iteratorError = err;
|
|
184
|
+
} finally {
|
|
185
|
+
try {
|
|
186
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
187
|
+
_iterator.return();
|
|
188
|
+
}
|
|
189
|
+
} finally {
|
|
190
|
+
if (_didIteratorError) {
|
|
191
|
+
throw _iteratorError;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return result;
|
|
113
196
|
}
|
|
114
|
-
export { getAnimatedProperties, getAnimationForProperty, getEffectiveAnimation, hasAnimation, normalizeTransition };
|
|
197
|
+
export { getAnimatedProperties, getAnimationConfigsForKeys, getAnimationForProperty, getEffectiveAnimation, hasAnimation, normalizeTransition };
|
|
115
198
|
//# sourceMappingURL=normalizeTransition.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_type_of","obj","Symbol","constructor","SPRING_CONFIG_KEYS","Set","isSpringConfigKey","key","has","normalizeTransition","transition","default","enter","exit","delay","properties","Array","isArray","defaultAnimation","configObj","springConfig","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Object","entries","iterator","_step","next","done","value","err","return","config","keys","length","properties1","springConfig1","defaultAnimation1","enter1","exit1","delay1","_iteratorNormalCompletion1","_didIteratorError1","_iteratorError1","_iterator1","_step1","key1","value1"],"sources":["../../src/normalizeTransition.ts"],"sourcesContent":[null],"mappings":"AAOA,SAAMA,SAAAC,GAAA;EACJ;;EACA,OAAAA,GAAA,WAAAC,MAAA,
|
|
1
|
+
{"version":3,"names":["_type_of","obj","Symbol","constructor","SPRING_CONFIG_KEYS","Set","isSpringConfigKey","key","has","normalizeTransition","transition","default","enter","exit","delay","properties","Array","isArray","defaultAnimation","configObj","springConfig","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Object","entries","iterator","_step","next","done","value","err","return","config","keys","length","properties1","springConfig1","defaultAnimation1","enter1","exit1","delay1","_iteratorNormalCompletion1","_didIteratorError1","_iteratorError1","_iterator1","_step1","key1","value1","getAnimationForProperty","normalized","property"],"sources":["../../src/normalizeTransition.ts"],"sourcesContent":[null],"mappings":"AAOA,SAAMA,SAAAC,GAAA;EACJ;;EACA,OAAAA,GAAA,WAAAC,MAAA,oBAAAD,GAAA,CAAAE,WAAA,KAAAD,MAAA,qBAAAD,GAAA;AAAA;AACA,IACAG,kBAAA,sBAAAC,GAAA,EACA,aACA,WACA,QACA,WACA,YACA,YACD,qBAKD,UAAS,EACP,YAAO,EACT,QAcO;AAIL,SAAKC,iBAAYA,CAAAC,GAAA;EACf,OAAAH,kBAAO,CAAAI,GAAA,CAAAD,GAAA;AAAA;AACI,SACTE,mBAAOA,CAAAC,UAAA;EAAA,IACP,CAAAA,UAAM;IAAA,OACN;MACAC,OAAA,MAAa;MACfC,KAAA;MACFC,IAAA;MAGIC,KAAA,EAAO;MACTC,UAAO;IAAA;EACI;EACF,IACP,OAAML,UAAA;IAAA,OACN;MACAC,OAAA,EAAAD,UAAa;MACfE,KAAA;MACFC,IAAA;MAIIC,KAAA,EAAM;MACRC,UAAO;IACP;EACA;EACA,IAAAC,KAAI,CAAAC,OAAA,CAAAP,UAAA;IACJ,IAAI,CAAAQ,gBAAuB,EAAAC,SAAA,IAAAT,UAAA;IAC3B,IAAIK,UAAsB;IAE1B,IAAIK,YAAA,GAAa;IACf,IAAAN,KAAA;IACE,IAAAF,KAAI,OAAQ;IACV,IAAAC,IAAA,OAAQ;IAAA,IACVM,SAAA,IAAW,QAAQA,SAAW,gBAAO,GAAU,WAAU,GAAAnB,QAAA,CAAAmB,SAAA;MACvD,IAAAE,yBAAQ;QAAAC,iBAAA;QAAAC,cAAA;MAAA,IACV;QACE,SAAOC,SAAA,GAAAC,MAAA,CAAAC,OAAA,CAAAP,SAAA,EAAAjB,MAAA,CAAAyB,QAAA,KAAAC,KAAA,IAAAP,yBAAA,IAAAO,KAAA,GAAAJ,SAAA,CAAAK,IAAA,IAAAC,IAAA,GAAAT,yBAAA;UACT,KAAAd,GAAA,EA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
"version": "2.0.0",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -18,15 +18,12 @@
|
|
|
18
18
|
"./package.json": "./package.json",
|
|
19
19
|
".": {
|
|
20
20
|
"types": "./types/index.d.ts",
|
|
21
|
-
"react-native":
|
|
22
|
-
|
|
23
|
-
"import": "./dist/esm/index.native.js",
|
|
24
|
-
"require": "./dist/cjs/index.native.js"
|
|
25
|
-
},
|
|
21
|
+
"react-native": "./dist/esm/index.native.js",
|
|
22
|
+
"browser": "./dist/esm/index.mjs",
|
|
26
23
|
"module": "./dist/esm/index.mjs",
|
|
27
24
|
"import": "./dist/esm/index.mjs",
|
|
28
25
|
"require": "./dist/cjs/index.cjs",
|
|
29
|
-
"default": "./dist/
|
|
26
|
+
"default": "./dist/esm/index.mjs"
|
|
30
27
|
}
|
|
31
28
|
},
|
|
32
29
|
"publishConfig": {
|
|
@@ -39,6 +36,6 @@
|
|
|
39
36
|
"clean:build": "tamagui-build clean:build"
|
|
40
37
|
},
|
|
41
38
|
"devDependencies": {
|
|
42
|
-
"@tamagui/build": "2.0.0
|
|
39
|
+
"@tamagui/build": "2.0.0"
|
|
43
40
|
}
|
|
44
41
|
}
|
package/src/index.ts
CHANGED
|
@@ -210,3 +210,46 @@ export function getEffectiveAnimation(
|
|
|
210
210
|
}
|
|
211
211
|
return normalized.default
|
|
212
212
|
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Gets the resolved animation config for each key, looking up in animations config.
|
|
216
|
+
* Useful for calculating max duration across all animated properties.
|
|
217
|
+
*
|
|
218
|
+
* @param normalized - The normalized transition object
|
|
219
|
+
* @param animations - The animations config object (driver-specific format)
|
|
220
|
+
* @param keys - Property keys to get animations for
|
|
221
|
+
* @param defaultAnimation - The default animation value to fall back to
|
|
222
|
+
* @returns Map of key -> resolved animation config (or null if not found)
|
|
223
|
+
*/
|
|
224
|
+
export function getAnimationConfigsForKeys<T>(
|
|
225
|
+
normalized: NormalizedTransition,
|
|
226
|
+
animations: Record<string, T>,
|
|
227
|
+
keys: string[],
|
|
228
|
+
defaultAnimation: T | null
|
|
229
|
+
): Map<string, T | null> {
|
|
230
|
+
const result = new Map<string, T | null>()
|
|
231
|
+
|
|
232
|
+
for (const key of keys) {
|
|
233
|
+
const propAnimation = normalized.properties[key]
|
|
234
|
+
let animationValue: T | null = null
|
|
235
|
+
|
|
236
|
+
if (typeof propAnimation === 'string') {
|
|
237
|
+
animationValue = animations[propAnimation] ?? null
|
|
238
|
+
} else if (
|
|
239
|
+
propAnimation &&
|
|
240
|
+
typeof propAnimation === 'object' &&
|
|
241
|
+
(propAnimation as any).type
|
|
242
|
+
) {
|
|
243
|
+
animationValue = animations[(propAnimation as any).type] ?? null
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// fall back to default if no per-property config found
|
|
247
|
+
if (animationValue === null) {
|
|
248
|
+
animationValue = defaultAnimation
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
result.set(key, animationValue)
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return result
|
|
255
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { normalizeTransition, getAnimationForProperty, hasAnimation, getAnimatedProperties, getEffectiveAnimation } from "./normalizeTransition";
|
|
1
|
+
export { normalizeTransition, getAnimationForProperty, hasAnimation, getAnimatedProperties, getEffectiveAnimation, getAnimationConfigsForKeys } from "./normalizeTransition";
|
|
2
2
|
export type { AnimationConfig, NormalizedTransition, TransitionPropInput } from "./types";
|
|
3
3
|
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "AAAA,SACE,qBACA,yBACA,cACA,uBACA,
|
|
2
|
+
"mappings": "AAAA,SACE,qBACA,yBACA,cACA,uBACA,uBACA,kCACK;AAEP,cAAc,iBAAiB,sBAAsB,2BAA2B",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/index.ts"
|
|
6
6
|
],
|
|
7
|
+
"version": 3,
|
|
7
8
|
"sourcesContent": [
|
|
8
|
-
"export {\n normalizeTransition,\n getAnimationForProperty,\n hasAnimation,\n getAnimatedProperties,\n getEffectiveAnimation,\n} from './normalizeTransition'\n\nexport type { AnimationConfig, NormalizedTransition, TransitionPropInput } from './types'\n"
|
|
9
|
-
]
|
|
10
|
-
"version": 3
|
|
9
|
+
"export {\n normalizeTransition,\n getAnimationForProperty,\n hasAnimation,\n getAnimatedProperties,\n getEffectiveAnimation,\n getAnimationConfigsForKeys,\n} from './normalizeTransition'\n\nexport type { AnimationConfig, NormalizedTransition, TransitionPropInput } from './types'\n"
|
|
10
|
+
]
|
|
11
11
|
}
|
|
@@ -39,5 +39,16 @@ export declare function getAnimatedProperties(normalized: NormalizedTransition):
|
|
|
39
39
|
* @returns The effective animation key or null
|
|
40
40
|
*/
|
|
41
41
|
export declare function getEffectiveAnimation(normalized: NormalizedTransition, state: "enter" | "exit" | "default"): string | null;
|
|
42
|
+
/**
|
|
43
|
+
* Gets the resolved animation config for each key, looking up in animations config.
|
|
44
|
+
* Useful for calculating max duration across all animated properties.
|
|
45
|
+
*
|
|
46
|
+
* @param normalized - The normalized transition object
|
|
47
|
+
* @param animations - The animations config object (driver-specific format)
|
|
48
|
+
* @param keys - Property keys to get animations for
|
|
49
|
+
* @param defaultAnimation - The default animation value to fall back to
|
|
50
|
+
* @returns Map of key -> resolved animation config (or null if not found)
|
|
51
|
+
*/
|
|
52
|
+
export declare function getAnimationConfigsForKeys<T>(normalized: NormalizedTransition, animations: Record<string, T>, keys: string[], defaultAnimation: T | null): Map<string, T | null>;
|
|
42
53
|
|
|
43
54
|
//# sourceMappingURL=normalizeTransition.d.ts.map
|