https://waateanews.com/wp-content/plugins/ncmaz-fse-core/build/dro…/view.js?ver=f41b6435a8eb2dac5d01
1import * as __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__ from "@wordpress/interactivity"; 2/******/ var __webpack_modules__ = ({ 3 4/***/ "@wordpress/interactivity": 5/*!*******************************************!*\ 6 !*** external "@wordpress/interactivity" ***! 7 \*******************************************/ 8/***/ ((module) => { 9 10module.exports = __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__; 11 12/***/ }) 13 14/******/ }); 15/************************************************************************/ 16/******/ // The module cache 17/******/ var __webpack_module_cache__ = {}; 18/******/ 19/******/ // The require function 20/******/ function __webpack_require__(moduleId) { 21/******/ // Check if module is in cache 22/******/ var cachedModule = __webpack_module_cache__[moduleId]; 23/******/ if (cachedModule !== undefined) { 24/******/ return cachedModule.exports; 25/******/ } 26/******/ // Create a new module (and put it into the cache) 27/******/ var module = __webpack_module_cache__[moduleId] = { 28/******/ // no module.id needed 29/******/ // no module.loaded needed 30/******/ exports: {} 31/******/ }; 32/******/ 33/******/ // Execute the module function 34/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 35/******/ 36/******/ // Return the exports of the module 37/******/ return module.exports; 38/******/ } 39/******/ 40/************************************************************************/ 41/******/ /* webpack/runtime/make namespace object */ 42/******/ (() => { 43/******/ // define __esModule on exports 44/******/ __webpack_require__.r = (exports) => { 45/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 46/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 47/******/ } 48/******/ Object.defineProperty(exports, '__esModule', { value: true }); 49/******/ }; 50/******/ })(); 51/******/ 52/************************************************************************/ 53var __webpack_exports__ = {}; 54// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. 55(() => { 56/*!*****************************************!*\ 57 !*** ./src/dropdown-menu-block/view.ts ***! 58 \*****************************************/ 59__webpack_require__.r(__webpack_exports__); 60/* harmony import */ var _wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/interactivity */ "@wordpress/interactivity"); 61 62const { 63 state, 64 actions 65} = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.store)("ncmfse/dropdown-menu", { 66 state: { 67 get isMenuOpen() { 68 const context = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getContext)(); 69 // The menu is opened if either `click` or `focus` is true. 70 return Object.values(context.menuOpenedBy).filter(Boolean).length > 0; 71 } 72 }, 73 actions: { 74 toggleMenuOnClick() { 75 const context = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getContext)(); 76 const { 77 ref 78 } = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getElement)(); 79 80 // Safari won't send focus to the clicked element, so we need to manually place it: https://bugs.webkit.org/show_bug.cgi?id=22261 81 if (window.document.activeElement !== ref) { 82 ref?.focus(); 83 } 84 if (context.menuOpenedBy.click || context.menuOpenedBy.focus) { 85 actions.closeMenu("click"); 86 actions.closeMenu("focus"); 87 } else { 88 context.previousFocus = ref; 89 actions.openMenu("click"); 90 } 91 }, 92 closeMenuOnClick() { 93 actions.closeMenu("click"); 94 actions.closeMenu("focus"); 95 }, 96 handleMenuKeydown(event) { 97 const context = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getContext)(); 98 if (context.menuOpenedBy.click) { 99 // If Escape close the menu. 100 if (event?.key === "Escape") { 101 actions.closeMenu("click"); 102 actions.closeMenu("focus"); 103 } 104 } 105 }, 106 openMenuOnFocus() { 107 actions.openMenu("focus"); 108 }, 109 handleMenuFocusout(event) { 110 const context = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getContext)(); 111 const menuContainer = context.dropdownMenu; 112 // If focus is outside menu, and in the document, close menu 113 // event.target === The element losing focus 114 // event.relatedTarget === The element receiving focus (if any) 115 // When focusout is outside the document, 116 // `window.document.activeElement` doesn't change. 117 118 // The event.relatedTarget is null when something outside the navigation menu is clicked. This is only necessary for Safari. 119 // TODO: There is still an issue in Safari where clicking on the menu link closes the menu. We don't want this. The toggleMenuOnClick callback should handle this. 120 if (event.relatedTarget === null || 121 // @ts-ignore 122 !menuContainer?.contains(event.relatedTarget) && event.target !== window.document.activeElement) {
123 actions.closeMenu("click"); 124 actions.closeMenu("focus"); 125 } 126 }, 127 openMenu(menuOpenedOn = "click") { 128 const context = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getContext)(); 129 context.menuOpenedBy[menuOpenedOn] = true; 130 }, 131 closeMenu(menuClosedOn = "click") { 132 const context = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getContext)(); 133 context.menuOpenedBy[menuClosedOn] = false; 134 135 // Reset the menu reference and button focus when closed. 136 if (!state.isMenuOpen) { 137 if (context.dropdownMenu?.contains(window.document.activeElement)) { 138 context.previousFocus?.focus(); 139 } 140 context.previousFocus = null; 141 context.dropdownMenu = null; 142 } 143 } 144 }, 145 callbacks: { 146 onWatchMenu() { 147 const context = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getContext)(); 148 const { 149 ref 150 } = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getElement)(); 151 // Set the menu reference when initialized. 152 if (state.isMenuOpen) { 153 context.dropdownMenu = ref; 154 } 155 } 156 } 157}); 158})(); 159 160 161//# sourceMappingURL=view.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.