@tamagui/animations-moti 1.90.2 → 1.90.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/createAnimations.js +50 -20
- package/dist/cjs/createAnimations.js.map +1 -1
- package/dist/cjs/createAnimations.native.js +91 -37
- package/dist/cjs/createAnimations.native.js.map +2 -2
- package/dist/esm/createAnimations.js +57 -20
- package/dist/esm/createAnimations.js.map +1 -1
- package/dist/esm/createAnimations.mjs +61 -21
- package/dist/esm/createAnimations.native.js +93 -37
- package/dist/esm/createAnimations.native.js.map +2 -2
- package/package.json +5 -5
- package/src/createAnimations.tsx +78 -28
- package/types/createAnimations.d.ts +1 -1
- package/types/createAnimations.d.ts.map +1 -1
|
@@ -25,11 +25,53 @@ __export(createAnimations_exports, {
|
|
|
25
25
|
createAnimations: () => createAnimations
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(createAnimations_exports);
|
|
28
|
-
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"));
|
|
28
|
+
var import_use_presence = require("@tamagui/use-presence"), import_web = require("@tamagui/web"), import_author = require("moti/author"), import_react = require("react"), import_react_native_reanimated = __toESM(require("react-native-reanimated")), import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
function createTamaguiAnimatedComponent(tag = "div") {
|
|
30
|
+
const Component = import_react_native_reanimated.default.createAnimatedComponent(
|
|
31
|
+
(0, import_react.forwardRef)(({ forwardedRef, style, ...props }, ref) => {
|
|
32
|
+
const composedRefs = (0, import_web.useComposedRefs)(forwardedRef, ref), Element = props.tag || tag;
|
|
33
|
+
return style && Array.isArray(style.transform) && (style.transform = (0, import_web.transformsToString)(style.transform)), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Element, { ...props, style, ref: composedRefs });
|
|
34
|
+
})
|
|
35
|
+
);
|
|
36
|
+
return Component.acceptTagProp = !0, Component;
|
|
37
|
+
}
|
|
38
|
+
const AnimatedView = createTamaguiAnimatedComponent("div"), AnimatedText = createTamaguiAnimatedComponent("span"), neverAnimate = {
|
|
39
|
+
alignItems: !0,
|
|
40
|
+
backdropFilter: !0,
|
|
41
|
+
borderBottomStyle: !0,
|
|
42
|
+
borderLeftStyle: !0,
|
|
43
|
+
borderRightStyle: !0,
|
|
44
|
+
borderStyle: !0,
|
|
45
|
+
borderTopStyle: !0,
|
|
46
|
+
boxSizing: !0,
|
|
47
|
+
contain: !0,
|
|
48
|
+
cursor: !0,
|
|
49
|
+
display: !0,
|
|
50
|
+
flexBasis: !0,
|
|
51
|
+
flexDirection: !0,
|
|
52
|
+
flexShrink: !0,
|
|
53
|
+
justifyContent: !0,
|
|
54
|
+
maxHeight: !0,
|
|
55
|
+
maxWidth: !0,
|
|
56
|
+
minHeight: !0,
|
|
57
|
+
minWidth: !0,
|
|
58
|
+
outlineStyle: !0,
|
|
59
|
+
overflow: !0,
|
|
60
|
+
overflowX: !0,
|
|
61
|
+
overflowY: !0,
|
|
62
|
+
pointerEvents: !0,
|
|
63
|
+
position: !0,
|
|
64
|
+
shadowColor: !0,
|
|
65
|
+
textAlign: !0,
|
|
66
|
+
textOverflow: !0,
|
|
67
|
+
whiteSpace: !0,
|
|
68
|
+
wordWrap: !0,
|
|
69
|
+
zIndex: !0
|
|
70
|
+
};
|
|
29
71
|
function createAnimations(animations) {
|
|
30
72
|
return {
|
|
31
|
-
View: import_react_native_reanimated.default.View,
|
|
32
|
-
Text: import_react_native_reanimated.default.Text,
|
|
73
|
+
View: import_web.isWeb ? AnimatedView : import_react_native_reanimated.default.View,
|
|
74
|
+
Text: import_web.isWeb ? AnimatedText : import_react_native_reanimated.default.Text,
|
|
33
75
|
isReactNative: !0,
|
|
34
76
|
animations,
|
|
35
77
|
usePresence: import_use_presence.usePresence,
|
|
@@ -83,26 +125,14 @@ function createAnimations(animations) {
|
|
|
83
125
|
dontAnimate = style;
|
|
84
126
|
else {
|
|
85
127
|
const animateOnly = props.animateOnly;
|
|
86
|
-
|
|
87
|
-
dontAnimate =
|
|
88
|
-
for (const key of animateOnly)
|
|
89
|
-
key in style && (animate[key] = style[key], delete dontAnimate[key]);
|
|
90
|
-
} else
|
|
91
|
-
animate = style;
|
|
128
|
+
for (const key in style)
|
|
129
|
+
!import_web.stylePropsAll[key] || neverAnimate[key] || animateOnly && !animateOnly.includes(key) ? dontAnimate[key] = style[key] : animate[key] = style[key];
|
|
92
130
|
}
|
|
93
|
-
const animateStr = JSON.stringify(animate), styles = (0, import_react.useMemo)(() => JSON.parse(animateStr), [animateStr]), isExiting = !!presence?.[1],
|
|
94
|
-
onDidAnimate?.(), sendExitComplete?.();
|
|
95
|
-
}, []), motiProps = {
|
|
131
|
+
const animateStr = JSON.stringify(animate), styles = (0, import_react.useMemo)(() => JSON.parse(animateStr), [animateStr]), isExiting = !!presence?.[1], presenceContext = (0, import_react.useContext)(import_use_presence.PresenceContext), usePresenceValue = presence || void 0, motiProps = {
|
|
96
132
|
animate: isExiting || isHydrating ? {} : styles,
|
|
97
133
|
transition: animations[animationKey],
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
// : componentState.unmounted
|
|
101
|
-
// ? { type: 'timing', duration: 0 }
|
|
102
|
-
// : animations[animationKey as keyof typeof animations]
|
|
103
|
-
onDidAnimate: onDidAnimateCombined,
|
|
104
|
-
usePresenceValue: presence,
|
|
105
|
-
presenceContext: (0, import_react.useContext)(import_use_presence.PresenceContext),
|
|
134
|
+
usePresenceValue,
|
|
135
|
+
presenceContext,
|
|
106
136
|
exit: isExiting ? styles : void 0
|
|
107
137
|
}, moti = (0, import_author.useMotify)(motiProps);
|
|
108
138
|
return process.env.NODE_ENV === "development" && props.debug && console.info("useMotify(", JSON.stringify(motiProps, null, 2) + ")", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/createAnimations.tsx"],
|
|
4
|
-
"mappings": ";;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ations: () => createAnimations
|
|
27
27
|
});
|
|
28
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"));
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime"), import_use_presence = require("@tamagui/use-presence"), import_web = require("@tamagui/web"), import_author = require("moti/author"), import_react = require("react"), import_react_native_reanimated = __toESM(require("react-native-reanimated"));
|
|
30
30
|
function _define_property(obj, key, value) {
|
|
31
31
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
32
32
|
value,
|
|
@@ -37,19 +37,99 @@ function _define_property(obj, key, value) {
|
|
|
37
37
|
}
|
|
38
38
|
function _object_spread(target) {
|
|
39
39
|
for (var i = 1; i < arguments.length; i++) {
|
|
40
|
-
var source = arguments[i] != null ? arguments[i] : {},
|
|
41
|
-
typeof Object.getOwnPropertySymbols == "function" && (
|
|
40
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
41
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
42
42
|
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
43
|
-
}))),
|
|
43
|
+
}))), ownKeys2.forEach(function(key) {
|
|
44
44
|
_define_property(target, key, source[key]);
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
return target;
|
|
48
48
|
}
|
|
49
|
+
function ownKeys(object, enumerableOnly) {
|
|
50
|
+
var keys = Object.keys(object);
|
|
51
|
+
if (Object.getOwnPropertySymbols) {
|
|
52
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
53
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
54
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
55
|
+
})), keys.push.apply(keys, symbols);
|
|
56
|
+
}
|
|
57
|
+
return keys;
|
|
58
|
+
}
|
|
59
|
+
function _object_spread_props(target, source) {
|
|
60
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
61
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
62
|
+
}), target;
|
|
63
|
+
}
|
|
64
|
+
function _object_without_properties(source, excluded) {
|
|
65
|
+
if (source == null)
|
|
66
|
+
return {};
|
|
67
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
68
|
+
if (Object.getOwnPropertySymbols) {
|
|
69
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
70
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
71
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
72
|
+
}
|
|
73
|
+
return target;
|
|
74
|
+
}
|
|
75
|
+
function _object_without_properties_loose(source, excluded) {
|
|
76
|
+
if (source == null)
|
|
77
|
+
return {};
|
|
78
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
79
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
80
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
81
|
+
return target;
|
|
82
|
+
}
|
|
83
|
+
function createTamaguiAnimatedComponent() {
|
|
84
|
+
var tag = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "div", Component = import_react_native_reanimated.default.createAnimatedComponent(/* @__PURE__ */ (0, import_react.forwardRef)(function(_param, ref) {
|
|
85
|
+
var forwardedRef = _param.forwardedRef, style = _param.style, props = _object_without_properties(_param, [
|
|
86
|
+
"forwardedRef",
|
|
87
|
+
"style"
|
|
88
|
+
]), composedRefs = (0, import_web.useComposedRefs)(forwardedRef, ref), Element = props.tag || tag;
|
|
89
|
+
return style && Array.isArray(style.transform) && (style.transform = (0, import_web.transformsToString)(style.transform)), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Element, _object_spread_props(_object_spread({}, props), {
|
|
90
|
+
style,
|
|
91
|
+
ref: composedRefs
|
|
92
|
+
}));
|
|
93
|
+
}));
|
|
94
|
+
return Component.acceptTagProp = !0, Component;
|
|
95
|
+
}
|
|
96
|
+
var AnimatedView = createTamaguiAnimatedComponent("div"), AnimatedText = createTamaguiAnimatedComponent("span"), neverAnimate = {
|
|
97
|
+
alignItems: !0,
|
|
98
|
+
backdropFilter: !0,
|
|
99
|
+
borderBottomStyle: !0,
|
|
100
|
+
borderLeftStyle: !0,
|
|
101
|
+
borderRightStyle: !0,
|
|
102
|
+
borderStyle: !0,
|
|
103
|
+
borderTopStyle: !0,
|
|
104
|
+
boxSizing: !0,
|
|
105
|
+
contain: !0,
|
|
106
|
+
cursor: !0,
|
|
107
|
+
display: !0,
|
|
108
|
+
flexBasis: !0,
|
|
109
|
+
flexDirection: !0,
|
|
110
|
+
flexShrink: !0,
|
|
111
|
+
justifyContent: !0,
|
|
112
|
+
maxHeight: !0,
|
|
113
|
+
maxWidth: !0,
|
|
114
|
+
minHeight: !0,
|
|
115
|
+
minWidth: !0,
|
|
116
|
+
outlineStyle: !0,
|
|
117
|
+
overflow: !0,
|
|
118
|
+
overflowX: !0,
|
|
119
|
+
overflowY: !0,
|
|
120
|
+
pointerEvents: !0,
|
|
121
|
+
position: !0,
|
|
122
|
+
shadowColor: !0,
|
|
123
|
+
textAlign: !0,
|
|
124
|
+
textOverflow: !0,
|
|
125
|
+
whiteSpace: !0,
|
|
126
|
+
wordWrap: !0,
|
|
127
|
+
zIndex: !0
|
|
128
|
+
};
|
|
49
129
|
function createAnimations(animations) {
|
|
50
130
|
return {
|
|
51
|
-
View: import_react_native_reanimated.default.View,
|
|
52
|
-
Text: import_react_native_reanimated.default.Text,
|
|
131
|
+
View: import_web.isWeb ? AnimatedView : import_react_native_reanimated.default.View,
|
|
132
|
+
Text: import_web.isWeb ? AnimatedText : import_react_native_reanimated.default.Text,
|
|
53
133
|
isReactNative: !0,
|
|
54
134
|
animations,
|
|
55
135
|
usePresence: import_use_presence.usePresence,
|
|
@@ -131,44 +211,18 @@ function createAnimations(animations) {
|
|
|
131
211
|
dontAnimate = style;
|
|
132
212
|
else {
|
|
133
213
|
var animateOnly = props.animateOnly;
|
|
134
|
-
|
|
135
|
-
dontAnimate =
|
|
136
|
-
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
137
|
-
try {
|
|
138
|
-
for (var _iterator = animateOnly[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
139
|
-
var key = _step.value;
|
|
140
|
-
key in style && (animate[key] = style[key], delete dontAnimate[key]);
|
|
141
|
-
}
|
|
142
|
-
} catch (err) {
|
|
143
|
-
_didIteratorError = !0, _iteratorError = err;
|
|
144
|
-
} finally {
|
|
145
|
-
try {
|
|
146
|
-
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
147
|
-
} finally {
|
|
148
|
-
if (_didIteratorError)
|
|
149
|
-
throw _iteratorError;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
} else
|
|
153
|
-
animate = style;
|
|
214
|
+
for (var key in style)
|
|
215
|
+
!import_web.stylePropsAll[key] || neverAnimate[key] || animateOnly && !animateOnly.includes(key) ? dontAnimate[key] = style[key] : animate[key] = style[key];
|
|
154
216
|
}
|
|
155
217
|
var animateStr = JSON.stringify(animate), styles = (0, import_react.useMemo)(function() {
|
|
156
218
|
return JSON.parse(animateStr);
|
|
157
219
|
}, [
|
|
158
220
|
animateStr
|
|
159
|
-
]), isExiting = !!(presence != null && presence[1]),
|
|
160
|
-
onDidAnimate == null || onDidAnimate(), sendExitComplete == null || sendExitComplete();
|
|
161
|
-
}, []), motiProps = {
|
|
221
|
+
]), isExiting = !!(presence != null && presence[1]), presenceContext = (0, import_react.useContext)(import_use_presence.PresenceContext), usePresenceValue = presence || void 0, motiProps = {
|
|
162
222
|
animate: isExiting || isHydrating ? {} : styles,
|
|
163
223
|
transition: animations[animationKey],
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
// : componentState.unmounted
|
|
167
|
-
// ? { type: 'timing', duration: 0 }
|
|
168
|
-
// : animations[animationKey as keyof typeof animations]
|
|
169
|
-
onDidAnimate: onDidAnimateCombined,
|
|
170
|
-
usePresenceValue: presence,
|
|
171
|
-
presenceContext: (0, import_react.useContext)(import_use_presence.PresenceContext),
|
|
224
|
+
usePresenceValue,
|
|
225
|
+
presenceContext,
|
|
172
226
|
exit: isExiting ? styles : void 0
|
|
173
227
|
}, moti = (0, import_author.useMotify)(motiProps);
|
|
174
228
|
return process.env.NODE_ENV === "development" && props.debug && console.info("useMotify(", JSON.stringify(motiProps, null, 2) + ")", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/packages/animations-moti/src/createAnimations.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
5
|
-
"names": ["createAnimations", "animations", "View", "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,sBAA4D,kCAC5D,aAOO,yBAEP,gBAA0B,wBAC1B,eAAgD,kBAEhD,iCASO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIP,SAASA,iCAAAA;MAA+BC,MAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAM,OACtCC,YAAYC,+BAAAA,QAASC,wBACzBC,6CAAW,SAAA,QAAyCC,KAAAA;QAAtCC,eAAAA,OAAAA,cAAcC,QAAAA,OAAAA,OAAUC,QAAAA,2BAAAA,QAAAA;MAAxBF;MAAcC;QACpBE,mBAAeC,4BAA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AC1B,iBAAWC,OAAO5F;AAChB,UACE,CAAC6F,yBAAcD,GAAAA,KACfhF,aAAagF,GAAAA,KACZD,eAAe,CAACA,YAAYG,SAASF,GAAAA,IAEtCF,YAAYE,GAAAA,IAAO5F,MAAM4F,GAAAA,IAEzBH,QAAQG,GAAAA,IAAO5F,MAAM4F,GAAAA;MAG3B;AAIA,UAAMG,aAAaC,KAAKC,UAAUR,OAAAA,GAC5BS,aAAS1C,sBAAQ,WAAA;eAAMwC,KAAKG,MAAMJ,UAAAA;SAAa;QAACA;OAAW,GAE3DK,YAAYC,GAAQnB,YAAAA,QAAAA,SAAW,CAAA,IAC/BoB,sBAAkBC,yBAAWC,mCAAAA,GAC7BC,mBAAoBvB,YAAYwB,QAIhCC,YAAY;QAChBlB,SAASW,aAAab,cAAc,CAAC,IAAIW;QACzCU,YAAY/D,WAAWwC,YAAAA;QACvBoB;QACAH;QACAO,MAAMT,YAAYF,SAASQ;MAC7B,GAEMI,WAAOC,yBAAUJ,SAAAA;AAEvB,aAAIK,QAAQC,IAAIC,aAAa,iBAAiBjH,MAAM,SAClDkH,QAAQC,KAAM,cAAapB,KAAKC,UAAUU,WAAW,MAAM,CAAA,IAAK,KAAK;QACnE1B;QACA0B;QACAG;QACA9G,OAAO;UAAC0F;UAAaoB,KAAK9G;;MAC5B,CAAA,GAGK;QACLA,OAAO;UAAC0F;UAAaoB,KAAK9G;;MAC5B;IACF;EACF;AACF;",
|
|
5
|
+
"names": ["createTamaguiAnimatedComponent", "tag", "Component", "Animated", "createAnimatedComponent", "forwardRef", "ref", "forwardedRef", "style", "props", "composedRefs", "useComposedRefs", "Element", "Array", "isArray", "transform", "transformsToString", "_jsx", "AnimatedView", "AnimatedText", "neverAnimate", "alignItems", "backdropFilter", "borderBottomStyle", "borderLeftStyle", "borderRightStyle", "borderStyle", "borderTopStyle", "boxSizing", "contain", "cursor", "display", "flexBasis", "flexDirection", "flexShrink", "justifyContent", "maxHeight", "maxWidth", "minHeight", "minWidth", "outlineStyle", "overflow", "overflowX", "overflowY", "pointerEvents", "position", "shadowColor", "textAlign", "textOverflow", "whiteSpace", "wordWrap", "zIndex", "createAnimations", "animations", "View", "isWeb", "Text", "isReactNative", "usePresence", "ResetPresence", "useAnimatedNumber", "initial", "sharedValue", "useSharedValue", "useMemo", "getInstance", "getValue", "value", "setValue", "next", "config", "type", "withSpring", "withTiming", "stop", "cancelAnimation", "useAnimatedNumberReaction", "onValue", "instance", "useAnimatedReaction", "prev", "runOnJS", "useAnimatedNumberStyle", "val", "getStyle", "derivedValue", "useDerivedValue", "useAnimatedStyle", "useAnimations", "animationProps", "presence", "onDidAnimate", "componentState", "animationKey", "animation", "isHydrating", "unmounted", "animate", "dontAnimate", "animateOnly", "key", "stylePropsAll", "includes", "animateStr", "JSON", "stringify", "styles", "parse", "isExiting", "Boolean", "presenceContext", "useContext", "PresenceContext", "usePresenceValue", "undefined", "motiProps", "transition", "exit", "moti", "useMotify", "process", "env", "NODE_ENV", "console", "info"]
|
|
6
6
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { PresenceContext, ResetPresence, usePresence } from "@tamagui/use-presence";
|
|
2
|
+
import {
|
|
3
|
+
isWeb,
|
|
4
|
+
transformsToString,
|
|
5
|
+
useComposedRefs,
|
|
6
|
+
stylePropsAll
|
|
7
|
+
} from "@tamagui/web";
|
|
2
8
|
import { useMotify } from "moti/author";
|
|
3
|
-
import {
|
|
9
|
+
import { forwardRef, useContext, useMemo } from "react";
|
|
4
10
|
import Animated, {
|
|
5
11
|
cancelAnimation,
|
|
6
12
|
runOnJS,
|
|
@@ -11,10 +17,53 @@ import Animated, {
|
|
|
11
17
|
withSpring,
|
|
12
18
|
withTiming
|
|
13
19
|
} from "react-native-reanimated";
|
|
20
|
+
import { jsx } from "react/jsx-runtime";
|
|
21
|
+
function createTamaguiAnimatedComponent(tag = "div") {
|
|
22
|
+
const Component = Animated.createAnimatedComponent(
|
|
23
|
+
forwardRef(({ forwardedRef, style, ...props }, ref) => {
|
|
24
|
+
const composedRefs = useComposedRefs(forwardedRef, ref), Element = props.tag || tag;
|
|
25
|
+
return style && Array.isArray(style.transform) && (style.transform = transformsToString(style.transform)), /* @__PURE__ */ jsx(Element, { ...props, style, ref: composedRefs });
|
|
26
|
+
})
|
|
27
|
+
);
|
|
28
|
+
return Component.acceptTagProp = !0, Component;
|
|
29
|
+
}
|
|
30
|
+
const AnimatedView = createTamaguiAnimatedComponent("div"), AnimatedText = createTamaguiAnimatedComponent("span"), neverAnimate = {
|
|
31
|
+
alignItems: !0,
|
|
32
|
+
backdropFilter: !0,
|
|
33
|
+
borderBottomStyle: !0,
|
|
34
|
+
borderLeftStyle: !0,
|
|
35
|
+
borderRightStyle: !0,
|
|
36
|
+
borderStyle: !0,
|
|
37
|
+
borderTopStyle: !0,
|
|
38
|
+
boxSizing: !0,
|
|
39
|
+
contain: !0,
|
|
40
|
+
cursor: !0,
|
|
41
|
+
display: !0,
|
|
42
|
+
flexBasis: !0,
|
|
43
|
+
flexDirection: !0,
|
|
44
|
+
flexShrink: !0,
|
|
45
|
+
justifyContent: !0,
|
|
46
|
+
maxHeight: !0,
|
|
47
|
+
maxWidth: !0,
|
|
48
|
+
minHeight: !0,
|
|
49
|
+
minWidth: !0,
|
|
50
|
+
outlineStyle: !0,
|
|
51
|
+
overflow: !0,
|
|
52
|
+
overflowX: !0,
|
|
53
|
+
overflowY: !0,
|
|
54
|
+
pointerEvents: !0,
|
|
55
|
+
position: !0,
|
|
56
|
+
shadowColor: !0,
|
|
57
|
+
textAlign: !0,
|
|
58
|
+
textOverflow: !0,
|
|
59
|
+
whiteSpace: !0,
|
|
60
|
+
wordWrap: !0,
|
|
61
|
+
zIndex: !0
|
|
62
|
+
};
|
|
14
63
|
function createAnimations(animations) {
|
|
15
64
|
return {
|
|
16
|
-
View: Animated.View,
|
|
17
|
-
Text: Animated.Text,
|
|
65
|
+
View: isWeb ? AnimatedView : Animated.View,
|
|
66
|
+
Text: isWeb ? AnimatedText : Animated.Text,
|
|
18
67
|
isReactNative: !0,
|
|
19
68
|
animations,
|
|
20
69
|
usePresence,
|
|
@@ -68,26 +117,14 @@ function createAnimations(animations) {
|
|
|
68
117
|
dontAnimate = style;
|
|
69
118
|
else {
|
|
70
119
|
const animateOnly = props.animateOnly;
|
|
71
|
-
|
|
72
|
-
dontAnimate =
|
|
73
|
-
for (const key of animateOnly)
|
|
74
|
-
key in style && (animate[key] = style[key], delete dontAnimate[key]);
|
|
75
|
-
} else
|
|
76
|
-
animate = style;
|
|
120
|
+
for (const key in style)
|
|
121
|
+
!stylePropsAll[key] || neverAnimate[key] || animateOnly && !animateOnly.includes(key) ? dontAnimate[key] = style[key] : animate[key] = style[key];
|
|
77
122
|
}
|
|
78
|
-
const animateStr = JSON.stringify(animate), styles = useMemo(() => JSON.parse(animateStr), [animateStr]), isExiting = !!presence?.[1],
|
|
79
|
-
onDidAnimate?.(), sendExitComplete?.();
|
|
80
|
-
}, []), motiProps = {
|
|
123
|
+
const animateStr = JSON.stringify(animate), styles = useMemo(() => JSON.parse(animateStr), [animateStr]), isExiting = !!presence?.[1], presenceContext = useContext(PresenceContext), usePresenceValue = presence || void 0, motiProps = {
|
|
81
124
|
animate: isExiting || isHydrating ? {} : styles,
|
|
82
125
|
transition: animations[animationKey],
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
// : componentState.unmounted
|
|
86
|
-
// ? { type: 'timing', duration: 0 }
|
|
87
|
-
// : animations[animationKey as keyof typeof animations]
|
|
88
|
-
onDidAnimate: onDidAnimateCombined,
|
|
89
|
-
usePresenceValue: presence,
|
|
90
|
-
presenceContext: useContext(PresenceContext),
|
|
126
|
+
usePresenceValue,
|
|
127
|
+
presenceContext,
|
|
91
128
|
exit: isExiting ? styles : void 0
|
|
92
129
|
}, moti = useMotify(motiProps);
|
|
93
130
|
return process.env.NODE_ENV === "development" && props.debug && console.info("useMotify(", JSON.stringify(motiProps, null, 2) + ")", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1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;AAAA,IACF;AAAA,EACF;AACF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,11 +1,64 @@
|
|
|
1
1
|
import { PresenceContext, ResetPresence, usePresence } from "@tamagui/use-presence";
|
|
2
|
+
import { isWeb, transformsToString, useComposedRefs, stylePropsAll } from "@tamagui/web";
|
|
2
3
|
import { useMotify } from "moti/author";
|
|
3
|
-
import {
|
|
4
|
+
import { forwardRef, useContext, useMemo } from "react";
|
|
4
5
|
import Animated, { cancelAnimation, runOnJS, useAnimatedReaction, useAnimatedStyle, useDerivedValue, useSharedValue, withSpring, withTiming } from "react-native-reanimated";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function createTamaguiAnimatedComponent(tag = "div") {
|
|
8
|
+
const Component = Animated.createAnimatedComponent(forwardRef(({
|
|
9
|
+
forwardedRef,
|
|
10
|
+
style,
|
|
11
|
+
...props
|
|
12
|
+
}, ref) => {
|
|
13
|
+
const composedRefs = useComposedRefs(forwardedRef, ref),
|
|
14
|
+
Element = props.tag || tag;
|
|
15
|
+
return style && Array.isArray(style.transform) && (style.transform = transformsToString(style.transform)), /* @__PURE__ */jsx(Element, {
|
|
16
|
+
...props,
|
|
17
|
+
style,
|
|
18
|
+
ref: composedRefs
|
|
19
|
+
});
|
|
20
|
+
}));
|
|
21
|
+
return Component.acceptTagProp = !0, Component;
|
|
22
|
+
}
|
|
23
|
+
const AnimatedView = createTamaguiAnimatedComponent("div"),
|
|
24
|
+
AnimatedText = createTamaguiAnimatedComponent("span"),
|
|
25
|
+
neverAnimate = {
|
|
26
|
+
alignItems: !0,
|
|
27
|
+
backdropFilter: !0,
|
|
28
|
+
borderBottomStyle: !0,
|
|
29
|
+
borderLeftStyle: !0,
|
|
30
|
+
borderRightStyle: !0,
|
|
31
|
+
borderStyle: !0,
|
|
32
|
+
borderTopStyle: !0,
|
|
33
|
+
boxSizing: !0,
|
|
34
|
+
contain: !0,
|
|
35
|
+
cursor: !0,
|
|
36
|
+
display: !0,
|
|
37
|
+
flexBasis: !0,
|
|
38
|
+
flexDirection: !0,
|
|
39
|
+
flexShrink: !0,
|
|
40
|
+
justifyContent: !0,
|
|
41
|
+
maxHeight: !0,
|
|
42
|
+
maxWidth: !0,
|
|
43
|
+
minHeight: !0,
|
|
44
|
+
minWidth: !0,
|
|
45
|
+
outlineStyle: !0,
|
|
46
|
+
overflow: !0,
|
|
47
|
+
overflowX: !0,
|
|
48
|
+
overflowY: !0,
|
|
49
|
+
pointerEvents: !0,
|
|
50
|
+
position: !0,
|
|
51
|
+
shadowColor: !0,
|
|
52
|
+
textAlign: !0,
|
|
53
|
+
textOverflow: !0,
|
|
54
|
+
whiteSpace: !0,
|
|
55
|
+
wordWrap: !0,
|
|
56
|
+
zIndex: !0
|
|
57
|
+
};
|
|
5
58
|
function createAnimations(animations) {
|
|
6
59
|
return {
|
|
7
|
-
View: Animated.View,
|
|
8
|
-
Text: Animated.Text,
|
|
60
|
+
View: isWeb ? AnimatedView : Animated.View,
|
|
61
|
+
Text: isWeb ? AnimatedText : Animated.Text,
|
|
9
62
|
isReactNative: !0,
|
|
10
63
|
animations,
|
|
11
64
|
usePresence,
|
|
@@ -69,31 +122,18 @@ function createAnimations(animations) {
|
|
|
69
122
|
dontAnimate = {};
|
|
70
123
|
if (isHydrating) dontAnimate = style;else {
|
|
71
124
|
const animateOnly = props.animateOnly;
|
|
72
|
-
|
|
73
|
-
dontAnimate = {
|
|
74
|
-
...style
|
|
75
|
-
};
|
|
76
|
-
for (const key of animateOnly) key in style && (animate[key] = style[key], delete dontAnimate[key]);
|
|
77
|
-
} else animate = style;
|
|
125
|
+
for (const key in style) !stylePropsAll[key] || neverAnimate[key] || animateOnly && !animateOnly.includes(key) ? dontAnimate[key] = style[key] : animate[key] = style[key];
|
|
78
126
|
}
|
|
79
127
|
const animateStr = JSON.stringify(animate),
|
|
80
128
|
styles = useMemo(() => JSON.parse(animateStr), [animateStr]),
|
|
81
129
|
isExiting = !!presence?.[1],
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
onDidAnimate?.(), sendExitComplete?.();
|
|
85
|
-
}, []),
|
|
130
|
+
presenceContext = useContext(PresenceContext),
|
|
131
|
+
usePresenceValue = presence || void 0,
|
|
86
132
|
motiProps = {
|
|
87
133
|
animate: isExiting || isHydrating ? {} : styles,
|
|
88
134
|
transition: animations[animationKey],
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
// : componentState.unmounted
|
|
92
|
-
// ? { type: 'timing', duration: 0 }
|
|
93
|
-
// : animations[animationKey as keyof typeof animations]
|
|
94
|
-
onDidAnimate: onDidAnimateCombined,
|
|
95
|
-
usePresenceValue: presence,
|
|
96
|
-
presenceContext: useContext(PresenceContext),
|
|
135
|
+
usePresenceValue,
|
|
136
|
+
presenceContext,
|
|
97
137
|
exit: isExiting ? styles : void 0
|
|
98
138
|
},
|
|
99
139
|
moti = useMotify(motiProps);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { PresenceContext, ResetPresence, usePresence } from "@tamagui/use-presence";
|
|
3
|
+
import { isWeb, transformsToString, useComposedRefs, stylePropsAll } from "@tamagui/web";
|
|
2
4
|
import { useMotify } from "moti/author";
|
|
3
|
-
import {
|
|
5
|
+
import { forwardRef, useContext, useMemo } from "react";
|
|
4
6
|
import Animated, { cancelAnimation, runOnJS, useAnimatedReaction, useAnimatedStyle, useDerivedValue, useSharedValue, withSpring, withTiming } from "react-native-reanimated";
|
|
5
7
|
function _define_property(obj, key, value) {
|
|
6
8
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
@@ -12,19 +14,99 @@ function _define_property(obj, key, value) {
|
|
|
12
14
|
}
|
|
13
15
|
function _object_spread(target) {
|
|
14
16
|
for (var i = 1; i < arguments.length; i++) {
|
|
15
|
-
var source = arguments[i] != null ? arguments[i] : {},
|
|
16
|
-
typeof Object.getOwnPropertySymbols == "function" && (
|
|
17
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
18
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
17
19
|
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
18
|
-
}))),
|
|
20
|
+
}))), ownKeys2.forEach(function(key) {
|
|
19
21
|
_define_property(target, key, source[key]);
|
|
20
22
|
});
|
|
21
23
|
}
|
|
22
24
|
return target;
|
|
23
25
|
}
|
|
26
|
+
function ownKeys(object, enumerableOnly) {
|
|
27
|
+
var keys = Object.keys(object);
|
|
28
|
+
if (Object.getOwnPropertySymbols) {
|
|
29
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
30
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
31
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
32
|
+
})), keys.push.apply(keys, symbols);
|
|
33
|
+
}
|
|
34
|
+
return keys;
|
|
35
|
+
}
|
|
36
|
+
function _object_spread_props(target, source) {
|
|
37
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
38
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
39
|
+
}), target;
|
|
40
|
+
}
|
|
41
|
+
function _object_without_properties(source, excluded) {
|
|
42
|
+
if (source == null)
|
|
43
|
+
return {};
|
|
44
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
45
|
+
if (Object.getOwnPropertySymbols) {
|
|
46
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
47
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
48
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
49
|
+
}
|
|
50
|
+
return target;
|
|
51
|
+
}
|
|
52
|
+
function _object_without_properties_loose(source, excluded) {
|
|
53
|
+
if (source == null)
|
|
54
|
+
return {};
|
|
55
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
56
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
57
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
58
|
+
return target;
|
|
59
|
+
}
|
|
60
|
+
function createTamaguiAnimatedComponent() {
|
|
61
|
+
var tag = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "div", Component = Animated.createAnimatedComponent(/* @__PURE__ */ forwardRef(function(_param, ref) {
|
|
62
|
+
var forwardedRef = _param.forwardedRef, style = _param.style, props = _object_without_properties(_param, [
|
|
63
|
+
"forwardedRef",
|
|
64
|
+
"style"
|
|
65
|
+
]), composedRefs = useComposedRefs(forwardedRef, ref), Element = props.tag || tag;
|
|
66
|
+
return style && Array.isArray(style.transform) && (style.transform = transformsToString(style.transform)), /* @__PURE__ */ _jsx(Element, _object_spread_props(_object_spread({}, props), {
|
|
67
|
+
style,
|
|
68
|
+
ref: composedRefs
|
|
69
|
+
}));
|
|
70
|
+
}));
|
|
71
|
+
return Component.acceptTagProp = !0, Component;
|
|
72
|
+
}
|
|
73
|
+
var AnimatedView = createTamaguiAnimatedComponent("div"), AnimatedText = createTamaguiAnimatedComponent("span"), neverAnimate = {
|
|
74
|
+
alignItems: !0,
|
|
75
|
+
backdropFilter: !0,
|
|
76
|
+
borderBottomStyle: !0,
|
|
77
|
+
borderLeftStyle: !0,
|
|
78
|
+
borderRightStyle: !0,
|
|
79
|
+
borderStyle: !0,
|
|
80
|
+
borderTopStyle: !0,
|
|
81
|
+
boxSizing: !0,
|
|
82
|
+
contain: !0,
|
|
83
|
+
cursor: !0,
|
|
84
|
+
display: !0,
|
|
85
|
+
flexBasis: !0,
|
|
86
|
+
flexDirection: !0,
|
|
87
|
+
flexShrink: !0,
|
|
88
|
+
justifyContent: !0,
|
|
89
|
+
maxHeight: !0,
|
|
90
|
+
maxWidth: !0,
|
|
91
|
+
minHeight: !0,
|
|
92
|
+
minWidth: !0,
|
|
93
|
+
outlineStyle: !0,
|
|
94
|
+
overflow: !0,
|
|
95
|
+
overflowX: !0,
|
|
96
|
+
overflowY: !0,
|
|
97
|
+
pointerEvents: !0,
|
|
98
|
+
position: !0,
|
|
99
|
+
shadowColor: !0,
|
|
100
|
+
textAlign: !0,
|
|
101
|
+
textOverflow: !0,
|
|
102
|
+
whiteSpace: !0,
|
|
103
|
+
wordWrap: !0,
|
|
104
|
+
zIndex: !0
|
|
105
|
+
};
|
|
24
106
|
function createAnimations(animations) {
|
|
25
107
|
return {
|
|
26
|
-
View: Animated.View,
|
|
27
|
-
Text: Animated.Text,
|
|
108
|
+
View: isWeb ? AnimatedView : Animated.View,
|
|
109
|
+
Text: isWeb ? AnimatedText : Animated.Text,
|
|
28
110
|
isReactNative: !0,
|
|
29
111
|
animations,
|
|
30
112
|
usePresence,
|
|
@@ -106,44 +188,18 @@ function createAnimations(animations) {
|
|
|
106
188
|
dontAnimate = style;
|
|
107
189
|
else {
|
|
108
190
|
var animateOnly = props.animateOnly;
|
|
109
|
-
|
|
110
|
-
dontAnimate =
|
|
111
|
-
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
112
|
-
try {
|
|
113
|
-
for (var _iterator = animateOnly[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
114
|
-
var key = _step.value;
|
|
115
|
-
key in style && (animate[key] = style[key], delete dontAnimate[key]);
|
|
116
|
-
}
|
|
117
|
-
} catch (err) {
|
|
118
|
-
_didIteratorError = !0, _iteratorError = err;
|
|
119
|
-
} finally {
|
|
120
|
-
try {
|
|
121
|
-
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
122
|
-
} finally {
|
|
123
|
-
if (_didIteratorError)
|
|
124
|
-
throw _iteratorError;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
} else
|
|
128
|
-
animate = style;
|
|
191
|
+
for (var key in style)
|
|
192
|
+
!stylePropsAll[key] || neverAnimate[key] || animateOnly && !animateOnly.includes(key) ? dontAnimate[key] = style[key] : animate[key] = style[key];
|
|
129
193
|
}
|
|
130
194
|
var animateStr = JSON.stringify(animate), styles = useMemo(function() {
|
|
131
195
|
return JSON.parse(animateStr);
|
|
132
196
|
}, [
|
|
133
197
|
animateStr
|
|
134
|
-
]), isExiting = !!(presence != null && presence[1]),
|
|
135
|
-
onDidAnimate == null || onDidAnimate(), sendExitComplete == null || sendExitComplete();
|
|
136
|
-
}, []), motiProps = {
|
|
198
|
+
]), isExiting = !!(presence != null && presence[1]), presenceContext = useContext(PresenceContext), usePresenceValue = presence || void 0, motiProps = {
|
|
137
199
|
animate: isExiting || isHydrating ? {} : styles,
|
|
138
200
|
transition: animations[animationKey],
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
// : componentState.unmounted
|
|
142
|
-
// ? { type: 'timing', duration: 0 }
|
|
143
|
-
// : animations[animationKey as keyof typeof animations]
|
|
144
|
-
onDidAnimate: onDidAnimateCombined,
|
|
145
|
-
usePresenceValue: presence,
|
|
146
|
-
presenceContext: useContext(PresenceContext),
|
|
201
|
+
usePresenceValue,
|
|
202
|
+
presenceContext,
|
|
147
203
|
exit: isExiting ? styles : void 0
|
|
148
204
|
}, moti = useMotify(motiProps);
|
|
149
205
|
return process.env.NODE_ENV === "development" && props.debug && console.info("useMotify(", JSON.stringify(motiProps, null, 2) + ")", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/packages/animations-moti/src/createAnimations.tsx"],
|
|
4
|
-
"mappings": "AAAA,SAASA,iBAAiBC,eAAeC,mBAAmB;
|
|
5
|
-
"names": ["PresenceContext", "ResetPresence", "usePresence", "useMotify", "
|
|
4
|
+
"mappings": ";AAAA,SA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AM,CAAA,IAAK,KAAK;QACnEvB;QACAuB;QACAG;QACA5F,OAAO;UAAC2E;UAAaiB,KAAK5F;;MAC5B,CAAA,GAGK;QACLA,OAAO;UAAC2E;UAAaiB,KAAK5F;;MAC5B;IACF;EACF;AACF;",
|
|
5
|
+
"names": ["PresenceContext", "ResetPresence", "usePresence", "isWeb", "transformsToString", "useComposedRefs", "stylePropsAll", "useMotify", "forwardRef", "useContext", "useMemo", "Animated", "cancelAnimation", "runOnJS", "useAnimatedReaction", "useAnimatedStyle", "useDerivedValue", "useSharedValue", "withSpring", "withTiming", "createTamaguiAnimatedComponent", "tag", "Component", "createAnimatedComponent", "ref", "forwardedRef", "style", "props", "composedRefs", "Element", "Array", "isArray", "transform", "AnimatedView", "AnimatedText", "neverAnimate", "alignItems", "backdropFilter", "borderBottomStyle", "borderLeftStyle", "borderRightStyle", "borderStyle", "borderTopStyle", "boxSizing", "contain", "cursor", "display", "flexBasis", "flexDirection", "flexShrink", "justifyContent", "maxHeight", "maxWidth", "minHeight", "minWidth", "outlineStyle", "overflow", "overflowX", "overflowY", "pointerEvents", "position", "shadowColor", "textAlign", "textOverflow", "whiteSpace", "wordWrap", "zIndex", "createAnimations", "animations", "View", "Text", "isReactNative", "useAnimatedNumber", "initial", "sharedValue", "getInstance", "getValue", "value", "setValue", "next", "config", "type", "stop", "useAnimatedNumberReaction", "onValue", "instance", "prev", "useAnimatedNumberStyle", "val", "getStyle", "derivedValue", "useAnimations", "animationProps", "presence", "onDidAnimate", "componentState", "animationKey", "animation", "isHydrating", "unmounted", "animate", "dontAnimate", "animateOnly", "key", "includes", "animateStr", "JSON", "stringify", "styles", "parse", "isExiting", "Boolean", "presenceContext", "usePresenceValue", "undefined", "motiProps", "transition", "exit", "moti", "process", "env", "NODE_ENV", "console", "info"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/animations-moti",
|
|
3
|
-
"version": "1.90.
|
|
3
|
+
"version": "1.90.4",
|
|
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.90.
|
|
19
|
-
"@tamagui/web": "1.90.
|
|
20
|
-
"moti": "^0.27.
|
|
18
|
+
"@tamagui/use-presence": "1.90.4",
|
|
19
|
+
"@tamagui/web": "1.90.4",
|
|
20
|
+
"moti": "^0.27.4",
|
|
21
21
|
"react": "^18.2.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@tamagui/build": "1.90.
|
|
24
|
+
"@tamagui/build": "1.90.4",
|
|
25
25
|
"react-native-reanimated": "~3.6.2"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
package/src/createAnimations.tsx
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { PresenceContext, ResetPresence, usePresence } from '@tamagui/use-presence'
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
isWeb,
|
|
4
|
+
transformsToString,
|
|
5
|
+
useComposedRefs,
|
|
6
|
+
stylePropsAll,
|
|
7
|
+
type AnimationDriver,
|
|
8
|
+
type UniversalAnimatedNumber,
|
|
9
|
+
} from '@tamagui/web'
|
|
3
10
|
import type { MotiTransition } from 'moti'
|
|
4
11
|
import { useMotify } from 'moti/author'
|
|
5
|
-
import {
|
|
12
|
+
import { forwardRef, useContext, useMemo } from 'react'
|
|
6
13
|
import type { SharedValue } from 'react-native-reanimated'
|
|
7
14
|
import Animated, {
|
|
8
15
|
cancelAnimation,
|
|
@@ -17,12 +24,65 @@ import Animated, {
|
|
|
17
24
|
|
|
18
25
|
type ReanimatedAnimatedNumber = SharedValue<number>
|
|
19
26
|
|
|
27
|
+
function createTamaguiAnimatedComponent(tag = 'div') {
|
|
28
|
+
const Component = Animated.createAnimatedComponent(
|
|
29
|
+
forwardRef(({ forwardedRef, style, ...props }: any, ref) => {
|
|
30
|
+
const composedRefs = useComposedRefs(forwardedRef, ref)
|
|
31
|
+
const Element = props.tag || tag
|
|
32
|
+
// we can probably just use stringifyTransforms? it seems almost fully normalized
|
|
33
|
+
if (style && Array.isArray(style.transform)) {
|
|
34
|
+
style.transform = transformsToString(style.transform)
|
|
35
|
+
}
|
|
36
|
+
return <Element {...props} style={style} ref={composedRefs} />
|
|
37
|
+
})
|
|
38
|
+
)
|
|
39
|
+
Component['acceptTagProp'] = true
|
|
40
|
+
return Component
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const AnimatedView = createTamaguiAnimatedComponent('div')
|
|
44
|
+
const AnimatedText = createTamaguiAnimatedComponent('span')
|
|
45
|
+
|
|
46
|
+
const neverAnimate = {
|
|
47
|
+
alignItems: true,
|
|
48
|
+
backdropFilter: true,
|
|
49
|
+
borderBottomStyle: true,
|
|
50
|
+
borderLeftStyle: true,
|
|
51
|
+
borderRightStyle: true,
|
|
52
|
+
borderStyle: true,
|
|
53
|
+
borderTopStyle: true,
|
|
54
|
+
boxSizing: true,
|
|
55
|
+
contain: true,
|
|
56
|
+
cursor: true,
|
|
57
|
+
display: true,
|
|
58
|
+
flexBasis: true,
|
|
59
|
+
flexDirection: true,
|
|
60
|
+
flexShrink: true,
|
|
61
|
+
justifyContent: true,
|
|
62
|
+
maxHeight: true,
|
|
63
|
+
maxWidth: true,
|
|
64
|
+
minHeight: true,
|
|
65
|
+
minWidth: true,
|
|
66
|
+
outlineStyle: true,
|
|
67
|
+
overflow: true,
|
|
68
|
+
overflowX: true,
|
|
69
|
+
overflowY: true,
|
|
70
|
+
pointerEvents: true,
|
|
71
|
+
position: true,
|
|
72
|
+
shadowColor: true,
|
|
73
|
+
textAlign: true,
|
|
74
|
+
textOverflow: true,
|
|
75
|
+
whiteSpace: true,
|
|
76
|
+
wordWrap: true,
|
|
77
|
+
zIndex: true,
|
|
78
|
+
}
|
|
79
|
+
|
|
20
80
|
export function createAnimations<A extends Record<string, MotiTransition>>(
|
|
21
81
|
animations: A
|
|
22
82
|
): AnimationDriver<A> {
|
|
23
83
|
return {
|
|
24
|
-
View: Animated.View,
|
|
25
|
-
Text: Animated.Text,
|
|
84
|
+
View: isWeb ? AnimatedView : Animated.View,
|
|
85
|
+
Text: isWeb ? AnimatedText : Animated.Text,
|
|
26
86
|
isReactNative: true,
|
|
27
87
|
animations,
|
|
28
88
|
usePresence,
|
|
@@ -109,17 +169,17 @@ export function createAnimations<A extends Record<string, MotiTransition>>(
|
|
|
109
169
|
if (isHydrating) {
|
|
110
170
|
dontAnimate = style
|
|
111
171
|
} else {
|
|
112
|
-
const animateOnly = props.animateOnly
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
172
|
+
const animateOnly = props.animateOnly as string[]
|
|
173
|
+
for (const key in style) {
|
|
174
|
+
if (
|
|
175
|
+
!stylePropsAll[key] ||
|
|
176
|
+
neverAnimate[key] ||
|
|
177
|
+
(animateOnly && !animateOnly.includes(key))
|
|
178
|
+
) {
|
|
179
|
+
dontAnimate[key] = style[key]
|
|
180
|
+
} else {
|
|
181
|
+
animate[key] = style[key]
|
|
120
182
|
}
|
|
121
|
-
} else {
|
|
122
|
-
animate = style
|
|
123
183
|
}
|
|
124
184
|
}
|
|
125
185
|
|
|
@@ -129,26 +189,16 @@ export function createAnimations<A extends Record<string, MotiTransition>>(
|
|
|
129
189
|
const styles = useMemo(() => JSON.parse(animateStr), [animateStr])
|
|
130
190
|
|
|
131
191
|
const isExiting = Boolean(presence?.[1])
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
const onDidAnimateCombined = useCallback(() => {
|
|
135
|
-
onDidAnimate?.()
|
|
136
|
-
sendExitComplete?.()
|
|
137
|
-
}, [])
|
|
192
|
+
const presenceContext = useContext(PresenceContext)
|
|
193
|
+
const usePresenceValue = (presence || undefined) as any
|
|
138
194
|
|
|
139
195
|
type UseMotiProps = Parameters<typeof useMotify>[0]
|
|
140
196
|
|
|
141
197
|
const motiProps = {
|
|
142
198
|
animate: isExiting || isHydrating ? {} : styles,
|
|
143
199
|
transition: animations[animationKey as keyof typeof animations],
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
// : componentState.unmounted
|
|
147
|
-
// ? { type: 'timing', duration: 0 }
|
|
148
|
-
// : animations[animationKey as keyof typeof animations]
|
|
149
|
-
onDidAnimate: onDidAnimateCombined,
|
|
150
|
-
usePresenceValue: presence as any,
|
|
151
|
-
presenceContext: useContext(PresenceContext),
|
|
200
|
+
usePresenceValue,
|
|
201
|
+
presenceContext,
|
|
152
202
|
exit: isExiting ? styles : undefined,
|
|
153
203
|
} satisfies UseMotiProps
|
|
154
204
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AnimationDriver } from '@tamagui/web';
|
|
2
2
|
import type { MotiTransition } from 'moti';
|
|
3
3
|
export declare function createAnimations<A extends Record<string, MotiTransition>>(animations: A): AnimationDriver<A>;
|
|
4
4
|
//# sourceMappingURL=createAnimations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAnimations.d.ts","sourceRoot":"","sources":["../src/createAnimations.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"createAnimations.d.ts","sourceRoot":"","sources":["../src/createAnimations.tsx"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAA;AAsE1C,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,EACvE,UAAU,EAAE,CAAC,GACZ,eAAe,CAAC,CAAC,CAAC,CA2IpB"}
|