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