@william-callao/antonella-animations 1.0.0

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.
@@ -0,0 +1,42 @@
1
+ import { FadeIn, FadeInDown, FadeInUp, SlideInRight, ZoomIn, FadeOut, SlideOutRight } from 'react-native-reanimated';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import React from 'react';
4
+ import { StyleProp, ViewStyle } from 'react-native';
5
+
6
+ declare const entering: {
7
+ readonly fade: FadeIn;
8
+ readonly fadeInDown: FadeInDown;
9
+ readonly fadeInUp: FadeInUp;
10
+ readonly slideRight: SlideInRight;
11
+ readonly zoom: ZoomIn;
12
+ };
13
+ declare const exiting: {
14
+ readonly fade: FadeOut;
15
+ readonly slideRight: SlideOutRight;
16
+ };
17
+ declare function staggeredFadeInDown(index: number, step?: number, duration?: number): FadeInDown;
18
+
19
+ type TransitionViewProps = {
20
+ children: React.ReactNode;
21
+ /**
22
+ * Cambia cuando el contenido cambia estructuralmente (p. ej. `contentKey={step}`).
23
+ * Al cambiar, el contenido se remonta y entra con fade in desde opacity 0 (sin parpadeos).
24
+ */
25
+ contentKey?: string | number;
26
+ /** Duración (ms) de la animación de altura. */
27
+ duration?: number;
28
+ /** Duración (ms) del fade in del contenido nuevo. */
29
+ fadeDuration?: number;
30
+ style?: StyleProp<ViewStyle>;
31
+ };
32
+ /**
33
+ * Envuelve contenido de altura variable: al cambiar, anima la altura del
34
+ * contenedor (crece/encoge sin que lo de arriba/abajo salte) y hace fade out
35
+ * del contenido anterior al tiempo que hace fade in del nuevo (transición
36
+ * cruzada, sin parpadeos). La altura se mide con onLayout y se anima en el UI
37
+ * thread; el fade lo maneja Reanimated (layout animations entering/exiting)
38
+ * desde el primer frame.
39
+ */
40
+ declare function TransitionView({ children, contentKey, duration, fadeDuration, style, }: TransitionViewProps): react_jsx_runtime.JSX.Element;
41
+
42
+ export { TransitionView, type TransitionViewProps, entering, exiting, staggeredFadeInDown };
package/dist/index.js ADDED
@@ -0,0 +1,113 @@
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;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ TransitionView: () => TransitionView,
34
+ entering: () => entering,
35
+ exiting: () => exiting,
36
+ staggeredFadeInDown: () => staggeredFadeInDown
37
+ });
38
+ module.exports = __toCommonJS(index_exports);
39
+
40
+ // src/presets.ts
41
+ var import_react_native_reanimated = require("react-native-reanimated");
42
+ var entering = {
43
+ fade: import_react_native_reanimated.FadeIn.duration(150),
44
+ fadeInDown: import_react_native_reanimated.FadeInDown.duration(180),
45
+ fadeInUp: import_react_native_reanimated.FadeInUp.duration(180),
46
+ slideRight: import_react_native_reanimated.SlideInRight.duration(180),
47
+ zoom: import_react_native_reanimated.ZoomIn.duration(150)
48
+ };
49
+ var exiting = {
50
+ fade: import_react_native_reanimated.FadeOut.duration(150),
51
+ slideRight: import_react_native_reanimated.SlideOutRight.duration(150)
52
+ };
53
+ function staggeredFadeInDown(index, step = 15, duration = 180) {
54
+ const maxDelay = 120;
55
+ const delay = Math.min(index * step, maxDelay);
56
+ return import_react_native_reanimated.FadeInDown.duration(duration).delay(delay);
57
+ }
58
+
59
+ // src/TransitionView.tsx
60
+ var import_react = require("react");
61
+ var import_react_native = require("react-native");
62
+ var import_react_native_reanimated2 = __toESM(require("react-native-reanimated"));
63
+ var import_jsx_runtime = require("react/jsx-runtime");
64
+ function TransitionView({
65
+ children,
66
+ contentKey,
67
+ duration = 150,
68
+ fadeDuration = 150,
69
+ style
70
+ }) {
71
+ const animatedHeight = (0, import_react_native_reanimated2.useSharedValue)(0);
72
+ const onContentLayout = (0, import_react.useCallback)(
73
+ (event) => {
74
+ const { height } = event.nativeEvent.layout;
75
+ if (height === animatedHeight.value) return;
76
+ animatedHeight.value = (0, import_react_native_reanimated2.withTiming)(height, {
77
+ duration,
78
+ easing: import_react_native_reanimated2.Easing.out(import_react_native_reanimated2.Easing.quad)
79
+ });
80
+ },
81
+ [animatedHeight, duration]
82
+ );
83
+ const containerStyle = (0, import_react_native_reanimated2.useAnimatedStyle)(() => ({
84
+ height: animatedHeight.value
85
+ }));
86
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native_reanimated2.default.View, { style: [styles.container, containerStyle, style], children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, { style: styles.content, onLayout: onContentLayout, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
87
+ import_react_native_reanimated2.default.View,
88
+ {
89
+ entering: import_react_native_reanimated2.FadeIn.duration(fadeDuration),
90
+ exiting: import_react_native_reanimated2.FadeOut.duration(fadeDuration),
91
+ children
92
+ },
93
+ contentKey
94
+ ) }) });
95
+ }
96
+ var styles = import_react_native.StyleSheet.create({
97
+ container: {
98
+ overflow: "hidden"
99
+ },
100
+ content: {
101
+ position: "absolute",
102
+ top: 0,
103
+ left: 0,
104
+ right: 0
105
+ }
106
+ });
107
+ // Annotate the CommonJS export names for ESM import in node:
108
+ 0 && (module.exports = {
109
+ TransitionView,
110
+ entering,
111
+ exiting,
112
+ staggeredFadeInDown
113
+ });
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@william-callao/antonella-animations",
3
+ "version": "1.0.0",
4
+ "description": "Animaciones compartidas de Antonella (React Native Reanimated).",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "react-native": "dist/index.js",
8
+ "sideEffects": false,
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "peerDependencies": {
16
+ "react": ">=19.0.0",
17
+ "react-native": ">=0.81.0",
18
+ "react-native-reanimated": ">=4.0.0",
19
+ "react-native-worklets": ">=0.5.0"
20
+ },
21
+ "scripts": {
22
+ "build": "tsup",
23
+ "typecheck": "tsc --noEmit"
24
+ }
25
+ }