@hanzogui/animation-helpers 3.0.6 → 4.4.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.
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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
- return to;
17
- };
17
+ }
18
+ return to;
19
+ };
18
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
21
+ value: true
20
22
  }), mod);
21
23
  var index_exports = {};
22
24
  __export(index_exports, {
@@ -5,20 +5,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: !0
23
+ value: true
22
24
  }), mod);
23
25
  var index_exports = {};
24
26
  __export(index_exports, {
@@ -1 +1 @@
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":[]}
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,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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
- return to;
17
- };
17
+ }
18
+ return to;
19
+ };
18
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
21
+ value: true
20
22
  }), mod);
21
23
  var normalizeTransition_exports = {};
22
24
  __export(normalizeTransition_exports, {
@@ -33,28 +35,46 @@ function isSpringConfigKey(key) {
33
35
  return SPRING_CONFIG_KEYS.has(key);
34
36
  }
35
37
  function normalizeTransition(transition) {
36
- if (!transition) return {
37
- default: null,
38
- enter: null,
39
- exit: null,
40
- delay: void 0,
41
- properties: {}
42
- };
43
- if (typeof transition == "string") return {
44
- default: transition,
45
- enter: null,
46
- exit: null,
47
- delay: void 0,
48
- properties: {}
49
- };
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
+ }
50
56
  if (Array.isArray(transition)) {
51
- const [defaultAnimation, configObj] = transition,
52
- properties = {},
53
- springConfig = {};
54
- let delay,
55
- enter = null,
56
- exit = null;
57
- if (configObj && typeof configObj == "object") for (const [key, value] of Object.entries(configObj)) key === "delay" && typeof value == "number" ? delay = value : key === "enter" && typeof value == "string" ? enter = value : key === "exit" && typeof value == "string" ? exit = value : isSpringConfigKey(key) && value !== void 0 ? springConfig[key] = value : value !== void 0 && (properties[key] = value);
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
+ }
58
78
  return {
59
79
  default: defaultAnimation,
60
80
  enter,
@@ -64,14 +84,28 @@ function normalizeTransition(transition) {
64
84
  config: Object.keys(springConfig).length > 0 ? springConfig : void 0
65
85
  };
66
86
  }
67
- if (typeof transition == "object") {
68
- const properties = {},
69
- springConfig = {};
70
- let defaultAnimation = null,
71
- enter = null,
72
- exit = null,
73
- delay;
74
- for (const [key, value] of Object.entries(transition)) key === "default" && typeof value == "string" ? defaultAnimation = value : key === "enter" && typeof value == "string" ? enter = value : key === "exit" && typeof value == "string" ? exit = value : key === "delay" && typeof value == "number" ? delay = value : isSpringConfigKey(key) && value !== void 0 ? springConfig[key] = value : value !== void 0 && (properties[key] = value);
87
+ if (typeof transition === "object") {
88
+ const properties = {};
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
+ }
75
109
  return {
76
110
  default: defaultAnimation,
77
111
  enter,
@@ -91,7 +125,10 @@ function normalizeTransition(transition) {
91
125
  }
92
126
  function getAnimationForProperty(normalized, property) {
93
127
  const propertyAnimation = normalized.properties[property];
94
- return propertyAnimation !== void 0 ? propertyAnimation : normalized.default;
128
+ if (propertyAnimation !== void 0) {
129
+ return propertyAnimation;
130
+ }
131
+ return normalized.default;
95
132
  }
96
133
  function hasAnimation(normalized) {
97
134
  return normalized.default !== null || normalized.enter !== null || normalized.exit !== null || Object.keys(normalized.properties).length > 0;
@@ -100,14 +137,28 @@ function getAnimatedProperties(normalized) {
100
137
  return Object.keys(normalized.properties);
101
138
  }
102
139
  function getEffectiveAnimation(normalized, state) {
103
- return state === "enter" && normalized.enter ? normalized.enter : state === "exit" && normalized.exit ? normalized.exit : normalized.default;
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;
104
147
  }
105
148
  function getAnimationConfigsForKeys(normalized, animations, keys, defaultAnimation) {
106
149
  const result = /* @__PURE__ */new Map();
107
150
  for (const key of keys) {
108
151
  const propAnimation = normalized.properties[key];
109
152
  let animationValue = null;
110
- typeof propAnimation == "string" ? animationValue = animations[propAnimation] ?? null : propAnimation && typeof propAnimation == "object" && propAnimation.type && (animationValue = animations[propAnimation.type] ?? null), animationValue === null && (animationValue = defaultAnimation), result.set(key, animationValue);
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);
111
162
  }
112
163
  return result;
113
164
  }
@@ -5,20 +5,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: !0
23
+ value: true
22
24
  }), mod);
23
25
  var normalizeTransition_exports = {};
24
26
  __export(normalizeTransition_exports, {
@@ -33,50 +35,69 @@ module.exports = __toCommonJS(normalizeTransition_exports);
33
35
  function _type_of(obj) {
34
36
  "@swc/helpers - typeof";
35
37
 
36
- return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
38
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
37
39
  }
38
40
  var SPRING_CONFIG_KEYS = /* @__PURE__ */new Set(["stiffness", "damping", "mass", "tension", "friction", "velocity", "overshootClamping", "duration", "bounciness", "speed"]);
39
41
  function isSpringConfigKey(key) {
40
42
  return SPRING_CONFIG_KEYS.has(key);
41
43
  }
42
44
  function normalizeTransition(transition) {
43
- if (!transition) return {
44
- default: null,
45
- enter: null,
46
- exit: null,
47
- delay: void 0,
48
- properties: {}
49
- };
50
- if (typeof transition == "string") return {
51
- default: transition,
52
- enter: null,
53
- exit: null,
54
- delay: void 0,
55
- properties: {}
56
- };
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
+ }
57
63
  if (Array.isArray(transition)) {
58
- var [defaultAnimation, configObj] = transition,
59
- properties = {},
60
- springConfig = {},
61
- delay,
62
- enter = null,
63
- exit = null;
64
- if (configObj && (typeof configObj > "u" ? "undefined" : _type_of(configObj)) === "object") {
65
- var _iteratorNormalCompletion = !0,
66
- _didIteratorError = !1,
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,
67
73
  _iteratorError = void 0;
68
74
  try {
69
- for (var _iterator = Object.entries(configObj)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
75
+ for (var _iterator = Object.entries(configObj)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
70
76
  var [key, value] = _step.value;
71
- key === "delay" && typeof value == "number" ? delay = value : key === "enter" && typeof value == "string" ? enter = value : key === "exit" && typeof value == "string" ? exit = value : isSpringConfigKey(key) && value !== void 0 ? springConfig[key] = value : value !== void 0 && (properties[key] = 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
+ }
72
88
  }
73
89
  } catch (err) {
74
- _didIteratorError = !0, _iteratorError = err;
90
+ _didIteratorError = true;
91
+ _iteratorError = err;
75
92
  } finally {
76
93
  try {
77
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
94
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
95
+ _iterator.return();
96
+ }
78
97
  } finally {
79
- if (_didIteratorError) throw _iteratorError;
98
+ if (_didIteratorError) {
99
+ throw _iteratorError;
100
+ }
80
101
  }
81
102
  }
82
103
  }
@@ -89,28 +110,45 @@ function normalizeTransition(transition) {
89
110
  config: Object.keys(springConfig).length > 0 ? springConfig : void 0
90
111
  };
91
112
  }
92
- if ((typeof transition > "u" ? "undefined" : _type_of(transition)) === "object") {
93
- var properties1 = {},
94
- springConfig1 = {},
95
- defaultAnimation1 = null,
96
- enter1 = null,
97
- exit1 = null,
98
- delay1,
99
- _iteratorNormalCompletion1 = !0,
100
- _didIteratorError1 = !1,
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,
101
122
  _iteratorError1 = void 0;
102
123
  try {
103
- for (var _iterator1 = Object.entries(transition)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = !0) {
124
+ for (var _iterator1 = Object.entries(transition)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
104
125
  var [key1, value1] = _step1.value;
105
- key1 === "default" && typeof value1 == "string" ? defaultAnimation1 = value1 : key1 === "enter" && typeof value1 == "string" ? enter1 = value1 : key1 === "exit" && typeof value1 == "string" ? exit1 = value1 : key1 === "delay" && typeof value1 == "number" ? delay1 = value1 : isSpringConfigKey(key1) && value1 !== void 0 ? springConfig1[key1] = value1 : value1 !== void 0 && (properties1[key1] = 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
+ }
106
139
  }
107
140
  } catch (err) {
108
- _didIteratorError1 = !0, _iteratorError1 = err;
141
+ _didIteratorError1 = true;
142
+ _iteratorError1 = err;
109
143
  } finally {
110
144
  try {
111
- !_iteratorNormalCompletion1 && _iterator1.return != null && _iterator1.return();
145
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
146
+ _iterator1.return();
147
+ }
112
148
  } finally {
113
- if (_didIteratorError1) throw _iteratorError1;
149
+ if (_didIteratorError1) {
150
+ throw _iteratorError1;
151
+ }
114
152
  }
115
153
  }
116
154
  return {
@@ -132,7 +170,10 @@ function normalizeTransition(transition) {
132
170
  }
133
171
  function getAnimationForProperty(normalized, property) {
134
172
  var propertyAnimation = normalized.properties[property];
135
- return propertyAnimation !== void 0 ? propertyAnimation : normalized.default;
173
+ if (propertyAnimation !== void 0) {
174
+ return propertyAnimation;
175
+ }
176
+ return normalized.default;
136
177
  }
137
178
  function hasAnimation(normalized) {
138
179
  return normalized.default !== null || normalized.enter !== null || normalized.exit !== null || Object.keys(normalized.properties).length > 0;
@@ -141,34 +182,48 @@ function getAnimatedProperties(normalized) {
141
182
  return Object.keys(normalized.properties);
142
183
  }
143
184
  function getEffectiveAnimation(normalized, state) {
144
- return state === "enter" && normalized.enter ? normalized.enter : state === "exit" && normalized.exit ? normalized.exit : normalized.default;
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;
145
192
  }
146
193
  function getAnimationConfigsForKeys(normalized, animations, keys, defaultAnimation) {
147
- var result = /* @__PURE__ */new Map(),
148
- _iteratorNormalCompletion = !0,
149
- _didIteratorError = !1,
194
+ var result = /* @__PURE__ */new Map();
195
+ var _iteratorNormalCompletion = true,
196
+ _didIteratorError = false,
150
197
  _iteratorError = void 0;
151
198
  try {
152
- for (var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
153
- var key = _step.value,
154
- propAnimation = normalized.properties[key],
155
- animationValue = null;
156
- if (typeof propAnimation == "string") {
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") {
157
204
  var _animations_propAnimation;
158
205
  animationValue = (_animations_propAnimation = animations[propAnimation]) !== null && _animations_propAnimation !== void 0 ? _animations_propAnimation : null;
159
- } else if (propAnimation && (typeof propAnimation > "u" ? "undefined" : _type_of(propAnimation)) === "object" && propAnimation.type) {
206
+ } else if (propAnimation && (typeof propAnimation === "undefined" ? "undefined" : _type_of(propAnimation)) === "object" && propAnimation.type) {
160
207
  var _animations_propAnimation_type;
161
208
  animationValue = (_animations_propAnimation_type = animations[propAnimation.type]) !== null && _animations_propAnimation_type !== void 0 ? _animations_propAnimation_type : null;
162
209
  }
163
- animationValue === null && (animationValue = defaultAnimation), result.set(key, animationValue);
210
+ if (animationValue === null) {
211
+ animationValue = defaultAnimation;
212
+ }
213
+ result.set(key, animationValue);
164
214
  }
165
215
  } catch (err) {
166
- _didIteratorError = !0, _iteratorError = err;
216
+ _didIteratorError = true;
217
+ _iteratorError = err;
167
218
  } finally {
168
219
  try {
169
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
220
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
221
+ _iterator.return();
222
+ }
170
223
  } finally {
171
- if (_didIteratorError) throw _iteratorError;
224
+ if (_didIteratorError) {
225
+ throw _iteratorError;
226
+ }
172
227
  }
173
228
  }
174
229
  return result;
@@ -1 +1 @@
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,EAAAA,CAAA,KAAAA,uBAAA;EAAAC,qBAAA,EAAAA,CAAA,KAAAA,qBAAA;EAAAC,YAAA,EAAAA,CAAA,KAAAA,YAAA;EAAAC,mBAAA,EAAAA,CAAA,KAAAA;AAAA;AAOAC,MAAM,CAAAC,OAAA,GAAAd,YAAkC,CAAAK,2BAAQ;AAAA,SAC9CU,SAAAC,GAAA;EACA;;EACA,OAAAA,GAAA,WAAAC,MAAA,UAAAD,GAAA,CAAAE,WAAA,KAAAD,MAAA,qBAAAD,GAAA;AAAA;AACA,IACAG,kBAAA,sBAAAC,GAAA,EACA,aACA,WACA,QACA,WACA,YACD,YAKD,mBAAS,EACP,UAAO,EACT,cAcO,OAAS,CAId;AACE,SAAAC,iBAAOA,CAAAC,GAAA;EAAA,OACLH,kBAAS,CAAAI,GAAA,CAAAD,GAAA;AAAA;AACF,SACPV,mBAAMA,CAAAY,UAAA;EAAA,IACN,CAAAA,UAAO,SACP;I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AAA,EAIV,MAAAC,eAAqB;MAO3B;IAYO;IAML,OAAM;MAENjC,OAAW,EAAA2B,iBAAa;MACtB1B,KAAM,EAAA2B,MAAA;MACN1B,IAAI,EAAA2B,KAAA;MAEA1B,KAAO,EAAA2B,MAAA;MAgBb1B,UAAA,EAAAqB,WAAA;MAEAH,MAAO,EAAAR,MAAA,CAAAS,IAAA,CAAAG,aAAA,EAAAF,MAAA,OAAAE,aAAA;IACT","ignoreList":[]}
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,EAAAA,CAAA,KAAAA,uBAAA;EAAAC,qBAAA,EAAAA,CAAA,KAAAA,qBAAA;EAAAC,YAAA,EAAAA,CAAA,KAAAA,YAAA;EAAAC,mBAAA,EAAAA,CAAA,KAAAA;AAAA;AAOAC,MAAM,CAAAC,OAAA,GAAAd,YAAkC,CAAAK,2BAAQ;AAAA,SA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ACDV,iBAAA,GAAAU,MAAA;QACN,OAAO,IAAAD,IAAA,uBAAAC,MAAA;UACPT,MAAY,GAACS,MAAA;QACf,WAAAD,IAAA,sBAAAC,MAAA;UACFR,KAAA,GAAAQ,MAAA;QAUO,CAAS,UAAAD,IAAA,YACd,WACAC,MAAA,KACiC;UAE3BP,MAAA,GAAAO,MAAA;QACF,WAAAzC,iBAAiC,CAAAwC,IAAA,KAAAC,MAAA;UACnCX,aAAO,CAAAU,IAAA,IAAAC,MAAA;QACT,WAAAA,MAAA;UAGOZ,WAAW,CAAAW,IAAA,IAAAC,MAAA;QACpB;MAKO;IACL,SACEjB,GAAA;MAKJY,kBAAA;MAMOC,eAAS,GAAAb,GAAA;IACd,UAAO;MACT;QAUO,IAAS,CAAAW,0BACd,IACAG,UACe,CAAAb,MAAA;UACXa,UAAU,CAAAb,MAAW;QACvB;MACF;QACI,IAAAW,kBAAoB;UACtB,MAAOC,eAAW;QACpB;MACA;IACF;IAYO,OAAS;MAMdjC,OAAM,EAAA2B,iBAAS;MAEf1B,KAAA,EAAW2B,MAAA;MACT1B,IAAM,EAAA2B,KAAA;MACN1B,KAAI,EAAA2B,MAAA;MAEJ1B,UAAW,EAAAqB,WAAA;MACTH,MAAA,EAAAR,MAAA,CAAAS,IAAiB,CAAAG,aAAW,EAAAF,MAAa,OAAKE,aAAA;IAChD;EAKE;EAA4D,OAC9D;IAGA1B,OAAI;IACFC,KAAA;IACFC,IAAA;IAEAC,KAAA,EAAO,KAAI;IACbC,UAAA;EAEA;AACF","ignoreList":[]}
@@ -3,14 +3,16 @@ var __getOwnPropDesc = 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 == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
- get: () => from[key],
8
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
- });
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: !0
15
+ value: true
14
16
  }), mod);
15
17
  var types_exports = {};
16
18
  module.exports = __toCommonJS(types_exports);
@@ -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 == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
9
- get: () => from[key],
10
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
- });
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: !0
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":";;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA","ignoreList":[]}
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":[]}
@@ -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) return {
7
- default: null,
8
- enter: null,
9
- exit: null,
10
- delay: void 0,
11
- properties: {}
12
- };
13
- if (typeof transition == "string") return {
14
- default: transition,
15
- enter: null,
16
- exit: null,
17
- delay: void 0,
18
- properties: {}
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
- properties = {},
23
- springConfig = {};
24
- let delay,
25
- enter = null,
26
- exit = null;
27
- if (configObj && typeof configObj == "object") for (const [key, value] of Object.entries(configObj)) key === "delay" && typeof value == "number" ? delay = value : key === "enter" && typeof value == "string" ? enter = value : key === "exit" && typeof value == "string" ? exit = value : isSpringConfigKey(key) && value !== void 0 ? springConfig[key] = value : value !== void 0 && (properties[key] = value);
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 == "object") {
38
- const properties = {},
39
- springConfig = {};
40
- let defaultAnimation = null,
41
- enter = null,
42
- exit = null,
43
- delay;
44
- for (const [key, value] of Object.entries(transition)) key === "default" && typeof value == "string" ? defaultAnimation = value : key === "enter" && typeof value == "string" ? enter = value : key === "exit" && typeof value == "string" ? exit = value : key === "delay" && typeof value == "number" ? delay = value : isSpringConfigKey(key) && value !== void 0 ? springConfig[key] = value : value !== void 0 && (properties[key] = value);
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
- return propertyAnimation !== void 0 ? propertyAnimation : normalized.default;
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,14 +105,28 @@ function getAnimatedProperties(normalized) {
70
105
  return Object.keys(normalized.properties);
71
106
  }
72
107
  function getEffectiveAnimation(normalized, state) {
73
- return state === "enter" && normalized.enter ? normalized.enter : state === "exit" && normalized.exit ? normalized.exit : normalized.default;
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;
74
115
  }
75
116
  function getAnimationConfigsForKeys(normalized, animations, keys, defaultAnimation) {
76
117
  const result = /* @__PURE__ */new Map();
77
118
  for (const key of keys) {
78
119
  const propAnimation = normalized.properties[key];
79
120
  let animationValue = null;
80
- typeof propAnimation == "string" ? animationValue = animations[propAnimation] ?? null : propAnimation && typeof propAnimation == "object" && propAnimation.type && (animationValue = animations[propAnimation.type] ?? null), animationValue === null && (animationValue = defaultAnimation), result.set(key, animationValue);
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);
81
130
  }
82
131
  return result;
83
132
  }
