@tamagui/react-native-web-lite
Version:
React Native for Web
148 lines (147 loc) • 5.09 kB
JavaScript
;
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.cjs"),
import_AnimatedImplementation = __toESM(require("./AnimatedImplementation.cjs")),
import_AnimatedInterpolation = __toESM(require("./nodes/AnimatedInterpolation.cjs")),
import_AnimatedNode = __toESM(require("./nodes/AnimatedNode.cjs")),
import_AnimatedValue = __toESM(require("./nodes/AnimatedValue.cjs")),
import_AnimatedValueXY = __toESM(require("./nodes/AnimatedValueXY.cjs")),
import_createAnimatedComponent = __toESM(require("./createAnimatedComponent.cjs")),
import_AnimatedColor = __toESM(require("./nodes/AnimatedColor.cjs"));
let inAnimationCallback = !1;
function mockAnimationStart(start) {
return callback => {
const guardedCallback = callback == null ? callback : (...args) => {
if (inAnimationCallback) {
console.warn("Ignoring recursive animation callback when running mock animations");
return;
}
inAnimationCallback = !0;
try {
callback(...args);
} finally {
inAnimationCallback = !1;
}
};
start(guardedCallback);
};
}
const emptyAnimation = {
start: () => {},
stop: () => {},
reset: () => {},
_startNativeLoop: () => {},
_isUsingNativeDriver: () => !1
},
mockCompositeAnimation = animations => ({
...emptyAnimation,
start: mockAnimationStart(callback => {
animations.forEach(animation => animation.start()), callback?.({
finished: !0
});
})
}),
spring = function (value, config) {
const anyValue = value;
return {
...emptyAnimation,
start: mockAnimationStart(callback => {
anyValue.setValue(config.toValue), callback?.({
finished: !0
});
})
};
},
timing = function (value, config) {
const anyValue = value;
return {
...emptyAnimation,
start: mockAnimationStart(callback => {
anyValue.setValue(config.toValue), 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, {
iterations = -1
} = {}) {
return emptyAnimation;
};
var 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
};