@tamagui/animation-helpers 2.7.7 → 3.0.0-beta.637.1

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.
@@ -1,33 +1,32 @@
1
+
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
6
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
7
+ for (var name in all) __defProp(target, name, {
8
+ get: all[name],
9
+ enumerable: true
10
+ });
10
11
  };
11
12
  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, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ return to;
19
20
  };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
22
  var index_exports = {};
24
23
  __export(index_exports, {
25
- getAnimatedProperties: () => import_normalizeTransition.getAnimatedProperties,
26
- getAnimationConfigsForKeys: () => import_normalizeTransition.getAnimationConfigsForKeys,
27
- getAnimationForProperty: () => import_normalizeTransition.getAnimationForProperty,
28
- getEffectiveAnimation: () => import_normalizeTransition.getEffectiveAnimation,
29
- hasAnimation: () => import_normalizeTransition.hasAnimation,
30
- normalizeTransition: () => import_normalizeTransition.normalizeTransition
24
+ getAnimatedProperties: () => import_normalizeTransition.getAnimatedProperties,
25
+ getAnimationConfigsForKeys: () => import_normalizeTransition.getAnimationConfigsForKeys,
26
+ getAnimationForProperty: () => import_normalizeTransition.getAnimationForProperty,
27
+ getEffectiveAnimation: () => import_normalizeTransition.getEffectiveAnimation,
28
+ hasAnimation: () => import_normalizeTransition.hasAnimation,
29
+ normalizeTransition: () => import_normalizeTransition.normalizeTransition
31
30
  });
32
31
  module.exports = __toCommonJS(index_exports);
33
- var import_normalizeTransition = require("./normalizeTransition.cjs");
32
+ var import_normalizeTransition = require("./normalizeTransition.cjs");
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
22
+ };
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+ var index_exports = {};
25
+ __export(index_exports, {
26
+ getAnimatedProperties: () => import_normalizeTransition.getAnimatedProperties,
27
+ getAnimationConfigsForKeys: () => import_normalizeTransition.getAnimationConfigsForKeys,
28
+ getAnimationForProperty: () => import_normalizeTransition.getAnimationForProperty,
29
+ getEffectiveAnimation: () => import_normalizeTransition.getEffectiveAnimation,
30
+ hasAnimation: () => import_normalizeTransition.hasAnimation,
31
+ normalizeTransition: () => import_normalizeTransition.normalizeTransition
32
+ });
33
+ module.exports = __toCommonJS(index_exports);
34
+ var import_normalizeTransition = require("./normalizeTransition.native.js");
@@ -1,36 +1,36 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
12
13
  };
13
14
  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, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
21
22
  };
22
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
- value: true
24
- }), mod);
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
24
  var index_exports = {};
26
25
  __export(index_exports, {
27
- getAnimatedProperties: () => import_normalizeTransition.getAnimatedProperties,
28
- getAnimationConfigsForKeys: () => import_normalizeTransition.getAnimationConfigsForKeys,
29
- getAnimationForProperty: () => import_normalizeTransition.getAnimationForProperty,
30
- getEffectiveAnimation: () => import_normalizeTransition.getEffectiveAnimation,
31
- hasAnimation: () => import_normalizeTransition.hasAnimation,
32
- normalizeTransition: () => import_normalizeTransition.normalizeTransition
26
+ getAnimatedProperties: () => import_normalizeTransition.getAnimatedProperties,
27
+ getAnimationConfigsForKeys: () => import_normalizeTransition.getAnimationConfigsForKeys,
28
+ getAnimationForProperty: () => import_normalizeTransition.getAnimationForProperty,
29
+ getEffectiveAnimation: () => import_normalizeTransition.getEffectiveAnimation,
30
+ hasAnimation: () => import_normalizeTransition.hasAnimation,
31
+ normalizeTransition: () => import_normalizeTransition.normalizeTransition
33
32
  });
34
33
  module.exports = __toCommonJS(index_exports);
35
34
  var import_normalizeTransition = require("./normalizeTransition.native.js");
35
+
36
36
  //# sourceMappingURL=index.native.js.map
