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