[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> plugins.js (source)

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


Generated: Tue Dec 1 01:00:04 2020 Cross-referenced by PHPXref 0.7.1