@tamagui/animation-helpers 2.7.7 → 3.0.0-beta.1097.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.
Files changed (79) hide show
  1. package/dist/cjs/index.cjs +32 -21
  2. package/dist/cjs/index.native.cjs +46 -0
  3. package/dist/cjs/index.native.js +33 -21
  4. package/dist/cjs/index.native.js.map +1 -1
  5. package/dist/cjs/presets.cjs +77 -0
  6. package/dist/cjs/presets.native.cjs +79 -0
  7. package/dist/cjs/presets.native.js +81 -0
  8. package/dist/cjs/presets.native.js.map +1 -0
  9. package/dist/cjs/propertyNames.cjs +91 -0
  10. package/dist/cjs/propertyNames.native.cjs +95 -0
  11. package/dist/cjs/propertyNames.native.js +97 -0
  12. package/dist/cjs/propertyNames.native.js.map +1 -0
  13. package/dist/cjs/resolveTransition.cjs +345 -0
  14. package/dist/cjs/resolveTransition.native.cjs +424 -0
  15. package/dist/cjs/resolveTransition.native.js +426 -0
  16. package/dist/cjs/resolveTransition.native.js.map +1 -0
  17. package/dist/cjs/transitionResolver.cjs +34 -0
  18. package/dist/cjs/transitionResolver.native.cjs +37 -0
  19. package/dist/cjs/transitionResolver.native.js +39 -0
  20. package/dist/cjs/transitionResolver.native.js.map +1 -0
  21. package/dist/cjs/types.cjs +9 -11
  22. package/dist/cjs/types.native.cjs +18 -0
  23. package/dist/cjs/types.native.js +9 -10
  24. package/dist/cjs/types.native.js.map +1 -1
  25. package/dist/esm/index.js +6 -3
  26. package/dist/esm/index.mjs +6 -3
  27. package/dist/esm/index.native.js +6 -3
  28. package/dist/esm/presets.mjs +57 -0
  29. package/dist/esm/presets.mjs.map +1 -0
  30. package/dist/esm/presets.native.js +57 -0
  31. package/dist/esm/presets.native.js.map +1 -0
  32. package/dist/esm/propertyNames.mjs +67 -0
  33. package/dist/esm/propertyNames.mjs.map +1 -0
  34. package/dist/esm/propertyNames.native.js +69 -0
  35. package/dist/esm/propertyNames.native.js.map +1 -0
  36. package/dist/esm/resolveTransition.mjs +315 -0
  37. package/dist/esm/resolveTransition.mjs.map +1 -0
  38. package/dist/esm/resolveTransition.native.js +392 -0
  39. package/dist/esm/resolveTransition.native.js.map +1 -0
  40. package/dist/esm/transitionResolver.mjs +11 -0
  41. package/dist/esm/transitionResolver.mjs.map +1 -0
  42. package/dist/esm/transitionResolver.native.js +12 -0
  43. package/dist/esm/transitionResolver.native.js.map +1 -0
  44. package/dist/esm/types.mjs +0 -2
  45. package/dist/esm/types.native.js +0 -2
  46. package/package.json +23 -2
  47. package/src/index.ts +39 -9
  48. package/src/presets.ts +40 -0
  49. package/src/propertyNames.ts +78 -0
  50. package/src/resolveTransition.ts +503 -0
  51. package/src/transitionResolver.ts +35 -0
  52. package/src/types.ts +42 -46
  53. package/types/index.d.ts +6 -2
  54. package/types/index.d.ts.map +2 -2
  55. package/types/presets.d.ts +79 -0
  56. package/types/presets.d.ts.map +11 -0
  57. package/types/propertyNames.d.ts +13 -0
  58. package/types/propertyNames.d.ts.map +11 -0
  59. package/types/resolveTransition.d.ts +108 -0
  60. package/types/resolveTransition.d.ts.map +11 -0
  61. package/types/transitionResolver.d.ts +30 -0
  62. package/types/transitionResolver.d.ts.map +11 -0
  63. package/types/types.d.ts +35 -42
  64. package/types/types.d.ts.map +2 -2
  65. package/dist/cjs/normalizeTransition.cjs +0 -164
  66. package/dist/cjs/normalizeTransition.native.js +0 -231
  67. package/dist/cjs/normalizeTransition.native.js.map +0 -1
  68. package/dist/esm/index.js.map +0 -1
  69. package/dist/esm/index.mjs.map +0 -1
  70. package/dist/esm/index.native.js.map +0 -1
  71. package/dist/esm/normalizeTransition.mjs +0 -134
  72. package/dist/esm/normalizeTransition.mjs.map +0 -1
  73. package/dist/esm/normalizeTransition.native.js +0 -198
  74. package/dist/esm/normalizeTransition.native.js.map +0 -1
  75. package/dist/esm/types.mjs.map +0 -1
  76. package/dist/esm/types.native.js.map +0 -1
  77. package/src/normalizeTransition.ts +0 -255
  78. package/types/normalizeTransition.d.ts +0 -54
  79. package/types/normalizeTransition.d.ts.map +0 -11
@@ -5,17 +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") {
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
- }
14
- return to;
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
+ }
14
+ return to;
15
15
  };
16
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
17
- value: true
18
- }), mod);
16
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
17
  var types_exports = {};
