Diff: STRATO-apps/wordpress_03/app/wp-includes/blocks/query/view.js
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
import * as __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__ from "@wordpress/interactivity";
2
+
/******/ var __webpack_modules__ = ({
3
+
4
+
/***/ 438:
5
+
/***/ ((module) => {
6
+
7
+
module.exports = import("@wordpress/interactivity-router");;
8
+
9
+
/***/ })
10
+
11
+
/******/ });
12
+
/************************************************************************/
13
+
/******/ // The module cache
14
+
/******/ var __webpack_module_cache__ = {};
15
+
/******/
16
+
/******/ // The require function
17
+
/******/ function __webpack_require__(moduleId) {
18
+
/******/ // Check if module is in cache
19
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
20
+
/******/ if (cachedModule !== undefined) {
21
+
/******/ return cachedModule.exports;
22
+
/******/ }
23
+
/******/ // Create a new module (and put it into the cache)
24
+
/******/ var module = __webpack_module_cache__[moduleId] = {
25
+
/******/ // no module.id needed
26
+
/******/ // no module.loaded needed
27
+
/******/ exports: {}
28
+
/******/ };
29
+
/******/
30
+
/******/ // Execute the module function
31
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
32
+
/******/
33
+
/******/ // Return the exports of the module
34
+
/******/ return module.exports;
35
+
/******/ }
36
+
/******/
37
+
/************************************************************************/
38
+
/******/ /* webpack/runtime/define property getters */
39
+
/******/ (() => {
40
+
/******/ // define getter functions for harmony exports
41
+
/******/ __webpack_require__.d = (exports, definition) => {
42
+
/******/ for(var key in definition) {
43
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
44
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
45
+
/******/ }
46
+
/******/ }
47
+
/******/ };
48
+
/******/ })();
49
+
/******/
50
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
51
+
/******/ (() => {
52
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
53
+
/******/ })();
54
+
/******/
55
+
/************************************************************************/
56
+
var __webpack_exports__ = {};
57
+
58
+
;// external "@wordpress/interactivity"
59
+
var x = (y) => {
60
+
var x = {}; __webpack_require__.d(x, y); return x
61
+
}
62
+
var y = (x) => (() => (x))
63
+
const 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), ["withSyncEvent"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.withSyncEvent) });
64
+
;// ./node_modules/@wordpress/block-library/build-module/query/view.js
65
+
66
+
const isValidLink = (ref) => ref && ref instanceof window.HTMLAnchorElement && ref.href && (!ref.target || ref.target === "_self") && ref.origin === window.location.origin;
67
+
const isValidEvent = (event) => event.button === 0 && // Left clicks only.
68
+
!event.metaKey && // Open in new tab (Mac).
69
+
!event.ctrlKey && // Open in new tab (Windows).
70
+
!event.altKey && // Download.
71
+
!event.shiftKey && !event.defaultPrevented;
72
+
(0,interactivity_namespaceObject.store)(
73
+
"core/query",
74
+
{
75
+
actions: {
76
+
navigate: (0,interactivity_namespaceObject.withSyncEvent)(function* (event) {
77
+
const ctx = (0,interactivity_namespaceObject.getContext)();
78
+
const { ref } = (0,interactivity_namespaceObject.getElement)();
79
+
const queryRef = ref.closest(
80
+
".wp-block-query[data-wp-router-region]"
81
+
);
82
+
if (isValidLink(ref) && isValidEvent(event)) {
83
+
event.preventDefault();
84
+
const { actions } = yield Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 438));
85
+
yield actions.navigate(ref.href);
86
+
ctx.url = ref.href;
87
+
const firstAnchor = `.wp-block-post-template a[href]`;
88
+
queryRef.querySelector(firstAnchor)?.focus();
89
+
}
90
+
}),
91
+
*prefetch() {
92
+
const { ref } = (0,interactivity_namespaceObject.getElement)();
93
+
if (isValidLink(ref)) {
94
+
const { actions } = yield Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 438));
95
+
yield actions.prefetch(ref.href);
96
+
}
97
+
}
98
+
},
99
+
callbacks: {
100
+
*prefetch() {
101
+
const { url } = (0,interactivity_namespaceObject.getContext)();
102
+
const { ref } = (0,interactivity_namespaceObject.getElement)();
103
+
if (url && isValidLink(ref)) {
104
+
const { actions } = yield Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 438));
105
+
yield actions.prefetch(ref.href);
106
+
}
107
+
}
108
+
}
109
+
},
110
+
{ lock: true }
111
+
);
112
+
113
+