6cb7f5c4b30bcd9d541300b053349b27.json 23.3 KB
{"ast":null,"code":"'use strict';var _interopRequireDefault=require(\"@babel/runtime/helpers/interopRequireDefault\");Object.defineProperty(exports,\"__esModule\",{value:true});exports.default=void 0;var _AnimatedInterpolation=_interopRequireDefault(require(\"./AnimatedInterpolation\"));var _AnimatedNode=_interopRequireDefault(require(\"./AnimatedNode\"));var _AnimatedWithChildren2=_interopRequireDefault(require(\"./AnimatedWithChildren\"));var _InteractionManager=_interopRequireDefault(require(\"../../../../exports/InteractionManager\"));var _NativeAnimatedHelper=_interopRequireDefault(require(\"../NativeAnimatedHelper\"));function _inheritsLoose(subClass,superClass){subClass.prototype=Object.create(superClass.prototype);subClass.prototype.constructor=subClass;subClass.__proto__=superClass;}var NativeAnimatedAPI=_NativeAnimatedHelper.default.API;var _uniqueId=1;function _flush(rootNode){var animatedStyles=new Set();function findAnimatedStyles(node){if(typeof node.update==='function'){animatedStyles.add(node);}else{node.__getChildren().forEach(findAnimatedStyles);}}findAnimatedStyles(rootNode);animatedStyles.forEach(function(animatedStyle){return animatedStyle.update();});}var AnimatedValue=function(_AnimatedWithChildren){_inheritsLoose(AnimatedValue,_AnimatedWithChildren);function AnimatedValue(value){var _this;_this=_AnimatedWithChildren.call(this)||this;_this._startingValue=_this._value=value;_this._offset=0;_this._animation=null;_this._listeners={};return _this;}var _proto=AnimatedValue.prototype;_proto.__detach=function __detach(){this.stopAnimation();_AnimatedWithChildren.prototype.__detach.call(this);};_proto.__getValue=function __getValue(){return this._value+this._offset;};_proto.__makeNative=function __makeNative(){_AnimatedWithChildren.prototype.__makeNative.call(this);if(Object.keys(this._listeners).length){this._startListeningToNativeValueUpdates();}};_proto.setValue=function setValue(value){if(this._animation){this._animation.stop();this._animation=null;}this._updateValue(value,!this.__isNative);if(this.__isNative){NativeAnimatedAPI.setAnimatedNodeValue(this.__getNativeTag(),value);}};_proto.setOffset=function setOffset(offset){this._offset=offset;if(this.__isNative){NativeAnimatedAPI.setAnimatedNodeOffset(this.__getNativeTag(),offset);}};_proto.flattenOffset=function flattenOffset(){this._value+=this._offset;this._offset=0;if(this.__isNative){NativeAnimatedAPI.flattenAnimatedNodeOffset(this.__getNativeTag());}};_proto.extractOffset=function extractOffset(){this._offset+=this._value;this._value=0;if(this.__isNative){NativeAnimatedAPI.extractAnimatedNodeOffset(this.__getNativeTag());}};_proto.addListener=function addListener(callback){var id=String(_uniqueId++);this._listeners[id]=callback;if(this.__isNative){this._startListeningToNativeValueUpdates();}return id;};_proto.removeListener=function removeListener(id){delete this._listeners[id];if(this.__isNative&&Object.keys(this._listeners).length===0){this._stopListeningForNativeValueUpdates();}};_proto.removeAllListeners=function removeAllListeners(){this._listeners={};if(this.__isNative){this._stopListeningForNativeValueUpdates();}};_proto._startListeningToNativeValueUpdates=function _startListeningToNativeValueUpdates(){var _this2=this;if(this.__nativeAnimatedValueListener){return;}NativeAnimatedAPI.startListeningToAnimatedNodeValue(this.__getNativeTag());this.__nativeAnimatedValueListener=_NativeAnimatedHelper.default.nativeEventEmitter.addListener('onAnimatedValueUpdate',function(data){if(data.tag!==_this2.__getNativeTag()){return;}_this2._updateValue(data.value,false);});};_proto._stopListeningForNativeValueUpdates=function _stopListeningForNativeValueUpdates(){if(!this.__nativeAnimatedValueListener){return;}this.__nativeAnimatedValueListener.remove();this.__nativeAnimatedValueListener=null;NativeAnimatedAPI.stopListeningToAnimatedNodeValue(this.__getNativeTag());};_proto.stopAnimation=function stopAnimation(callback){this.stopTracking();this._animation&&this._animation.stop();this._animation=null;callback&&callback(this.__getValue());};_proto.resetAnimation=function resetAnimation(callback){this.stopAnimation(callback);this._value=this._startingValue;};_proto.interpolate=function interpolate(config){return new _AnimatedInterpolation.default(this,config);};_proto.animate=function animate(animation,callback){var _this3=this;var handle=null;if(animation.__isInteraction){handle=_InteractionManager.default.createInteractionHandle();}var previousAnimation=this._animation;this._animation&&this._animation.stop();this._animation=animation;animation.start(this._value,function(value){_this3._updateValue(value,true);},function(result){_this3._animation=null;if(handle!==null){_InteractionManager.default.clearInteractionHandle(handle);}callback&&callback(result);},previousAnimation,this);};_proto.stopTracking=function stopTracking(){this._tracking&&this._tracking.__detach();this._tracking=null;};_proto.track=function track(tracking){this.stopTracking();this._tracking=tracking;};_proto._updateValue=function _updateValue(value,flush){this._value=value;if(flush){_flush(this);}for(var _key in this._listeners){this._listeners[_key]({value:this.__getValue()});}};_proto.__getNativeConfig=function __getNativeConfig(){return{type:'value',value:this._value,offset:this._offset};};return AnimatedValue;}(_AnimatedWithChildren2.default);var _default=AnimatedValue;exports.default=_default;","map":{"version":3,"sources":["C:/Users/bluej/Desktop/2_2/searchGuide/searchGuide/node_modules/react-native-web/dist/vendor/react-native/Animated/nodes/AnimatedValue.js"],"names":["_inheritsLoose","subClass","superClass","prototype","Object","create","constructor","__proto__","NativeAnimatedAPI","NativeAnimatedHelper","API","_uniqueId","_flush","rootNode","animatedStyles","Set","findAnimatedStyles","node","update","add","__getChildren","forEach","animatedStyle","AnimatedValue","_AnimatedWithChildren","value","_this","call","_startingValue","_value","_offset","_animation","_listeners","_proto","__detach","stopAnimation","__getValue","__makeNative","keys","length","_startListeningToNativeValueUpdates","setValue","stop","_updateValue","__isNative","setAnimatedNodeValue","__getNativeTag","setOffset","offset","setAnimatedNodeOffset","flattenOffset","flattenAnimatedNodeOffset","extractOffset","extractAnimatedNodeOffset","addListener","callback","id","String","removeListener","_stopListeningForNativeValueUpdates","removeAllListeners","_this2","__nativeAnimatedValueListener","startListeningToAnimatedNodeValue","nativeEventEmitter","data","tag","remove","stopListeningToAnimatedNodeValue","stopTracking","resetAnimation","interpolate","config","AnimatedInterpolation","animate","animation","_this3","handle","__isInteraction","InteractionManager","createInteractionHandle","previousAnimation","start","result","clearInteractionHandle","_tracking","track","tracking","flush","_key","__getNativeConfig","type","AnimatedWithChildren"],"mappings":"AASA,a,mKAIA,sFACA,oEACA,qFACA,kGACA,qFANA,QAASA,CAAAA,cAAT,CAAwBC,QAAxB,CAAkCC,UAAlC,CA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AAT,CAAsBlB,KAAtB,CAA6B+D,KAA7B,CAAoC,CACxD,KAAK3D,MAAL,CAAcJ,KAAd,CAEA,GAAI+D,KAAJ,CAAW,CACT5E,MAAM,CAAC,IAAD,CAAN,CACD,CAED,IAAK,GAAI6E,CAAAA,IAAT,GAAiB,MAAKzD,UAAtB,CAAkC,CAChC,KAAKA,UAAL,CAAgByD,IAAhB,EAAsB,CACpBhE,KAAK,CAAE,KAAKW,UAAL,EADa,CAAtB,EAGD,CACF,CAZD,CAcAH,MAAM,CAACyD,iBAAP,CAA2B,QAASA,CAAAA,iBAAT,EAA6B,CACtD,MAAO,CACLC,IAAI,CAAE,OADD,CAELlE,KAAK,CAAE,KAAKI,MAFP,CAGLmB,MAAM,CAAE,KAAKlB,OAHR,CAAP,CAKD,CAND,CAQA,MAAOP,CAAAA,aAAP,CACD,CAvSD,CAuSEqE,8BAvSF,CAFA,C,aA2SerE,a","sourcesContent":["/**\n * Copyright (c) 2015-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n * @format\n */\n'use strict';\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nimport AnimatedInterpolation from './AnimatedInterpolation';\nimport AnimatedNode from './AnimatedNode';\nimport AnimatedWithChildren from './AnimatedWithChildren';\nimport InteractionManager from '../../../../exports/InteractionManager';\nimport NativeAnimatedHelper from '../NativeAnimatedHelper';\nvar NativeAnimatedAPI = NativeAnimatedHelper.API;\nvar _uniqueId = 1;\n/**\n * Animated works by building a directed acyclic graph of dependencies\n * transparently when you render your Animated components.\n *\n *               new Animated.Value(0)\n *     .interpolate()        .interpolate()    new Animated.Value(1)\n *         opacity               translateY      scale\n *          style                         transform\n *         View#234                         style\n *                                         View#123\n *\n * A) Top Down phase\n * When an Animated.Value is updated, we recursively go down through this\n * graph in order to find leaf nodes: the views that we flag as needing\n * an update.\n *\n * B) Bottom Up phase\n * When a view is flagged as needing an update, we recursively go back up\n * in order to build the new value that it needs. The reason why we need\n * this two-phases process is to deal with composite props such as\n * transform which can receive values from multiple parents.\n */\n\nfunction _flush(rootNode) {\n  var animatedStyles = new Set();\n\n  function findAnimatedStyles(node) {\n    if (typeof node.update === 'function') {\n      animatedStyles.add(node);\n    } else {\n      node.__getChildren().forEach(findAnimatedStyles);\n    }\n  }\n\n  findAnimatedStyles(rootNode);\n  animatedStyles.forEach(function (animatedStyle) {\n    return animatedStyle.update();\n  });\n}\n/**\n * Standard value for driving animations.  One `Animated.Value` can drive\n * multiple properties in a synchronized fashion, but can only be driven by one\n * mechanism at a time.  Using a new mechanism (e.g. starting a new animation,\n * or calling `setValue`) will stop any previous ones.\n *\n * See http://facebook.github.io/react-native/docs/animatedvalue.html\n */\n\n\nvar AnimatedValue =\n/*#__PURE__*/\nfunction (_AnimatedWithChildren) {\n  _inheritsLoose(AnimatedValue, _AnimatedWithChildren);\n\n  function AnimatedValue(value) {\n    var _this;\n\n    _this = _AnimatedWithChildren.call(this) || this;\n    _this._startingValue = _this._value = value;\n    _this._offset = 0;\n    _this._animation = null;\n    _this._listeners = {};\n    return _this;\n  }\n\n  var _proto = AnimatedValue.prototype;\n\n  _proto.__detach = function __detach() {\n    this.stopAnimation();\n\n    _AnimatedWithChildren.prototype.__detach.call(this);\n  };\n\n  _proto.__getValue = function __getValue() {\n    return this._value + this._offset;\n  };\n\n  _proto.__makeNative = function __makeNative() {\n    _AnimatedWithChildren.prototype.__makeNative.call(this);\n\n    if (Object.keys(this._listeners).length) {\n      this._startListeningToNativeValueUpdates();\n    }\n  }\n  /**\n   * Directly set the value.  This will stop any animations running on the value\n   * and update all the bound properties.\n   *\n   * See http://facebook.github.io/react-native/docs/animatedvalue.html#setvalue\n   */\n  ;\n\n  _proto.setValue = function setValue(value) {\n    if (this._animation) {\n      this._animation.stop();\n\n      this._animation = null;\n    }\n\n    this._updateValue(value, !this.__isNative\n    /* don't perform a flush for natively driven values */\n    );\n\n    if (this.__isNative) {\n      NativeAnimatedAPI.setAnimatedNodeValue(this.__getNativeTag(), value);\n    }\n  }\n  /**\n   * Sets an offset that is applied on top of whatever value is set, whether via\n   * `setValue`, an animation, or `Animated.event`.  Useful for compensating\n   * things like the start of a pan gesture.\n   *\n   * See http://facebook.github.io/react-native/docs/animatedvalue.html#setoffset\n   */\n  ;\n\n  _proto.setOffset = function setOffset(offset) {\n    this._offset = offset;\n\n    if (this.__isNative) {\n      NativeAnimatedAPI.setAnimatedNodeOffset(this.__getNativeTag(), offset);\n    }\n  }\n  /**\n   * Merges the offset value into the base value and resets the offset to zero.\n   * The final output of the value is unchanged.\n   *\n   * See http://facebook.github.io/react-native/docs/animatedvalue.html#flattenoffset\n   */\n  ;\n\n  _proto.flattenOffset = function flattenOffset() {\n    this._value += this._offset;\n    this._offset = 0;\n\n    if (this.__isNative) {\n      NativeAnimatedAPI.flattenAnimatedNodeOffset(this.__getNativeTag());\n    }\n  }\n  /**\n   * Sets the offset value to the base value, and resets the base value to zero.\n   * The final output of the value is unchanged.\n   *\n   * See http://facebook.github.io/react-native/docs/animatedvalue.html#extractoffset\n   */\n  ;\n\n  _proto.extractOffset = function extractOffset() {\n    this._offset += this._value;\n    this._value = 0;\n\n    if (this.__isNative) {\n      NativeAnimatedAPI.extractAnimatedNodeOffset(this.__getNativeTag());\n    }\n  }\n  /**\n   * Adds an asynchronous listener to the value so you can observe updates from\n   * animations.  This is useful because there is no way to\n   * synchronously read the value because it might be driven natively.\n   *\n   * See http://facebook.github.io/react-native/docs/animatedvalue.html#addlistener\n   */\n  ;\n\n  _proto.addListener = function addListener(callback) {\n    var id = String(_uniqueId++);\n    this._listeners[id] = callback;\n\n    if (this.__isNative) {\n      this._startListeningToNativeValueUpdates();\n    }\n\n    return id;\n  }\n  /**\n   * Unregister a listener. The `id` param shall match the identifier\n   * previously returned by `addListener()`.\n   *\n   * See http://facebook.github.io/react-native/docs/animatedvalue.html#removelistener\n   */\n  ;\n\n  _proto.removeListener = function removeListener(id) {\n    delete this._listeners[id];\n\n    if (this.__isNative && Object.keys(this._listeners).length === 0) {\n      this._stopListeningForNativeValueUpdates();\n    }\n  }\n  /**\n   * Remove all registered listeners.\n   *\n   * See http://facebook.github.io/react-native/docs/animatedvalue.html#removealllisteners\n   */\n  ;\n\n  _proto.removeAllListeners = function removeAllListeners() {\n    this._listeners = {};\n\n    if (this.__isNative) {\n      this._stopListeningForNativeValueUpdates();\n    }\n  };\n\n  _proto._startListeningToNativeValueUpdates = function _startListeningToNativeValueUpdates() {\n    var _this2 = this;\n\n    if (this.__nativeAnimatedValueListener) {\n      return;\n    }\n\n    NativeAnimatedAPI.startListeningToAnimatedNodeValue(this.__getNativeTag());\n    this.__nativeAnimatedValueListener = NativeAnimatedHelper.nativeEventEmitter.addListener('onAnimatedValueUpdate', function (data) {\n      if (data.tag !== _this2.__getNativeTag()) {\n        return;\n      }\n\n      _this2._updateValue(data.value, false\n      /* flush */\n      );\n    });\n  };\n\n  _proto._stopListeningForNativeValueUpdates = function _stopListeningForNativeValueUpdates() {\n    if (!this.__nativeAnimatedValueListener) {\n      return;\n    }\n\n    this.__nativeAnimatedValueListener.remove();\n\n    this.__nativeAnimatedValueListener = null;\n    NativeAnimatedAPI.stopListeningToAnimatedNodeValue(this.__getNativeTag());\n  }\n  /**\n   * Stops any running animation or tracking. `callback` is invoked with the\n   * final value after stopping the animation, which is useful for updating\n   * state to match the animation position with layout.\n   *\n   * See http://facebook.github.io/react-native/docs/animatedvalue.html#stopanimation\n   */\n  ;\n\n  _proto.stopAnimation = function stopAnimation(callback) {\n    this.stopTracking();\n    this._animation && this._animation.stop();\n    this._animation = null;\n    callback && callback(this.__getValue());\n  }\n  /**\n   * Stops any animation and resets the value to its original.\n   *\n   * See http://facebook.github.io/react-native/docs/animatedvalue.html#resetanimation\n   */\n  ;\n\n  _proto.resetAnimation = function resetAnimation(callback) {\n    this.stopAnimation(callback);\n    this._value = this._startingValue;\n  }\n  /**\n   * Interpolates the value before updating the property, e.g. mapping 0-1 to\n   * 0-10.\n   */\n  ;\n\n  _proto.interpolate = function interpolate(config) {\n    return new AnimatedInterpolation(this, config);\n  }\n  /**\n   * Typically only used internally, but could be used by a custom Animation\n   * class.\n   *\n   * See http://facebook.github.io/react-native/docs/animatedvalue.html#animate\n   */\n  ;\n\n  _proto.animate = function animate(animation, callback) {\n    var _this3 = this;\n\n    var handle = null;\n\n    if (animation.__isInteraction) {\n      handle = InteractionManager.createInteractionHandle();\n    }\n\n    var previousAnimation = this._animation;\n    this._animation && this._animation.stop();\n    this._animation = animation;\n    animation.start(this._value, function (value) {\n      // Natively driven animations will never call into that callback, therefore we can always\n      // pass flush = true to allow the updated value to propagate to native with setNativeProps\n      _this3._updateValue(value, true\n      /* flush */\n      );\n    }, function (result) {\n      _this3._animation = null;\n\n      if (handle !== null) {\n        InteractionManager.clearInteractionHandle(handle);\n      }\n\n      callback && callback(result);\n    }, previousAnimation, this);\n  }\n  /**\n   * Typically only used internally.\n   */\n  ;\n\n  _proto.stopTracking = function stopTracking() {\n    this._tracking && this._tracking.__detach();\n    this._tracking = null;\n  }\n  /**\n   * Typically only used internally.\n   */\n  ;\n\n  _proto.track = function track(tracking) {\n    this.stopTracking();\n    this._tracking = tracking;\n  };\n\n  _proto._updateValue = function _updateValue(value, flush) {\n    this._value = value;\n\n    if (flush) {\n      _flush(this);\n    }\n\n    for (var _key in this._listeners) {\n      this._listeners[_key]({\n        value: this.__getValue()\n      });\n    }\n  };\n\n  _proto.__getNativeConfig = function __getNativeConfig() {\n    return {\n      type: 'value',\n      value: this._value,\n      offset: this._offset\n    };\n  };\n\n  return AnimatedValue;\n}(AnimatedWithChildren);\n\nexport default AnimatedValue;"]},"metadata":{},"sourceType":"script"}