@wordpress/block-directory 5.57.0 → 6.1.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/build/components/auto-block-uninstaller/index.cjs +26 -47
- package/build/components/auto-block-uninstaller/index.cjs.map +1 -7
- package/build/components/block-ratings/index.cjs +28 -34
- package/build/components/block-ratings/index.cjs.map +1 -7
- package/build/components/block-ratings/stars.cjs +35 -71
- package/build/components/block-ratings/stars.cjs.map +1 -7
- package/build/components/compact-list/index.cjs +45 -43
- package/build/components/compact-list/index.cjs.map +1 -7
- package/build/components/downloadable-block-icon/index.cjs +20 -29
- package/build/components/downloadable-block-icon/index.cjs.map +1 -7
- package/build/components/downloadable-block-list-item/index.cjs +95 -161
- package/build/components/downloadable-block-list-item/index.cjs.map +1 -7
- package/build/components/downloadable-block-notice/index.cjs +23 -46
- package/build/components/downloadable-block-notice/index.cjs.map +1 -7
- package/build/components/downloadable-blocks-list/index.cjs +50 -70
- package/build/components/downloadable-blocks-list/index.cjs.map +1 -7
- package/build/components/downloadable-blocks-panel/index.cjs +79 -119
- package/build/components/downloadable-blocks-panel/index.cjs.map +1 -7
- package/build/components/downloadable-blocks-panel/inserter-panel.cjs +37 -61
- package/build/components/downloadable-blocks-panel/inserter-panel.cjs.map +1 -7
- package/build/components/downloadable-blocks-panel/no-results.cjs +27 -39
- package/build/components/downloadable-blocks-panel/no-results.cjs.map +1 -7
- package/build/index.cjs +11 -29
- package/build/plugins/get-install-missing/index.cjs +80 -122
- package/build/plugins/get-install-missing/index.cjs.map +1 -7
- package/build/plugins/get-install-missing/install-button.cjs +33 -70
- package/build/plugins/get-install-missing/install-button.cjs.map +1 -7
- package/build/plugins/index.cjs +45 -45
- package/build/plugins/index.cjs.map +1 -7
- package/build/plugins/inserter-menu-downloadable-blocks-panel/index.cjs +40 -52
- package/build/plugins/inserter-menu-downloadable-blocks-panel/index.cjs.map +1 -7
- package/build/plugins/installed-blocks-pre-publish-panel/index.cjs +38 -62
- package/build/plugins/installed-blocks-pre-publish-panel/index.cjs.map +1 -7
- package/build/store/actions.cjs +233 -205
- package/build/store/actions.cjs.map +1 -7
- package/build/store/index.cjs +56 -45
- package/build/store/index.cjs.map +1 -7
- package/build/store/load-assets.cjs +62 -63
- package/build/store/load-assets.cjs.map +1 -7
- package/build/store/reducer.cjs +90 -101
- package/build/store/reducer.cjs.map +1 -7
- package/build/store/resolvers.cjs +34 -54
- package/build/store/resolvers.cjs.map +1 -7
- package/build/store/selectors.cjs +111 -107
- package/build/store/selectors.cjs.map +1 -7
- package/build/store/utils/get-plugin-url.cjs +19 -32
- package/build/store/utils/get-plugin-url.cjs.map +1 -7
- package/build-module/components/auto-block-uninstaller/index.mjs +19 -25
- package/build-module/components/auto-block-uninstaller/index.mjs.map +1 -7
- package/build-module/components/block-ratings/index.mjs +8 -8
- package/build-module/components/block-ratings/index.mjs.map +1 -7
- package/build-module/components/block-ratings/stars.mjs +28 -49
- package/build-module/components/block-ratings/stars.mjs.map +1 -7
- package/build-module/components/compact-list/index.mjs +24 -19
- package/build-module/components/compact-list/index.mjs.map +1 -7
- package/build-module/components/downloadable-block-icon/index.mjs +14 -8
- package/build-module/components/downloadable-block-icon/index.mjs.map +1 -7
- package/build-module/components/downloadable-block-list-item/index.mjs +64 -130
- package/build-module/components/downloadable-block-list-item/index.mjs.map +1 -7
- package/build-module/components/downloadable-block-notice/index.mjs +15 -20
- package/build-module/components/downloadable-block-notice/index.mjs.map +1 -7
- package/build-module/components/downloadable-blocks-list/index.mjs +26 -43
- package/build-module/components/downloadable-blocks-list/index.mjs.map +1 -7
- package/build-module/components/downloadable-blocks-panel/index.mjs +51 -90
- package/build-module/components/downloadable-blocks-panel/index.mjs.map +1 -7
- package/build-module/components/downloadable-blocks-panel/inserter-panel.mjs +29 -38
- package/build-module/components/downloadable-blocks-panel/inserter-panel.mjs.map +1 -7
- package/build-module/components/downloadable-blocks-panel/no-results.mjs +21 -18
- package/build-module/components/downloadable-blocks-panel/no-results.mjs.map +1 -7
- package/build-module/index.mjs +1 -6
- package/build-module/plugins/get-install-missing/index.mjs +55 -98
- package/build-module/plugins/get-install-missing/index.mjs.map +1 -7
- package/build-module/plugins/get-install-missing/install-button.mjs +25 -47
- package/build-module/plugins/get-install-missing/install-button.mjs.map +1 -7
- package/build-module/plugins/index.mjs +16 -23
- package/build-module/plugins/index.mjs.map +1 -7
- package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.mjs +17 -26
- package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.mjs.map +1 -7
- package/build-module/plugins/installed-blocks-pre-publish-panel/index.mjs +15 -36
- package/build-module/plugins/installed-blocks-pre-publish-panel/index.mjs.map +1 -7
- package/build-module/store/actions.mjs +201 -170
- package/build-module/store/actions.mjs.map +1 -7
- package/build-module/store/index.mjs +28 -13
- package/build-module/store/index.mjs.map +1 -7
- package/build-module/store/load-assets.mjs +42 -36
- package/build-module/store/load-assets.mjs.map +1 -7
- package/build-module/store/reducer.mjs +81 -74
- package/build-module/store/reducer.mjs.map +1 -7
- package/build-module/store/resolvers.mjs +13 -26
- package/build-module/store/resolvers.mjs.map +1 -7
- package/build-module/store/selectors.mjs +99 -76
- package/build-module/store/selectors.mjs.map +1 -7
- package/build-module/store/utils/get-plugin-url.mjs +14 -12
- package/build-module/store/utils/get-plugin-url.mjs.map +1 -7
- package/build-style/style-rtl.css +6 -12
- package/build-style/style.css +6 -12
- package/package.json +25 -27
- package/src/components/downloadable-block-list-item/index.jsx +2 -2
- package/src/components/downloadable-block-list-item/style.scss +6 -6
- package/src/components/downloadable-blocks-panel/index.jsx +2 -2
- package/src/components/downloadable-blocks-panel/no-results.jsx +15 -8
- package/CHANGELOG.md +0 -295
- package/build/index.cjs.map +0 -7
- package/build/lock-unlock.cjs +0 -36
- package/build/lock-unlock.cjs.map +0 -7
- package/build-module/index.mjs.map +0 -7
- package/build-module/lock-unlock.mjs +0 -11
- package/build-module/lock-unlock.mjs.map +0 -7
- package/src/lock-unlock.js +0 -7
|
@@ -1,133 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
// \0rolldown/runtime.js
|
|
1
7
|
var __create = Object.create;
|
|
2
8
|
var __defProp = Object.defineProperty;
|
|
3
9
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
10
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
13
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
15
|
+
key = keys[i];
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: ((k) => from[k]).bind(null, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
18
22
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
let _wordpress_i18n = require("@wordpress/i18n");
|
|
28
|
+
let _wordpress_components = require("@wordpress/components");
|
|
29
|
+
let _wordpress_blocks = require("@wordpress/blocks");
|
|
30
|
+
let _wordpress_element = require("@wordpress/element");
|
|
31
|
+
let _wordpress_data = require("@wordpress/data");
|
|
32
|
+
let _wordpress_core_data = require("@wordpress/core-data");
|
|
33
|
+
let _wordpress_block_editor = require("@wordpress/block-editor");
|
|
34
|
+
let __install_button_jsx = require("./install-button.cjs");
|
|
35
|
+
__install_button_jsx = __toESM(__install_button_jsx);
|
|
36
|
+
let ______store_index_js = require("../../store/index.cjs");
|
|
37
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
29
38
|
// packages/block-directory/src/plugins/get-install-missing/index.jsx
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var getInstallMissing = (OriginalComponent) => (props) => {
|
|
46
|
-
const { originalName } = props.attributes;
|
|
47
|
-
const { block, hasPermission } = (0, import_data.useSelect)(
|
|
48
|
-
(select) => {
|
|
49
|
-
const { getDownloadableBlocks } = select(import_store.store);
|
|
50
|
-
const blocks = getDownloadableBlocks(
|
|
51
|
-
"block:" + originalName
|
|
52
|
-
).filter(({ name }) => originalName === name);
|
|
53
|
-
return {
|
|
54
|
-
hasPermission: select(import_core_data.store).canUser(
|
|
55
|
-
"read",
|
|
56
|
-
"block-directory/search"
|
|
57
|
-
),
|
|
58
|
-
block: blocks.length && blocks[0]
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
[originalName]
|
|
62
|
-
);
|
|
63
|
-
if (!hasPermission || !block) {
|
|
64
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OriginalComponent, { ...props });
|
|
65
|
-
}
|
|
66
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ModifiedWarning, { ...props, originalBlock: block });
|
|
39
|
+
const getInstallMissing = (OriginalComponent) => (props) => {
|
|
40
|
+
const { originalName } = props.attributes;
|
|
41
|
+
const { block, hasPermission } = (0, _wordpress_data.useSelect)((select) => {
|
|
42
|
+
const { getDownloadableBlocks } = select(______store_index_js.store);
|
|
43
|
+
const blocks = getDownloadableBlocks("block:" + originalName).filter(({ name }) => originalName === name);
|
|
44
|
+
return {
|
|
45
|
+
hasPermission: select(_wordpress_core_data.store).canUser("read", "block-directory/search"),
|
|
46
|
+
block: blocks.length && blocks[0]
|
|
47
|
+
};
|
|
48
|
+
}, [originalName]);
|
|
49
|
+
if (!hasPermission || !block) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OriginalComponent, { ...props });
|
|
50
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModifiedWarning, {
|
|
51
|
+
...props,
|
|
52
|
+
originalBlock: block
|
|
53
|
+
});
|
|
67
54
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
clientId: props.clientId
|
|
102
|
-
},
|
|
103
|
-
"install"
|
|
104
|
-
)
|
|
105
|
-
];
|
|
106
|
-
if (hasContent && hasHTMLBlock) {
|
|
107
|
-
messageHTML = (0, import_i18n.sprintf)(
|
|
108
|
-
/* translators: %s: block name */
|
|
109
|
-
(0, import_i18n.__)(
|
|
110
|
-
"Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely."
|
|
111
|
-
),
|
|
112
|
-
originalBlock.title || originalName
|
|
113
|
-
);
|
|
114
|
-
actions.push(
|
|
115
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
116
|
-
import_components.Button,
|
|
117
|
-
{
|
|
118
|
-
__next40pxDefaultSize: true,
|
|
119
|
-
onClick: convertToHTML,
|
|
120
|
-
variant: "tertiary",
|
|
121
|
-
children: (0, import_i18n.__)("Keep as HTML")
|
|
122
|
-
},
|
|
123
|
-
"convert"
|
|
124
|
-
)
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ...(0, import_block_editor.useBlockProps)(), children: [
|
|
128
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.Warning, { actions, children: messageHTML }),
|
|
129
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_element.RawHTML, { children: originalUndelimitedContent })
|
|
130
|
-
] });
|
|
55
|
+
const ModifiedWarning = ({ originalBlock, ...props }) => {
|
|
56
|
+
const { originalName, originalUndelimitedContent, clientId } = props.attributes;
|
|
57
|
+
const { replaceBlock } = (0, _wordpress_data.useDispatch)(_wordpress_block_editor.store);
|
|
58
|
+
const convertToHTML = () => {
|
|
59
|
+
replaceBlock(props.clientId, (0, _wordpress_blocks.createBlock)("core/html", {}, [], [originalUndelimitedContent]));
|
|
60
|
+
};
|
|
61
|
+
const hasContent = !!originalUndelimitedContent;
|
|
62
|
+
const hasHTMLBlock = (0, _wordpress_data.useSelect)((select) => {
|
|
63
|
+
const { canInsertBlockType, getBlockRootClientId } = select(_wordpress_block_editor.store);
|
|
64
|
+
return canInsertBlockType("core/html", getBlockRootClientId(clientId));
|
|
65
|
+
}, [clientId]);
|
|
66
|
+
let messageHTML = (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely."), originalBlock.title || originalName);
|
|
67
|
+
const actions = [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__install_button_jsx.default, {
|
|
68
|
+
block: originalBlock,
|
|
69
|
+
attributes: props.attributes,
|
|
70
|
+
clientId: props.clientId
|
|
71
|
+
}, "install")];
|
|
72
|
+
if (hasContent && hasHTMLBlock) {
|
|
73
|
+
messageHTML = (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely."), originalBlock.title || originalName);
|
|
74
|
+
actions.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.Button, {
|
|
75
|
+
__next40pxDefaultSize: true,
|
|
76
|
+
onClick: convertToHTML,
|
|
77
|
+
variant: "tertiary",
|
|
78
|
+
children: (0, _wordpress_i18n.__)("Keep as HTML")
|
|
79
|
+
}, "convert"));
|
|
80
|
+
}
|
|
81
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
82
|
+
...(0, _wordpress_block_editor.useBlockProps)(),
|
|
83
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_block_editor.Warning, {
|
|
84
|
+
actions,
|
|
85
|
+
children: messageHTML
|
|
86
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_element.RawHTML, { children: originalUndelimitedContent })]
|
|
87
|
+
});
|
|
131
88
|
};
|
|
132
|
-
|
|
133
|
-
|
|
89
|
+
exports.default = getInstallMissing;
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/get-install-missing/index.jsx"],
|
|
4
|
-
"sourcesContent": ["import { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { RawHTML } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport InstallButton from './install-button';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst getInstallMissing = ( OriginalComponent ) => ( props ) => {\n\tconst { originalName } = props.attributes;\n\tconst { block, hasPermission } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getDownloadableBlocks } = select( blockDirectoryStore );\n\t\t\tconst blocks = getDownloadableBlocks(\n\t\t\t\t'block:' + originalName\n\t\t\t).filter( ( { name } ) => originalName === name );\n\t\t\treturn {\n\t\t\t\thasPermission: select( coreStore ).canUser(\n\t\t\t\t\t'read',\n\t\t\t\t\t'block-directory/search'\n\t\t\t\t),\n\t\t\t\tblock: blocks.length && blocks[ 0 ],\n\t\t\t};\n\t\t},\n\t\t[ originalName ]\n\t);\n\n\t// The user can't install blocks, or the block isn't available for download.\n\tif ( ! hasPermission || ! block ) {\n\t\treturn <OriginalComponent { ...props } />;\n\t}\n\n\treturn <ModifiedWarning { ...props } originalBlock={ block } />;\n};\n\nconst ModifiedWarning = ( { originalBlock, ...props } ) => {\n\tconst { originalName, originalUndelimitedContent, clientId } =\n\t\tprops.attributes;\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\tconst convertToHTML = () => {\n\t\treplaceBlock(\n\t\t\tprops.clientId,\n\t\t\tcreateBlock( 'core/html', {}, [], [ originalUndelimitedContent ] )\n\t\t);\n\t};\n\n\tconst hasContent = !! originalUndelimitedContent;\n\tconst hasHTMLBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canInsertBlockType, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn canInsertBlockType(\n\t\t\t\t'core/html',\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tlet messageHTML = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__(\n\t\t\t'Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely.'\n\t\t),\n\t\toriginalBlock.title || originalName\n\t);\n\tconst actions = [\n\t\t<InstallButton\n\t\t\tkey=\"install\"\n\t\t\tblock={ originalBlock }\n\t\t\tattributes={ props.attributes }\n\t\t\tclientId={ props.clientId }\n\t\t/>,\n\t];\n\n\tif ( hasContent && hasHTMLBlock ) {\n\t\tmessageHTML = sprintf(\n\t\t\t/* translators: %s: block name */\n\t\t\t__(\n\t\t\t\t'Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely.'\n\t\t\t),\n\t\t\toriginalBlock.title || originalName\n\t\t);\n\t\tactions.push(\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tkey=\"convert\"\n\t\t\t\tonClick={ convertToHTML }\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t>\n\t\t\t\t{ __( 'Keep as HTML' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div { ...useBlockProps() }>\n\t\t\t<Warning actions={ actions }>{ messageHTML }</Warning>\n\t\t\t<RawHTML>{ originalUndelimitedContent }</RawHTML>\n\t\t</div>\n\t);\n};\n\nexport default getInstallMissing;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA4B;AAC5B,wBAAuB;AACvB,oBAA4B;AAC5B,qBAAwB;AACxB,kBAAuC;AACvC,uBAAmC;AACnC,0BAIO;AACP,4BAA0B;AAC1B,mBAA6C;AAuBpC;AArBT,IAAM,oBAAoB,CAAE,sBAAuB,CAAE,UAAW;AAC/D,QAAM,EAAE,aAAa,IAAI,MAAM;AAC/B,QAAM,EAAE,OAAO,cAAc,QAAI;AAAA,IAChC,CAAE,WAAY;AACb,YAAM,EAAE,sBAAsB,IAAI,OAAQ,aAAAA,KAAoB;AAC9D,YAAM,SAAS;AAAA,QACd,WAAW;AAAA,MACZ,EAAE,OAAQ,CAAE,EAAE,KAAK,MAAO,iBAAiB,IAAK;AAChD,aAAO;AAAA,QACN,eAAe,OAAQ,iBAAAC,KAAU,EAAE;AAAA,UAClC;AAAA,UACA;AAAA,QACD;AAAA,QACA,OAAO,OAAO,UAAU,OAAQ,CAAE;AAAA,MACnC;AAAA,IACD;AAAA,IACA,CAAE,YAAa;AAAA,EAChB;AAGA,MAAK,CAAE,iBAAiB,CAAE,OAAQ;AACjC,WAAO,4CAAC,qBAAoB,GAAG,OAAQ;AAAA,EACxC;AAEA,SAAO,4CAAC,mBAAkB,GAAG,OAAQ,eAAgB,OAAQ;AAC9D;AAEA,IAAM,kBAAkB,CAAE,EAAE,eAAe,GAAG,MAAM,MAAO;AAC1D,QAAM,EAAE,cAAc,4BAA4B,SAAS,IAC1D,MAAM;AACP,QAAM,EAAE,aAAa,QAAI,yBAAa,oBAAAC,KAAiB;AACvD,QAAM,gBAAgB,MAAM;AAC3B;AAAA,MACC,MAAM;AAAA,UACN,2BAAa,aAAa,CAAC,GAAG,CAAC,GAAG,CAAE,0BAA2B,CAAE;AAAA,IAClE;AAAA,EACD;AAEA,QAAM,aAAa,CAAC,CAAE;AACtB,QAAM,mBAAe;AAAA,IACpB,CAAE,WAAY;AACb,YAAM,EAAE,oBAAoB,qBAAqB,IAChD,OAAQ,oBAAAA,KAAiB;AAE1B,aAAO;AAAA,QACN;AAAA,QACA,qBAAsB,QAAS;AAAA,MAChC;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AAEA,MAAI,kBAAc;AAAA;AAAA,QAEjB;AAAA,MACC;AAAA,IACD;AAAA,IACA,cAAc,SAAS;AAAA,EACxB;AACA,QAAM,UAAU;AAAA,IACf;AAAA,MAAC,sBAAAC;AAAA,MAAA;AAAA,QAEA,OAAQ;AAAA,QACR,YAAa,MAAM;AAAA,QACnB,UAAW,MAAM;AAAA;AAAA,MAHb;AAAA,IAIL;AAAA,EACD;AAEA,MAAK,cAAc,cAAe;AACjC,sBAAc;AAAA;AAAA,UAEb;AAAA,QACC;AAAA,MACD;AAAA,MACA,cAAc,SAAS;AAAA,IACxB;AACA,YAAQ;AAAA,MACP;AAAA,QAAC;AAAA;AAAA,UACA,uBAAqB;AAAA,UAErB,SAAU;AAAA,UACV,SAAQ;AAAA,UAEN,8BAAI,cAAe;AAAA;AAAA,QAJjB;AAAA,MAKL;AAAA,IACD;AAAA,EACD;AAEA,SACC,6CAAC,SAAM,OAAG,mCAAc,GACvB;AAAA,gDAAC,+BAAQ,SAAsB,uBAAa;AAAA,IAC5C,4CAAC,0BAAU,sCAA4B;AAAA,KACxC;AAEF;AAEA,IAAO,8BAAQ;",
|
|
6
|
-
"names": ["blockDirectoryStore", "coreStore", "blockEditorStore", "InstallButton"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["useSelect","blockDirectoryStore","coreStore","useDispatch","blockEditorStore","createBlock","sprintf","__","InstallButton","Button","useBlockProps","Warning","RawHTML"],"sources":["../../../src/plugins/get-install-missing/index.jsx"],"sourcesContent":["import { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { RawHTML } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport InstallButton from './install-button';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst getInstallMissing = ( OriginalComponent ) => ( props ) => {\n\tconst { originalName } = props.attributes;\n\tconst { block, hasPermission } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getDownloadableBlocks } = select( blockDirectoryStore );\n\t\t\tconst blocks = getDownloadableBlocks(\n\t\t\t\t'block:' + originalName\n\t\t\t).filter( ( { name } ) => originalName === name );\n\t\t\treturn {\n\t\t\t\thasPermission: select( coreStore ).canUser(\n\t\t\t\t\t'read',\n\t\t\t\t\t'block-directory/search'\n\t\t\t\t),\n\t\t\t\tblock: blocks.length && blocks[ 0 ],\n\t\t\t};\n\t\t},\n\t\t[ originalName ]\n\t);\n\n\t// The user can't install blocks, or the block isn't available for download.\n\tif ( ! hasPermission || ! block ) {\n\t\treturn <OriginalComponent { ...props } />;\n\t}\n\n\treturn <ModifiedWarning { ...props } originalBlock={ block } />;\n};\n\nconst ModifiedWarning = ( { originalBlock, ...props } ) => {\n\tconst { originalName, originalUndelimitedContent, clientId } =\n\t\tprops.attributes;\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\tconst convertToHTML = () => {\n\t\treplaceBlock(\n\t\t\tprops.clientId,\n\t\t\tcreateBlock( 'core/html', {}, [], [ originalUndelimitedContent ] )\n\t\t);\n\t};\n\n\tconst hasContent = !! originalUndelimitedContent;\n\tconst hasHTMLBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canInsertBlockType, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn canInsertBlockType(\n\t\t\t\t'core/html',\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tlet messageHTML = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__(\n\t\t\t'Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely.'\n\t\t),\n\t\toriginalBlock.title || originalName\n\t);\n\tconst actions = [\n\t\t<InstallButton\n\t\t\tkey=\"install\"\n\t\t\tblock={ originalBlock }\n\t\t\tattributes={ props.attributes }\n\t\t\tclientId={ props.clientId }\n\t\t/>,\n\t];\n\n\tif ( hasContent && hasHTMLBlock ) {\n\t\tmessageHTML = sprintf(\n\t\t\t/* translators: %s: block name */\n\t\t\t__(\n\t\t\t\t'Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely.'\n\t\t\t),\n\t\t\toriginalBlock.title || originalName\n\t\t);\n\t\tactions.push(\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tkey=\"convert\"\n\t\t\t\tonClick={ convertToHTML }\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t>\n\t\t\t\t{ __( 'Keep as HTML' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div { ...useBlockProps() }>\n\t\t\t<Warning actions={ actions }>{ messageHTML }</Warning>\n\t\t\t<RawHTML>{ originalUndelimitedContent }</RawHTML>\n\t\t</div>\n\t);\n};\n\nexport default getInstallMissing;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAM,qBAAsB,uBAAyB,UAAW;CAC/D,MAAM,EAAE,iBAAiB,MAAM;CAC/B,MAAM,EAAE,OAAO,mBAAA,GAAkBA,gBAAAA,UAAAA,EAC9B,WAAY;EACb,MAAM,EAAE,0BAA0B,OAAQC,qBAAAA,KAAoB;EAC9D,MAAM,SAAS,sBACd,WAAW,YACZ,CAAC,CAAC,QAAU,EAAE,WAAY,iBAAiB,IAAK;EAChD,OAAO;GACN,eAAe,OAAQC,qBAAAA,KAAU,CAAC,CAAC,QAClC,QACA,wBACD;GACA,OAAO,OAAO,UAAU,OAAQ;EACjC;CACD,GACA,CAAE,YAAa,CAChB;CAGA,IAAK,CAAE,iBAAiB,CAAE,OACzB,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,mBAAD,EAAmB,GAAK,MAAS,CAAA;CAGzC,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAD;EAAiB,GAAK;EAAQ,eAAgB;CAAS,CAAA;AAC/D;AAEA,MAAM,mBAAoB,EAAE,eAAe,GAAG,YAAa;CAC1D,MAAM,EAAE,cAAc,4BAA4B,aACjD,MAAM;CACP,MAAM,EAAE,kBAAA,GAAiBC,gBAAAA,YAAAA,CAAaC,wBAAAA,KAAiB;CACvD,MAAM,sBAAsB;EAC3B,aACC,MAAM,WAAA,GACNC,kBAAAA,YAAAA,CAAa,aAAa,CAAC,GAAG,CAAC,GAAG,CAAE,0BAA2B,CAAE,CAClE;CACD;CAEA,MAAM,aAAa,CAAC,CAAE;CACtB,MAAM,gBAAA,GAAeL,gBAAAA,UAAAA,EAClB,WAAY;EACb,MAAM,EAAE,oBAAoB,yBAC3B,OAAQI,wBAAAA,KAAiB;EAE1B,OAAO,mBACN,aACA,qBAAsB,QAAS,CAChC;CACD,GACA,CAAE,QAAS,CACZ;CAEA,IAAI,eAAA,GAAcE,gBAAAA,QAAAA,EAAAA,GAEjBC,gBAAAA,GAAAA,CACC,6GACD,GACA,cAAc,SAAS,YACxB;CACA,MAAM,UAAU,CACf,iBAAA,GAAA,kBAAA,IAAA,CAACC,qBAAAA,SAAD;EAEC,OAAQ;EACR,YAAa,MAAM;EACnB,UAAW,MAAM;CACjB,GAJI,SAIJ,CACF;CAEA,IAAK,cAAc,cAAe;EACjC,eAAA,GAAcF,gBAAAA,QAAAA,EAAAA,GAEbC,gBAAAA,GAAAA,CACC,iJACD,GACA,cAAc,SAAS,YACxB;EACA,QAAQ,KACP,iBAAA,GAAA,kBAAA,IAAA,CAACE,sBAAAA,QAAD;GACC,uBAAA;GAEA,SAAU;GACV,SAAQ;GAENF,WAAAA,GAAAA,gBAAAA,GAAAA,CAAI,cAAe;EACd,GALH,SAKG,CACT;CACD;CAEA,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,IAAA,GAAKG,wBAAAA,cAAAA,CAAc;EAAxB,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,SAAD;GAAmB;GAAY,UAAA;EAAsB,CAAA,GACrD,iBAAA,GAAA,kBAAA,IAAA,CAACC,mBAAAA,SAAD,EAAA,UAAW,2BAAqC,CAAA,CAC5C;;AAEP"}
|
|
@@ -1,73 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// packages/block-directory/src/plugins/get-install-missing/install-button.jsx
|
|
20
|
-
var install_button_exports = {};
|
|
21
|
-
__export(install_button_exports, {
|
|
22
|
-
default: () => InstallButton
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
23
5
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
6
|
+
let _wordpress_i18n = require("@wordpress/i18n");
|
|
7
|
+
let _wordpress_components = require("@wordpress/components");
|
|
8
|
+
let _wordpress_blocks = require("@wordpress/blocks");
|
|
9
|
+
let _wordpress_data = require("@wordpress/data");
|
|
10
|
+
let _wordpress_block_editor = require("@wordpress/block-editor");
|
|
11
|
+
let ______store_index_js = require("../../store/index.cjs");
|
|
12
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
|
+
// packages/block-directory/src/plugins/get-install-missing/install-button.jsx
|
|
32
14
|
function InstallButton({ attributes, block, clientId }) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
clientId,
|
|
52
|
-
(0, import_blocks.createBlock)(
|
|
53
|
-
blockType.name,
|
|
54
|
-
originalBlock.attributes,
|
|
55
|
-
originalBlock.innerBlocks
|
|
56
|
-
)
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}),
|
|
61
|
-
accessibleWhenDisabled: true,
|
|
62
|
-
disabled: isInstallingBlock,
|
|
63
|
-
isBusy: isInstallingBlock,
|
|
64
|
-
variant: "primary",
|
|
65
|
-
children: (0, import_i18n.sprintf)(
|
|
66
|
-
/* translators: %s: block name */
|
|
67
|
-
(0, import_i18n.__)("Install %s"),
|
|
68
|
-
block.title
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
);
|
|
15
|
+
const isInstallingBlock = (0, _wordpress_data.useSelect)((select) => select(______store_index_js.store).isInstalling(block.id), [block.id]);
|
|
16
|
+
const { installBlockType } = (0, _wordpress_data.useDispatch)(______store_index_js.store);
|
|
17
|
+
const { replaceBlock } = (0, _wordpress_data.useDispatch)(_wordpress_block_editor.store);
|
|
18
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.Button, {
|
|
19
|
+
__next40pxDefaultSize: true,
|
|
20
|
+
onClick: () => installBlockType(block).then((success) => {
|
|
21
|
+
if (success) {
|
|
22
|
+
const blockType = (0, _wordpress_blocks.getBlockType)(block.name);
|
|
23
|
+
const [originalBlock] = (0, _wordpress_blocks.parse)(attributes.originalContent);
|
|
24
|
+
if (originalBlock && blockType) replaceBlock(clientId, (0, _wordpress_blocks.createBlock)(blockType.name, originalBlock.attributes, originalBlock.innerBlocks));
|
|
25
|
+
}
|
|
26
|
+
}),
|
|
27
|
+
accessibleWhenDisabled: true,
|
|
28
|
+
disabled: isInstallingBlock,
|
|
29
|
+
isBusy: isInstallingBlock,
|
|
30
|
+
variant: "primary",
|
|
31
|
+
children: (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("Install %s"), block.title)
|
|
32
|
+
});
|
|
72
33
|
}
|
|
73
|
-
|
|
34
|
+
exports.default = InstallButton;
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=install-button.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/get-install-missing/install-button.jsx"],
|
|
4
|
-
"sourcesContent": ["import { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createBlock, getBlockType, parse } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function InstallButton( { attributes, block, clientId } ) {\n\tconst isInstallingBlock = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).isInstalling( block.id ),\n\t\t[ block.id ]\n\t);\n\tconst { installBlockType } = useDispatch( blockDirectoryStore );\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tonClick={ () =>\n\t\t\t\tinstallBlockType( block ).then( ( success ) => {\n\t\t\t\t\tif ( success ) {\n\t\t\t\t\t\tconst blockType = getBlockType( block.name );\n\t\t\t\t\t\tconst [ originalBlock ] = parse(\n\t\t\t\t\t\t\tattributes.originalContent\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( originalBlock && blockType ) {\n\t\t\t\t\t\t\treplaceBlock(\n\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\tblockType.name,\n\t\t\t\t\t\t\t\t\toriginalBlock.attributes,\n\t\t\t\t\t\t\t\t\toriginalBlock.innerBlocks\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} )\n\t\t\t}\n\t\t\taccessibleWhenDisabled\n\t\t\tdisabled={ isInstallingBlock }\n\t\t\tisBusy={ isInstallingBlock }\n\t\t\tvariant=\"primary\"\n\t\t>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: %s: block name */\n\t\t\t\t__( 'Install %s' ),\n\t\t\t\tblock.title\n\t\t\t) }\n\t\t</Button>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA4B;AAC5B,wBAAuB;AACvB,oBAAiD;AACjD,kBAAuC;AACvC,0BAA0C;AAC1C,mBAA6C;AAW3C;AATa,SAAR,cAAgC,EAAE,YAAY,OAAO,SAAS,GAAI;AACxE,QAAM,wBAAoB;AAAA,IACzB,CAAE,WAAY,OAAQ,aAAAA,KAAoB,EAAE,aAAc,MAAM,EAAG;AAAA,IACnE,CAAE,MAAM,EAAG;AAAA,EACZ;AACA,QAAM,EAAE,iBAAiB,QAAI,yBAAa,aAAAA,KAAoB;AAC9D,QAAM,EAAE,aAAa,QAAI,yBAAa,oBAAAC,KAAiB;AAEvD,SACC;AAAA,IAAC;AAAA;AAAA,MACA,uBAAqB;AAAA,MACrB,SAAU,MACT,iBAAkB,KAAM,EAAE,KAAM,CAAE,YAAa;AAC9C,YAAK,SAAU;AACd,gBAAM,gBAAY,4BAAc,MAAM,IAAK;AAC3C,gBAAM,CAAE,aAAc,QAAI;AAAA,YACzB,WAAW;AAAA,UACZ;AACA,cAAK,iBAAiB,WAAY;AACjC;AAAA,cACC;AAAA,kBACA;AAAA,gBACC,UAAU;AAAA,gBACV,cAAc;AAAA,gBACd,cAAc;AAAA,cACf;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,MACD,CAAE;AAAA,MAEH,wBAAsB;AAAA,MACtB,UAAW;AAAA,MACX,QAAS;AAAA,MACT,SAAQ;AAAA,MAEN;AAAA;AAAA,YAED,gBAAI,YAAa;AAAA,QACjB,MAAM;AAAA,MACP;AAAA;AAAA,EACD;AAEF;",
|
|
6
|
-
"names": ["blockDirectoryStore", "blockEditorStore"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"install-button.cjs","names":["useSelect","blockDirectoryStore","useDispatch","blockEditorStore","Button","getBlockType","parse","createBlock","sprintf","__"],"sources":["../../../src/plugins/get-install-missing/install-button.jsx"],"sourcesContent":["import { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createBlock, getBlockType, parse } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function InstallButton( { attributes, block, clientId } ) {\n\tconst isInstallingBlock = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).isInstalling( block.id ),\n\t\t[ block.id ]\n\t);\n\tconst { installBlockType } = useDispatch( blockDirectoryStore );\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tonClick={ () =>\n\t\t\t\tinstallBlockType( block ).then( ( success ) => {\n\t\t\t\t\tif ( success ) {\n\t\t\t\t\t\tconst blockType = getBlockType( block.name );\n\t\t\t\t\t\tconst [ originalBlock ] = parse(\n\t\t\t\t\t\t\tattributes.originalContent\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( originalBlock && blockType ) {\n\t\t\t\t\t\t\treplaceBlock(\n\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\tblockType.name,\n\t\t\t\t\t\t\t\t\toriginalBlock.attributes,\n\t\t\t\t\t\t\t\t\toriginalBlock.innerBlocks\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} )\n\t\t\t}\n\t\t\taccessibleWhenDisabled\n\t\t\tdisabled={ isInstallingBlock }\n\t\t\tisBusy={ isInstallingBlock }\n\t\t\tvariant=\"primary\"\n\t\t>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: %s: block name */\n\t\t\t\t__( 'Install %s' ),\n\t\t\t\tblock.title\n\t\t\t) }\n\t\t</Button>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;AAOA,SAAwB,cAAe,EAAE,YAAY,OAAO,YAAa;CACxE,MAAM,qBAAA,GAAoBA,gBAAAA,UAAAA,EACvB,WAAY,OAAQC,qBAAAA,KAAoB,CAAC,CAAC,aAAc,MAAM,EAAG,GACnE,CAAE,MAAM,EAAG,CACZ;CACA,MAAM,EAAE,sBAAA,GAAqBC,gBAAAA,YAAAA,CAAaD,qBAAAA,KAAoB;CAC9D,MAAM,EAAE,kBAAA,GAAiBC,gBAAAA,YAAAA,CAAaC,wBAAAA,KAAiB;CAEvD,OACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,QAAD;EACC,uBAAA;EACA,eACC,iBAAkB,KAAM,CAAC,CAAC,MAAQ,YAAa;GAC9C,IAAK,SAAU;IACd,MAAM,aAAA,GAAYC,kBAAAA,aAAAA,CAAc,MAAM,IAAK;IAC3C,MAAM,CAAE,kBAAA,GAAkBC,kBAAAA,MAAAA,CACzB,WAAW,eACZ;IACA,IAAK,iBAAiB,WACrB,aACC,WAAA,GACAC,kBAAAA,YAAAA,CACC,UAAU,MACV,cAAc,YACd,cAAc,WACf,CACD;GAEF;EACD,CAAE;EAEH,wBAAA;EACA,UAAW;EACX,QAAS;EACT,SAAQ;EAENC,WAAAA,GAAAA,gBAAAA,QAAAA,EAAAA,GAEDC,gBAAAA,GAAAA,CAAI,YAAa,GACjB,MAAM,KACP;CACO,CAAA;AAEV"}
|
package/build/plugins/index.cjs
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
// \0rolldown/runtime.js
|
|
1
7
|
var __create = Object.create;
|
|
2
8
|
var __defProp = Object.defineProperty;
|
|
3
9
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -5,51 +11,45 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
13
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
15
|
+
key = keys[i];
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: ((k) => from[k]).bind(null, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
14
22
|
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
)
|
|
23
|
-
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
let _wordpress_plugins = require("@wordpress/plugins");
|
|
28
|
+
let _wordpress_hooks = require("@wordpress/hooks");
|
|
29
|
+
let ___components_auto_block_uninstaller_index_js = require("../components/auto-block-uninstaller/index.cjs");
|
|
30
|
+
___components_auto_block_uninstaller_index_js = __toESM(___components_auto_block_uninstaller_index_js);
|
|
31
|
+
let __inserter_menu_downloadable_blocks_panel_index_jsx = require("./inserter-menu-downloadable-blocks-panel/index.cjs");
|
|
32
|
+
__inserter_menu_downloadable_blocks_panel_index_jsx = __toESM(__inserter_menu_downloadable_blocks_panel_index_jsx);
|
|
33
|
+
let __installed_blocks_pre_publish_panel_index_jsx = require("./installed-blocks-pre-publish-panel/index.cjs");
|
|
34
|
+
__installed_blocks_pre_publish_panel_index_jsx = __toESM(__installed_blocks_pre_publish_panel_index_jsx);
|
|
35
|
+
let __get_install_missing_index_jsx = require("./get-install-missing/index.cjs");
|
|
36
|
+
__get_install_missing_index_jsx = __toESM(__get_install_missing_index_jsx);
|
|
37
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
24
38
|
// packages/block-directory/src/plugins/index.jsx
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// from rendering the fallback icon pluginIcon.
|
|
35
|
-
icon: void 0,
|
|
36
|
-
render() {
|
|
37
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
38
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_auto_block_uninstaller.default, {}),
|
|
39
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_inserter_menu_downloadable_blocks_panel.default, {}),
|
|
40
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_installed_blocks_pre_publish_panel.default, {})
|
|
41
|
-
] });
|
|
42
|
-
}
|
|
39
|
+
(0, _wordpress_plugins.registerPlugin)("block-directory", {
|
|
40
|
+
icon: void 0,
|
|
41
|
+
render() {
|
|
42
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
43
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(___components_auto_block_uninstaller_index_js.default, {}),
|
|
44
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__inserter_menu_downloadable_blocks_panel_index_jsx.default, {}),
|
|
45
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__installed_blocks_pre_publish_panel_index_jsx.default, {})
|
|
46
|
+
] });
|
|
47
|
+
}
|
|
43
48
|
});
|
|
44
|
-
(0,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
settings.edit = (0, import_get_install_missing.default)(settings.edit);
|
|
52
|
-
return settings;
|
|
53
|
-
}
|
|
54
|
-
);
|
|
55
|
-
//# sourceMappingURL=index.cjs.map
|
|
49
|
+
(0, _wordpress_hooks.addFilter)("blocks.registerBlockType", "block-directory/fallback", (settings, name) => {
|
|
50
|
+
if (name !== "core/missing") return settings;
|
|
51
|
+
settings.edit = (0, __get_install_missing_index_jsx.default)(settings.edit);
|
|
52
|
+
return settings;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/plugins/index.jsx"],
|
|
4
|
-
"sourcesContent": ["import { registerPlugin } from '@wordpress/plugins';\nimport { addFilter } from '@wordpress/hooks';\nimport AutoBlockUninstaller from '../components/auto-block-uninstaller';\nimport InserterMenuDownloadableBlocksPanel from './inserter-menu-downloadable-blocks-panel';\nimport InstalledBlocksPrePublishPanel from './installed-blocks-pre-publish-panel';\nimport getInstallMissing from './get-install-missing';\n\nregisterPlugin( 'block-directory', {\n\t// The icon is explicitly set to undefined to prevent PluginPrePublishPanel\n\t// from rendering the fallback icon pluginIcon.\n\ticon: undefined,\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<AutoBlockUninstaller />\n\t\t\t\t<InserterMenuDownloadableBlocksPanel />\n\t\t\t\t<InstalledBlocksPrePublishPanel />\n\t\t\t</>\n\t\t);\n\t},\n} );\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'block-directory/fallback',\n\t( settings, name ) => {\n\t\tif ( name !== 'core/missing' ) {\n\t\t\treturn settings;\n\t\t}\n\t\tsettings.edit = getInstallMissing( settings.edit );\n\n\t\treturn settings;\n\t}\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAA+B;AAC/B,mBAA0B;AAC1B,oCAAiC;AACjC,qDAAgD;AAChD,gDAA2C;AAC3C,iCAA8B;AAQ3B;AAAA,IANH,+BAAgB,mBAAmB;AAAA;AAAA;AAAA,EAGlC,MAAM;AAAA,EACN,SAAS;AACR,WACC,4EACC;AAAA,kDAAC,8BAAAA,SAAA,EAAqB;AAAA,MACtB,4CAAC,+CAAAC,SAAA,EAAoC;AAAA,MACrC,4CAAC,0CAAAC,SAAA,EAA+B;AAAA,OACjC;AAAA,EAEF;AACD,CAAE;AAAA,IAEF;AAAA,EACC;AAAA,EACA;AAAA,EACA,CAAE,UAAU,SAAU;AACrB,QAAK,SAAS,gBAAiB;AAC9B,aAAO;AAAA,IACR;AACA,aAAS,WAAO,2BAAAC,SAAmB,SAAS,IAAK;AAEjD,WAAO;AAAA,EACR;AACD;",
|
|
6
|
-
"names": ["AutoBlockUninstaller", "InserterMenuDownloadableBlocksPanel", "InstalledBlocksPrePublishPanel", "getInstallMissing"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["registerPlugin","AutoBlockUninstaller","InserterMenuDownloadableBlocksPanel","InstalledBlocksPrePublishPanel","addFilter","getInstallMissing"],"sources":["../../src/plugins/index.jsx"],"sourcesContent":["import { registerPlugin } from '@wordpress/plugins';\nimport { addFilter } from '@wordpress/hooks';\nimport AutoBlockUninstaller from '../components/auto-block-uninstaller';\nimport InserterMenuDownloadableBlocksPanel from './inserter-menu-downloadable-blocks-panel';\nimport InstalledBlocksPrePublishPanel from './installed-blocks-pre-publish-panel';\nimport getInstallMissing from './get-install-missing';\n\nregisterPlugin( 'block-directory', {\n\t// The icon is explicitly set to undefined to prevent PluginPrePublishPanel\n\t// from rendering the fallback icon pluginIcon.\n\ticon: undefined,\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<AutoBlockUninstaller />\n\t\t\t\t<InserterMenuDownloadableBlocksPanel />\n\t\t\t\t<InstalledBlocksPrePublishPanel />\n\t\t\t</>\n\t\t);\n\t},\n} );\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'block-directory/fallback',\n\t( settings, name ) => {\n\t\tif ( name !== 'core/missing' ) {\n\t\t\treturn settings;\n\t\t}\n\t\tsettings.edit = getInstallMissing( settings.edit );\n\n\t\treturn settings;\n\t}\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOAA,GAAAA,mBAAAA,eAAAA,CAAgB,mBAAmB;CAGlC,MAAM,KAAA;CACN,SAAS;EACR,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA;GACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,8CAAAA,SAAD,CAAuB,CAAA;GACvB,iBAAA,GAAA,kBAAA,IAAA,CAACC,oDAAAA,SAAD,CAAsC,CAAA;GACtC,iBAAA,GAAA,kBAAA,IAAA,CAACC,+CAAAA,SAAD,CAAiC,CAAA;EAChC,EAAA,CAAA;CAEJ;AACD,CAAE;CAEFC,GAAAA,iBAAAA,UAAAA,CACC,4BACA,6BACE,UAAU,SAAU;CACrB,IAAK,SAAS,gBACb,OAAO;CAER,SAAS,QAAA,GAAOC,gCAAAA,QAAAA,CAAmB,SAAS,IAAK;CAEjD,OAAO;AACR,CACD"}
|
|
@@ -1,63 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
// \0rolldown/runtime.js
|
|
1
7
|
var __create = Object.create;
|
|
2
8
|
var __defProp = Object.defineProperty;
|
|
3
9
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
10
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
13
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
15
|
+
key = keys[i];
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: ((k) => from[k]).bind(null, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
18
22
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
let _wordpress_block_editor = require("@wordpress/block-editor");
|
|
28
|
+
let _wordpress_compose = require("@wordpress/compose");
|
|
29
|
+
let _wordpress_element = require("@wordpress/element");
|
|
30
|
+
let ______components_downloadable_blocks_panel_index_jsx = require("../../components/downloadable-blocks-panel/index.cjs");
|
|
31
|
+
______components_downloadable_blocks_panel_index_jsx = __toESM(______components_downloadable_blocks_panel_index_jsx);
|
|
32
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
29
33
|
// packages/block-directory/src/plugins/inserter-menu-downloadable-blocks-panel/index.jsx
|
|
30
|
-
var inserter_menu_downloadable_blocks_panel_exports = {};
|
|
31
|
-
__export(inserter_menu_downloadable_blocks_panel_exports, {
|
|
32
|
-
default: () => inserter_menu_downloadable_blocks_panel_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(inserter_menu_downloadable_blocks_panel_exports);
|
|
35
|
-
var import_block_editor = require("@wordpress/block-editor");
|
|
36
|
-
var import_compose = require("@wordpress/compose");
|
|
37
|
-
var import_element = require("@wordpress/element");
|
|
38
|
-
var import_downloadable_blocks_panel = __toESM(require("../../components/downloadable-blocks-panel/index.cjs"));
|
|
39
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
34
|
function InserterMenuDownloadableBlocksPanel() {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
onHover,
|
|
55
|
-
filterValue: debouncedFilterValue,
|
|
56
|
-
hasLocalBlocks: hasItems,
|
|
57
|
-
isTyping: filterValue !== debouncedFilterValue
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
} });
|
|
35
|
+
const [debouncedFilterValue, setFilterValue] = (0, _wordpress_element.useState)("");
|
|
36
|
+
const debouncedSetFilterValue = (0, _wordpress_compose.debounce)(setFilterValue, 400);
|
|
37
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_block_editor.__unstableInserterMenuExtension, { children: ({ onSelect, onHover, filterValue, hasItems }) => {
|
|
38
|
+
if (debouncedFilterValue !== filterValue) debouncedSetFilterValue(filterValue);
|
|
39
|
+
if (!debouncedFilterValue) return null;
|
|
40
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(______components_downloadable_blocks_panel_index_jsx.default, {
|
|
41
|
+
onSelect,
|
|
42
|
+
onHover,
|
|
43
|
+
filterValue: debouncedFilterValue,
|
|
44
|
+
hasLocalBlocks: hasItems,
|
|
45
|
+
isTyping: filterValue !== debouncedFilterValue
|
|
46
|
+
});
|
|
47
|
+
} });
|
|
61
48
|
}
|
|
62
|
-
|
|
63
|
-
|
|
49
|
+
exports.default = InserterMenuDownloadableBlocksPanel;
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/inserter-menu-downloadable-blocks-panel/index.jsx"],
|
|
4
|
-
"sourcesContent": ["import { __unstableInserterMenuExtension } from '@wordpress/block-editor';\nimport { debounce } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\nimport DownloadableBlocksPanel from '../../components/downloadable-blocks-panel';\n\nfunction InserterMenuDownloadableBlocksPanel() {\n\tconst [ debouncedFilterValue, setFilterValue ] = useState( '' );\n\tconst debouncedSetFilterValue = debounce( setFilterValue, 400 );\n\n\treturn (\n\t\t<__unstableInserterMenuExtension>\n\t\t\t{ ( { onSelect, onHover, filterValue, hasItems } ) => {\n\t\t\t\tif ( debouncedFilterValue !== filterValue ) {\n\t\t\t\t\tdebouncedSetFilterValue( filterValue );\n\t\t\t\t}\n\n\t\t\t\tif ( ! debouncedFilterValue ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<DownloadableBlocksPanel\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tfilterValue={ debouncedFilterValue }\n\t\t\t\t\t\thasLocalBlocks={ hasItems }\n\t\t\t\t\t\tisTyping={ filterValue !== debouncedFilterValue }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} }\n\t\t</__unstableInserterMenuExtension>\n\t);\n}\n\nexport default InserterMenuDownloadableBlocksPanel;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAgD;AAChD,qBAAyB;AACzB,qBAAyB;AACzB,uCAAoC;AAkB/B;AAhBL,SAAS,sCAAsC;AAC9C,QAAM,CAAE,sBAAsB,cAAe,QAAI,yBAAU,EAAG;AAC9D,QAAM,8BAA0B,yBAAU,gBAAgB,GAAI;AAE9D,SACC,4CAAC,uDACE,WAAE,EAAE,UAAU,SAAS,aAAa,SAAS,MAAO;AACrD,QAAK,yBAAyB,aAAc;AAC3C,8BAAyB,WAAY;AAAA,IACtC;AAEA,QAAK,CAAE,sBAAuB;AAC7B,aAAO;AAAA,IACR;AAEA,WACC;AAAA,MAAC,iCAAAA;AAAA,MAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA,aAAc;AAAA,QACd,gBAAiB;AAAA,QACjB,UAAW,gBAAgB;AAAA;AAAA,IAC5B;AAAA,EAEF,GACD;AAEF;AAEA,IAAO,kDAAQ;",
|
|
6
|
-
"names": ["DownloadableBlocksPanel"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["useState","debounce","__unstableInserterMenuExtension","DownloadableBlocksPanel"],"sources":["../../../src/plugins/inserter-menu-downloadable-blocks-panel/index.jsx"],"sourcesContent":["import { __unstableInserterMenuExtension } from '@wordpress/block-editor';\nimport { debounce } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\nimport DownloadableBlocksPanel from '../../components/downloadable-blocks-panel';\n\nfunction InserterMenuDownloadableBlocksPanel() {\n\tconst [ debouncedFilterValue, setFilterValue ] = useState( '' );\n\tconst debouncedSetFilterValue = debounce( setFilterValue, 400 );\n\n\treturn (\n\t\t<__unstableInserterMenuExtension>\n\t\t\t{ ( { onSelect, onHover, filterValue, hasItems } ) => {\n\t\t\t\tif ( debouncedFilterValue !== filterValue ) {\n\t\t\t\t\tdebouncedSetFilterValue( filterValue );\n\t\t\t\t}\n\n\t\t\t\tif ( ! debouncedFilterValue ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<DownloadableBlocksPanel\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tfilterValue={ debouncedFilterValue }\n\t\t\t\t\t\thasLocalBlocks={ hasItems }\n\t\t\t\t\t\tisTyping={ filterValue !== debouncedFilterValue }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} }\n\t\t</__unstableInserterMenuExtension>\n\t);\n}\n\nexport default InserterMenuDownloadableBlocksPanel;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,SAAS,sCAAsC;CAC9C,MAAM,CAAE,sBAAsB,mBAAA,GAAmBA,mBAAAA,SAAAA,CAAU,EAAG;CAC9D,MAAM,2BAAA,GAA0BC,mBAAAA,SAAAA,CAAU,gBAAgB,GAAI;CAE9D,OACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,iCAAD,EAAA,WACK,EAAE,UAAU,SAAS,aAAa,eAAgB;EACrD,IAAK,yBAAyB,aAC7B,wBAAyB,WAAY;EAGtC,IAAK,CAAE,sBACN,OAAO;EAGR,OACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,qDAAAA,SAAD;GACY;GACD;GACV,aAAc;GACd,gBAAiB;GACjB,UAAW,gBAAgB;EAC3B,CAAA;CAEH,EACgC,CAAA;AAEnC"}
|