[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/blocks/ -> query.js (source)

   1  import * as __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__ from "@wordpress/interactivity";
   2  /******/ var __webpack_modules__ = ({
   3  
   4  /***/ 998:
   5  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
   6  
   7  var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
   8  var y = x => () => x
   9  module.exports = x({ ["directivePrefix"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.directivePrefix, ["getContext"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getContext, ["getElement"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getElement, ["getRegionRootFragment"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getRegionRootFragment, ["render"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.render, ["store"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.store, ["toVdom"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.toVdom });
  10  
  11  /***/ })
  12  
  13  /******/ });
  14  /************************************************************************/
  15  /******/ // The module cache
  16  /******/ var __webpack_module_cache__ = {};
  17  /******/ 
  18  /******/ // The require function
  19  /******/ function __webpack_require__(moduleId) {
  20  /******/     // Check if module is in cache
  21  /******/     var cachedModule = __webpack_module_cache__[moduleId];
  22  /******/     if (cachedModule !== undefined) {
  23  /******/         return cachedModule.exports;
  24  /******/     }
  25  /******/     // Create a new module (and put it into the cache)
  26  /******/     var module = __webpack_module_cache__[moduleId] = {
  27  /******/         // no module.id needed
  28  /******/         // no module.loaded needed
  29  /******/         exports: {}
  30  /******/     };
  31  /******/ 
  32  /******/     // Execute the module function
  33  /******/     __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  34  /******/ 
  35  /******/     // Return the exports of the module
  36  /******/     return module.exports;
  37  /******/ }
  38  /******/ 
  39  /******/ // expose the modules object (__webpack_modules__)
  40  /******/ __webpack_require__.m = __webpack_modules__;
  41  /******/ 
  42  /************************************************************************/
  43  /******/ /* webpack/runtime/define property getters */
  44  /******/ !function() {
  45  /******/     // define getter functions for harmony exports
  46  /******/     __webpack_require__.d = function(exports, definition) {
  47  /******/         for(var key in definition) {
  48  /******/             if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  49  /******/                 Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  50  /******/             }
  51  /******/         }
  52  /******/     };
  53  /******/ }();
  54  /******/ 
  55  /******/ /* webpack/runtime/ensure chunk */
  56  /******/ !function() {
  57  /******/     __webpack_require__.f = {};
  58  /******/     // This file contains only the entry chunk.
  59  /******/     // The chunk loading function for additional chunks
  60  /******/     __webpack_require__.e = function(chunkId) {
  61  /******/         return Promise.all(Object.keys(__webpack_require__.f).reduce(function(promises, key) {
  62  /******/             __webpack_require__.f[key](chunkId, promises);
  63  /******/             return promises;
  64  /******/         }, []));
  65  /******/     };
  66  /******/ }();
  67  /******/ 
  68  /******/ /* webpack/runtime/get javascript chunk filename */
  69  /******/ !function() {
  70  /******/     // This function allow to reference async chunks
  71  /******/     __webpack_require__.u = function(chunkId) {
  72  /******/         // return url for filenames based on template
  73  /******/         return "./blocks/" + chunkId + ".js";
  74  /******/     };
  75  /******/ }();
  76  /******/ 
  77  /******/ /* webpack/runtime/hasOwnProperty shorthand */
  78  /******/ !function() {
  79  /******/     __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  80  /******/ }();
  81  /******/ 
  82  /******/ /* webpack/runtime/load script */
  83  /******/ !function() {
  84  /******/     var inProgress = {};
  85  /******/     var dataWebpackPrefix = "WordPress:";
  86  /******/     // loadScript function to load a script via script tag
  87  /******/     __webpack_require__.l = function(url, done, key, chunkId) {
  88  /******/         if(inProgress[url]) { inProgress[url].push(done); return; }
  89  /******/         var script, needAttach;
  90  /******/         if(key !== undefined) {
  91  /******/             var scripts = document.getElementsByTagName("script");
  92  /******/             for(var i = 0; i < scripts.length; i++) {
  93  /******/                 var s = scripts[i];
  94  /******/                 if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
  95  /******/             }
  96  /******/         }
  97  /******/         if(!script) {
  98  /******/             needAttach = true;
  99  /******/             script = document.createElement('script');
 100  /******/             script.type = "module";
 101  /******/             script.charset = 'utf-8';
 102  /******/             script.timeout = 120;
 103  /******/             if (__webpack_require__.nc) {
 104  /******/                 script.setAttribute("nonce", __webpack_require__.nc);
 105  /******/             }
 106  /******/             script.setAttribute("data-webpack", dataWebpackPrefix + key);
 107  /******/     
 108  /******/             script.src = url;
 109  /******/         }
 110  /******/         inProgress[url] = [done];
 111  /******/         var onScriptComplete = function(prev, event) {
 112  /******/             // avoid mem leaks in IE.
 113  /******/             script.onerror = script.onload = null;
 114  /******/             clearTimeout(timeout);
 115  /******/             var doneFns = inProgress[url];
 116  /******/             delete inProgress[url];
 117  /******/             script.parentNode && script.parentNode.removeChild(script);
 118  /******/             doneFns && doneFns.forEach(function(fn) { return fn(event); });
 119  /******/             if(prev) return prev(event);
 120  /******/         }
 121  /******/         var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
 122  /******/         script.onerror = onScriptComplete.bind(null, script.onerror);
 123  /******/         script.onload = onScriptComplete.bind(null, script.onload);
 124  /******/         needAttach && document.head.appendChild(script);
 125  /******/     };
 126  /******/ }();
 127  /******/ 
 128  /******/ /* webpack/runtime/make namespace object */
 129  /******/ !function() {
 130  /******/     // define __esModule on exports
 131  /******/     __webpack_require__.r = function(exports) {
 132  /******/         if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
 133  /******/             Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
 134  /******/         }
 135  /******/         Object.defineProperty(exports, '__esModule', { value: true });
 136  /******/     };
 137  /******/ }();
 138  /******/ 
 139  /******/ /* webpack/runtime/publicPath */
 140  /******/ !function() {
 141  /******/     var scriptUrl;
 142  /******/     if (typeof import.meta.url === "string") scriptUrl = import.meta.url
 143  /******/     // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
 144  /******/     // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
 145  /******/     if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
 146  /******/     scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
 147  /******/     __webpack_require__.p = scriptUrl + "../";
 148  /******/ }();
 149  /******/ 
 150  /******/ /* webpack/runtime/jsonp chunk loading */
 151  /******/ !function() {
 152  /******/     // no baseURI
 153  /******/     
 154  /******/     // object to store loaded and loading chunks
 155  /******/     // undefined = chunk not loaded, null = chunk preloaded/prefetched
 156  /******/     // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
 157  /******/     var installedChunks = {
 158  /******/         658: 0
 159  /******/     };
 160  /******/     
 161  /******/     __webpack_require__.f.j = function(chunkId, promises) {
 162  /******/             // JSONP chunk loading for javascript
 163  /******/             var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
 164  /******/             if(installedChunkData !== 0) { // 0 means "already installed".
 165  /******/     
 166  /******/                 // a Promise means "currently loading".
 167  /******/                 if(installedChunkData) {
 168  /******/                     promises.push(installedChunkData[2]);
 169  /******/                 } else {
 170  /******/                     if(true) { // all chunks have JS
 171  /******/                         // setup Promise in chunk cache
 172  /******/                         var promise = new Promise(function(resolve, reject) { installedChunkData = installedChunks[chunkId] = [resolve, reject]; });
 173  /******/                         promises.push(installedChunkData[2] = promise);
 174  /******/     
 175  /******/                         // start chunk loading
 176  /******/                         var url = __webpack_require__.p + __webpack_require__.u(chunkId);
 177  /******/                         // create error before stack unwound to get useful stacktrace later
 178  /******/                         var error = new Error();
 179  /******/                         var loadingEnded = function(event) {
 180  /******/                             if(__webpack_require__.o(installedChunks, chunkId)) {
 181  /******/                                 installedChunkData = installedChunks[chunkId];
 182  /******/                                 if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
 183  /******/                                 if(installedChunkData) {
 184  /******/                                     var errorType = event && (event.type === 'load' ? 'missing' : event.type);
 185  /******/                                     var realSrc = event && event.target && event.target.src;
 186  /******/                                     error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
 187  /******/                                     error.name = 'ChunkLoadError';
 188  /******/                                     error.type = errorType;
 189  /******/                                     error.request = realSrc;
 190  /******/                                     installedChunkData[1](error);
 191  /******/                                 }
 192  /******/                             }
 193  /******/                         };
 194  /******/                         __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
 195  /******/                     }
 196  /******/                 }
 197  /******/             }
 198  /******/     };
 199  /******/     
 200  /******/     // no prefetching
 201  /******/     
 202  /******/     // no preloaded
 203  /******/     
 204  /******/     // no HMR
 205  /******/     
 206  /******/     // no HMR manifest
 207  /******/     
 208  /******/     // no on chunks loaded
 209  /******/     
 210  /******/     // install a JSONP callback for chunk loading
 211  /******/     var webpackJsonpCallback = function(parentChunkLoadingFunction, data) {
 212  /******/         var chunkIds = data[0];
 213  /******/         var moreModules = data[1];
 214  /******/         var runtime = data[2];
 215  /******/         // add "moreModules" to the modules object,
 216  /******/         // then flag all "chunkIds" as loaded and fire callback
 217  /******/         var moduleId, chunkId, i = 0;
 218  /******/         if(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) {
 219  /******/             for(moduleId in moreModules) {
 220  /******/                 if(__webpack_require__.o(moreModules, moduleId)) {
 221  /******/                     __webpack_require__.m[moduleId] = moreModules[moduleId];
 222  /******/                 }
 223  /******/             }
 224  /******/             if(runtime) var result = runtime(__webpack_require__);
 225  /******/         }
 226  /******/         if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
 227  /******/         for(;i < chunkIds.length; i++) {
 228  /******/             chunkId = chunkIds[i];
 229  /******/             if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
 230  /******/                 installedChunks[chunkId][0]();
 231  /******/             }
 232  /******/             installedChunks[chunkId] = 0;
 233  /******/         }
 234  /******/     
 235  /******/     }
 236  /******/     
 237  /******/     var chunkLoadingGlobal = self["webpackChunkWordPress"] = self["webpackChunkWordPress"] || [];
 238  /******/     chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
 239  /******/     chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
 240  /******/ }();
 241  /******/ 
 242  /************************************************************************/
 243  var __webpack_exports__ = {};
 244  // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
 245  !function() {
 246  /* harmony import */ var _wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(998);
 247  /**
 248   * WordPress dependencies
 249   */
 250  
 251  const isValidLink = ref => ref && ref instanceof window.HTMLAnchorElement && ref.href && (!ref.target || ref.target === '_self') && ref.origin === window.location.origin;
 252  const isValidEvent = event => event.button === 0 &&
 253  // Left clicks only.
 254  !event.metaKey &&
 255  // Open in new tab (Mac).
 256  !event.ctrlKey &&
 257  // Open in new tab (Windows).
 258  !event.altKey &&
 259  // Download.
 260  !event.shiftKey && !event.defaultPrevented;
 261  (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.store)('core/query', {
 262    state: {
 263      get startAnimation() {
 264        return (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getContext)().animation === 'start';
 265      },
 266      get finishAnimation() {
 267        return (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getContext)().animation === 'finish';
 268      }
 269    },
 270    actions: {
 271      *navigate(event) {
 272        const ctx = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getContext)();
 273        const {
 274          ref
 275        } = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getElement)();
 276        const {
 277          queryRef
 278        } = ctx;
 279        const isDisabled = queryRef?.dataset.wpNavigationDisabled;
 280        if (isValidLink(ref) && isValidEvent(event) && !isDisabled) {
 281          event.preventDefault();
 282  
 283          // Don't announce the navigation immediately, wait 400 ms.
 284          const timeout = setTimeout(() => {
 285            ctx.message = ctx.loadingText;
 286            ctx.animation = 'start';
 287          }, 400);
 288          const {
 289            actions
 290          } = yield __webpack_require__.e(/* import() */ 908).then(__webpack_require__.bind(__webpack_require__, 908));
 291          yield actions.navigate(ref.href);
 292  
 293          // Dismiss loading message if it hasn't been added yet.
 294          clearTimeout(timeout);
 295  
 296          // Announce that the page has been loaded. If the message is the
 297          // same, we use a no-break space similar to the @wordpress/a11y
 298          // package: https://github.com/WordPress/gutenberg/blob/c395242b8e6ee20f8b06c199e4fc2920d7018af1/packages/a11y/src/filter-message.js#L20-L26
 299          ctx.message = ctx.loadedText + (ctx.message === ctx.loadedText ? '\u00A0' : '');
 300          ctx.animation = 'finish';
 301          ctx.url = ref.href;
 302  
 303          // Focus the first anchor of the Query block.
 304          const firstAnchor = `.wp-block-post-template a[href]`;
 305          queryRef.querySelector(firstAnchor)?.focus();
 306        }
 307      },
 308      *prefetch() {
 309        const {
 310          queryRef
 311        } = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getContext)();
 312        const {
 313          ref
 314        } = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getElement)();
 315        const isDisabled = queryRef?.dataset.wpNavigationDisabled;
 316        if (isValidLink(ref) && !isDisabled) {
 317          const {
 318            actions
 319          } = yield __webpack_require__.e(/* import() */ 908).then(__webpack_require__.bind(__webpack_require__, 908));
 320          yield actions.prefetch(ref.href);
 321        }
 322      }
 323    },
 324    callbacks: {
 325      *prefetch() {
 326        const {
 327          url
 328        } = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getContext)();
 329        const {
 330          ref
 331        } = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getElement)();
 332        if (url && isValidLink(ref)) {
 333          const {
 334            actions
 335          } = yield __webpack_require__.e(/* import() */ 908).then(__webpack_require__.bind(__webpack_require__, 908));
 336          yield actions.prefetch(ref.href);
 337        }
 338      },
 339      setQueryRef() {
 340        const ctx = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getContext)();
 341        const {
 342          ref
 343        } = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getElement)();
 344        ctx.queryRef = ref;
 345      }
 346    }
 347  });
 348  }();


Generated : Wed Jan 31 08:20:02 2024 Cross-referenced by PHPXref