@tamagui/animations-motion 1.0.1-beta.20 → 1.0.1-beta.201
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 +1 -37
- package/dist/cjs/createAnimations.js.map +3 -3
- package/dist/cjs/index.js +1 -17
- package/dist/cjs/index.js.map +3 -3
- package/dist/esm/createAnimations.js +0 -15
- package/dist/esm/createAnimations.js.map +3 -3
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +3 -3
- package/dist/jsx/createAnimations.js +1 -15
- package/dist/jsx/createAnimations.js.map +7 -0
- package/dist/jsx/index.js +1 -1
- package/dist/jsx/index.js.map +7 -0
- package/package.json +5 -4
- package/src/createAnimations.tsx +143 -0
- package/src/index.tsx +1 -0
- package/types/createAnimations.d.ts +0 -6
- package/types/index.d.ts +0 -1
- package/types/createAnimations.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
|
@@ -1,38 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var createAnimations_exports = {};
|
|
20
|
-
__export(createAnimations_exports, {
|
|
21
|
-
createAnimations: () => createAnimations
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(createAnimations_exports);
|
|
24
|
-
function createAnimations(animations) {
|
|
25
|
-
const useAnimations = /* @__PURE__ */ __name((props, extra) => {
|
|
26
|
-
const { style, hoverStyle, pressStyle, exitStyle, onDidAnimate, delay } = extra;
|
|
27
|
-
}, "useAnimations");
|
|
28
|
-
return {
|
|
29
|
-
useAnimations,
|
|
30
|
-
animations
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
__name(createAnimations, "createAnimations");
|
|
34
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
-
0 && (module.exports = {
|
|
36
|
-
createAnimations
|
|
37
|
-
});
|
|
1
|
+
"use strict";
|
|
38
2
|
//# sourceMappingURL=createAnimations.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"mappings": "
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var src_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(src_exports);
|
|
17
|
-
__reExport(src_exports, require("./createAnimations"), module.exports);
|
|
1
|
+
"use strict";
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
function createAnimations(animations) {
|
|
4
|
-
const useAnimations = /* @__PURE__ */ __name((props, extra) => {
|
|
5
|
-
const { style, hoverStyle, pressStyle, exitStyle, onDidAnimate, delay } = extra;
|
|
6
|
-
}, "useAnimations");
|
|
7
|
-
return {
|
|
8
|
-
useAnimations,
|
|
9
|
-
animations
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
__name(createAnimations, "createAnimations");
|
|
13
|
-
export {
|
|
14
|
-
createAnimations
|
|
15
|
-
};
|
|
16
1
|
//# sourceMappingURL=createAnimations.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"mappings": "
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
function createAnimations(animations) {
|
|
4
|
-
const useAnimations = /* @__PURE__ */ __name((props, extra) => {
|
|
5
|
-
const { style, hoverStyle, pressStyle, exitStyle, onDidAnimate, delay } = extra;
|
|
6
|
-
}, "useAnimations");
|
|
7
|
-
return {
|
|
8
|
-
useAnimations,
|
|
9
|
-
animations
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
__name(createAnimations, "createAnimations");
|
|
13
|
-
export {
|
|
14
|
-
createAnimations
|
|
15
|
-
};
|
|
1
|
+
//# sourceMappingURL=createAnimations.js.map
|
package/dist/jsx/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/animations-motion",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.201",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"
|
|
6
|
+
"types": "./types/index.d.ts",
|
|
7
7
|
"main": "dist/cjs",
|
|
8
8
|
"module": "dist/esm",
|
|
9
9
|
"module:jsx": "dist/jsx",
|
|
10
10
|
"files": [
|
|
11
|
+
"src",
|
|
11
12
|
"types",
|
|
12
13
|
"dist"
|
|
13
14
|
],
|
|
14
15
|
"dependencies": {
|
|
15
|
-
"@tamagui/core": "^1.0.1-beta.
|
|
16
|
+
"@tamagui/core": "^1.0.1-beta.201"
|
|
16
17
|
},
|
|
17
18
|
"devDependencies": {
|
|
18
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
19
|
+
"@tamagui/build": "^1.0.1-beta.201"
|
|
19
20
|
},
|
|
20
21
|
"scripts": {
|
|
21
22
|
"build": "tamagui-build",
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// import { PresenceContext, usePresence } from '@tamagui/animate-presence'
|
|
2
|
+
// import {
|
|
3
|
+
// AnimatedNumberStrategy,
|
|
4
|
+
// AnimationConfigType,
|
|
5
|
+
// AnimationDriver,
|
|
6
|
+
// AnimationProp,
|
|
7
|
+
// UniversalAnimatedNumber,
|
|
8
|
+
// isWeb,
|
|
9
|
+
// useEvent,
|
|
10
|
+
// useIsomorphicLayoutEffect,
|
|
11
|
+
// } from '@tamagui/core'
|
|
12
|
+
// import { AnimationControls, animate } from 'motion'
|
|
13
|
+
// import { useContext, useEffect, useMemo, useRef } from 'react'
|
|
14
|
+
// import { Text, View } from 'react-native'
|
|
15
|
+
|
|
16
|
+
// export const AnimatedView = View
|
|
17
|
+
// export const AnimatedText = Text
|
|
18
|
+
|
|
19
|
+
// export function useAnimatedNumber(
|
|
20
|
+
// initial: number
|
|
21
|
+
// ): UniversalAnimatedNumber<AnimationControls | null> {
|
|
22
|
+
// const state = useRef(
|
|
23
|
+
// null as any as {
|
|
24
|
+
// val: number
|
|
25
|
+
// controls: AnimationControls | null
|
|
26
|
+
// }
|
|
27
|
+
// )
|
|
28
|
+
// if (!state.current) {
|
|
29
|
+
// state.current = {
|
|
30
|
+
// val: initial,
|
|
31
|
+
// controls: null,
|
|
32
|
+
// }
|
|
33
|
+
// }
|
|
34
|
+
// return {
|
|
35
|
+
// getInstance() {
|
|
36
|
+
// return state.current.controls
|
|
37
|
+
// },
|
|
38
|
+
// getValue() {
|
|
39
|
+
// return state.current.val
|
|
40
|
+
// },
|
|
41
|
+
// stop() {
|
|
42
|
+
// state.current.controls?.stop()
|
|
43
|
+
// },
|
|
44
|
+
// setValue(next: number, { type, ...config } = { type: 'spring' }) {
|
|
45
|
+
// // const val = state.current.val
|
|
46
|
+
// // if (type === 'direct') {
|
|
47
|
+
// // val.setValue(next)
|
|
48
|
+
// // } else if (type === 'spring') {
|
|
49
|
+
// // state.current.composite?.stop()
|
|
50
|
+
// // const composite = Animated.spring(val, {
|
|
51
|
+
// // ...config,
|
|
52
|
+
// // toValue: next,
|
|
53
|
+
// // useNativeDriver: !isWeb,
|
|
54
|
+
// // })
|
|
55
|
+
// // composite.start()
|
|
56
|
+
// // state.current.composite = composite
|
|
57
|
+
// // } else {
|
|
58
|
+
// // state.current.composite?.stop()
|
|
59
|
+
// // const composite = Animated.timing(val, {
|
|
60
|
+
// // ...config,
|
|
61
|
+
// // toValue: next,
|
|
62
|
+
// // useNativeDriver: !isWeb,
|
|
63
|
+
// // })
|
|
64
|
+
// // composite.start()
|
|
65
|
+
// // state.current.composite = composite
|
|
66
|
+
// // }
|
|
67
|
+
// },
|
|
68
|
+
// }
|
|
69
|
+
// }
|
|
70
|
+
|
|
71
|
+
// export function useAnimatedNumberReaction(
|
|
72
|
+
// value: UniversalAnimatedNumber<any>,
|
|
73
|
+
// cb: (current: number) => void
|
|
74
|
+
// ) {
|
|
75
|
+
// // const onChange = useEvent((current) => {
|
|
76
|
+
// // cb(current.value)
|
|
77
|
+
// // })
|
|
78
|
+
// // useEffect(() => {
|
|
79
|
+
// // const id = value.getInstance().addListener(onChange)
|
|
80
|
+
// // return () => {
|
|
81
|
+
// // value.getInstance().removeListener(id)
|
|
82
|
+
// // }
|
|
83
|
+
// // }, [value, onChange])
|
|
84
|
+
// }
|
|
85
|
+
|
|
86
|
+
// export function useAnimatedNumberStyle<V extends UniversalAnimatedNumber<any>>(
|
|
87
|
+
// value: V,
|
|
88
|
+
// getStyle: (value: any) => any
|
|
89
|
+
// ) {
|
|
90
|
+
// return getStyle(value.getInstance())
|
|
91
|
+
// }
|
|
92
|
+
|
|
93
|
+
// // @ts-ignore
|
|
94
|
+
// export function createAnimations<A extends AnimationConfigType>(animations: A): AnimationDriver<A> {
|
|
95
|
+
// AnimatedView['displayName'] = 'AnimatedView'
|
|
96
|
+
// AnimatedText['displayName'] = 'AnimatedText'
|
|
97
|
+
|
|
98
|
+
// return {
|
|
99
|
+
// animations,
|
|
100
|
+
// View: AnimatedView,
|
|
101
|
+
// Text: AnimatedText,
|
|
102
|
+
// useAnimatedNumber,
|
|
103
|
+
// useAnimatedNumberReaction,
|
|
104
|
+
// useAnimatedNumberStyle,
|
|
105
|
+
// useAnimations: (props, helpers) => {
|
|
106
|
+
// const { onDidAnimate, delay, getStyle, state } = helpers
|
|
107
|
+
// const [isPresent, sendExitComplete] = usePresence()
|
|
108
|
+
// const presence = useContext(PresenceContext)
|
|
109
|
+
|
|
110
|
+
// const isExiting = isPresent === false
|
|
111
|
+
// const isEntering = !state.mounted
|
|
112
|
+
|
|
113
|
+
// const all = getStyle({
|
|
114
|
+
// isExiting,
|
|
115
|
+
// isEntering,
|
|
116
|
+
// exitVariant: presence?.exitVariant,
|
|
117
|
+
// enterVariant: presence?.enterVariant,
|
|
118
|
+
// })
|
|
119
|
+
|
|
120
|
+
// const args = [
|
|
121
|
+
// JSON.stringify(all),
|
|
122
|
+
// state.mounted,
|
|
123
|
+
// state.hover,
|
|
124
|
+
// state.press,
|
|
125
|
+
// state.pressIn,
|
|
126
|
+
// state.focus,
|
|
127
|
+
// delay,
|
|
128
|
+
// isPresent,
|
|
129
|
+
// onDidAnimate,
|
|
130
|
+
// presence?.exitVariant,
|
|
131
|
+
// presence?.enterVariant,
|
|
132
|
+
// ]
|
|
133
|
+
|
|
134
|
+
// // return useMemo(() => {
|
|
135
|
+
// // return {
|
|
136
|
+
// // style: [nonAnimatedStyle, animatedStyle],
|
|
137
|
+
// // }
|
|
138
|
+
// // // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
139
|
+
// // }, args)
|
|
140
|
+
// return {}
|
|
141
|
+
// },
|
|
142
|
+
// }
|
|
143
|
+
// }
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// export * from './createAnimations'
|
package/types/index.d.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createAnimations.d.ts","sourceRoot":"","sources":["../src/createAnimations.tsx"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,GAAG;IAClD,aAAa,EAAE,GAAG,CAAA;IAClB,UAAU,EAAE,CAAC,CAAA;IACb,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,IAAI,CAAC,EAAE,GAAG,CAAA;CACX,CAQA"}
|
package/types/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|