| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 "use strict"; 2 var wp; 3 (wp ||= {}).plugins = (() => { 4 var __create = Object.create; 5 var __defProp = Object.defineProperty; 6 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 7 var __getOwnPropNames = Object.getOwnPropertyNames; 8 var __getProtoOf = Object.getPrototypeOf; 9 var __hasOwnProp = Object.prototype.hasOwnProperty; 10 var __commonJS = (cb, mod) => function __require() { 11 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 12 }; 13 var __export = (target, all) => { 14 for (var name in all) 15 __defProp(target, name, { get: all[name], enumerable: true }); 16 }; 17 var __copyProps = (to, from, except, desc) => { 18 if (from && typeof from === "object" || typeof from === "function") { 19 for (let key of __getOwnPropNames(from)) 20 if (!__hasOwnProp.call(to, key) && key !== except) 21 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 22 } 23 return to; 24 }; 25 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 26 // If the importer is in node compatibility mode or this is not an ESM 27 // file that has been converted to a CommonJS file using a Babel- 28 // compatible transform (i.e. "__esModule" has not been set), then set 29 // "default" to the CommonJS "module.exports" for node compatibility. 30 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 31 mod 32 )); 33 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 34 35 // package-external:@wordpress/element 36 var require_element = __commonJS({ 37 "package-external:@wordpress/element"(exports, module) { 38 module.exports = window.wp.element; 39 } 40 }); 41 42 // package-external:@wordpress/hooks 43 var require_hooks = __commonJS({ 44 "package-external:@wordpress/hooks"(exports, module) { 45 module.exports = window.wp.hooks; 46 } 47 }); 48 49 // package-external:@wordpress/is-shallow-equal 50 var require_is_shallow_equal = __commonJS({ 51 "package-external:@wordpress/is-shallow-equal"(exports, module) { 52 module.exports = window.wp.isShallowEqual; 53 } 54 }); 55 56 // package-external:@wordpress/compose 57 var require_compose = __commonJS({ 58 "package-external:@wordpress/compose"(exports, module) { 59 module.exports = window.wp.compose; 60 } 61 }); 62 63 // package-external:@wordpress/deprecated 64 var require_deprecated = __commonJS({ 65 "package-external:@wordpress/deprecated"(exports, module) { 66 module.exports = window.wp.deprecated; 67 } 68 }); 69 70 // vendor-external:react/jsx-runtime 71 var require_jsx_runtime = __commonJS({ 72 "vendor-external:react/jsx-runtime"(exports, module) { 73 module.exports = window.ReactJSXRuntime; 74 } 75 }); 76 77 // packages/plugins/node_modules/react-is/cjs/react-is.development.js 78 var require_react_is_development = __commonJS({ 79 "packages/plugins/node_modules/react-is/cjs/react-is.development.js"(exports) { 80 "use strict"; 81 if (true) { 82 (function() { 83 "use strict"; 84 var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element"); 85 var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"); 86 var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"); 87 var REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"); 88 var REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"); 89 var REACT_PROVIDER_TYPE = /* @__PURE__ */ Symbol.for("react.provider"); 90 var REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"); 91 var REACT_SERVER_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.server_context"); 92 var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"); 93 var REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"); 94 var REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"); 95 var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"); 96 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); 97 var REACT_OFFSCREEN_TYPE = /* @__PURE__ */ Symbol.for("react.offscreen"); 98 var enableScopeAPI = false; 99 var enableCacheElement = false; 100 var enableTransitionTracing = false; 101 var enableLegacyHidden = false; 102 var enableDebugTracing = false; 103 var REACT_MODULE_REFERENCE; 104 { 105 REACT_MODULE_REFERENCE = /* @__PURE__ */ Symbol.for("react.module.reference"); 106 } 107 function isValidElementType2(type) { 108 if (typeof type === "string" || typeof type === "function") { 109 return true; 110 } 111 if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) { 112 return true; 113 } 114 if (typeof type === "object" && type !== null) { 115 if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object 116 // types supported by any Flight configuration anywhere since 117 // we don't know which Flight build this will end up being used 118 // with. 119 type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) { 120 return true; 121 } 122 } 123 return false; 124 } 125 function typeOf(object) { 126 if (typeof object === "object" && object !== null) { 127 var $$typeof = object.$$typeof; 128 switch ($$typeof) { 129 case REACT_ELEMENT_TYPE: 130 var type = object.type; 131 switch (type) { 132 case REACT_FRAGMENT_TYPE: 133 case REACT_PROFILER_TYPE: 134 case REACT_STRICT_MODE_TYPE: 135 case REACT_SUSPENSE_TYPE: 136 case REACT_SUSPENSE_LIST_TYPE: 137 return type; 138 default: 139 var $$typeofType = type && type.$$typeof; 140 switch ($$typeofType) { 141 case REACT_SERVER_CONTEXT_TYPE: 142 case REACT_CONTEXT_TYPE: 143 case REACT_FORWARD_REF_TYPE: 144 case REACT_LAZY_TYPE: 145 case REACT_MEMO_TYPE: 146 case REACT_PROVIDER_TYPE: 147 return $$typeofType; 148 default: 149 return $$typeof; 150 } 151 } 152 case REACT_PORTAL_TYPE: 153 return $$typeof; 154 } 155 } 156 return void 0; 157 } 158 var ContextConsumer = REACT_CONTEXT_TYPE; 159 var ContextProvider = REACT_PROVIDER_TYPE; 160 var Element = REACT_ELEMENT_TYPE; 161 var ForwardRef = REACT_FORWARD_REF_TYPE; 162 var Fragment = REACT_FRAGMENT_TYPE; 163 var Lazy = REACT_LAZY_TYPE; 164 var Memo = REACT_MEMO_TYPE; 165 var Portal = REACT_PORTAL_TYPE; 166 var Profiler = REACT_PROFILER_TYPE; 167 var StrictMode = REACT_STRICT_MODE_TYPE; 168 var Suspense = REACT_SUSPENSE_TYPE; 169 var SuspenseList = REACT_SUSPENSE_LIST_TYPE; 170 var hasWarnedAboutDeprecatedIsAsyncMode = false; 171 var hasWarnedAboutDeprecatedIsConcurrentMode = false; 172 function isAsyncMode(object) { 173 { 174 if (!hasWarnedAboutDeprecatedIsAsyncMode) { 175 hasWarnedAboutDeprecatedIsAsyncMode = true; 176 console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+."); 177 } 178 } 179 return false; 180 } 181 function isConcurrentMode(object) { 182 { 183 if (!hasWarnedAboutDeprecatedIsConcurrentMode) { 184 hasWarnedAboutDeprecatedIsConcurrentMode = true; 185 console["warn"]("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+."); 186 } 187 } 188 return false; 189 } 190 function isContextConsumer(object) { 191 return typeOf(object) === REACT_CONTEXT_TYPE; 192 } 193 function isContextProvider(object) { 194 return typeOf(object) === REACT_PROVIDER_TYPE; 195 } 196 function isElement(object) { 197 return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; 198 } 199 function isForwardRef(object) { 200 return typeOf(object) === REACT_FORWARD_REF_TYPE; 201 } 202 function isFragment(object) { 203 return typeOf(object) === REACT_FRAGMENT_TYPE; 204 } 205 function isLazy(object) { 206 return typeOf(object) === REACT_LAZY_TYPE; 207 } 208 function isMemo(object) { 209 return typeOf(object) === REACT_MEMO_TYPE; 210 } 211 function isPortal(object) { 212 return typeOf(object) === REACT_PORTAL_TYPE; 213 } 214 function isProfiler(object) { 215 return typeOf(object) === REACT_PROFILER_TYPE; 216 } 217 function isStrictMode(object) { 218 return typeOf(object) === REACT_STRICT_MODE_TYPE; 219 } 220 function isSuspense(object) { 221 return typeOf(object) === REACT_SUSPENSE_TYPE; 222 } 223 function isSuspenseList(object) { 224 return typeOf(object) === REACT_SUSPENSE_LIST_TYPE; 225 } 226 exports.ContextConsumer = ContextConsumer; 227 exports.ContextProvider = ContextProvider; 228 exports.Element = Element; 229 exports.ForwardRef = ForwardRef; 230 exports.Fragment = Fragment; 231 exports.Lazy = Lazy; 232 exports.Memo = Memo; 233 exports.Portal = Portal; 234 exports.Profiler = Profiler; 235 exports.StrictMode = StrictMode; 236 exports.Suspense = Suspense; 237 exports.SuspenseList = SuspenseList; 238 exports.isAsyncMode = isAsyncMode; 239 exports.isConcurrentMode = isConcurrentMode; 240 exports.isContextConsumer = isContextConsumer; 241 exports.isContextProvider = isContextProvider; 242 exports.isElement = isElement; 243 exports.isForwardRef = isForwardRef; 244 exports.isFragment = isFragment; 245 exports.isLazy = isLazy; 246 exports.isMemo = isMemo; 247 exports.isPortal = isPortal; 248 exports.isProfiler = isProfiler; 249 exports.isStrictMode = isStrictMode; 250 exports.isSuspense = isSuspense; 251 exports.isSuspenseList = isSuspenseList; 252 exports.isValidElementType = isValidElementType2; 253 exports.typeOf = typeOf; 254 })(); 255 } 256 } 257 }); 258 259 // packages/plugins/node_modules/react-is/index.js 260 var require_react_is = __commonJS({ 261 "packages/plugins/node_modules/react-is/index.js"(exports, module) { 262 "use strict"; 263 if (false) { 264 module.exports = null; 265 } else { 266 module.exports = require_react_is_development(); 267 } 268 } 269 }); 270 271 // package-external:@wordpress/primitives 272 var require_primitives = __commonJS({ 273 "package-external:@wordpress/primitives"(exports, module) { 274 module.exports = window.wp.primitives; 275 } 276 }); 277 278 // packages/plugins/build-module/index.mjs 279 var index_exports = {}; 280 __export(index_exports, { 281 PluginArea: () => plugin_area_default, 282 getPlugin: () => getPlugin, 283 getPlugins: () => getPlugins, 284 registerPlugin: () => registerPlugin, 285 unregisterPlugin: () => unregisterPlugin, 286 usePluginContext: () => usePluginContext, 287 withPluginContext: () => withPluginContext 288 }); 289 290 // node_modules/memize/dist/index.js 291 function memize(fn, options) { 292 var size = 0; 293 var head; 294 var tail; 295 options = options || {}; 296 function memoized() { 297 var node = head, len = arguments.length, args, i; 298 searchCache: while (node) { 299 if (node.args.length !== arguments.length) { 300 node = node.next; 301 continue; 302 } 303 for (i = 0; i < len; i++) { 304 if (node.args[i] !== arguments[i]) { 305 node = node.next; 306 continue searchCache; 307 } 308 } 309 if (node !== head) { 310 if (node === tail) { 311 tail = node.prev; 312 } 313 node.prev.next = node.next; 314 if (node.next) { 315 node.next.prev = node.prev; 316 } 317 node.next = head; 318 node.prev = null; 319 head.prev = node; 320 head = node; 321 } 322 return node.val; 323 } 324 args = new Array(len); 325 for (i = 0; i < len; i++) { 326 args[i] = arguments[i]; 327 } 328 node = { 329 args, 330 // Generate the result from original function 331 val: fn.apply(null, args) 332 }; 333 if (head) { 334 head.prev = node; 335 node.next = head; 336 } else { 337 tail = node; 338 } 339 if (size === /** @type {MemizeOptions} */ 340 options.maxSize) { 341 tail = /** @type {MemizeCacheNode} */ 342 tail.prev; 343 tail.next = null; 344 } else { 345 size++; 346 } 347 head = node; 348 return node.val; 349 } 350 memoized.clear = function() { 351 head = null; 352 tail = null; 353 size = 0; 354 }; 355 return memoized; 356 } 357 358 // packages/plugins/build-module/components/plugin-area/index.mjs 359 var import_element3 = __toESM(require_element(), 1); 360 var import_hooks2 = __toESM(require_hooks(), 1); 361 var import_is_shallow_equal = __toESM(require_is_shallow_equal(), 1); 362 363 // packages/plugins/build-module/components/plugin-context/index.mjs 364 var import_element = __toESM(require_element(), 1); 365 var import_compose = __toESM(require_compose(), 1); 366 var import_deprecated = __toESM(require_deprecated(), 1); 367 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 368 var Context = (0, import_element.createContext)({ 369 name: null, 370 icon: null 371 }); 372 Context.displayName = "PluginContext"; 373 var PluginContextProvider = Context.Provider; 374 function usePluginContext() { 375 return (0, import_element.useContext)(Context); 376 } 377 var withPluginContext = (mapContextToProps) => (0, import_compose.createHigherOrderComponent)((OriginalComponent) => { 378 (0, import_deprecated.default)("wp.plugins.withPluginContext", { 379 since: "6.8.0", 380 alternative: "wp.plugins.usePluginContext" 381 }); 382 return (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Consumer, { children: (context) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)( 383 OriginalComponent, 384 { 385 ...props, 386 ...mapContextToProps(context, props) 387 } 388 ) }); 389 }, "withPluginContext"); 390 391 // packages/plugins/build-module/components/plugin-error-boundary/index.mjs 392 var import_element2 = __toESM(require_element(), 1); 393 var PluginErrorBoundary = class extends import_element2.Component { 394 constructor(props) { 395 super(props); 396 this.state = { 397 hasError: false 398 }; 399 } 400 static getDerivedStateFromError() { 401 return { hasError: true }; 402 } 403 componentDidCatch(error) { 404 const { name, onError } = this.props; 405 if (onError) { 406 onError(name, error); 407 } 408 } 409 render() { 410 if (!this.state.hasError) { 411 return this.props.children; 412 } 413 return null; 414 } 415 }; 416 417 // packages/plugins/build-module/api/index.mjs 418 var import_react_is = __toESM(require_react_is(), 1); 419 var import_hooks = __toESM(require_hooks(), 1); 420 421 // packages/icons/build-module/library/plugins.mjs 422 var import_primitives = __toESM(require_primitives(), 1); 423 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 424 var plugins_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.Path, { 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" }) }); 425 426 // packages/plugins/build-module/api/index.mjs 427 var plugins = {}; 428 function registerPlugin(name, settings) { 429 if (typeof settings !== "object") { 430 console.error("No settings object provided!"); 431 return null; 432 } 433 if (typeof name !== "string") { 434 console.error("Plugin name must be string."); 435 return null; 436 } 437 if (!/^[a-z][a-z0-9-]*$/.test(name)) { 438 console.error( 439 'Plugin name must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-plugin".' 440 ); 441 return null; 442 } 443 if (plugins[name]) { 444 console.error(`Plugin "$name}" is already registered.`); 445 } 446 settings = (0, import_hooks.applyFilters)( 447 "plugins.registerPlugin", 448 settings, 449 name 450 ); 451 const { render, scope } = settings; 452 if (!(0, import_react_is.isValidElementType)(render)) { 453 console.error( 454 'The "render" property must be specified and must be a valid component.' 455 ); 456 return null; 457 } 458 if (scope) { 459 if (typeof scope !== "string") { 460 console.error("Plugin scope must be string."); 461 return null; 462 } 463 if (!/^[a-z][a-z0-9-]*$/.test(scope)) { 464 console.error( 465 'Plugin scope must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-page".' 466 ); 467 return null; 468 } 469 } 470 plugins[name] = { 471 name, 472 icon: plugins_default, 473 ...settings 474 }; 475 (0, import_hooks.doAction)("plugins.pluginRegistered", settings, name); 476 return settings; 477 } 478 function unregisterPlugin(name) { 479 if (!plugins[name]) { 480 console.error('Plugin "' + name + '" is not registered.'); 481 return; 482 } 483 const oldPlugin = plugins[name]; 484 delete plugins[name]; 485 (0, import_hooks.doAction)("plugins.pluginUnregistered", oldPlugin, name); 486 return oldPlugin; 487 } 488 function getPlugin(name) { 489 return plugins[name]; 490 } 491 function getPlugins(scope) { 492 return Object.values(plugins).filter( 493 (plugin) => plugin.scope === scope 494 ); 495 } 496 497 // packages/plugins/build-module/components/plugin-area/index.mjs 498 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 499 var getPluginContext = memize( 500 (icon, name) => ({ 501 icon, 502 name 503 }) 504 ); 505 function PluginArea({ 506 scope, 507 onError 508 }) { 509 const store = (0, import_element3.useMemo)(() => { 510 let lastValue = []; 511 return { 512 subscribe(listener) { 513 (0, import_hooks2.addAction)( 514 "plugins.pluginRegistered", 515 "core/plugins/plugin-area/plugins-registered", 516 listener 517 ); 518 (0, import_hooks2.addAction)( 519 "plugins.pluginUnregistered", 520 "core/plugins/plugin-area/plugins-unregistered", 521 listener 522 ); 523 return () => { 524 (0, import_hooks2.removeAction)( 525 "plugins.pluginRegistered", 526 "core/plugins/plugin-area/plugins-registered" 527 ); 528 (0, import_hooks2.removeAction)( 529 "plugins.pluginUnregistered", 530 "core/plugins/plugin-area/plugins-unregistered" 531 ); 532 }; 533 }, 534 getValue() { 535 const nextValue = getPlugins(scope); 536 if (!(0, import_is_shallow_equal.isShallowEqual)(lastValue, nextValue)) { 537 lastValue = nextValue; 538 } 539 return lastValue; 540 } 541 }; 542 }, [scope]); 543 const plugins2 = (0, import_element3.useSyncExternalStore)( 544 store.subscribe, 545 store.getValue, 546 store.getValue 547 ); 548 return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { display: "none" }, children: plugins2.map(({ icon, name, render: Plugin }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( 549 PluginContextProvider, 550 { 551 value: getPluginContext(icon, name), 552 children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PluginErrorBoundary, { name, onError, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Plugin, {}) }) 553 }, 554 name 555 )) }); 556 } 557 var plugin_area_default = PluginArea; 558 return __toCommonJS(index_exports); 559 })(); 560 /*! Bundled license information: 561 562 react-is/cjs/react-is.development.js: 563 (** 564 * @license React 565 * react-is.development.js 566 * 567 * Copyright (c) Facebook, Inc. and its affiliates. 568 * 569 * This source code is licensed under the MIT license found in the 570 * LICENSE file in the root directory of this source tree. 571 *) 572 */
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Wed Jul 15 08:20:16 2026 | Cross-referenced by PHPXref |