[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

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


Generated : Sun Mar 7 08:20:02 2021 Cross-referenced by PHPXref