UNPKG

@tamagui/react-native-web-lite

Version:
133 lines (132 loc) 5.31 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: !0 }); }, __copyProps = (to, from, except, desc) => { if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target, mod )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod); var AnimatedMock_exports = {}; __export(AnimatedMock_exports, { default: () => AnimatedMock_default }); module.exports = __toCommonJS(AnimatedMock_exports); var import_AnimatedEvent = require("./AnimatedEvent"), import_AnimatedImplementation = __toESM(require("./AnimatedImplementation")), import_AnimatedInterpolation = __toESM(require("./nodes/AnimatedInterpolation")), import_AnimatedNode = __toESM(require("./nodes/AnimatedNode")), import_AnimatedValue = __toESM(require("./nodes/AnimatedValue")), import_AnimatedValueXY = __toESM(require("./nodes/AnimatedValueXY")), import_createAnimatedComponent = __toESM(require("./createAnimatedComponent")), import_AnimatedColor = __toESM(require("./nodes/AnimatedColor")), inAnimationCallback = !1; function mockAnimationStart(start) { return function(callback) { var guardedCallback = callback == null ? callback : function() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key]; if (inAnimationCallback) { console.warn("Ignoring recursive animation callback when running mock animations"); return; } inAnimationCallback = !0; try { callback(...args); } finally { inAnimationCallback = !1; } }; start(guardedCallback); }; } var emptyAnimation = { start: function() { }, stop: function() { }, reset: function() { }, _startNativeLoop: function() { }, _isUsingNativeDriver: function() { return !1; } }, mockCompositeAnimation = function(animations) { return { ...emptyAnimation, start: mockAnimationStart(function(callback) { animations.forEach(function(animation) { return animation.start(); }), callback == null || callback({ finished: !0 }); }) }; }, spring = function(value, config) { var anyValue = value; return { ...emptyAnimation, start: mockAnimationStart(function(callback) { anyValue.setValue(config.toValue), callback == null || callback({ finished: !0 }); }) }; }, timing = function(value, config) { var anyValue = value; return { ...emptyAnimation, start: mockAnimationStart(function(callback) { anyValue.setValue(config.toValue), callback == null || callback({ finished: !0 }); }) }; }, decay = function(value, config) { return emptyAnimation; }, sequence = function(animations) { return mockCompositeAnimation(animations); }, parallel = function(animations, config) { return mockCompositeAnimation(animations); }, delay = function(time) { return emptyAnimation; }, stagger = function(time, animations) { return mockCompositeAnimation(animations); }, loop = function(animation) { var { iterations = -1 } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; return emptyAnimation; }, AnimatedMock_default = { Value: import_AnimatedValue.default, ValueXY: import_AnimatedValueXY.default, Color: import_AnimatedColor.default, Interpolation: import_AnimatedInterpolation.default, Node: import_AnimatedNode.default, decay, timing, spring, add: import_AnimatedImplementation.default.add, subtract: import_AnimatedImplementation.default.subtract, divide: import_AnimatedImplementation.default.divide, multiply: import_AnimatedImplementation.default.multiply, modulo: import_AnimatedImplementation.default.modulo, diffClamp: import_AnimatedImplementation.default.diffClamp, delay, sequence, parallel, stagger, loop, event: import_AnimatedImplementation.default.event, createAnimatedComponent: import_createAnimatedComponent.default, attachNativeEvent: import_AnimatedEvent.attachNativeEvent, forkEvent: import_AnimatedImplementation.default.forkEvent, unforkEvent: import_AnimatedImplementation.default.unforkEvent, Event: import_AnimatedEvent.AnimatedEvent }; //# sourceMappingURL=AnimatedMock.js.map