[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 import * as __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__ from "@wordpress/interactivity"; 2 /******/ // The require scope 3 /******/ var __webpack_require__ = {}; 4 /******/ 5 /************************************************************************/ 6 /******/ /* webpack/runtime/define property getters */ 7 /******/ !function() { 8 /******/ // define getter functions for harmony exports 9 /******/ __webpack_require__.d = function(exports, definition) { 10 /******/ for(var key in definition) { 11 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 12 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 13 /******/ } 14 /******/ } 15 /******/ }; 16 /******/ }(); 17 /******/ 18 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 19 /******/ !function() { 20 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } 21 /******/ }(); 22 /******/ 23 /************************************************************************/ 24 var __webpack_exports__ = {}; 25 26 ;// CONCATENATED MODULE: external "@wordpress/interactivity" 27 var x = y => { var x = {}; __webpack_require__.d(x, y); return x; } 28 var y = x => () => x 29 var interactivity_namespaceObject = x({ ["getContext"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getContext, ["getElement"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getElement, ["store"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.store }); 30 ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/search/view.js 31 /** 32 * WordPress dependencies 33 */ 34 35 const { 36 actions 37 } = (0,interactivity_namespaceObject.store)('core/search', { 38 state: { 39 get ariaLabel() { 40 const { 41 isSearchInputVisible, 42 ariaLabelCollapsed, 43 ariaLabelExpanded 44 } = (0,interactivity_namespaceObject.getContext)(); 45 return isSearchInputVisible ? ariaLabelExpanded : ariaLabelCollapsed; 46 }, 47 get ariaControls() { 48 const { 49 isSearchInputVisible, 50 inputId 51 } = (0,interactivity_namespaceObject.getContext)(); 52 return isSearchInputVisible ? null : inputId; 53 }, 54 get type() { 55 const { 56 isSearchInputVisible 57 } = (0,interactivity_namespaceObject.getContext)(); 58 return isSearchInputVisible ? 'submit' : 'button'; 59 }, 60 get tabindex() { 61 const { 62 isSearchInputVisible 63 } = (0,interactivity_namespaceObject.getContext)(); 64 return isSearchInputVisible ? '0' : '-1'; 65 } 66 }, 67 actions: { 68 openSearchInput(event) { 69 const ctx = (0,interactivity_namespaceObject.getContext)(); 70 const { 71 ref 72 } = (0,interactivity_namespaceObject.getElement)(); 73 if (!ctx.isSearchInputVisible) { 74 event.preventDefault(); 75 ctx.isSearchInputVisible = true; 76 ref.parentElement.querySelector('input').focus(); 77 } 78 }, 79 closeSearchInput() { 80 const ctx = (0,interactivity_namespaceObject.getContext)(); 81 ctx.isSearchInputVisible = false; 82 }, 83 handleSearchKeydown(event) { 84 const { 85 ref 86 } = (0,interactivity_namespaceObject.getElement)(); 87 // If Escape close the menu. 88 if (event?.key === 'Escape') { 89 actions.closeSearchInput(); 90 ref.querySelector('button').focus(); 91 } 92 }, 93 handleSearchFocusout(event) { 94 const { 95 ref 96 } = (0,interactivity_namespaceObject.getElement)(); 97 // If focus is outside search form, and in the document, close menu 98 // event.target === The element losing focus 99 // event.relatedTarget === The element receiving focus (if any) 100 // When focusout is outside the document, 101 // `window.document.activeElement` doesn't change. 102 if (!ref.contains(event.relatedTarget) && event.target !== window.document.activeElement) { 103 actions.closeSearchInput(); 104 } 105 } 106 } 107 });
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Wed Jan 31 08:20:02 2024 | Cross-referenced by PHPXref |