36 lines
10 KiB
JavaScript
36 lines
10 KiB
JavaScript
/** @license React v16.12.0
|
|
* react-dom-unstable-native-dependencies.production.min.js
|
|
*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
'use strict';var aa=require("react-dom"),h=require("object-assign");function k(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=null,n=null,p=null;
|
|
function r(a){var b=a._dispatchListeners,c=a._dispatchInstances;if(Array.isArray(b))throw Error(k(103));a.currentTarget=b?p(c):null;b=b?b(a):null;a.currentTarget=null;a._dispatchListeners=null;a._dispatchInstances=null;return b}function t(a){do a=a.return;while(a&&5!==a.tag);return a?a:null}function u(a,b,c){for(var f=[];a;)f.push(a),a=t(a);for(a=f.length;0<a--;)b(f[a],"captured",c);for(a=0;a<f.length;a++)b(f[a],"bubbled",c)}
|
|
function v(a,b){if(null==b)throw Error(k(30));if(null==a)return b;if(Array.isArray(a)){if(Array.isArray(b))return a.push.apply(a,b),a;a.push(b);return a}return Array.isArray(b)?[a].concat(b):[a,b]}function w(a,b,c){Array.isArray(a)?a.forEach(b,c):a&&b.call(c,a)}
|
|
function x(a,b){var c=a.stateNode;if(!c)return null;var f=l(c);if(!f)return null;c=f[b];a:switch(b){case "onClick":case "onClickCapture":case "onDoubleClick":case "onDoubleClickCapture":case "onMouseDown":case "onMouseDownCapture":case "onMouseMove":case "onMouseMoveCapture":case "onMouseUp":case "onMouseUpCapture":(f=!f.disabled)||(a=a.type,f=!("button"===a||"input"===a||"select"===a||"textarea"===a));a=!f;break a;default:a=!1}if(a)return null;if(c&&"function"!==typeof c)throw Error(k(231,b,typeof c));
|
|
return c}function y(a,b,c){if(b=x(a,c.dispatchConfig.phasedRegistrationNames[b]))c._dispatchListeners=v(c._dispatchListeners,b),c._dispatchInstances=v(c._dispatchInstances,a)}function ba(a){a&&a.dispatchConfig.phasedRegistrationNames&&u(a._targetInst,y,a)}function ca(a){if(a&&a.dispatchConfig.phasedRegistrationNames){var b=a._targetInst;b=b?t(b):null;u(b,y,a)}}
|
|
function z(a){if(a&&a.dispatchConfig.registrationName){var b=a._targetInst;if(b&&a&&a.dispatchConfig.registrationName){var c=x(b,a.dispatchConfig.registrationName);c&&(a._dispatchListeners=v(a._dispatchListeners,c),a._dispatchInstances=v(a._dispatchInstances,b))}}}function A(){return!0}function B(){return!1}
|
|
function C(a,b,c,f){this.dispatchConfig=a;this._targetInst=b;this.nativeEvent=c;a=this.constructor.Interface;for(var d in a)a.hasOwnProperty(d)&&((b=a[d])?this[d]=b(c):"target"===d?this.target=f:this[d]=c[d]);this.isDefaultPrevented=(null!=c.defaultPrevented?c.defaultPrevented:!1===c.returnValue)?A:B;this.isPropagationStopped=B;return this}
|
|
h(C.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&&(a.returnValue=!1),this.isDefaultPrevented=A)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==typeof a.cancelBubble&&(a.cancelBubble=!0),this.isPropagationStopped=A)},persist:function(){this.isPersistent=A},isPersistent:B,destructor:function(){var a=this.constructor.Interface,b;for(b in a)this[b]=
|
|
null;this.nativeEvent=this._targetInst=this.dispatchConfig=null;this.isPropagationStopped=this.isDefaultPrevented=B;this._dispatchInstances=this._dispatchListeners=null}});C.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};
|
|
C.extend=function(a){function b(){}function c(){return f.apply(this,arguments)}var f=this;b.prototype=f.prototype;var d=new b;h(d,c.prototype);c.prototype=d;c.prototype.constructor=c;c.Interface=h({},f.Interface,a);c.extend=f.extend;D(c);return c};D(C);function da(a,b,c,f){if(this.eventPool.length){var d=this.eventPool.pop();this.call(d,a,b,c,f);return d}return new this(a,b,c,f)}
|
|
function ea(a){if(!(a instanceof this))throw Error(k(279));a.destructor();10>this.eventPool.length&&this.eventPool.push(a)}function D(a){a.eventPool=[];a.getPooled=da;a.release=ea}var E=C.extend({touchHistory:function(){return null}});function F(a){return"touchstart"===a||"mousedown"===a}function G(a){return"touchmove"===a||"mousemove"===a}function H(a){return"touchend"===a||"touchcancel"===a||"mouseup"===a}
|
|
var I=["touchstart","mousedown"],J=["touchmove","mousemove"],K=["touchcancel","touchend","mouseup"],L=[],N={touchBank:L,numberActiveTouches:0,indexOfSingleActiveTouch:-1,mostRecentTimeStamp:0};function O(a){return a.timeStamp||a.timestamp}function P(a){a=a.identifier;if(null==a)throw Error(k(138));return a}
|
|
function fa(a){var b=P(a),c=L[b];c?(c.touchActive=!0,c.startPageX=a.pageX,c.startPageY=a.pageY,c.startTimeStamp=O(a),c.currentPageX=a.pageX,c.currentPageY=a.pageY,c.currentTimeStamp=O(a),c.previousPageX=a.pageX,c.previousPageY=a.pageY,c.previousTimeStamp=O(a)):(c={touchActive:!0,startPageX:a.pageX,startPageY:a.pageY,startTimeStamp:O(a),currentPageX:a.pageX,currentPageY:a.pageY,currentTimeStamp:O(a),previousPageX:a.pageX,previousPageY:a.pageY,previousTimeStamp:O(a)},L[b]=c);N.mostRecentTimeStamp=O(a)}
|
|
function ha(a){var b=L[P(a)];b?(b.touchActive=!0,b.previousPageX=b.currentPageX,b.previousPageY=b.currentPageY,b.previousTimeStamp=b.currentTimeStamp,b.currentPageX=a.pageX,b.currentPageY=a.pageY,b.currentTimeStamp=O(a),N.mostRecentTimeStamp=O(a)):console.warn("Cannot record touch move without a touch start.\nTouch Move: %s\n","Touch Bank: %s",Q(a),R())}
|
|
function ia(a){var b=L[P(a)];b?(b.touchActive=!1,b.previousPageX=b.currentPageX,b.previousPageY=b.currentPageY,b.previousTimeStamp=b.currentTimeStamp,b.currentPageX=a.pageX,b.currentPageY=a.pageY,b.currentTimeStamp=O(a),N.mostRecentTimeStamp=O(a)):console.warn("Cannot record touch end without a touch start.\nTouch End: %s\n","Touch Bank: %s",Q(a),R())}function Q(a){return JSON.stringify({identifier:a.identifier,pageX:a.pageX,pageY:a.pageY,timestamp:O(a)})}
|
|
function R(){var a=JSON.stringify(L.slice(0,20));20<L.length&&(a+=" (original size: "+L.length+")");return a}
|
|
var S={recordTouchTrack:function(a,b){if(G(a))b.changedTouches.forEach(ha);else if(F(a))b.changedTouches.forEach(fa),N.numberActiveTouches=b.touches.length,1===N.numberActiveTouches&&(N.indexOfSingleActiveTouch=b.touches[0].identifier);else if(H(a)&&(b.changedTouches.forEach(ia),N.numberActiveTouches=b.touches.length,1===N.numberActiveTouches))for(a=0;a<L.length;a++)if(b=L[a],null!=b&&b.touchActive){N.indexOfSingleActiveTouch=a;break}},touchHistory:N};
|
|
function T(a,b){if(null==b)throw Error(k(334));return null==a?b:Array.isArray(a)?a.concat(b):Array.isArray(b)?[a].concat(b):[a,b]}var U=null,V=0;function W(a,b){var c=U;U=a;if(null!==X.GlobalResponderHandler)X.GlobalResponderHandler.onChange(c,a,b)}
|
|
var Y={startShouldSetResponder:{phasedRegistrationNames:{bubbled:"onStartShouldSetResponder",captured:"onStartShouldSetResponderCapture"},dependencies:I},scrollShouldSetResponder:{phasedRegistrationNames:{bubbled:"onScrollShouldSetResponder",captured:"onScrollShouldSetResponderCapture"},dependencies:["scroll"]},selectionChangeShouldSetResponder:{phasedRegistrationNames:{bubbled:"onSelectionChangeShouldSetResponder",captured:"onSelectionChangeShouldSetResponderCapture"},dependencies:["selectionchange"]},
|
|
moveShouldSetResponder:{phasedRegistrationNames:{bubbled:"onMoveShouldSetResponder",captured:"onMoveShouldSetResponderCapture"},dependencies:J},responderStart:{registrationName:"onResponderStart",dependencies:I},responderMove:{registrationName:"onResponderMove",dependencies:J},responderEnd:{registrationName:"onResponderEnd",dependencies:K},responderRelease:{registrationName:"onResponderRelease",dependencies:K},responderTerminationRequest:{registrationName:"onResponderTerminationRequest",dependencies:[]},
|
|
responderGrant:{registrationName:"onResponderGrant",dependencies:[]},responderReject:{registrationName:"onResponderReject",dependencies:[]},responderTerminate:{registrationName:"onResponderTerminate",dependencies:[]}},X={_getResponder:function(){return U},eventTypes:Y,extractEvents:function(a,b,c,f){if(F(a))V+=1;else if(H(a))if(0<=V)--V;else return console.warn("Ended a touch event which was not counted in `trackedTouchCount`."),null;S.recordTouchTrack(a,c);if(b&&("scroll"===a&&!c.responderIgnoreScroll||
|
|
0<V&&"selectionchange"===a||F(a)||G(a))){var d=F(a)?Y.startShouldSetResponder:G(a)?Y.moveShouldSetResponder:"selectionchange"===a?Y.selectionChangeShouldSetResponder:Y.scrollShouldSetResponder;if(U)b:{var e=U;for(var g=0,q=e;q;q=t(q))g++;q=0;for(var M=b;M;M=t(M))q++;for(;0<g-q;)e=t(e),g--;for(;0<q-g;)b=t(b),q--;for(;g--;){if(e===b||e===b.alternate)break b;e=t(e);b=t(b)}e=null}else e=b;b=e===U;e=E.getPooled(d,e,c,f);e.touchHistory=S.touchHistory;b?w(e,ca):w(e,ba);b:{d=e._dispatchListeners;b=e._dispatchInstances;
|
|
if(Array.isArray(d))for(g=0;g<d.length&&!e.isPropagationStopped();g++){if(d[g](e,b[g])){d=b[g];break b}}else if(d&&d(e,b)){d=b;break b}d=null}e._dispatchInstances=null;e._dispatchListeners=null;e.isPersistent()||e.constructor.release(e);if(d&&d!==U)if(e=E.getPooled(Y.responderGrant,d,c,f),e.touchHistory=S.touchHistory,w(e,z),b=!0===r(e),U)if(g=E.getPooled(Y.responderTerminationRequest,U,c,f),g.touchHistory=S.touchHistory,w(g,z),q=!g._dispatchListeners||r(g),g.isPersistent()||g.constructor.release(g),
|
|
q){g=E.getPooled(Y.responderTerminate,U,c,f);g.touchHistory=S.touchHistory;w(g,z);var m=T(m,[e,g]);W(d,b)}else d=E.getPooled(Y.responderReject,d,c,f),d.touchHistory=S.touchHistory,w(d,z),m=T(m,d);else m=T(m,e),W(d,b);else m=null}else m=null;d=U&&F(a);e=U&&G(a);b=U&&H(a);if(d=d?Y.responderStart:e?Y.responderMove:b?Y.responderEnd:null)d=E.getPooled(d,U,c,f),d.touchHistory=S.touchHistory,w(d,z),m=T(m,d);d=U&&"touchcancel"===a;if(a=U&&!d&&H(a))a:{if((a=c.touches)&&0!==a.length)for(e=0;e<a.length;e++)if(b=
|
|
a[e].target,null!==b&&void 0!==b&&0!==b){g=n(b);b:{for(b=U;g;){if(b===g||b===g.alternate){b=!0;break b}g=t(g)}b=!1}if(b){a=!1;break a}}a=!0}if(a=d?Y.responderTerminate:a?Y.responderRelease:null)c=E.getPooled(a,U,c,f),c.touchHistory=S.touchHistory,w(c,z),m=T(m,c),W(null);return m},GlobalResponderHandler:null,injection:{injectGlobalResponderHandler:function(a){X.GlobalResponderHandler=a}}},Z=aa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events,ja=Z[3],ka=Z[0],la=Z[1];l=Z[2];n=ka;p=la;
|
|
module.exports={ResponderEventPlugin:X,ResponderTouchHistoryStore:S,injectEventPluginsByName:ja};
|