WordPress/wp-includes/js/dist/compose.js

1198 lines
57 KiB
JavaScript
Raw Normal View History

this["wp"] = this["wp"] || {}; this["wp"]["compose"] =
/******/ (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 = "./packages/packages/compose/build-module/index.js");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./packages/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js":
/*!***********************************************************************************!*\
!*** ./packages/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.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 _assertThisInitialized; });
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
/***/ }),
/***/ "./packages/node_modules/@babel/runtime/helpers/esm/classCallCheck.js":
/*!****************************************************************************!*\
!*** ./packages/node_modules/@babel/runtime/helpers/esm/classCallCheck.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 _classCallCheck; });
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
/***/ }),
/***/ "./packages/node_modules/@babel/runtime/helpers/esm/createClass.js":
/*!*************************************************************************!*\
!*** ./packages/node_modules/@babel/runtime/helpers/esm/createClass.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 _createClass; });
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;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/***/ }),
/***/ "./packages/node_modules/@babel/runtime/helpers/esm/extends.js":
/*!*********************************************************************!*\
!*** ./packages/node_modules/@babel/runtime/helpers/esm/extends.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 _extends; });
function _extends() {
_extends = Object.assign || 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;
};
return _extends.apply(this, arguments);
}
/***/ }),
/***/ "./packages/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js":
/*!****************************************************************************!*\
!*** ./packages/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.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 _getPrototypeOf; });
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
/***/ }),
/***/ "./packages/node_modules/@babel/runtime/helpers/esm/inherits.js":
/*!**********************************************************************!*\
!*** ./packages/node_modules/@babel/runtime/helpers/esm/inherits.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 _inherits; });
/* harmony import */ var _setPrototypeOf__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setPrototypeOf */ "./packages/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js");
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) Object(_setPrototypeOf__WEBPACK_IMPORTED_MODULE_0__["default"])(subClass, superClass);
}
/***/ }),
/***/ "./packages/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js":
/*!***************************************************************************************!*\
!*** ./packages/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.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 _possibleConstructorReturn; });
/* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../helpers/esm/typeof */ "./packages/node_modules/@babel/runtime/helpers/esm/typeof.js");
/* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assertThisInitialized */ "./packages/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js");
function _possibleConstructorReturn(self, call) {
if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__["default"])(call) === "object" || typeof call === "function")) {
return call;
}
return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__["default"])(self);
}
/***/ }),
/***/ "./packages/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js":
/*!****************************************************************************!*\
!*** ./packages/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.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 _setPrototypeOf; });
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
/***/ }),
/***/ "./packages/node_modules/@babel/runtime/helpers/esm/typeof.js":
/*!********************************************************************!*\
!*** ./packages/node_modules/@babel/runtime/helpers/esm/typeof.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 _typeof; });
function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
function _typeof(obj) {
if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
_typeof = function _typeof(obj) {
return _typeof2(obj);
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
};
}
return _typeof(obj);
}
/***/ }),
/***/ "./packages/packages/compose/build-module/create-higher-order-component/index.js":
/*!***************************************************************************************!*\
!*** ./packages/packages/compose/build-module/create-higher-order-component/index.js ***!
\***************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
/**
* External dependencies
*/
/**
* Given a function mapping a component to an enhanced component and modifier
* name, returns the enhanced component augmented with a generated displayName.
*
* @param {Function} mapComponentToEnhancedComponent Function mapping component
* to enhanced component.
* @param {string} modifierName Seed name from which to
* generated display name.
*
* @return {WPComponent} Component class with generated display name assigned.
*/
function createHigherOrderComponent(mapComponentToEnhancedComponent, modifierName) {
return function (OriginalComponent) {
var EnhancedComponent = mapComponentToEnhancedComponent(OriginalComponent);
var _OriginalComponent$di = OriginalComponent.displayName,
displayName = _OriginalComponent$di === void 0 ? OriginalComponent.name || 'Component' : _OriginalComponent$di;
EnhancedComponent.displayName = "".concat(Object(lodash__WEBPACK_IMPORTED_MODULE_0__["upperFirst"])(Object(lodash__WEBPACK_IMPORTED_MODULE_0__["camelCase"])(modifierName)), "(").concat(displayName, ")");
return EnhancedComponent;
};
}
/* harmony default export */ __webpack_exports__["default"] = (createHigherOrderComponent);
/***/ }),
/***/ "./packages/packages/compose/build-module/if-condition/index.js":
/*!**********************************************************************!*\
!*** ./packages/packages/compose/build-module/if-condition/index.js ***!
\**********************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _create_higher_order_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../create-higher-order-component */ "./packages/packages/compose/build-module/create-higher-order-component/index.js");
/**
* Internal dependencies
*/
/**
* Higher-order component creator, creating a new component which renders if
* the given condition is satisfied or with the given optional prop name.
*
* @param {Function} predicate Function to test condition.
*
* @return {Function} Higher-order component.
*/
var ifCondition = function ifCondition(predicate) {
return Object(_create_higher_order_component__WEBPACK_IMPORTED_MODULE_1__["default"])(function (WrappedComponent) {
return function (props) {
if (!predicate(props)) {
return null;
}
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(WrappedComponent, props);
};
}, 'ifCondition');
};
/* harmony default export */ __webpack_exports__["default"] = (ifCondition);
/***/ }),
/***/ "./packages/packages/compose/build-module/index.js":
/*!*********************************************************!*\
!*** ./packages/packages/compose/build-module/index.js ***!
\*********************************************************/
/*! exports provided: createHigherOrderComponent, ifCondition, pure, remountOnPropChange, withGlobalEvents, withInstanceId, withSafeTimeout, withState, compose */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return lodash__WEBPACK_IMPORTED_MODULE_0__["flowRight"]; });
/* harmony import */ var _create_higher_order_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./create-higher-order-component */ "./packages/packages/compose/build-module/create-higher-order-component/index.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createHigherOrderComponent", function() { return _create_higher_order_component__WEBPACK_IMPORTED_MODULE_1__["default"]; });
/* harmony import */ var _if_condition__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./if-condition */ "./packages/packages/compose/build-module/if-condition/index.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ifCondition", function() { return _if_condition__WEBPACK_IMPORTED_MODULE_2__["default"]; });
/* harmony import */ var _pure__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pure */ "./packages/packages/compose/build-module/pure/index.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pure", function() { return _pure__WEBPACK_IMPORTED_MODULE_3__["default"]; });
/* harmony import */ var _remount_on_prop_change__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./remount-on-prop-change */ "./packages/packages/compose/build-module/remount-on-prop-change/index.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "remountOnPropChange", function() { return _remount_on_prop_change__WEBPACK_IMPORTED_MODULE_4__["default"]; });
/* harmony import */ var _with_global_events__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./with-global-events */ "./packages/packages/compose/build-module/with-global-events/index.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "withGlobalEvents", function() { return _with_global_events__WEBPACK_IMPORTED_MODULE_5__["default"]; });
/* harmony import */ var _with_instance_id__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./with-instance-id */ "./packages/packages/compose/build-module/with-instance-id/index.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "withInstanceId", function() { return _with_instance_id__WEBPACK_IMPORTED_MODULE_6__["default"]; });
/* harmony import */ var _with_safe_timeout__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./with-safe-timeout */ "./packages/packages/compose/build-module/with-safe-timeout/index.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "withSafeTimeout", function() { return _with_safe_timeout__WEBPACK_IMPORTED_MODULE_7__["default"]; });
/* harmony import */ var _with_state__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./with-state */ "./packages/packages/compose/build-module/with-state/index.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "withState", function() { return _with_state__WEBPACK_IMPORTED_MODULE_8__["default"]; });
/**
* External dependencies
*/
/**
* Composes multiple higher-order components into a single higher-order component. Performs right-to-left function
* composition, where each successive invocation is supplied the return value of the previous.
*
* @param {...Function} hocs The HOC functions to invoke.
*
* @return {Function} Returns the new composite function.
*/
/***/ }),
/***/ "./packages/packages/compose/build-module/pure/index.js":
/*!**************************************************************!*\
!*** ./packages/packages/compose/build-module/pure/index.js ***!
\**************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./packages/node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./packages/node_modules/@babel/runtime/helpers/esm/createClass.js");
/* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/possibleConstructorReturn */ "./packages/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js");
/* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/getPrototypeOf */ "./packages/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js");
/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inherits */ "./packages/node_modules/@babel/runtime/helpers/esm/inherits.js");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _wordpress_is_shallow_equal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/is-shallow-equal */ "@wordpress/is-shallow-equal");
/* harmony import */ var _wordpress_is_shallow_equal__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_is_shallow_equal__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _create_higher_order_component__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../create-higher-order-component */ "./packages/packages/compose/build-module/create-higher-order-component/index.js");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Given a component returns the enhanced component augmented with a component
* only rerendering when its props/state change
*
* @param {Function} mapComponentToEnhancedComponent Function mapping component
* to enhanced component.
* @param {string} modifierName Seed name from which to
* generated display name.
*
* @return {WPComponent} Component class with generated display name assigned.
*/
var pure = Object(_create_higher_order_component__WEBPACK_IMPORTED_MODULE_7__["default"])(function (Wrapped) {
if (Wrapped.prototype instanceof _wordpress_element__WEBPACK_IMPORTED_MODULE_5__["Component"]) {
return (
/*#__PURE__*/
function (_Wrapped) {
Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__["default"])(_class, _Wrapped);
function _class() {
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, _class);
return Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__["default"])(this, Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__["default"])(_class).apply(this, arguments));
}
Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(_class, [{
key: "shouldComponentUpdate",
value: function shouldComponentUpdate(nextProps, nextState) {
return !_wordpress_is_shallow_equal__WEBPACK_IMPORTED_MODULE_6___default()(nextProps, this.props) || !_wordpress_is_shallow_equal__WEBPACK_IMPORTED_MODULE_6___default()(nextState, this.state);
}
}]);
return _class;
}(Wrapped)
);
}
return (
/*#__PURE__*/
function (_Component) {
Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__["default"])(_class2, _Component);
function _class2() {
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, _class2);
return Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__["default"])(this, Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__["default"])(_class2).apply(this, arguments));
}
Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(_class2, [{
key: "shouldComponentUpdate",
value: function shouldComponentUpdate(nextProps) {
return !_wordpress_is_shallow_equal__WEBPACK_IMPORTED_MODULE_6___default()(nextProps, this.props);
}
}, {
key: "render",
value: function render() {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["createElement"])(Wrapped, this.props);
}
}]);
return _class2;
}(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["Component"])
);
}, 'pure');
/* harmony default export */ __webpack_exports__["default"] = (pure);
/***/ }),
/***/ "./packages/packages/compose/build-module/remount-on-prop-change/index.js":
/*!********************************************************************************!*\
!*** ./packages/packages/compose/build-module/remount-on-prop-change/index.js ***!
\********************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./packages/node_modules/@babel/runtime/helpers/esm/extends.js");
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./packages/node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./packages/node_modules/@babel/runtime/helpers/esm/createClass.js");
/* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/possibleConstructorReturn */ "./packages/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js");
/* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/getPrototypeOf */ "./packages/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js");
/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inherits */ "./packages/node_modules/@babel/runtime/helpers/esm/inherits.js");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _create_higher_order_component__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../create-higher-order-component */ "./packages/packages/compose/build-module/create-higher-order-component/index.js");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Higher-order component creator, creating a new component that remounts
* the wrapped component each time a given prop value changes.
*
* @param {string} propName Prop name to monitor.
*
* @return {Function} Higher-order component.
*/
var remountOnPropChange = function remountOnPropChange(propName) {
return Object(_create_higher_order_component__WEBPACK_IMPORTED_MODULE_7__["default"])(function (WrappedComponent) {
return (
/*#__PURE__*/
function (_Component) {
Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_5__["default"])(_class, _Component);
function _class(props) {
var _this;
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__["default"])(this, _class);
_this = Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__["default"])(this, Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__["default"])(_class).apply(this, arguments));
_this.state = {
propChangeId: 0,
propValue: props[propName]
};
return _this;
}
Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__["default"])(_class, [{
key: "render",
value: function render() {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(WrappedComponent, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({
key: this.state.propChangeId
}, this.props));
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(props, state) {
if (props[propName] === state.propValue) {
return null;
}
return {
propChangeId: state.propChangeId + 1,
propValue: props[propName]
};
}
}]);
return _class;
}(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["Component"])
);
}, 'remountOnPropChange');
};
/* harmony default export */ __webpack_exports__["default"] = (remountOnPropChange);
/***/ }),
/***/ "./packages/packages/compose/build-module/with-global-events/index.js":
/*!****************************************************************************!*\
!*** ./packages/packages/compose/build-module/with-global-events/index.js ***!
\****************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./packages/node_modules/@babel/runtime/helpers/esm/extends.js");
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./packages/node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./packages/node_modules/@babel/runtime/helpers/esm/createClass.js");
/* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/possibleConstructorReturn */ "./packages/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js");
/* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/getPrototypeOf */ "./packages/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js");
/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inherits */ "./packages/node_modules/@babel/runtime/helpers/esm/inherits.js");
/* harmony import */ var _babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/esm/assertThisInitialized */ "./packages/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var _create_higher_order_component__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../create-higher-order-component */ "./packages/packages/compose/build-module/create-higher-order-component/index.js");
/* harmony import */ var _listener__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./listener */ "./packages/packages/compose/build-module/with-global-events/listener.js");
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Listener instance responsible for managing document event handling.
*
* @type {Listener}
*/
var listener = new _listener__WEBPACK_IMPORTED_MODULE_10__["default"]();
function withGlobalEvents(eventTypesToHandlers) {
return Object(_create_higher_order_component__WEBPACK_IMPORTED_MODULE_9__["default"])(function (WrappedComponent) {
var Wrapper =
/*#__PURE__*/
function (_Component) {
Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_5__["default"])(Wrapper, _Component);
function Wrapper() {
var _this;
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__["default"])(this, Wrapper);
_this = Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__["default"])(this, Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__["default"])(Wrapper).apply(this, arguments));
_this.handleEvent = _this.handleEvent.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_6__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_6__["default"])(_this)));
_this.handleRef = _this.handleRef.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_6__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_6__["default"])(_this)));
return _this;
}
Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__["default"])(Wrapper, [{
key: "componentDidMount",
value: function componentDidMount() {
var _this2 = this;
Object(lodash__WEBPACK_IMPORTED_MODULE_8__["forEach"])(eventTypesToHandlers, function (handler, eventType) {
listener.add(eventType, _this2);
});
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
var _this3 = this;
Object(lodash__WEBPACK_IMPORTED_MODULE_8__["forEach"])(eventTypesToHandlers, function (handler, eventType) {
listener.remove(eventType, _this3);
});
}
}, {
key: "handleEvent",
value: function handleEvent(event) {
var handler = eventTypesToHandlers[event.type];
if (typeof this.wrappedRef[handler] === 'function') {
this.wrappedRef[handler](event);
}
}
}, {
key: "handleRef",
value: function handleRef(el) {
this.wrappedRef = el; // Any component using `withGlobalEvents` that is not setting a `ref`
// will cause `this.props.forwardedRef` to be `null`, so we need this
// check.
if (this.props.forwardedRef) {
this.props.forwardedRef(el);
}
}
}, {
key: "render",
value: function render() {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__["createElement"])(WrappedComponent, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, this.props.ownProps, {
ref: this.handleRef
}));
}
}]);
return Wrapper;
}(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__["Component"]);
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__["forwardRef"])(function (props, ref) {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__["createElement"])(Wrapper, {
ownProps: props,
forwardedRef: ref
});
});
}, 'withGlobalEvents');
}
/* harmony default export */ __webpack_exports__["default"] = (withGlobalEvents);
/***/ }),
/***/ "./packages/packages/compose/build-module/with-global-events/listener.js":
/*!*******************************************************************************!*\
!*** ./packages/packages/compose/build-module/with-global-events/listener.js ***!
\*******************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./packages/node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./packages/node_modules/@babel/runtime/helpers/esm/createClass.js");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);
/**
* External dependencies
*/
/**
* Class responsible for orchestrating event handling on the global window,
* binding a single event to be shared across all handling instances, and
* removing the handler when no instances are listening for the event.
*/
var Listener =
/*#__PURE__*/
function () {
function Listener() {
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, Listener);
this.listeners = {};
this.handleEvent = this.handleEvent.bind(this);
}
Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(Listener, [{
key: "add",
value: function add(eventType, instance) {
if (!this.listeners[eventType]) {
// Adding first listener for this type, so bind event.
window.addEventListener(eventType, this.handleEvent);
this.listeners[eventType] = [];
}
this.listeners[eventType].push(instance);
}
}, {
key: "remove",
value: function remove(eventType, instance) {
this.listeners[eventType] = Object(lodash__WEBPACK_IMPORTED_MODULE_2__["without"])(this.listeners[eventType], instance);
if (!this.listeners[eventType].length) {
// Removing last listener for this type, so unbind event.
window.removeEventListener(eventType, this.handleEvent);
delete this.listeners[eventType];
}
}
}, {
key: "handleEvent",
value: function handleEvent(event) {
Object(lodash__WEBPACK_IMPORTED_MODULE_2__["forEach"])(this.listeners[event.type], function (instance) {
instance.handleEvent(event);
});
}
}]);
return Listener;
}();
/* harmony default export */ __webpack_exports__["default"] = (Listener);
/***/ }),
/***/ "./packages/packages/compose/build-module/with-instance-id/index.js":
/*!**************************************************************************!*\
!*** ./packages/packages/compose/build-module/with-instance-id/index.js ***!
\**************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./packages/node_modules/@babel/runtime/helpers/esm/extends.js");
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./packages/node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./packages/node_modules/@babel/runtime/helpers/esm/createClass.js");
/* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/possibleConstructorReturn */ "./packages/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js");
/* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/getPrototypeOf */ "./packages/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js");
/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inherits */ "./packages/node_modules/@babel/runtime/helpers/esm/inherits.js");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _create_higher_order_component__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../create-higher-order-component */ "./packages/packages/compose/build-module/create-higher-order-component/index.js");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* A Higher Order Component used to be provide a unique instance ID by
* component.
*
* @param {WPElement} WrappedComponent The wrapped component.
*
* @return {Component} Component with an instanceId prop.
*/
/* harmony default export */ __webpack_exports__["default"] = (Object(_create_higher_order_component__WEBPACK_IMPORTED_MODULE_7__["default"])(function (WrappedComponent) {
var instances = 0;
return (
/*#__PURE__*/
function (_Component) {
Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_5__["default"])(_class, _Component);
function _class() {
var _this;
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__["default"])(this, _class);
_this = Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__["default"])(this, Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__["default"])(_class).apply(this, arguments));
_this.instanceId = instances++;
return _this;
}
Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__["default"])(_class, [{
key: "render",
value: function render() {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(WrappedComponent, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, this.props, {
instanceId: this.instanceId
}));
}
}]);
return _class;
}(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["Component"])
);
}, 'withInstanceId'));
/***/ }),
/***/ "./packages/packages/compose/build-module/with-safe-timeout/index.js":
/*!***************************************************************************!*\
!*** ./packages/packages/compose/build-module/with-safe-timeout/index.js ***!
\***************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./packages/node_modules/@babel/runtime/helpers/esm/extends.js");
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./packages/node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./packages/node_modules/@babel/runtime/helpers/esm/createClass.js");
/* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/possibleConstructorReturn */ "./packages/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js");
/* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/getPrototypeOf */ "./packages/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js");
/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inherits */ "./packages/node_modules/@babel/runtime/helpers/esm/inherits.js");
/* harmony import */ var _babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/esm/assertThisInitialized */ "./packages/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var _create_higher_order_component__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../create-higher-order-component */ "./packages/packages/compose/build-module/create-higher-order-component/index.js");
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* A higher-order component used to provide and manage delayed function calls
* that ought to be bound to a component's lifecycle.
*
* @param {Component} OriginalComponent Component requiring setTimeout
*
* @return {Component} Wrapped component.
*/
var withSafeTimeout = Object(_create_higher_order_component__WEBPACK_IMPORTED_MODULE_9__["default"])(function (OriginalComponent) {
return (
/*#__PURE__*/
function (_Component) {
Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_5__["default"])(WrappedComponent, _Component);
function WrappedComponent() {
var _this;
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__["default"])(this, WrappedComponent);
_this = Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__["default"])(this, Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__["default"])(WrappedComponent).apply(this, arguments));
_this.timeouts = [];
_this.setTimeout = _this.setTimeout.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_6__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_6__["default"])(_this)));
_this.clearTimeout = _this.clearTimeout.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_6__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_6__["default"])(_this)));
return _this;
}
Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__["default"])(WrappedComponent, [{
key: "componentWillUnmount",
value: function componentWillUnmount() {
this.timeouts.forEach(clearTimeout);
}
}, {
key: "setTimeout",
value: function (_setTimeout) {
function setTimeout(_x, _x2) {
return _setTimeout.apply(this, arguments);
}
setTimeout.toString = function () {
return _setTimeout.toString();
};
return setTimeout;
}(function (fn, delay) {
var _this2 = this;
var id = setTimeout(function () {
fn();
_this2.clearTimeout(id);
}, delay);
this.timeouts.push(id);
return id;
})
}, {
key: "clearTimeout",
value: function (_clearTimeout) {
function clearTimeout(_x3) {
return _clearTimeout.apply(this, arguments);
}
clearTimeout.toString = function () {
return _clearTimeout.toString();
};
return clearTimeout;
}(function (id) {
clearTimeout(id);
this.timeouts = Object(lodash__WEBPACK_IMPORTED_MODULE_8__["without"])(this.timeouts, id);
})
}, {
key: "render",
value: function render() {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__["createElement"])(OriginalComponent, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, this.props, {
setTimeout: this.setTimeout,
clearTimeout: this.clearTimeout
}));
}
}]);
return WrappedComponent;
}(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__["Component"])
);
}, 'withSafeTimeout');
/* harmony default export */ __webpack_exports__["default"] = (withSafeTimeout);
/***/ }),
/***/ "./packages/packages/compose/build-module/with-state/index.js":
/*!********************************************************************!*\
!*** ./packages/packages/compose/build-module/with-state/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 withState; });
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./packages/node_modules/@babel/runtime/helpers/esm/extends.js");
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./packages/node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./packages/node_modules/@babel/runtime/helpers/esm/createClass.js");
/* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/possibleConstructorReturn */ "./packages/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js");
/* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/getPrototypeOf */ "./packages/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js");
/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inherits */ "./packages/node_modules/@babel/runtime/helpers/esm/inherits.js");
/* harmony import */ var _babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/esm/assertThisInitialized */ "./packages/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var _create_higher_order_component__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../create-higher-order-component */ "./packages/packages/compose/build-module/create-higher-order-component/index.js");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* A Higher Order Component used to provide and manage internal component state
* via props.
*
* @param {?Object} initialState Optional initial state of the component.
*
* @return {Component} Wrapped component.
*/
function withState() {
var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return Object(_create_higher_order_component__WEBPACK_IMPORTED_MODULE_8__["default"])(function (OriginalComponent) {
return (
/*#__PURE__*/
function (_Component) {
Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_5__["default"])(WrappedComponent, _Component);
function WrappedComponent() {
var _this;
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__["default"])(this, WrappedComponent);
_this = Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__["default"])(this, Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__["default"])(WrappedComponent).apply(this, arguments));
_this.setState = _this.setState.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_6__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_6__["default"])(_this)));
_this.state = initialState;
return _this;
}
Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__["default"])(WrappedComponent, [{
key: "render",
value: function render() {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__["createElement"])(OriginalComponent, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, this.props, this.state, {
setState: this.setState
}));
}
}]);
return WrappedComponent;
}(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__["Component"])
);
}, 'withState');
}
/***/ }),
/***/ "@wordpress/element":
/*!******************************************!*\
!*** external {"this":["wp","element"]} ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["element"]; }());
/***/ }),
/***/ "@wordpress/is-shallow-equal":
/*!*************************************************!*\
!*** external {"this":["wp","isShallowEqual"]} ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["isShallowEqual"]; }());
/***/ }),
/***/ "lodash":
/*!*************************!*\
!*** external "lodash" ***!
\*************************/
/*! no static exports found */
/***/ (function(module, exports) {
(function() { module.exports = this["lodash"]; }());
/***/ })
/******/ });
//# sourceMappingURL=compose.js.map