@@ -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,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\n__export(index_exports, {\n getAnimatedProperties: () => import_normalizeTransition.getAnimatedProperties,\n getAnimationConfigsForKeys: () => import_normalizeTransition.getAnimationConfigsForKeys,\n getAnimationForProperty: () => import_normalizeTransition.getAnimationForProperty,\n getEffectiveAnimation: () => import_normalizeTransition.getEffectiveAnimation,\n hasAnimation: () => import_normalizeTransition.hasAnimation,\n normalizeTransition: () => import_normalizeTransition.normalizeTransition\n});\nmodule.exports = __toCommonJS(index_exports);\nvar import_normalizeTransition = require(\"./normalizeTransition\");\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,SAAS,eAAe;CACtB,6BAA6B,2BAA2B;CACxD,kCAAkC,2BAA2B;CAC7D,+BAA+B,2BAA2B;CAC1D,6BAA6B,2BAA2B;CACxD,oBAAoB,2BAA2B;CAC/C,2BAA2B,2BAA2B;AACxD,CAAC;AACD,OAAO,UAAU,aAAa,aAAa;AAC3C,IAAI,6BAA6B,QAAQ,iCAAuB"}
@@ -1,164 +1,174 @@
1
+
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
6
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
7
+ for (var name in all) __defProp(target, name, {
8
+ get: all[name],
9
+ enumerable: true
10
+ });
10
11
  };
11
12
  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, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ return to;
19
20
  };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
22
  var normalizeTransition_exports = {};
24
23
  __export(normalizeTransition_exports, {
25
- getAnimatedProperties: () => getAnimatedProperties,
26
- getAnimationConfigsForKeys: () => getAnimationConfigsForKeys,
27
- getAnimationForProperty: () => getAnimationForProperty,
28
- getEffectiveAnimation: () => getEffectiveAnimation,
29
- hasAnimation: () => hasAnimation,
30
- normalizeTransition: () => normalizeTransition
24
+ getAnimatedProperties: () => getAnimatedProperties,
25
+ getAnimationConfigsForKeys: () => getAnimationConfigsForKeys,
26
+ getAnimationForProperty: () => getAnimationForProperty,
27
+ getEffectiveAnimation: () => getEffectiveAnimation,
28
+ hasAnimation: () => hasAnimation,
29
+ normalizeTransition: () => normalizeTransition
31
30
  });
32
31
  module.exports = __toCommonJS(normalizeTransition_exports);
33
- const SPRING_CONFIG_KEYS = /* @__PURE__ */new Set(["stiffness", "damping", "mass", "tension", "friction", "velocity", "overshootClamping", "duration", "bounciness", "speed"]);
32
+ const SPRING_CONFIG_KEYS = /* @__PURE__ */ new Set([
33
+ "stiffness",
34
+ "damping",
35
+ "mass",
36
+ "tension",
37
+ "friction",
38
+ "velocity",
39
+ "overshootClamping",
40
+ "duration",
41
+ "bounciness",
42
+ "speed"
43
+ ]);
34
44
  function isSpringConfigKey(key) {
35
- return SPRING_CONFIG_KEYS.has(key);
45
+ return SPRING_CONFIG_KEYS.has(key);
36
46
  }
