@tamagui/animations-moti 1.88.21 → 1.88.23

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,43 +1,27 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: !0 });
10
- }, __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from == "object" || typeof from == "function")
12
- for (let key of __getOwnPropNames(from))
13
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
22
- mod
23
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
24
- var createAnimations_exports = {};
25
- __export(createAnimations_exports, {
26
- createAnimations: () => createAnimations
27
- });
28
- module.exports = __toCommonJS(createAnimations_exports);
29
- var import_use_presence = require("@tamagui/use-presence"), import_author = require("moti/author"), import_react = require("react"), import_react_native_reanimated = __toESM(require("react-native-reanimated"));
1
+ import { PresenceContext, ResetPresence, usePresence } from "@tamagui/use-presence";
2
+ import { useMotify } from "moti/author";
3
+ import { useCallback, useContext, useMemo } from "react";
4
+ import Animated, {
5
+ cancelAnimation,
6
+ runOnJS,
7
+ useAnimatedReaction,
8
+ useAnimatedStyle,
9
+ useDerivedValue,
10
+ useSharedValue,
11
+ withSpring,
12
+ withTiming
13
+ } from "react-native-reanimated";
30
14
  function createAnimations(animations) {
31
15
  return {
32
- View: import_react_native_reanimated.default.View,
33
- Text: import_react_native_reanimated.default.Text,
16
+ View: Animated.View,
17
+ Text: Animated.Text,
34
18
  isReactNative: !0,
35
19
  animations,
36
- usePresence: import_use_presence.usePresence,
37
- ResetPresence: import_use_presence.ResetPresence,
20
+ usePresence,
21
+ ResetPresence,
38
22
  useAnimatedNumber(initial) {
39
- const sharedValue = (0, import_react_native_reanimated.useSharedValue)(initial);
40
- return (0, import_react.useMemo)(
23
+ const sharedValue = useSharedValue(initial);
24
+ return useMemo(
41
25
  () => ({
42
26
  getInstance() {
43
27
  "worklet";
@@ -49,11 +33,11 @@ function createAnimations(animations) {
49
33
  },
50
34
  setValue(next, config = { type: "spring" }) {
51
35
  "worklet";
52
- config.type === "direct" ? sharedValue.value = next : config.type === "spring" ? sharedValue.value = (0, import_react_native_reanimated.withSpring)(next, config) : sharedValue.value = (0, import_react_native_reanimated.withTiming)(next, config);
36
+ config.type === "direct" ? sharedValue.value = next : config.type === "spring" ? sharedValue.value = withSpring(next, config) : sharedValue.value = withTiming(next, config);
53
37
  },
54
38
  stop() {
55
39
  "worklet";
56
- (0, import_react_native_reanimated.cancelAnimation)(sharedValue);
40
+ cancelAnimation(sharedValue);
57
41
  }
58
42
  }),
59
43
  [sharedValue]
@@ -61,10 +45,10 @@ function createAnimations(animations) {
61
45
  },
62
46
  useAnimatedNumberReaction({ value }, onValue) {
63
47
  const instance = value.getInstance();
64
- return (0, import_react_native_reanimated.useAnimatedReaction)(
48
+ return useAnimatedReaction(
65
49
  () => instance.value,
66
50
  (next, prev) => {
67
- prev !== next && (0, import_react_native_reanimated.runOnJS)(onValue)(next);
51
+ prev !== next && runOnJS(onValue)(next);
68
52
  },
69
53
  // dependency array is very important here
70
54
  [onValue, instance]
@@ -74,8 +58,8 @@ function createAnimations(animations) {
74
58
  * `getStyle` must be a worklet
75
59
  */
76
60
  useAnimatedNumberStyle(val, getStyle) {
77
- const instance = val.getInstance(), derivedValue = (0, import_react_native_reanimated.useDerivedValue)(() => instance.value, [instance, getStyle]);
78
- return (0, import_react_native_reanimated.useAnimatedStyle)(() => getStyle(derivedValue.value), [val, getStyle, derivedValue, instance]);
61
+ const instance = val.getInstance(), derivedValue = useDerivedValue(() => instance.value, [instance, getStyle]);
62
+ return useAnimatedStyle(() => getStyle(derivedValue.value), [val, getStyle, derivedValue, instance]);
79
63
  },
80
64
  useAnimations: (animationProps) => {
81
65
  const { props, presence, style, onDidAnimate, componentState } = animationProps, animationKey = Array.isArray(props.animation) ? props.animation[0] : props.animation, isHydrating = componentState.unmounted === "should-enter";
@@ -91,7 +75,7 @@ function createAnimations(animations) {
91
75
  } else
92
76
  animate = style;
93
77
  }
94
- const animateStr = JSON.stringify(animate), styles = (0, import_react.useMemo)(() => JSON.parse(animateStr), [animateStr]), isExiting = !!(presence != null && presence[1]), sendExitComplete = presence == null ? void 0 : presence[1], onDidAnimateCombined = (0, import_react.useCallback)(() => {
78
+ const animateStr = JSON.stringify(animate), styles = useMemo(() => JSON.parse(animateStr), [animateStr]), isExiting = !!(presence != null && presence[1]), sendExitComplete = presence == null ? void 0 : presence[1], onDidAnimateCombined = useCallback(() => {
95
79
  onDidAnimate == null || onDidAnimate(), sendExitComplete == null || sendExitComplete();
96
80
  }, []), motiProps = {
97
81
  animate: isExiting || isHydrating ? {} : styles,
@@ -103,9 +87,9 @@ function createAnimations(animations) {
103
87
  // : animations[animationKey as keyof typeof animations]
104
88
  onDidAnimate: onDidAnimateCombined,
105
89
  usePresenceValue: presence,
106
- presenceContext: (0, import_react.useContext)(import_use_presence.PresenceContext),
90
+ presenceContext: useContext(PresenceContext),
107
91
  exit: isExiting ? styles : void 0
108
- }, moti = (0, import_author.useMotify)(motiProps);
92
+ }, moti = useMotify(motiProps);
109
93
  return process.env.NODE_ENV === "development" && props.debug && console.info("useMotify(", JSON.stringify(motiProps, null, 2) + ")", {
110
94
  animationProps,
111
95
  motiProps,
@@ -117,8 +101,7 @@ function createAnimations(animations) {
117
101
  }
118
102
  };
119
103
  }
120
- // Annotate the CommonJS export names for ESM import in node:
121
- 0 && (module.exports = {
104
+ export {
122
105
  createAnimations
123
- });
106
+ };
124
107
  //# sourceMappingURL=createAnimations.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/createAnimations.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA4D,kCAG5D,gBAA0B,wBAC1B,eAAiD,kBAEjD,iCASO;AAIA,SAAS,iBACd,YACoB;AACpB,SAAO;AAAA,IACL,MAAM,+BAAAA,QAAS;AAAA,IACf,MAAM,+BAAAA,QAAS;AAAA,IACf,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IAEA,kBAAkB,SAA4D;AAC5E,YAAM,kBAAc,+CAAe,OAAO;AAE1C,iBAAO;AAAA,QACL,OAAO;AAAA,UACL,cAAc;AACZ;AACA,mBAAO;AAAA,UACT;AAAA,UACA,WAAW;AACT;AACA,mBAAO,YAAY;AAAA,UACrB;AAAA,UACA,SAAS,MAAM,SAAS,EAAE,MAAM,SAAS,GAAG;AAC1C;AACA,YAAI,OAAO,SAAS,WAClB,YAAY,QAAQ,OACX,OAAO,SAAS,WACzB,YAAY,YAAQ,2CAAW,MAAM,MAAM,IAE3C,YAAY,YAAQ,2CAAW,MAAM,MAAM;AAAA,UAE/C;AAAA,UACA,OAAO;AACL;AACA,gEAAgB,WAAW;AAAA,UAC7B;AAAA,QACF;AAAA,QACA,CAAC,WAAW;AAAA,MACd;AAAA,IACF;AAAA,IAEA,0BAA0B,EAAE,MAAM,GAAG,SAAS;AAC5C,YAAM,WAAW,MAAM,YAAY;AACnC,iBAAO;AAAA,QACL,MACS,S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mB,qCAAW,IAE9B,uBAAuB,YAAY,MAAM;AAC7C,gDACA;AAAA,MACF,GAAG,CAAC,CAAC,GAIC,YAAY;AAAA,QAChB,SAAS,aAAa,cAAc,CAAC,IAAI;AAAA,QACzC,YAAY,WAAW,YAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAM9D,cAAc;AAAA,QACd,kBAAkB;AAAA,QAClB,iBAAiB,WAAW,eAAe;AAAA,QAC3C,MAAM,YAAY,SAAS;AAAA,MAC7B,GAEM,OAAO,UAAU,SAAS;AAEhC,aAAI,QAAQ,IAAI,aAAa,iBAAiB,MAAM,SAClD,QAAQ,KAAK,cAAc,KAAK,UAAU,WAAW,MAAM,CAAC,IAAI,KAAK;AAAA,QACnE;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO,CAAC,aAAa,KAAK,KAAK;AAAA,MACjC,CAAC,GAGI;AAAA,QACL,OAAO,CAAC,aAAa,KAAK,KAAK;AAAA,MACjC;AAAA,IACF;AAAA,EACF;AACF;",
5
+ "names": []
6
6
  }
@@ -1,21 +1,3 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from == "object" || typeof from == "function")
8
- for (let key of __getOwnPropNames(from))
9
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- return to;
11
- }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
12
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
13
- var src_exports = {};
14
- module.exports = __toCommonJS(src_exports);
15
- var import_polyfill = require("./polyfill");
16
- __reExport(src_exports, require("./createAnimations"), module.exports);
17
- // Annotate the CommonJS export names for ESM import in node:
18
- 0 && (module.exports = {
19
- ...require("./createAnimations")
20
- });
1
+ import "./polyfill";
2
+ export * from "./createAnimations";
21
3
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "mappings": ";;;;;;;;;;;;AAAA;AAAA;AAAA,sBAAO;AAEP,wBAAc,+BAFd;",
4
+ "mappings": "AAAA,OAAO;AAEP,cAAc;",
5
5
  "names": []
6
6
  }
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  typeof requestAnimationFrame > "u" && (globalThis.requestAnimationFrame = setTimeout);
3
2
  typeof global > "u" && (globalThis.global = globalThis);
4
3
  //# sourceMappingURL=polyfill.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/polyfill.ts"],
4
- "mappings": ";AACI,OAAO,wBAA0B,QACnC,WAAW,wBAA2B;AAIpC,OAAO,SAAW,QACpB,WAAW,SAAY;",
4
+ "mappings": "AACI,OAAO,wBAA0B,QACnC,WAAW,wBAA2B;AAIpC,OAAO,SAAW,QACpB,WAAW,SAAY;",
5
5
  "names": []
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/animations-moti",
3
- "version": "1.88.21",
3
+ "version": "1.88.23",
4
4
  "source": "src/index.ts",
5
5
  "license": "MIT",
6
6
  "types": "./types/index.d.ts",
@@ -15,13 +15,13 @@
15
15
  "dist"
16
16
  ],
17
17
  "dependencies": {
18
- "@tamagui/use-presence": "1.88.21",
19
- "@tamagui/web": "1.88.21",
18
+ "@tamagui/use-presence": "1.88.23",
19
+ "@tamagui/web": "1.88.23",
20
20
  "moti": "^0.27.2",
21
21
  "react": "^18.2.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@tamagui/build": "1.88.21",
24
+ "@tamagui/build": "1.88.23",
25
25
  "react-native-reanimated": "3.3.0"
26
26
  },
27
27
  "scripts": {