remeasure
Version:
Get position and size of the DOM element for any React Component
1,481 lines (1,292 loc) • 119 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("prop-types"), require("react"), require("react-dom"));
else if(typeof define === 'function' && define.amd)
define("remeasure", ["prop-types", "react", "react-dom"], factory);
else if(typeof exports === 'object')
exports["remeasure"] = factory(require("prop-types"), require("react"), require("react-dom"));
else
root["remeasure"] = factory(root["prop-types"], root["react"], root["react-dom"]);
})(window, function(__WEBPACK_EXTERNAL_MODULE_prop_types__, __WEBPACK_EXTERNAL_MODULE_react__, __WEBPACK_EXTERNAL_MODULE_react_dom__) {
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, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // 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 = 0);
/******/ })
/************************************************************************/
/******/ ({
/***/ "./node_modules/debounce/index.js":
/*!****************************************!*\
!*** ./node_modules/debounce/index.js ***!
\****************************************/
/*! no static exports found */
/***/ (function(module, exports) {
/**
* Returns a function, that, as long as it continues to be invoked, will not
* be triggered. The function will be called after it stops being called for
* N milliseconds. If `immediate` is passed, trigger the function on the
* leading edge, instead of the trailing. The function also has a property 'clear'
* that is a function which will clear the timer to prevent previously scheduled executions.
*
* @source underscore.js
* @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/
* @param {Function} function to wrap
* @param {Number} timeout in ms (`100`)
* @param {Boolean} whether to execute at the beginning (`false`)
* @api public
*/
function debounce(func, wait, immediate){
var timeout, args, context, timestamp, result;
if (null == wait) wait = 100;
function later() {
var last = Date.now() - timestamp;
if (last < wait && last >= 0) {
timeout = setTimeout(later, wait - last);
} else {
timeout = null;
if (!immediate) {
result = func.apply(context, args);
context = args = null;
}
}
};
var debounced = function(){
context = this;
args = arguments;
timestamp = Date.now();
var callNow = immediate && !timeout;
if (!timeout) timeout = setTimeout(later, wait);
if (callNow) {
result = func.apply(context, args);
context = args = null;
}
return result;
};
debounced.clear = function() {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
};
debounced.flush = function() {
if (timeout) {
result = func.apply(context, args);
context = args = null;
clearTimeout(timeout);
timeout = null;
}
};
return debounced;
};
// Adds compatibility for ES modules
debounce.debounce = debounce;
module.exports = debounce;
/***/ }),
/***/ "./node_modules/fast-equals/es/comparator.js":
/*!***************************************************!*\
!*** ./node_modules/fast-equals/es/comparator.js ***!
\***************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ "./node_modules/fast-equals/es/constants.js");
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./node_modules/fast-equals/es/utils.js");
// constants
// utils
var isArray = Array.isArray;
var areMapsEqual = Object(_utils__WEBPACK_IMPORTED_MODULE_1__["createAreIterablesEqual"])(true);
var areSetsEqual = Object(_utils__WEBPACK_IMPORTED_MODULE_1__["createAreIterablesEqual"])(false);
var createComparator = function createComparator(createIsEqual) {
// eslint-disable-next-line no-use-before-define
var isEqual = typeof createIsEqual === 'function' ? createIsEqual(comparator) : comparator;
/**
* @function comparator
*
* @description
* compare the value of the two objects and return true if they are equivalent in values
*
* @param {any} objectA the object to test against
* @param {any} objectB the object to test
* @param {any} [meta] an optional meta object that is passed through to all equality test calls
* @returns {boolean} are objectA and objectB equivalent in value
*/
function comparator(objectA, objectB, meta) {
if (Object(_utils__WEBPACK_IMPORTED_MODULE_1__["sameValueZeroEqual"])(objectA, objectB)) {
return true;
}
var typeOfA = typeof objectA;
if (typeOfA !== typeof objectB || typeOfA !== 'object' || !objectA || !objectB) {
return false;
}
if (Object(_utils__WEBPACK_IMPORTED_MODULE_1__["isPlainObject"])(objectA) && Object(_utils__WEBPACK_IMPORTED_MODULE_1__["isPlainObject"])(objectB)) {
return Object(_utils__WEBPACK_IMPORTED_MODULE_1__["areObjectsEqual"])(objectA, objectB, isEqual, meta);
}
var arrayA = isArray(objectA);
var arrayB = isArray(objectB);
if (arrayA || arrayB) {
return arrayA === arrayB && Object(_utils__WEBPACK_IMPORTED_MODULE_1__["areArraysEqual"])(objectA, objectB, isEqual, meta);
}
var dateA = objectA instanceof Date;
var dateB = objectB instanceof Date;
if (dateA || dateB) {
return dateA === dateB && Object(_utils__WEBPACK_IMPORTED_MODULE_1__["sameValueZeroEqual"])(objectA.getTime(), objectB.getTime());
}
var regexpA = objectA instanceof RegExp;
var regexpB = objectB instanceof RegExp;
if (regexpA || regexpB) {
return regexpA === regexpB && Object(_utils__WEBPACK_IMPORTED_MODULE_1__["areRegExpsEqual"])(objectA, objectB);
}
if (Object(_utils__WEBPACK_IMPORTED_MODULE_1__["isPromiseLike"])(objectA) || Object(_utils__WEBPACK_IMPORTED_MODULE_1__["isPromiseLike"])(objectB)) {
return objectA === objectB;
}
if (_constants__WEBPACK_IMPORTED_MODULE_0__["HAS_MAP_SUPPORT"]) {
var mapA = objectA instanceof Map;
var mapB = objectB instanceof Map;
if (mapA || mapB) {
return mapA === mapB && areMapsEqual(objectA, objectB, isEqual, meta);
}
}
if (_constants__WEBPACK_IMPORTED_MODULE_0__["HAS_SET_SUPPORT"]) {
var setA = objectA instanceof Set;
var setB = objectB instanceof Set;
if (setA || setB) {
return setA === setB && areSetsEqual(objectA, objectB, isEqual, meta);
}
}
return Object(_utils__WEBPACK_IMPORTED_MODULE_1__["areObjectsEqual"])(objectA, objectB, isEqual, meta);
}
return comparator;
};
/* harmony default export */ __webpack_exports__["default"] = (createComparator);
/***/ }),
/***/ "./node_modules/fast-equals/es/constants.js":
/*!**************************************************!*\
!*** ./node_modules/fast-equals/es/constants.js ***!
\**************************************************/
/*! exports provided: HAS_MAP_SUPPORT, HAS_SET_SUPPORT, HAS_WEAKSET_SUPPORT */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HAS_MAP_SUPPORT", function() { return HAS_MAP_SUPPORT; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HAS_SET_SUPPORT", function() { return HAS_SET_SUPPORT; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HAS_WEAKSET_SUPPORT", function() { return HAS_WEAKSET_SUPPORT; });
/**
* @constant {boolean} HAS_MAP_SUPPORT
*/
var HAS_MAP_SUPPORT = typeof Map === 'function';
/**
* @constant {boolean} HAS_SET_SUPPORT
*/
var HAS_SET_SUPPORT = typeof Set === 'function';
/**
* @constant {boolean} HAS_WEAKSET_SUPPORT
*/
var HAS_WEAKSET_SUPPORT = typeof WeakSet === 'function';
/***/ }),
/***/ "./node_modules/fast-equals/es/index.js":
/*!**********************************************!*\
!*** ./node_modules/fast-equals/es/index.js ***!
\**********************************************/
/*! exports provided: createCustomEqual, sameValueZeroEqual, circularDeepEqual, circularShallowEqual, deepEqual, shallowEqual, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "circularDeepEqual", function() { return circularDeepEqual; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "circularShallowEqual", function() { return circularShallowEqual; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deepEqual", function() { return deepEqual; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shallowEqual", function() { return shallowEqual; });
/* harmony import */ var _comparator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./comparator */ "./node_modules/fast-equals/es/comparator.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createCustomEqual", function() { return _comparator__WEBPACK_IMPORTED_MODULE_0__["default"]; });
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./node_modules/fast-equals/es/utils.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sameValueZeroEqual", function() { return _utils__WEBPACK_IMPORTED_MODULE_1__["sameValueZeroEqual"]; });
// comparator
// utils
var circularDeepEqual = Object(_comparator__WEBPACK_IMPORTED_MODULE_0__["default"])(Object(_utils__WEBPACK_IMPORTED_MODULE_1__["createCircularEqual"])());
var circularShallowEqual = Object(_comparator__WEBPACK_IMPORTED_MODULE_0__["default"])(Object(_utils__WEBPACK_IMPORTED_MODULE_1__["createCircularEqual"])(_utils__WEBPACK_IMPORTED_MODULE_1__["sameValueZeroEqual"]));
var deepEqual = Object(_comparator__WEBPACK_IMPORTED_MODULE_0__["default"])();
var shallowEqual = Object(_comparator__WEBPACK_IMPORTED_MODULE_0__["default"])(function () {
return _utils__WEBPACK_IMPORTED_MODULE_1__["sameValueZeroEqual"];
});
/* harmony default export */ __webpack_exports__["default"] = ({
circularDeep: circularDeepEqual,
circularShallow: circularShallowEqual,
createCustom: _comparator__WEBPACK_IMPORTED_MODULE_0__["default"],
deep: deepEqual,
sameValueZero: _utils__WEBPACK_IMPORTED_MODULE_1__["sameValueZeroEqual"],
shallow: shallowEqual
});
/***/ }),
/***/ "./node_modules/fast-equals/es/utils.js":
/*!**********************************************!*\
!*** ./node_modules/fast-equals/es/utils.js ***!
\**********************************************/
/*! exports provided: addObjectToCache, hasItem, hasItems, sameValueZeroEqual, isPlainObject, isPromiseLike, isReactElement, getNewCache, createCircularEqual, toPairs, areArraysEqual, createAreIterablesEqual, areObjectsEqual, areRegExpsEqual */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addObjectToCache", function() { return addObjectToCache; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasItem", function() { return hasItem; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasItems", function() { return hasItems; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sameValueZeroEqual", function() { return sameValueZeroEqual; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlainObject", function() { return isPlainObject; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPromiseLike", function() { return isPromiseLike; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isReactElement", function() { return isReactElement; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNewCache", function() { return getNewCache; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCircularEqual", function() { return createCircularEqual; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toPairs", function() { return toPairs; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "areArraysEqual", function() { return areArraysEqual; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createAreIterablesEqual", function() { return createAreIterablesEqual; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "areObjectsEqual", function() { return areObjectsEqual; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "areRegExpsEqual", function() { return areRegExpsEqual; });
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ "./node_modules/fast-equals/es/constants.js");
// constants
var keys = Object.keys;
/**
* @function addObjectToCache
*
* @description
* add object to cache if it is indeed an object
*
* @param {any} object the object to potentially add to the cache
* @param {Object|WeakSet} cache the cache to add to
* @returns {void}
*/
var addObjectToCache = function addObjectToCache(object, cache) {
return object && typeof object === 'object' && cache.add(object);
};
/**
* @function hasItem
*
* @description
* does the array include the item passed
*
* @param {Array<any>} array the array to check in
* @param {any} item the item to locate
* @param {function} isEqual the equality comparator
* @param {any} meta the meta item to pass through
* @returns {boolean} does the item exist in the array
*/
var hasItem = function hasItem(array, item, isEqual, meta) {
for (var index = 0; index < array.length; index++) {
if (isEqual(array[index], item, meta)) {
return true;
}
}
return false;
};
/**
* @function hasItems
*
* @description
* are the arrays equal in value, despite being in different order
*
* @param {Array<any>} arrayA the first array to test
* @param {Array<any>} arrayB the second array to test
* @param {function} isEqual the equality comparator
* @param {any} meta the meta item to pass through
* @returns {boolean} are the arrays equal absent order
*/
var hasItems = function hasItems(arrayA, arrayB, isEqual, meta) {
if (arrayA.length !== arrayB.length) {
return false;
}
for (var index = 0; index < arrayA.length; index++) {
if (!hasItem(arrayB, arrayA[index], isEqual, meta)) {
return false;
}
}
return true;
};
/**
* @function sameValueZeroEqual
*
* @description
* are the objects passed strictly equal or both NaN
*
* @param {any} objectA the object to compare against
* @param {any} objectB the object to test
* @returns {boolean} are the objects equal by the SameValueZero principle
*/
var sameValueZeroEqual = function sameValueZeroEqual(objectA, objectB) {
return objectA === objectB || objectA !== objectA && objectB !== objectB;
};
/**
* @function isPlainObject
*
* @description
* is the object a plain object
*
* @param {any} object the object to test
* @returns {boolean} is the object a plain object
*/
var isPlainObject = function isPlainObject(object) {
return object.constructor === Object;
};
/**
* @function isPromiseLike
*
* @description
* is the object promise-like (thenable)
*
* @param {any} object the object to test
* @returns {boolean} is the object promise-like
*/
var isPromiseLike = function isPromiseLike(object) {
return typeof object.then === 'function';
};
/**
* @function isReactElement
*
* @description
* is the object passed a react element
*
* @param {any} object the object to test
* @returns {boolean} is the object a react element
*/
var isReactElement = function isReactElement(object) {
return !!(object.$$typeof && object._store);
};
/**
* @function getNewCache
*
* @description
* get a new cache object to prevent circular references
*
* @returns {Object|Weakset} the new cache object
*/
var getNewCache = function getNewCache() {
return _constants__WEBPACK_IMPORTED_MODULE_0__["HAS_WEAKSET_SUPPORT"] ? new WeakSet() : Object.create({
_values: [],
add: function add(value) {
this._values.push(value);
},
has: function has(value) {
return !!~this._values.indexOf(value);
}
});
};
/**
* @function createCircularEqual
*
* @description
* create a custom isEqual handler specific to circular objects
*
* @param {funtion} [isEqual] the isEqual comparator to use instead of isDeepEqual
* @returns {function(any, any): boolean}
*/
var createCircularEqual = function createCircularEqual(isEqual) {
return function (isDeepEqual) {
var comparator = isEqual || isDeepEqual;
return function (objectA, objectB, cache) {
if (cache === void 0) {
cache = getNewCache();
}
var cacheHasA = cache.has(objectA);
var cacheHasB = cache.has(objectB);
if (cacheHasA || cacheHasB) {
return cacheHasA && cacheHasB;
}
addObjectToCache(objectA, cache);
addObjectToCache(objectB, cache);
return comparator(objectA, objectB, cache);
};
};
};
/**
* @function toPairs
*
* @param {Map|Set} iterable the iterable to convert to [key, value] pairs (entries)
* @returns {{keys: Array<*>, values: Array<*>}} the [key, value] pairs
*/
var toPairs = function toPairs(iterable) {
var pairs = {
keys: [],
values: []
};
iterable.forEach(function (value, key) {
return pairs.keys.push(key) && pairs.values.push(value);
});
return pairs;
};
/**
* @function areArraysEqual
*
* @description
* are the arrays equal in value
*
* @param {Array<any>} arrayA the array to test
* @param {Array<any>} arrayB the array to test against
* @param {function} isEqual the comparator to determine equality
* @param {any} meta the meta object to pass through
* @returns {boolean} are the arrays equal
*/
var areArraysEqual = function areArraysEqual(arrayA, arrayB, isEqual, meta) {
if (arrayA.length !== arrayB.length) {
return false;
}
for (var index = 0; index < arrayA.length; index++) {
if (!isEqual(arrayA[index], arrayB[index], meta)) {
return false;
}
}
return true;
};
var createAreIterablesEqual = function createAreIterablesEqual(shouldCompareKeys) {
/**
* @function areIterablesEqual
*
* @description
* determine if the iterables are equivalent in value
*
* @param {Array<Array<any>>} pairsA the pairs to test
* @param {Array<Array<any>>} pairsB the pairs to test against
* @param {function} isEqual the comparator to determine equality
* @param {any} meta the cache possibly being used
* @returns {boolean} are the objects equal in value
*/
var areIterablesEqual = shouldCompareKeys ? function (pairsA, pairsB, isEqual, meta) {
return hasItems(pairsA.keys, pairsB.keys, isEqual, meta) && hasItems(pairsA.values, pairsB.values, isEqual, meta);
} : function (pairsA, pairsB, isEqual, meta) {
return hasItems(pairsA.values, pairsB.values, isEqual, meta);
};
return function (iterableA, iterableB, isEqual, meta) {
return areIterablesEqual(toPairs(iterableA), toPairs(iterableB), isEqual, meta);
};
};
/**
* @function areArraysEqual
*
* @description
* are the objects equal in value
*
* @param {Array<any>} objectA the object to test
* @param {Array<any>} objectB the object to test against
* @param {function} isEqual the comparator to determine equality
* @param {any} meta the meta object to pass through
* @returns {boolean} are the objects equal
*/
var areObjectsEqual = function areObjectsEqual(objectA, objectB, isEqual, meta) {
var keysA = keys(objectA);
var keysB = keys(objectB);
if (keysA.length !== keysB.length) {
return false;
}
var key;
for (var index = 0; index < keysA.length; index++) {
key = keysA[index];
if (!hasItem(keysB, key, sameValueZeroEqual)) {
return false;
} // if a react element, ignore the "_owner" key because its not necessary for equality comparisons
if (key === '_owner' && isReactElement(objectA) && isReactElement(objectB)) {
continue;
}
if (!isEqual(objectA[key], objectB[key], meta)) {
return false;
}
}
return true;
};
/**
* @function areRegExpsEqual
*
* @description
* are the regExps equal in value
*
* @param {RegExp} regExpA the regExp to test
* @param {RegExp} regExpB the regExp to test agains
* @returns {boolean} are the regExps equal
*/
var areRegExpsEqual = function areRegExpsEqual(regExpA, regExpB) {
return regExpA.source === regExpB.source && regExpA.global === regExpB.global && regExpA.ignoreCase === regExpB.ignoreCase && regExpA.multiline === regExpB.multiline && regExpA.unicode === regExpB.unicode && regExpA.sticky === regExpB.sticky && regExpA.lastIndex === regExpB.lastIndex;
};
/***/ }),
/***/ "./node_modules/micro-memoize/es/index.js":
/*!************************************************!*\
!*** ./node_modules/micro-memoize/es/index.js ***!
\************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return memoize; });
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./node_modules/micro-memoize/es/utils.js");
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
// types
// utils
/**
* @function memoize
*
* @description
* get the memoized version of the method passed
*
* @param {function} fn the method to memoize
* @param {Object} [options={}] the options to build the memoizer with
* @param {boolean} [options.isEqual=isSameValueZero] the method to compare equality of keys with
* @param {number} [options.maxSize=1] the number of items to store in cache
* @returns {function} the memoized method
*/
function memoize(fn, options) {
// if it is a memoized method, don't re-memoize it
if (fn.isMemoized) {
return fn;
}
var _ref = options || {},
_ref$isEqual = _ref.isEqual,
isEqual = _ref$isEqual === void 0 ? _utils__WEBPACK_IMPORTED_MODULE_0__["isSameValueZero"] : _ref$isEqual,
isMatchingKey = _ref.isMatchingKey,
_ref$isPromise = _ref.isPromise,
isPromise = _ref$isPromise === void 0 ? false : _ref$isPromise,
_ref$maxSize = _ref.maxSize,
maxSize = _ref$maxSize === void 0 ? 1 : _ref$maxSize,
_ref$onCacheAdd = _ref.onCacheAdd,
onCacheAdd = _ref$onCacheAdd === void 0 ? _utils__WEBPACK_IMPORTED_MODULE_0__["onCacheOperation"] : _ref$onCacheAdd,
_ref$onCacheChange = _ref.onCacheChange,
onCacheChange = _ref$onCacheChange === void 0 ? _utils__WEBPACK_IMPORTED_MODULE_0__["onCacheOperation"] : _ref$onCacheChange,
_ref$onCacheHit = _ref.onCacheHit,
onCacheHit = _ref$onCacheHit === void 0 ? _utils__WEBPACK_IMPORTED_MODULE_0__["onCacheOperation"] : _ref$onCacheHit,
transformKey = _ref.transformKey,
extraOptions = _objectWithoutPropertiesLoose(_ref, ["isEqual", "isMatchingKey", "isPromise", "maxSize", "onCacheAdd", "onCacheChange", "onCacheHit", "transformKey"]);
var normalizedOptions = Object.assign({}, extraOptions, {
isEqual: isEqual,
isMatchingKey: isMatchingKey,
isPromise: isPromise,
maxSize: maxSize,
onCacheAdd: onCacheAdd,
onCacheChange: onCacheChange,
onCacheHit: onCacheHit,
transformKey: transformKey
});
var getKeyIndex = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["createGetKeyIndex"])(isEqual, isMatchingKey);
var shouldCloneArguments = !!(transformKey || isMatchingKey);
var cache = {
keys: [],
get size() {
return cache.keys.length;
},
values: []
};
var keys = cache.keys,
values = cache.values;
/**
* @function memoized
*
* @description
* the memoized version of the method passed
*
* @param {...Array<any>} key the arguments passed, which create a unique cache key
* @returns {any} the value of the method called with the arguments
*/
function memoized() {
var args = shouldCloneArguments ? Object(_utils__WEBPACK_IMPORTED_MODULE_0__["cloneArray"])(arguments) : arguments;
var key = transformKey ? transformKey(args) : args;
var keyIndex = getKeyIndex(keys, key);
if (~keyIndex) {
onCacheHit(cache, normalizedOptions, memoized);
if (keyIndex) {
Object(_utils__WEBPACK_IMPORTED_MODULE_0__["orderByLru"])(keys, keys[keyIndex], keyIndex);
Object(_utils__WEBPACK_IMPORTED_MODULE_0__["orderByLru"])(values, values[keyIndex], keyIndex);
onCacheChange(cache, normalizedOptions, memoized);
}
} else {
if (keys.length >= maxSize) {
keys.pop();
values.pop();
}
var newKey = shouldCloneArguments ? key : Object(_utils__WEBPACK_IMPORTED_MODULE_0__["cloneArray"])(args);
var newValue = fn.apply(this, arguments);
Object(_utils__WEBPACK_IMPORTED_MODULE_0__["orderByLru"])(keys, newKey, keys.length);
Object(_utils__WEBPACK_IMPORTED_MODULE_0__["orderByLru"])(values, newValue, values.length);
if (isPromise) {
Object(_utils__WEBPACK_IMPORTED_MODULE_0__["setPromiseHandler"])(cache, normalizedOptions, memoized);
}
onCacheAdd(cache, normalizedOptions, memoized);
onCacheChange(cache, normalizedOptions, memoized);
}
return values[0];
}
Object.defineProperties(memoized, {
cache: {
configurable: true,
get: function get() {
return cache;
}
},
cacheSnapshot: {
configurable: true,
get: function get() {
return {
keys: Object(_utils__WEBPACK_IMPORTED_MODULE_0__["cloneArray"])(cache.keys),
size: cache.size,
values: Object(_utils__WEBPACK_IMPORTED_MODULE_0__["cloneArray"])(cache.values)
};
}
},
isMemoized: {
configurable: true,
get: function get() {
return true;
}
},
options: {
configurable: true,
get: function get() {
return normalizedOptions;
}
}
});
return memoized;
}
/***/ }),
/***/ "./node_modules/micro-memoize/es/utils.js":
/*!************************************************!*\
!*** ./node_modules/micro-memoize/es/utils.js ***!
\************************************************/
/*! exports provided: cloneArray, createAreKeysEqual, createGetKeyIndex, isSameValueZero, onCacheOperation, orderByLru, setPromiseHandler */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cloneArray", function() { return cloneArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createAreKeysEqual", function() { return createAreKeysEqual; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createGetKeyIndex", function() { return createGetKeyIndex; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isSameValueZero", function() { return isSameValueZero; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onCacheOperation", function() { return onCacheOperation; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "orderByLru", function() { return orderByLru; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setPromiseHandler", function() { return setPromiseHandler; });
// types
/**
* @function cloneArray
*
* @description
* clone the array-like object and return the new array
*
* @param {Array<any>|Arguments} arrayLike the array-like object to clone
* @returns {Array<any>} the clone of the array
*/
var cloneArray = function cloneArray(arrayLike) {
var array = new Array(arrayLike.length);
for (var index = 0; index < arrayLike.length; index++) {
array[index] = arrayLike[index];
}
return array;
};
var createAreKeysEqual = function createAreKeysEqual(isEqual
/**
* @function areKeysEqual
*
* @description
* are the keys shallowly equal to one another
*
* @param {Array<any>} keys1 the keys array to test against
* @param {Array<any>} keys2 the keys array to test
* @returns {boolean} are the keys shallowly equal
*/
) {
return function (keys1, keys2) {
if (keys1.length !== keys2.length) {
return false;
}
for (var index = 0; index < keys1.length; index++) {
if (!isEqual(keys1[index], keys2[index])) {
return false;
}
}
return true;
};
};
var createGetKeyIndex = function createGetKeyIndex(isEqual, isMatchingKey) {
var areKeysEqual = typeof isMatchingKey === 'function' ? isMatchingKey : createAreKeysEqual(isEqual);
/**
* @function getKeyIndex
*
* @description
* get the index of the matching key
*
* @param {Array<Array<any>>} allKeys the list of all available keys
* @param {Array<any>} keysToMatch the key to try to match
*
* @returns {number} the index of the matching key value, or -1
*/
return function (allKeys, keysToMatch) {
for (var index = 0; index < allKeys.length; index++) {
if (areKeysEqual(allKeys[index], keysToMatch)) {
return index;
}
}
return -1;
};
};
/**
* @function isSameValueZero
*
* @description
* are the objects equal based on SameValueZero
*
* @param {any} object1 the first object to compare
* @param {any} object2 the second object to compare
* @returns {boolean} are the two objects equal
*/
var isSameValueZero = function isSameValueZero(object1, object2) {
return object1 === object2 || object1 !== object1 && object2 !== object2;
};
/* eslint-disable no-unused-vars */
var onCacheOperation = function onCacheOperation(cacheIgnored, optionsIgnored, memoized) {};
/* eslint-enable */
/**
* @function orderByLru
*
* @description
* order the array based on a Least-Recently-Used basis
*
* @param {Array<any>} array the array to order
* @param {any} value the value to assign at the beginning of the array
* @param {number} startingIndex the index of the item to move to the front
*/
var orderByLru = function orderByLru(array, value, startingIndex) {
var index = startingIndex;
while (index--) {
array[index + 1] = array[index];
}
array[0] = value;
};
/**
* @function setPromiseHandler
*
* @description
* update the promise method to auto-remove from cache if rejected, and if resolved then fire cache hit / changed
*
* @param {Cache} cache the cache object
* @param {Options} options the options for the memoized function
* @param {function} memoized the memoized function
*/
var setPromiseHandler = function setPromiseHandler(cache, options, memoized) {
var key = cache.keys[0];
cache.values[0] = cache.values[0].then(function (value) {
options.onCacheHit(cache, options, memoized);
options.onCacheChange(cache, options, memoized);
return value;
}).catch(function (error) {
var keyIndex = createGetKeyIndex(options.isEqual)(cache.keys, key);
if (~keyIndex) {
cache.keys.splice(keyIndex, 1);
cache.values.splice(keyIndex, 1);
}
throw error;
});
};
/***/ }),
/***/ "./node_modules/performance-now/lib/performance-now.js":
/*!*************************************************************!*\
!*** ./node_modules/performance-now/lib/performance-now.js ***!
\*************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {// Generated by CoffeeScript 1.12.2
(function() {
var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime;
if ((typeof performance !== "undefined" && performance !== null) && performance.now) {
module.exports = function() {
return performance.now();
};
} else if ((typeof process !== "undefined" && process !== null) && process.hrtime) {
module.exports = function() {
return (getNanoSeconds() - nodeLoadTime) / 1e6;
};
hrtime = process.hrtime;
getNanoSeconds = function() {
var hr;
hr = hrtime();
return hr[0] * 1e9 + hr[1];
};
moduleLoadTime = getNanoSeconds();
upTime = process.uptime() * 1e9;
nodeLoadTime = moduleLoadTime - upTime;
} else if (Date.now) {
module.exports = function() {
return Date.now() - loadTime;
};
loadTime = Date.now();
} else {
module.exports = function() {
return new Date().getTime() - loadTime;
};
loadTime = new Date().getTime();
}
}).call(this);
//# sourceMappingURL=performance-now.js.map
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
/***/ }),
/***/ "./node_modules/process/browser.js":
/*!*****************************************!*\
!*** ./node_modules/process/browser.js ***!
\*****************************************/
/*! no static exports found */
/***/ (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; };
/***/ }),
/***/ "./node_modules/raf/index.js":
/*!***********************************!*\
!*** ./node_modules/raf/index.js ***!
\***********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {var now = __webpack_require__(/*! performance-now */ "./node_modules/performance-now/lib/performance-now.js")
, root = typeof window === 'undefined' ? global : window
, vendors = ['moz', 'webkit']
, suffix = 'AnimationFrame'
, raf = root['request' + suffix]
, caf = root['cancel' + suffix] || root['cancelRequest' + suffix]
for(var i = 0; !raf && i < vendors.length; i++) {
raf = root[vendors[i] + 'Request' + suffix]
caf = root[vendors[i] + 'Cancel' + suffix]
|| root[vendors[i] + 'CancelRequest' + suffix]
}
// Some versions of FF have rAF but not cAF
if(!raf || !caf) {
var last = 0
, id = 0
, queue = []
, frameDuration = 1000 / 60
raf = function(callback) {
if(queue.length === 0) {
var _now = now()
, next = Math.max(0, frameDuration - (_now - last))
last = next + _now
setTimeout(function() {
var cp = queue.slice(0)
// Clear queue here to prevent
// callbacks from appending listeners
// to the current frame's queue
queue.length = 0
for(var i = 0; i < cp.length; i++) {
if(!cp[i].cancelled) {
try{
cp[i].callback(last)
} catch(e) {
setTimeout(function() { throw e }, 0)
}
}
}
}, Math.round(next))
}
queue.push({
handle: ++id,
callback: callback,
cancelled: false
})
return id
}
caf = function(handle) {
for(var i = 0; i < queue.length; i++) {
if(queue[i].handle === handle) {
queue[i].cancelled = true
}
}
}
}
module.exports = function(fn) {
// Wrap in a new function to prevent
// `cancel` potentially being assigned
// to the native rAF function
return raf.call(root, fn)
}
module.exports.cancel = function() {
caf.apply(root, arguments)
}
module.exports.polyfill = function(object) {
if (!object) {
object = root;
}
object.requestAnimationFrame = raf
object.cancelAnimationFrame = caf
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
/***/ }),
/***/ "./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js":
/*!*************************************************************************!*\
!*** ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js ***!
\*************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* WEBPACK VAR INJECTION */(function(global) {/**
* A collection of shims that provide minimal functionality of the ES6 collections.
*
* These implementations are not meant to be used outside of the ResizeObserver
* modules as they cover only a limited range of use cases.
*/
/* eslint-disable require-jsdoc, valid-jsdoc */
var MapShim = (function () {
if (typeof Map !== 'undefined') {
return Map;
}
/**
* Returns index in provided array that matches the specified key.
*
* @param {Array<Array>} arr
* @param {*} key
* @returns {number}
*/
function getIndex(arr, key) {
var result = -1;
arr.some(function (entry, index) {
if (entry[0] === key) {
result = index;
return true;
}
return false;
});
return result;
}
return (function () {
function anonymous() {
this.__entries__ = [];
}
var prototypeAccessors = { size: { configurable: true } };
/**
* @returns {boolean}
*/
prototypeAccessors.size.get = function () {
return this.__entries__.length;
};
/**
* @param {*} key
* @returns {*}
*/
anonymous.prototype.get = function (key) {
var index = getIndex(this.__entries__, key);
var entry = this.__entries__[index];
return entry && entry[1];
};
/**
* @param {*} key
* @param {*} value
* @returns {void}
*/
anonymous.prototype.set = function (key, value) {
var index = getIndex(this.__entries__, key);
if (~index) {
this.__entries__[index][1] = value;
} else {
this.__entries__.push([key, value]);
}
};
/**
* @param {*} key
* @returns {void}
*/
anonymous.prototype.delete = function (key) {
var entries = this.__entries__;
var index = getIndex(entries, key);
if (~index) {
entries.splice(index, 1);
}
};
/**
* @param {*} key
* @returns {void}
*/
anonymous.prototype.has = function (key) {
return !!~getIndex(this.__entries__, key);
};
/**
* @returns {void}
*/
anonymous.prototype.clear = function () {
this.__entries__.splice(0);
};
/**
* @param {Function} callback
* @param {*} [ctx=null]
* @returns {void}
*/
anonymous.prototype.forEach = function (callback, ctx) {
var this$1 = this;
if ( ctx === void 0 ) ctx = null;
for (var i = 0, list = this$1.__entries__; i < list.length; i += 1) {
var entry = list[i];
callback.call(ctx, entry[1], entry[0]);
}
};
Object.defineProperties( anonymous.prototype, prototypeAccessors );
return anonymous;
}());
})();
/**
* Detects whether window and document objects are available in current environment.
*/
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document;
// Returns global object of a current environment.
var global$1 = (function () {
if (typeof global !== 'undefined' && global.Math === Math) {
return global;
}
if (typeof self !== 'undefined' && self.Math === Math) {
return self;
}
if (typeof window !== 'undefined' && window.Math === Math) {
return window;
}
// eslint-disable-next-line no-new-func
return Function('return this')();
})();
/**
* A shim for the requestAnimationFrame which falls back to the setTimeout if
* first one is not supported.
*
* @returns {number} Requests' identifier.
*/
var requestAnimationFrame$1 = (function () {
if (typeof requestAnimationFrame === 'function') {
// It's required to use a bounded function because IE sometimes throws
// an "Invalid calling object" error if rAF is invoked without the global
// object on the left hand side.
return requestAnimationFrame.bind(global$1);
}
return function (callback) { return setTimeout(function () { r