37
47
  function normalizeTransition(transition) {
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
- }
56
- if (Array.isArray(transition)) {
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
- }
78
- return {
79
- default: defaultAnimation,
80
- enter,
81
- exit,
82
- delay,
83
- properties,
84
- config: Object.keys(springConfig).length > 0 ? springConfig : void 0
85
- };
86
- }
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
- }
109
- return {
110
- default: defaultAnimation,
111
- enter,
112
- exit,
113
- delay,
114
- properties,
115
- config: Object.keys(springConfig).length > 0 ? springConfig : void 0
116
- };
117
- }
118
- return {
119
- default: null,
120
- enter: null,
121
- exit: null,
122
- delay: void 0,
123
- properties: {}
124
- };
48
+ if (!transition) {
49
+ return {
50
+ default: null,
51
+ enter: null,
52
+ exit: null,
53
+ delay: void 0,
54
+ properties: {}
55
+ };
56
+ }
57
+ if (typeof transition === "string") {
58
+ return {
59
+ default: transition,
60
+ enter: null,
61
+ exit: null,
62
+ delay: void 0,
63
+ properties: {}
64
+ };
65
+ }
66
+ if (Array.isArray(transition)) {
67
+ const [defaultAnimation, configObj] = transition;
68
+ const properties = {};
69
+ const springConfig = {};
70
+ let delay;
71
+ let enter = null;
72
+ let exit = null;
73
+ if (configObj && typeof configObj === "object") {
74
+ for (const [key, value] of Object.entries(configObj)) {
75
+ if (key === "delay" && typeof value === "number") {
76
+ delay = value;
77
+ } else if (key === "enter" && typeof value === "string") {
78
+ enter = value;
79
+ } else if (key === "exit" && typeof value === "string") {
80
+ exit = value;
81
+ } else if (isSpringConfigKey(key) && value !== void 0) {
82
+ springConfig[key] = value;
83
+ } else if (value !== void 0) {
84
+ properties[key] = value;
85
+ }
86
+ }
87
+ }
88
+ return {
89
+ default: defaultAnimation,
90
+ enter,
91
+ exit,
92
+ delay,
93
+ properties,
94
+ config: Object.keys(springConfig).length > 0 ? springConfig : void 0
95
+ };
96
+ }
97
+ if (typeof transition === "object") {
98
+ const properties = {};
99
+ const springConfig = {};
100
+ let defaultAnimation = null;
101
+ let enter = null;
102
+ let exit = null;
103
+ let delay;
104
+ for (const [key, value] of Object.entries(transition)) {
105
+ if (key === "default" && typeof value === "string") {
106
+ defaultAnimation = value;
107
+ } else if (key === "enter" && typeof value === "string") {
108
+ enter = value;
109
+ } else if (key === "exit" && typeof value === "string") {
110
+ exit = value;
111
+ } else if (key === "delay" && typeof value === "number") {
112
+ delay = value;
113
+ } else if (isSpringConfigKey(key) && value !== void 0) {
114
+ springConfig[key] = value;
115
+ } else if (value !== void 0) {
116
+ properties[key] = value;
117
+ }
118
+ }
119
+ return {
120
+ default: defaultAnimation,
121
+ enter,
122
+ exit,
123
+ delay,
124
+ properties,
125
+ config: Object.keys(springConfig).length > 0 ? springConfig : void 0
126
+ };
127
+ }
128
+ return {
129
+ default: null,
130
+ enter: null,
131
+ exit: null,
132
+ delay: void 0,
133
+ properties: {}
134
+ };
125
135
  }
126
136
  function getAnimationForProperty(normalized, property) {
127
- const propertyAnimation = normalized.properties[property];
128
- if (propertyAnimation !== void 0) {
129
- return propertyAnimation;
130
- }
131
- return normalized.default;
137
+ const propertyAnimation = normalized.properties[property];
138
+ if (propertyAnimation !== void 0) {
139
+ return propertyAnimation;
140
+ }
141
+ return normalized.default;
132
142
  }
133
143
  function hasAnimation(normalized) {
134
- return normalized.default !== null || normalized.enter !== null || normalized.exit !== null || Object.keys(normalized.properties).length > 0;
144
+ return normalized.default !== null || normalized.enter !== null || normalized.exit !== null || Object.keys(normalized.properties).length > 0;
135
145
  }
136
146
  function getAnimatedProperties(normalized) {
137
- return Object.keys(normalized.properties);
147
+ return Object.keys(normalized.properties);
138
148
  }
139
149
  function getEffectiveAnimation(normalized, state) {
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;
150
+ if (state === "enter" && normalized.enter) {
151
+ return normalized.enter;
152
+ }
153
+ if (state === "exit" && normalized.exit) {
154
+ return normalized.exit;
155
+ }
156
+ return normalized.default;
147
157
  }
148
158
  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;
164
- }
159
+ const result = /* @__PURE__ */ new Map();
160
+ for (const key of keys) {
161
+ const propAnimation = normalized.properties[key];
162
+ let animationValue = null;
163
+ if (typeof propAnimation === "string") {
164
+ animationValue = animations[propAnimation] ?? null;
165
+ } else if (propAnimation && typeof propAnimation === "object" && propAnimation.type) {
166
+ animationValue = animations[propAnimation.type] ?? null;
167
+ }
168
+ if (animationValue === null) {
169
+ animationValue = defaultAnimation;
170
+ }
171
+ result.set(key, animationValue);
172
+ }
173
+ return result;
174
+ }