@@ -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","getAnimationConfigsForKeys","animations","result","Map","propAnimation","animationValue","type","set"],"sources":["../../src/normalizeTransition.ts"],"sourcesContent":[null],"mappings":"AAOA,MAAMA,kBAAA,GAAkC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EA,OAAOH,MAAA;AACT","ignoreList":[]}
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,SA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AA,EAAM;IACvC,OAAOe,UAAA,CAAWf,IAAA;EACpB;EACA,OAAOe,UAAA,CAAWjB,OAAA;AACpB;AAYO,SAASwB,2BACdP,UAAA,EACAQ,UAAA,EACAX,IAAA,EACAP,gBAAA,EACuB;EACvB,MAAMmB,MAAA,GAAS,mBAAIC,GAAA,CAAsB;EAEzC,WAAW/B,GAAA,IAAOkB,IAAA,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 < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
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) return {
12
- default: null,
13
- enter: null,
14
- exit: null,
15
- delay: void 0,
16
- properties: {}
17
- };
18
- if (typeof transition == "string") return {
19
- default: transition,
20
- enter: null,
21
- exit: null,
22
- delay: void 0,
23
- properties: {}
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
- properties = {},
28
- springConfig = {},
29
- delay,
30
- enter = null,
31
- exit = null;
32
- if (configObj && (typeof configObj > "u" ? "undefined" : _type_of(configObj)) === "object") {
33
- var _iteratorNormalCompletion = !0,
34
- _didIteratorError = !1,
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 = !0) {
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 == "number" ? delay = value : key === "enter" && typeof value == "string" ? enter = value : key === "exit" && typeof value == "string" ? exit = value : isSpringConfigKey(key) && value !== void 0 ? springConfig[key] = value : value !== void 0 && (properties[key] = 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 = !0, _iteratorError = err;
56
+ _didIteratorError = true;
57
+ _iteratorError = err;
43
58
  } finally {
44
59
  try {
45
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
60
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
61
+ _iterator.return();
62
+ }
46
63
  } finally {
47
- if (_didIteratorError) throw _iteratorError;
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 > "u" ? "undefined" : _type_of(transition)) === "object") {
61
- var properties1 = {},
62
- springConfig1 = {},
63
- defaultAnimation1 = null,
64
- enter1 = null,
65
- exit1 = null,
66
- delay1,
67
- _iteratorNormalCompletion1 = !0,
68
- _didIteratorError1 = !1,
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 = !0) {
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 == "string" ? defaultAnimation1 = value1 : key1 === "enter" && typeof value1 == "string" ? enter1 = value1 : key1 === "exit" && typeof value1 == "string" ? exit1 = value1 : key1 === "delay" && typeof value1 == "number" ? delay1 = value1 : isSpringConfigKey(key1) && value1 !== void 0 ? springConfig1[key1] = value1 : value1 !== void 0 && (properties1[key1] = 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 = !0, _iteratorError1 = err;
107
+ _didIteratorError1 = true;
108
+ _iteratorError1 = err;
77
109
  } finally {
78
110
  try {
79
- !_iteratorNormalCompletion1 && _iterator1.return != null && _iterator1.return();
111
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
112
+ _iterator1.return();
113
+ }
80
114
  } finally {
81
- if (_didIteratorError1) throw _iteratorError1;
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
- return propertyAnimation !== void 0 ? propertyAnimation : normalized.default;
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,34 +148,48 @@ function getAnimatedProperties(normalized) {
109
148
  return Object.keys(normalized.properties);
110
149
  }
111
150
  function getEffectiveAnimation(normalized, state) {
112
- return state === "enter" && normalized.enter ? normalized.enter : state === "exit" && normalized.exit ? normalized.exit : normalized.default;
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;
113
158
  }
114
159
  function getAnimationConfigsForKeys(normalized, animations, keys, defaultAnimation) {
115
- var result = /* @__PURE__ */new Map(),
116
- _iteratorNormalCompletion = !0,
117
- _didIteratorError = !1,
160
+ var result = /* @__PURE__ */new Map();
161
+ var _iteratorNormalCompletion = true,
162
+ _didIteratorError = false,
118
163
  _iteratorError = void 0;
119
164
  try {
120
- for (var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
121
- var key = _step.value,
122
- propAnimation = normalized.properties[key],
123
- animationValue = null;
124
- if (typeof propAnimation == "string") {
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") {
125
170
  var _animations_propAnimation;
126
171
  animationValue = (_animations_propAnimation = animations[propAnimation]) !== null && _animations_propAnimation !== void 0 ? _animations_propAnimation : null;
127
- } else if (propAnimation && (typeof propAnimation > "u" ? "undefined" : _type_of(propAnimation)) === "object" && propAnimation.type) {
172
+ } else if (propAnimation && (typeof propAnimation === "undefined" ? "undefined" : _type_of(propAnimation)) === "object" && propAnimation.type) {
128
173
  var _animations_propAnimation_type;
129
174
  animationValue = (_animations_propAnimation_type = animations[propAnimation.type]) !== null && _animations_propAnimation_type !== void 0 ? _animations_propAnimation_type : null;
130
175
  }
131
- animationValue === null && (animationValue = defaultAnimation), result.set(key, animationValue);
176
+ if (animationValue === null) {
177
+ animationValue = defaultAnimation;
178
+ }
179
+ result.set(key, animationValue);
132
180
  }
133
181
  } catch (err) {
134
- _didIteratorError = !0, _iteratorError = err;
182
+ _didIteratorError = true;
183
+ _iteratorError = err;
135
184
  } finally {
136
185
  try {
137
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
186
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
187
+ _iterator.return();
188
+ }
138
189
  } finally {
139
- if (_didIteratorError) throw _iteratorError;
190
+ if (_didIteratorError) {
191
+ throw _iteratorError;
192
+ }
140
193
  }
141
194
  }
142
195
  return result;
@@ -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,UAAAD,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,kBAAAC,GAAA;EACH,OAAAH,kBAAO,CAAAI,GAAA,CAAAD,GAAA;AAAA;AACI,SACTE,mBAAOA,CAAAC,UAAA;EAAA,IACP,CAAAA,UAAM,SACN;IACAC,OAAA,MAAa;IACfC,KAAA;IAIEC,IAAA,MAAO;IACTC,KAAO;IACLC,UAAS;EAAA;EACF,IACP,OAAML,UAAA,qBACN;IACAC,OAAA,EAAAD,UAAa;IACfE,KAAA;IAKEC,IAAA,EAAM;IACRC,KAAO;IAGPC,UACI;EAGJ;EACE,IAAAC,KAAA,CAAAC,OAAY,CAAAP,UAAU,GAAK;IACzB,IAAI,CAAAQ,gBAAQ,EAAWC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ignoreList":[]}
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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,EAAAF,MAAU,OAAAE,aAAA;IACrC;EAA8C;EAM9C;IACF3B,OAAA;IAGAC,KAAI;IACFC,IAAA;IACFC,KAAA;IAEAC,UAAO,EAAI;EACb;AAEA;AACF,SAAAmC,wBAAAC,UAAA,EAAAC,QAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzogui/animation-helpers",
3
- "version": "3.0.6",
3
+ "version": "4.4.0",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "license": "MIT",
6
6
  "source": "src/index.ts",
@@ -36,6 +36,6 @@
36
36
  "clean:build": "hanzo-gui-build clean:build"
37
37
  },
38
38
  "devDependencies": {
39
- "@hanzogui/build": "3.0.6"
39
+ "@hanzogui/build": "4.4.0"
40
40
  }
41
41
  }