wp/wp-includes/js/dist/plugins.js
changeset 9 177826044cd9
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
       
     1 this["wp"] = this["wp"] || {}; this["wp"]["plugins"] =
       
     2 /******/ (function(modules) { // webpackBootstrap
       
     3 /******/ 	// The module cache
       
     4 /******/ 	var installedModules = {};
       
     5 /******/
       
     6 /******/ 	// The require function
       
     7 /******/ 	function __webpack_require__(moduleId) {
       
     8 /******/
       
     9 /******/ 		// Check if module is in cache
       
    10 /******/ 		if(installedModules[moduleId]) {
       
    11 /******/ 			return installedModules[moduleId].exports;
       
    12 /******/ 		}
       
    13 /******/ 		// Create a new module (and put it into the cache)
       
    14 /******/ 		var module = installedModules[moduleId] = {
       
    15 /******/ 			i: moduleId,
       
    16 /******/ 			l: false,
       
    17 /******/ 			exports: {}
       
    18 /******/ 		};
       
    19 /******/
       
    20 /******/ 		// Execute the module function
       
    21 /******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
       
    22 /******/
       
    23 /******/ 		// Flag the module as loaded
       
    24 /******/ 		module.l = true;
       
    25 /******/
       
    26 /******/ 		// Return the exports of the module
       
    27 /******/ 		return module.exports;
       
    28 /******/ 	}
       
    29 /******/
       
    30 /******/
       
    31 /******/ 	// expose the modules object (__webpack_modules__)
       
    32 /******/ 	__webpack_require__.m = modules;
       
    33 /******/
       
    34 /******/ 	// expose the module cache
       
    35 /******/ 	__webpack_require__.c = installedModules;
       
    36 /******/
       
    37 /******/ 	// define getter function for harmony exports
       
    38 /******/ 	__webpack_require__.d = function(exports, name, getter) {
       
    39 /******/ 		if(!__webpack_require__.o(exports, name)) {
       
    40 /******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
       
    41 /******/ 		}
       
    42 /******/ 	};
       
    43 /******/
       
    44 /******/ 	// define __esModule on exports
       
    45 /******/ 	__webpack_require__.r = function(exports) {
       
    46 /******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
       
    47 /******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
       
    48 /******/ 		}
       
    49 /******/ 		Object.defineProperty(exports, '__esModule', { value: true });
       
    50 /******/ 	};
       
    51 /******/
       
    52 /******/ 	// create a fake namespace object
       
    53 /******/ 	// mode & 1: value is a module id, require it
       
    54 /******/ 	// mode & 2: merge all properties of value into the ns
       
    55 /******/ 	// mode & 4: return value when already ns object
       
    56 /******/ 	// mode & 8|1: behave like require
       
    57 /******/ 	__webpack_require__.t = function(value, mode) {
       
    58 /******/ 		if(mode & 1) value = __webpack_require__(value);
       
    59 /******/ 		if(mode & 8) return value;
       
    60 /******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
       
    61 /******/ 		var ns = Object.create(null);
       
    62 /******/ 		__webpack_require__.r(ns);
       
    63 /******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
       
    64 /******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
       
    65 /******/ 		return ns;
       
    66 /******/ 	};
       
    67 /******/
       
    68 /******/ 	// getDefaultExport function for compatibility with non-harmony modules
       
    69 /******/ 	__webpack_require__.n = function(module) {
       
    70 /******/ 		var getter = module && module.__esModule ?
       
    71 /******/ 			function getDefault() { return module['default']; } :
       
    72 /******/ 			function getModuleExports() { return module; };
       
    73 /******/ 		__webpack_require__.d(getter, 'a', getter);
       
    74 /******/ 		return getter;
       
    75 /******/ 	};
       
    76 /******/
       
    77 /******/ 	// Object.prototype.hasOwnProperty.call
       
    78 /******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
       
    79 /******/
       
    80 /******/ 	// __webpack_public_path__
       
    81 /******/ 	__webpack_require__.p = "";
       
    82 /******/
       
    83 /******/
       
    84 /******/ 	// Load entry module and return exports
       
    85 /******/ 	return __webpack_require__(__webpack_require__.s = 377);
       
    86 /******/ })
       
    87 /************************************************************************/
       
    88 /******/ ({
       
    89 
       
    90 /***/ 0:
       
    91 /***/ (function(module, exports) {
       
    92 
       
    93 (function() { module.exports = this["wp"]["element"]; }());
       
    94 
       
    95 /***/ }),
       
    96 
       
    97 /***/ 10:
       
    98 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
    99 
       
   100 "use strict";
       
   101 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
       
   102 function _classCallCheck(instance, Constructor) {
       
   103   if (!(instance instanceof Constructor)) {
       
   104     throw new TypeError("Cannot call a class as a function");
       
   105   }
       
   106 }
       
   107 
       
   108 /***/ }),
       
   109 
       
   110 /***/ 11:
       
   111 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   112 
       
   113 "use strict";
       
   114 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; });
       
   115 /* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32);
       
   116 /* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
       
   117 
       
   118 
       
   119 function _possibleConstructorReturn(self, call) {
       
   120   if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) {
       
   121     return call;
       
   122   }
       
   123 
       
   124   return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self);
       
   125 }
       
   126 
       
   127 /***/ }),
       
   128 
       
   129 /***/ 12:
       
   130 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   131 
       
   132 "use strict";
       
   133 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; });
       
   134 function _getPrototypeOf(o) {
       
   135   _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
       
   136     return o.__proto__ || Object.getPrototypeOf(o);
       
   137   };
       
   138   return _getPrototypeOf(o);
       
   139 }
       
   140 
       
   141 /***/ }),
       
   142 
       
   143 /***/ 13:
       
   144 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   145 
       
   146 "use strict";
       
   147 
       
   148 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
       
   149 function _setPrototypeOf(o, p) {
       
   150   _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
       
   151     o.__proto__ = p;
       
   152     return o;
       
   153   };
       
   154 
       
   155   return _setPrototypeOf(o, p);
       
   156 }
       
   157 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
       
   158 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _inherits; });
       
   159 
       
   160 function _inherits(subClass, superClass) {
       
   161   if (typeof superClass !== "function" && superClass !== null) {
       
   162     throw new TypeError("Super expression must either be null or a function");
       
   163   }
       
   164 
       
   165   subClass.prototype = Object.create(superClass && superClass.prototype, {
       
   166     constructor: {
       
   167       value: subClass,
       
   168       writable: true,
       
   169       configurable: true
       
   170     }
       
   171   });
       
   172   if (superClass) _setPrototypeOf(subClass, superClass);
       
   173 }
       
   174 
       
   175 /***/ }),
       
   176 
       
   177 /***/ 15:
       
   178 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   179 
       
   180 "use strict";
       
   181 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
       
   182 function _defineProperty(obj, key, value) {
       
   183   if (key in obj) {
       
   184     Object.defineProperty(obj, key, {
       
   185       value: value,
       
   186       enumerable: true,
       
   187       configurable: true,
       
   188       writable: true
       
   189     });
       
   190   } else {
       
   191     obj[key] = value;
       
   192   }
       
   193 
       
   194   return obj;
       
   195 }
       
   196 
       
   197 /***/ }),
       
   198 
       
   199 /***/ 19:
       
   200 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   201 
       
   202 "use strict";
       
   203 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
       
   204 function _extends() {
       
   205   _extends = Object.assign || function (target) {
       
   206     for (var i = 1; i < arguments.length; i++) {
       
   207       var source = arguments[i];
       
   208 
       
   209       for (var key in source) {
       
   210         if (Object.prototype.hasOwnProperty.call(source, key)) {
       
   211           target[key] = source[key];
       
   212         }
       
   213       }
       
   214     }
       
   215 
       
   216     return target;
       
   217   };
       
   218 
       
   219   return _extends.apply(this, arguments);
       
   220 }
       
   221 
       
   222 /***/ }),
       
   223 
       
   224 /***/ 2:
       
   225 /***/ (function(module, exports) {
       
   226 
       
   227 (function() { module.exports = this["lodash"]; }());
       
   228 
       
   229 /***/ }),
       
   230 
       
   231 /***/ 26:
       
   232 /***/ (function(module, exports) {
       
   233 
       
   234 (function() { module.exports = this["wp"]["hooks"]; }());
       
   235 
       
   236 /***/ }),
       
   237 
       
   238 /***/ 3:
       
   239 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   240 
       
   241 "use strict";
       
   242 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; });
       
   243 function _assertThisInitialized(self) {
       
   244   if (self === void 0) {
       
   245     throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
       
   246   }
       
   247 
       
   248   return self;
       
   249 }
       
   250 
       
   251 /***/ }),
       
   252 
       
   253 /***/ 32:
       
   254 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   255 
       
   256 "use strict";
       
   257 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; });
       
   258 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); }
       
   259 
       
   260 function _typeof(obj) {
       
   261   if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
       
   262     _typeof = function _typeof(obj) {
       
   263       return _typeof2(obj);
       
   264     };
       
   265   } else {
       
   266     _typeof = function _typeof(obj) {
       
   267       return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
       
   268     };
       
   269   }
       
   270 
       
   271   return _typeof(obj);
       
   272 }
       
   273 
       
   274 /***/ }),
       
   275 
       
   276 /***/ 377:
       
   277 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   278 
       
   279 "use strict";
       
   280 __webpack_require__.r(__webpack_exports__);
       
   281 
       
   282 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
       
   283 var classCallCheck = __webpack_require__(10);
       
   284 
       
   285 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
       
   286 var createClass = __webpack_require__(9);
       
   287 
       
   288 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
       
   289 var possibleConstructorReturn = __webpack_require__(11);
       
   290 
       
   291 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
       
   292 var getPrototypeOf = __webpack_require__(12);
       
   293 
       
   294 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules
       
   295 var inherits = __webpack_require__(13);
       
   296 
       
   297 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
       
   298 var assertThisInitialized = __webpack_require__(3);
       
   299 
       
   300 // EXTERNAL MODULE: external {"this":["wp","element"]}
       
   301 var external_this_wp_element_ = __webpack_require__(0);
       
   302 
       
   303 // EXTERNAL MODULE: external "lodash"
       
   304 var external_lodash_ = __webpack_require__(2);
       
   305 
       
   306 // EXTERNAL MODULE: external {"this":["wp","hooks"]}
       
   307 var external_this_wp_hooks_ = __webpack_require__(26);
       
   308 
       
   309 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
       
   310 var esm_extends = __webpack_require__(19);
       
   311 
       
   312 // EXTERNAL MODULE: external {"this":["wp","compose"]}
       
   313 var external_this_wp_compose_ = __webpack_require__(6);
       
   314 
       
   315 // CONCATENATED MODULE: ./node_modules/@wordpress/plugins/build-module/components/plugin-context/index.js
       
   316 
       
   317 
       
   318 
       
   319 /**
       
   320  * WordPress dependencies
       
   321  */
       
   322 
       
   323 
       
   324 
       
   325 var _createContext = Object(external_this_wp_element_["createContext"])({
       
   326   name: null,
       
   327   icon: null
       
   328 }),
       
   329     Consumer = _createContext.Consumer,
       
   330     Provider = _createContext.Provider;
       
   331 
       
   332 
       
   333 /**
       
   334  * A Higher Order Component used to inject Plugin context to the
       
   335  * wrapped component.
       
   336  *
       
   337  * @param {Function} mapContextToProps Function called on every context change,
       
   338  *                                     expected to return object of props to
       
   339  *                                     merge with the component's own props.
       
   340  *
       
   341  * @return {Component} Enhanced component with injected context as props.
       
   342  */
       
   343 
       
   344 var plugin_context_withPluginContext = function withPluginContext(mapContextToProps) {
       
   345   return Object(external_this_wp_compose_["createHigherOrderComponent"])(function (OriginalComponent) {
       
   346     return function (props) {
       
   347       return Object(external_this_wp_element_["createElement"])(Consumer, null, function (context) {
       
   348         return Object(external_this_wp_element_["createElement"])(OriginalComponent, Object(esm_extends["a" /* default */])({}, props, mapContextToProps(context, props)));
       
   349       });
       
   350     };
       
   351   }, 'withPluginContext');
       
   352 };
       
   353 
       
   354 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js
       
   355 var objectSpread = __webpack_require__(7);
       
   356 
       
   357 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
       
   358 var esm_typeof = __webpack_require__(32);
       
   359 
       
   360 // CONCATENATED MODULE: ./node_modules/@wordpress/plugins/build-module/api/index.js
       
   361 
       
   362 
       
   363 
       
   364 /* eslint no-console: [ 'error', { allow: [ 'error' ] } ] */
       
   365 
       
   366 /**
       
   367  * WordPress dependencies
       
   368  */
       
   369 
       
   370 /**
       
   371  * External dependencies
       
   372  */
       
   373 
       
   374 
       
   375 /**
       
   376  * Plugin definitions keyed by plugin name.
       
   377  *
       
   378  * @type {Object.<string,WPPlugin>}
       
   379  */
       
   380 
       
   381 var plugins = {};
       
   382 /**
       
   383  * Registers a plugin to the editor.
       
   384  *
       
   385  * @param {string}                    name            A string identifying the plugin. Must be unique across all registered plugins.
       
   386  * @param {Object}                    settings        The settings for this plugin.
       
   387  * @param {string|WPElement|Function} settings.icon   An icon to be shown in the UI. It can be a slug of the Dashicon,
       
   388  * or an element (or function returning an element) if you choose to render your own SVG.
       
   389  * @param {Function}                  settings.render A component containing the UI elements to be rendered.
       
   390  *
       
   391  * @example <caption>ES5</caption>
       
   392  * ```js
       
   393  * // Using ES5 syntax
       
   394  * var el = wp.element.createElement;
       
   395  * var Fragment = wp.element.Fragment;
       
   396  * var PluginSidebar = wp.editPost.PluginSidebar;
       
   397  * var PluginSidebarMoreMenuItem = wp.editPost.PluginSidebarMoreMenuItem;
       
   398  * var registerPlugin = wp.plugins.registerPlugin;
       
   399  *
       
   400  * function Component() {
       
   401  * 	return el(
       
   402  * 		Fragment,
       
   403  * 		{},
       
   404  * 		el(
       
   405  * 			PluginSidebarMoreMenuItem,
       
   406  * 			{
       
   407  * 				target: 'sidebar-name',
       
   408  * 			},
       
   409  * 			'My Sidebar'
       
   410  * 		),
       
   411  * 		el(
       
   412  * 			PluginSidebar,
       
   413  * 			{
       
   414  * 				name: 'sidebar-name',
       
   415  * 				title: 'My Sidebar',
       
   416  * 			},
       
   417  * 			'Content of the sidebar'
       
   418  * 		)
       
   419  * 	);
       
   420  * }
       
   421  * registerPlugin( 'plugin-name', {
       
   422  * 	icon: 'smiley',
       
   423  * 	render: Component,
       
   424  * } );
       
   425  * ```
       
   426  *
       
   427  * @example <caption>ESNext</caption>
       
   428  * ```js
       
   429  * // Using ESNext syntax
       
   430  * const { Fragment } = wp.element;
       
   431  * const { PluginSidebar, PluginSidebarMoreMenuItem } = wp.editPost;
       
   432  * const { registerPlugin } = wp.plugins;
       
   433  *
       
   434  * const Component = () => (
       
   435  * 	<Fragment>
       
   436  * 		<PluginSidebarMoreMenuItem
       
   437  * 			target="sidebar-name"
       
   438  * 		>
       
   439  * 			My Sidebar
       
   440  * 		</PluginSidebarMoreMenuItem>
       
   441  * 		<PluginSidebar
       
   442  * 			name="sidebar-name"
       
   443  * 			title="My Sidebar"
       
   444  * 		>
       
   445  * 			Content of the sidebar
       
   446  * 		</PluginSidebar>
       
   447  * 	</Fragment>
       
   448  * );
       
   449  *
       
   450  * registerPlugin( 'plugin-name', {
       
   451  * 	icon: 'smiley',
       
   452  * 	render: Component,
       
   453  * } );
       
   454  * ```
       
   455  *
       
   456  * @return {Object} The final plugin settings object.
       
   457  */
       
   458 
       
   459 function registerPlugin(name, settings) {
       
   460   if (Object(esm_typeof["a" /* default */])(settings) !== 'object') {
       
   461     console.error('No settings object provided!');
       
   462     return null;
       
   463   }
       
   464 
       
   465   if (typeof name !== 'string') {
       
   466     console.error('Plugin names must be strings.');
       
   467     return null;
       
   468   }
       
   469 
       
   470   if (!/^[a-z][a-z0-9-]*$/.test(name)) {
       
   471     console.error('Plugin names must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-plugin".');
       
   472     return null;
       
   473   }
       
   474 
       
   475   if (plugins[name]) {
       
   476     console.error("Plugin \"".concat(name, "\" is already registered."));
       
   477   }
       
   478 
       
   479   settings = Object(external_this_wp_hooks_["applyFilters"])('plugins.registerPlugin', settings, name);
       
   480 
       
   481   if (!Object(external_lodash_["isFunction"])(settings.render)) {
       
   482     console.error('The "render" property must be specified and must be a valid function.');
       
   483     return null;
       
   484   }
       
   485 
       
   486   plugins[name] = Object(objectSpread["a" /* default */])({
       
   487     name: name,
       
   488     icon: 'admin-plugins'
       
   489   }, settings);
       
   490   Object(external_this_wp_hooks_["doAction"])('plugins.pluginRegistered', settings, name);
       
   491   return settings;
       
   492 }
       
   493 /**
       
   494  * Unregisters a plugin by name.
       
   495  *
       
   496  * @param {string} name Plugin name.
       
   497  *
       
   498  * @example <caption>ES5</caption>
       
   499  * ```js
       
   500  * // Using ES5 syntax
       
   501  * var unregisterPlugin = wp.plugins.unregisterPlugin;
       
   502  *
       
   503  * unregisterPlugin( 'plugin-name' );
       
   504  * ```
       
   505  *
       
   506  * @example <caption>ESNext</caption>
       
   507  * ```js
       
   508  * // Using ESNext syntax
       
   509  * const { unregisterPlugin } = wp.plugins;
       
   510  *
       
   511  * unregisterPlugin( 'plugin-name' );
       
   512  * ```
       
   513  *
       
   514  * @return {?WPPlugin} The previous plugin settings object, if it has been
       
   515  *                     successfully unregistered; otherwise `undefined`.
       
   516  */
       
   517 
       
   518 function unregisterPlugin(name) {
       
   519   if (!plugins[name]) {
       
   520     console.error('Plugin "' + name + '" is not registered.');
       
   521     return;
       
   522   }
       
   523 
       
   524   var oldPlugin = plugins[name];
       
   525   delete plugins[name];
       
   526   Object(external_this_wp_hooks_["doAction"])('plugins.pluginUnregistered', oldPlugin, name);
       
   527   return oldPlugin;
       
   528 }
       
   529 /**
       
   530  * Returns a registered plugin settings.
       
   531  *
       
   532  * @param {string} name Plugin name.
       
   533  *
       
   534  * @return {?Object} Plugin setting.
       
   535  */
       
   536 
       
   537 function getPlugin(name) {
       
   538   return plugins[name];
       
   539 }
       
   540 /**
       
   541  * Returns all registered plugins.
       
   542  *
       
   543  * @return {Array} Plugin settings.
       
   544  */
       
   545 
       
   546 function getPlugins() {
       
   547   return Object.values(plugins);
       
   548 }
       
   549 
       
   550 // CONCATENATED MODULE: ./node_modules/@wordpress/plugins/build-module/components/plugin-area/index.js
       
   551 
       
   552 
       
   553 
       
   554 
       
   555 
       
   556 
       
   557 
       
   558 
       
   559 /**
       
   560  * External dependencies
       
   561  */
       
   562 
       
   563 /**
       
   564  * WordPress dependencies
       
   565  */
       
   566 
       
   567 
       
   568 
       
   569 /**
       
   570  * Internal dependencies
       
   571  */
       
   572 
       
   573 
       
   574 
       
   575 /**
       
   576  * A component that renders all plugin fills in a hidden div.
       
   577  *
       
   578  * @example <caption>ES5</caption>
       
   579  * ```js
       
   580  * // Using ES5 syntax
       
   581  * var el = wp.element.createElement;
       
   582  * var PluginArea = wp.plugins.PluginArea;
       
   583  *
       
   584  * function Layout() {
       
   585  * 	return el(
       
   586  * 		'div',
       
   587  * 		{},
       
   588  * 		'Content of the page',
       
   589  * 		PluginArea
       
   590  * 	);
       
   591  * }
       
   592  * ```
       
   593  *
       
   594  * @example <caption>ESNext</caption>
       
   595  * ```js
       
   596  * // Using ESNext syntax
       
   597  * const { PluginArea } = wp.plugins;
       
   598  *
       
   599  * const Layout = () => (
       
   600  * 	<div>
       
   601  * 		Content of the page
       
   602  * 		<PluginArea />
       
   603  * 	</div>
       
   604  * );
       
   605  * ```
       
   606  *
       
   607  * @return {WPElement} Plugin area.
       
   608  */
       
   609 
       
   610 var plugin_area_PluginArea =
       
   611 /*#__PURE__*/
       
   612 function (_Component) {
       
   613   Object(inherits["a" /* default */])(PluginArea, _Component);
       
   614 
       
   615   function PluginArea() {
       
   616     var _this;
       
   617 
       
   618     Object(classCallCheck["a" /* default */])(this, PluginArea);
       
   619 
       
   620     _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PluginArea).apply(this, arguments));
       
   621     _this.setPlugins = _this.setPlugins.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this)));
       
   622     _this.state = _this.getCurrentPluginsState();
       
   623     return _this;
       
   624   }
       
   625 
       
   626   Object(createClass["a" /* default */])(PluginArea, [{
       
   627     key: "getCurrentPluginsState",
       
   628     value: function getCurrentPluginsState() {
       
   629       return {
       
   630         plugins: Object(external_lodash_["map"])(getPlugins(), function (_ref) {
       
   631           var icon = _ref.icon,
       
   632               name = _ref.name,
       
   633               render = _ref.render;
       
   634           return {
       
   635             Plugin: render,
       
   636             context: {
       
   637               name: name,
       
   638               icon: icon
       
   639             }
       
   640           };
       
   641         })
       
   642       };
       
   643     }
       
   644   }, {
       
   645     key: "componentDidMount",
       
   646     value: function componentDidMount() {
       
   647       Object(external_this_wp_hooks_["addAction"])('plugins.pluginRegistered', 'core/plugins/plugin-area/plugins-registered', this.setPlugins);
       
   648       Object(external_this_wp_hooks_["addAction"])('plugins.pluginUnregistered', 'core/plugins/plugin-area/plugins-unregistered', this.setPlugins);
       
   649     }
       
   650   }, {
       
   651     key: "componentWillUnmount",
       
   652     value: function componentWillUnmount() {
       
   653       Object(external_this_wp_hooks_["removeAction"])('plugins.pluginRegistered', 'core/plugins/plugin-area/plugins-registered');
       
   654       Object(external_this_wp_hooks_["removeAction"])('plugins.pluginUnregistered', 'core/plugins/plugin-area/plugins-unregistered');
       
   655     }
       
   656   }, {
       
   657     key: "setPlugins",
       
   658     value: function setPlugins() {
       
   659       this.setState(this.getCurrentPluginsState);
       
   660     }
       
   661   }, {
       
   662     key: "render",
       
   663     value: function render() {
       
   664       return Object(external_this_wp_element_["createElement"])("div", {
       
   665         style: {
       
   666           display: 'none'
       
   667         }
       
   668       }, Object(external_lodash_["map"])(this.state.plugins, function (_ref2) {
       
   669         var context = _ref2.context,
       
   670             Plugin = _ref2.Plugin;
       
   671         return Object(external_this_wp_element_["createElement"])(Provider, {
       
   672           key: context.name,
       
   673           value: context
       
   674         }, Object(external_this_wp_element_["createElement"])(Plugin, null));
       
   675       }));
       
   676     }
       
   677   }]);
       
   678 
       
   679   return PluginArea;
       
   680 }(external_this_wp_element_["Component"]);
       
   681 
       
   682 /* harmony default export */ var plugin_area = (plugin_area_PluginArea);
       
   683 
       
   684 // CONCATENATED MODULE: ./node_modules/@wordpress/plugins/build-module/components/index.js
       
   685 
       
   686 
       
   687 
       
   688 // CONCATENATED MODULE: ./node_modules/@wordpress/plugins/build-module/index.js
       
   689 /* concated harmony reexport PluginArea */__webpack_require__.d(__webpack_exports__, "PluginArea", function() { return plugin_area; });
       
   690 /* concated harmony reexport withPluginContext */__webpack_require__.d(__webpack_exports__, "withPluginContext", function() { return plugin_context_withPluginContext; });
       
   691 /* concated harmony reexport registerPlugin */__webpack_require__.d(__webpack_exports__, "registerPlugin", function() { return registerPlugin; });
       
   692 /* concated harmony reexport unregisterPlugin */__webpack_require__.d(__webpack_exports__, "unregisterPlugin", function() { return unregisterPlugin; });
       
   693 /* concated harmony reexport getPlugin */__webpack_require__.d(__webpack_exports__, "getPlugin", function() { return getPlugin; });
       
   694 /* concated harmony reexport getPlugins */__webpack_require__.d(__webpack_exports__, "getPlugins", function() { return getPlugins; });
       
   695 
       
   696 
       
   697 
       
   698 
       
   699 /***/ }),
       
   700 
       
   701 /***/ 6:
       
   702 /***/ (function(module, exports) {
       
   703 
       
   704 (function() { module.exports = this["wp"]["compose"]; }());
       
   705 
       
   706 /***/ }),
       
   707 
       
   708 /***/ 7:
       
   709 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   710 
       
   711 "use strict";
       
   712 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; });
       
   713 /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
       
   714 
       
   715 function _objectSpread(target) {
       
   716   for (var i = 1; i < arguments.length; i++) {
       
   717     var source = arguments[i] != null ? arguments[i] : {};
       
   718     var ownKeys = Object.keys(source);
       
   719 
       
   720     if (typeof Object.getOwnPropertySymbols === 'function') {
       
   721       ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
       
   722         return Object.getOwnPropertyDescriptor(source, sym).enumerable;
       
   723       }));
       
   724     }
       
   725 
       
   726     ownKeys.forEach(function (key) {
       
   727       Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]);
       
   728     });
       
   729   }
       
   730 
       
   731   return target;
       
   732 }
       
   733 
       
   734 /***/ }),
       
   735 
       
   736 /***/ 9:
       
   737 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   738 
       
   739 "use strict";
       
   740 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
       
   741 function _defineProperties(target, props) {
       
   742   for (var i = 0; i < props.length; i++) {
       
   743     var descriptor = props[i];
       
   744     descriptor.enumerable = descriptor.enumerable || false;
       
   745     descriptor.configurable = true;
       
   746     if ("value" in descriptor) descriptor.writable = true;
       
   747     Object.defineProperty(target, descriptor.key, descriptor);
       
   748   }
       
   749 }
       
   750 
       
   751 function _createClass(Constructor, protoProps, staticProps) {
       
   752   if (protoProps) _defineProperties(Constructor.prototype, protoProps);
       
   753   if (staticProps) _defineProperties(Constructor, staticProps);
       
   754   return Constructor;
       
   755 }
       
   756 
       
   757 /***/ })
       
   758 
       
   759 /******/ });