UNPKG

rc-banner-anim-fix

Version:

banner-anim animation component for react

1,426 lines (1,297 loc) 389 kB
(function webpackUniversalModuleDefinition(root, factory) { if (typeof exports === 'object' && typeof module === 'object') module.exports = factory(require('react'), require('react-dom')); else if (typeof define === 'function' && define.amd) define(['react', 'react-dom'], factory); else if (typeof exports === 'object') exports['rc-banner-anim'] = factory(require('react'), require('react-dom')); else root['rc-banner-anim'] = factory(root['React'], root['ReactDOM']); })(typeof self !== 'undefined' ? self : this, function ( __WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_29__, ) { return /******/ (function (modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; // The require function /******/ /******/ /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if (installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } // Create a new module (and put it into the cache) /******/ /******/ var module = (installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {}, /******/ }); // Execute the module function /******/ /******/ /******/ modules[moduleId].call( module.exports, module, module.exports, __webpack_require__, ); // Flag the module as loaded /******/ /******/ /******/ module.l = true; // Return the exports of the module /******/ /******/ /******/ return module.exports; /******/ } // expose the modules object (__webpack_modules__) /******/ /******/ /******/ /******/ __webpack_require__.m = modules; // expose the module cache /******/ /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports /******/ /******/ /******/ __webpack_require__.d = function (exports, name, getter) { /******/ if (!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter, /******/ }); /******/ } /******/ }; // getDefaultExport function for compatibility with non-harmony modules /******/ /******/ /******/ __webpack_require__.n = function (module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; // Object.prototype.hasOwnProperty.call /******/ /******/ /******/ __webpack_require__.o = function (object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; // __webpack_public_path__ /******/ /******/ /******/ __webpack_require__.p = ''; // Load entry module and return exports /******/ /******/ /******/ return __webpack_require__((__webpack_require__.s = 67)); /******/ })( /************************************************************************/ /******/ [ /* 0 */ /***/ function (module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; var _assign = __webpack_require__(71); var _assign2 = _interopRequireDefault(_assign); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = _assign2.default || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /***/ }, /* 1 */ /***/ function (module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_1__; /***/ }, /* 2 */ /***/ function (module, exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = (module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : // eslint-disable-next-line no-new-func Function('return this')()); if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef /***/ }, /* 3 */ /***/ function (module, exports) { var core = (module.exports = { version: '2.6.9' }); if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef /***/ }, /* 4 */ /***/ function (module, exports, __webpack_require__) { // Thank's IE8 for his funny defineProperty module.exports = !__webpack_require__(21)(function () { return ( Object.defineProperty({}, 'a', { get: function () { return 7; }, }).a != 7 ); }); /***/ }, /* 5 */ /***/ function (module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */ (function (process) { /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ if (process.env.NODE_ENV !== 'production') { var ReactIs = __webpack_require__(59); // By explicitly using `prop-types` you are opting into new development behavior. // http://fb.me/prop-types-in-prod var throwOnDirectAccess = true; module.exports = __webpack_require__(113)(ReactIs.isElement, throwOnDirectAccess); } else { // By explicitly using `prop-types` you are opting into new production behavior. // http://fb.me/prop-types-in-prod module.exports = __webpack_require__(116)(); } /* WEBPACK VAR INJECTION */ }.call(exports, __webpack_require__(17))); /***/ }, /* 6 */ /***/ function (module, exports, __webpack_require__) { var anObject = __webpack_require__(20); var IE8_DOM_DEFINE = __webpack_require__(49); var toPrimitive = __webpack_require__(32); var dP = Object.defineProperty; exports.f = __webpack_require__(4) ? Object.defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (IE8_DOM_DEFINE) try { return dP(O, P, Attributes); } catch (e) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; /***/ }, /* 7 */ /***/ function (module, exports) { var hasOwnProperty = {}.hasOwnProperty; module.exports = function (it, key) { return hasOwnProperty.call(it, key); }; /***/ }, /* 8 */ /***/ function (module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports.default = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; /***/ }, /* 9 */ /***/ function (module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; var _typeof2 = __webpack_require__(54); var _typeof3 = _interopRequireDefault(_typeof2); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = function (self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && ((typeof call === 'undefined' ? 'undefined' : (0, _typeof3.default)(call)) === 'object' || typeof call === 'function') ? call : self; }; /***/ }, /* 10 */ /***/ function (module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; var _defineProperty = __webpack_require__(101); var _defineProperty2 = _interopRequireDefault(_defineProperty); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; (0, _defineProperty2.default)(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); /***/ }, /* 11 */ /***/ function (module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; var _setPrototypeOf = __webpack_require__(104); var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf); var _create = __webpack_require__(108); var _create2 = _interopRequireDefault(_create); var _typeof2 = __webpack_require__(54); var _typeof3 = _interopRequireDefault(_typeof2); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError( 'Super expression must either be null or a function, not ' + (typeof superClass === 'undefined' ? 'undefined' : (0, _typeof3.default)(superClass)), ); } subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true, }, }); if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : (subClass.__proto__ = superClass); }; /***/ }, /* 12 */ /***/ function (module, exports, __webpack_require__) { var global = __webpack_require__(2); var core = __webpack_require__(3); var ctx = __webpack_require__(48); var hide = __webpack_require__(13); var has = __webpack_require__(7); var PROTOTYPE = 'prototype'; var $export = function (type, name, source) { var IS_FORCED = type & $export.F; var IS_GLOBAL = type & $export.G; var IS_STATIC = type & $export.S; var IS_PROTO = type & $export.P; var IS_BIND = type & $export.B; var IS_WRAP = type & $export.W; var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); var expProto = exports[PROTOTYPE]; var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]; var key, own, out; if (IS_GLOBAL) source = name; for (key in source) { // contains in native own = !IS_FORCED && target && target[key] !== undefined; if (own && has(exports, key)) continue; // export native or passed out = own ? target[key] : source[key]; // prevent global pollution for namespaces exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] : // bind timers to global for call from export context IS_BIND && own ? ctx(out, global) : // wrap global constructors for prevent change them in library IS_WRAP && target[key] == out ? (function (C) { var F = function (a, b, c) { if (this instanceof C) { switch (arguments.length) { case 0: return new C(); case 1: return new C(a); case 2: return new C(a, b); } return new C(a, b, c); } return C.apply(this, arguments); }; F[PROTOTYPE] = C[PROTOTYPE]; return F; // make static versions for prototype methods })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% if (IS_PROTO) { (exports.virtual || (exports.virtual = {}))[key] = out; // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out); } } }; // type bitmap $export.F = 1; // forced $export.G = 2; // global $export.S = 4; // static $export.P = 8; // proto $export.B = 16; // bind $export.W = 32; // wrap $export.U = 64; // safe $export.R = 128; // real proto method for `library` module.exports = $export; /***/ }, /* 13 */ /***/ function (module, exports, __webpack_require__) { var dP = __webpack_require__(6); var createDesc = __webpack_require__(24); module.exports = __webpack_require__(4) ? function (object, key, value) { return dP.f(object, key, createDesc(1, value)); } : function (object, key, value) { object[key] = value; return object; }; /***/ }, /* 14 */ /***/ function (module, exports) { module.exports = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; /***/ }, /* 15 */ /***/ function (module, exports, __webpack_require__) { // to indexed object, toObject with fallback for non-array-like ES3 strings var IObject = __webpack_require__(52); var defined = __webpack_require__(33); module.exports = function (it) { return IObject(defined(it)); }; /***/ }, /* 16 */ /***/ function (module, exports, __webpack_require__) { var store = __webpack_require__(36)('wks'); var uid = __webpack_require__(27); var Symbol = __webpack_require__(2).Symbol; var USE_SYMBOL = typeof Symbol == 'function'; var $exports = (module.exports = function (name) { return ( store[name] || (store[name] = (USE_SYMBOL && Symbol[name]) || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)) ); }); $exports.store = store; /***/ }, /* 17 */ /***/ function (module, exports) { // shim for using process in browser var process = (module.exports = {}); // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout() { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } })(); function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch (e) { try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch (e) { // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e) { try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e) { // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while (len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return []; }; process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/'; }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function () { return 0; }; /***/ }, /* 18 */ /***/ function (module, __webpack_exports__, __webpack_require__) { 'use strict'; /* harmony export (immutable) */ __webpack_exports__['f'] = toArrayChildren; /* harmony export (immutable) */ __webpack_exports__['c'] = dataToArray; /* harmony export (immutable) */ __webpack_exports__['d'] = setAnimCompToTagComp; /* harmony export (immutable) */ __webpack_exports__['b'] = currentScrollTop; /* harmony export (immutable) */ __webpack_exports__['a'] = currentScrollLeft; /* harmony export (immutable) */ __webpack_exports__['g'] = windowHeight; /* harmony export (immutable) */ __webpack_exports__['e'] = switchChildren; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n( __WEBPACK_IMPORTED_MODULE_0_react__, ); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_prop_types__ = __webpack_require__(5); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_prop_types___default = __webpack_require__.n( __WEBPACK_IMPORTED_MODULE_1_prop_types__, ); function toArrayChildren(children) { var ret = []; __WEBPACK_IMPORTED_MODULE_0_react___default.a.Children.forEach(children, function (c) { ret.push(c); }); return ret; } function dataToArray(vars) { if (!vars && vars !== 0) { return []; } if (Array.isArray(vars)) { return vars; } return [vars]; } function setAnimCompToTagComp(item, i) { if (!item) { return null; } var itemProps = item.props; if (!itemProps.component) { return item; } var props = {}; props.key = item.key || i; // dom global attributes var domAttrArray = [ 'accesskey', 'classname', 'contenteditable', 'contextmenu', 'dir', 'draggable', 'dropzone', 'hidden', 'id', 'lang', 'spellcheck', 'style', 'tabindex', 'title', ]; Object.keys(itemProps).forEach(function (key) { if (domAttrArray.indexOf(key.toLocaleLowerCase()) >= 0 || key.match('data-')) { props[key] = itemProps[key]; } }); return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( itemProps.component, props, itemProps.children, ); } setAnimCompToTagComp.propTypes = { key: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, }; function currentScrollTop() { return ( window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop ); } function currentScrollLeft() { return ( window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft ); } function windowHeight() { return ( window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight ); } function switchChildren(hideProps, item) { if (!hideProps) { return item; } if (item.type.isTweenOne) { return __WEBPACK_IMPORTED_MODULE_0_react___default.a.cloneElement(item, { reverse: true, }); } return __WEBPACK_IMPORTED_MODULE_0_react___default.a.cloneElement(item, item.props, null); } /***/ }, /* 19 */ /***/ function (module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports.default = function (obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }; /***/ }, /* 20 */ /***/ function (module, exports, __webpack_require__) { var isObject = __webpack_require__(14); module.exports = function (it) { if (!isObject(it)) throw TypeError(it + ' is not an object!'); return it; }; /***/ }, /* 21 */ /***/ function (module, exports) { module.exports = function (exec) { try { return !!exec(); } catch (e) { return true; } }; /***/ }, /* 22 */ /***/ function (module, __webpack_exports__, __webpack_require__) { 'use strict'; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, 'm', function () { return windowIsUndefined; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, 'l', function () { return transformOrFilter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, 'i', function () { return styleValueToArray; }); /* harmony export (immutable) */ __webpack_exports__['j'] = toArrayChildren; /* harmony export (immutable) */ __webpack_exports__['a'] = dataToArray; /* harmony export (immutable) */ __webpack_exports__['f'] = objectEqual; /* harmony export (immutable) */ __webpack_exports__['b'] = findChildInChildrenByKey; /* harmony export (immutable) */ __webpack_exports__['e'] = mergeChildren; /* harmony export (immutable) */ __webpack_exports__['k'] = transformArguments; /* harmony export (immutable) */ __webpack_exports__['c'] = getChildrenFromProps; /* harmony export (immutable) */ __webpack_exports__['h'] = startConvertToEndUnit; /* harmony export (immutable) */ __webpack_exports__['g'] = parsePath; /* harmony export (immutable) */ __webpack_exports__['d'] = getTransformValue; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n( __WEBPACK_IMPORTED_MODULE_0_react__, ); var windowIsUndefined = !( typeof window !== 'undefined' && window.document && window.document.createElement ); var transformOrFilter = { transform: 1, '-ms-transform': 1, '-moz-transform': 1, '-webkit-transform': 1, '-o-transform': 1, filter: 1, '-webkit-filter': 1, }; var styleValueToArray = { margin: 1, padding: 1, borderWidth: 1, borderRadius: 1, }; function toArrayChildren(children) { var ret = []; __WEBPACK_IMPORTED_MODULE_0_react___default.a.Children.forEach(children, function (c) { ret.push(c); }); return ret; } function dataToArray(vars) { if (!vars && vars !== 0) { return []; } if (Array.isArray(vars)) { return vars; } return [vars]; } function deepEql(a, b) { if (!a || !b) { return false; } var $a = Object.keys(a); var $b = Object.keys(b); if ($a.length && $b.length && $a.length === $b.length) { return !$a.some(function (key) { var aa = a[key]; var bb = b[key]; if (Array.isArray(aa) && Array.isArray(bb)) { aa = aa.join(); bb = bb.join(); } return aa !== bb; }); } return false; } function objectEqual(obj1, obj2) { if (obj1 === obj2 || deepEql(obj1, obj2)) { return true; } if (!obj1 || !obj2) { return false; } // animation 写在标签上的进行判断是否相等, 判断每个参数有没有 function; var equalBool = true; if (Array.isArray(obj1) && Array.isArray(obj2)) { if (obj1.length !== obj2.length) { return false; } for (var i = 0; i < obj1.length; i++) { var currentObj = obj1[i]; var nextObj = obj2[i]; for (var p in currentObj) { // eslint-disable-line no-restricted-syntax if (currentObj[p] !== nextObj[p]) { if (typeof currentObj[p] === 'object' && typeof nextObj[p] === 'object') { equalBool = objectEqual(currentObj[p], nextObj[p]); } else if ( typeof currentObj[p] === 'function' && typeof nextObj[p] === 'function' ) { if (currentObj[p].name !== nextObj[p].name) { equalBool = false; } } else { equalBool = false; } if (!equalBool) { return false; } } } } } var setEqualBool = function setEqualBool(objA, objB) { Object.keys(objA).forEach(function (key) { // 如果前面有参数匹配不相同则直接返回; if (!equalBool) { return; } if (!(key in objB)) { equalBool = false; } if (typeof objA[key] === 'object' && typeof objB[key] === 'object') { equalBool = objectEqual(objA[key], objB[key]); } else if (typeof objA[key] === 'function' && typeof objB[key] === 'function') { if (objA[key].name !== objB[key].name) { equalBool = false; } } else if (objA[key] !== objB[key]) { equalBool = false; } }); }; setEqualBool(obj1, obj2); setEqualBool(obj2, obj1); return equalBool; } function findChildInChildrenByKey(children, key) { var ret = null; if (children) { children.forEach(function (c) { if (ret || !c) { return; } if (c.key === key) { ret = c; } }); } return ret; } function mergeChildren(prev, next) { var ret = []; // For each key of `next`, the list of keys to insert before that key in // the combined list var nextChildrenPending = {}; var pendingChildren = []; var followChildrenKey = void 0; prev.forEach(function (c) { if (!c) { return; } if (findChildInChildrenByKey(next, c.key)) { if (pendingChildren.length) { nextChildrenPending[c.key] = pendingChildren; pendingChildren = []; } followChildrenKey = c.key; } else if (c.key) { pendingChildren.push(c); } }); if (!followChildrenKey) { ret = ret.concat(pendingChildren); } next.forEach(function (c) { if (!c) { return; } if (nextChildrenPending.hasOwnProperty(c.key)) { // eslint-disable-line no-prototype-builtins ret = ret.concat(nextChildrenPending[c.key]); } ret.push(c); if (c.key === followChildrenKey) { ret = ret.concat(pendingChildren); } }); return ret; } function transformArguments(arg, key, i) { var result = void 0; if (typeof arg === 'function') { result = arg({ key: key, index: i, }); } else { result = arg; } return result; } function getChildrenFromProps(props) { return props && props.children; } function startConvertToEndUnit( target, computedStyle, style, num, unit, dataUnit, fixed, isOriginWidth, ) { if (windowIsUndefined) { return num; } var horiz = /(?:Left|Right|Width|X)/i.test(style) || isOriginWidth; horiz = style === 'padding' || style === 'marign' ? true : horiz; var t = style.indexOf('border') !== -1 || style.indexOf('translate') !== -1 || style === 'transformOrigin' ? target : target.parentNode || document.body; t = fixed ? document.body : t; var pix = void 0; var htmlComputedStyle = void 0; // transform 在 safari 下会留着单位,chrome 下会全部转换成 px; switch (unit) { case '%': pix = (parseFloat(num) / 100) * (horiz ? t.clientWidth : t.clientHeight); break; case 'vw': pix = (parseFloat(num) * document.body.clientWidth) / 100; break; case 'vh': pix = (parseFloat(num) * document.body.clientHeight) / 100; break; case 'em': pix = parseFloat(num) * parseFloat(computedStyle.fontSize); break; case 'rem': { htmlComputedStyle = window.getComputedStyle(document.getElementsByTagName('html')[0]); pix = parseFloat(num) * parseFloat(htmlComputedStyle.fontSize); break; } default: pix = parseFloat(num); break; } switch (dataUnit) { case '%': pix = pix ? (pix * 100) / (horiz ? t.clientWidth : t.clientHeight) : 0; break; case 'vw': pix = (parseFloat(num) / document.body.clientWidth) * 100; break; case 'vh': pix = (parseFloat(num) / document.body.clientHeight) * 100; break; case 'em': pix = parseFloat(num) / parseFloat(computedStyle.fontSize); break; case 'rem': { htmlComputedStyle = htmlComputedStyle || window.getComputedStyle(document.getElementsByTagName('html')[0]); pix = parseFloat(num) / parseFloat(htmlComputedStyle.fontSize); break; } default: break; } return pix; } function parsePath(path) { if (typeof path === 'string') { if (path.charAt(0).match(/m/i)) { var domPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); domPath.setAttributeNS(null, 'd', path); return domPath; } return document.querySelector(path); } else if (path.style) { return path; } throw new Error('Error while parsing the path'); } function getTransformValue(t) { if (typeof t === 'string') { return t; } var perspective = t.perspective; var angle = t.rotate; var rotateX = t.rotateX; var rotateY = t.rotateY; var sx = t.scaleX; var sy = t.scaleY; var sz = t.scaleZ; var skx = t.skewX; var sky = t.skewY; var translateX = typeof t.translateX === 'string' ? t.translateX : t.translateX + 'px'; var translateY = typeof t.translateY === 'string' ? t.translateY : t.translateY + 'px'; var translateZ = typeof t.translateZ === 'string' ? t.translateZ : t.translateZ + 'px'; var sk = skx || sky ? 'skew(' + skx + 'deg,' + sky + 'deg)' : ''; var an = angle ? 'rotate(' + angle + 'deg)' : ''; var ss = sx !== 1 || sy !== 1 || sz !== 1 ? 'scale3d(' + sx + ',' + sy + ',' + sz + ')' : ''; var rX = rotateX ? 'rotateX(' + rotateX + 'deg)' : ''; var rY = rotateY ? 'rotateY(' + rotateY + 'deg)' : ''; var per = perspective ? 'perspective(' + perspective + 'px)' : ''; var defaultTranslate = ss || an || rX || rY || sk ? '' : 'translate(0px, 0px)'; var translate = t.translateZ ? 'translate3d(' + translateX + ',' + translateY + ',' + translateZ + ')' : ((t.translateX || t.translateY) && 'translate(' + translateX + ',' + translateY + ')') || defaultTranslate; return ( per + ' ' + translate + ' ' + ss + ' ' + an + ' ' + rX + ' ' + rY + ' ' + sk ).trim(); } /***/ }, /* 23 */ /***/ function (module, __webpack_exports__, __webpack_require__) { 'use strict'; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, 'a', function () { return polyfill; }); /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ function componentWillMount() { // Call this.constructor.gDSFP to support sub-classes. var state = this.constructor.getDerivedStateFromProps(this.props, this.state); if (state !== null && state !== undefined) { this.setState(state); } } function componentWillReceiveProps(nextProps) { // Call this.constructor.gDSFP to support sub-classes. // Use the setState() updater to ensure state isn't stale in certain edge cases. function updater(prevState) { var state = this.constructor.getDerivedStateFromProps(nextProps, prevState); return state !== null && state !== undefined ? state : null; } // Binding "this" is important for shallow renderer support. this.setState(updater.bind(this)); } function componentWillUpdate(nextProps, nextState) { try { var prevProps = this.props; var prevState = this.state; this.props = nextProps; this.state = nextState; this.__reactInternalSnapshotFlag = true; this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(prevProps, prevState); } finally { this.props = prevProps; this.state = prevState; } } // React may warn about cWM/cWRP/cWU methods being deprecated. // Add a flag to suppress these warnings for this special case. componentWillMount.__suppressDeprecationWarning = true; componentWillReceiveProps.__suppressDeprecationWarning = true; componentWillUpdate.__suppressDeprecationWarning = true; function polyfill(Component) { var prototype = Component.prototype; if (!prototype || !prototype.isReactComponent) { throw new Error('Can only polyfill class components'); } if ( typeof Component.getDerivedStateFromProps !== 'function' && typeof prototype.getSnapshotBeforeUpdate !== 'function' ) { return Component; } // If new component APIs are defined, "unsafe" lifecycles won't be called. // Error if any of these lifecycles are present, // Because they would work differently between older and newer (16.3+) versions of React. var foundWillMountName = null; var foundWillReceivePropsName = null; var foundWillUpdateName = null; if (typeof prototype.componentWillMount === 'function') { foundWillMountName = 'componentWillMount'; } else if (typeof prototype.UNSAFE_componentWillMount === 'function') { foundWillMountName = 'UNSAFE_componentWillMount'; } if (typeof prototype.componentWillReceiveProps === 'function') { foundWillReceivePropsName = 'componentWillReceiveProps'; } else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') { foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps'; } if (typeof prototype.componentWillUpdate === 'function') { foundWillUpdateName = 'componentWillUpdate'; } else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') { foundWillUpdateName = 'UNSAFE_componentWillUpdate'; } if ( foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null ) { var componentName = Component.displayName || Component.name; var newApiName = typeof Component.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()'; throw Error( 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + componentName + ' uses ' + newApiName + ' but also contains the following legacy lifecycles:' + (foundWillMountName !== null ? '\n ' + foundWillMountName : '') + (foundWillReceivePropsName !== null ? '\n ' + foundWillReceivePropsName : '') + (foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '') + '\n\nThe above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-async-component-lifecycle-hooks', ); } // React <= 16.2 does not support static getDerivedStateFromProps. // As a workaround, use cWM and cWRP to invoke the new static lifecycle. // Newer versions of React will ignore these lifecycles if gDSFP exists. if (typeof Component.getDerivedStateFromProps === 'function') { prototype.componentWillMount = componentWillMount; prototype.componentWillReceiveProps = componentWillReceiveProps; } // React <= 16.2 does not support getSnapshotBeforeUpdate. // As a workaround, use cWU to invoke the new lifecycle. // Newer versions of React will ignore that lifecycle if gSBU exists. if (typeof prototype.getSnapshotBeforeUpdate === 'function') { if (typeof prototype.componentDidUpdate !== 'function') { throw new Error( 'Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype', ); } prototype.componentWillUpdate = componentWillUpdate; var componentDidUpdate = prototype.componentDidUpdate; prototype.componentDidUpdate = function componentDidUpdatePolyfill( prevProps, prevState, maybeSnapshot, ) { // 16.3+ will not execute our will-update method; // It will pass a snapshot value to did-update though. // Older versions will require our polyfilled will-update value. // We need to handle both cases, but can't just check for the presence of "maybeSnapshot", // Because for <= 15.x versions this might be a "prevContext" object. // We also can't just check "__reactInternalSnapshot", // Because get-snapshot might return a falsy value. // So check for the explicit __reactInternalSnapshotFlag flag to determine behavior. var snapshot = this.__reactInternalSnapshotFlag ? this.__reactInternalSnapshot : maybeSnapshot; componentDidUpdate.call(this, prevProps, prevState, snapshot); }; } return Component; } /***/ }, /* 24 */ /***/ function (module, exports) { module.exports = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value, }; }; /***/ }, /* 25 */ /***/ function (module, exports, __webpack_require__) { // 19.1.2.14 / 15.2.3.14 Object.keys(O) var $keys = __webpack_require__(51); var enumBugKeys = __webpack_require__(37); module.exports = Object.keys || function keys(O) { return $keys(O, enumBugKeys); }; /***/ }, /* 26 */ /***/ function (module, exports) { module.exports = true; /***/ }, /* 27 */ /***/ function (module, exports) { var id = 0; var px = Math.random(); module.exports = function (key) { return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; /***/ }, /* 28 */ /***/ function (module, exports) { exports.f = {}.propertyIsEnumerable; /***/ }, /* 29 */ /***/ function (module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_29__; /***/ }, /* 30 */ /***/ function (module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, '__esModule', { value: true, }); exports.toCssLowerCase = toCssLowerCase; exports.toStyleUpperCase = toStyleUpperCase; exports.toFixed = toFixed; exports.createMatrix = createMatrix; exports.checkStyleName = checkStyleName; exports.getGsapType = getGsapType; exports.parseColor = parseColor; exports.parseShadow = parseShadow; exports.getColor = getColor; exports.isTransform = isTransform; exports