UNPKG

rc-tween-one

Version:
1,596 lines (1,345 loc) 217 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-tween-one"] = factory(require("react"), require("react-dom")); else root["rc-tween-one"] = factory(root["React"], root["ReactDOM"]); })(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_32__, __WEBPACK_EXTERNAL_MODULE_104__) { 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 = 57); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (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 /***/ }), /* 1 */ /***/ (function(module, exports) { var core = module.exports = { version: '2.5.7' }; if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { var anObject = __webpack_require__(10); var IE8_DOM_DEFINE = __webpack_require__(37); var toPrimitive = __webpack_require__(20); var dP = Object.defineProperty; exports.f = __webpack_require__(3) ? 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; }; /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { // Thank's IE8 for his funny defineProperty module.exports = !__webpack_require__(11)(function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; }); /***/ }), /* 4 */ /***/ (function(module, exports) { var hasOwnProperty = {}.hasOwnProperty; module.exports = function (it, key) { return hasOwnProperty.call(it, key); }; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(0); var core = __webpack_require__(1); var ctx = __webpack_require__(36); var hide = __webpack_require__(6); var has = __webpack_require__(4); 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; /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { var dP = __webpack_require__(2); var createDesc = __webpack_require__(14); module.exports = __webpack_require__(3) ? function (object, key, value) { return dP.f(object, key, createDesc(1, value)); } : function (object, key, value) { object[key] = value; return object; }; /***/ }), /* 7 */ /***/ (function(module, exports) { module.exports = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { // to indexed object, toObject with fallback for non-array-like ES3 strings var IObject = __webpack_require__(40); var defined = __webpack_require__(21); module.exports = function (it) { return IObject(defined(it)); }; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { var store = __webpack_require__(24)('wks'); var uid = __webpack_require__(17); var Symbol = __webpack_require__(0).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; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(7); module.exports = function (it) { if (!isObject(it)) throw TypeError(it + ' is not an object!'); return it; }; /***/ }), /* 11 */ /***/ (function(module, exports) { module.exports = function (exec) { try { return !!exec(); } catch (e) { return true; } }; /***/ }), /* 12 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return windowIsUndefined; }); /* harmony export (immutable) */ __webpack_exports__["i"] = 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__["j"] = 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__(32); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_deep_eql__ = __webpack_require__(105); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_deep_eql___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_deep_eql__); var windowIsUndefined = !(typeof window !== 'undefined' && window.document && window.document.createElement); 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 objectEqual(obj1, obj2) { if (obj1 === obj2 || __WEBPACK_IMPORTED_MODULE_1_deep_eql___default()(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; return false; } } } } } var setEqualBool = function setEqualBool(objA, objB) { Object.keys(objA).forEach(function (key) { 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 ? 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 defautlTranslate = ss || an || rX || rY || sk ? '' : 'translate(0px, 0px)'; var translate = t.translateZ ? 'translate3d(' + translateX + ',' + translateY + ',' + translateZ + ')' : (t.translateX || t.translateY) && 'translate(' + translateX + ',' + translateY + ')' || defautlTranslate; return (per + ' ' + translate + ' ' + ss + ' ' + an + ' ' + rX + ' ' + rY + ' ' + sk).trim(); } /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _assign = __webpack_require__(60); 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; }; /***/ }), /* 14 */ /***/ (function(module, exports) { module.exports = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.14 / 15.2.3.14 Object.keys(O) var $keys = __webpack_require__(39); var enumBugKeys = __webpack_require__(25); module.exports = Object.keys || function keys(O) { return $keys(O, enumBugKeys); }; /***/ }), /* 16 */ /***/ (function(module, exports) { module.exports = true; /***/ }), /* 17 */ /***/ (function(module, exports) { var id = 0; var px = Math.random(); module.exports = function (key) { return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; /***/ }), /* 18 */ /***/ (function(module, exports) { exports.f = {}.propertyIsEnumerable; /***/ }), /* 19 */ /***/ (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; }; /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.1 ToPrimitive(input [, PreferredType]) var isObject = __webpack_require__(7); // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string module.exports = function (it, S) { if (!isObject(it)) return it; var fn, val; if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; throw TypeError("Can't convert object to primitive value"); }; /***/ }), /* 21 */ /***/ (function(module, exports) { // 7.2.1 RequireObjectCoercible(argument) module.exports = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; /***/ }), /* 22 */ /***/ (function(module, exports) { // 7.1.4 ToInteger var ceil = Math.ceil; var floor = Math.floor; module.exports = function (it) { return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); }; /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { var shared = __webpack_require__(24)('keys'); var uid = __webpack_require__(17); module.exports = function (key) { return shared[key] || (shared[key] = uid(key)); }; /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { var core = __webpack_require__(1); var global = __webpack_require__(0); var SHARED = '__core-js_shared__'; var store = global[SHARED] || (global[SHARED] = {}); (module.exports = function (key, value) { return store[key] || (store[key] = value !== undefined ? value : {}); })('versions', []).push({ version: core.version, mode: __webpack_require__(16) ? 'pure' : 'global', copyright: '© 2018 Denis Pushkarev (zloirock.ru)' }); /***/ }), /* 25 */ /***/ (function(module, exports) { // IE 8- don't enum bug keys module.exports = ( 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' ).split(','); /***/ }), /* 26 */ /***/ (function(module, exports) { exports.f = Object.getOwnPropertySymbols; /***/ }), /* 27 */ /***/ (function(module, exports) { module.exports = {}; /***/ }), /* 28 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) var anObject = __webpack_require__(10); var dPs = __webpack_require__(76); var enumBugKeys = __webpack_require__(25); var IE_PROTO = __webpack_require__(23)('IE_PROTO'); var Empty = function () { /* empty */ }; var PROTOTYPE = 'prototype'; // Create object with fake `null` prototype: use iframe Object with cleared prototype var createDict = function () { // Thrash, waste and sodomy: IE GC bug var iframe = __webpack_require__(38)('iframe'); var i = enumBugKeys.length; var lt = '<'; var gt = '>'; var iframeDocument; iframe.style.display = 'none'; __webpack_require__(77).appendChild(iframe); iframe.src = 'javascript:'; // eslint-disable-line no-script-url // createDict = iframe.contentWindow.Object; // html.removeChild(iframe); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); iframeDocument.close(); createDict = iframeDocument.F; while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; return createDict(); }; module.exports = Object.create || function create(O, Properties) { var result; if (O !== null) { Empty[PROTOTYPE] = anObject(O); result = new Empty(); Empty[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO] = O; } else result = createDict(); return Properties === undefined ? result : dPs(result, Properties); }; /***/ }), /* 29 */ /***/ (function(module, exports, __webpack_require__) { var def = __webpack_require__(2).f; var has = __webpack_require__(4); var TAG = __webpack_require__(9)('toStringTag'); module.exports = function (it, tag, stat) { if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); }; /***/ }), /* 30 */ /***/ (function(module, exports, __webpack_require__) { exports.f = __webpack_require__(9); /***/ }), /* 31 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(0); var core = __webpack_require__(1); var LIBRARY = __webpack_require__(16); var wksExt = __webpack_require__(30); var defineProperty = __webpack_require__(2).f; module.exports = function (name) { var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) }); }; /***/ }), /* 32 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_32__; /***/ }), /* 33 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * 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. */ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; module.exports = ReactPropTypesSecret; /***/ }), /* 34 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* eslint-disable func-names */ var Plugins = function Plugins() {}; var p = Plugins.prototype; p.push = function (plugin) { this[plugin.prototype.name] = plugin; }; /* harmony default export */ __webpack_exports__["a"] = (new Plugins()); /***/ }), /* 35 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends__ = __webpack_require__(13); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck__ = __webpack_require__(43); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass__ = __webpack_require__(44); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn__ = __webpack_require__(45); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits__ = __webpack_require__(51); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_react__ = __webpack_require__(32); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_react__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_prop_types__ = __webpack_require__(52); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_prop_types__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_react_dom__ = __webpack_require__(104); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_react_dom___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_react_dom__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__util__ = __webpack_require__(12); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Tween__ = __webpack_require__(107); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__ticker__ = __webpack_require__(56); function noop() {} var perFrame = Math.round(1000 / 60); var objectOrArray = __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.oneOfType([__WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.object, __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.array]); var TweenOne = function (_Component) { __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits___default()(TweenOne, _Component); function TweenOne(props) { __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck___default()(this, TweenOne); var _this = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn___default()(this, (TweenOne.__proto__ || Object.getPrototypeOf(TweenOne)).call(this, props)); _initialiseProps.call(_this); _this.rafID = -1; _this.setDefalut(props); _this.paused = props.paused; _this.reverse = props.reverse; _this.updateAnim = false; _this.forced = {}; _this.setForcedJudg(props); return _this; } __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass___default()(TweenOne, [{ key: 'componentDidMount', value: function componentDidMount() { this.dom = __WEBPACK_IMPORTED_MODULE_7_react_dom___default.a.findDOMNode(this); if (this.dom && this.dom.nodeName !== '#text') { this.start(); } } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { if (!this.tween && !this.dom) { this.updateAnim = true; return; } // 动画处理 var newAnimation = nextProps.animation; var currentAnimation = this.props.animation; var equal = Object(__WEBPACK_IMPORTED_MODULE_8__util__["f" /* objectEqual */])(currentAnimation, newAnimation); if (!equal) { if (nextProps.resetStyle && this.tween) { this.tween.resetDefaultStyle(); } this.setDefalut(nextProps); this.updateAnim = true; } // 跳帧事件 moment; var nextMoment = nextProps.moment; if (typeof nextMoment === 'number' && nextMoment !== this.props.moment) { if (this.tween && !this.updateAnim) { this.startMoment = nextMoment; this.startFrame = __WEBPACK_IMPORTED_MODULE_10__ticker__["a" /* default */].frame; if (nextProps.paused) { this.raf(); } if (this.tween.progressTime >= this.tween.totalTime) { this.play(); } } else { this.setDefalut(nextProps); this.updateAnim = true; } } // 暂停倒放 if (this.paused !== nextProps.paused || this.reverse !== nextProps.reverse) { this.paused = nextProps.paused; this.reverse = nextProps.reverse; if (this.paused) { this.cancelRequestAnimationFrame(); } else if (this.reverse && nextProps.reverseDelay) { this.cancelRequestAnimationFrame(); __WEBPACK_IMPORTED_MODULE_10__ticker__["a" /* default */].timeout(this.restart, nextProps.reverseDelay); } else { // 在 form 状态下,暂停时拉 moment 时,start 有值恢复播放,在 delay 的时间没有处理。。 if (this.tween) { this.tween.resetAnimData(); this.tween.resetDefaultStyle(); } if (!this.updateAnim) { this.restart(); } } } var styleEqual = Object(__WEBPACK_IMPORTED_MODULE_8__util__["f" /* objectEqual */])(this.props.style, nextProps.style); if (!styleEqual) { // 在动画时更改了 style, 作为更改开始数值。 if (this.tween) { this.tween.reStart(nextProps.style); if (this.paused) { this.raf(); } } } this.setForcedJudg(nextProps); } }, { key: 'componentDidUpdate', value: function componentDidUpdate() { if (!this.dom) { this.dom = __WEBPACK_IMPORTED_MODULE_7_react_dom___default.a.findDOMNode(this); } // 样式更新了后再执行动画; if (this.updateAnim && this.dom && this.dom.nodeName !== '#text') { if (this.tween) { this.cancelRequestAnimationFrame(); } this.start(); } } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { this.cancelRequestAnimationFrame(); } /** * @method setForcedJudg * @param props * QueueAnim 套在组件下面后导至子级变化。 * <QueueAnim component={Menu} > * <SubMenu key="a" title="导航"> * <Item /> * </SubMenu> * </QueueAnim> * rc-Menu 里是以 isXXX 来判断是 rc-Menu 的子级; * 如: 用 isSubMenu 来处理 hover 事件 * 地址: https://github.com/react-component/menu/blob/master/src/MenuMixin.js#L172 * 暂时方案: 在组件里添加判断用的值。 */ }, { key: 'render', value: function render() { var props = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, this.props); ['animation', 'component', 'componentProps', 'reverseDelay', 'attr', 'paused', 'reverse', 'repeat', 'yoyo', 'moment', 'resetStyle', 'forcedJudg'].forEach(function (key) { return delete props[key]; }); props.style = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, this.props.style); Object.keys(props.style).forEach(function (p) { if (p.match(/filter/i)) { ['Webkit', 'Moz', 'Ms', 'ms'].forEach(function (prefix) { props.style[prefix + 'Filter'] = props.style[p]; }); } }); // component 为空时调用子级的。。 if (!this.props.component) { if (!this.props.children) { return this.props.children; } var childrenProps = this.props.children.props; var style = childrenProps.style, className = childrenProps.className; // 合并 style 与 className。 var newStyle = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, style, props.style); var newClassName = props.className ? props.className + ' ' + className : className; return __WEBPACK_IMPORTED_MODULE_5_react___default.a.cloneElement(this.props.children, { style: newStyle, className: newClassName }); } return __WEBPACK_IMPORTED_MODULE_5_react___default.a.createElement(this.props.component, __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, props, this.props.componentProps)); } }]); return TweenOne; }(__WEBPACK_IMPORTED_MODULE_5_react__["Component"]); TweenOne.propTypes = { component: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.any, componentProps: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.any, animation: objectOrArray, children: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.any, style: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.object, paused: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.bool, reverse: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.bool, reverseDelay: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.number, yoyo: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.bool, repeat: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.number, moment: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.number, attr: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.string, onChange: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.func, resetStyle: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.bool, forcedJudg: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.object }; TweenOne.defaultProps = { component: 'div', componentProps: {}, reverseDelay: 0, repeat: 0, attr: 'style', onChange: noop }; var _initialiseProps = function _initialiseProps() { var _this2 = this; this.setForcedJudg = function (props) { Object.keys(_this2.forced).forEach(function (key) { delete _this2[key]; delete _this2.forced[key]; }); if (props.forcedJudg) { Object.keys(props.forcedJudg).forEach(function (key) { if (!_this2[key]) { _this2[key] = props.forcedJudg[key]; _this2.forced[key] = 1; } }); } }; this.setDefalut = function (props) { _this2.moment = props.moment || 0; _this2.startMoment = props.moment || 0; _this2.startFrame = __WEBPACK_IMPORTED_MODULE_10__ticker__["a" /* default */].frame; }; this.restart = function () { if (!_this2.tween) { return; } _this2.startMoment = _this2.moment; _this2.startFrame = __WEBPACK_IMPORTED_MODULE_10__ticker__["a" /* default */].frame; _this2.tween.reverse = _this2.reverse; _this2.tween.reverseStartTime = _this2.startMoment; _this2.raf(); _this2.play(); }; this.start = function () { _this2.updateAnim = false; var props = _this2.props; if (props.animation && Object.keys(props.animation).length) { _this2.tween = new __WEBPACK_IMPORTED_MODULE_9__Tween__["a" /* default */](_this2.dom, Object(__WEBPACK_IMPORTED_MODULE_8__util__["a" /* dataToArray */])(props.animation), { attr: props.attr }); _this2.tween.reverse = _this2.reverse; // 预先注册 raf, 初始动画数值。 _this2.raf(); // 开始动画 _this2.play(); } }; this.play = function () { _this2.cancelRequestAnimationFrame(); if (_this2.paused) { return; } _this2.rafID = __WEBPACK_IMPORTED_MODULE_10__ticker__["a" /* default */].add(_this2.raf); }; this.frame = function () { var yoyo = _this2.props.yoyo; var repeat = _this2.props.repeat; var totalTime = repeat === -1 ? Number.MAX_VALUE : _this2.tween.totalTime * (repeat + 1); repeat = repeat >= 0 ? repeat : Number.MAX_VALUE; var moment = (__WEBPACK_IMPORTED_MODULE_10__ticker__["a" /* default */].frame - _this2.startFrame) * perFrame + _this2.startMoment; if (_this2.reverse) { moment = (_this2.startMoment || 0) - (__WEBPACK_IMPORTED_MODULE_10__ticker__["a" /* default */].frame - _this2.startFrame) * perFrame; } moment = moment > totalTime ? totalTime : moment; moment = moment <= 0 ? 0 : moment; var repeatNum = Math.floor(moment / _this2.tween.totalTime) || 0; repeatNum = repeatNum > repeat ? repeat : repeatNum; var tweenMoment = moment - _this2.tween.totalTime * repeatNum; tweenMoment = tweenMoment < perFrame && !_this2.reverse ? 0 : tweenMoment; if (repeat && moment && moment - _this2.tween.totalTime * repeatNum < perFrame) { // 在重置样式之前补 complete; _this2.tween.frame(_this2.tween.totalTime * repeatNum); } if (moment < _this2.moment && !_this2.reverse || repeat !== 0 && repeatNum && tweenMoment <= perFrame) { // 在 form 状态下,暂停时拉 moment 时,start 有值,,往返方向播放时,在 delay 的时间没有处理。。 // 与上面的处理一样,删除 start ,重新走一遍 start。。 _this2.tween.resetAnimData(); _this2.tween.resetDefaultStyle(); } var yoyoReverse = yoyo && repeatNum % 2; if (yoyoReverse) { tweenMoment = _this2.tween.totalTime - tweenMoment; } _this2.tween.onChange = function (e) { var cb = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, e, { timelineMode: '' }); if (!moment && !_this2.reverse || _this2.reverse && _this2.moment === _this2.startMoment) { cb.timelineMode = 'onTimelineStart'; } else if (moment >= totalTime && !_this2.reverse || !moment && _this2.reverse) { cb.timelineMode = 'onTimelineComplete'; } else if (repeatNum !== _this2.timelineRepeatNum) { cb.timelineMode = 'onTimelineRepeat'; } else { cb.timelineMode = 'onTimelineUpdate'; } _this2.props.onChange(cb); }; _this2.moment = moment; _this2.timelineRepeatNum = repeatNum; _this2.tween.frame(tweenMoment); }; this.raf = function () { var tween = _this2.tween; _this2.frame(); if (tween !== _this2.tween) { // 在 onComplete 时更换动画时,raf 没结束,所以需要强制退出,避逸两个时间的冲突。 return null; } var repeat = _this2.props.repeat; var totalTime = repeat === -1 ? Number.MAX_VALUE : _this2.tween.totalTime * (repeat + 1); if (_this2.moment >= totalTime && !_this2.reverse || _this2.paused || _this2.reverse && _this2.moment === 0) { return _this2.cancelRequestAnimationFrame(); } return null; }; this.cancelRequestAnimationFrame = function () { __WEBPACK_IMPORTED_MODULE_10__ticker__["a" /* default */].clear(_this2.rafID); _this2.rafID = -1; }; }; TweenOne.isTweenOne = true; /* harmony default export */ __webpack_exports__["a"] = (TweenOne); /***/ }), /* 36 */ /***/ (function(module, exports, __webpack_require__) { // optional / simple context binding var aFunction = __webpack_require__(63); module.exports = function (fn, that, length) { aFunction(fn); if (that === undefined) return fn; switch (length) { case 1: return function (a) { return fn.call(that, a); }; case 2: return function (a, b) { return fn.call(that, a, b); }; case 3: return function (a, b, c) { return fn.call(that, a, b, c); }; } return function (/* ...args */) { return fn.apply(that, arguments); }; }; /***/ }), /* 37 */ /***/ (function(module, exports, __webpack_require__) { module.exports = !__webpack_require__(3) && !__webpack_require__(11)(function () { return Object.defineProperty(__webpack_require__(38)('div'), 'a', { get: function () { return 7; } }).a != 7; }); /***/ }), /* 38 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(7); var document = __webpack_require__(0).document; // typeof document.createElement is 'object' in old IE var is = isObject(document) && isObject(document.createElement); module.exports = function (it) { return is ? document.createElement(it) : {}; }; /***/ }), /* 39 */ /***/ (function(module, exports, __webpack_require__) { var has = __webpack_require__(4); var toIObject = __webpack_require__(8); var arrayIndexOf = __webpack_require__(65)(false); var IE_PROTO = __webpack_require__(23)('IE_PROTO'); module.exports = function (object, names) { var O = toIObject(object); var i = 0; var result = []; var key; for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); // Don't enum bug & hidden keys while (names.length > i) if (has(O, key = names[i++])) { ~arrayIndexOf(result, key) || result.push(key); } return result; }; /***/ }), /* 40 */ /***/ (function(module, exports, __webpack_require__) { // fallback for non-array-like ES3 and non-enumerable old V8 strings var cof = __webpack_require__(41); // eslint-disable-next-line no-prototype-builtins module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { return cof(it) == 'String' ? it.split('') : Object(it); }; /***/ }), /* 41 */ /***/ (function(module, exports) { var toString = {}.toString; module.exports = function (it) { return toString.call(it).slice(8, -1); }; /***/ }), /* 42 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.13 ToObject(argument) var defined = __webpack_require__(21); module.exports = function (it) { return Object(defined(it)); }; /***/ }), /* 43 */ /***/ (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"); } }; /***/ }), /* 44 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _defineProperty = __webpack_require__(68); 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; }; }(); /***/ }), /* 45 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _typeof2 = __webpack_require__(46); 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; }; /***/ }), /* 46 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _iterator = _