@wordpress/block-directory 5.3.0 → 5.4.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/plugins/installed-blocks-pre-publish-panel/index.js +4 -7
- package/build/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
- package/build/store/selectors.js +4 -4
- package/build/store/selectors.js.map +1 -1
- package/build-module/plugins/installed-blocks-pre-publish-panel/index.js +1 -7
- package/build-module/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
- package/build-module/store/selectors.js +5 -5
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +1 -0
- package/build-style/style.css +1 -0
- package/package.json +20 -21
- package/src/components/downloadable-block-list-item/style.scss +6 -0
- package/src/plugins/installed-blocks-pre-publish-panel/index.js +1 -4
- package/src/store/selectors.js +29 -17
package/CHANGELOG.md
CHANGED
|
@@ -8,27 +8,24 @@ exports.default = InstalledBlocksPrePublishPanel;
|
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
9
|
var _data = require("@wordpress/data");
|
|
10
10
|
var _icons = require("@wordpress/icons");
|
|
11
|
+
var _editor = require("@wordpress/editor");
|
|
11
12
|
var _compactList = _interopRequireDefault(require("../../components/compact-list"));
|
|
12
13
|
var _store = require("../../store");
|
|
13
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
var _window$wp$editor;
|
|
15
15
|
/**
|
|
16
16
|
* WordPress dependencies
|
|
17
17
|
*/
|
|
18
|
+
|
|
18
19
|
/**
|
|
19
20
|
* Internal dependencies
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
-
// because it would include the wp-editor in all pages loading the block-directory script.
|
|
23
|
-
const {
|
|
24
|
-
PluginPrePublishPanel
|
|
25
|
-
} = (_window$wp$editor = window?.wp?.editor) !== null && _window$wp$editor !== void 0 ? _window$wp$editor : {};
|
|
22
|
+
|
|
26
23
|
function InstalledBlocksPrePublishPanel() {
|
|
27
24
|
const newBlockTypes = (0, _data.useSelect)(select => select(_store.store).getNewBlockTypes(), []);
|
|
28
25
|
if (!newBlockTypes.length) {
|
|
29
26
|
return null;
|
|
30
27
|
}
|
|
31
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(PluginPrePublishPanel, {
|
|
28
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_editor.PluginPrePublishPanel, {
|
|
32
29
|
icon: _icons.blockDefault,
|
|
33
30
|
title: (0, _i18n.sprintf)(
|
|
34
31
|
// translators: %d: number of blocks (number).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_data","_icons","_compactList","_interopRequireDefault","_store","_jsxRuntime","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_data","_icons","_editor","_compactList","_interopRequireDefault","_store","_jsxRuntime","InstalledBlocksPrePublishPanel","newBlockTypes","useSelect","select","blockDirectoryStore","getNewBlockTypes","length","jsxs","PluginPrePublishPanel","icon","blockDefault","title","sprintf","_n","initialOpen","children","jsx","className","default","items"],"sources":["@wordpress/block-directory/src/plugins/installed-blocks-pre-publish-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { blockDefault } from '@wordpress/icons';\nimport { PluginPrePublishPanel } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport CompactList from '../../components/compact-list';\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function InstalledBlocksPrePublishPanel() {\n\tconst newBlockTypes = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).getNewBlockTypes(),\n\t\t[]\n\t);\n\n\tif ( ! newBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PluginPrePublishPanel\n\t\t\ticon={ blockDefault }\n\t\t\ttitle={ sprintf(\n\t\t\t\t// translators: %d: number of blocks (number).\n\t\t\t\t_n(\n\t\t\t\t\t'Added: %d block',\n\t\t\t\t\t'Added: %d blocks',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t),\n\t\t\t\tnewBlockTypes.length\n\t\t\t) }\n\t\t\tinitialOpen\n\t\t>\n\t\t\t<p className=\"installed-blocks-pre-publish-panel__copy\">\n\t\t\t\t{ _n(\n\t\t\t\t\t'The following block has been added to your site.',\n\t\t\t\t\t'The following blocks have been added to your site.',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<CompactList items={ newBlockTypes } />\n\t\t</PluginPrePublishPanel>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,YAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAA2D,IAAAO,WAAA,GAAAP,OAAA;AAZ3D;AACA;AACA;;AAMA;AACA;AACA;;AAIe,SAASQ,8BAA8BA,CAAA,EAAG;EACxD,MAAMC,aAAa,GAAG,IAAAC,eAAS,EAC5BC,MAAM,IAAMA,MAAM,CAAEC,YAAoB,CAAC,CAACC,gBAAgB,CAAC,CAAC,EAC9D,EACD,CAAC;EAED,IAAK,CAAEJ,aAAa,CAACK,MAAM,EAAG;IAC7B,OAAO,IAAI;EACZ;EAEA,oBACC,IAAAP,WAAA,CAAAQ,IAAA,EAACZ,OAAA,CAAAa,qBAAqB;IACrBC,IAAI,EAAGC,mBAAc;IACrBC,KAAK,EAAG,IAAAC,aAAO;IACd;IACA,IAAAC,QAAE,EACD,iBAAiB,EACjB,kBAAkB,EAClBZ,aAAa,CAACK,MACf,CAAC,EACDL,aAAa,CAACK,MACf,CAAG;IACHQ,WAAW;IAAAC,QAAA,gBAEX,IAAAhB,WAAA,CAAAiB,GAAA;MAAGC,SAAS,EAAC,0CAA0C;MAAAF,QAAA,EACpD,IAAAF,QAAE,EACH,kDAAkD,EAClD,oDAAoD,EACpDZ,aAAa,CAACK,MACf;IAAC,CACC,CAAC,eACJ,IAAAP,WAAA,CAAAiB,GAAA,EAACpB,YAAA,CAAAsB,OAAW;MAACC,KAAK,EAAGlB;IAAe,CAAE,CAAC;EAAA,CACjB,CAAC;AAE1B","ignoreList":[]}
|
package/build/store/selectors.js
CHANGED
|
@@ -68,11 +68,11 @@ function getInstalledBlockTypes(state) {
|
|
|
68
68
|
*
|
|
69
69
|
* @return {Array} Block type items.
|
|
70
70
|
*/
|
|
71
|
-
const getNewBlockTypes = exports.getNewBlockTypes = (0, _data.createRegistrySelector)(select => state => {
|
|
71
|
+
const getNewBlockTypes = exports.getNewBlockTypes = (0, _data.createRegistrySelector)(select => (0, _data.createSelector)(state => {
|
|
72
72
|
const usedBlockTree = select(_blockEditor.store).getBlocks();
|
|
73
73
|
const installedBlockTypes = getInstalledBlockTypes(state);
|
|
74
74
|
return installedBlockTypes.filter(blockType => (0, _hasBlockType.default)(blockType, usedBlockTree));
|
|
75
|
-
});
|
|
75
|
+
}, state => [getInstalledBlockTypes(state), select(_blockEditor.store).getBlocks()]));
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
78
|
* Returns the block types that have been installed on the server but are not
|
|
@@ -82,11 +82,11 @@ const getNewBlockTypes = exports.getNewBlockTypes = (0, _data.createRegistrySele
|
|
|
82
82
|
*
|
|
83
83
|
* @return {Array} Block type items.
|
|
84
84
|
*/
|
|
85
|
-
const getUnusedBlockTypes = exports.getUnusedBlockTypes = (0, _data.createRegistrySelector)(select => state => {
|
|
85
|
+
const getUnusedBlockTypes = exports.getUnusedBlockTypes = (0, _data.createRegistrySelector)(select => (0, _data.createSelector)(state => {
|
|
86
86
|
const usedBlockTree = select(_blockEditor.store).getBlocks();
|
|
87
87
|
const installedBlockTypes = getInstalledBlockTypes(state);
|
|
88
88
|
return installedBlockTypes.filter(blockType => !(0, _hasBlockType.default)(blockType, usedBlockTree));
|
|
89
|
-
});
|
|
89
|
+
}, state => [getInstalledBlockTypes(state), select(_blockEditor.store).getBlocks()]));
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* Returns true if a block plugin install is in progress.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blockEditor","_hasBlockType","_interopRequireDefault","isRequestingDownloadableBlocks","state","filterValue","_state$downloadableBl","downloadableBlocks","isRequesting","getDownloadableBlocks","_state$downloadableBl2","results","getInstalledBlockTypes","blockManagement","installedBlockTypes","getNewBlockTypes","exports","createRegistrySelector","select","usedBlockTree","blockEditorStore","getBlocks","filter","blockType","hasBlockType","getUnusedBlockTypes","isInstalling","blockId","getErrorNotices","errorNotices","getErrorNoticeForBlock"],"sources":["@wordpress/block-directory/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport hasBlockType from './utils/has-block-type';\n\n/**\n * Returns true if application is requesting for downloadable blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {boolean} Whether a request is in progress for the blocks list.\n */\nexport function isRequestingDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.isRequesting ?? false;\n}\n\n/**\n * Returns the available uninstalled blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {Array} Downloadable blocks.\n */\nexport function getDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.results ?? [];\n}\n\n/**\n * Returns the block types that have been installed on the server in this\n * session.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items\n */\nexport function getInstalledBlockTypes( state ) {\n\treturn state.blockManagement.installedBlockTypes;\n}\n\n/**\n * Returns block types that have been installed on the server and used in the\n * current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getNewBlockTypes = createRegistrySelector(
|
|
1
|
+
{"version":3,"names":["_data","require","_blockEditor","_hasBlockType","_interopRequireDefault","isRequestingDownloadableBlocks","state","filterValue","_state$downloadableBl","downloadableBlocks","isRequesting","getDownloadableBlocks","_state$downloadableBl2","results","getInstalledBlockTypes","blockManagement","installedBlockTypes","getNewBlockTypes","exports","createRegistrySelector","select","createSelector","usedBlockTree","blockEditorStore","getBlocks","filter","blockType","hasBlockType","getUnusedBlockTypes","isInstalling","blockId","getErrorNotices","errorNotices","getErrorNoticeForBlock"],"sources":["@wordpress/block-directory/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport hasBlockType from './utils/has-block-type';\n\n/**\n * Returns true if application is requesting for downloadable blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {boolean} Whether a request is in progress for the blocks list.\n */\nexport function isRequestingDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.isRequesting ?? false;\n}\n\n/**\n * Returns the available uninstalled blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {Array} Downloadable blocks.\n */\nexport function getDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.results ?? [];\n}\n\n/**\n * Returns the block types that have been installed on the server in this\n * session.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items\n */\nexport function getInstalledBlockTypes( state ) {\n\treturn state.blockManagement.installedBlockTypes;\n}\n\n/**\n * Returns block types that have been installed on the server and used in the\n * current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getNewBlockTypes = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tconst usedBlockTree = select( blockEditorStore ).getBlocks();\n\t\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\n\t\t\treturn installedBlockTypes.filter( ( blockType ) =>\n\t\t\t\thasBlockType( blockType, usedBlockTree )\n\t\t\t);\n\t\t},\n\t\t( state ) => [\n\t\t\tgetInstalledBlockTypes( state ),\n\t\t\tselect( blockEditorStore ).getBlocks(),\n\t\t]\n\t)\n);\n\n/**\n * Returns the block types that have been installed on the server but are not\n * used in the current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getUnusedBlockTypes = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tconst usedBlockTree = select( blockEditorStore ).getBlocks();\n\t\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\n\t\t\treturn installedBlockTypes.filter(\n\t\t\t\t( blockType ) => ! hasBlockType( blockType, usedBlockTree )\n\t\t\t);\n\t\t},\n\t\t( state ) => [\n\t\t\tgetInstalledBlockTypes( state ),\n\t\t\tselect( blockEditorStore ).getBlocks(),\n\t\t]\n\t)\n);\n\n/**\n * Returns true if a block plugin install is in progress.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId Id of the block.\n *\n * @return {boolean} Whether this block is currently being installed.\n */\nexport function isInstalling( state, blockId ) {\n\treturn state.blockManagement.isInstalling[ blockId ] || false;\n}\n\n/**\n * Returns all block error notices.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Object with error notices.\n */\nexport function getErrorNotices( state ) {\n\treturn state.errorNotices;\n}\n\n/**\n * Returns the error notice for a given block.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId The ID of the block plugin. eg: my-block\n *\n * @return {string|boolean} The error text, or false if no error.\n */\nexport function getErrorNoticeForBlock( state, blockId ) {\n\treturn state.errorNotices[ blockId ];\n}\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
var _window$wp$editor;
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
5
4
|
import { _n, sprintf } from '@wordpress/i18n';
|
|
6
5
|
import { useSelect } from '@wordpress/data';
|
|
7
6
|
import { blockDefault } from '@wordpress/icons';
|
|
7
|
+
import { PluginPrePublishPanel } from '@wordpress/editor';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
import CompactList from '../../components/compact-list';
|
|
13
13
|
import { store as blockDirectoryStore } from '../../store';
|
|
14
|
-
|
|
15
|
-
// We shouldn't import the editor package directly
|
|
16
|
-
// because it would include the wp-editor in all pages loading the block-directory script.
|
|
17
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
-
const {
|
|
20
|
-
PluginPrePublishPanel
|
|
21
|
-
} = (_window$wp$editor = window?.wp?.editor) !== null && _window$wp$editor !== void 0 ? _window$wp$editor : {};
|
|
22
16
|
export default function InstalledBlocksPrePublishPanel() {
|
|
23
17
|
const newBlockTypes = useSelect(select => select(blockDirectoryStore).getNewBlockTypes(), []);
|
|
24
18
|
if (!newBlockTypes.length) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_n","sprintf","useSelect","blockDefault","CompactList","store","blockDirectoryStore","jsx","_jsx","jsxs","_jsxs","
|
|
1
|
+
{"version":3,"names":["_n","sprintf","useSelect","blockDefault","PluginPrePublishPanel","CompactList","store","blockDirectoryStore","jsx","_jsx","jsxs","_jsxs","InstalledBlocksPrePublishPanel","newBlockTypes","select","getNewBlockTypes","length","icon","title","initialOpen","children","className","items"],"sources":["@wordpress/block-directory/src/plugins/installed-blocks-pre-publish-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { blockDefault } from '@wordpress/icons';\nimport { PluginPrePublishPanel } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport CompactList from '../../components/compact-list';\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function InstalledBlocksPrePublishPanel() {\n\tconst newBlockTypes = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).getNewBlockTypes(),\n\t\t[]\n\t);\n\n\tif ( ! newBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PluginPrePublishPanel\n\t\t\ticon={ blockDefault }\n\t\t\ttitle={ sprintf(\n\t\t\t\t// translators: %d: number of blocks (number).\n\t\t\t\t_n(\n\t\t\t\t\t'Added: %d block',\n\t\t\t\t\t'Added: %d blocks',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t),\n\t\t\t\tnewBlockTypes.length\n\t\t\t) }\n\t\t\tinitialOpen\n\t\t>\n\t\t\t<p className=\"installed-blocks-pre-publish-panel__copy\">\n\t\t\t\t{ _n(\n\t\t\t\t\t'The following block has been added to your site.',\n\t\t\t\t\t'The following blocks have been added to your site.',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<CompactList items={ newBlockTypes } />\n\t\t</PluginPrePublishPanel>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,qBAAqB,QAAQ,mBAAmB;;AAEzD;AACA;AACA;AACA,OAAOC,WAAW,MAAM,+BAA+B;AACvD,SAASC,KAAK,IAAIC,mBAAmB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE3D,eAAe,SAASC,8BAA8BA,CAAA,EAAG;EACxD,MAAMC,aAAa,GAAGX,SAAS,CAC5BY,MAAM,IAAMA,MAAM,CAAEP,mBAAoB,CAAC,CAACQ,gBAAgB,CAAC,CAAC,EAC9D,EACD,CAAC;EAED,IAAK,CAAEF,aAAa,CAACG,MAAM,EAAG;IAC7B,OAAO,IAAI;EACZ;EAEA,oBACCL,KAAA,CAACP,qBAAqB;IACrBa,IAAI,EAAGd,YAAc;IACrBe,KAAK,EAAGjB,OAAO;IACd;IACAD,EAAE,CACD,iBAAiB,EACjB,kBAAkB,EAClBa,aAAa,CAACG,MACf,CAAC,EACDH,aAAa,CAACG,MACf,CAAG;IACHG,WAAW;IAAAC,QAAA,gBAEXX,IAAA;MAAGY,SAAS,EAAC,0CAA0C;MAAAD,QAAA,EACpDpB,EAAE,CACH,kDAAkD,EAClD,oDAAoD,EACpDa,aAAa,CAACG,MACf;IAAC,CACC,CAAC,eACJP,IAAA,CAACJ,WAAW;MAACiB,KAAK,EAAGT;IAAe,CAAE,CAAC;EAAA,CACjB,CAAC;AAE1B","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { createRegistrySelector } from '@wordpress/data';
|
|
4
|
+
import { createSelector, createRegistrySelector } from '@wordpress/data';
|
|
5
5
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -55,11 +55,11 @@ export function getInstalledBlockTypes(state) {
|
|
|
55
55
|
*
|
|
56
56
|
* @return {Array} Block type items.
|
|
57
57
|
*/
|
|
58
|
-
export const getNewBlockTypes = createRegistrySelector(select => state => {
|
|
58
|
+
export const getNewBlockTypes = createRegistrySelector(select => createSelector(state => {
|
|
59
59
|
const usedBlockTree = select(blockEditorStore).getBlocks();
|
|
60
60
|
const installedBlockTypes = getInstalledBlockTypes(state);
|
|
61
61
|
return installedBlockTypes.filter(blockType => hasBlockType(blockType, usedBlockTree));
|
|
62
|
-
});
|
|
62
|
+
}, state => [getInstalledBlockTypes(state), select(blockEditorStore).getBlocks()]));
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* Returns the block types that have been installed on the server but are not
|
|
@@ -69,11 +69,11 @@ export const getNewBlockTypes = createRegistrySelector(select => state => {
|
|
|
69
69
|
*
|
|
70
70
|
* @return {Array} Block type items.
|
|
71
71
|
*/
|
|
72
|
-
export const getUnusedBlockTypes = createRegistrySelector(select => state => {
|
|
72
|
+
export const getUnusedBlockTypes = createRegistrySelector(select => createSelector(state => {
|
|
73
73
|
const usedBlockTree = select(blockEditorStore).getBlocks();
|
|
74
74
|
const installedBlockTypes = getInstalledBlockTypes(state);
|
|
75
75
|
return installedBlockTypes.filter(blockType => !hasBlockType(blockType, usedBlockTree));
|
|
76
|
-
});
|
|
76
|
+
}, state => [getInstalledBlockTypes(state), select(blockEditorStore).getBlocks()]));
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* Returns true if a block plugin install is in progress.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createRegistrySelector","store","blockEditorStore","hasBlockType","isRequestingDownloadableBlocks","state","filterValue","_state$downloadableBl","downloadableBlocks","isRequesting","getDownloadableBlocks","_state$downloadableBl2","results","getInstalledBlockTypes","blockManagement","installedBlockTypes","getNewBlockTypes","select","usedBlockTree","getBlocks","filter","blockType","getUnusedBlockTypes","isInstalling","blockId","getErrorNotices","errorNotices","getErrorNoticeForBlock"],"sources":["@wordpress/block-directory/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport hasBlockType from './utils/has-block-type';\n\n/**\n * Returns true if application is requesting for downloadable blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {boolean} Whether a request is in progress for the blocks list.\n */\nexport function isRequestingDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.isRequesting ?? false;\n}\n\n/**\n * Returns the available uninstalled blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {Array} Downloadable blocks.\n */\nexport function getDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.results ?? [];\n}\n\n/**\n * Returns the block types that have been installed on the server in this\n * session.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items\n */\nexport function getInstalledBlockTypes( state ) {\n\treturn state.blockManagement.installedBlockTypes;\n}\n\n/**\n * Returns block types that have been installed on the server and used in the\n * current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getNewBlockTypes = createRegistrySelector(
|
|
1
|
+
{"version":3,"names":["createSelector","createRegistrySelector","store","blockEditorStore","hasBlockType","isRequestingDownloadableBlocks","state","filterValue","_state$downloadableBl","downloadableBlocks","isRequesting","getDownloadableBlocks","_state$downloadableBl2","results","getInstalledBlockTypes","blockManagement","installedBlockTypes","getNewBlockTypes","select","usedBlockTree","getBlocks","filter","blockType","getUnusedBlockTypes","isInstalling","blockId","getErrorNotices","errorNotices","getErrorNoticeForBlock"],"sources":["@wordpress/block-directory/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport hasBlockType from './utils/has-block-type';\n\n/**\n * Returns true if application is requesting for downloadable blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {boolean} Whether a request is in progress for the blocks list.\n */\nexport function isRequestingDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.isRequesting ?? false;\n}\n\n/**\n * Returns the available uninstalled blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {Array} Downloadable blocks.\n */\nexport function getDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.results ?? [];\n}\n\n/**\n * Returns the block types that have been installed on the server in this\n * session.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items\n */\nexport function getInstalledBlockTypes( state ) {\n\treturn state.blockManagement.installedBlockTypes;\n}\n\n/**\n * Returns block types that have been installed on the server and used in the\n * current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getNewBlockTypes = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tconst usedBlockTree = select( blockEditorStore ).getBlocks();\n\t\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\n\t\t\treturn installedBlockTypes.filter( ( blockType ) =>\n\t\t\t\thasBlockType( blockType, usedBlockTree )\n\t\t\t);\n\t\t},\n\t\t( state ) => [\n\t\t\tgetInstalledBlockTypes( state ),\n\t\t\tselect( blockEditorStore ).getBlocks(),\n\t\t]\n\t)\n);\n\n/**\n * Returns the block types that have been installed on the server but are not\n * used in the current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getUnusedBlockTypes = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tconst usedBlockTree = select( blockEditorStore ).getBlocks();\n\t\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\n\t\t\treturn installedBlockTypes.filter(\n\t\t\t\t( blockType ) => ! hasBlockType( blockType, usedBlockTree )\n\t\t\t);\n\t\t},\n\t\t( state ) => [\n\t\t\tgetInstalledBlockTypes( state ),\n\t\t\tselect( blockEditorStore ).getBlocks(),\n\t\t]\n\t)\n);\n\n/**\n * Returns true if a block plugin install is in progress.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId Id of the block.\n *\n * @return {boolean} Whether this block is currently being installed.\n */\nexport function isInstalling( state, blockId ) {\n\treturn state.blockManagement.isInstalling[ blockId ] || false;\n}\n\n/**\n * Returns all block error notices.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Object with error notices.\n */\nexport function getErrorNotices( state ) {\n\treturn state.errorNotices;\n}\n\n/**\n * Returns the error notice for a given block.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId The ID of the block plugin. eg: my-block\n *\n * @return {string|boolean} The error text, or false if no error.\n */\nexport function getErrorNoticeForBlock( state, blockId ) {\n\treturn state.errorNotices[ blockId ];\n}\n"],"mappings":"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","ignoreList":[]}
|
package/build-style/style.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-directory",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "Extend editor with block directory features to search, download and install blocks.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,25 +27,24 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/a11y": "^4.
|
|
31
|
-
"@wordpress/api-fetch": "^7.
|
|
32
|
-
"@wordpress/block-editor": "^13.
|
|
33
|
-
"@wordpress/blocks": "^13.
|
|
34
|
-
"@wordpress/components": "^28.
|
|
35
|
-
"@wordpress/compose": "^7.
|
|
36
|
-
"@wordpress/core-data": "^7.
|
|
37
|
-
"@wordpress/data": "^10.
|
|
38
|
-
"@wordpress/
|
|
39
|
-
"@wordpress/
|
|
40
|
-
"@wordpress/
|
|
41
|
-
"@wordpress/
|
|
42
|
-
"@wordpress/
|
|
43
|
-
"@wordpress/
|
|
44
|
-
"@wordpress/
|
|
45
|
-
"@wordpress/
|
|
46
|
-
"@wordpress/
|
|
47
|
-
"@wordpress/
|
|
48
|
-
"@wordpress/url": "^4.3.0",
|
|
30
|
+
"@wordpress/a11y": "^4.4.0",
|
|
31
|
+
"@wordpress/api-fetch": "^7.4.0",
|
|
32
|
+
"@wordpress/block-editor": "^13.4.0",
|
|
33
|
+
"@wordpress/blocks": "^13.4.0",
|
|
34
|
+
"@wordpress/components": "^28.4.0",
|
|
35
|
+
"@wordpress/compose": "^7.4.0",
|
|
36
|
+
"@wordpress/core-data": "^7.4.0",
|
|
37
|
+
"@wordpress/data": "^10.4.0",
|
|
38
|
+
"@wordpress/editor": "^14.4.0",
|
|
39
|
+
"@wordpress/element": "^6.4.0",
|
|
40
|
+
"@wordpress/hooks": "^4.4.0",
|
|
41
|
+
"@wordpress/html-entities": "^4.4.0",
|
|
42
|
+
"@wordpress/i18n": "^5.4.0",
|
|
43
|
+
"@wordpress/icons": "^10.4.0",
|
|
44
|
+
"@wordpress/notices": "^5.4.0",
|
|
45
|
+
"@wordpress/plugins": "^7.4.0",
|
|
46
|
+
"@wordpress/private-apis": "^1.4.0",
|
|
47
|
+
"@wordpress/url": "^4.4.0",
|
|
49
48
|
"change-case": "^4.1.2"
|
|
50
49
|
},
|
|
51
50
|
"peerDependencies": {
|
|
@@ -55,5 +54,5 @@
|
|
|
55
54
|
"publishConfig": {
|
|
56
55
|
"access": "public"
|
|
57
56
|
},
|
|
58
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "363edb39b8dda8727f652e42cbb8497732693ed2"
|
|
59
58
|
}
|
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
display: grid;
|
|
7
7
|
grid-template-columns: auto 1fr;
|
|
8
8
|
|
|
9
|
+
// The item contains absolutely positioned items.
|
|
10
|
+
// Set `position: relative` on the parent to prevent overflow issues
|
|
11
|
+
// in scroll containers.
|
|
12
|
+
// See: https://github.com/WordPress/gutenberg/issues/63384
|
|
13
|
+
position: relative;
|
|
14
|
+
|
|
9
15
|
&:hover {
|
|
10
16
|
@include button-style__focus();
|
|
11
17
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { _n, sprintf } from '@wordpress/i18n';
|
|
5
5
|
import { useSelect } from '@wordpress/data';
|
|
6
6
|
import { blockDefault } from '@wordpress/icons';
|
|
7
|
+
import { PluginPrePublishPanel } from '@wordpress/editor';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Internal dependencies
|
|
@@ -11,10 +12,6 @@ import { blockDefault } from '@wordpress/icons';
|
|
|
11
12
|
import CompactList from '../../components/compact-list';
|
|
12
13
|
import { store as blockDirectoryStore } from '../../store';
|
|
13
14
|
|
|
14
|
-
// We shouldn't import the editor package directly
|
|
15
|
-
// because it would include the wp-editor in all pages loading the block-directory script.
|
|
16
|
-
const { PluginPrePublishPanel } = window?.wp?.editor ?? {};
|
|
17
|
-
|
|
18
15
|
export default function InstalledBlocksPrePublishPanel() {
|
|
19
16
|
const newBlockTypes = useSelect(
|
|
20
17
|
( select ) => select( blockDirectoryStore ).getNewBlockTypes(),
|
package/src/store/selectors.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { createRegistrySelector } from '@wordpress/data';
|
|
4
|
+
import { createSelector, createRegistrySelector } from '@wordpress/data';
|
|
5
5
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -53,15 +53,21 @@ export function getInstalledBlockTypes( state ) {
|
|
|
53
53
|
*
|
|
54
54
|
* @return {Array} Block type items.
|
|
55
55
|
*/
|
|
56
|
-
export const getNewBlockTypes = createRegistrySelector(
|
|
57
|
-
(
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
export const getNewBlockTypes = createRegistrySelector( ( select ) =>
|
|
57
|
+
createSelector(
|
|
58
|
+
( state ) => {
|
|
59
|
+
const usedBlockTree = select( blockEditorStore ).getBlocks();
|
|
60
|
+
const installedBlockTypes = getInstalledBlockTypes( state );
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
return installedBlockTypes.filter( ( blockType ) =>
|
|
63
|
+
hasBlockType( blockType, usedBlockTree )
|
|
64
|
+
);
|
|
65
|
+
},
|
|
66
|
+
( state ) => [
|
|
67
|
+
getInstalledBlockTypes( state ),
|
|
68
|
+
select( blockEditorStore ).getBlocks(),
|
|
69
|
+
]
|
|
70
|
+
)
|
|
65
71
|
);
|
|
66
72
|
|
|
67
73
|
/**
|
|
@@ -72,15 +78,21 @@ export const getNewBlockTypes = createRegistrySelector(
|
|
|
72
78
|
*
|
|
73
79
|
* @return {Array} Block type items.
|
|
74
80
|
*/
|
|
75
|
-
export const getUnusedBlockTypes = createRegistrySelector(
|
|
76
|
-
(
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
export const getUnusedBlockTypes = createRegistrySelector( ( select ) =>
|
|
82
|
+
createSelector(
|
|
83
|
+
( state ) => {
|
|
84
|
+
const usedBlockTree = select( blockEditorStore ).getBlocks();
|
|
85
|
+
const installedBlockTypes = getInstalledBlockTypes( state );
|
|
79
86
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
return installedBlockTypes.filter(
|
|
88
|
+
( blockType ) => ! hasBlockType( blockType, usedBlockTree )
|
|
89
|
+
);
|
|
90
|
+
},
|
|
91
|
+
( state ) => [
|
|
92
|
+
getInstalledBlockTypes( state ),
|
|
93
|
+
select( blockEditorStore ).getBlocks(),
|
|
94
|
+
]
|
|
95
|
+
)
|
|
84
96
|
);
|
|
85
97
|
|
|
86
98
|
/**
|