first commit
This commit is contained in:
56
wp-includes/blocks/query/block.json
Normal file
56
wp-includes/blocks/query/block.json
Normal file
@ -0,0 +1,56 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "core/query",
|
||||
"title": "Query Loop",
|
||||
"category": "theme",
|
||||
"description": "An advanced block that allows displaying post types based on different query parameters and visual configurations.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
"queryId": {
|
||||
"type": "number"
|
||||
},
|
||||
"query": {
|
||||
"type": "object",
|
||||
"default": {
|
||||
"perPage": null,
|
||||
"pages": 0,
|
||||
"offset": 0,
|
||||
"postType": "post",
|
||||
"order": "desc",
|
||||
"orderBy": "date",
|
||||
"author": "",
|
||||
"search": "",
|
||||
"exclude": [],
|
||||
"sticky": "",
|
||||
"inherit": true,
|
||||
"taxQuery": null,
|
||||
"parents": []
|
||||
}
|
||||
},
|
||||
"tagName": {
|
||||
"type": "string",
|
||||
"default": "div"
|
||||
},
|
||||
"namespace": {
|
||||
"type": "string"
|
||||
},
|
||||
"enhancedPagination": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"providesContext": {
|
||||
"queryId": "queryId",
|
||||
"query": "query",
|
||||
"displayLayout": "displayLayout",
|
||||
"enhancedPagination": "enhancedPagination"
|
||||
},
|
||||
"supports": {
|
||||
"align": [ "wide", "full" ],
|
||||
"html": false,
|
||||
"layout": true,
|
||||
"interactivity": true
|
||||
},
|
||||
"editorStyle": "wp-block-query-editor"
|
||||
}
|
57
wp-includes/blocks/query/editor-rtl.css
Normal file
57
wp-includes/blocks/query/editor-rtl.css
Normal file
@ -0,0 +1,57 @@
|
||||
.block-library-query-toolbar__popover .components-popover__content{
|
||||
min-width:230px;
|
||||
}
|
||||
|
||||
.wp-block-query__create-new-link{
|
||||
padding:0 52px 16px 16px;
|
||||
}
|
||||
|
||||
.block-library-query__pattern-selection-content .block-editor-block-patterns-list{
|
||||
display:grid;
|
||||
grid-template-columns:1fr 1fr 1fr;
|
||||
grid-gap:8px;
|
||||
}
|
||||
.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{
|
||||
margin-bottom:0;
|
||||
}
|
||||
.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container{
|
||||
max-height:250px;
|
||||
}
|
||||
|
||||
.block-library-query-pattern__selection-modal .block-editor-block-patterns-list{
|
||||
column-count:2;
|
||||
column-gap:24px;
|
||||
}
|
||||
@media (min-width:1280px){
|
||||
.block-library-query-pattern__selection-modal .block-editor-block-patterns-list{
|
||||
column-count:3;
|
||||
}
|
||||
}
|
||||
.block-library-query-pattern__selection-modal .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{
|
||||
break-inside:avoid-column;
|
||||
}
|
||||
.block-library-query-pattern__selection-modal .block-library-query-pattern__selection-search{
|
||||
background:#fff;
|
||||
margin-bottom:2px;
|
||||
padding:16px 0;
|
||||
position:sticky;
|
||||
top:0;
|
||||
z-index:2;
|
||||
}
|
||||
|
||||
.block-library-query-toolspanel__filters .components-form-token-field__help{
|
||||
margin-bottom:0;
|
||||
}
|
||||
.block-library-query-toolspanel__filters .block-library-query-inspector__taxonomy-control:not(:last-child){
|
||||
margin-bottom:24px;
|
||||
}
|
||||
|
||||
@media (min-width:600px){
|
||||
.wp-block-query__enhanced-pagination-modal{
|
||||
max-width:480px;
|
||||
}
|
||||
}
|
||||
|
||||
.wp-block-query__enhanced-pagination-notice{
|
||||
margin:0;
|
||||
}
|
1
wp-includes/blocks/query/editor-rtl.min.css
vendored
Normal file
1
wp-includes/blocks/query/editor-rtl.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.block-library-query-toolbar__popover .components-popover__content{min-width:230px}.wp-block-query__create-new-link{padding:0 52px 16px 16px}.block-library-query__pattern-selection-content .block-editor-block-patterns-list{display:grid;grid-template-columns:1fr 1fr 1fr;grid-gap:8px}.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{margin-bottom:0}.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container{max-height:250px}.block-library-query-pattern__selection-modal .block-editor-block-patterns-list{column-count:2;column-gap:24px}@media (min-width:1280px){.block-library-query-pattern__selection-modal .block-editor-block-patterns-list{column-count:3}}.block-library-query-pattern__selection-modal .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{break-inside:avoid-column}.block-library-query-pattern__selection-modal .block-library-query-pattern__selection-search{background:#fff;margin-bottom:2px;padding:16px 0;position:sticky;top:0;z-index:2}.block-library-query-toolspanel__filters .components-form-token-field__help{margin-bottom:0}.block-library-query-toolspanel__filters .block-library-query-inspector__taxonomy-control:not(:last-child){margin-bottom:24px}@media (min-width:600px){.wp-block-query__enhanced-pagination-modal{max-width:480px}}.wp-block-query__enhanced-pagination-notice{margin:0}
|
57
wp-includes/blocks/query/editor.css
Normal file
57
wp-includes/blocks/query/editor.css
Normal file
@ -0,0 +1,57 @@
|
||||
.block-library-query-toolbar__popover .components-popover__content{
|
||||
min-width:230px;
|
||||
}
|
||||
|
||||
.wp-block-query__create-new-link{
|
||||
padding:0 16px 16px 52px;
|
||||
}
|
||||
|
||||
.block-library-query__pattern-selection-content .block-editor-block-patterns-list{
|
||||
display:grid;
|
||||
grid-template-columns:1fr 1fr 1fr;
|
||||
grid-gap:8px;
|
||||
}
|
||||
.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{
|
||||
margin-bottom:0;
|
||||
}
|
||||
.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container{
|
||||
max-height:250px;
|
||||
}
|
||||
|
||||
.block-library-query-pattern__selection-modal .block-editor-block-patterns-list{
|
||||
column-count:2;
|
||||
column-gap:24px;
|
||||
}
|
||||
@media (min-width:1280px){
|
||||
.block-library-query-pattern__selection-modal .block-editor-block-patterns-list{
|
||||
column-count:3;
|
||||
}
|
||||
}
|
||||
.block-library-query-pattern__selection-modal .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{
|
||||
break-inside:avoid-column;
|
||||
}
|
||||
.block-library-query-pattern__selection-modal .block-library-query-pattern__selection-search{
|
||||
background:#fff;
|
||||
margin-bottom:2px;
|
||||
padding:16px 0;
|
||||
position:sticky;
|
||||
top:0;
|
||||
z-index:2;
|
||||
}
|
||||
|
||||
.block-library-query-toolspanel__filters .components-form-token-field__help{
|
||||
margin-bottom:0;
|
||||
}
|
||||
.block-library-query-toolspanel__filters .block-library-query-inspector__taxonomy-control:not(:last-child){
|
||||
margin-bottom:24px;
|
||||
}
|
||||
|
||||
@media (min-width:600px){
|
||||
.wp-block-query__enhanced-pagination-modal{
|
||||
max-width:480px;
|
||||
}
|
||||
}
|
||||
|
||||
.wp-block-query__enhanced-pagination-notice{
|
||||
margin:0;
|
||||
}
|
1
wp-includes/blocks/query/editor.min.css
vendored
Normal file
1
wp-includes/blocks/query/editor.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.block-library-query-toolbar__popover .components-popover__content{min-width:230px}.wp-block-query__create-new-link{padding:0 16px 16px 52px}.block-library-query__pattern-selection-content .block-editor-block-patterns-list{display:grid;grid-template-columns:1fr 1fr 1fr;grid-gap:8px}.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{margin-bottom:0}.block-library-query__pattern-selection-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container{max-height:250px}.block-library-query-pattern__selection-modal .block-editor-block-patterns-list{column-count:2;column-gap:24px}@media (min-width:1280px){.block-library-query-pattern__selection-modal .block-editor-block-patterns-list{column-count:3}}.block-library-query-pattern__selection-modal .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item{break-inside:avoid-column}.block-library-query-pattern__selection-modal .block-library-query-pattern__selection-search{background:#fff;margin-bottom:2px;padding:16px 0;position:sticky;top:0;z-index:2}.block-library-query-toolspanel__filters .components-form-token-field__help{margin-bottom:0}.block-library-query-toolspanel__filters .block-library-query-inspector__taxonomy-control:not(:last-child){margin-bottom:24px}@media (min-width:600px){.wp-block-query__enhanced-pagination-modal{max-width:480px}}.wp-block-query__enhanced-pagination-notice{margin:0}
|
1
wp-includes/blocks/query/view.asset.php
Normal file
1
wp-includes/blocks/query/view.asset.php
Normal file
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => 'ee101e08820687c9c07f');
|
135
wp-includes/blocks/query/view.js
Normal file
135
wp-includes/blocks/query/view.js
Normal file
@ -0,0 +1,135 @@
|
||||
import * as __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__ from "@wordpress/interactivity";
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ 438:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = import("@wordpress/interactivity-router");;
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
/************************************************************************/
|
||||
/******/ // The module cache
|
||||
/******/ var __webpack_module_cache__ = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/ // Check if module is in cache
|
||||
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
||||
/******/ if (cachedModule !== undefined) {
|
||||
/******/ return cachedModule.exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||||
/******/ // no module.id needed
|
||||
/******/ // no module.loaded needed
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/ /* webpack/runtime/define property getters */
|
||||
/******/ (() => {
|
||||
/******/ // define getter functions for harmony exports
|
||||
/******/ __webpack_require__.d = (exports, definition) => {
|
||||
/******/ for(var key in definition) {
|
||||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
||||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
||||
/******/ (() => {
|
||||
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
||||
/******/ })();
|
||||
/******/
|
||||
/************************************************************************/
|
||||
var __webpack_exports__ = {};
|
||||
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
||||
(() => {
|
||||
|
||||
;// CONCATENATED MODULE: external "@wordpress/interactivity"
|
||||
var x = (y) => {
|
||||
var x = {}; __webpack_require__.d(x, y); return x
|
||||
}
|
||||
var y = (x) => (() => (x))
|
||||
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) });
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/view.js
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
const isValidLink = ref => ref && ref instanceof window.HTMLAnchorElement && ref.href && (!ref.target || ref.target === '_self') && ref.origin === window.location.origin;
|
||||
const isValidEvent = event => event.button === 0 &&
|
||||
// Left clicks only.
|
||||
!event.metaKey &&
|
||||
// Open in new tab (Mac).
|
||||
!event.ctrlKey &&
|
||||
// Open in new tab (Windows).
|
||||
!event.altKey &&
|
||||
// Download.
|
||||
!event.shiftKey && !event.defaultPrevented;
|
||||
(0,interactivity_namespaceObject.store)('core/query', {
|
||||
actions: {
|
||||
*navigate(event) {
|
||||
const ctx = (0,interactivity_namespaceObject.getContext)();
|
||||
const {
|
||||
ref
|
||||
} = (0,interactivity_namespaceObject.getElement)();
|
||||
const queryRef = ref.closest('.wp-block-query[data-wp-router-region]');
|
||||
if (isValidLink(ref) && isValidEvent(event)) {
|
||||
event.preventDefault();
|
||||
const {
|
||||
actions
|
||||
} = yield Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 438));
|
||||
yield actions.navigate(ref.href);
|
||||
ctx.url = ref.href;
|
||||
|
||||
// Focus the first anchor of the Query block.
|
||||
const firstAnchor = `.wp-block-post-template a[href]`;
|
||||
queryRef.querySelector(firstAnchor)?.focus();
|
||||
}
|
||||
},
|
||||
*prefetch() {
|
||||
const {
|
||||
ref
|
||||
} = (0,interactivity_namespaceObject.getElement)();
|
||||
if (isValidLink(ref)) {
|
||||
const {
|
||||
actions
|
||||
} = yield Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 438));
|
||||
yield actions.prefetch(ref.href);
|
||||
}
|
||||
}
|
||||
},
|
||||
callbacks: {
|
||||
*prefetch() {
|
||||
const {
|
||||
url
|
||||
} = (0,interactivity_namespaceObject.getContext)();
|
||||
const {
|
||||
ref
|
||||
} = (0,interactivity_namespaceObject.getElement)();
|
||||
if (url && isValidLink(ref)) {
|
||||
const {
|
||||
actions
|
||||
} = yield Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 438));
|
||||
yield actions.prefetch(ref.href);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
lock: true
|
||||
});
|
||||
|
||||
})();
|
||||
|
1
wp-includes/blocks/query/view.min.asset.php
Normal file
1
wp-includes/blocks/query/view.min.asset.php
Normal file
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '490915f92cc794ea16e1');
|
1
wp-includes/blocks/query/view.min.js
vendored
Normal file
1
wp-includes/blocks/query/view.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
import*as e from"@wordpress/interactivity";var t={438:e=>{e.exports=import("@wordpress/interactivity-router")}},r={};function o(e){var n=r[e];if(void 0!==n)return n.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{const t=(e=>{var t={};return o.d(t,e),t})({getContext:()=>e.getContext,getElement:()=>e.getElement,store:()=>e.store}),r=e=>e&&e instanceof window.HTMLAnchorElement&&e.href&&(!e.target||"_self"===e.target)&&e.origin===window.location.origin;(0,t.store)("core/query",{actions:{*navigate(e){const n=(0,t.getContext)(),{ref:i}=(0,t.getElement)(),s=i.closest(".wp-block-query[data-wp-router-region]");if(r(i)&&(e=>!(0!==e.button||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.defaultPrevented))(e)){e.preventDefault();const{actions:t}=yield Promise.resolve().then(o.bind(o,438));yield t.navigate(i.href),n.url=i.href;const r=".wp-block-post-template a[href]";s.querySelector(r)?.focus()}},*prefetch(){const{ref:e}=(0,t.getElement)();if(r(e)){const{actions:t}=yield Promise.resolve().then(o.bind(o,438));yield t.prefetch(e.href)}}},callbacks:{*prefetch(){const{url:e}=(0,t.getContext)(),{ref:n}=(0,t.getElement)();if(e&&r(n)){const{actions:e}=yield Promise.resolve().then(o.bind(o,438));yield e.prefetch(n.href)}}}},{lock:!0})})();
|
Reference in New Issue
Block a user