[ 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 DotTip: () => (/* reexport */ dot_tip), 55 store: () => (/* reexport */ store) 56 }); 57 58 // NAMESPACE OBJECT: ./node_modules/@wordpress/nux/build-module/store/actions.js 59 var actions_namespaceObject = {}; 60 __webpack_require__.r(actions_namespaceObject); 61 __webpack_require__.d(actions_namespaceObject, { 62 disableTips: () => (disableTips), 63 dismissTip: () => (dismissTip), 64 enableTips: () => (enableTips), 65 triggerGuide: () => (triggerGuide) 66 }); 67 68 // NAMESPACE OBJECT: ./node_modules/@wordpress/nux/build-module/store/selectors.js 69 var selectors_namespaceObject = {}; 70 __webpack_require__.r(selectors_namespaceObject); 71 __webpack_require__.d(selectors_namespaceObject, { 72 areTipsEnabled: () => (selectors_areTipsEnabled), 73 getAssociatedGuide: () => (getAssociatedGuide), 74 isTipVisible: () => (isTipVisible) 75 }); 76 77 ;// CONCATENATED MODULE: external ["wp","deprecated"] 78 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; 79 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); 80 ;// CONCATENATED MODULE: external ["wp","data"] 81 const external_wp_data_namespaceObject = window["wp"]["data"]; 82 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/reducer.js 83 /** 84 * WordPress dependencies 85 */ 86 87 88 /** 89 * Reducer that tracks which tips are in a guide. Each guide is represented by 90 * an array which contains the tip identifiers contained within that guide. 91 * 92 * @param {Array} state Current state. 93 * @param {Object} action Dispatched action. 94 * 95 * @return {Array} Updated state. 96 */ 97 function guides(state = [], action) { 98 switch (action.type) { 99 case 'TRIGGER_GUIDE': 100 return [...state, action.tipIds]; 101 } 102 return state; 103 } 104 105 /** 106 * Reducer that tracks whether or not tips are globally enabled. 107 * 108 * @param {boolean} state Current state. 109 * @param {Object} action Dispatched action. 110 * 111 * @return {boolean} Updated state. 112 */ 113 function areTipsEnabled(state = true, action) { 114 switch (action.type) { 115 case 'DISABLE_TIPS': 116 return false; 117 case 'ENABLE_TIPS': 118 return true; 119 } 120 return state; 121 } 122 123 /** 124 * Reducer that tracks which tips have been dismissed. If the state object 125 * contains a tip identifier, then that tip is dismissed. 126 * 127 * @param {Object} state Current state. 128 * @param {Object} action Dispatched action. 129 * 130 * @return {Object} Updated state. 131 */ 132 function dismissedTips(state = {}, action) { 133 switch (action.type) { 134 case 'DISMISS_TIP': 135 return { 136 ...state, 137 [action.id]: true 138 }; 139 case 'ENABLE_TIPS': 140 return {}; 141 } 142 return state; 143 } 144 const preferences = (0,external_wp_data_namespaceObject.combineReducers)({ 145 areTipsEnabled, 146 dismissedTips 147 }); 148 /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 149 guides, 150 preferences 151 })); 152 153 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/actions.js 154 /** 155 * Returns an action object that, when dispatched, presents a guide that takes 156 * the user through a series of tips step by step. 157 * 158 * @param {string[]} tipIds Which tips to show in the guide. 159 * 160 * @return {Object} Action object. 161 */ 162 function triggerGuide(tipIds) { 163 return { 164 type: 'TRIGGER_GUIDE', 165 tipIds 166 }; 167 } 168 169 /** 170 * Returns an action object that, when dispatched, dismisses the given tip. A 171 * dismissed tip will not show again. 172 * 173 * @param {string} id The tip to dismiss. 174 * 175 * @return {Object} Action object. 176 */ 177 function dismissTip(id) { 178 return { 179 type: 'DISMISS_TIP', 180 id 181 }; 182 } 183 184 /** 185 * Returns an action object that, when dispatched, prevents all tips from 186 * showing again. 187 * 188 * @return {Object} Action object. 189 */ 190 function disableTips() { 191 return { 192 type: 'DISABLE_TIPS' 193 }; 194 } 195 196 /** 197 * Returns an action object that, when dispatched, makes all tips show again. 198 * 199 * @return {Object} Action object. 200 */ 201 function enableTips() { 202 return { 203 type: 'ENABLE_TIPS' 204 }; 205 } 206 207 ;// CONCATENATED MODULE: ./node_modules/rememo/rememo.js 208 209 210 /** @typedef {(...args: any[]) => *[]} GetDependants */ 211 212 /** @typedef {() => void} Clear */ 213 214 /** 215 * @typedef {{ 216 * getDependants: GetDependants, 217 * clear: Clear 218 * }} EnhancedSelector 219 */ 220 221 /** 222 * Internal cache entry. 223 * 224 * @typedef CacheNode 225 * 226 * @property {?CacheNode|undefined} [prev] Previous node. 227 * @property {?CacheNode|undefined} [next] Next node. 228 * @property {*[]} args Function arguments for cache entry. 229 * @property {*} val Function result. 230 */ 231 232 /** 233 * @typedef Cache 234 * 235 * @property {Clear} clear Function to clear cache. 236 * @property {boolean} [isUniqueByDependants] Whether dependants are valid in 237 * considering cache uniqueness. A cache is unique if dependents are all arrays 238 * or objects. 239 * @property {CacheNode?} [head] Cache head. 240 * @property {*[]} [lastDependants] Dependants from previous invocation. 241 */ 242 243 /** 244 * Arbitrary value used as key for referencing cache object in WeakMap tree. 245 * 246 * @type {{}} 247 */ 248 var LEAF_KEY = {}; 249 250 /** 251 * Returns the first argument as the sole entry in an array. 252 * 253 * @template T 254 * 255 * @param {T} value Value to return. 256 * 257 * @return {[T]} Value returned as entry in array. 258 */ 259 function arrayOf(value) { 260 return [value]; 261 } 262 263 /** 264 * Returns true if the value passed is object-like, or false otherwise. A value 265 * is object-like if it can support property assignment, e.g. object or array. 266 * 267 * @param {*} value Value to test. 268 * 269 * @return {boolean} Whether value is object-like. 270 */ 271 function isObjectLike(value) { 272 return !!value && 'object' === typeof value; 273 } 274 275 /** 276 * Creates and returns a new cache object. 277 * 278 * @return {Cache} Cache object. 279 */ 280 function createCache() { 281 /** @type {Cache} */ 282 var cache = { 283 clear: function () { 284 cache.head = null; 285 }, 286 }; 287 288 return cache; 289 } 290 291 /** 292 * Returns true if entries within the two arrays are strictly equal by 293 * reference from a starting index. 294 * 295 * @param {*[]} a First array. 296 * @param {*[]} b Second array. 297 * @param {number} fromIndex Index from which to start comparison. 298 * 299 * @return {boolean} Whether arrays are shallowly equal. 300 */ 301 function isShallowEqual(a, b, fromIndex) { 302 var i; 303 304 if (a.length !== b.length) { 305 return false; 306 } 307 308 for (i = fromIndex; i < a.length; i++) { 309 if (a[i] !== b[i]) { 310 return false; 311 } 312 } 313 314 return true; 315 } 316 317 /** 318 * Returns a memoized selector function. The getDependants function argument is 319 * called before the memoized selector and is expected to return an immutable 320 * reference or array of references on which the selector depends for computing 321 * its own return value. The memoize cache is preserved only as long as those 322 * dependant references remain the same. If getDependants returns a different 323 * reference(s), the cache is cleared and the selector value regenerated. 324 * 325 * @template {(...args: *[]) => *} S 326 * 327 * @param {S} selector Selector function. 328 * @param {GetDependants=} getDependants Dependant getter returning an array of 329 * references used in cache bust consideration. 330 */ 331 /* harmony default export */ function rememo(selector, getDependants) { 332 /** @type {WeakMap<*,*>} */ 333 var rootCache; 334 335 /** @type {GetDependants} */ 336 var normalizedGetDependants = getDependants ? getDependants : arrayOf; 337 338 /** 339 * Returns the cache for a given dependants array. When possible, a WeakMap 340 * will be used to create a unique cache for each set of dependants. This 341 * is feasible due to the nature of WeakMap in allowing garbage collection 342 * to occur on entries where the key object is no longer referenced. Since 343 * WeakMap requires the key to be an object, this is only possible when the 344 * dependant is object-like. The root cache is created as a hierarchy where 345 * each top-level key is the first entry in a dependants set, the value a 346 * WeakMap where each key is the next dependant, and so on. This continues 347 * so long as the dependants are object-like. If no dependants are object- 348 * like, then the cache is shared across all invocations. 349 * 350 * @see isObjectLike 351 * 352 * @param {*[]} dependants Selector dependants. 353 * 354 * @return {Cache} Cache object. 355 */ 356 function getCache(dependants) { 357 var caches = rootCache, 358 isUniqueByDependants = true, 359 i, 360 dependant, 361 map, 362 cache; 363 364 for (i = 0; i < dependants.length; i++) { 365 dependant = dependants[i]; 366 367 // Can only compose WeakMap from object-like key. 368 if (!isObjectLike(dependant)) { 369 isUniqueByDependants = false; 370 break; 371 } 372 373 // Does current segment of cache already have a WeakMap? 374 if (caches.has(dependant)) { 375 // Traverse into nested WeakMap. 376 caches = caches.get(dependant); 377 } else { 378 // Create, set, and traverse into a new one. 379 map = new WeakMap(); 380 caches.set(dependant, map); 381 caches = map; 382 } 383 } 384 385 // We use an arbitrary (but consistent) object as key for the last item 386 // in the WeakMap to serve as our running cache. 387 if (!caches.has(LEAF_KEY)) { 388 cache = createCache(); 389 cache.isUniqueByDependants = isUniqueByDependants; 390 caches.set(LEAF_KEY, cache); 391 } 392 393 return caches.get(LEAF_KEY); 394 } 395 396 /** 397 * Resets root memoization cache. 398 */ 399 function clear() { 400 rootCache = new WeakMap(); 401 } 402 403 /* eslint-disable jsdoc/check-param-names */ 404 /** 405 * The augmented selector call, considering first whether dependants have 406 * changed before passing it to underlying memoize function. 407 * 408 * @param {*} source Source object for derivation. 409 * @param {...*} extraArgs Additional arguments to pass to selector. 410 * 411 * @return {*} Selector result. 412 */ 413 /* eslint-enable jsdoc/check-param-names */ 414 function callSelector(/* source, ...extraArgs */) { 415 var len = arguments.length, 416 cache, 417 node, 418 i, 419 args, 420 dependants; 421 422 // Create copy of arguments (avoid leaking deoptimization). 423 args = new Array(len); 424 for (i = 0; i < len; i++) { 425 args[i] = arguments[i]; 426 } 427 428 dependants = normalizedGetDependants.apply(null, args); 429 cache = getCache(dependants); 430 431 // If not guaranteed uniqueness by dependants (primitive type), shallow 432 // compare against last dependants and, if references have changed, 433 // destroy cache to recalculate result. 434 if (!cache.isUniqueByDependants) { 435 if ( 436 cache.lastDependants && 437 !isShallowEqual(dependants, cache.lastDependants, 0) 438 ) { 439 cache.clear(); 440 } 441 442 cache.lastDependants = dependants; 443 } 444 445 node = cache.head; 446 while (node) { 447 // Check whether node arguments match arguments 448 if (!isShallowEqual(node.args, args, 1)) { 449 node = node.next; 450 continue; 451 } 452 453 // At this point we can assume we've found a match 454 455 // Surface matched node to head if not already 456 if (node !== cache.head) { 457 // Adjust siblings to point to each other. 458 /** @type {CacheNode} */ (node.prev).next = node.next; 459 if (node.next) { 460 node.next.prev = node.prev; 461 } 462 463 node.next = cache.head; 464 node.prev = null; 465 /** @type {CacheNode} */ (cache.head).prev = node; 466 cache.head = node; 467 } 468 469 // Return immediately 470 return node.val; 471 } 472 473 // No cached value found. Continue to insertion phase: 474 475 node = /** @type {CacheNode} */ ({ 476 // Generate the result from original function 477 val: selector.apply(null, args), 478 }); 479 480 // Avoid including the source object in the cache. 481 args[0] = null; 482 node.args = args; 483 484 // Don't need to check whether node is already head, since it would 485 // have been returned above already if it was 486 487 // Shift existing head down list 488 if (cache.head) { 489 cache.head.prev = node; 490 node.next = cache.head; 491 } 492 493 cache.head = node; 494 495 return node.val; 496 } 497 498 callSelector.getDependants = normalizedGetDependants; 499 callSelector.clear = clear; 500 clear(); 501 502 return /** @type {S & EnhancedSelector} */ (callSelector); 503 } 504 505 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/selectors.js 506 /** 507 * External dependencies 508 */ 509 510 511 /** 512 * An object containing information about a guide. 513 * 514 * @typedef {Object} NUXGuideInfo 515 * @property {string[]} tipIds Which tips the guide contains. 516 * @property {?string} currentTipId The guide's currently showing tip. 517 * @property {?string} nextTipId The guide's next tip to show. 518 */ 519 520 /** 521 * Returns an object describing the guide, if any, that the given tip is a part 522 * of. 523 * 524 * @param {Object} state Global application state. 525 * @param {string} tipId The tip to query. 526 * 527 * @return {?NUXGuideInfo} Information about the associated guide. 528 */ 529 const getAssociatedGuide = rememo((state, tipId) => { 530 for (const tipIds of state.guides) { 531 if (tipIds.includes(tipId)) { 532 const nonDismissedTips = tipIds.filter(tId => !Object.keys(state.preferences.dismissedTips).includes(tId)); 533 const [currentTipId = null, nextTipId = null] = nonDismissedTips; 534 return { 535 tipIds, 536 currentTipId, 537 nextTipId 538 }; 539 } 540 } 541 return null; 542 }, state => [state.guides, state.preferences.dismissedTips]); 543 544 /** 545 * Determines whether or not the given tip is showing. Tips are hidden if they 546 * are disabled, have been dismissed, or are not the current tip in any 547 * guide that they have been added to. 548 * 549 * @param {Object} state Global application state. 550 * @param {string} tipId The tip to query. 551 * 552 * @return {boolean} Whether or not the given tip is showing. 553 */ 554 function isTipVisible(state, tipId) { 555 if (!state.preferences.areTipsEnabled) { 556 return false; 557 } 558 if (state.preferences.dismissedTips?.hasOwnProperty(tipId)) { 559 return false; 560 } 561 const associatedGuide = getAssociatedGuide(state, tipId); 562 if (associatedGuide && associatedGuide.currentTipId !== tipId) { 563 return false; 564 } 565 return true; 566 } 567 568 /** 569 * Returns whether or not tips are globally enabled. 570 * 571 * @param {Object} state Global application state. 572 * 573 * @return {boolean} Whether tips are globally enabled. 574 */ 575 function selectors_areTipsEnabled(state) { 576 return state.preferences.areTipsEnabled; 577 } 578 579 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/index.js 580 /** 581 * WordPress dependencies 582 */ 583 584 585 /** 586 * Internal dependencies 587 */ 588 589 590 591 const STORE_NAME = 'core/nux'; 592 593 /** 594 * Store definition for the nux namespace. 595 * 596 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore 597 * 598 * @type {Object} 599 */ 600 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { 601 reducer: reducer, 602 actions: actions_namespaceObject, 603 selectors: selectors_namespaceObject, 604 persist: ['preferences'] 605 }); 606 607 // Once we build a more generic persistence plugin that works across types of stores 608 // we'd be able to replace this with a register call. 609 (0,external_wp_data_namespaceObject.registerStore)(STORE_NAME, { 610 reducer: reducer, 611 actions: actions_namespaceObject, 612 selectors: selectors_namespaceObject, 613 persist: ['preferences'] 614 }); 615 616 ;// CONCATENATED MODULE: external "React" 617 const external_React_namespaceObject = window["React"]; 618 ;// CONCATENATED MODULE: external ["wp","compose"] 619 const external_wp_compose_namespaceObject = window["wp"]["compose"]; 620 ;// CONCATENATED MODULE: external ["wp","components"] 621 const external_wp_components_namespaceObject = window["wp"]["components"]; 622 ;// CONCATENATED MODULE: external ["wp","i18n"] 623 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; 624 ;// CONCATENATED MODULE: external ["wp","element"] 625 const external_wp_element_namespaceObject = window["wp"]["element"]; 626 ;// CONCATENATED MODULE: external ["wp","primitives"] 627 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 628 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js 629 630 /** 631 * WordPress dependencies 632 */ 633 634 const close_close = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 635 xmlns: "http://www.w3.org/2000/svg", 636 viewBox: "0 0 24 24" 637 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 638 d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" 639 })); 640 /* harmony default export */ const library_close = (close_close); 641 642 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/components/dot-tip/index.js 643 644 /** 645 * WordPress dependencies 646 */ 647 648 649 650 651 652 653 654 /** 655 * Internal dependencies 656 */ 657 658 function onClick(event) { 659 // Tips are often nested within buttons. We stop propagation so that clicking 660 // on a tip doesn't result in the button being clicked. 661 event.stopPropagation(); 662 } 663 function DotTip({ 664 position = 'middle right', 665 children, 666 isVisible, 667 hasNextTip, 668 onDismiss, 669 onDisable 670 }) { 671 const anchorParent = (0,external_wp_element_namespaceObject.useRef)(null); 672 const onFocusOutsideCallback = (0,external_wp_element_namespaceObject.useCallback)(event => { 673 if (!anchorParent.current) { 674 return; 675 } 676 if (anchorParent.current.contains(event.relatedTarget)) { 677 return; 678 } 679 onDisable(); 680 }, [onDisable, anchorParent]); 681 if (!isVisible) { 682 return null; 683 } 684 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, { 685 className: "nux-dot-tip", 686 position: position, 687 focusOnMount: true, 688 role: "dialog", 689 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Editor tips'), 690 onClick: onClick, 691 onFocusOutside: onFocusOutsideCallback 692 }, (0,external_React_namespaceObject.createElement)("p", null, children), (0,external_React_namespaceObject.createElement)("p", null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 693 variant: "link", 694 onClick: onDismiss 695 }, hasNextTip ? (0,external_wp_i18n_namespaceObject.__)('See next tip') : (0,external_wp_i18n_namespaceObject.__)('Got it'))), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 696 className: "nux-dot-tip__disable", 697 icon: library_close, 698 label: (0,external_wp_i18n_namespaceObject.__)('Disable tips'), 699 onClick: onDisable 700 })); 701 } 702 /* harmony default export */ const dot_tip = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, { 703 tipId 704 }) => { 705 const { 706 isTipVisible, 707 getAssociatedGuide 708 } = select(store); 709 const associatedGuide = getAssociatedGuide(tipId); 710 return { 711 isVisible: isTipVisible(tipId), 712 hasNextTip: !!(associatedGuide && associatedGuide.nextTipId) 713 }; 714 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { 715 tipId 716 }) => { 717 const { 718 dismissTip, 719 disableTips 720 } = dispatch(store); 721 return { 722 onDismiss() { 723 dismissTip(tipId); 724 }, 725 onDisable() { 726 disableTips(); 727 } 728 }; 729 }))(DotTip)); 730 731 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/index.js 732 /** 733 * WordPress dependencies 734 */ 735 736 737 738 external_wp_deprecated_default()('wp.nux', { 739 since: '5.4', 740 hint: 'wp.components.Guide can be used to show a user guide.', 741 version: '6.2' 742 }); 743 744 (window.wp = window.wp || {}).nux = __webpack_exports__; 745 /******/ })() 746 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Fri Apr 26 08:20:02 2024 | Cross-referenced by PHPXref |