@tamagui/animation-helpers 2.0.0-rc.4 → 2.0.0-rc.40
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 +109 -40
- package/dist/cjs/normalizeTransition.native.js +149 -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 +97 -31
- package/dist/esm/normalizeTransition.mjs.map +1 -1
- package/dist/esm/normalizeTransition.native.js +137 -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 +84 -4
- package/src/types.ts +19 -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 +18 -0
- package/types/types.d.ts.map +4 -4
- package/dist/cjs/index.js +0 -25
- package/dist/cjs/index.js.map +0 -6
- package/dist/cjs/normalizeTransition.js +0 -89
- 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 -73
- 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/cjs/index.cjs
CHANGED
|
@@ -3,24 +3,27 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var index_exports = {};
|
|
22
24
|
__export(index_exports, {
|
|
23
25
|
getAnimatedProperties: () => import_normalizeTransition.getAnimatedProperties,
|
|
26
|
+
getAnimationConfigsForKeys: () => import_normalizeTransition.getAnimationConfigsForKeys,
|
|
24
27
|
getAnimationForProperty: () => import_normalizeTransition.getAnimationForProperty,
|
|
25
28
|
getEffectiveAnimation: () => import_normalizeTransition.getEffectiveAnimation,
|
|
26
29
|
hasAnimation: () => import_normalizeTransition.hasAnimation,
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -5,24 +5,27 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value:
|
|
23
|
+
value: true
|
|
22
24
|
}), mod);
|
|
23
25
|
var index_exports = {};
|
|
24
26
|
__export(index_exports, {
|
|
25
27
|
getAnimatedProperties: () => import_normalizeTransition.getAnimatedProperties,
|
|
28
|
+
getAnimationConfigsForKeys: () => import_normalizeTransition.getAnimationConfigsForKeys,
|
|
26
29
|
getAnimationForProperty: () => import_normalizeTransition.getAnimationForProperty,
|
|
27
30
|
getEffectiveAnimation: () => import_normalizeTransition.getEffectiveAnimation,
|
|
28
31
|
hasAnimation: () => import_normalizeTransition.hasAnimation,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","getAnimatedProperties","import_normalizeTransition","getAnimationForProperty","getEffectiveAnimation","hasAnimation","normalizeTransition","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","getAnimatedProperties","import_normalizeTransition","getAnimationConfigsForKeys","getAnimationForProperty","getEffectiveAnimation","hasAnimation","normalizeTransition","module","exports"],"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,QAAA,CAAAD,aAAA;EAAAE,qBAAA,EAAAA,CAAA,KAAAC,0BAAA,CAAAD,qBAAA;EAAAE,0BAAA,EAAAA,CAAA,KAAAD,0BAAA,CAAAC,0BAAA;EAAAC,uBAAA,EAAAA,CAAA,KAAAF,0BAAA,CAAAE,uBAAA;EAAAC,qBAAA,EAAAA,CAAA,KAAAH,0BAAA,CAAAG,qBAAA;EAAAC,YAAA,EAAAA,CAAA,KAAAJ,0BAAA,CAAAI,YAAA;EAAAC,mBAAA,EAAAA,CAAA,KAAAL,0BAAA,CAAAK;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAf,YAAA,CAAAK,aAOO","ignoreList":[]}
|
|
@@ -3,73 +3,116 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var normalizeTransition_exports = {};
|
|
22
24
|
__export(normalizeTransition_exports, {
|
|
23
25
|
getAnimatedProperties: () => getAnimatedProperties,
|
|
26
|
+
getAnimationConfigsForKeys: () => getAnimationConfigsForKeys,
|
|
24
27
|
getAnimationForProperty: () => getAnimationForProperty,
|
|
25
28
|
getEffectiveAnimation: () => getEffectiveAnimation,
|
|
26
29
|
hasAnimation: () => hasAnimation,
|
|
27
30
|
normalizeTransition: () => normalizeTransition
|
|
28
31
|
});
|
|
29
32
|
module.exports = __toCommonJS(normalizeTransition_exports);
|
|
33
|
+
const SPRING_CONFIG_KEYS = /* @__PURE__ */new Set(["stiffness", "damping", "mass", "tension", "friction", "velocity", "overshootClamping", "duration", "bounciness", "speed"]);
|
|
34
|
+
function isSpringConfigKey(key) {
|
|
35
|
+
return SPRING_CONFIG_KEYS.has(key);
|
|
36
|
+
}
|
|
30
37
|
function normalizeTransition(transition) {
|
|
31
|
-
if (!transition)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
if (!transition) {
|
|
39
|
+
return {
|
|
40
|
+
default: null,
|
|
41
|
+
enter: null,
|
|
42
|
+
exit: null,
|
|
43
|
+
delay: void 0,
|
|
44
|
+
properties: {}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (typeof transition === "string") {
|
|
48
|
+
return {
|
|
49
|
+
default: transition,
|
|
50
|
+
enter: null,
|
|
51
|
+
exit: null,
|
|
52
|
+
delay: void 0,
|
|
53
|
+
properties: {}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
45
56
|
if (Array.isArray(transition)) {
|
|
46
|
-
const [defaultAnimation,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
const [defaultAnimation, configObj] = transition;
|
|
58
|
+
const properties = {};
|
|
59
|
+
const springConfig = {};
|
|
60
|
+
let delay;
|
|
61
|
+
let enter = null;
|
|
62
|
+
let exit = null;
|
|
63
|
+
if (configObj && typeof configObj === "object") {
|
|
64
|
+
for (const [key, value] of Object.entries(configObj)) {
|
|
65
|
+
if (key === "delay" && typeof value === "number") {
|
|
66
|
+
delay = value;
|
|
67
|
+
} else if (key === "enter" && typeof value === "string") {
|
|
68
|
+
enter = value;
|
|
69
|
+
} else if (key === "exit" && typeof value === "string") {
|
|
70
|
+
exit = 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
|
+
}
|
|
77
|
+
}
|
|
52
78
|
return {
|
|
53
79
|
default: defaultAnimation,
|
|
54
80
|
enter,
|
|
55
81
|
exit,
|
|
56
82
|
delay,
|
|
57
|
-
properties
|
|
83
|
+
properties,
|
|
84
|
+
config: Object.keys(springConfig).length > 0 ? springConfig : void 0
|
|
58
85
|
};
|
|
59
86
|
}
|
|
60
|
-
if (typeof transition
|
|
87
|
+
if (typeof transition === "object") {
|
|
61
88
|
const properties = {};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
89
|
+
const springConfig = {};
|
|
90
|
+
let defaultAnimation = null;
|
|
91
|
+
let enter = null;
|
|
92
|
+
let exit = null;
|
|
93
|
+
let delay;
|
|
94
|
+
for (const [key, value] of Object.entries(transition)) {
|
|
95
|
+
if (key === "default" && typeof value === "string") {
|
|
96
|
+
defaultAnimation = value;
|
|
97
|
+
} else if (key === "enter" && typeof value === "string") {
|
|
98
|
+
enter = value;
|
|
99
|
+
} else if (key === "exit" && typeof value === "string") {
|
|
100
|
+
exit = value;
|
|
101
|
+
} else if (key === "delay" && typeof value === "number") {
|
|
102
|
+
delay = value;
|
|
103
|
+
} else if (isSpringConfigKey(key) && value !== void 0) {
|
|
104
|
+
springConfig[key] = value;
|
|
105
|
+
} else if (value !== void 0) {
|
|
106
|
+
properties[key] = value;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
67
109
|
return {
|
|
68
110
|
default: defaultAnimation,
|
|
69
111
|
enter,
|
|
70
112
|
exit,
|
|
71
113
|
delay,
|
|
72
|
-
properties
|
|
114
|
+
properties,
|
|
115
|
+
config: Object.keys(springConfig).length > 0 ? springConfig : void 0
|
|
73
116
|
};
|
|
74
117
|
}
|
|
75
118
|
return {
|
|
@@ -82,7 +125,10 @@ function normalizeTransition(transition) {
|
|
|
82
125
|
}
|
|
83
126
|
function getAnimationForProperty(normalized, property) {
|
|
84
127
|
const propertyAnimation = normalized.properties[property];
|
|
85
|
-
|
|
128
|
+
if (propertyAnimation !== void 0) {
|
|
129
|
+
return propertyAnimation;
|
|
130
|
+
}
|
|
131
|
+
return normalized.default;
|
|
86
132
|
}
|
|
87
133
|
function hasAnimation(normalized) {
|
|
88
134
|
return normalized.default !== null || normalized.enter !== null || normalized.exit !== null || Object.keys(normalized.properties).length > 0;
|
|
@@ -91,5 +137,28 @@ function getAnimatedProperties(normalized) {
|
|
|
91
137
|
return Object.keys(normalized.properties);
|
|
92
138
|
}
|
|
93
139
|
function getEffectiveAnimation(normalized, state) {
|
|
94
|
-
|
|
140
|
+
if (state === "enter" && normalized.enter) {
|
|
141
|
+
return normalized.enter;
|
|
142
|
+
}
|
|
143
|
+
if (state === "exit" && normalized.exit) {
|
|
144
|
+
return normalized.exit;
|
|
145
|
+
}
|
|
146
|
+
return normalized.default;
|
|
147
|
+
}
|
|
148
|
+
function getAnimationConfigsForKeys(normalized, animations, keys, defaultAnimation) {
|
|
149
|
+
const result = /* @__PURE__ */new Map();
|
|
150
|
+
for (const key of keys) {
|
|
151
|
+
const propAnimation = normalized.properties[key];
|
|
152
|
+
let animationValue = null;
|
|
153
|
+
if (typeof propAnimation === "string") {
|
|
154
|
+
animationValue = animations[propAnimation] ?? null;
|
|
155
|
+
} else if (propAnimation && typeof propAnimation === "object" && propAnimation.type) {
|
|
156
|
+
animationValue = animations[propAnimation.type] ?? null;
|
|
157
|
+
}
|
|
158
|
+
if (animationValue === null) {
|
|
159
|
+
animationValue = defaultAnimation;
|
|
160
|
+
}
|
|
161
|
+
result.set(key, animationValue);
|
|
162
|
+
}
|
|
163
|
+
return result;
|
|
95
164
|
}
|
|
@@ -5,24 +5,27 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value:
|
|
23
|
+
value: true
|
|
22
24
|
}), mod);
|
|
23
25
|
var normalizeTransition_exports = {};
|
|
24
26
|
__export(normalizeTransition_exports, {
|
|
25
27
|
getAnimatedProperties: () => getAnimatedProperties,
|
|
28
|
+
getAnimationConfigsForKeys: () => getAnimationConfigsForKeys,
|
|
26
29
|
getAnimationForProperty: () => getAnimationForProperty,
|
|
27
30
|
getEffectiveAnimation: () => getEffectiveAnimation,
|
|
28
31
|
hasAnimation: () => hasAnimation,
|
|
@@ -32,45 +35,69 @@ module.exports = __toCommonJS(normalizeTransition_exports);
|
|
|
32
35
|
function _type_of(obj) {
|
|
33
36
|
"@swc/helpers - typeof";
|
|
34
37
|
|
|
35
|
-
return obj && typeof Symbol
|
|
38
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
39
|
+
}
|
|
40
|
+
var SPRING_CONFIG_KEYS = /* @__PURE__ */new Set(["stiffness", "damping", "mass", "tension", "friction", "velocity", "overshootClamping", "duration", "bounciness", "speed"]);
|
|
41
|
+
function isSpringConfigKey(key) {
|
|
42
|
+
return SPRING_CONFIG_KEYS.has(key);
|
|
36
43
|
}
|
|
37
44
|
function normalizeTransition(transition) {
|
|
38
|
-
if (!transition)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
if (!transition) {
|
|
46
|
+
return {
|
|
47
|
+
default: null,
|
|
48
|
+
enter: null,
|
|
49
|
+
exit: null,
|
|
50
|
+
delay: void 0,
|
|
51
|
+
properties: {}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (typeof transition === "string") {
|
|
55
|
+
return {
|
|
56
|
+
default: transition,
|
|
57
|
+
enter: null,
|
|
58
|
+
exit: null,
|
|
59
|
+
delay: void 0,
|
|
60
|
+
properties: {}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
52
63
|
if (Array.isArray(transition)) {
|
|
53
|
-
var [defaultAnimation,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
var [defaultAnimation, configObj] = transition;
|
|
65
|
+
var properties = {};
|
|
66
|
+
var springConfig = {};
|
|
67
|
+
var delay;
|
|
68
|
+
var enter = null;
|
|
69
|
+
var exit = null;
|
|
70
|
+
if (configObj && (typeof configObj === "undefined" ? "undefined" : _type_of(configObj)) === "object") {
|
|
71
|
+
var _iteratorNormalCompletion = true,
|
|
72
|
+
_didIteratorError = false,
|
|
61
73
|
_iteratorError = void 0;
|
|
62
74
|
try {
|
|
63
|
-
for (var _iterator = Object.entries(
|
|
75
|
+
for (var _iterator = Object.entries(configObj)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
64
76
|
var [key, value] = _step.value;
|
|
65
|
-
key === "delay" && typeof value
|
|
77
|
+
if (key === "delay" && typeof value === "number") {
|
|
78
|
+
delay = value;
|
|
79
|
+
} else if (key === "enter" && typeof value === "string") {
|
|
80
|
+
enter = value;
|
|
81
|
+
} else if (key === "exit" && typeof value === "string") {
|
|
82
|
+
exit = value;
|
|
83
|
+
} else if (isSpringConfigKey(key) && value !== void 0) {
|
|
84
|
+
springConfig[key] = value;
|
|
85
|
+
} else if (value !== void 0) {
|
|
86
|
+
properties[key] = value;
|
|
87
|
+
}
|
|
66
88
|
}
|
|
67
89
|
} catch (err) {
|
|
68
|
-
_didIteratorError =
|
|
90
|
+
_didIteratorError = true;
|
|
91
|
+
_iteratorError = err;
|
|
69
92
|
} finally {
|
|
70
93
|
try {
|
|
71
|
-
!_iteratorNormalCompletion && _iterator.return != null
|
|
94
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
95
|
+
_iterator.return();
|
|
96
|
+
}
|
|
72
97
|
} finally {
|
|
73
|
-
if (_didIteratorError)
|
|
98
|
+
if (_didIteratorError) {
|
|
99
|
+
throw _iteratorError;
|
|
100
|
+
}
|
|
74
101
|
}
|
|
75
102
|
}
|
|
76
103
|
}
|
|
@@ -79,30 +106,49 @@ function normalizeTransition(transition) {
|
|
|
79
106
|
enter,
|
|
80
107
|
exit,
|
|
81
108
|
delay,
|
|
82
|
-
properties
|
|
109
|
+
properties,
|
|
110
|
+
config: Object.keys(springConfig).length > 0 ? springConfig : void 0
|
|
83
111
|
};
|
|
84
112
|
}
|
|
85
|
-
if ((typeof transition
|
|
86
|
-
var properties1 = {}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
113
|
+
if ((typeof transition === "undefined" ? "undefined" : _type_of(transition)) === "object") {
|
|
114
|
+
var properties1 = {};
|
|
115
|
+
var springConfig1 = {};
|
|
116
|
+
var defaultAnimation1 = null;
|
|
117
|
+
var enter1 = null;
|
|
118
|
+
var exit1 = null;
|
|
119
|
+
var delay1;
|
|
120
|
+
var _iteratorNormalCompletion1 = true,
|
|
121
|
+
_didIteratorError1 = false,
|
|
93
122
|
_iteratorError1 = void 0;
|
|
94
123
|
try {
|
|
95
|
-
for (var _iterator1 = Object.entries(transition)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 =
|
|
124
|
+
for (var _iterator1 = Object.entries(transition)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
|
|
96
125
|
var [key1, value1] = _step1.value;
|
|
97
|
-
key1 === "default" && typeof value1
|
|
126
|
+
if (key1 === "default" && typeof value1 === "string") {
|
|
127
|
+
defaultAnimation1 = value1;
|
|
128
|
+
} else if (key1 === "enter" && typeof value1 === "string") {
|
|
129
|
+
enter1 = value1;
|
|
130
|
+
} else if (key1 === "exit" && typeof value1 === "string") {
|
|
131
|
+
exit1 = value1;
|
|
132
|
+
} else if (key1 === "delay" && typeof value1 === "number") {
|
|
133
|
+
delay1 = value1;
|
|
134
|
+
} else if (isSpringConfigKey(key1) && value1 !== void 0) {
|
|
135
|
+
springConfig1[key1] = value1;
|
|
136
|
+
} else if (value1 !== void 0) {
|
|
137
|
+
properties1[key1] = value1;
|
|
138
|
+
}
|
|
98
139
|
}
|
|
99
140
|
} catch (err) {
|
|
100
|
-
_didIteratorError1 =
|
|
141
|
+
_didIteratorError1 = true;
|
|
142
|
+
_iteratorError1 = err;
|
|
101
143
|
} finally {
|
|
102
144
|
try {
|
|
103
|
-
!_iteratorNormalCompletion1 && _iterator1.return != null
|
|
145
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
146
|
+
_iterator1.return();
|
|
147
|
+
}
|
|
104
148
|
} finally {
|
|
105
|
-
if (_didIteratorError1)
|
|
149
|
+
if (_didIteratorError1) {
|
|
150
|
+
throw _iteratorError1;
|
|
151
|
+
}
|
|
106
152
|
}
|
|
107
153
|
}
|
|
108
154
|
return {
|
|
@@ -110,7 +156,8 @@ function normalizeTransition(transition) {
|
|
|
110
156
|
enter: enter1,
|
|
111
157
|
exit: exit1,
|
|
112
158
|
delay: delay1,
|
|
113
|
-
properties: properties1
|
|
159
|
+
properties: properties1,
|
|
160
|
+
config: Object.keys(springConfig1).length > 0 ? springConfig1 : void 0
|
|
114
161
|
};
|
|
115
162
|
}
|
|
116
163
|
return {
|
|
@@ -123,7 +170,10 @@ function normalizeTransition(transition) {
|
|
|
123
170
|
}
|
|
124
171
|
function getAnimationForProperty(normalized, property) {
|
|
125
172
|
var propertyAnimation = normalized.properties[property];
|
|
126
|
-
|
|
173
|
+
if (propertyAnimation !== void 0) {
|
|
174
|
+
return propertyAnimation;
|
|
175
|
+
}
|
|
176
|
+
return normalized.default;
|
|
127
177
|
}
|
|
128
178
|
function hasAnimation(normalized) {
|
|
129
179
|
return normalized.default !== null || normalized.enter !== null || normalized.exit !== null || Object.keys(normalized.properties).length > 0;
|
|
@@ -132,6 +182,50 @@ function getAnimatedProperties(normalized) {
|
|
|
132
182
|
return Object.keys(normalized.properties);
|
|
133
183
|
}
|
|
134
184
|
function getEffectiveAnimation(normalized, state) {
|
|
135
|
-
|
|
185
|
+
if (state === "enter" && normalized.enter) {
|
|
186
|
+
return normalized.enter;
|
|
187
|
+
}
|
|
188
|
+
if (state === "exit" && normalized.exit) {
|
|
189
|
+
return normalized.exit;
|
|
190
|
+
}
|
|
191
|
+
return normalized.default;
|
|
192
|
+
}
|
|
193
|
+
function getAnimationConfigsForKeys(normalized, animations, keys, defaultAnimation) {
|
|
194
|
+
var result = /* @__PURE__ */new Map();
|
|
195
|
+
var _iteratorNormalCompletion = true,
|
|
196
|
+
_didIteratorError = false,
|
|
197
|
+
_iteratorError = void 0;
|
|
198
|
+
try {
|
|
199
|
+
for (var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
200
|
+
var key = _step.value;
|
|
201
|
+
var propAnimation = normalized.properties[key];
|
|
202
|
+
var animationValue = null;
|
|
203
|
+
if (typeof propAnimation === "string") {
|
|
204
|
+
var _animations_propAnimation;
|
|
205
|
+
animationValue = (_animations_propAnimation = animations[propAnimation]) !== null && _animations_propAnimation !== void 0 ? _animations_propAnimation : null;
|
|
206
|
+
} else if (propAnimation && (typeof propAnimation === "undefined" ? "undefined" : _type_of(propAnimation)) === "object" && propAnimation.type) {
|
|
207
|
+
var _animations_propAnimation_type;
|
|
208
|
+
animationValue = (_animations_propAnimation_type = animations[propAnimation.type]) !== null && _animations_propAnimation_type !== void 0 ? _animations_propAnimation_type : null;
|
|
209
|
+
}
|
|
210
|
+
if (animationValue === null) {
|
|
211
|
+
animationValue = defaultAnimation;
|
|
212
|
+
}
|
|
213
|
+
result.set(key, animationValue);
|
|
214
|
+
}
|
|
215
|
+
} catch (err) {
|
|
216
|
+
_didIteratorError = true;
|
|
217
|
+
_iteratorError = err;
|
|
218
|
+
} finally {
|
|
219
|
+
try {
|
|
220
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
221
|
+
_iterator.return();
|
|
222
|
+
}
|
|
223
|
+
} finally {
|
|
224
|
+
if (_didIteratorError) {
|
|
225
|
+
throw _iteratorError;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return result;
|
|
136
230
|
}
|
|
137
231
|
//# sourceMappingURL=normalizeTransition.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","normalizeTransition_exports","__export","getAnimatedProperties","getAnimationForProperty","getEffectiveAnimation","hasAnimation","normalizeTransition","module","exports","_type_of","obj","Symbol","constructor","transition","default","enter","exit","delay","properties","Array","isArray","defaultAnimation","
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","normalizeTransition_exports","__export","getAnimatedProperties","getAnimationConfigsForKeys","getAnimationForProperty","getEffectiveAnimation","hasAnimation","normalizeTransition","module","exports","_type_of","obj","Symbol","constructor","SPRING_CONFIG_KEYS","Set","isSpringConfigKey","key","has","transition","default","enter","exit","delay","properties","Array","isArray","defaultAnimation","configObj","springConfig","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Object","entries","iterator","_step","next","done","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":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,2BAAA;AAAAC,QAAA,CAAAD,2BAAA;EAAAE,qBAAA,EAAAA,CAAA,KAAAA,qBAAA;EAAAC,0BAAA,EAAAA,CAAA,KAAAA,0BAAA;EAAAC,uBAAA,EAAA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= Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
8
|
+
get: () => from[key],
|
|
9
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
10
|
+
});
|
|
11
|
+
}
|
|
10
12
|
return to;
|
|
11
13
|
};
|
|
12
14
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
13
|
-
value:
|
|
15
|
+
value: true
|
|
14
16
|
}), mod);
|
|
15
17
|
var types_exports = {};
|
|
16
18
|
module.exports = __toCommonJS(types_exports);
|
package/dist/cjs/types.native.js
CHANGED
|
@@ -5,14 +5,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
if (from && typeof from
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
10
|
+
get: () => from[key],
|
|
11
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
12
|
+
});
|
|
13
|
+
}
|
|
12
14
|
return to;
|
|
13
15
|
};
|
|
14
16
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
15
|
-
value:
|
|
17
|
+
value: true
|
|
16
18
|
}), mod);
|
|
17
19
|
var types_exports = {};
|
|
18
20
|
module.exports = __toCommonJS(types_exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","types_exports"],"sources":["../../src/types.ts"],"sourcesContent":[null],"mappings":"
|
|
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":[]}
|