UNPKG

react-palm

Version:

Elm-like architecture for React apps

549 lines (480 loc) 16.3 kB
/** @license React v16.8.4+patch * 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'; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } (function (n, p) { "object" === (typeof exports === "undefined" ? "undefined" : _typeof(exports)) && "undefined" !== typeof module ? module.exports = p(require("react-dom"), require("react")) : "function" === typeof define && define.amd ? define(["react-dom", "react"], p) : n.ReactDOMUnstableNativeDependencies = p(n.ReactDOM, n.React); })(void 0, function (n, p) { function Y(a, b, c, f, e, d, g, h) { if (!a) { a = void 0; if (void 0 === b) a = Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else { var k = [c, f, e, d, g, h], m = 0; a = Error(b.replace(/%s/g, function () { return k[m++]; })); a.name = "Invariant Violation"; } a.framesToPop = 1; throw a; } } function x(a) { for (var b = arguments.length - 1, c = "https://reactjs.org/docs/error-decoder.html?invariant=" + a, f = 0; f < b; f++) { c += "&args[]=" + encodeURIComponent(arguments[f + 1]); } Y(!1, "Minified React error #" + a + "; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ", c); } function M(a) { var b = a._dispatchListeners, c = a._dispatchInstances; Array.isArray(b) ? x("103") : void 0; a.currentTarget = b ? N(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 O(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 C(a, b) { null == b ? x("30") : void 0; 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 v(a, b, c) { Array.isArray(a) ? a.forEach(b, c) : a && b.call(c, a); } function P(a, b) { var c = a.stateNode; if (!c) return null; var f = Q(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; c && "function" !== typeof c ? x("231", b, _typeof(c)) : void 0; return c; } function R(a, b, c) { if (b = P(a, c.dispatchConfig.phasedRegistrationNames[b])) c._dispatchListeners = C(c._dispatchListeners, b), c._dispatchInstances = C(c._dispatchInstances, a); } function Z(a) { a && a.dispatchConfig.phasedRegistrationNames && O(a._targetInst, R, a); } function aa(a) { if (a && a.dispatchConfig.phasedRegistrationNames) { var b = a._targetInst; b = b ? t(b) : null; O(b, R, a); } } function y(a) { if (a && a.dispatchConfig.registrationName) { var b = a._targetInst; if (b && a && a.dispatchConfig.registrationName) { var c = P(b, a.dispatchConfig.registrationName); c && (a._dispatchListeners = C(a._dispatchListeners, c), a._dispatchInstances = C(a._dispatchInstances, b)); } } } function D() { return !0; } function E() { return !1; } function z(a, b, c, f) { this.dispatchConfig = a; this._targetInst = b; this.nativeEvent = c; a = this.constructor.Interface; for (var e in a) { a.hasOwnProperty(e) && ((b = a[e]) ? this[e] = b(c) : "target" === e ? this.target = f : this[e] = c[e]); } this.isDefaultPrevented = (null != c.defaultPrevented ? c.defaultPrevented : !1 === c.returnValue) ? D : E; this.isPropagationStopped = E; return this; } function ba(a, b, c, f) { if (this.eventPool.length) { var e = this.eventPool.pop(); this.call(e, a, b, c, f); return e; } return new this(a, b, c, f); } function ca(a) { a instanceof this ? void 0 : x("279"); a.destructor(); 10 > this.eventPool.length && this.eventPool.push(a); } function S(a) { a.eventPool = []; a.getPooled = ba; a.release = ca; } function A(a) { return "touchstart" === a || "mousedown" === a; } function F(a) { return "touchmove" === a || "mousemove" === a; } function G(a) { return "touchend" === a || "touchcancel" === a || "mouseup" === a; } function l(a) { return a.timeStamp || a.timestamp; } function J(a) { a = a.identifier; null == a ? x("138") : void 0; return a; } function da(a) { var b = J(a), c = q[b]; c ? (c.touchActive = !0, c.startPageX = a.pageX, c.startPageY = a.pageY, c.startTimeStamp = l(a), c.currentPageX = a.pageX, c.currentPageY = a.pageY, c.currentTimeStamp = l(a), c.previousPageX = a.pageX, c.previousPageY = a.pageY, c.previousTimeStamp = l(a)) : (c = { touchActive: !0, startPageX: a.pageX, startPageY: a.pageY, startTimeStamp: l(a), currentPageX: a.pageX, currentPageY: a.pageY, currentTimeStamp: l(a), previousPageX: a.pageX, previousPageY: a.pageY, previousTimeStamp: l(a) }, q[b] = c); r.mostRecentTimeStamp = l(a); } function ea(a) { var b = q[J(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 = l(a), r.mostRecentTimeStamp = l(a)) : console.error("Cannot record touch move without a touch start.\nTouch Move: %s\n", "Touch Bank: %s", T(a), U()); } function fa(a) { var b = q[J(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 = l(a), r.mostRecentTimeStamp = l(a)) : console.error("Cannot record touch end without a touch start.\nTouch End: %s\n", "Touch Bank: %s", T(a), U()); } function T(a) { return JSON.stringify({ identifier: a.identifier, pageX: a.pageX, pageY: a.pageY, timestamp: l(a) }); } function U() { var a = JSON.stringify(q.slice(0, 20)); 20 < q.length && (a += " (original size: " + q.length + ")"); return a; } function B(a, b) { null == b ? x("29") : void 0; return null == a ? b : Array.isArray(a) ? a.concat(b) : Array.isArray(b) ? [a].concat(b) : [a, b]; } var Q = null, V = null, N = null, K = p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign; K(z.prototype, { preventDefault: function preventDefault() { this.defaultPrevented = !0; var a = this.nativeEvent; a && (a.preventDefault ? a.preventDefault() : "unknown" !== typeof a.returnValue && (a.returnValue = !1), this.isDefaultPrevented = D); }, stopPropagation: function stopPropagation() { var a = this.nativeEvent; a && (a.stopPropagation ? a.stopPropagation() : "unknown" !== typeof a.cancelBubble && (a.cancelBubble = !0), this.isPropagationStopped = D); }, persist: function persist() { this.isPersistent = D; }, isPersistent: E, destructor: function destructor() { var a = this.constructor.Interface, b; for (b in a) { this[b] = null; } this.nativeEvent = this._targetInst = this.dispatchConfig = null; this.isPropagationStopped = this.isDefaultPrevented = E; this._dispatchInstances = this._dispatchListeners = null; } }); z.Interface = { type: null, target: null, currentTarget: function currentTarget() { return null; }, eventPhase: null, bubbles: null, cancelable: null, timeStamp: function timeStamp(a) { return a.timeStamp || Date.now(); }, defaultPrevented: null, isTrusted: null }; z.extend = function (a) { function b() { return c.apply(this, arguments); } var c = this, f = function f() {}; f.prototype = c.prototype; f = new f(); K(f, b.prototype); b.prototype = f; b.prototype.constructor = b; b.Interface = K({}, c.Interface, a); b.extend = c.extend; S(b); return b; }; S(z); var w = z.extend({ touchHistory: function touchHistory(a) { return null; } }); p = ["touchstart", "mousedown"]; var W = ["touchmove", "mousemove"], X = ["touchcancel", "touchend", "mouseup"], q = [], r = { touchBank: q, numberActiveTouches: 0, indexOfSingleActiveTouch: -1, mostRecentTimeStamp: 0 }, u = { recordTouchTrack: function recordTouchTrack(a, b) { if (F(a)) b.changedTouches.forEach(ea);else if (A(a)) b.changedTouches.forEach(da), r.numberActiveTouches = b.touches.length, 1 === r.numberActiveTouches && (r.indexOfSingleActiveTouch = b.touches[0].identifier);else if (G(a) && (b.changedTouches.forEach(fa), r.numberActiveTouches = b.touches.length, 1 === r.numberActiveTouches)) for (a = 0; a < q.length; a++) { if (b = q[a], null != b && b.touchActive) { r.indexOfSingleActiveTouch = a; break; } } }, touchHistory: r }, k = null, H = 0, L = function L(a, b) { var c = k; k = a; if (null !== I.GlobalResponderHandler) I.GlobalResponderHandler.onChange(c, a, b); }, m = { startShouldSetResponder: { phasedRegistrationNames: { bubbled: "onStartShouldSetResponder", captured: "onStartShouldSetResponderCapture" }, dependencies: p }, scrollShouldSetResponder: { phasedRegistrationNames: { bubbled: "onScrollShouldSetResponder", captured: "onScrollShouldSetResponderCapture" }, dependencies: ["scroll"] }, selectionChangeShouldSetResponder: { phasedRegistrationNames: { bubbled: "onSelectionChangeShouldSetResponder", captured: "onSelectionChangeShouldSetResponderCapture" }, dependencies: ["selectionchange"] }, moveShouldSetResponder: { phasedRegistrationNames: { bubbled: "onMoveShouldSetResponder", captured: "onMoveShouldSetResponderCapture" }, dependencies: W }, responderStart: { registrationName: "onResponderStart", dependencies: p }, responderMove: { registrationName: "onResponderMove", dependencies: W }, responderEnd: { registrationName: "onResponderEnd", dependencies: X }, responderRelease: { registrationName: "onResponderRelease", dependencies: X }, responderTerminationRequest: { registrationName: "onResponderTerminationRequest", dependencies: [] }, responderGrant: { registrationName: "onResponderGrant", dependencies: [] }, responderReject: { registrationName: "onResponderReject", dependencies: [] }, responderTerminate: { registrationName: "onResponderTerminate", dependencies: [] } }, I = { _getResponder: function _getResponder() { return k; }, eventTypes: m, extractEvents: function extractEvents(a, b, c, f) { if (A(a)) H += 1;else if (G(a)) if (0 <= H) --H;else return console.error("Ended a touch event which was not counted in `trackedTouchCount`."), null; u.recordTouchTrack(a, c); if (b && ("scroll" === a && !c.responderIgnoreScroll || 0 < H && "selectionchange" === a || A(a) || F(a))) { var e = A(a) ? m.startShouldSetResponder : F(a) ? m.moveShouldSetResponder : "selectionchange" === a ? m.selectionChangeShouldSetResponder : m.scrollShouldSetResponder; if (k) b: { var d = k; for (var g = 0, h = d; h; h = t(h)) { g++; } h = 0; for (var l = b; l; l = t(l)) { h++; } for (; 0 < g - h;) { d = t(d), g--; } for (; 0 < h - g;) { b = t(b), h--; } for (; g--;) { if (d === b || d === b.alternate) break b; d = t(d); b = t(b); } d = null; } else d = b; b = d === k; d = w.getPooled(e, d, c, f); d.touchHistory = u.touchHistory; b ? v(d, aa) : v(d, Z); b: { e = d._dispatchListeners; b = d._dispatchInstances; if (Array.isArray(e)) for (g = 0; g < e.length && !d.isPropagationStopped(); g++) { if (e[g](d, b[g])) { e = b[g]; break b; } } else if (e && e(d, b)) { e = b; break b; } e = null; } d._dispatchInstances = null; d._dispatchListeners = null; d.isPersistent() || d.constructor.release(d); e && e !== k ? (d = void 0, b = w.getPooled(m.responderGrant, e, c, f), b.touchHistory = u.touchHistory, v(b, y), g = !0 === M(b), k ? (h = w.getPooled(m.responderTerminationRequest, k, c, f), h.touchHistory = u.touchHistory, v(h, y), l = !h._dispatchListeners || M(h), h.isPersistent() || h.constructor.release(h), l ? (h = w.getPooled(m.responderTerminate, k, c, f), h.touchHistory = u.touchHistory, v(h, y), d = B(d, [b, h]), L(e, g)) : (e = w.getPooled(m.responderReject, e, c, f), e.touchHistory = u.touchHistory, v(e, y), d = B(d, e))) : (d = B(d, b), L(e, g)), e = d) : e = null; } else e = null; d = k && A(a); b = k && F(a); g = k && G(a); if (d = d ? m.responderStart : b ? m.responderMove : g ? m.responderEnd : null) d = w.getPooled(d, k, c, f), d.touchHistory = u.touchHistory, v(d, y), e = B(e, d); d = k && "touchcancel" === a; if (a = k && !d && G(a)) a: { if ((a = c.touches) && 0 !== a.length) for (b = 0; b < a.length; b++) { if (g = a[b].target, null !== g && void 0 !== g && 0 !== g) { h = V(g); b: { for (g = k; h;) { if (g === h || g === h.alternate) { g = !0; break b; } h = t(h); } g = !1; } if (g) { a = !1; break a; } } } a = !0; } if (a = d ? m.responderTerminate : a ? m.responderRelease : null) c = w.getPooled(a, k, c, f), c.touchHistory = u.touchHistory, v(c, y), e = B(e, c), L(null); return e; }, GlobalResponderHandler: null, injection: { injectGlobalResponderHandler: function injectGlobalResponderHandler(a) { I.GlobalResponderHandler = a; } } }; n = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events; p = n[3]; (function (a, b, c) { Q = a; V = b; N = c; })(n[2], n[0], n[1]); return { ResponderEventPlugin: I, ResponderTouchHistoryStore: u, injectEventPluginsByName: p }; });