20
18
  module.exports = __toCommonJS(types_exports);
19
+
21
20
  //# sourceMappingURL=types.native.js.map
@@ -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,"file":"types.native.js","names":[],"sources":["cjs/types.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\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 types_exports = {};\nmodule.exports = __toCommonJS(types_exports);\n//# sourceMappingURL=types.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,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,OAAO,UAAU,aAAa,aAAa"}
package/dist/esm/index.js CHANGED
@@ -1,3 +1,6 @@
1
- import { normalizeTransition, getAnimationForProperty, hasAnimation, getAnimatedProperties, getEffectiveAnimation, getAnimationConfigsForKeys } from "./normalizeTransition.mjs";
2
- export { getAnimatedProperties, getAnimationConfigsForKeys, getAnimationForProperty, getEffectiveAnimation, hasAnimation, normalizeTransition };
3
- //# sourceMappingURL=index.js.map
1
+ import { animationPresets } from "./presets.mjs";
2
+ import { canonicalTransitionProperty, isTransformProperty, styleKeysForProperty } from "./propertyNames.mjs";
3
+ import { getTransitionResolver, setTransitionResolver } from "./transitionResolver.mjs";
4
+ import { easingToBezier, entryToCSS, forAnimationState, getMaxDurationMs, getSettleMs, getTransitionForKey, hasTransition, presetToTiming, resolveTransition, toCSSTransition } from "./resolveTransition.mjs";
5
+
6
+ export { animationPresets, canonicalTransitionProperty, easingToBezier, entryToCSS, forAnimationState, getMaxDurationMs, getSettleMs, getTransitionForKey, getTransitionResolver, hasTransition, isTransformProperty, presetToTiming, resolveTransition, setTransitionResolver, styleKeysForProperty, toCSSTransition };
@@ -1,3 +1,6 @@
1
- import { normalizeTransition, getAnimationForProperty, hasAnimation, getAnimatedProperties, getEffectiveAnimation, getAnimationConfigsForKeys } from "./normalizeTransition.mjs";
2
- export { getAnimatedProperties, getAnimationConfigsForKeys, getAnimationForProperty, getEffectiveAnimation, hasAnimation, normalizeTransition };
3
- //# sourceMappingURL=index.mjs.map
1
+ import { animationPresets } from "./presets.mjs";
2
+ import { canonicalTransitionProperty, isTransformProperty, styleKeysForProperty } from "./propertyNames.mjs";
3
+ import { getTransitionResolver, setTransitionResolver } from "./transitionResolver.mjs";
4
+ import { easingToBezier, entryToCSS, forAnimationState, getMaxDurationMs, getSettleMs, getTransitionForKey, hasTransition, presetToTiming, resolveTransition, toCSSTransition } from "./resolveTransition.mjs";
5
+
6
+ export { animationPresets, canonicalTransitionProperty, easingToBezier, entryToCSS, forAnimationState, getMaxDurationMs, getSettleMs, getTransitionForKey, getTransitionResolver, hasTransition, isTransformProperty, presetToTiming, resolveTransition, setTransitionResolver, styleKeysForProperty, toCSSTransition };
@@ -1,3 +1,6 @@
1
- import { normalizeTransition, getAnimationForProperty, hasAnimation, getAnimatedProperties, getEffectiveAnimation, getAnimationConfigsForKeys } from "./normalizeTransition.native.js";
2
- export { getAnimatedProperties, getAnimationConfigsForKeys, getAnimationForProperty, getEffectiveAnimation, hasAnimation, normalizeTransition };
3
- //# sourceMappingURL=index.native.js.map
1
+ import { animationPresets } from "./presets.native.js";
2
+ import { canonicalTransitionProperty, isTransformProperty, styleKeysForProperty } from "./propertyNames.native.js";
3
+ import { getTransitionResolver, setTransitionResolver } from "./transitionResolver.native.js";
4
+ import { easingToBezier, entryToCSS, forAnimationState, getMaxDurationMs, getSettleMs, getTransitionForKey, hasTransition, presetToTiming, resolveTransition, toCSSTransition } from "./resolveTransition.native.js";
5
+
6
+ export { animationPresets, canonicalTransitionProperty, easingToBezier, entryToCSS, forAnimationState, getMaxDurationMs, getSettleMs, getTransitionForKey, getTransitionResolver, hasTransition, isTransformProperty, presetToTiming, resolveTransition, setTransitionResolver, styleKeysForProperty, toCSSTransition };
@@ -0,0 +1,57 @@
1
+ const animationPresets = {
2
+ quickest: {
3
+ duration: 120,
4
+ bounce: .2
5
+ },
6
+ quickestLessBouncy: {
7
+ duration: 120,
8
+ bounce: 0
9
+ },
10
+ quicker: {
11
+ duration: 160,
12
+ bounce: .25
13
+ },
14
+ quickerLessBouncy: {
15
+ duration: 160,
16
+ bounce: 0
17
+ },
18
+ quick: {
19
+ duration: 220,
20
+ bounce: .3
21
+ },
22
+ quickLessBouncy: {
23
+ duration: 220,
24
+ bounce: 0
25
+ },
26
+ medium: {
27
+ duration: 300,
28
+ bounce: .15
29
+ },
30
+ slow: {
31
+ duration: 450,
32
+ bounce: .1
33
+ },
34
+ slowest: {
35
+ duration: 700,
36
+ bounce: .1
37
+ },
38
+ lazy: {
39
+ duration: 500,
40
+ bounce: -.2
41
+ },
42
+ superLazy: {
43
+ duration: 800,
44
+ bounce: -.3
45
+ },
46
+ bouncy: {
47
+ duration: 400,
48
+ bounce: .5
49
+ },
50
+ superBouncy: {
51
+ duration: 400,
52
+ bounce: .75
53
+ }
54
+ };
55
+
56
+ export { animationPresets };
57
+ //# sourceMappingURL=presets.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.js","names":[],"sources":["esm/presets.js"],"sourcesContent":["const animationPresets = {\n quickest: { duration: 120, bounce: 0.2 },\n quickestLessBouncy: { duration: 120, bounce: 0 },\n quicker: { duration: 160, bounce: 0.25 },\n quickerLessBouncy: { duration: 160, bounce: 0 },\n quick: { duration: 220, bounce: 0.3 },\n quickLessBouncy: { duration: 220, bounce: 0 },\n medium: { duration: 300, bounce: 0.15 },\n slow: { duration: 450, bounce: 0.1 },\n slowest: { duration: 700, bounce: 0.1 },\n lazy: { duration: 500, bounce: -0.2 },\n superLazy: { duration: 800, bounce: -0.3 },\n bouncy: { duration: 400, bounce: 0.5 },\n superBouncy: { duration: 400, bounce: 0.75 }\n};\nexport {\n animationPresets\n};\n//# sourceMappingURL=presets.js.map\n"],"mappings":";AAAA,MAAM,mBAAmB;CACvB,UAAU;EAAE,UAAU;EAAK,QAAQ;CAAI;CACvC,oBAAoB;EAAE,UAAU;EAAK,QAAQ;CAAE;CAC/C,SAAS;EAAE,UAAU;EAAK,QAAQ;CAAK;CACvC,mBAAmB;EAAE,UAAU;EAAK,QAAQ;CAAE;CAC9C,OAAO;EAAE,UAAU;EAAK,QAAQ;CAAI;CACpC,iBAAiB;EAAE,UAAU;EAAK,QAAQ;CAAE;CAC5C,QAAQ;EAAE,UAAU;EAAK,QAAQ;CAAK;CACtC,MAAM;EAAE,UAAU;EAAK,QAAQ;CAAI;CACnC,SAAS;EAAE,UAAU;EAAK,QAAQ;CAAI;CACtC,MAAM;EAAE,UAAU;EAAK,QAAQ,CAAC;CAAI;CACpC,WAAW;EAAE,UAAU;EAAK,QAAQ,CAAC;CAAI;CACzC,QAAQ;EAAE,UAAU;EAAK,QAAQ;CAAI;CACrC,aAAa;EAAE,UAAU;EAAK,QAAQ;CAAK;AAC7C"}
@@ -0,0 +1,57 @@
1
+ var animationPresets = {
2
+ quickest: {
3
+ duration: 120,
4
+ bounce: .2
5
+ },
6
+ quickestLessBouncy: {
7
+ duration: 120,
8
+ bounce: 0
9
+ },
10
+ quicker: {
11
+ duration: 160,
12
+ bounce: .25
13
+ },
14
+ quickerLessBouncy: {
15
+ duration: 160,
16
+ bounce: 0
17
+ },
18
+ quick: {
19
+ duration: 220,
20
+ bounce: .3
21
+ },
22
+ quickLessBouncy: {
23
+ duration: 220,
24
+ bounce: 0
25
+ },
26
+ medium: {
27
+ duration: 300,
28
+ bounce: .15
29
+ },
30
+ slow: {
31
+ duration: 450,
32
+ bounce: .1
33
+ },
34
+ slowest: {
35
+ duration: 700,
36
+ bounce: .1
37
+ },
38
+ lazy: {
39
+ duration: 500,
40
+ bounce: -.2
41
+ },
42
+ superLazy: {
43
+ duration: 800,
44
+ bounce: -.3
45
+ },
46
+ bouncy: {
47
+ duration: 400,
48
+ bounce: .5
49
+ },
50
+ superBouncy: {
51
+ duration: 400,
52
+ bounce: .75
53
+ }
54
+ };
55
+
56
+ export { animationPresets };
57
+ //# sourceMappingURL=presets.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.native.js","names":[],"sources":["esm/presets.native.js"],"sourcesContent":["var animationPresets = {\n quickest: {\n duration: 120,\n bounce: 0.2\n },\n quickestLessBouncy: {\n duration: 120,\n bounce: 0\n },\n quicker: {\n duration: 160,\n bounce: 0.25\n },\n quickerLessBouncy: {\n duration: 160,\n bounce: 0\n },\n quick: {\n duration: 220,\n bounce: 0.3\n },\n quickLessBouncy: {\n duration: 220,\n bounce: 0\n },\n medium: {\n duration: 300,\n bounce: 0.15\n },\n slow: {\n duration: 450,\n bounce: 0.1\n },\n slowest: {\n duration: 700,\n bounce: 0.1\n },\n lazy: {\n duration: 500,\n bounce: -0.2\n },\n superLazy: {\n duration: 800,\n bounce: -0.3\n },\n bouncy: {\n duration: 400,\n bounce: 0.5\n },\n superBouncy: {\n duration: 400,\n bounce: 0.75\n }\n};\nexport {\n animationPresets\n};\n//# sourceMappingURL=presets.js.map\n"],"mappings":";AAAA,IAAI,mBAAmB;CACrB,UAAU;EACR,UAAU;EACV,QAAQ;CACV;CACA,oBAAoB;EAClB,UAAU;EACV,QAAQ;CACV;CACA,SAAS;EACP,UAAU;EACV,QAAQ;CACV;CACA,mBAAmB;EACjB,UAAU;EACV,QAAQ;CACV;CACA,OAAO;EACL,UAAU;EACV,QAAQ;CACV;CACA,iBAAiB;EACf,UAAU;EACV,QAAQ;CACV;CACA,QAAQ;EACN,UAAU;EACV,QAAQ;CACV;CACA,MAAM;EACJ,UAAU;EACV,QAAQ;CACV;CACA,SAAS;EACP,UAAU;EACV,QAAQ;CACV;CACA,MAAM;EACJ,UAAU;EACV,QAAQ,CAAC;CACX;CACA,WAAW;EACT,UAAU;EACV,QAAQ,CAAC;CACX;CACA,QAAQ;EACN,UAAU;EACV,QAAQ;CACV;CACA,aAAa;EACX,UAAU;EACV,QAAQ;CACV;AACF"}
@@ -0,0 +1,67 @@
1
+ const transformProperties = {
2
+ x: "translate",
3
+ y: "translate",
4
+ z: "translate",
5
+ translate: "translate",
6
+ translateX: "translate",
7
+ translateY: "translate",
8
+ translateZ: "translate",
9
+ scale: "scale",
10
+ scaleX: "scale",
11
+ scaleY: "scale",
12
+ scaleZ: "scale",
13
+ rotate: "rotate",
14
+ rotateX: "transform",
15
+ rotateY: "transform",
16
+ rotateZ: "transform",
17
+ skewX: "transform",
18
+ skewY: "transform",
19
+ perspective: "transform",
20
+ matrix: "transform",
21
+ transform: "transform"
22
+ };
23
+ function canonicalTransitionProperty(key) {
24
+ if (key === "all" || key === "none") return key;
25
+ const transform = transformProperties[key];
26
+ if (transform) return transform;
27
+ return key.includes("-") ? key : key.replace(/[A-Z]/g, "-$&").toLowerCase();
28
+ }
29
+ function isTransformProperty(key) {
30
+ return key in transformProperties;
31
+ }
32
+ const styleKeysByProperty = {
33
+ translate: [
34
+ "translate",
35
+ "translateX",
36
+ "translateY",
37
+ "translateZ",
38
+ "x",
39
+ "y",
40
+ "z"
41
+ ],
42
+ scale: [
43
+ "scale",
44
+ "scaleX",
45
+ "scaleY",
46
+ "scaleZ"
47
+ ],
48
+ rotate: ["rotate"],
49
+ transform: [
50
+ "transform",
51
+ "rotateX",
52
+ "rotateY",
53
+ "rotateZ",
54
+ "skewX",
55
+ "skewY",
56
+ "perspective",
57
+ "matrix"
58
+ ]
59
+ };
60
+ function styleKeysForProperty(property) {
61
+ const transform = styleKeysByProperty[property];
62
+ if (transform) return transform;
63
+ return [property.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase())];
64
+ }
65
+
66
+ export { canonicalTransitionProperty, isTransformProperty, styleKeysForProperty };
67
+ //# sourceMappingURL=propertyNames.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propertyNames.js","names":[],"sources":["esm/propertyNames.js"],"sourcesContent":["const transformProperties = {\n x: \"translate\",\n y: \"translate\",\n z: \"translate\",\n translate: \"translate\",\n translateX: \"translate\",\n translateY: \"translate\",\n translateZ: \"translate\",\n scale: \"scale\",\n scaleX: \"scale\",\n scaleY: \"scale\",\n scaleZ: \"scale\",\n rotate: \"rotate\",\n rotateX: \"transform\",\n rotateY: \"transform\",\n rotateZ: \"transform\",\n skewX: \"transform\",\n skewY: \"transform\",\n perspective: \"transform\",\n matrix: \"transform\",\n transform: \"transform\"\n};\nfunction canonicalTransitionProperty(key) {\n if (key === \"all\" || key === \"none\") return key;\n const transform = transformProperties[key];\n if (transform) return transform;\n return key.includes(\"-\") ? key : key.replace(/[A-Z]/g, \"-$&\").toLowerCase();\n}\nfunction isTransformProperty(key) {\n return key in transformProperties;\n}\nconst styleKeysByProperty = {\n translate: [\"translate\", \"translateX\", \"translateY\", \"translateZ\", \"x\", \"y\", \"z\"],\n scale: [\"scale\", \"scaleX\", \"scaleY\", \"scaleZ\"],\n rotate: [\"rotate\"],\n transform: [\n \"transform\",\n \"rotateX\",\n \"rotateY\",\n \"rotateZ\",\n \"skewX\",\n \"skewY\",\n \"perspective\",\n \"matrix\"\n ]\n};\nfunction styleKeysForProperty(property) {\n const transform = styleKeysByProperty[property];\n if (transform) return transform;\n return [property.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase())];\n}\nexport {\n canonicalTransitionProperty,\n isTransformProperty,\n styleKeysForProperty\n};\n//# sourceMappingURL=propertyNames.js.map\n"],"mappings":";AAAA,MAAM,sBAAsB;CAC1B,GAAG;CACH,GAAG;CACH,GAAG;CACH,WAAW;CACX,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;CACT,SAAS;CACT,OAAO;CACP,OAAO;CACP,aAAa;CACb,QAAQ;CACR,WAAW;AACb;AACA,SAAS,4BAA4B,KAAK;CACxC,IAAI,QAAQ,SAAS,QAAQ,QAAQ,OAAO;CAC5C,MAAM,YAAY,oBAAoB;CACtC,IAAI,WAAW,OAAO;CACtB,OAAO,IAAI,SAAS,GAAG,IAAI,MAAM,IAAI,QAAQ,UAAU,KAAK,CAAC,CAAC,YAAY;AAC5E;AACA,SAAS,oBAAoB,KAAK;CAChC,OAAO,OAAO;AAChB;AACA,MAAM,sBAAsB;CAC1B,WAAW;EAAC;EAAa;EAAc;EAAc;EAAc;EAAK;EAAK;CAAG;CAChF,OAAO;EAAC;EAAS;EAAU;EAAU;CAAQ;CAC7C,QAAQ,CAAC,QAAQ;CACjB,WAAW;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;AACA,SAAS,qBAAqB,UAAU;CACtC,MAAM,YAAY,oBAAoB;CACtC,IAAI,WAAW,OAAO;CACtB,OAAO,CAAC,SAAS,QAAQ,cAAc,GAAG,WAAW,OAAO,YAAY,CAAC,CAAC;AAC5E"}
@@ -0,0 +1,69 @@
1
+ var transformProperties = {
2
+ x: "translate",
3
+ y: "translate",
4
+ z: "translate",
5
+ translate: "translate",
6
+ translateX: "translate",
7
+ translateY: "translate",
8
+ translateZ: "translate",
9
+ scale: "scale",
10
+ scaleX: "scale",
11
+ scaleY: "scale",
12
+ scaleZ: "scale",
13
+ rotate: "rotate",
14
+ rotateX: "transform",
15
+ rotateY: "transform",
16
+ rotateZ: "transform",
17
+ skewX: "transform",
18
+ skewY: "transform",
19
+ perspective: "transform",
20
+ matrix: "transform",
21
+ transform: "transform"
22
+ };
23
+ function canonicalTransitionProperty(key) {
24
+ if (key === "all" || key === "none") return key;
25
+ var transform = transformProperties[key];
26
+ if (transform) return transform;
27
+ return key.includes("-") ? key : key.replace(/[A-Z]/g, "-$&").toLowerCase();
28
+ }
29
+ function isTransformProperty(key) {
30
+ return key in transformProperties;
31
+ }
32
+ var styleKeysByProperty = {
33
+ translate: [
34
+ "translate",
35
+ "translateX",
36
+ "translateY",
37
+ "translateZ",
38
+ "x",
39
+ "y",
40
+ "z"
41
+ ],
42
+ scale: [
43
+ "scale",
44
+ "scaleX",
45
+ "scaleY",
46
+ "scaleZ"
47
+ ],
48
+ rotate: ["rotate"],
49
+ transform: [
50
+ "transform",
51
+ "rotateX",
52
+ "rotateY",
53
+ "rotateZ",
54
+ "skewX",
55
+ "skewY",
56
+ "perspective",
57
+ "matrix"
58
+ ]
59
+ };
60
+ function styleKeysForProperty(property) {
61
+ var transform = styleKeysByProperty[property];
62
+ if (transform) return transform;
63
+ return [property.replace(/-([a-z])/g, function(_, letter) {
64
+ return letter.toUpperCase();
65
+ })];
66
+ }
67
+
68
+ export { canonicalTransitionProperty, isTransformProperty, styleKeysForProperty };
69
+ //# sourceMappingURL=propertyNames.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propertyNames.native.js","names":[],"sources":["esm/propertyNames.native.js"],"sourcesContent":["var transformProperties = {\n x: \"translate\",\n y: \"translate\",\n z: \"translate\",\n translate: \"translate\",\n translateX: \"translate\",\n translateY: \"translate\",\n translateZ: \"translate\",\n scale: \"scale\",\n scaleX: \"scale\",\n scaleY: \"scale\",\n scaleZ: \"scale\",\n rotate: \"rotate\",\n rotateX: \"transform\",\n rotateY: \"transform\",\n rotateZ: \"transform\",\n skewX: \"transform\",\n skewY: \"transform\",\n perspective: \"transform\",\n matrix: \"transform\",\n transform: \"transform\"\n};\nfunction canonicalTransitionProperty(key) {\n if (key === \"all\" || key === \"none\") return key;\n var transform = transformProperties[key];\n if (transform) return transform;\n return key.includes(\"-\") ? key : key.replace(/[A-Z]/g, \"-$&\").toLowerCase();\n}\nfunction isTransformProperty(key) {\n return key in transformProperties;\n}\nvar styleKeysByProperty = {\n translate: [\n \"translate\",\n \"translateX\",\n \"translateY\",\n \"translateZ\",\n \"x\",\n \"y\",\n \"z\"\n ],\n scale: [\n \"scale\",\n \"scaleX\",\n \"scaleY\",\n \"scaleZ\"\n ],\n rotate: [\n \"rotate\"\n ],\n transform: [\n \"transform\",\n \"rotateX\",\n \"rotateY\",\n \"rotateZ\",\n \"skewX\",\n \"skewY\",\n \"perspective\",\n \"matrix\"\n ]\n};\nfunction styleKeysForProperty(property) {\n var transform = styleKeysByProperty[property];\n if (transform) return transform;\n return [\n property.replace(/-([a-z])/g, function(_, letter) {\n return letter.toUpperCase();\n })\n ];\n}\nexport {\n canonicalTransitionProperty,\n isTransformProperty,\n styleKeysForProperty\n};\n//# sourceMappingURL=propertyNames.js.map\n"],"mappings":";AAAA,IAAI,sBAAsB;CACxB,GAAG;CACH,GAAG;CACH,GAAG;CACH,WAAW;CACX,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;CACT,SAAS;CACT,OAAO;CACP,OAAO;CACP,aAAa;CACb,QAAQ;CACR,WAAW;AACb;AACA,SAAS,4BAA4B,KAAK;CACxC,IAAI,QAAQ,SAAS,QAAQ,QAAQ,OAAO;CAC5C,IAAI,YAAY,oBAAoB;CACpC,IAAI,WAAW,OAAO;CACtB,OAAO,IAAI,SAAS,GAAG,IAAI,MAAM,IAAI,QAAQ,UAAU,KAAK,CAAC,CAAC,YAAY;AAC5E;AACA,SAAS,oBAAoB,KAAK;CAChC,OAAO,OAAO;AAChB;AACA,IAAI,sBAAsB;CACxB,WAAW;EACT;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,OAAO;EACL;EACA;EACA;EACA;CACF;CACA,QAAQ,CACN,QACF;CACA,WAAW;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;AACA,SAAS,qBAAqB,UAAU;CACtC,IAAI,YAAY,oBAAoB;CACpC,IAAI,WAAW,OAAO;CACtB,OAAO,CACL,SAAS,QAAQ,aAAa,SAAS,GAAG,QAAQ;EAChD,OAAO,OAAO,YAAY;CAC5B,CAAC,CACH;AACF"}
@@ -0,0 +1,315 @@
1
+ import { parseTransition, parseTransitionObject, springFromDurationBounce, springSettleTime, springToDurationBounce, springToLinearEasing } from "@tamagui/style-grammar/transitions";
2
+ import { canonicalTransitionProperty } from "./propertyNames.mjs";
3
+ import { setTransitionResolver } from "./transitionResolver.mjs";
4
+
5
+ const emptyResolved = {
6
+ entries: [],
7
+ all: null,
8
+ byProperty: {},
9
+ none: false,
10
+ fused: false,
11
+ enter: null,
12
+ exit: null,
13
+ diagnostics: []
14
+ };
15
+ function forAnimationState(resolved, state) {
16
+ if (state === "enter" && resolved.enter) return resolved.enter;
17
+ if (state === "exit" && resolved.exit) return resolved.exit;
18
+ return resolved;
19
+ }
20
+ function timeToMs(value) {
21
+ return value.endsWith("ms") ? Number.parseFloat(value) : Number.parseFloat(value) * 1e3;
22
+ }
23
+ function springTiming(durationMs, bounce, extra) {
24
+ const mass = typeof extra?.mass === "number" ? extra.mass : 1;
25
+ const physics = springFromDurationBounce({
26
+ duration: durationMs,
27
+ bounce
28
+ }, mass);
29
+ return {
30
+ kind: "spring",
31
+ durationMs,
32
+ bounce,
33
+ stiffness: typeof extra?.stiffness === "number" ? extra.stiffness : physics.stiffness,
34
+ damping: typeof extra?.damping === "number" ? extra.damping : physics.damping,
35
+ mass,
36
+ extra
37
+ };
38
+ }
39
+ function presetToTiming(preset) {
40
+ if (typeof preset === "string") {
41
+ const parsed = parseTransition(preset);
42
+ if (!parsed.ok || parsed.value.kind !== "transition") return null;
43
+ const entry = parsed.value.entries[0];
44
+ if (!entry) return null;
45
+ return timingToDriver(entry.timing, null);
46
+ }
47
+ if (!preset || typeof preset !== "object") return null;
48
+ const config = preset;
49
+ const duration = typeof config.duration === "number" ? config.duration : void 0;
50
+ const hasPhysics = typeof config.stiffness === "number" || typeof config.damping === "number";
51
+ const stiffness = typeof config.stiffness === "number" ? config.stiffness : void 0;
52
+ const damping = typeof config.damping === "number" ? config.damping : void 0;
53
+ const isSpring = config.type === "spring" || typeof config.bounce === "number" || hasPhysics;
54
+ if (isSpring) {
55
+ const mass = typeof config.mass === "number" ? config.mass : 1;
56
+ if (stiffness !== void 0) {
57
+ const canonical = springToDurationBounce({
58
+ stiffness,
59
+ damping: damping ?? 2 * Math.sqrt(stiffness * mass),
60
+ mass
61
+ });
62
+ return {
63
+ kind: "spring",
64
+ durationMs: duration ?? canonical.duration,
65
+ bounce: typeof config.bounce === "number" ? config.bounce : canonical.bounce,
66
+ stiffness,
67
+ damping: damping ?? 2 * Math.sqrt(stiffness * mass),
68
+ mass,
69
+ extra: config
70
+ };
71
+ }
72
+ if (duration !== void 0) {
73
+ return springTiming(duration, typeof config.bounce === "number" ? config.bounce : 0, config);
74
+ }
75
+ return null;
76
+ }
77
+ if (duration === void 0) return null;
78
+ const easing = typeof config.easing === "string" ? config.easing : "ease";
79
+ return {
80
+ kind: "timing",
81
+ durationMs: duration,
82
+ easing
83
+ };
84
+ }
85
+ function timingToDriver(timing, animations) {
86
+ if (timing.type === "css") {
87
+ return {
88
+ kind: "timing",
89
+ durationMs: timeToMs(timing.duration),
90
+ easing: timing.timingFunction
91
+ };
92
+ }
93
+ if (timing.type === "spring") {
94
+ return springTiming(timeToMs(timing.duration), timing.bounce, timing.config);
95
+ }
96
+ const preset = animations?.[timing.name];
97
+ if (preset === void 0) return null;
98
+ const base = presetToTiming(preset);
99
+ if (!base || !timing.config) return base;
100
+ const overrides = timing.config;
101
+ if (base.kind === "spring" || typeof overrides.bounce === "number") {
102
+ const overrideDuration = typeof overrides.duration === "number" ? overrides.duration : typeof overrides.duration === "string" ? timeToMs(overrides.duration) : void 0;
103
+ const overrideBounce = typeof overrides.bounce === "number" ? overrides.bounce : void 0;
104
+ const durationMs = overrideDuration ?? base.durationMs;
105
+ const bounce = overrideBounce ?? (base.kind === "spring" ? base.bounce : 0);
106
+ let carried = base.kind === "spring" ? base.extra : void 0;
107
+ if (carried && (overrideDuration !== void 0 || overrideBounce !== void 0)) {
108
+ const { stiffness, damping, ...rest } = carried;
109
+ carried = rest;
110
+ }
111
+ return springTiming(durationMs, bounce, {
112
+ ...carried,
113
+ ...overrides
114
+ });
115
+ }
116
+ return {
117
+ kind: "timing",
118
+ durationMs: typeof overrides.duration === "number" ? overrides.duration : typeof overrides.duration === "string" ? timeToMs(overrides.duration) : base.durationMs,
119
+ easing: typeof overrides.easing === "string" ? overrides.easing : base.easing
120
+ };
121
+ }
122
+ const namedEasings = {
123
+ linear: [
124
+ 0,
125
+ 0,
126
+ 1,
127
+ 1
128
+ ],
129
+ ease: [
130
+ .25,
131
+ .1,
132
+ .25,
133
+ 1
134
+ ],
135
+ "ease-in": [
136
+ .42,
137
+ 0,
138
+ 1,
139
+ 1
140
+ ],
141
+ "ease-out": [
142
+ 0,
143
+ 0,
144
+ .58,
145
+ 1
146
+ ],
147
+ "ease-in-out": [
148
+ .42,
149
+ 0,
150
+ .58,
151
+ 1
152
+ ]
153
+ };
154
+ function easingToBezier(easing) {
155
+ const named = namedEasings[easing];
156
+ if (named) return named;
157
+ if (!easing.startsWith("cubic-bezier(")) return null;
158
+ const parts = easing.slice("cubic-bezier(".length, -1).split(",");
159
+ if (parts.length !== 4) return null;
160
+ const points = parts.map((part) => Number.parseFloat(part));
161
+ if (points.some((point) => !Number.isFinite(point))) return null;
162
+ return points;
163
+ }
164
+ const cacheByAnimations = /* @__PURE__ */ new WeakMap();
165
+ const objectCache = /* @__PURE__ */ new WeakMap();
166
+ const noAnimations = {};
167
+ function resolveTransition(transition, options = {}) {
168
+ if (transition == null || transition === "") return emptyResolved;
169
+ const animations = options.animations ?? null;
170
+ const cacheKey = animations ?? noAnimations;
171
+ if (typeof transition === "string") {
172
+ let byValue = cacheByAnimations.get(cacheKey);
173
+ if (!byValue) {
174
+ byValue = /* @__PURE__ */ new Map();
175
+ cacheByAnimations.set(cacheKey, byValue);
176
+ }
177
+ const hit2 = byValue.get(transition);
178
+ if (hit2) return hit2;
179
+ const built2 = buildResolved(transition, animations, options.shorthands ?? null);
180
+ if (byValue.size > 2048) byValue.clear();
181
+ byValue.set(transition, built2);
182
+ return built2;
183
+ }
184
+ if (typeof transition !== "object") return emptyResolved;
185
+ const hit = objectCache.get(transition);
186
+ if (hit) return hit;
187
+ const built = buildResolved(transition, animations, options.shorthands ?? null);
188
+ objectCache.set(transition, built);
189
+ return built;
190
+ }
191
+ function buildResolved(transition, animations, shorthands) {
192
+ const presetNames = animations ? new Set(Object.keys(animations)) : void 0;
193
+ const parsed = parseTransitionObject(transition, presetNames);
194
+ if (!parsed.ok) {
195
+ return {
196
+ ...emptyResolved,
197
+ diagnostics: parsed.diagnostics
198
+ };
199
+ }
200
+ if (parsed.value.kind !== "transition") return emptyResolved;
201
+ return fromEntries(parsed.value.entries, animations, shorthands, parsed.value.enter ? fromEntries(parsed.value.enter, animations, shorthands, null, null) : null, parsed.value.exit ? fromEntries(parsed.value.exit, animations, shorthands, null, null) : null);
202
+ }
203
+ const transformFamily = [
204
+ "transform",
205
+ "translate",
206
+ "scale",
207
+ "rotate"
208
+ ];
209
+ function fromEntries(source, animations, shorthands, enter, exit) {
210
+ const entries = [];
211
+ const byProperty = {};
212
+ const diagnostics = [];
213
+ let all = null;
214
+ let none = false;
215
+ let fused = false;
216
+ for (const entry of source) {
217
+ if (entry.property === "none") {
218
+ none = true;
219
+ continue;
220
+ }
221
+ if (entry.timing.type !== "css") fused = true;
222
+ const timing = timingToDriver(entry.timing, animations);
223
+ if (!timing) {
224
+ diagnostics.push({
225
+ code: "transition-invalid-token",
226
+ token: entry.timing.type === "preset" ? entry.timing.name : void 0,
227
+ message: entry.timing.type === "preset" ? `"${entry.timing.name}" is not a configured animation` : "transition timing could not be resolved"
228
+ });
229
+ continue;
230
+ }
231
+ const expanded = shorthands?.[entry.property] ?? entry.property;
232
+ const property = canonicalTransitionProperty(expanded);
233
+ const delayMs = timeToMs(entry.delay);
234
+ for (const name of expanded === "transform" ? transformFamily : [property]) {
235
+ const resolved = {
236
+ property: name,
237
+ timing,
238
+ delayMs,
239
+ behavior: entry.behavior
240
+ };
241
+ entries.push(resolved);
242
+ if (name === "all") all = resolved;
243
+ else byProperty[name] = resolved;
244
+ }
245
+ }
246
+ return {
247
+ entries,
248
+ all,
249
+ byProperty,
250
+ none,
251
+ fused,
252
+ enter,
253
+ exit,
254
+ diagnostics
255
+ };
256
+ }
257
+ function getTransitionForKey(resolved, key) {
258
+ if (resolved.none) return null;
259
+ const direct = resolved.byProperty[canonicalTransitionProperty(key)];
260
+ if (direct) return direct;
261
+ return resolved.all;
262
+ }
263
+ function hasTransition(resolved) {
264
+ return !resolved.none && resolved.entries.length > 0;
265
+ }
266
+ function getSettleMs(timing) {
267
+ if (timing.kind === "timing") return timing.durationMs;
268
+ return springSettleTime({
269
+ duration: timing.durationMs,
270
+ bounce: timing.bounce
271
+ });
272
+ }
273
+ function getMaxDurationMs(resolved) {
274
+ let max = 0;
275
+ for (const entry of resolved.entries) {
276
+ const total = getSettleMs(entry.timing) + entry.delayMs;
277
+ if (total > max) max = total;
278
+ }
279
+ return max;
280
+ }
281
+ const linearEasingCache = /* @__PURE__ */ new Map();
282
+ function entryToCSS(entry) {
283
+ const delay = entry.delayMs ? ` ${entry.delayMs}ms` : "";
284
+ const behavior = entry.behavior === "allow-discrete" ? " allow-discrete" : "";
285
+ if (entry.timing.kind === "timing") {
286
+ return `${entry.property} ${entry.timing.durationMs}ms ${entry.timing.easing}${delay}${behavior}`;
287
+ }
288
+ const key = `${entry.timing.durationMs}/${entry.timing.bounce}`;
289
+ let spring = linearEasingCache.get(key);
290
+ if (!spring) {
291
+ spring = springToLinearEasing({
292
+ duration: entry.timing.durationMs,
293
+ bounce: entry.timing.bounce
294
+ });
295
+ if (linearEasingCache.size > 256) linearEasingCache.clear();
296
+ linearEasingCache.set(key, spring);
297
+ }
298
+ return `${entry.property} ${Math.round(spring.durationMs)}ms ${spring.easing}${delay}${behavior}`;
299
+ }
300
+ function toCSSTransition(resolved) {
301
+ if (resolved.none) return "none";
302
+ if (!resolved.entries.length) return void 0;
303
+ let out = "";
304
+ for (const entry of resolved.entries) {
305
+ out += `${out ? ", " : ""}${entryToCSS(entry)}`;
306
+ }
307
+ return out || void 0;
308
+ }
309
+ setTransitionResolver({
310
+ resolve: resolveTransition,
311
+ toCSS: toCSSTransition
312
+ });
313
+
314
+ export { easingToBezier, entryToCSS, forAnimationState, getMaxDurationMs, getSettleMs, getTransitionForKey, hasTransition, presetToTiming, resolveTransition, toCSSTransition };
315
+ //# sourceMappingURL=resolveTransition.mjs.map