@wordpress/block-library 9.7.1-next.5368f64a9.0 → 9.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/categories/edit.js +38 -17
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +10 -3
- package/build/categories/index.js.map +1 -1
- package/build/categories/variations.js +43 -0
- package/build/categories/variations.js.map +1 -0
- package/build/embed/edit.js +1 -0
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js +1 -0
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/embed-preview.js +80 -100
- package/build/embed/embed-preview.js.map +1 -1
- package/build/embed/embed-preview.native.js +1 -0
- package/build/embed/embed-preview.native.js.map +1 -1
- package/build/form/view.js +1 -0
- package/build/form/view.js.map +1 -1
- package/build/form-input/deprecated.js +113 -1
- package/build/form-input/deprecated.js.map +1 -1
- package/build/form-input/edit.js +16 -12
- package/build/form-input/edit.js.map +1 -1
- package/build/form-input/save.js +9 -1
- package/build/form-input/save.js.map +1 -1
- package/build/image/image.js +5 -2
- package/build/image/image.js.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/navigation-submenu/index.js +13 -0
- package/build/navigation-submenu/index.js.map +1 -1
- package/build/post-template/edit.js +6 -1
- package/build/post-template/edit.js.map +1 -1
- package/build/post-title/index.js +1 -4
- package/build/post-title/index.js.map +1 -1
- package/build/query/edit/inspector-controls/format-controls.js +102 -0
- package/build/query/edit/inspector-controls/format-controls.js.map +1 -0
- package/build/query/edit/inspector-controls/index.js +45 -9
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/query-content.js +26 -10
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/index.js +3 -1
- package/build/query/index.js.map +1 -1
- package/build/query/utils.js +12 -1
- package/build/query/utils.js.map +1 -1
- package/build/site-title/index.js +1 -4
- package/build/site-title/index.js.map +1 -1
- package/build/social-link/edit.js +13 -11
- package/build/social-link/edit.js.map +1 -1
- package/build-module/categories/edit.js +40 -19
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +10 -3
- package/build-module/categories/index.js.map +1 -1
- package/build-module/categories/variations.js +36 -0
- package/build-module/categories/variations.js.map +1 -0
- package/build-module/embed/edit.js +1 -0
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js +1 -0
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/embed-preview.js +80 -100
- package/build-module/embed/embed-preview.js.map +1 -1
- package/build-module/embed/embed-preview.native.js +1 -0
- package/build-module/embed/embed-preview.native.js.map +1 -1
- package/build-module/form/view.js +1 -0
- package/build-module/form/view.js.map +1 -1
- package/build-module/form-input/deprecated.js +114 -2
- package/build-module/form-input/deprecated.js.map +1 -1
- package/build-module/form-input/edit.js +16 -12
- package/build-module/form-input/edit.js.map +1 -1
- package/build-module/form-input/save.js +9 -1
- package/build-module/form-input/save.js.map +1 -1
- package/build-module/image/image.js +5 -2
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/navigation-submenu/index.js +13 -0
- package/build-module/navigation-submenu/index.js.map +1 -1
- package/build-module/post-template/edit.js +6 -1
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-title/index.js +1 -4
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/format-controls.js +96 -0
- package/build-module/query/edit/inspector-controls/format-controls.js.map +1 -0
- package/build-module/query/edit/inspector-controls/index.js +45 -9
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/query-content.js +27 -11
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/index.js +3 -1
- package/build-module/query/index.js.map +1 -1
- package/build-module/query/utils.js +12 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/site-title/index.js +1 -4
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-link/edit.js +14 -12
- package/build-module/social-link/edit.js.map +1 -1
- package/build-style/editor-rtl.css +1 -1
- package/build-style/editor.css +1 -1
- package/build-style/form-input/style-rtl.css +7 -8
- package/build-style/form-input/style.css +7 -8
- package/build-style/gallery/editor-rtl.css +1 -1
- package/build-style/gallery/editor.css +1 -1
- package/build-style/post-title/style-rtl.css +4 -18
- package/build-style/post-title/style.css +4 -18
- package/build-style/site-title/style-rtl.css +4 -18
- package/build-style/site-title/style.css +4 -18
- package/build-style/style-rtl.css +15 -44
- package/build-style/style.css +15 -44
- package/package.json +35 -35
- package/src/categories/block.json +7 -2
- package/src/categories/edit.js +69 -30
- package/src/categories/index.js +2 -0
- package/src/categories/index.php +21 -9
- package/src/categories/variations.js +40 -0
- package/src/comments-pagination-next/index.php +1 -1
- package/src/comments-pagination-previous/index.php +2 -1
- package/src/embed/embed-preview.js +96 -112
- package/src/form-input/deprecated.js +114 -1
- package/src/form-input/edit.js +17 -11
- package/src/form-input/save.js +13 -3
- package/src/form-input/style.scss +9 -8
- package/src/image/image.js +2 -1
- package/src/navigation-submenu/block.json +13 -0
- package/src/post-template/edit.js +6 -0
- package/src/post-template/index.php +5 -0
- package/src/post-title/block.json +1 -4
- package/src/post-title/style.scss +4 -21
- package/src/query/block.json +3 -1
- package/src/query/edit/inspector-controls/format-controls.js +90 -0
- package/src/query/edit/inspector-controls/index.js +68 -9
- package/src/query/edit/query-content.js +38 -5
- package/src/query/utils.js +16 -1
- package/src/site-title/block.json +1 -4
- package/src/site-title/style.scss +4 -21
- package/src/social-link/edit.js +11 -7
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
5
|
import { useInstanceId } from '@wordpress/compose';
|
|
6
|
-
import { useEffect } from '@wordpress/element';
|
|
6
|
+
import { useEffect, useCallback } from '@wordpress/element';
|
|
7
7
|
import { BlockControls, InspectorControls, useBlockProps, store as blockEditorStore, useInnerBlocksProps } from '@wordpress/block-editor';
|
|
8
8
|
import { SelectControl } from '@wordpress/components';
|
|
9
9
|
import { __ } from '@wordpress/i18n';
|
|
@@ -26,7 +26,8 @@ export default function QueryContent({
|
|
|
26
26
|
setAttributes,
|
|
27
27
|
openPatternSelectionModal,
|
|
28
28
|
name,
|
|
29
|
-
clientId
|
|
29
|
+
clientId,
|
|
30
|
+
context
|
|
30
31
|
}) {
|
|
31
32
|
const {
|
|
32
33
|
queryId,
|
|
@@ -38,6 +39,9 @@ export default function QueryContent({
|
|
|
38
39
|
inherit
|
|
39
40
|
} = {}
|
|
40
41
|
} = attributes;
|
|
42
|
+
const {
|
|
43
|
+
postType
|
|
44
|
+
} = context;
|
|
41
45
|
const {
|
|
42
46
|
__unstableMarkNextChangeAsNotPersistent
|
|
43
47
|
} = useDispatch(blockEditorStore);
|
|
@@ -46,6 +50,12 @@ export default function QueryContent({
|
|
|
46
50
|
const innerBlocksProps = useInnerBlocksProps(blockProps, {
|
|
47
51
|
template: TEMPLATE
|
|
48
52
|
});
|
|
53
|
+
const isTemplate = useSelect(select => {
|
|
54
|
+
const currentTemplate = select(coreStore).__experimentalGetTemplateForLink()?.type;
|
|
55
|
+
const isInTemplate = 'wp_template' === currentTemplate;
|
|
56
|
+
const isInSingularContent = postType !== undefined;
|
|
57
|
+
return isInTemplate && !isInSingularContent;
|
|
58
|
+
}, [postType]);
|
|
49
59
|
const {
|
|
50
60
|
postsPerPage
|
|
51
61
|
} = useSelect(select => {
|
|
@@ -79,6 +89,12 @@ export default function QueryContent({
|
|
|
79
89
|
// Changes in query property (which is an object) need to be in the same callback,
|
|
80
90
|
// because updates are batched after the render and changes in different query properties
|
|
81
91
|
// would cause to override previous wanted changes.
|
|
92
|
+
const updateQuery = useCallback(newQuery => setAttributes({
|
|
93
|
+
query: {
|
|
94
|
+
...query,
|
|
95
|
+
...newQuery
|
|
96
|
+
}
|
|
97
|
+
}), [query, setAttributes]);
|
|
82
98
|
useEffect(() => {
|
|
83
99
|
const newQuery = {};
|
|
84
100
|
// When we inherit from global query always need to set the `perPage`
|
|
@@ -88,11 +104,16 @@ export default function QueryContent({
|
|
|
88
104
|
} else if (!query.perPage && postsPerPage) {
|
|
89
105
|
newQuery.perPage = postsPerPage;
|
|
90
106
|
}
|
|
107
|
+
// We need to reset the `inherit` value if not in a template, as queries
|
|
108
|
+
// are not inherited when outside a template (e.g. when in singular content).
|
|
109
|
+
if (!isTemplate && query.inherit) {
|
|
110
|
+
newQuery.inherit = false;
|
|
111
|
+
}
|
|
91
112
|
if (!!Object.keys(newQuery).length) {
|
|
92
113
|
__unstableMarkNextChangeAsNotPersistent();
|
|
93
114
|
updateQuery(newQuery);
|
|
94
115
|
}
|
|
95
|
-
}, [query.perPage, postsPerPage, inherit]);
|
|
116
|
+
}, [query.perPage, postsPerPage, inherit, isTemplate, query.inherit, __unstableMarkNextChangeAsNotPersistent, updateQuery]);
|
|
96
117
|
// We need this for multi-query block pagination.
|
|
97
118
|
// Query parameters for each block are scoped to their ID.
|
|
98
119
|
useEffect(() => {
|
|
@@ -102,13 +123,7 @@ export default function QueryContent({
|
|
|
102
123
|
queryId: instanceId
|
|
103
124
|
});
|
|
104
125
|
}
|
|
105
|
-
}, [queryId, instanceId]);
|
|
106
|
-
const updateQuery = newQuery => setAttributes({
|
|
107
|
-
query: {
|
|
108
|
-
...query,
|
|
109
|
-
...newQuery
|
|
110
|
-
}
|
|
111
|
-
});
|
|
126
|
+
}, [queryId, instanceId, __unstableMarkNextChangeAsNotPersistent, setAttributes]);
|
|
112
127
|
const updateDisplayLayout = newDisplayLayout => setAttributes({
|
|
113
128
|
displayLayout: {
|
|
114
129
|
...displayLayout,
|
|
@@ -131,7 +146,8 @@ export default function QueryContent({
|
|
|
131
146
|
setQuery: updateQuery,
|
|
132
147
|
setDisplayLayout: updateDisplayLayout,
|
|
133
148
|
setAttributes: setAttributes,
|
|
134
|
-
clientId: clientId
|
|
149
|
+
clientId: clientId,
|
|
150
|
+
isTemplate: isTemplate
|
|
135
151
|
})
|
|
136
152
|
}), /*#__PURE__*/_jsx(BlockControls, {
|
|
137
153
|
children: /*#__PURE__*/_jsx(QueryToolbar, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","useInstanceId","useEffect","BlockControls","InspectorControls","useBlockProps","store","blockEditorStore","useInnerBlocksProps","SelectControl","__","coreStore","EnhancedPaginationControl","QueryToolbar","QueryInspectorControls","EnhancedPaginationModal","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","DEFAULTS_POSTS_PER_PAGE","TEMPLATE","QueryContent","attributes","setAttributes","openPatternSelectionModal","name","clientId","queryId","query","displayLayout","enhancedPagination","tagName","TagName","inherit","__unstableMarkNextChangeAsNotPersistent","instanceId","blockProps","innerBlocksProps","template","postsPerPage","select","getSettings","getEntityRecord","getEntityRecordEdits","canUser","settingPerPage","kind","posts_per_page","editedSettingPerPage","newQuery","perPage","Object","keys","length","updateQuery","Number","isFinite","updateDisplayLayout","newDisplayLayout","htmlElementMessages","main","section","aside","children","setQuery","setDisplayLayout","group","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help"],"sources":["@wordpress/block-library/src/query/edit/query-content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EnhancedPaginationControl from './inspector-controls/enhanced-pagination-control';\nimport QueryToolbar from './query-toolbar';\nimport QueryInspectorControls from './inspector-controls';\nimport EnhancedPaginationModal from './enhanced-pagination-modal';\n\nconst DEFAULTS_POSTS_PER_PAGE = 3;\n\nconst TEMPLATE = [ [ 'core/post-template' ] ];\nexport default function QueryContent( {\n\tattributes,\n\tsetAttributes,\n\topenPatternSelectionModal,\n\tname,\n\tclientId,\n} ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tdisplayLayout,\n\t\tenhancedPagination,\n\t\ttagName: TagName = 'div',\n\t\tquery: { inherit } = {},\n\t} = attributes;\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\tconst { postsPerPage } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getEntityRecord, getEntityRecordEdits, canUser } =\n\t\t\tselect( coreStore );\n\t\tconst settingPerPage = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? +getEntityRecord( 'root', 'site' )?.posts_per_page\n\t\t\t: +getSettings().postsPerPage;\n\n\t\t// Gets changes made via the template area posts per page setting. These won't be saved\n\t\t// until the page is saved, but we should reflect this setting within the query loops\n\t\t// that inherit it.\n\t\tconst editedSettingPerPage = +getEntityRecordEdits( 'root', 'site' )\n\t\t\t?.posts_per_page;\n\n\t\treturn {\n\t\t\tpostsPerPage:\n\t\t\t\teditedSettingPerPage ||\n\t\t\t\tsettingPerPage ||\n\t\t\t\tDEFAULTS_POSTS_PER_PAGE,\n\t\t};\n\t}, [] );\n\t// There are some effects running where some initialization logic is\n\t// happening and setting some values to some attributes (ex. queryId).\n\t// These updates can cause an `undo trap` where undoing will result in\n\t// resetting again, so we need to mark these changes as not persistent\n\t// with `__unstableMarkNextChangeAsNotPersistent`.\n\n\t// Changes in query property (which is an object) need to be in the same callback,\n\t// because updates are batched after the render and changes in different query properties\n\t// would cause to override previous wanted changes.\n\tuseEffect( () => {\n\t\tconst newQuery = {};\n\t\t// When we inherit from global query always need to set the `perPage`\n\t\t// based on the reading settings.\n\t\tif ( inherit && query.perPage !== postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t} else if ( ! query.perPage && postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t}\n\t\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [ query.perPage, postsPerPage, inherit ] );\n\t// We need this for multi-query block pagination.\n\t// Query parameters for each block are scoped to their ID.\n\tuseEffect( () => {\n\t\tif ( ! Number.isFinite( queryId ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { queryId: instanceId } );\n\t\t}\n\t}, [ queryId, instanceId ] );\n\tconst updateQuery = ( newQuery ) =>\n\t\tsetAttributes( { query: { ...query, ...newQuery } } );\n\tconst updateDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tdisplayLayout: { ...displayLayout, ...newDisplayLayout },\n\t\t} );\n\tconst htmlElementMessages = {\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only.'\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<EnhancedPaginationModal\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t<InspectorControls>\n\t\t\t\t<QueryInspectorControls\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetDisplayLayout={ updateDisplayLayout }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls>\n\t\t\t\t<QueryToolbar\n\t\t\t\t\tname={ name }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\topenPatternSelectionModal={ openPatternSelectionModal }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ TagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ TagName ] }\n\t\t\t\t/>\n\t\t\t\t<EnhancedPaginationControl\n\t\t\t\t\tenhancedPagination={ enhancedPagination }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SACCC,aAAa,EACbC,iBAAiB,EACjBC,aAAa,EACbC,KAAK,IAAIC,gBAAgB,EACzBC,mBAAmB,QACb,yBAAyB;AAChC,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,EAAE,QAA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AG,CACT;UAAED,KAAK,EAAE9D,EAAE,CAAE,iBAAkB,CAAC;UAAEgE,KAAK,EAAE;QAAM,CAAC,EAChD;UAAEF,KAAK,EAAE,QAAQ;UAAEE,KAAK,EAAE;QAAO,CAAC,EAClC;UAAEF,KAAK,EAAE,WAAW;UAAEE,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEF,KAAK,EAAE,SAAS;UAAEE,KAAK,EAAE;QAAQ,CAAC,CAClC;QACHA,KAAK,EAAGvC,OAAS;QACjBwC,QAAQ,EAAKD,KAAK,IACjBhD,aAAa,CAAE;UAAEQ,OAAO,EAAEwC;QAAM,CAAE,CAClC;QACDE,IAAI,EAAGd,mBAAmB,CAAE3B,OAAO;MAAI,CACvC,CAAC,eACFlB,IAAA,CAACL,yBAAyB;QACzBqB,kBAAkB,EAAGA,kBAAoB;QACzCP,aAAa,EAAGA,aAAe;QAC/BG,QAAQ,EAAGA;MAAU,CACrB,CAAC;IAAA,CACgB,CAAC,eACpBZ,IAAA,CAACkB,OAAO;MAAA,GAAMK;IAAgB,CAAI,CAAC;EAAA,CAClC,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","useInstanceId","useEffect","useCallback","BlockControls","InspectorControls","useBlockProps","store","blockEditorStore","useInnerBlocksProps","SelectControl","__","coreStore","EnhancedPaginationControl","QueryToolbar","QueryInspectorControls","EnhancedPaginationModal","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","DEFAULTS_POSTS_PER_PAGE","TEMPLATE","QueryContent","attributes","setAttributes","openPatternSelectionModal","name","clientId","context","queryId","query","displayLayout","enhancedPagination","tagName","TagName","inherit","postType","__unstableMarkNextChangeAsNotPersistent","instanceId","blockProps","innerBlocksProps","template","isTemplate","select","currentTemplate","__experimentalGetTemplateForLink","type","isInTemplate","isInSingularContent","undefined","postsPerPage","getSettings","getEntityRecord","getEntityRecordEdits","canUser","settingPerPage","kind","posts_per_page","editedSettingPerPage","updateQuery","newQuery","perPage","Object","keys","length","Number","isFinite","updateDisplayLayout","newDisplayLayout","htmlElementMessages","main","section","aside","children","setQuery","setDisplayLayout","group","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help"],"sources":["@wordpress/block-library/src/query/edit/query-content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EnhancedPaginationControl from './inspector-controls/enhanced-pagination-control';\nimport QueryToolbar from './query-toolbar';\nimport QueryInspectorControls from './inspector-controls';\nimport EnhancedPaginationModal from './enhanced-pagination-modal';\n\nconst DEFAULTS_POSTS_PER_PAGE = 3;\n\nconst TEMPLATE = [ [ 'core/post-template' ] ];\nexport default function QueryContent( {\n\tattributes,\n\tsetAttributes,\n\topenPatternSelectionModal,\n\tname,\n\tclientId,\n\tcontext,\n} ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tdisplayLayout,\n\t\tenhancedPagination,\n\t\ttagName: TagName = 'div',\n\t\tquery: { inherit } = {},\n\t} = attributes;\n\tconst { postType } = context;\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\tconst isTemplate = useSelect(\n\t\t( select ) => {\n\t\t\tconst currentTemplate =\n\t\t\t\tselect( coreStore ).__experimentalGetTemplateForLink()?.type;\n\t\t\tconst isInTemplate = 'wp_template' === currentTemplate;\n\t\t\tconst isInSingularContent = postType !== undefined;\n\t\t\treturn isInTemplate && ! isInSingularContent;\n\t\t},\n\t\t[ postType ]\n\t);\n\tconst { postsPerPage } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getEntityRecord, getEntityRecordEdits, canUser } =\n\t\t\tselect( coreStore );\n\t\tconst settingPerPage = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? +getEntityRecord( 'root', 'site' )?.posts_per_page\n\t\t\t: +getSettings().postsPerPage;\n\n\t\t// Gets changes made via the template area posts per page setting. These won't be saved\n\t\t// until the page is saved, but we should reflect this setting within the query loops\n\t\t// that inherit it.\n\t\tconst editedSettingPerPage = +getEntityRecordEdits( 'root', 'site' )\n\t\t\t?.posts_per_page;\n\n\t\treturn {\n\t\t\tpostsPerPage:\n\t\t\t\teditedSettingPerPage ||\n\t\t\t\tsettingPerPage ||\n\t\t\t\tDEFAULTS_POSTS_PER_PAGE,\n\t\t};\n\t}, [] );\n\t// There are some effects running where some initialization logic is\n\t// happening and setting some values to some attributes (ex. queryId).\n\t// These updates can cause an `undo trap` where undoing will result in\n\t// resetting again, so we need to mark these changes as not persistent\n\t// with `__unstableMarkNextChangeAsNotPersistent`.\n\n\t// Changes in query property (which is an object) need to be in the same callback,\n\t// because updates are batched after the render and changes in different query properties\n\t// would cause to override previous wanted changes.\n\tconst updateQuery = useCallback(\n\t\t( newQuery ) => setAttributes( { query: { ...query, ...newQuery } } ),\n\t\t[ query, setAttributes ]\n\t);\n\tuseEffect( () => {\n\t\tconst newQuery = {};\n\t\t// When we inherit from global query always need to set the `perPage`\n\t\t// based on the reading settings.\n\t\tif ( inherit && query.perPage !== postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t} else if ( ! query.perPage && postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t}\n\t\t// We need to reset the `inherit` value if not in a template, as queries\n\t\t// are not inherited when outside a template (e.g. when in singular content).\n\t\tif ( ! isTemplate && query.inherit ) {\n\t\t\tnewQuery.inherit = false;\n\t\t}\n\t\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [\n\t\tquery.perPage,\n\t\tpostsPerPage,\n\t\tinherit,\n\t\tisTemplate,\n\t\tquery.inherit,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tupdateQuery,\n\t] );\n\t// We need this for multi-query block pagination.\n\t// Query parameters for each block are scoped to their ID.\n\tuseEffect( () => {\n\t\tif ( ! Number.isFinite( queryId ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { queryId: instanceId } );\n\t\t}\n\t}, [\n\t\tqueryId,\n\t\tinstanceId,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetAttributes,\n\t] );\n\tconst updateDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tdisplayLayout: { ...displayLayout, ...newDisplayLayout },\n\t\t} );\n\tconst htmlElementMessages = {\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only.'\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<EnhancedPaginationModal\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t<InspectorControls>\n\t\t\t\t<QueryInspectorControls\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetDisplayLayout={ updateDisplayLayout }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisTemplate={ isTemplate }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls>\n\t\t\t\t<QueryToolbar\n\t\t\t\t\tname={ name }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\topenPatternSelectionModal={ openPatternSelectionModal }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ TagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ TagName ] }\n\t\t\t\t/>\n\t\t\t\t<EnhancedPaginationControl\n\t\t\t\t\tenhancedPagination={ enhancedPagination }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,EAAEC,WAAW,QAAQ,oBAAoB;AAC3D,SACCC,aAAa,EACbC,iBAAiB,EACjBC,aAAa,EACbC,KAAK,IAAIC,gBAAgB,EACzBC,mBAAmB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BAAyB;QACzBsB,kBAAkB,EAAGA,kBAAoB;QACzCR,aAAa,EAAGA,aAAe;QAC/BG,QAAQ,EAAGA;MAAU,CACrB,CAAC;IAAA,CACgB,CAAC,eACpBZ,IAAA,CAACmB,OAAO;MAAA,GAAMM;IAAgB,CAAI,CAAC;EAAA,CAClC,CAAC;AAEL","ignoreList":[]}
|
|
@@ -34,7 +34,8 @@ const metadata = {
|
|
|
34
34
|
sticky: "",
|
|
35
35
|
inherit: true,
|
|
36
36
|
taxQuery: null,
|
|
37
|
-
parents: []
|
|
37
|
+
parents: [],
|
|
38
|
+
format: []
|
|
38
39
|
}
|
|
39
40
|
},
|
|
40
41
|
tagName: {
|
|
@@ -49,6 +50,7 @@ const metadata = {
|
|
|
49
50
|
"default": false
|
|
50
51
|
}
|
|
51
52
|
},
|
|
53
|
+
usesContext: ["postType"],
|
|
52
54
|
providesContext: {
|
|
53
55
|
queryId: "queryId",
|
|
54
56
|
query: "query",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["loop","icon","initBlock","metadata","$schema","apiVersion","name","title","category","description","textdomain","attributes","queryId","type","query","perPage","pages","offset","postType","order","orderBy","author","search","exclude","sticky","inherit","taxQuery","parents","tagName","namespace","enhancedPagination","providesContext","displayLayout","supports","align","html","layout","interactivity","editorStyle","edit","save","variations","deprecated","settings","example","viewportWidth","innerBlocks","columnCount","init"],"sources":["@wordpress/block-library/src/query/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { loop as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport variations from './variations';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\texample: {\n\t\tviewportWidth: 650,\n\t\tattributes: {\n\t\t\tnamespace: 'core/posts-list',\n\t\t\tquery: {\n\t\t\t\tperPage: 4,\n\t\t\t\tpages: 1,\n\t\t\t\toffset: 0,\n\t\t\t\tpostType: 'post',\n\t\t\t\torder: 'desc',\n\t\t\t\torderBy: 'date',\n\t\t\t\tauthor: '',\n\t\t\t\tsearch: '',\n\t\t\t\tsticky: 'exclude',\n\t\t\t\tinherit: false,\n\t\t\t},\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/post-template',\n\t\t\t\tattributes: {\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'grid',\n\t\t\t\t\t\tcolumnCount: 2,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tinnerBlocks: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/post-title',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/post-date',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/post-excerpt',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\tsave,\n\tvariations,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,IAAIC,IAAI,QAAQ,kBAAkB;;AAE/C;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,OAAA;MAAAC,IAAA;IAAA;IAAAC,KAAA;MAAAD,IAAA;MAAA;QAAAE,OAAA;QAAAC,KAAA;QAAAC,MAAA;QAAAC,QAAA;QAAAC,KAAA;QAAAC,OAAA;QAAAC,MAAA;QAAAC,MAAA;QAAAC,OAAA;QAAAC,MAAA;QAAAC,OAAA;QAAAC,QAAA;QAAAC,OAAA;MAAA;IAAA;IAAAC,OAAA;
|
|
1
|
+
{"version":3,"names":["loop","icon","initBlock","metadata","$schema","apiVersion","name","title","category","description","textdomain","attributes","queryId","type","query","perPage","pages","offset","postType","order","orderBy","author","search","exclude","sticky","inherit","taxQuery","parents","format","tagName","namespace","enhancedPagination","usesContext","providesContext","displayLayout","supports","align","html","layout","interactivity","editorStyle","edit","save","variations","deprecated","settings","example","viewportWidth","innerBlocks","columnCount","init"],"sources":["@wordpress/block-library/src/query/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { loop as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport variations from './variations';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\texample: {\n\t\tviewportWidth: 650,\n\t\tattributes: {\n\t\t\tnamespace: 'core/posts-list',\n\t\t\tquery: {\n\t\t\t\tperPage: 4,\n\t\t\t\tpages: 1,\n\t\t\t\toffset: 0,\n\t\t\t\tpostType: 'post',\n\t\t\t\torder: 'desc',\n\t\t\t\torderBy: 'date',\n\t\t\t\tauthor: '',\n\t\t\t\tsearch: '',\n\t\t\t\tsticky: 'exclude',\n\t\t\t\tinherit: false,\n\t\t\t},\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/post-template',\n\t\t\t\tattributes: {\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'grid',\n\t\t\t\t\t\tcolumnCount: 2,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tinnerBlocks: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/post-title',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/post-date',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/post-excerpt',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\tsave,\n\tvariations,\n\tdeprecated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E;QACNC,OAAO,EAAE,CAAC;QACVC,KAAK,EAAE,CAAC;QACRC,MAAM,EAAE,CAAC;QACTC,QAAQ,EAAE,MAAM;QAChBC,KAAK,EAAE,MAAM;QACbC,OAAO,EAAE,MAAM;QACfC,MAAM,EAAE,EAAE;QACVC,MAAM,EAAE,EAAE;QACVE,MAAM,EAAE,SAAS;QACjBC,OAAO,EAAE;MACV;IACD,CAAC;IACDuB,WAAW,EAAE,CACZ;MACC1C,IAAI,EAAE,oBAAoB;MAC1BK,UAAU,EAAE;QACX2B,MAAM,EAAE;UACPzB,IAAI,EAAE,MAAM;UACZoC,WAAW,EAAE;QACd;MACD,CAAC;MACDD,WAAW,EAAE,CACZ;QACC1C,IAAI,EAAE;MACP,CAAC,EACD;QACCA,IAAI,EAAE;MACP,CAAC,EACD;QACCA,IAAI,EAAE;MACP,CAAC;IAEH,CAAC;EAEH,CAAC;EACDoC,IAAI;EACJC,UAAU;EACVC;AACD,CAAC;AAED,OAAO,MAAMM,IAAI,GAAGA,CAAA,KAAMhD,SAAS,CAAE;EAAEI,IAAI;EAAEH,QAAQ;EAAE0C;AAAS,CAAE,CAAC","ignoreList":[]}
|
|
@@ -95,6 +95,7 @@ export const mapToIHasNameAndId = (entities, path) => {
|
|
|
95
95
|
* Returns a helper object that contains:
|
|
96
96
|
* 1. An `options` object from the available post types, to be passed to a `SelectControl`.
|
|
97
97
|
* 2. A helper map with available taxonomies per post type.
|
|
98
|
+
* 3. A helper map with post format support per post type.
|
|
98
99
|
*
|
|
99
100
|
* @return {Object} The helper object related to post types.
|
|
100
101
|
*/
|
|
@@ -128,9 +129,19 @@ export const usePostTypes = () => {
|
|
|
128
129
|
label: labels.singular_name,
|
|
129
130
|
value: slug
|
|
130
131
|
})), [postTypes]);
|
|
132
|
+
const postTypeFormatSupportMap = useMemo(() => {
|
|
133
|
+
if (!postTypes?.length) {
|
|
134
|
+
return {};
|
|
135
|
+
}
|
|
136
|
+
return postTypes.reduce((accumulator, type) => {
|
|
137
|
+
accumulator[type.slug] = type.supports?.['post-formats'] || false;
|
|
138
|
+
return accumulator;
|
|
139
|
+
}, {});
|
|
140
|
+
}, [postTypes]);
|
|
131
141
|
return {
|
|
132
142
|
postTypesTaxonomiesMap,
|
|
133
|
-
postTypesSelectOptions
|
|
143
|
+
postTypesSelectOptions,
|
|
144
|
+
postTypeFormatSupportMap
|
|
134
145
|
};
|
|
135
146
|
};
|
|
136
147
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useMemo","store","coreStore","blockEditorStore","decodeEntities","cloneBlock","getBlockSupport","blocksStore","getEntitiesInfo","entities","mapping","reduce","accumulator","entity","mapById","mapByName","names","id","name","push","getValueFromObjectPath","object","path","normalizedPath","split","value","forEach","fieldName","mapToIHasNameAndId","map","usePostTypes","postTypes","select","getPostTypes","excludedPostTypes","filteredPostTypes","per_page","filter","viewable","slug","includes","postTypesTaxonomiesMap","length","type","taxonomies","postTypesSelectOptions","labels","label","singular_name","useTaxonomies","postType","getTaxonomies","getPostType","visibility","publicly_queryable","useIsPostTypeHierarchical","hierarchical","useAllowedControls","attributes","getActiveBlockVariation","allowedControls","isControlAllowed","key","getTransformedBlocksFromPattern","blocks","queryBlockAttributes","query","inherit","namespace","clonedBlocks","block","queryClientIds","blocksQueue","shift","clientId","innerBlocks","innerBlock","newBlocks","useBlockNameForPatterns","activeVariationName","blockName","hasActiveVariationPatterns","getBlockRootClientId","getPatternsByBlockTypes","rootClientId","activePatterns","useScopedBlockVariations","blockVariations","getBlockVariations","variations","isNotConnected","variation","connectedVariations","usePatterns","useUnsupportedBlocks","getClientIdsOfDescendants","getBlockName","descendantClientId","blockSupportsInteractivity","Object","is","blockSupportsInteractivityClientNavigation","blockInteractivity","hasBlocksFromPlugins","hasPostContentBlock","hasUnsupportedBlocks"],"sources":["@wordpress/block-library/src/query/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\tcloneBlock,\n\tgetBlockSupport,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n\n/**\n * @typedef IHasNameAndId\n * @property {string|number} id The entity's id.\n * @property {string} name The entity's name.\n */\n\n/**\n * The object used in Query block that contains info and helper mappings\n * from an array of IHasNameAndId objects.\n *\n * @typedef {Object} QueryEntitiesInfo\n * @property {IHasNameAndId[]} entities The array of entities.\n * @property {Object<string, IHasNameAndId>} mapById Object mapping with the id as key and the entity as value.\n * @property {Object<string, IHasNameAndId>} mapByName Object mapping with the name as key and the entity as value.\n * @property {string[]} names Array with the entities' names.\n */\n\n/**\n * Returns a helper object with mapping from Objects that implement\n * the `IHasNameAndId` interface. The returned object is used for\n * integration with `FormTokenField` component.\n *\n * @param {IHasNameAndId[]} entities The entities to extract of helper object.\n * @return {QueryEntitiesInfo} The object with the entities information.\n */\nexport const getEntitiesInfo = ( entities ) => {\n\tconst mapping = entities?.reduce(\n\t\t( accumulator, entity ) => {\n\t\t\tconst { mapById, mapByName, names } = accumulator;\n\t\t\tmapById[ entity.id ] = entity;\n\t\t\tmapByName[ entity.name ] = entity;\n\t\t\tnames.push( entity.name );\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ mapById: {}, mapByName: {}, names: [] }\n\t);\n\treturn {\n\t\tentities,\n\t\t...mapping,\n\t};\n};\n\n/**\n * Helper util to return a value from a certain path of the object.\n * Path is specified as a string of properties, separated by dots,\n * for example: \"parent.child\".\n *\n * @param {Object} object Input object.\n * @param {string} path Path to the object property.\n * @return {*} Value of the object property at the specified path.\n */\nexport const getValueFromObjectPath = ( object, path ) => {\n\tconst normalizedPath = path.split( '.' );\n\tlet value = object;\n\tnormalizedPath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\n/**\n * Helper util to map records to add a `name` prop from a\n * provided path, in order to handle all entities in the same\n * fashion(implementing`IHasNameAndId` interface).\n *\n * @param {Object[]} entities The array of entities.\n * @param {string} path The path to map a `name` property from the entity.\n * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.\n */\nexport const mapToIHasNameAndId = ( entities, path ) => {\n\treturn ( entities || [] ).map( ( entity ) => ( {\n\t\t...entity,\n\t\tname: decodeEntities( getValueFromObjectPath( entity, path ) ),\n\t} ) );\n};\n\n/**\n * Returns a helper object that contains:\n * 1. An `options` object from the available post types, to be passed to a `SelectControl`.\n * 2. A helper map with available taxonomies per post type.\n *\n * @return {Object} The helper object related to post types.\n */\nexport const usePostTypes = () => {\n\tconst postTypes = useSelect( ( select ) => {\n\t\tconst { getPostTypes } = select( coreStore );\n\t\tconst excludedPostTypes = [ 'attachment' ];\n\t\tconst filteredPostTypes = getPostTypes( { per_page: -1 } )?.filter(\n\t\t\t( { viewable, slug } ) =>\n\t\t\t\tviewable && ! excludedPostTypes.includes( slug )\n\t\t);\n\t\treturn filteredPostTypes;\n\t}, [] );\n\tconst postTypesTaxonomiesMap = useMemo( () => {\n\t\tif ( ! postTypes?.length ) {\n\t\t\treturn;\n\t\t}\n\t\treturn postTypes.reduce( ( accumulator, type ) => {\n\t\t\taccumulator[ type.slug ] = type.taxonomies;\n\t\t\treturn accumulator;\n\t\t}, {} );\n\t}, [ postTypes ] );\n\tconst postTypesSelectOptions = useMemo(\n\t\t() =>\n\t\t\t( postTypes || [] ).map( ( { labels, slug } ) => ( {\n\t\t\t\tlabel: labels.singular_name,\n\t\t\t\tvalue: slug,\n\t\t\t} ) ),\n\t\t[ postTypes ]\n\t);\n\treturn { postTypesTaxonomiesMap, postTypesSelectOptions };\n};\n\n/**\n * Hook that returns the taxonomies associated with a specific post type.\n *\n * @param {string} postType The post type from which to retrieve the associated taxonomies.\n * @return {Object[]} An array of the associated taxonomies.\n */\nexport const useTaxonomies = ( postType ) => {\n\tconst taxonomies = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getTaxonomies, getPostType } = select( coreStore );\n\t\t\t// Does the post type have taxonomies?\n\t\t\tif ( getPostType( postType )?.taxonomies?.length > 0 ) {\n\t\t\t\treturn getTaxonomies( {\n\t\t\t\t\ttype: postType,\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn [];\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn useMemo( () => {\n\t\treturn taxonomies?.filter(\n\t\t\t( { visibility } ) => !! visibility?.publicly_queryable\n\t\t);\n\t}, [ taxonomies ] );\n};\n\n/**\n * Hook that returns whether a specific post type is hierarchical.\n *\n * @param {string} postType The post type to check.\n * @return {boolean} Whether a specific post type is hierarchical.\n */\nexport function useIsPostTypeHierarchical( postType ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst type = select( coreStore ).getPostType( postType );\n\t\t\treturn type?.viewable && type?.hierarchical;\n\t\t},\n\t\t[ postType ]\n\t);\n}\n\n/**\n * Hook that returns the query properties' names defined by the active\n * block variation, to determine which block's filters to show.\n *\n * @param {Object} attributes Block attributes.\n * @return {string[]} An array of the query attributes.\n */\nexport function useAllowedControls( attributes ) {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( blocksStore ).getActiveBlockVariation(\n\t\t\t\t'core/query',\n\t\t\t\tattributes\n\t\t\t)?.allowedControls,\n\n\t\t[ attributes ]\n\t);\n}\nexport function isControlAllowed( allowedControls, key ) {\n\t// Every controls is allowed if the list is not defined.\n\tif ( ! allowedControls ) {\n\t\treturn true;\n\t}\n\treturn allowedControls.includes( key );\n}\n\n/**\n * Clones a pattern's blocks and then recurses over that list of blocks,\n * transforming them to retain some `query` attribute properties.\n * For now we retain the `postType` and `inherit` properties as they are\n * fundamental for the expected functionality of the block and don't affect\n * its design and presentation.\n *\n * Returns the cloned/transformed blocks and array of existing Query Loop\n * client ids for further manipulation, in order to avoid multiple recursions.\n *\n * @param {WPBlock[]} blocks The list of blocks to look through and transform(mutate).\n * @param {Record<string,*>} queryBlockAttributes The existing Query Loop's attributes.\n * @return {{ newBlocks: WPBlock[], queryClientIds: string[] }} An object with the cloned/transformed blocks and all the Query Loop clients from these blocks.\n */\nexport const getTransformedBlocksFromPattern = (\n\tblocks,\n\tqueryBlockAttributes\n) => {\n\tconst {\n\t\tquery: { postType, inherit },\n\t\tnamespace,\n\t} = queryBlockAttributes;\n\tconst clonedBlocks = blocks.map( ( block ) => cloneBlock( block ) );\n\tconst queryClientIds = [];\n\tconst blocksQueue = [ ...clonedBlocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\t\tif ( block.name === 'core/query' ) {\n\t\t\tblock.attributes.query = {\n\t\t\t\t...block.attributes.query,\n\t\t\t\tpostType,\n\t\t\t\tinherit,\n\t\t\t};\n\t\t\tif ( namespace ) {\n\t\t\t\tblock.attributes.namespace = namespace;\n\t\t\t}\n\t\t\tqueryClientIds.push( block.clientId );\n\t\t}\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\treturn { newBlocks: clonedBlocks, queryClientIds };\n};\n\n/**\n * Helper hook that determines if there is an active variation of the block\n * and if there are available specific patterns for this variation.\n * If there are, these patterns are going to be the only ones suggested to\n * the user in setup and replace flow, without including the default ones\n * for Query Loop.\n *\n * If there are no such patterns, the default ones for Query Loop are going\n * to be suggested.\n *\n * @param {string} clientId The block's client ID.\n * @param {Object} attributes The block's attributes.\n * @return {string} The block name to be used in the patterns suggestions.\n */\nexport function useBlockNameForPatterns( clientId, attributes ) {\n\tconst activeVariationName = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blocksStore ).getActiveBlockVariation(\n\t\t\t\t'core/query',\n\t\t\t\tattributes\n\t\t\t)?.name,\n\t\t[ attributes ]\n\t);\n\tconst blockName = `core/query/${ activeVariationName }`;\n\tconst hasActiveVariationPatterns = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! activeVariationName ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst activePatterns = getPatternsByBlockTypes(\n\t\t\t\tblockName,\n\t\t\t\trootClientId\n\t\t\t);\n\t\t\treturn activePatterns.length > 0;\n\t\t},\n\t\t[ clientId, activeVariationName, blockName ]\n\t);\n\treturn hasActiveVariationPatterns ? blockName : 'core/query';\n}\n\n/**\n * Helper hook that determines if there is an active variation of the block\n * and if there are available specific scoped `block` variations connected with\n * this variation.\n *\n * If there are, these variations are going to be the only ones suggested\n * to the user in setup flow when clicking to `start blank`, without including\n * the default ones for Query Loop.\n *\n * If there are no such scoped `block` variations, the default ones for Query\n * Loop are going to be suggested.\n *\n * The way we determine such variations is with the convention that they have the `namespace`\n * attribute defined as an array. This array should contain the names(`name` property) of any\n * variations they want to be connected to.\n * For example, if we have a `Query Loop` scoped `inserter` variation with the name `products`,\n * we can connect a scoped `block` variation by setting its `namespace` attribute to `['products']`.\n * If the user selects this variation, the `namespace` attribute will be overridden by the\n * main `inserter` variation.\n *\n * @param {Object} attributes The block's attributes.\n * @return {WPBlockVariation[]} The block variations to be suggested in setup flow, when clicking to `start blank`.\n */\nexport function useScopedBlockVariations( attributes ) {\n\tconst { activeVariationName, blockVariations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\tselect( blocksStore );\n\t\t\treturn {\n\t\t\t\tactiveVariationName: getActiveBlockVariation(\n\t\t\t\t\t'core/query',\n\t\t\t\t\tattributes\n\t\t\t\t)?.name,\n\t\t\t\tblockVariations: getBlockVariations( 'core/query', 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ attributes ]\n\t);\n\tconst variations = useMemo( () => {\n\t\t// Filter out the variations that have defined a `namespace` attribute,\n\t\t// which means they are 'connected' to specific variations of the block.\n\t\tconst isNotConnected = ( variation ) =>\n\t\t\t! variation.attributes?.namespace;\n\t\tif ( ! activeVariationName ) {\n\t\t\treturn blockVariations.filter( isNotConnected );\n\t\t}\n\t\tconst connectedVariations = blockVariations.filter( ( variation ) =>\n\t\t\tvariation.attributes?.namespace?.includes( activeVariationName )\n\t\t);\n\t\tif ( !! connectedVariations.length ) {\n\t\t\treturn connectedVariations;\n\t\t}\n\t\treturn blockVariations.filter( isNotConnected );\n\t}, [ activeVariationName, blockVariations ] );\n\treturn variations;\n}\n\n/**\n * Hook that returns the block patterns for a specific block type.\n *\n * @param {string} clientId The block's client ID.\n * @param {string} name The block type name.\n * @return {Object[]} An array of valid block patterns.\n */\nexport const usePatterns = ( clientId, name ) => {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\treturn getPatternsByBlockTypes( name, rootClientId );\n\t\t},\n\t\t[ name, clientId ]\n\t);\n};\n\n/**\n * The object returned by useUnsupportedBlocks with info about the type of\n * unsupported blocks present inside the Query block.\n *\n * @typedef {Object} UnsupportedBlocksInfo\n * @property {boolean} hasBlocksFromPlugins True if blocks from plugins are present.\n * @property {boolean} hasPostContentBlock True if a 'core/post-content' block is present.\n * @property {boolean} hasUnsupportedBlocks True if there are any unsupported blocks.\n */\n\n/**\n * Hook that returns an object with information about the unsupported blocks\n * present inside a Query Loop with the given `clientId`. The returned object\n * contains props that are true when a certain type of unsupported block is\n * present.\n *\n * @param {string} clientId The block's client ID.\n * @return {UnsupportedBlocksInfo} The object containing the information.\n */\nexport const useUnsupportedBlocks = ( clientId ) => {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getClientIdsOfDescendants, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst blocks = {};\n\t\t\tgetClientIdsOfDescendants( clientId ).forEach(\n\t\t\t\t( descendantClientId ) => {\n\t\t\t\t\tconst blockName = getBlockName( descendantClientId );\n\t\t\t\t\t/*\n\t\t\t\t\t * Client side navigation can be true in two states:\n\t\t\t\t\t * - supports.interactivity = true;\n\t\t\t\t\t * - supports.interactivity.clientNavigation = true;\n\t\t\t\t\t */\n\t\t\t\t\tconst blockSupportsInteractivity = Object.is(\n\t\t\t\t\t\tgetBlockSupport( blockName, 'interactivity' ),\n\t\t\t\t\t\ttrue\n\t\t\t\t\t);\n\t\t\t\t\tconst blockSupportsInteractivityClientNavigation =\n\t\t\t\t\t\tgetBlockSupport(\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\t'interactivity.clientNavigation'\n\t\t\t\t\t\t);\n\t\t\t\t\tconst blockInteractivity =\n\t\t\t\t\t\tblockSupportsInteractivity ||\n\t\t\t\t\t\tblockSupportsInteractivityClientNavigation;\n\t\t\t\t\tif ( ! blockInteractivity ) {\n\t\t\t\t\t\tblocks.hasBlocksFromPlugins = true;\n\t\t\t\t\t} else if ( blockName === 'core/post-content' ) {\n\t\t\t\t\t\tblocks.hasPostContentBlock = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\tblocks.hasUnsupportedBlocks =\n\t\t\t\tblocks.hasBlocksFromPlugins || blocks.hasPostContentBlock;\n\t\t\treturn blocks;\n\t\t},\n\t\t[ clientId ]\n\t);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SACCC,UAAU,EACVC,eAAe,EACfL,KAAK,IAAIM,WAAW,QACd,mBAAmB;;AAE1B;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;A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A;AACA,OAAO,MAAMoB,oBAAoB,GAAKpB,QAAQ,IAAM;EACnD,OAAO3E,SAAS,CACbiC,MAAM,IAAM;IACb,MAAM;MAAE+D,yBAAyB;MAAEC;IAAa,CAAC,GAChDhE,MAAM,CAAE7B,gBAAiB,CAAC;IAC3B,MAAM6D,MAAM,GAAG,CAAC,CAAC;IACjB+B,yBAAyB,CAAErB,QAAS,CAAC,CAAChD,OAAO,CAC1CuE,kBAAkB,IAAM;MACzB,MAAMjB,SAAS,GAAGgB,YAAY,CAAEC,kBAAmB,CAAC;MACpD;AACL;AACA;AACA;AACA;MACK,MAAMC,0BAA0B,GAAGC,MAAM,CAACC,EAAE,CAC3C9F,eAAe,CAAE0E,SAAS,EAAE,eAAgB,CAAC,EAC7C,IACD,CAAC;MACD,MAAMqB,0CAA0C,GAC/C/F,eAAe,CACd0E,SAAS,EACT,gCACD,CAAC;MACF,MAAMsB,kBAAkB,GACvBJ,0BAA0B,IAC1BG,0CAA0C;MAC3C,IAAK,CAAEC,kBAAkB,EAAG;QAC3BtC,MAAM,CAACuC,oBAAoB,GAAG,IAAI;MACnC,CAAC,MAAM,IAAKvB,SAAS,KAAK,mBAAmB,EAAG;QAC/ChB,MAAM,CAACwC,mBAAmB,GAAG,IAAI;MAClC;IACD,CACD,CAAC;IACDxC,MAAM,CAACyC,oBAAoB,GAC1BzC,MAAM,CAACuC,oBAAoB,IAAIvC,MAAM,CAACwC,mBAAmB;IAC1D,OAAOxC,MAAM;EACd,CAAC,EACD,CAAEU,QAAQ,CACX,CAAC;AACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useSelect","useMemo","store","coreStore","blockEditorStore","decodeEntities","cloneBlock","getBlockSupport","blocksStore","getEntitiesInfo","entities","mapping","reduce","accumulator","entity","mapById","mapByName","names","id","name","push","getValueFromObjectPath","object","path","normalizedPath","split","value","forEach","fieldName","mapToIHasNameAndId","map","usePostTypes","postTypes","select","getPostTypes","excludedPostTypes","filteredPostTypes","per_page","filter","viewable","slug","includes","postTypesTaxonomiesMap","length","type","taxonomies","postTypesSelectOptions","labels","label","singular_name","postTypeFormatSupportMap","supports","useTaxonomies","postType","getTaxonomies","getPostType","visibility","publicly_queryable","useIsPostTypeHierarchical","hierarchical","useAllowedControls","attributes","getActiveBlockVariation","allowedControls","isControlAllowed","key","getTransformedBlocksFromPattern","blocks","queryBlockAttributes","query","inherit","namespace","clonedBlocks","block","queryClientIds","blocksQueue","shift","clientId","innerBlocks","innerBlock","newBlocks","useBlockNameForPatterns","activeVariationName","blockName","hasActiveVariationPatterns","getBlockRootClientId","getPatternsByBlockTypes","rootClientId","activePatterns","useScopedBlockVariations","blockVariations","getBlockVariations","variations","isNotConnected","variation","connectedVariations","usePatterns","useUnsupportedBlocks","getClientIdsOfDescendants","getBlockName","descendantClientId","blockSupportsInteractivity","Object","is","blockSupportsInteractivityClientNavigation","blockInteractivity","hasBlocksFromPlugins","hasPostContentBlock","hasUnsupportedBlocks"],"sources":["@wordpress/block-library/src/query/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\tcloneBlock,\n\tgetBlockSupport,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n\n/**\n * @typedef IHasNameAndId\n * @property {string|number} id The entity's id.\n * @property {string} name The entity's name.\n */\n\n/**\n * The object used in Query block that contains info and helper mappings\n * from an array of IHasNameAndId objects.\n *\n * @typedef {Object} QueryEntitiesInfo\n * @property {IHasNameAndId[]} entities The array of entities.\n * @property {Object<string, IHasNameAndId>} mapById Object mapping with the id as key and the entity as value.\n * @property {Object<string, IHasNameAndId>} mapByName Object mapping with the name as key and the entity as value.\n * @property {string[]} names Array with the entities' names.\n */\n\n/**\n * Returns a helper object with mapping from Objects that implement\n * the `IHasNameAndId` interface. The returned object is used for\n * integration with `FormTokenField` component.\n *\n * @param {IHasNameAndId[]} entities The entities to extract of helper object.\n * @return {QueryEntitiesInfo} The object with the entities information.\n */\nexport const getEntitiesInfo = ( entities ) => {\n\tconst mapping = entities?.reduce(\n\t\t( accumulator, entity ) => {\n\t\t\tconst { mapById, mapByName, names } = accumulator;\n\t\t\tmapById[ entity.id ] = entity;\n\t\t\tmapByName[ entity.name ] = entity;\n\t\t\tnames.push( entity.name );\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ mapById: {}, mapByName: {}, names: [] }\n\t);\n\treturn {\n\t\tentities,\n\t\t...mapping,\n\t};\n};\n\n/**\n * Helper util to return a value from a certain path of the object.\n * Path is specified as a string of properties, separated by dots,\n * for example: \"parent.child\".\n *\n * @param {Object} object Input object.\n * @param {string} path Path to the object property.\n * @return {*} Value of the object property at the specified path.\n */\nexport const getValueFromObjectPath = ( object, path ) => {\n\tconst normalizedPath = path.split( '.' );\n\tlet value = object;\n\tnormalizedPath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\n/**\n * Helper util to map records to add a `name` prop from a\n * provided path, in order to handle all entities in the same\n * fashion(implementing`IHasNameAndId` interface).\n *\n * @param {Object[]} entities The array of entities.\n * @param {string} path The path to map a `name` property from the entity.\n * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.\n */\nexport const mapToIHasNameAndId = ( entities, path ) => {\n\treturn ( entities || [] ).map( ( entity ) => ( {\n\t\t...entity,\n\t\tname: decodeEntities( getValueFromObjectPath( entity, path ) ),\n\t} ) );\n};\n\n/**\n * Returns a helper object that contains:\n * 1. An `options` object from the available post types, to be passed to a `SelectControl`.\n * 2. A helper map with available taxonomies per post type.\n * 3. A helper map with post format support per post type.\n *\n * @return {Object} The helper object related to post types.\n */\nexport const usePostTypes = () => {\n\tconst postTypes = useSelect( ( select ) => {\n\t\tconst { getPostTypes } = select( coreStore );\n\t\tconst excludedPostTypes = [ 'attachment' ];\n\t\tconst filteredPostTypes = getPostTypes( { per_page: -1 } )?.filter(\n\t\t\t( { viewable, slug } ) =>\n\t\t\t\tviewable && ! excludedPostTypes.includes( slug )\n\t\t);\n\t\treturn filteredPostTypes;\n\t}, [] );\n\tconst postTypesTaxonomiesMap = useMemo( () => {\n\t\tif ( ! postTypes?.length ) {\n\t\t\treturn;\n\t\t}\n\t\treturn postTypes.reduce( ( accumulator, type ) => {\n\t\t\taccumulator[ type.slug ] = type.taxonomies;\n\t\t\treturn accumulator;\n\t\t}, {} );\n\t}, [ postTypes ] );\n\tconst postTypesSelectOptions = useMemo(\n\t\t() =>\n\t\t\t( postTypes || [] ).map( ( { labels, slug } ) => ( {\n\t\t\t\tlabel: labels.singular_name,\n\t\t\t\tvalue: slug,\n\t\t\t} ) ),\n\t\t[ postTypes ]\n\t);\n\tconst postTypeFormatSupportMap = useMemo( () => {\n\t\tif ( ! postTypes?.length ) {\n\t\t\treturn {};\n\t\t}\n\t\treturn postTypes.reduce( ( accumulator, type ) => {\n\t\t\taccumulator[ type.slug ] =\n\t\t\t\ttype.supports?.[ 'post-formats' ] || false;\n\t\t\treturn accumulator;\n\t\t}, {} );\n\t}, [ postTypes ] );\n\treturn {\n\t\tpostTypesTaxonomiesMap,\n\t\tpostTypesSelectOptions,\n\t\tpostTypeFormatSupportMap,\n\t};\n};\n\n/**\n * Hook that returns the taxonomies associated with a specific post type.\n *\n * @param {string} postType The post type from which to retrieve the associated taxonomies.\n * @return {Object[]} An array of the associated taxonomies.\n */\nexport const useTaxonomies = ( postType ) => {\n\tconst taxonomies = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getTaxonomies, getPostType } = select( coreStore );\n\t\t\t// Does the post type have taxonomies?\n\t\t\tif ( getPostType( postType )?.taxonomies?.length > 0 ) {\n\t\t\t\treturn getTaxonomies( {\n\t\t\t\t\ttype: postType,\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn [];\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn useMemo( () => {\n\t\treturn taxonomies?.filter(\n\t\t\t( { visibility } ) => !! visibility?.publicly_queryable\n\t\t);\n\t}, [ taxonomies ] );\n};\n\n/**\n * Hook that returns whether a specific post type is hierarchical.\n *\n * @param {string} postType The post type to check.\n * @return {boolean} Whether a specific post type is hierarchical.\n */\nexport function useIsPostTypeHierarchical( postType ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst type = select( coreStore ).getPostType( postType );\n\t\t\treturn type?.viewable && type?.hierarchical;\n\t\t},\n\t\t[ postType ]\n\t);\n}\n\n/**\n * Hook that returns the query properties' names defined by the active\n * block variation, to determine which block's filters to show.\n *\n * @param {Object} attributes Block attributes.\n * @return {string[]} An array of the query attributes.\n */\nexport function useAllowedControls( attributes ) {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( blocksStore ).getActiveBlockVariation(\n\t\t\t\t'core/query',\n\t\t\t\tattributes\n\t\t\t)?.allowedControls,\n\n\t\t[ attributes ]\n\t);\n}\nexport function isControlAllowed( allowedControls, key ) {\n\t// Every controls is allowed if the list is not defined.\n\tif ( ! allowedControls ) {\n\t\treturn true;\n\t}\n\treturn allowedControls.includes( key );\n}\n\n/**\n * Clones a pattern's blocks and then recurses over that list of blocks,\n * transforming them to retain some `query` attribute properties.\n * For now we retain the `postType` and `inherit` properties as they are\n * fundamental for the expected functionality of the block and don't affect\n * its design and presentation.\n *\n * Returns the cloned/transformed blocks and array of existing Query Loop\n * client ids for further manipulation, in order to avoid multiple recursions.\n *\n * @param {WPBlock[]} blocks The list of blocks to look through and transform(mutate).\n * @param {Record<string,*>} queryBlockAttributes The existing Query Loop's attributes.\n * @return {{ newBlocks: WPBlock[], queryClientIds: string[] }} An object with the cloned/transformed blocks and all the Query Loop clients from these blocks.\n */\nexport const getTransformedBlocksFromPattern = (\n\tblocks,\n\tqueryBlockAttributes\n) => {\n\tconst {\n\t\tquery: { postType, inherit },\n\t\tnamespace,\n\t} = queryBlockAttributes;\n\tconst clonedBlocks = blocks.map( ( block ) => cloneBlock( block ) );\n\tconst queryClientIds = [];\n\tconst blocksQueue = [ ...clonedBlocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\t\tif ( block.name === 'core/query' ) {\n\t\t\tblock.attributes.query = {\n\t\t\t\t...block.attributes.query,\n\t\t\t\tpostType,\n\t\t\t\tinherit,\n\t\t\t};\n\t\t\tif ( namespace ) {\n\t\t\t\tblock.attributes.namespace = namespace;\n\t\t\t}\n\t\t\tqueryClientIds.push( block.clientId );\n\t\t}\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\treturn { newBlocks: clonedBlocks, queryClientIds };\n};\n\n/**\n * Helper hook that determines if there is an active variation of the block\n * and if there are available specific patterns for this variation.\n * If there are, these patterns are going to be the only ones suggested to\n * the user in setup and replace flow, without including the default ones\n * for Query Loop.\n *\n * If there are no such patterns, the default ones for Query Loop are going\n * to be suggested.\n *\n * @param {string} clientId The block's client ID.\n * @param {Object} attributes The block's attributes.\n * @return {string} The block name to be used in the patterns suggestions.\n */\nexport function useBlockNameForPatterns( clientId, attributes ) {\n\tconst activeVariationName = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blocksStore ).getActiveBlockVariation(\n\t\t\t\t'core/query',\n\t\t\t\tattributes\n\t\t\t)?.name,\n\t\t[ attributes ]\n\t);\n\tconst blockName = `core/query/${ activeVariationName }`;\n\tconst hasActiveVariationPatterns = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! activeVariationName ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst activePatterns = getPatternsByBlockTypes(\n\t\t\t\tblockName,\n\t\t\t\trootClientId\n\t\t\t);\n\t\t\treturn activePatterns.length > 0;\n\t\t},\n\t\t[ clientId, activeVariationName, blockName ]\n\t);\n\treturn hasActiveVariationPatterns ? blockName : 'core/query';\n}\n\n/**\n * Helper hook that determines if there is an active variation of the block\n * and if there are available specific scoped `block` variations connected with\n * this variation.\n *\n * If there are, these variations are going to be the only ones suggested\n * to the user in setup flow when clicking to `start blank`, without including\n * the default ones for Query Loop.\n *\n * If there are no such scoped `block` variations, the default ones for Query\n * Loop are going to be suggested.\n *\n * The way we determine such variations is with the convention that they have the `namespace`\n * attribute defined as an array. This array should contain the names(`name` property) of any\n * variations they want to be connected to.\n * For example, if we have a `Query Loop` scoped `inserter` variation with the name `products`,\n * we can connect a scoped `block` variation by setting its `namespace` attribute to `['products']`.\n * If the user selects this variation, the `namespace` attribute will be overridden by the\n * main `inserter` variation.\n *\n * @param {Object} attributes The block's attributes.\n * @return {WPBlockVariation[]} The block variations to be suggested in setup flow, when clicking to `start blank`.\n */\nexport function useScopedBlockVariations( attributes ) {\n\tconst { activeVariationName, blockVariations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\tselect( blocksStore );\n\t\t\treturn {\n\t\t\t\tactiveVariationName: getActiveBlockVariation(\n\t\t\t\t\t'core/query',\n\t\t\t\t\tattributes\n\t\t\t\t)?.name,\n\t\t\t\tblockVariations: getBlockVariations( 'core/query', 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ attributes ]\n\t);\n\tconst variations = useMemo( () => {\n\t\t// Filter out the variations that have defined a `namespace` attribute,\n\t\t// which means they are 'connected' to specific variations of the block.\n\t\tconst isNotConnected = ( variation ) =>\n\t\t\t! variation.attributes?.namespace;\n\t\tif ( ! activeVariationName ) {\n\t\t\treturn blockVariations.filter( isNotConnected );\n\t\t}\n\t\tconst connectedVariations = blockVariations.filter( ( variation ) =>\n\t\t\tvariation.attributes?.namespace?.includes( activeVariationName )\n\t\t);\n\t\tif ( !! connectedVariations.length ) {\n\t\t\treturn connectedVariations;\n\t\t}\n\t\treturn blockVariations.filter( isNotConnected );\n\t}, [ activeVariationName, blockVariations ] );\n\treturn variations;\n}\n\n/**\n * Hook that returns the block patterns for a specific block type.\n *\n * @param {string} clientId The block's client ID.\n * @param {string} name The block type name.\n * @return {Object[]} An array of valid block patterns.\n */\nexport const usePatterns = ( clientId, name ) => {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\treturn getPatternsByBlockTypes( name, rootClientId );\n\t\t},\n\t\t[ name, clientId ]\n\t);\n};\n\n/**\n * The object returned by useUnsupportedBlocks with info about the type of\n * unsupported blocks present inside the Query block.\n *\n * @typedef {Object} UnsupportedBlocksInfo\n * @property {boolean} hasBlocksFromPlugins True if blocks from plugins are present.\n * @property {boolean} hasPostContentBlock True if a 'core/post-content' block is present.\n * @property {boolean} hasUnsupportedBlocks True if there are any unsupported blocks.\n */\n\n/**\n * Hook that returns an object with information about the unsupported blocks\n * present inside a Query Loop with the given `clientId`. The returned object\n * contains props that are true when a certain type of unsupported block is\n * present.\n *\n * @param {string} clientId The block's client ID.\n * @return {UnsupportedBlocksInfo} The object containing the information.\n */\nexport const useUnsupportedBlocks = ( clientId ) => {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getClientIdsOfDescendants, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst blocks = {};\n\t\t\tgetClientIdsOfDescendants( clientId ).forEach(\n\t\t\t\t( descendantClientId ) => {\n\t\t\t\t\tconst blockName = getBlockName( descendantClientId );\n\t\t\t\t\t/*\n\t\t\t\t\t * Client side navigation can be true in two states:\n\t\t\t\t\t * - supports.interactivity = true;\n\t\t\t\t\t * - supports.interactivity.clientNavigation = true;\n\t\t\t\t\t */\n\t\t\t\t\tconst blockSupportsInteractivity = Object.is(\n\t\t\t\t\t\tgetBlockSupport( blockName, 'interactivity' ),\n\t\t\t\t\t\ttrue\n\t\t\t\t\t);\n\t\t\t\t\tconst blockSupportsInteractivityClientNavigation =\n\t\t\t\t\t\tgetBlockSupport(\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\t'interactivity.clientNavigation'\n\t\t\t\t\t\t);\n\t\t\t\t\tconst blockInteractivity =\n\t\t\t\t\t\tblockSupportsInteractivity ||\n\t\t\t\t\t\tblockSupportsInteractivityClientNavigation;\n\t\t\t\t\tif ( ! blockInteractivity ) {\n\t\t\t\t\t\tblocks.hasBlocksFromPlugins = true;\n\t\t\t\t\t} else if ( blockName === 'core/post-content' ) {\n\t\t\t\t\t\tblocks.hasPostContentBlock = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\tblocks.hasUnsupportedBlocks =\n\t\t\t\tblocks.hasBlocksFromPlugins || blocks.hasPostContentBlock;\n\t\t\treturn blocks;\n\t\t},\n\t\t[ clientId ]\n\t);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SACCC,UAAU,EACVC,eAAe,EACfL,KAAK,IAAIM,WAAW,QACd,mBAAmB;;AAE1B;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAKC,QAAQ,IAAM;EAC9C,MAAMC,OAAO,GAAGD,QAAQ,EAAEE,MAAM,CAC/B,CAAEC,WAAW,EAAEC,MAAM,KAAM;IAC1B,MAAM;MAAEC,OAAO;M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},
|
|
86
86
|
editorStyle: "wp-block-site-title-editor",
|
|
87
|
-
style: "wp-block-site-title"
|
|
88
|
-
selectors: {
|
|
89
|
-
typography: ".wp-block-site-title > span, .wp-block-site-title > a"
|
|
90
|
-
}
|
|
87
|
+
style: "wp-block-site-title"
|
|
91
88
|
};
|
|
92
89
|
import edit from './edit';
|
|
93
90
|
import deprecated from './deprecated';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["mapMarker","icon","initBlock","metadata","$schema","apiVersion","name","title","category","description","textdomain","attributes","level","type","levelOptions","textAlign","isLink","linkTarget","example","viewportWidth","supports","align","html","color","gradients","link","__experimentalDefaultControls","background","text","spacing","padding","margin","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalTextTransform","__experimentalTextDecoration","__experimentalFontStyle","__experimentalFontWeight","__experimentalLetterSpacing","__experimentalWritingMode","interactivity","clientNavigation","__experimentalBorder","radius","width","style","editorStyle","
|
|
1
|
+
{"version":3,"names":["mapMarker","icon","initBlock","metadata","$schema","apiVersion","name","title","category","description","textdomain","attributes","level","type","levelOptions","textAlign","isLink","linkTarget","example","viewportWidth","supports","align","html","color","gradients","link","__experimentalDefaultControls","background","text","spacing","padding","margin","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalTextTransform","__experimentalTextDecoration","__experimentalFontStyle","__experimentalFontWeight","__experimentalLetterSpacing","__experimentalWritingMode","interactivity","clientNavigation","__experimentalBorder","radius","width","style","editorStyle","edit","deprecated","transforms","settings","init"],"sources":["@wordpress/block-library/src/site-title/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { mapMarker as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\nimport transforms from './transforms';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tviewportWidth: 350,\n\t\tattributes: {\n\t\t\ttext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ErC,MAAM;EAAE7C;AAAK,CAAC,GAAGH,QAAQ;AACzB,SAASA,QAAQ,EAAEG,IAAI;AAEvB,OAAO,MAAM8C,QAAQ,GAAG;EACvBnD,IAAI;EACJiB,OAAO,EAAE;IACRC,aAAa,EAAE,GAAG;IAClBR,UAAU,EAAE;MACXI,SAAS,EAAE;IACZ;EACD,CAAC;EACDkC,IAAI;EACJE,UAAU;EACVD;AACD,CAAC;AAED,OAAO,MAAMG,IAAI,GAAGA,CAAA,KAAMnD,SAAS,CAAE;EAAEI,IAAI;EAAEH,QAAQ;EAAEiD;AAAS,CAAE,CAAC","ignoreList":[]}
|
|
@@ -10,7 +10,7 @@ import { DELETE, BACKSPACE } from '@wordpress/keycodes';
|
|
|
10
10
|
import { useDispatch } from '@wordpress/data';
|
|
11
11
|
import { InspectorControls, URLPopover, URLInput, useBlockProps, store as blockEditorStore } from '@wordpress/block-editor';
|
|
12
12
|
import { useState } from '@wordpress/element';
|
|
13
|
-
import { Button, PanelBody, PanelRow, TextControl } from '@wordpress/components';
|
|
13
|
+
import { Button, PanelBody, PanelRow, TextControl, __experimentalInputControlSuffixWrapper as InputControlSuffixWrapper } from '@wordpress/components';
|
|
14
14
|
import { __ } from '@wordpress/i18n';
|
|
15
15
|
import { keyboardReturn } from '@wordpress/icons';
|
|
16
16
|
|
|
@@ -38,14 +38,14 @@ const SocialLinkURLPopover = ({
|
|
|
38
38
|
setPopover(false);
|
|
39
39
|
popoverAnchor?.focus();
|
|
40
40
|
},
|
|
41
|
-
children: /*#__PURE__*/
|
|
41
|
+
children: /*#__PURE__*/_jsx("form", {
|
|
42
42
|
className: "block-editor-url-popover__link-editor",
|
|
43
43
|
onSubmit: event => {
|
|
44
44
|
event.preventDefault();
|
|
45
45
|
setPopover(false);
|
|
46
46
|
popoverAnchor?.focus();
|
|
47
47
|
},
|
|
48
|
-
children:
|
|
48
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
49
49
|
className: "block-editor-url-input",
|
|
50
50
|
children: /*#__PURE__*/_jsx(URLInput, {
|
|
51
51
|
value: url,
|
|
@@ -61,16 +61,18 @@ const SocialLinkURLPopover = ({
|
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
removeBlock(clientId);
|
|
64
|
-
}
|
|
64
|
+
},
|
|
65
|
+
suffix: /*#__PURE__*/_jsx(InputControlSuffixWrapper, {
|
|
66
|
+
variant: "control",
|
|
67
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
68
|
+
icon: keyboardReturn,
|
|
69
|
+
label: __('Apply'),
|
|
70
|
+
type: "submit",
|
|
71
|
+
size: "small"
|
|
72
|
+
})
|
|
73
|
+
})
|
|
65
74
|
})
|
|
66
|
-
})
|
|
67
|
-
// TODO: Switch to `true` (40px size) if possible.
|
|
68
|
-
, {
|
|
69
|
-
__next40pxDefaultSize: false,
|
|
70
|
-
icon: keyboardReturn,
|
|
71
|
-
label: __('Apply'),
|
|
72
|
-
type: "submit"
|
|
73
|
-
})]
|
|
75
|
+
})
|
|
74
76
|
})
|
|
75
77
|
});
|
|
76
78
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","DELETE","BACKSPACE","useDispatch","InspectorControls","URLPopover","URLInput","useBlockProps","store","blockEditorStore","useState","Button","PanelBody","PanelRow","TextControl","__","keyboardReturn","getIconBySite","getNameBySite","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","SocialLinkURLPopover","url","setAttributes","setPopover","popoverAnchor","clientId","removeBlock","anchor","onClose","focus","children","className","onSubmit","event","preventDefault","value","onChange","nextURL","placeholder","label","hideLabelFromVision","disableSuggestions","onKeyDown","defaultPrevented","includes","keyCode","__next40pxDefaultSize","icon","type","SocialLinkEdit","attributes","context","isSelected","service","rel","showLabels","iconColor","iconColorValue","iconBackgroundColor","iconBackgroundColorValue","showURLPopover","classes","setPopoverAnchor","IconComponent","socialLinkName","socialLinkText","trim","blockProps","style","color","backgroundColor","title","__nextHasNoMarginBottom","help","group","ref","onClick"],"sources":["@wordpress/block-library/src/social-link/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { DELETE, BACKSPACE } from '@wordpress/keycodes';\nimport { useDispatch } from '@wordpress/data';\n\nimport {\n\tInspectorControls,\n\tURLPopover,\n\tURLInput,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport {\n\tButton,\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { keyboardReturn } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { getIconBySite, getNameBySite } from './social-list';\n\nconst SocialLinkURLPopover = ( {\n\turl,\n\tsetAttributes,\n\tsetPopover,\n\tpopoverAnchor,\n\tclientId,\n} ) => {\n\tconst { removeBlock } = useDispatch( blockEditorStore );\n\treturn (\n\t\t<URLPopover\n\t\t\tanchor={ popoverAnchor }\n\t\t\taria-label={ __( 'Edit social link' ) }\n\t\t\tonClose={ () => {\n\t\t\t\tsetPopover( false );\n\t\t\t\tpopoverAnchor?.focus();\n\t\t\t} }\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"block-editor-url-popover__link-editor\"\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tsetPopover( false );\n\t\t\t\t\tpopoverAnchor?.focus();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<div className=\"block-editor-url-input\">\n\t\t\t\t\t<URLInput\n\t\t\t\t\t\tvalue={ url }\n\t\t\t\t\t\tonChange={ ( nextURL ) =>\n\t\t\t\t\t\t\tsetAttributes( { url: nextURL } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tplaceholder={ __( 'Enter social link' ) }\n\t\t\t\t\t\tlabel={ __( 'Enter social link' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tdisableSuggestions\n\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t!! url ||\n\t\t\t\t\t\t\t\tevent.defaultPrevented ||\n\t\t\t\t\t\t\t\t! [ BACKSPACE, DELETE ].includes(\n\t\t\t\t\t\t\t\t\tevent.keyCode\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tremoveBlock( clientId );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<Button\n\t\t\t\t\t// TODO: Switch to `true` (40px size) if possible.\n\t\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\t\ticon={ keyboardReturn }\n\t\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\t\ttype=\"submit\"\n\t\t\t\t/>\n\t\t\t</form>\n\t\t</URLPopover>\n\t);\n};\n\nconst SocialLinkEdit = ( {\n\tattributes,\n\tcontext,\n\tisSelected,\n\tsetAttributes,\n\tclientId,\n} ) => {\n\tconst { url, service, label = '', rel } = attributes;\n\tconst {\n\t\tshowLabels,\n\t\ticonColor,\n\t\ticonColorValue,\n\t\ticonBackgroundColor,\n\t\ticonBackgroundColorValue,\n\t} = context;\n\tconst [ showURLPopover, setPopover ] = useState( false );\n\tconst classes = clsx( 'wp-social-link', 'wp-social-link-' + service, {\n\t\t'wp-social-link__is-incomplete': ! url,\n\t\t[ `has-${ iconColor }-color` ]: iconColor,\n\t\t[ `has-${ iconBackgroundColor }-background-color` ]:\n\t\t\ticonBackgroundColor,\n\t} );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\n\tconst IconComponent = getIconBySite( service );\n\tconst socialLinkName = getNameBySite( service );\n\t// The initial label (ie. the link text) is an empty string.\n\t// We want to prevent empty links so that the link text always fallbacks to\n\t// the social name, even when users enter and save an empty string or only\n\t// spaces. The PHP render callback fallbacks to the social name as well.\n\tconst socialLinkText = label.trim() === '' ? socialLinkName : label;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t\tstyle: {\n\t\t\tcolor: iconColorValue,\n\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t},\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'The text is visible when enabled from the parent Social Icons block.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { label: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tplaceholder={ socialLinkName }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\tonChange={ ( value ) => setAttributes( { rel: value } ) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<li { ...blockProps }>\n\t\t\t\t<button\n\t\t\t\t\tclassName=\"wp-block-social-link-anchor\"\n\t\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\t\tonClick={ () => setPopover( true ) }\n\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t>\n\t\t\t\t\t<IconComponent />\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ clsx( 'wp-block-social-link-label', {\n\t\t\t\t\t\t\t'screen-reader-text': ! showLabels,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ socialLinkText }\n\t\t\t\t\t</span>\n\t\t\t\t</button>\n\t\t\t\t{ isSelected && showURLPopover && (\n\t\t\t\t\t<SocialLinkURLPopover\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tsetPopover={ setPopover }\n\t\t\t\t\t\tpopoverAnchor={ popoverAnchor }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</li>\n\t\t</>\n\t);\n};\n\nexport default SocialLinkEdit;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,MAAM,EAAEC,SAAS,QAAQ,qBAAqB;AACvD,SAASC,WAAW,QAAQ,iBAAiB;AAE7C,SACCC,iBAAiB,EACjBC,UAAU,EACVC,QAAQ,EACRC,aAAa,EACbC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SACCC,MAAM,EACNC,SAAS,EACTC,QAAQ,EACRC,WAAW,QACL,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,cAAc,QAAQ,kBAAkB;;AAEjD;AACA;AACA;AACA,SAASC,aAAa,EAAEC,aAAa,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAE7D,MAAMC,oBAAoB,GAAGA,CAAE;EAC9BC,GAAG;EACHC,aAAa;EACbC,UAAU;EACVC,aAAa;EACbC;AACD,CAAC,KAAM;EACN,MAAM;IAAEC;EAAY,CAAC,GAAG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AAoB;QACpBC,GAAG,EAAGA,GAAK;QACXC,aAAa,EAAGA,aAAe;QAC/BC,UAAU,EAAGA,UAAY;QACzBC,aAAa,EAAGA,aAAe;QAC/BC,QAAQ,EAAGA;MAAU,CACrB,CACD;IAAA,CACE,CAAC;EAAA,CACJ,CAAC;AAEL,CAAC;AAED,eAAewB,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","DELETE","BACKSPACE","useDispatch","InspectorControls","URLPopover","URLInput","useBlockProps","store","blockEditorStore","useState","Button","PanelBody","PanelRow","TextControl","__experimentalInputControlSuffixWrapper","InputControlSuffixWrapper","__","keyboardReturn","getIconBySite","getNameBySite","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","SocialLinkURLPopover","url","setAttributes","setPopover","popoverAnchor","clientId","removeBlock","anchor","onClose","focus","children","className","onSubmit","event","preventDefault","value","onChange","nextURL","placeholder","label","hideLabelFromVision","disableSuggestions","onKeyDown","defaultPrevented","includes","keyCode","suffix","variant","icon","type","size","SocialLinkEdit","attributes","context","isSelected","service","rel","showLabels","iconColor","iconColorValue","iconBackgroundColor","iconBackgroundColorValue","showURLPopover","classes","setPopoverAnchor","IconComponent","socialLinkName","socialLinkText","trim","blockProps","style","color","backgroundColor","title","__next40pxDefaultSize","__nextHasNoMarginBottom","help","group","ref","onClick"],"sources":["@wordpress/block-library/src/social-link/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { DELETE, BACKSPACE } from '@wordpress/keycodes';\nimport { useDispatch } from '@wordpress/data';\n\nimport {\n\tInspectorControls,\n\tURLPopover,\n\tURLInput,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport {\n\tButton,\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { keyboardReturn } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { getIconBySite, getNameBySite } from './social-list';\n\nconst SocialLinkURLPopover = ( {\n\turl,\n\tsetAttributes,\n\tsetPopover,\n\tpopoverAnchor,\n\tclientId,\n} ) => {\n\tconst { removeBlock } = useDispatch( blockEditorStore );\n\treturn (\n\t\t<URLPopover\n\t\t\tanchor={ popoverAnchor }\n\t\t\taria-label={ __( 'Edit social link' ) }\n\t\t\tonClose={ () => {\n\t\t\t\tsetPopover( false );\n\t\t\t\tpopoverAnchor?.focus();\n\t\t\t} }\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"block-editor-url-popover__link-editor\"\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tsetPopover( false );\n\t\t\t\t\tpopoverAnchor?.focus();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<div className=\"block-editor-url-input\">\n\t\t\t\t\t<URLInput\n\t\t\t\t\t\tvalue={ url }\n\t\t\t\t\t\tonChange={ ( nextURL ) =>\n\t\t\t\t\t\t\tsetAttributes( { url: nextURL } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tplaceholder={ __( 'Enter social link' ) }\n\t\t\t\t\t\tlabel={ __( 'Enter social link' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tdisableSuggestions\n\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t!! url ||\n\t\t\t\t\t\t\t\tevent.defaultPrevented ||\n\t\t\t\t\t\t\t\t! [ BACKSPACE, DELETE ].includes(\n\t\t\t\t\t\t\t\t\tevent.keyCode\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tremoveBlock( clientId );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\ticon={ keyboardReturn }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</InputControlSuffixWrapper>\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</form>\n\t\t</URLPopover>\n\t);\n};\n\nconst SocialLinkEdit = ( {\n\tattributes,\n\tcontext,\n\tisSelected,\n\tsetAttributes,\n\tclientId,\n} ) => {\n\tconst { url, service, label = '', rel } = attributes;\n\tconst {\n\t\tshowLabels,\n\t\ticonColor,\n\t\ticonColorValue,\n\t\ticonBackgroundColor,\n\t\ticonBackgroundColorValue,\n\t} = context;\n\tconst [ showURLPopover, setPopover ] = useState( false );\n\tconst classes = clsx( 'wp-social-link', 'wp-social-link-' + service, {\n\t\t'wp-social-link__is-incomplete': ! url,\n\t\t[ `has-${ iconColor }-color` ]: iconColor,\n\t\t[ `has-${ iconBackgroundColor }-background-color` ]:\n\t\t\ticonBackgroundColor,\n\t} );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\n\tconst IconComponent = getIconBySite( service );\n\tconst socialLinkName = getNameBySite( service );\n\t// The initial label (ie. the link text) is an empty string.\n\t// We want to prevent empty links so that the link text always fallbacks to\n\t// the social name, even when users enter and save an empty string or only\n\t// spaces. The PHP render callback fallbacks to the social name as well.\n\tconst socialLinkText = label.trim() === '' ? socialLinkName : label;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t\tstyle: {\n\t\t\tcolor: iconColorValue,\n\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t},\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'The text is visible when enabled from the parent Social Icons block.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { label: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tplaceholder={ socialLinkName }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\tonChange={ ( value ) => setAttributes( { rel: value } ) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<li { ...blockProps }>\n\t\t\t\t<button\n\t\t\t\t\tclassName=\"wp-block-social-link-anchor\"\n\t\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\t\tonClick={ () => setPopover( true ) }\n\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t>\n\t\t\t\t\t<IconComponent />\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ clsx( 'wp-block-social-link-label', {\n\t\t\t\t\t\t\t'screen-reader-text': ! showLabels,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ socialLinkText }\n\t\t\t\t\t</span>\n\t\t\t\t</button>\n\t\t\t\t{ isSelected && showURLPopover && (\n\t\t\t\t\t<SocialLinkURLPopover\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tsetPopover={ setPopover }\n\t\t\t\t\t\tpopoverAnchor={ popoverAnchor }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</li>\n\t\t</>\n\t);\n};\n\nexport default SocialLinkEdit;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,MAAM,EAAEC,SAAS,QAAQ,qBAAqB;AACvD,SAASC,WAAW,QAAQ,iBAAiB;AAE7C,SACCC,iBAAiB,EACjBC,UAAU,EACVC,QAAQ,EACRC,aAAa,EACbC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SACCC,MAAM,EACNC,SAAS,EACTC,QAAQ,EACRC,WAAW,EACXC,uCAAuC,IAAIC,yBAAyB,QAC9D,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,cAAc,QAAQ,kBAAkB;;AAEjD;AACA;AACA;AACA,SAASC,aAAa,EAAEC,aAAa,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAE7D,MAAMC,oBAAoB,GAAGA,CAAE;EAC9BC,GAAG;EACHC,aAAa;EACbC,UAAU;EACVC,aAAa;EACbC;AACD,CAAC,KAAM;EACN,MAAM;IAAEC;EAAY,CAAC,GAAG9B,WAAW,CAAEM,gBAAiB,CAAC;EACvD,oBACCa,IAAA,CAACjB,UAAU;IACV6B,MAAM,EAAGH,aAAe;IACxB,cAAad,EAAE,CAAE,kBAAmB,CAAG;IACvCkB,OAAO,EAAGA,CAAA,KAAM;MACfL,UAAU,CAAE,KAAM,CAAC;MACnBC,a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/BC,QAAQ,EAAGA;MAAU,CACrB,CACD;IAAA,CACE,CAAC;EAAA,CACJ,CAAC;AAEL,CAAC;AAED,eAAe0B,cAAc","ignoreList":[]}
|
|
@@ -1090,7 +1090,7 @@ div[data-type="core/freeform"].is-selected .block-library-classic__toolbar {
|
|
|
1090
1090
|
}
|
|
1091
1091
|
}
|
|
1092
1092
|
.block-library-gallery-item__inline-menu:hover {
|
|
1093
|
-
box-shadow: 0
|
|
1093
|
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02), 0 3px 3px rgba(0, 0, 0, 0.02), 0 4px 4px rgba(0, 0, 0, 0.01);
|
|
1094
1094
|
}
|
|
1095
1095
|
@media (min-width: 600px) {
|
|
1096
1096
|
.columns-7 .block-library-gallery-item__inline-menu, .columns-8 .block-library-gallery-item__inline-menu {
|
package/build-style/editor.css
CHANGED
|
@@ -1098,7 +1098,7 @@ div[data-type="core/freeform"].is-selected .block-library-classic__toolbar {
|
|
|
1098
1098
|
}
|
|
1099
1099
|
}
|
|
1100
1100
|
.block-library-gallery-item__inline-menu:hover {
|
|
1101
|
-
box-shadow: 0
|
|
1101
|
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02), 0 3px 3px rgba(0, 0, 0, 0.02), 0 4px 4px rgba(0, 0, 0, 0.01);
|
|
1102
1102
|
}
|
|
1103
1103
|
@media (min-width: 600px) {
|
|
1104
1104
|
.columns-7 .block-library-gallery-item__inline-menu, .columns-8 .block-library-gallery-item__inline-menu {
|
|
@@ -95,13 +95,6 @@
|
|
|
95
95
|
flex-direction: column;
|
|
96
96
|
gap: 0.25em;
|
|
97
97
|
margin-bottom: 0.5em;
|
|
98
|
-
/*
|
|
99
|
-
Small tweak to left-align the checkbox.
|
|
100
|
-
Even though `:has` is not currently supported in Firefox, this is a small tweak
|
|
101
|
-
and does not affect the functionality of the block or the user's experience.
|
|
102
|
-
There will be a minor inconsistency between browsers. However, it's more important to provide
|
|
103
|
-
a better experience for 80+% of users, until Firefox catches up and supports `:has`.
|
|
104
|
-
*/
|
|
105
98
|
}
|
|
106
99
|
.wp-block-form-input__label.is-label-inline {
|
|
107
100
|
flex-direction: row;
|
|
@@ -112,9 +105,15 @@
|
|
|
112
105
|
margin-bottom: 0.5em;
|
|
113
106
|
}
|
|
114
107
|
.wp-block-form-input__label:has(input[type=checkbox]) {
|
|
108
|
+
flex-direction: row;
|
|
115
109
|
width: -moz-fit-content;
|
|
116
110
|
width: fit-content;
|
|
117
|
-
|
|
111
|
+
}
|
|
112
|
+
.wp-block-form-input__label:has(input[type=checkbox]) .wp-block-form-input__label-content {
|
|
113
|
+
margin: 0;
|
|
114
|
+
}
|
|
115
|
+
.wp-block-form-input__label:has(.wp-block-form-input__label-content + input[type=checkbox]) {
|
|
116
|
+
/* stylelint-disable-next-line declaration-property-value-allowed-list -- This style is required for old markup. */
|
|
118
117
|
flex-direction: row-reverse;
|
|
119
118
|
}
|
|
120
119
|
|
|
@@ -95,13 +95,6 @@
|
|
|
95
95
|
flex-direction: column;
|
|
96
96
|
gap: 0.25em;
|
|
97
97
|
margin-bottom: 0.5em;
|
|
98
|
-
/*
|
|
99
|
-
Small tweak to left-align the checkbox.
|
|
100
|
-
Even though `:has` is not currently supported in Firefox, this is a small tweak
|
|
101
|
-
and does not affect the functionality of the block or the user's experience.
|
|
102
|
-
There will be a minor inconsistency between browsers. However, it's more important to provide
|
|
103
|
-
a better experience for 80+% of users, until Firefox catches up and supports `:has`.
|
|
104
|
-
*/
|
|
105
98
|
}
|
|
106
99
|
.wp-block-form-input__label.is-label-inline {
|
|
107
100
|
flex-direction: row;
|
|
@@ -112,9 +105,15 @@
|
|
|
112
105
|
margin-bottom: 0.5em;
|
|
113
106
|
}
|
|
114
107
|
.wp-block-form-input__label:has(input[type=checkbox]) {
|
|
108
|
+
flex-direction: row;
|
|
115
109
|
width: -moz-fit-content;
|
|
116
110
|
width: fit-content;
|
|
117
|
-
|
|
111
|
+
}
|
|
112
|
+
.wp-block-form-input__label:has(input[type=checkbox]) .wp-block-form-input__label-content {
|
|
113
|
+
margin: 0;
|
|
114
|
+
}
|
|
115
|
+
.wp-block-form-input__label:has(.wp-block-form-input__label-content + input[type=checkbox]) {
|
|
116
|
+
/* stylelint-disable-next-line declaration-property-value-allowed-list -- This style is required for old markup. */
|
|
118
117
|
flex-direction: row-reverse;
|
|
119
118
|
}
|
|
120
119
|
|
|
@@ -204,7 +204,7 @@
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
.block-library-gallery-item__inline-menu:hover {
|
|
207
|
-
box-shadow: 0
|
|
207
|
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02), 0 3px 3px rgba(0, 0, 0, 0.02), 0 4px 4px rgba(0, 0, 0, 0.01);
|
|
208
208
|
}
|
|
209
209
|
@media (min-width: 600px) {
|
|
210
210
|
.columns-7 .block-library-gallery-item__inline-menu, .columns-8 .block-library-gallery-item__inline-menu {
|
|
@@ -204,7 +204,7 @@
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
.block-library-gallery-item__inline-menu:hover {
|
|
207
|
-
box-shadow: 0
|
|
207
|
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02), 0 3px 3px rgba(0, 0, 0, 0.02), 0 4px 4px rgba(0, 0, 0, 0.01);
|
|
208
208
|
}
|
|
209
209
|
@media (min-width: 600px) {
|
|
210
210
|
.columns-7 .block-library-gallery-item__inline-menu, .columns-8 .block-library-gallery-item__inline-menu {
|