[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 /******/ (function() { // webpackBootstrap 2 /******/ var __webpack_modules__ = ({ 3 4 /***/ 9756: 5 /***/ (function(module) { 6 7 /** 8 * Memize options object. 9 * 10 * @typedef MemizeOptions 11 * 12 * @property {number} [maxSize] Maximum size of the cache. 13 */ 14 15 /** 16 * Internal cache entry. 17 * 18 * @typedef MemizeCacheNode 19 * 20 * @property {?MemizeCacheNode|undefined} [prev] Previous node. 21 * @property {?MemizeCacheNode|undefined} [next] Next node. 22 * @property {Array<*>} args Function arguments for cache 23 * entry. 24 * @property {*} val Function result. 25 */ 26 27 /** 28 * Properties of the enhanced function for controlling cache. 29 * 30 * @typedef MemizeMemoizedFunction 31 * 32 * @property {()=>void} clear Clear the cache. 33 */ 34 35 /** 36 * Accepts a function to be memoized, and returns a new memoized function, with 37 * optional options. 38 * 39 * @template {Function} F 40 * 41 * @param {F} fn Function to memoize. 42 * @param {MemizeOptions} [options] Options object. 43 * 44 * @return {F & MemizeMemoizedFunction} Memoized function. 45 */ 46 function memize( fn, options ) { 47 var size = 0; 48 49 /** @type {?MemizeCacheNode|undefined} */ 50 var head; 51 52 /** @type {?MemizeCacheNode|undefined} */ 53 var tail; 54 55 options = options || {}; 56 57 function memoized( /* ...args */ ) { 58 var node = head, 59 len = arguments.length, 60 args, i; 61 62 searchCache: while ( node ) { 63 // Perform a shallow equality test to confirm that whether the node 64 // under test is a candidate for the arguments passed. Two arrays 65 // are shallowly equal if their length matches and each entry is 66 // strictly equal between the two sets. Avoid abstracting to a 67 // function which could incur an arguments leaking deoptimization. 68 69 // Check whether node arguments match arguments length 70 if ( node.args.length !== arguments.length ) { 71 node = node.next; 72 continue; 73 } 74 75 // Check whether node arguments match arguments values 76 for ( i = 0; i < len; i++ ) { 77 if ( node.args[ i ] !== arguments[ i ] ) { 78 node = node.next; 79 continue searchCache; 80 } 81 } 82 83 // At this point we can assume we've found a match 84 85 // Surface matched node to head if not already 86 if ( node !== head ) { 87 // As tail, shift to previous. Must only shift if not also 88 // head, since if both head and tail, there is no previous. 89 if ( node === tail ) { 90 tail = node.prev; 91 } 92 93 // Adjust siblings to point to each other. If node was tail, 94 // this also handles new tail's empty `next` assignment. 95 /** @type {MemizeCacheNode} */ ( node.prev ).next = node.next; 96 if ( node.next ) { 97 node.next.prev = node.prev; 98 } 99 100 node.next = head; 101 node.prev = null; 102 /** @type {MemizeCacheNode} */ ( head ).prev = node; 103 head = node; 104 } 105 106 // Return immediately 107 return node.val; 108 } 109 110 // No cached value found. Continue to insertion phase: 111 112 // Create a copy of arguments (avoid leaking deoptimization) 113 args = new Array( len ); 114 for ( i = 0; i < len; i++ ) { 115 args[ i ] = arguments[ i ]; 116 } 117 118 node = { 119 args: args, 120 121 // Generate the result from original function 122 val: fn.apply( null, args ), 123 }; 124 125 // Don't need to check whether node is already head, since it would 126 // have been returned above already if it was 127 128 // Shift existing head down list 129 if ( head ) { 130 head.prev = node; 131 node.next = head; 132 } else { 133 // If no head, follows that there's no tail (at initial or reset) 134 tail = node; 135 } 136 137 // Trim tail if we're reached max size and are pending cache insertion 138 if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) { 139 tail = /** @type {MemizeCacheNode} */ ( tail ).prev; 140 /** @type {MemizeCacheNode} */ ( tail ).next = null; 141 } else { 142 size++; 143 } 144 145 head = node; 146 147 return node.val; 148 } 149 150 memoized.clear = function() { 151 head = null; 152 tail = null; 153 size = 0; 154 }; 155 156 if ( false ) {} 157 158 // Ignore reason: There's not a clear solution to create an intersection of 159 // the function with additional properties, where the goal is to retain the 160 // function signature of the incoming argument and add control properties 161 // on the return value. 162 163 // @ts-ignore 164 return memoized; 165 } 166 167 module.exports = memize; 168 169 170 /***/ }) 171 172 /******/ }); 173 /************************************************************************/ 174 /******/ // The module cache 175 /******/ var __webpack_module_cache__ = {}; 176 /******/ 177 /******/ // The require function 178 /******/ function __webpack_require__(moduleId) { 179 /******/ // Check if module is in cache 180 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 181 /******/ if (cachedModule !== undefined) { 182 /******/ return cachedModule.exports; 183 /******/ } 184 /******/ // Create a new module (and put it into the cache) 185 /******/ var module = __webpack_module_cache__[moduleId] = { 186 /******/ // no module.id needed 187 /******/ // no module.loaded needed 188 /******/ exports: {} 189 /******/ }; 190 /******/ 191 /******/ // Execute the module function 192 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 193 /******/ 194 /******/ // Return the exports of the module 195 /******/ return module.exports; 196 /******/ } 197 /******/ 198 /************************************************************************/ 199 /******/ /* webpack/runtime/compat get default export */ 200 /******/ !function() { 201 /******/ // getDefaultExport function for compatibility with non-harmony modules 202 /******/ __webpack_require__.n = function(module) { 203 /******/ var getter = module && module.__esModule ? 204 /******/ function() { return module['default']; } : 205 /******/ function() { return module; }; 206 /******/ __webpack_require__.d(getter, { a: getter }); 207 /******/ return getter; 208 /******/ }; 209 /******/ }(); 210 /******/ 211 /******/ /* webpack/runtime/define property getters */ 212 /******/ !function() { 213 /******/ // define getter functions for harmony exports 214 /******/ __webpack_require__.d = function(exports, definition) { 215 /******/ for(var key in definition) { 216 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 217 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 218 /******/ } 219 /******/ } 220 /******/ }; 221 /******/ }(); 222 /******/ 223 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 224 /******/ !function() { 225 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } 226 /******/ }(); 227 /******/ 228 /******/ /* webpack/runtime/make namespace object */ 229 /******/ !function() { 230 /******/ // define __esModule on exports 231 /******/ __webpack_require__.r = function(exports) { 232 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 233 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 234 /******/ } 235 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 236 /******/ }; 237 /******/ }(); 238 /******/ 239 /************************************************************************/ 240 var __webpack_exports__ = {}; 241 // This entry need to be wrapped in an IIFE because it need to be in strict mode. 242 !function() { 243 "use strict"; 244 // ESM COMPAT FLAG 245 __webpack_require__.r(__webpack_exports__); 246 247 // EXPORTS 248 __webpack_require__.d(__webpack_exports__, { 249 "PluginArea": function() { return /* reexport */ plugin_area; }, 250 "getPlugin": function() { return /* reexport */ getPlugin; }, 251 "getPlugins": function() { return /* reexport */ getPlugins; }, 252 "registerPlugin": function() { return /* reexport */ registerPlugin; }, 253 "unregisterPlugin": function() { return /* reexport */ unregisterPlugin; }, 254 "withPluginContext": function() { return /* reexport */ withPluginContext; } 255 }); 256 257 ;// CONCATENATED MODULE: external ["wp","element"] 258 var external_wp_element_namespaceObject = window["wp"]["element"]; 259 ;// CONCATENATED MODULE: external "lodash" 260 var external_lodash_namespaceObject = window["lodash"]; 261 // EXTERNAL MODULE: ./node_modules/memize/index.js 262 var memize = __webpack_require__(9756); 263 var memize_default = /*#__PURE__*/__webpack_require__.n(memize); 264 ;// CONCATENATED MODULE: external ["wp","hooks"] 265 var external_wp_hooks_namespaceObject = window["wp"]["hooks"]; 266 ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js 267 function _extends() { 268 _extends = Object.assign || function (target) { 269 for (var i = 1; i < arguments.length; i++) { 270 var source = arguments[i]; 271 272 for (var key in source) { 273 if (Object.prototype.hasOwnProperty.call(source, key)) { 274 target[key] = source[key]; 275 } 276 } 277 } 278 279 return target; 280 }; 281 282 return _extends.apply(this, arguments); 283 } 284 ;// CONCATENATED MODULE: external ["wp","compose"] 285 var external_wp_compose_namespaceObject = window["wp"]["compose"]; 286 ;// CONCATENATED MODULE: ./node_modules/@wordpress/plugins/build-module/components/plugin-context/index.js 287 288 289 290 /** 291 * WordPress dependencies 292 */ 293 294 295 const { 296 Consumer, 297 Provider 298 } = (0,external_wp_element_namespaceObject.createContext)({ 299 name: null, 300 icon: null 301 }); 302 303 /** 304 * A Higher Order Component used to inject Plugin context to the 305 * wrapped component. 306 * 307 * @param {Function} mapContextToProps Function called on every context change, 308 * expected to return object of props to 309 * merge with the component's own props. 310 * 311 * @return {WPComponent} Enhanced component with injected context as props. 312 */ 313 314 const withPluginContext = mapContextToProps => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(OriginalComponent => { 315 return props => (0,external_wp_element_namespaceObject.createElement)(Consumer, null, context => (0,external_wp_element_namespaceObject.createElement)(OriginalComponent, _extends({}, props, mapContextToProps(context, props)))); 316 }, 'withPluginContext'); 317 318 ;// CONCATENATED MODULE: ./node_modules/@wordpress/plugins/build-module/components/plugin-error-boundary/index.js 319 /** 320 * WordPress dependencies 321 */ 322 323 class PluginErrorBoundary extends external_wp_element_namespaceObject.Component { 324 constructor(props) { 325 super(props); 326 this.state = { 327 hasError: false 328 }; 329 } 330 331 static getDerivedStateFromError() { 332 return { 333 hasError: true 334 }; 335 } 336 337 componentDidCatch(error) { 338 const { 339 name, 340 onError 341 } = this.props; 342 343 if (onError) { 344 onError(name, error); 345 } 346 } 347 348 render() { 349 if (!this.state.hasError) { 350 return this.props.children; 351 } 352 353 return null; 354 } 355 356 } 357 358 ;// CONCATENATED MODULE: external ["wp","primitives"] 359 var external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 360 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plugins.js 361 362 363 /** 364 * WordPress dependencies 365 */ 366 367 const plugins = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 368 xmlns: "http://www.w3.org/2000/svg", 369 viewBox: "0 0 24 24" 370 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 371 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" 372 })); 373 /* harmony default export */ var library_plugins = (plugins); 374 375 ;// CONCATENATED MODULE: ./node_modules/@wordpress/plugins/build-module/api/index.js 376 /* eslint no-console: [ 'error', { allow: [ 'error' ] } ] */ 377 378 /** 379 * WordPress dependencies 380 */ 381 382 383 /** 384 * External dependencies 385 */ 386 387 388 /** 389 * Defined behavior of a plugin type. 390 * 391 * @typedef {Object} WPPlugin 392 * 393 * @property {string} name A string identifying the plugin. Must be 394 * unique across all registered plugins. 395 * @property {string|WPElement|Function} [icon] An icon to be shown in the UI. It can 396 * be a slug of the Dashicon, or an element 397 * (or function returning an element) if you 398 * choose to render your own SVG. 399 * @property {Function} render A component containing the UI elements 400 * to be rendered. 401 * @property {string} [scope] The optional scope to be used when rendering inside 402 * a plugin area. No scope by default. 403 */ 404 405 /** 406 * Plugin definitions keyed by plugin name. 407 * 408 * @type {Object.<string,WPPlugin>} 409 */ 410 411 const api_plugins = {}; 412 /** 413 * Registers a plugin to the editor. 414 * 415 * @param {string} name A string identifying the plugin.Must be 416 * unique across all registered plugins. 417 * @param {WPPlugin} settings The settings for this plugin. 418 * 419 * @example 420 * ```js 421 * // Using ES5 syntax 422 * var el = wp.element.createElement; 423 * var Fragment = wp.element.Fragment; 424 * var PluginSidebar = wp.editPost.PluginSidebar; 425 * var PluginSidebarMoreMenuItem = wp.editPost.PluginSidebarMoreMenuItem; 426 * var registerPlugin = wp.plugins.registerPlugin; 427 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. 428 * 429 * function Component() { 430 * return el( 431 * Fragment, 432 * {}, 433 * el( 434 * PluginSidebarMoreMenuItem, 435 * { 436 * target: 'sidebar-name', 437 * }, 438 * 'My Sidebar' 439 * ), 440 * el( 441 * PluginSidebar, 442 * { 443 * name: 'sidebar-name', 444 * title: 'My Sidebar', 445 * }, 446 * 'Content of the sidebar' 447 * ) 448 * ); 449 * } 450 * registerPlugin( 'plugin-name', { 451 * icon: moreIcon, 452 * render: Component, 453 * scope: 'my-page', 454 * } ); 455 * ``` 456 * 457 * @example 458 * ```js 459 * // Using ESNext syntax 460 * import { PluginSidebar, PluginSidebarMoreMenuItem } from '@wordpress/edit-post'; 461 * import { registerPlugin } from '@wordpress/plugins'; 462 * import { more } from '@wordpress/icons'; 463 * 464 * const Component = () => ( 465 * <> 466 * <PluginSidebarMoreMenuItem 467 * target="sidebar-name" 468 * > 469 * My Sidebar 470 * </PluginSidebarMoreMenuItem> 471 * <PluginSidebar 472 * name="sidebar-name" 473 * title="My Sidebar" 474 * > 475 * Content of the sidebar 476 * </PluginSidebar> 477 * </> 478 * ); 479 * 480 * registerPlugin( 'plugin-name', { 481 * icon: more, 482 * render: Component, 483 * scope: 'my-page', 484 * } ); 485 * ``` 486 * 487 * @return {WPPlugin} The final plugin settings object. 488 */ 489 490 function registerPlugin(name, settings) { 491 if (typeof settings !== 'object') { 492 console.error('No settings object provided!'); 493 return null; 494 } 495 496 if (typeof name !== 'string') { 497 console.error('Plugin name must be string.'); 498 return null; 499 } 500 501 if (!/^[a-z][a-z0-9-]*$/.test(name)) { 502 console.error('Plugin name must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-plugin".'); 503 return null; 504 } 505 506 if (api_plugins[name]) { 507 console.error(`Plugin "$name}" is already registered.`); 508 } 509 510 settings = (0,external_wp_hooks_namespaceObject.applyFilters)('plugins.registerPlugin', settings, name); 511 const { 512 render, 513 scope 514 } = settings; 515 516 if (!(0,external_lodash_namespaceObject.isFunction)(render)) { 517 console.error('The "render" property must be specified and must be a valid function.'); 518 return null; 519 } 520 521 if (scope) { 522 if (typeof scope !== 'string') { 523 console.error('Plugin scope must be string.'); 524 return null; 525 } 526 527 if (!/^[a-z][a-z0-9-]*$/.test(scope)) { 528 console.error('Plugin scope must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-page".'); 529 return null; 530 } 531 } 532 533 api_plugins[name] = { 534 name, 535 icon: library_plugins, 536 ...settings 537 }; 538 (0,external_wp_hooks_namespaceObject.doAction)('plugins.pluginRegistered', settings, name); 539 return settings; 540 } 541 /** 542 * Unregisters a plugin by name. 543 * 544 * @param {string} name Plugin name. 545 * 546 * @example 547 * ```js 548 * // Using ES5 syntax 549 * var unregisterPlugin = wp.plugins.unregisterPlugin; 550 * 551 * unregisterPlugin( 'plugin-name' ); 552 * ``` 553 * 554 * @example 555 * ```js 556 * // Using ESNext syntax 557 * import { unregisterPlugin } from '@wordpress/plugins'; 558 * 559 * unregisterPlugin( 'plugin-name' ); 560 * ``` 561 * 562 * @return {?WPPlugin} The previous plugin settings object, if it has been 563 * successfully unregistered; otherwise `undefined`. 564 */ 565 566 function unregisterPlugin(name) { 567 if (!api_plugins[name]) { 568 console.error('Plugin "' + name + '" is not registered.'); 569 return; 570 } 571 572 const oldPlugin = api_plugins[name]; 573 delete api_plugins[name]; 574 (0,external_wp_hooks_namespaceObject.doAction)('plugins.pluginUnregistered', oldPlugin, name); 575 return oldPlugin; 576 } 577 /** 578 * Returns a registered plugin settings. 579 * 580 * @param {string} name Plugin name. 581 * 582 * @return {?WPPlugin} Plugin setting. 583 */ 584 585 function getPlugin(name) { 586 return api_plugins[name]; 587 } 588 /** 589 * Returns all registered plugins without a scope or for a given scope. 590 * 591 * @param {string} [scope] The scope to be used when rendering inside 592 * a plugin area. No scope by default. 593 * 594 * @return {WPPlugin[]} The list of plugins without a scope or for a given scope. 595 */ 596 597 function getPlugins(scope) { 598 return Object.values(api_plugins).filter(plugin => plugin.scope === scope); 599 } 600 601 ;// CONCATENATED MODULE: ./node_modules/@wordpress/plugins/build-module/components/plugin-area/index.js 602 603 604 /** 605 * External dependencies 606 */ 607 608 609 /** 610 * WordPress dependencies 611 */ 612 613 614 615 /** 616 * Internal dependencies 617 */ 618 619 620 621 622 /** 623 * A component that renders all plugin fills in a hidden div. 624 * 625 * @example 626 * ```js 627 * // Using ES5 syntax 628 * var el = wp.element.createElement; 629 * var PluginArea = wp.plugins.PluginArea; 630 * 631 * function Layout() { 632 * return el( 633 * 'div', 634 * { scope: 'my-page' }, 635 * 'Content of the page', 636 * PluginArea 637 * ); 638 * } 639 * ``` 640 * 641 * @example 642 * ```js 643 * // Using ESNext syntax 644 * import { PluginArea } from '@wordpress/plugins'; 645 * 646 * const Layout = () => ( 647 * <div> 648 * Content of the page 649 * <PluginArea scope="my-page" /> 650 * </div> 651 * ); 652 * ``` 653 * 654 * @return {WPComponent} The component to be rendered. 655 */ 656 657 class PluginArea extends external_wp_element_namespaceObject.Component { 658 constructor() { 659 super(...arguments); 660 this.setPlugins = this.setPlugins.bind(this); 661 this.memoizedContext = memize_default()((name, icon) => { 662 return { 663 name, 664 icon 665 }; 666 }); 667 this.state = this.getCurrentPluginsState(); 668 } 669 670 getCurrentPluginsState() { 671 return { 672 plugins: (0,external_lodash_namespaceObject.map)(getPlugins(this.props.scope), _ref => { 673 let { 674 icon, 675 name, 676 render 677 } = _ref; 678 return { 679 Plugin: render, 680 context: this.memoizedContext(name, icon) 681 }; 682 }) 683 }; 684 } 685 686 componentDidMount() { 687 (0,external_wp_hooks_namespaceObject.addAction)('plugins.pluginRegistered', 'core/plugins/plugin-area/plugins-registered', this.setPlugins); 688 (0,external_wp_hooks_namespaceObject.addAction)('plugins.pluginUnregistered', 'core/plugins/plugin-area/plugins-unregistered', this.setPlugins); 689 } 690 691 componentWillUnmount() { 692 (0,external_wp_hooks_namespaceObject.removeAction)('plugins.pluginRegistered', 'core/plugins/plugin-area/plugins-registered'); 693 (0,external_wp_hooks_namespaceObject.removeAction)('plugins.pluginUnregistered', 'core/plugins/plugin-area/plugins-unregistered'); 694 } 695 696 setPlugins() { 697 this.setState(this.getCurrentPluginsState); 698 } 699 700 render() { 701 return (0,external_wp_element_namespaceObject.createElement)("div", { 702 style: { 703 display: 'none' 704 } 705 }, (0,external_lodash_namespaceObject.map)(this.state.plugins, _ref2 => { 706 let { 707 context, 708 Plugin 709 } = _ref2; 710 return (0,external_wp_element_namespaceObject.createElement)(Provider, { 711 key: context.name, 712 value: context 713 }, (0,external_wp_element_namespaceObject.createElement)(PluginErrorBoundary, { 714 name: context.name, 715 onError: this.props.onError 716 }, (0,external_wp_element_namespaceObject.createElement)(Plugin, null))); 717 })); 718 } 719 720 } 721 722 /* harmony default export */ var plugin_area = (PluginArea); 723 724 ;// CONCATENATED MODULE: ./node_modules/@wordpress/plugins/build-module/components/index.js 725 726 727 728 ;// CONCATENATED MODULE: ./node_modules/@wordpress/plugins/build-module/index.js 729 730 731 732 }(); 733 (window.wp = window.wp || {}).plugins = __webpack_exports__; 734 /******/ })() 735 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Dec 5 01:00:03 2024 | Cross-referenced by PHPXref 0.7.1 |