778 lines
33 KiB
JavaScript
778 lines
33 KiB
JavaScript
|
this["wp"] = this["wp"] || {}; this["wp"]["plugins"] =
|
||
|
/******/ (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 = "./node_modules/@wordpress/plugins/build-module/index.js");
|
||
|
/******/ })
|
||
|
/************************************************************************/
|
||
|
/******/ ({
|
||
|
|
||
|
/***/ "./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js":
|
||
|
/*!**************************************************************************!*\
|
||
|
!*** ./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;
|
||
|
}
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js":
|
||
|
/*!*******************************************************************!*\
|
||
|
!*** ./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");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./node_modules/@babel/runtime/helpers/esm/createClass.js":
|
||
|
/*!****************************************************************!*\
|
||
|
!*** ./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;
|
||
|
}
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js":
|
||
|
/*!*******************************************************************!*\
|
||
|
!*** ./node_modules/@babel/runtime/helpers/esm/defineProperty.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 _defineProperty; });
|
||
|
function _defineProperty(obj, key, value) {
|
||
|
if (key in obj) {
|
||
|
Object.defineProperty(obj, key, {
|
||
|
value: value,
|
||
|
enumerable: true,
|
||
|
configurable: true,
|
||
|
writable: true
|
||
|
});
|
||
|
} else {
|
||
|
obj[key] = value;
|
||
|
}
|
||
|
|
||
|
return obj;
|
||
|
}
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./node_modules/@babel/runtime/helpers/esm/extends.js":
|
||
|
/*!************************************************************!*\
|
||
|
!*** ./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);
|
||
|
}
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js":
|
||
|
/*!*******************************************************************!*\
|
||
|
!*** ./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);
|
||
|
}
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./node_modules/@babel/runtime/helpers/esm/inherits.js":
|
||
|
/*!*************************************************************!*\
|
||
|
!*** ./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 */ "./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);
|
||
|
}
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js":
|
||
|
/*!*****************************************************************!*\
|
||
|
!*** ./node_modules/@babel/runtime/helpers/esm/objectSpread.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 _objectSpread; });
|
||
|
/* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
|
||
|
|
||
|
function _objectSpread(target) {
|
||
|
for (var i = 1; i < arguments.length; i++) {
|
||
|
var source = arguments[i] != null ? arguments[i] : {};
|
||
|
var ownKeys = Object.keys(source);
|
||
|
|
||
|
if (typeof Object.getOwnPropertySymbols === 'function') {
|
||
|
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
||
|
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||
|
}));
|
||
|
}
|
||
|
|
||
|
ownKeys.forEach(function (key) {
|
||
|
Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(target, key, source[key]);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
return target;
|
||
|
}
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js":
|
||
|
/*!******************************************************************************!*\
|
||
|
!*** ./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 */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
|
||
|
/* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assertThisInitialized */ "./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);
|
||
|
}
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js":
|
||
|
/*!*******************************************************************!*\
|
||
|
!*** ./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);
|
||
|
}
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./node_modules/@babel/runtime/helpers/esm/typeof.js":
|
||
|
/*!***********************************************************!*\
|
||
|
!*** ./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);
|
||
|
}
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./node_modules/@wordpress/plugins/build-module/api/index.js":
|
||
|
/*!*******************************************************************!*\
|
||
|
!*** ./node_modules/@wordpress/plugins/build-module/api/index.js ***!
|
||
|
\*******************************************************************/
|
||
|
/*! exports provided: registerPlugin, unregisterPlugin, getPlugin, getPlugins */
|
||
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
|
||
|
"use strict";
|
||
|
__webpack_require__.r(__webpack_exports__);
|
||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerPlugin", function() { return registerPlugin; });
|
||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unregisterPlugin", function() { return unregisterPlugin; });
|
||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPlugin", function() { return getPlugin; });
|
||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPlugins", function() { return getPlugins; });
|
||
|
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread */ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js");
|
||
|
/* harmony import */ var _babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/typeof */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
|
||
|
/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/hooks */ "@wordpress/hooks");
|
||
|
/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_2__);
|
||
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash */ "lodash");
|
||
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__);
|
||
|
|
||
|
|
||
|
|
||
|
/* eslint no-console: [ 'error', { allow: [ 'error' ] } ] */
|
||
|
|
||
|
/**
|
||
|
* WordPress dependencies
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* External dependencies
|
||
|
*/
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Plugin definitions keyed by plugin name.
|
||
|
*
|
||
|
* @type {Object.<string,WPPlugin>}
|
||
|
*/
|
||
|
|
||
|
var plugins = {};
|
||
|
/**
|
||
|
* Registers a plugin to the editor.
|
||
|
*
|
||
|
* @param {string} name The name of the plugin.
|
||
|
* @param {Object} settings The settings for this plugin.
|
||
|
* @param {Function} settings.render The function that renders the plugin.
|
||
|
* @param {string|WPElement|Function} settings.icon An icon to be shown in the UI.
|
||
|
*
|
||
|
* @return {Object} The final plugin settings object.
|
||
|
*/
|
||
|
|
||
|
function registerPlugin(name, settings) {
|
||
|
if (Object(_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_1__["default"])(settings) !== 'object') {
|
||
|
console.error('No settings object provided!');
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
if (typeof name !== 'string') {
|
||
|
console.error('Plugin names must be strings.');
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
if (!/^[a-z][a-z0-9-]*$/.test(name)) {
|
||
|
console.error('Plugin names must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-plugin".');
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
if (plugins[name]) {
|
||
|
console.error("Plugin \"".concat(name, "\" is already registered."));
|
||
|
}
|
||
|
|
||
|
settings = Object(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_2__["applyFilters"])('plugins.registerPlugin', settings, name);
|
||
|
|
||
|
if (!Object(lodash__WEBPACK_IMPORTED_MODULE_3__["isFunction"])(settings.render)) {
|
||
|
console.error('The "render" property must be specified and must be a valid function.');
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
plugins[name] = Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__["default"])({
|
||
|
name: name,
|
||
|
icon: 'admin-plugins'
|
||
|
}, settings);
|
||
|
Object(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_2__["doAction"])('plugins.pluginRegistered', settings, name);
|
||
|
return settings;
|
||
|
}
|
||
|
/**
|
||
|
* Unregisters a plugin by name.
|
||
|
*
|
||
|
* @param {string} name Plugin name.
|
||
|
*
|
||
|
* @return {?WPPlugin} The previous plugin settings object, if it has been
|
||
|
* successfully unregistered; otherwise `undefined`.
|
||
|
*/
|
||
|
|
||
|
function unregisterPlugin(name) {
|
||
|
if (!plugins[name]) {
|
||
|
console.error('Plugin "' + name + '" is not registered.');
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
var oldPlugin = plugins[name];
|
||
|
delete plugins[name];
|
||
|
Object(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_2__["doAction"])('plugins.pluginUnregistered', oldPlugin, name);
|
||
|
return oldPlugin;
|
||
|
}
|
||
|
/**
|
||
|
* Returns a registered plugin settings.
|
||
|
*
|
||
|
* @param {string} name Plugin name.
|
||
|
*
|
||
|
* @return {?Object} Plugin setting.
|
||
|
*/
|
||
|
|
||
|
function getPlugin(name) {
|
||
|
return plugins[name];
|
||
|
}
|
||
|
/**
|
||
|
* Returns all registered plugins.
|
||
|
*
|
||
|
* @return {Array} Plugin settings.
|
||
|
*/
|
||
|
|
||
|
function getPlugins() {
|
||
|
return Object.values(plugins);
|
||
|
}
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./node_modules/@wordpress/plugins/build-module/components/index.js":
|
||
|
/*!**************************************************************************!*\
|
||
|
!*** ./node_modules/@wordpress/plugins/build-module/components/index.js ***!
|
||
|
\**************************************************************************/
|
||
|
/*! exports provided: PluginArea, withPluginContext */
|
||
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
|
||
|
"use strict";
|
||
|
__webpack_require__.r(__webpack_exports__);
|
||
|
/* harmony import */ var _plugin_area__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./plugin-area */ "./node_modules/@wordpress/plugins/build-module/components/plugin-area/index.js");
|
||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PluginArea", function() { return _plugin_area__WEBPACK_IMPORTED_MODULE_0__["default"]; });
|
||
|
|
||
|
/* harmony import */ var _plugin_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./plugin-context */ "./node_modules/@wordpress/plugins/build-module/components/plugin-context/index.js");
|
||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "withPluginContext", function() { return _plugin_context__WEBPACK_IMPORTED_MODULE_1__["withPluginContext"]; });
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./node_modules/@wordpress/plugins/build-module/components/plugin-area/index.js":
|
||
|
/*!**************************************************************************************!*\
|
||
|
!*** ./node_modules/@wordpress/plugins/build-module/components/plugin-area/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 */ "./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 */ "./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 */ "./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 */ "./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 */ "./node_modules/@babel/runtime/helpers/esm/inherits.js");
|
||
|
/* harmony import */ var _babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.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 lodash__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lodash */ "lodash");
|
||
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_7__);
|
||
|
/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/hooks */ "@wordpress/hooks");
|
||
|
/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_8__);
|
||
|
/* harmony import */ var _plugin_context__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../plugin-context */ "./node_modules/@wordpress/plugins/build-module/components/plugin-context/index.js");
|
||
|
/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../api */ "./node_modules/@wordpress/plugins/build-module/api/index.js");
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
* External dependencies
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* WordPress dependencies
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Internal dependencies
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
* A component that renders all plugin fills in a hidden div.
|
||
|
*
|
||
|
* @return {WPElement} Plugin area.
|
||
|
*/
|
||
|
|
||
|
var PluginArea =
|
||
|
/*#__PURE__*/
|
||
|
function (_Component) {
|
||
|
Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__["default"])(PluginArea, _Component);
|
||
|
|
||
|
function PluginArea() {
|
||
|
var _this;
|
||
|
|
||
|
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, PluginArea);
|
||
|
|
||
|
_this = Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__["default"])(this, Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__["default"])(PluginArea).apply(this, arguments));
|
||
|
_this.setPlugins = _this.setPlugins.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(_this)));
|
||
|
_this.state = _this.getCurrentPluginsState();
|
||
|
return _this;
|
||
|
}
|
||
|
|
||
|
Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(PluginArea, [{
|
||
|
key: "getCurrentPluginsState",
|
||
|
value: function getCurrentPluginsState() {
|
||
|
return {
|
||
|
plugins: Object(lodash__WEBPACK_IMPORTED_MODULE_7__["map"])(Object(_api__WEBPACK_IMPORTED_MODULE_10__["getPlugins"])(), function (_ref) {
|
||
|
var icon = _ref.icon,
|
||
|
name = _ref.name,
|
||
|
render = _ref.render;
|
||
|
return {
|
||
|
Plugin: render,
|
||
|
context: {
|
||
|
name: name,
|
||
|
icon: icon
|
||
|
}
|
||
|
};
|
||
|
})
|
||
|
};
|
||
|
}
|
||
|
}, {
|
||
|
key: "componentDidMount",
|
||
|
value: function componentDidMount() {
|
||
|
Object(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_8__["addAction"])('plugins.pluginRegistered', 'core/plugins/plugin-area/plugins-registered', this.setPlugins);
|
||
|
Object(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_8__["addAction"])('plugins.pluginUnregistered', 'core/plugins/plugin-area/plugins-unregistered', this.setPlugins);
|
||
|
}
|
||
|
}, {
|
||
|
key: "componentWillUnmount",
|
||
|
value: function componentWillUnmount() {
|
||
|
Object(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_8__["removeAction"])('plugins.pluginRegistered', 'core/plugins/plugin-area/plugins-registered');
|
||
|
Object(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_8__["removeAction"])('plugins.pluginUnregistered', 'core/plugins/plugin-area/plugins-unregistered');
|
||
|
}
|
||
|
}, {
|
||
|
key: "setPlugins",
|
||
|
value: function setPlugins() {
|
||
|
this.setState(this.getCurrentPluginsState);
|
||
|
}
|
||
|
}, {
|
||
|
key: "render",
|
||
|
value: function render() {
|
||
|
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
|
||
|
style: {
|
||
|
display: 'none'
|
||
|
}
|
||
|
}, Object(lodash__WEBPACK_IMPORTED_MODULE_7__["map"])(this.state.plugins, function (_ref2) {
|
||
|
var context = _ref2.context,
|
||
|
Plugin = _ref2.Plugin;
|
||
|
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_plugin_context__WEBPACK_IMPORTED_MODULE_9__["PluginContextProvider"], {
|
||
|
key: context.name,
|
||
|
value: context
|
||
|
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(Plugin, null));
|
||
|
}));
|
||
|
}
|
||
|
}]);
|
||
|
|
||
|
return PluginArea;
|
||
|
}(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["Component"]);
|
||
|
|
||
|
/* harmony default export */ __webpack_exports__["default"] = (PluginArea);
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./node_modules/@wordpress/plugins/build-module/components/plugin-context/index.js":
|
||
|
/*!*****************************************************************************************!*\
|
||
|
!*** ./node_modules/@wordpress/plugins/build-module/components/plugin-context/index.js ***!
|
||
|
\*****************************************************************************************/
|
||
|
/*! exports provided: PluginContextProvider, withPluginContext */
|
||
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
|
||
|
"use strict";
|
||
|
__webpack_require__.r(__webpack_exports__);
|
||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PluginContextProvider", function() { return Provider; });
|
||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "withPluginContext", function() { return withPluginContext; });
|
||
|
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js");
|
||
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
|
||
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
|
||
|
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose");
|
||
|
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_2__);
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
* WordPress dependencies
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
var _createContext = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createContext"])({
|
||
|
name: null,
|
||
|
icon: null
|
||
|
}),
|
||
|
Consumer = _createContext.Consumer,
|
||
|
Provider = _createContext.Provider;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* A Higher Order Component used to inject Plugin context to the
|
||
|
* wrapped component.
|
||
|
*
|
||
|
* @param {Function} mapContextToProps Function called on every context change,
|
||
|
* expected to return object of props to
|
||
|
* merge with the component's own props.
|
||
|
*
|
||
|
* @return {Component} Enhanced component with injected context as props.
|
||
|
*/
|
||
|
|
||
|
var withPluginContext = function withPluginContext(mapContextToProps) {
|
||
|
return Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_2__["createHigherOrderComponent"])(function (OriginalComponent) {
|
||
|
return function (props) {
|
||
|
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(Consumer, null, function (context) {
|
||
|
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(OriginalComponent, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, props, mapContextToProps(context, props)));
|
||
|
});
|
||
|
};
|
||
|
}, 'withPluginContext');
|
||
|
};
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "./node_modules/@wordpress/plugins/build-module/index.js":
|
||
|
/*!***************************************************************!*\
|
||
|
!*** ./node_modules/@wordpress/plugins/build-module/index.js ***!
|
||
|
\***************************************************************/
|
||
|
/*! exports provided: PluginArea, withPluginContext, registerPlugin, unregisterPlugin, getPlugin, getPlugins */
|
||
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
|
||
|
"use strict";
|
||
|
__webpack_require__.r(__webpack_exports__);
|
||
|
/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components */ "./node_modules/@wordpress/plugins/build-module/components/index.js");
|
||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PluginArea", function() { return _components__WEBPACK_IMPORTED_MODULE_0__["PluginArea"]; });
|
||
|
|
||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "withPluginContext", function() { return _components__WEBPACK_IMPORTED_MODULE_0__["withPluginContext"]; });
|
||
|
|
||
|
/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./api */ "./node_modules/@wordpress/plugins/build-module/api/index.js");
|
||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "registerPlugin", function() { return _api__WEBPACK_IMPORTED_MODULE_1__["registerPlugin"]; });
|
||
|
|
||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "unregisterPlugin", function() { return _api__WEBPACK_IMPORTED_MODULE_1__["unregisterPlugin"]; });
|
||
|
|
||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getPlugin", function() { return _api__WEBPACK_IMPORTED_MODULE_1__["getPlugin"]; });
|
||
|
|
||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getPlugins", function() { return _api__WEBPACK_IMPORTED_MODULE_1__["getPlugins"]; });
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "@wordpress/compose":
|
||
|
/*!******************************************!*\
|
||
|
!*** external {"this":["wp","compose"]} ***!
|
||
|
\******************************************/
|
||
|
/*! no static exports found */
|
||
|
/***/ (function(module, exports) {
|
||
|
|
||
|
(function() { module.exports = this["wp"]["compose"]; }());
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "@wordpress/element":
|
||
|
/*!******************************************!*\
|
||
|
!*** external {"this":["wp","element"]} ***!
|
||
|
\******************************************/
|
||
|
/*! no static exports found */
|
||
|
/***/ (function(module, exports) {
|
||
|
|
||
|
(function() { module.exports = this["wp"]["element"]; }());
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "@wordpress/hooks":
|
||
|
/*!****************************************!*\
|
||
|
!*** external {"this":["wp","hooks"]} ***!
|
||
|
\****************************************/
|
||
|
/*! no static exports found */
|
||
|
/***/ (function(module, exports) {
|
||
|
|
||
|
(function() { module.exports = this["wp"]["hooks"]; }());
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ "lodash":
|
||
|
/*!*************************!*\
|
||
|
!*** external "lodash" ***!
|
||
|
\*************************/
|
||
|
/*! no static exports found */
|
||
|
/***/ (function(module, exports) {
|
||
|
|
||
|
(function() { module.exports = this["lodash"]; }());
|
||
|
|
||
|
/***/ })
|
||
|
|
||
|
/******/ });
|
||
|
//# sourceMappingURL=plugins.js.map
|