@wordpress/block-directory 5.32.0 → 5.32.1-next.b8c8708f3.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.js +37 -31
- package/build/components/auto-block-uninstaller/index.js.map +7 -1
- package/build/components/block-ratings/index.js +40 -22
- package/build/components/block-ratings/index.js.map +7 -1
- package/build/components/block-ratings/stars.js +66 -40
- package/build/components/block-ratings/stars.js.map +7 -1
- package/build/components/compact-list/index.js +47 -46
- package/build/components/compact-list/index.js.map +7 -1
- package/build/components/downloadable-block-icon/index.js +28 -26
- package/build/components/downloadable-block-icon/index.js.map +7 -1
- package/build/components/downloadable-block-list-item/index.js +113 -127
- package/build/components/downloadable-block-list-item/index.js.map +7 -1
- package/build/components/downloadable-block-notice/index.js +41 -31
- package/build/components/downloadable-block-notice/index.js.map +7 -1
- package/build/components/downloadable-blocks-list/index.js +72 -56
- package/build/components/downloadable-blocks-list/index.js.map +7 -1
- package/build/components/downloadable-blocks-panel/index.js +108 -95
- package/build/components/downloadable-blocks-panel/index.js.map +7 -1
- package/build/components/downloadable-blocks-panel/inserter-panel.js +52 -38
- package/build/components/downloadable-blocks-panel/inserter-panel.js.map +7 -1
- package/build/components/downloadable-blocks-panel/no-results.js +37 -30
- package/build/components/downloadable-blocks-panel/no-results.js.map +7 -1
- package/build/index.js +27 -12
- package/build/index.js.map +7 -1
- package/build/lock-unlock.js +31 -15
- package/build/lock-unlock.js.map +7 -1
- package/build/plugins/get-install-missing/index.js +123 -102
- package/build/plugins/get-install-missing/index.js.map +7 -1
- package/build/plugins/get-install-missing/install-button.js +68 -50
- package/build/plugins/get-install-missing/install-button.js.map +7 -1
- package/build/plugins/index.js +46 -29
- package/build/plugins/index.js.map +7 -1
- package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js +55 -42
- package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +7 -1
- package/build/plugins/installed-blocks-pre-publish-panel/index.js +65 -34
- package/build/plugins/installed-blocks-pre-publish-panel/index.js.map +7 -1
- package/build/store/actions.js +142 -188
- package/build/store/actions.js.map +7 -1
- package/build/store/index.js +48 -46
- package/build/store/index.js.map +7 -1
- package/build/store/load-assets.js +48 -55
- package/build/store/load-assets.js.map +7 -1
- package/build/store/reducer.js +48 -54
- package/build/store/reducer.js.map +7 -1
- package/build/store/resolvers.js +52 -31
- package/build/store/resolvers.js.map +7 -1
- package/build/store/selectors.js +100 -127
- package/build/store/selectors.js.map +7 -1
- package/build/store/utils/get-plugin-url.js +23 -14
- package/build/store/utils/get-plugin-url.js.map +7 -1
- package/build-module/components/auto-block-uninstaller/index.js +18 -24
- package/build-module/components/auto-block-uninstaller/index.js.map +7 -1
- package/build-module/components/block-ratings/index.js +9 -15
- package/build-module/components/block-ratings/index.js.map +7 -1
- package/build-module/components/block-ratings/stars.js +48 -34
- package/build-module/components/block-ratings/stars.js.map +7 -1
- package/build-module/components/compact-list/index.js +19 -39
- package/build-module/components/compact-list/index.js.map +7 -1
- package/build-module/components/downloadable-block-icon/index.js +10 -20
- package/build-module/components/downloadable-block-icon/index.js.map +7 -1
- package/build-module/components/downloadable-block-list-item/index.js +89 -120
- package/build-module/components/downloadable-block-list-item/index.js.map +7 -1
- package/build-module/components/downloadable-block-notice/index.js +19 -24
- package/build-module/components/downloadable-block-notice/index.js.map +7 -1
- package/build-module/components/downloadable-blocks-list/index.js +44 -49
- package/build-module/components/downloadable-blocks-list/index.js.map +7 -1
- package/build-module/components/downloadable-blocks-panel/index.js +81 -89
- package/build-module/components/downloadable-blocks-panel/index.js.map +7 -1
- package/build-module/components/downloadable-blocks-panel/inserter-panel.js +33 -31
- package/build-module/components/downloadable-blocks-panel/inserter-panel.js.map +7 -1
- package/build-module/components/downloadable-blocks-panel/no-results.js +19 -24
- package/build-module/components/downloadable-blocks-panel/no-results.js.map +7 -1
- package/build-module/index.js +6 -6
- package/build-module/index.js.map +7 -1
- package/build-module/lock-unlock.js +8 -7
- package/build-module/lock-unlock.js.map +7 -1
- package/build-module/plugins/get-install-missing/index.js +99 -95
- package/build-module/plugins/get-install-missing/index.js.map +7 -1
- package/build-module/plugins/get-install-missing/install-button.js +50 -44
- package/build-module/plugins/get-install-missing/install-button.js.map +7 -1
- package/build-module/plugins/index.js +24 -25
- package/build-module/plugins/index.js.map +7 -1
- package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js +26 -34
- package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +7 -1
- package/build-module/plugins/installed-blocks-pre-publish-panel/index.js +38 -28
- package/build-module/plugins/installed-blocks-pre-publish-panel/index.js.map +7 -1
- package/build-module/store/actions.js +100 -168
- package/build-module/store/actions.js.map +7 -1
- package/build-module/store/index.js +13 -36
- package/build-module/store/index.js.map +7 -1
- package/build-module/store/load-assets.js +15 -47
- package/build-module/store/load-assets.js.map +7 -1
- package/build-module/store/reducer.js +27 -49
- package/build-module/store/reducer.js.map +7 -1
- package/build-module/store/resolvers.js +16 -19
- package/build-module/store/resolvers.js.map +7 -1
- package/build-module/store/selectors.js +77 -121
- package/build-module/store/selectors.js.map +7 -1
- package/build-module/store/utils/get-plugin-url.js +6 -10
- package/build-module/store/utils/get-plugin-url.js.map +7 -1
- package/build-style/style-rtl.css +9 -142
- package/build-style/style.css +9 -142
- package/package.json +28 -21
- package/src/components/block-ratings/style.scss +2 -0
- package/src/components/compact-list/style.scss +3 -0
- package/src/components/downloadable-block-icon/style.scss +3 -0
- package/src/components/downloadable-block-list-item/style.scss +4 -0
- package/src/components/downloadable-block-notice/style.scss +3 -0
- package/src/components/downloadable-blocks-panel/style.scss +3 -1
- package/src/style.scss +8 -7
|
@@ -1,104 +1,108 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}) => originalName === name);
|
|
34
|
-
return {
|
|
35
|
-
hasPermission: select(coreStore).canUser('read', 'block-directory/search'),
|
|
36
|
-
block: blocks.length && blocks[0]
|
|
37
|
-
};
|
|
38
|
-
}, [originalName]);
|
|
39
|
-
|
|
40
|
-
// The user can't install blocks, or the block isn't available for download.
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { __, sprintf } from "@wordpress/i18n";
|
|
3
|
+
import { Button } from "@wordpress/components";
|
|
4
|
+
import { createBlock } from "@wordpress/blocks";
|
|
5
|
+
import { RawHTML } from "@wordpress/element";
|
|
6
|
+
import { useDispatch, useSelect } from "@wordpress/data";
|
|
7
|
+
import { store as coreStore } from "@wordpress/core-data";
|
|
8
|
+
import {
|
|
9
|
+
Warning,
|
|
10
|
+
useBlockProps,
|
|
11
|
+
store as blockEditorStore
|
|
12
|
+
} from "@wordpress/block-editor";
|
|
13
|
+
import InstallButton from "./install-button";
|
|
14
|
+
import { store as blockDirectoryStore } from "../../store";
|
|
15
|
+
const getInstallMissing = (OriginalComponent) => (props) => {
|
|
16
|
+
const { originalName } = props.attributes;
|
|
17
|
+
const { block, hasPermission } = useSelect(
|
|
18
|
+
(select) => {
|
|
19
|
+
const { getDownloadableBlocks } = select(blockDirectoryStore);
|
|
20
|
+
const blocks = getDownloadableBlocks(
|
|
21
|
+
"block:" + originalName
|
|
22
|
+
).filter(({ name }) => originalName === name);
|
|
23
|
+
return {
|
|
24
|
+
hasPermission: select(coreStore).canUser(
|
|
25
|
+
"read",
|
|
26
|
+
"block-directory/search"
|
|
27
|
+
),
|
|
28
|
+
block: blocks.length && blocks[0]
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
[originalName]
|
|
32
|
+
);
|
|
41
33
|
if (!hasPermission || !block) {
|
|
42
|
-
return
|
|
43
|
-
...props
|
|
44
|
-
});
|
|
34
|
+
return /* @__PURE__ */ jsx(OriginalComponent, { ...props });
|
|
45
35
|
}
|
|
46
|
-
return
|
|
47
|
-
...props,
|
|
48
|
-
originalBlock: block
|
|
49
|
-
});
|
|
36
|
+
return /* @__PURE__ */ jsx(ModifiedWarning, { ...props, originalBlock: block });
|
|
50
37
|
};
|
|
51
|
-
const ModifiedWarning = ({
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}) => {
|
|
55
|
-
const {
|
|
56
|
-
originalName,
|
|
57
|
-
originalUndelimitedContent,
|
|
58
|
-
clientId
|
|
59
|
-
} = props.attributes;
|
|
60
|
-
const {
|
|
61
|
-
replaceBlock
|
|
62
|
-
} = useDispatch(blockEditorStore);
|
|
38
|
+
const ModifiedWarning = ({ originalBlock, ...props }) => {
|
|
39
|
+
const { originalName, originalUndelimitedContent, clientId } = props.attributes;
|
|
40
|
+
const { replaceBlock } = useDispatch(blockEditorStore);
|
|
63
41
|
const convertToHTML = () => {
|
|
64
|
-
replaceBlock(
|
|
65
|
-
|
|
66
|
-
|
|
42
|
+
replaceBlock(
|
|
43
|
+
props.clientId,
|
|
44
|
+
createBlock("core/html", {
|
|
45
|
+
content: originalUndelimitedContent
|
|
46
|
+
})
|
|
47
|
+
);
|
|
67
48
|
};
|
|
68
49
|
const hasContent = !!originalUndelimitedContent;
|
|
69
|
-
const hasHTMLBlock = useSelect(
|
|
70
|
-
|
|
71
|
-
canInsertBlockType,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
50
|
+
const hasHTMLBlock = useSelect(
|
|
51
|
+
(select) => {
|
|
52
|
+
const { canInsertBlockType, getBlockRootClientId } = select(blockEditorStore);
|
|
53
|
+
return canInsertBlockType(
|
|
54
|
+
"core/html",
|
|
55
|
+
getBlockRootClientId(clientId)
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
[clientId]
|
|
59
|
+
);
|
|
60
|
+
let messageHTML = sprintf(
|
|
61
|
+
/* translators: %s: block name */
|
|
62
|
+
__(
|
|
63
|
+
"Your site doesn\u2019t include support for the %s block. You can try installing the block or remove it entirely."
|
|
64
|
+
),
|
|
65
|
+
originalBlock.title || originalName
|
|
66
|
+
);
|
|
67
|
+
const actions = [
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
InstallButton,
|
|
70
|
+
{
|
|
71
|
+
block: originalBlock,
|
|
72
|
+
attributes: props.attributes,
|
|
73
|
+
clientId: props.clientId
|
|
74
|
+
},
|
|
75
|
+
"install"
|
|
76
|
+
)
|
|
77
|
+
];
|
|
83
78
|
if (hasContent && hasHTMLBlock) {
|
|
84
|
-
messageHTML = sprintf(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
79
|
+
messageHTML = sprintf(
|
|
80
|
+
/* translators: %s: block name */
|
|
81
|
+
__(
|
|
82
|
+
"Your site doesn\u2019t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely."
|
|
83
|
+
),
|
|
84
|
+
originalBlock.title || originalName
|
|
85
|
+
);
|
|
86
|
+
actions.push(
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
Button,
|
|
89
|
+
{
|
|
90
|
+
__next40pxDefaultSize: true,
|
|
91
|
+
onClick: convertToHTML,
|
|
92
|
+
variant: "tertiary",
|
|
93
|
+
children: __("Keep as HTML")
|
|
94
|
+
},
|
|
95
|
+
"convert"
|
|
96
|
+
)
|
|
97
|
+
);
|
|
92
98
|
}
|
|
93
|
-
return
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
children: messageHTML
|
|
98
|
-
}), /*#__PURE__*/_jsx(RawHTML, {
|
|
99
|
-
children: originalUndelimitedContent
|
|
100
|
-
})]
|
|
101
|
-
});
|
|
99
|
+
return /* @__PURE__ */ jsxs("div", { ...useBlockProps(), children: [
|
|
100
|
+
/* @__PURE__ */ jsx(Warning, { actions, children: messageHTML }),
|
|
101
|
+
/* @__PURE__ */ jsx(RawHTML, { children: originalUndelimitedContent })
|
|
102
|
+
] });
|
|
102
103
|
};
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
var get_install_missing_default = getInstallMissing;
|
|
105
|
+
export {
|
|
106
|
+
get_install_missing_default as default
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugins/get-install-missing/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, 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';\n\n/**\n * Internal dependencies\n */\nimport InstallButton from './install-button';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst getInstallMissing = ( OriginalComponent ) => ( props ) => {\n\tconst { originalName } = props.attributes;\n\t// Disable reason: This is a valid component, but it's mistaken for a callback.\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\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', {\n\t\t\t\tcontent: originalUndelimitedContent,\n\t\t\t} )\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\u2019t 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\u2019t 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": "AA4CS,cAsEP,YAtEO;AAzCT,SAAS,IAAI,eAAe;AAC5B,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,aAAa,iBAAiB;AACvC,SAAS,SAAS,iBAAiB;AACnC;AAAA,EACC;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AAKP,OAAO,mBAAmB;AAC1B,SAAS,SAAS,2BAA2B;AAE7C,MAAM,oBAAoB,CAAE,sBAAuB,CAAE,UAAW;AAC/D,QAAM,EAAE,aAAa,IAAI,MAAM;AAG/B,QAAM,EAAE,OAAO,cAAc,IAAI;AAAA,IAChC,CAAE,WAAY;AACb,YAAM,EAAE,sBAAsB,IAAI,OAAQ,mBAAoB;AAC9D,YAAM,SAAS;AAAA,QACd,WAAW;AAAA,MACZ,EAAE,OAAQ,CAAE,EAAE,KAAK,MAAO,iBAAiB,IAAK;AAChD,aAAO;AAAA,QACN,eAAe,OAAQ,SAAU,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,oBAAC,qBAAoB,GAAG,OAAQ;AAAA,EACxC;AAEA,SAAO,oBAAC,mBAAkB,GAAG,OAAQ,eAAgB,OAAQ;AAC9D;AAEA,MAAM,kBAAkB,CAAE,EAAE,eAAe,GAAG,MAAM,MAAO;AAC1D,QAAM,EAAE,cAAc,4BAA4B,SAAS,IAC1D,MAAM;AACP,QAAM,EAAE,aAAa,IAAI,YAAa,gBAAiB;AACvD,QAAM,gBAAgB,MAAM;AAC3B;AAAA,MACC,MAAM;AAAA,MACN,YAAa,aAAa;AAAA,QACzB,SAAS;AAAA,MACV,CAAE;AAAA,IACH;AAAA,EACD;AAEA,QAAM,aAAa,CAAC,CAAE;AACtB,QAAM,eAAe;AAAA,IACpB,CAAE,WAAY;AACb,YAAM,EAAE,oBAAoB,qBAAqB,IAChD,OAAQ,gBAAiB;AAE1B,aAAO;AAAA,QACN;AAAA,QACA,qBAAsB,QAAS;AAAA,MAChC;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AAEA,MAAI,cAAc;AAAA;AAAA,IAEjB;AAAA,MACC;AAAA,IACD;AAAA,IACA,cAAc,SAAS;AAAA,EACxB;AACA,QAAM,UAAU;AAAA,IACf;AAAA,MAAC;AAAA;AAAA,QAEA,OAAQ;AAAA,QACR,YAAa,MAAM;AAAA,QACnB,UAAW,MAAM;AAAA;AAAA,MAHb;AAAA,IAIL;AAAA,EACD;AAEA,MAAK,cAAc,cAAe;AACjC,kBAAc;AAAA;AAAA,MAEb;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,aAAI,cAAe;AAAA;AAAA,QAJjB;AAAA,MAKL;AAAA,IACD;AAAA,EACD;AAEA,SACC,qBAAC,SAAM,GAAG,cAAc,GACvB;AAAA,wBAAC,WAAQ,SAAsB,uBAAa;AAAA,IAC5C,oBAAC,WAAU,sCAA4B;AAAA,KACxC;AAEF;AAEA,IAAO,8BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,46 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { __, sprintf } from "@wordpress/i18n";
|
|
3
|
+
import { Button } from "@wordpress/components";
|
|
4
|
+
import { createBlock, getBlockType, parse } from "@wordpress/blocks";
|
|
5
|
+
import { useSelect, useDispatch } from "@wordpress/data";
|
|
6
|
+
import { store as blockEditorStore } from "@wordpress/block-editor";
|
|
7
|
+
import { store as blockDirectoryStore } from "../../store";
|
|
8
|
+
function InstallButton({ attributes, block, clientId }) {
|
|
9
|
+
const isInstallingBlock = useSelect(
|
|
10
|
+
(select) => select(blockDirectoryStore).isInstalling(block.id),
|
|
11
|
+
[block.id]
|
|
12
|
+
);
|
|
13
|
+
const { installBlockType } = useDispatch(blockDirectoryStore);
|
|
14
|
+
const { replaceBlock } = useDispatch(blockEditorStore);
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
Button,
|
|
17
|
+
{
|
|
18
|
+
__next40pxDefaultSize: true,
|
|
19
|
+
onClick: () => installBlockType(block).then((success) => {
|
|
20
|
+
if (success) {
|
|
21
|
+
const blockType = getBlockType(block.name);
|
|
22
|
+
const [originalBlock] = parse(
|
|
23
|
+
attributes.originalContent
|
|
24
|
+
);
|
|
25
|
+
if (originalBlock && blockType) {
|
|
26
|
+
replaceBlock(
|
|
27
|
+
clientId,
|
|
28
|
+
createBlock(
|
|
29
|
+
blockType.name,
|
|
30
|
+
originalBlock.attributes,
|
|
31
|
+
originalBlock.innerBlocks
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
35
|
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
}),
|
|
37
|
+
accessibleWhenDisabled: true,
|
|
38
|
+
disabled: isInstallingBlock,
|
|
39
|
+
isBusy: isInstallingBlock,
|
|
40
|
+
variant: "primary",
|
|
41
|
+
children: sprintf(
|
|
42
|
+
/* translators: %s: block name */
|
|
43
|
+
__("Install %s"),
|
|
44
|
+
block.title
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
);
|
|
45
48
|
}
|
|
46
|
-
|
|
49
|
+
export {
|
|
50
|
+
InstallButton as default
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=install-button.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugins/get-install-missing/install-button.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, 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';\n\n/**\n * Internal dependencies\n */\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": "AAuBE;AApBF,SAAS,IAAI,eAAe;AAC5B,SAAS,cAAc;AACvB,SAAS,aAAa,cAAc,aAAa;AACjD,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,wBAAwB;AAK1C,SAAS,SAAS,2BAA2B;AAE9B,SAAR,cAAgC,EAAE,YAAY,OAAO,SAAS,GAAI;AACxE,QAAM,oBAAoB;AAAA,IACzB,CAAE,WAAY,OAAQ,mBAAoB,EAAE,aAAc,MAAM,EAAG;AAAA,IACnE,CAAE,MAAM,EAAG;AAAA,EACZ;AACA,QAAM,EAAE,iBAAiB,IAAI,YAAa,mBAAoB;AAC9D,QAAM,EAAE,aAAa,IAAI,YAAa,gBAAiB;AAEvD,SACC;AAAA,IAAC;AAAA;AAAA,MACA,uBAAqB;AAAA,MACrB,SAAU,MACT,iBAAkB,KAAM,EAAE,KAAM,CAAE,YAAa;AAC9C,YAAK,SAAU;AACd,gBAAM,YAAY,aAAc,MAAM,IAAK;AAC3C,gBAAM,CAAE,aAAc,IAAI;AAAA,YACzB,WAAW;AAAA,UACZ;AACA,cAAK,iBAAiB,WAAY;AACjC;AAAA,cACC;AAAA,cACA;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,QAED,GAAI,YAAa;AAAA,QACjB,MAAM;AAAA,MACP;AAAA;AAAA,EACD;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,32 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
import AutoBlockUninstaller from '../components/auto-block-uninstaller';
|
|
11
|
-
import InserterMenuDownloadableBlocksPanel from './inserter-menu-downloadable-blocks-panel';
|
|
12
|
-
import InstalledBlocksPrePublishPanel from './installed-blocks-pre-publish-panel';
|
|
13
|
-
import getInstallMissing from './get-install-missing';
|
|
14
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
registerPlugin('block-directory', {
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { registerPlugin } from "@wordpress/plugins";
|
|
3
|
+
import { addFilter } from "@wordpress/hooks";
|
|
4
|
+
import AutoBlockUninstaller from "../components/auto-block-uninstaller";
|
|
5
|
+
import InserterMenuDownloadableBlocksPanel from "./inserter-menu-downloadable-blocks-panel";
|
|
6
|
+
import InstalledBlocksPrePublishPanel from "./installed-blocks-pre-publish-panel";
|
|
7
|
+
import getInstallMissing from "./get-install-missing";
|
|
8
|
+
registerPlugin("block-directory", {
|
|
16
9
|
// The icon is explicitly set to undefined to prevent PluginPrePublishPanel
|
|
17
10
|
// from rendering the fallback icon pluginIcon.
|
|
18
|
-
icon:
|
|
11
|
+
icon: void 0,
|
|
19
12
|
render() {
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14
|
+
/* @__PURE__ */ jsx(AutoBlockUninstaller, {}),
|
|
15
|
+
/* @__PURE__ */ jsx(InserterMenuDownloadableBlocksPanel, {}),
|
|
16
|
+
/* @__PURE__ */ jsx(InstalledBlocksPrePublishPanel, {})
|
|
17
|
+
] });
|
|
23
18
|
}
|
|
24
19
|
});
|
|
25
|
-
addFilter(
|
|
26
|
-
|
|
20
|
+
addFilter(
|
|
21
|
+
"blocks.registerBlockType",
|
|
22
|
+
"block-directory/fallback",
|
|
23
|
+
(settings, name) => {
|
|
24
|
+
if (name !== "core/missing") {
|
|
25
|
+
return settings;
|
|
26
|
+
}
|
|
27
|
+
settings.edit = getInstallMissing(settings.edit);
|
|
27
28
|
return settings;
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
//# sourceMappingURL=index.js.map
|
|
30
|
+
);
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/plugins/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { registerPlugin } from '@wordpress/plugins';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\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": "AAoBG,mBACC,KADD;AAjBH,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAK1B,OAAO,0BAA0B;AACjC,OAAO,yCAAyC;AAChD,OAAO,oCAAoC;AAC3C,OAAO,uBAAuB;AAE9B,eAAgB,mBAAmB;AAAA;AAAA;AAAA,EAGlC,MAAM;AAAA,EACN,SAAS;AACR,WACC,iCACC;AAAA,0BAAC,wBAAqB;AAAA,MACtB,oBAAC,uCAAoC;AAAA,MACrC,oBAAC,kCAA+B;AAAA,OACjC;AAAA,EAEF;AACD,CAAE;AAEF;AAAA,EACC;AAAA,EACA;AAAA,EACA,CAAE,UAAU,SAAU;AACrB,QAAK,SAAS,gBAAiB;AAC9B,aAAO;AAAA,IACR;AACA,aAAS,OAAO,kBAAmB,SAAS,IAAK;AAEjD,WAAO;AAAA,EACR;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,40 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { useState } from '@wordpress/element';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import DownloadableBlocksPanel from '../../components/downloadable-blocks-panel';
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { __unstableInserterMenuExtension } from "@wordpress/block-editor";
|
|
3
|
+
import { debounce } from "@wordpress/compose";
|
|
4
|
+
import { useState } from "@wordpress/element";
|
|
5
|
+
import DownloadableBlocksPanel from "../../components/downloadable-blocks-panel";
|
|
13
6
|
function InserterMenuDownloadableBlocksPanel() {
|
|
14
|
-
const [debouncedFilterValue, setFilterValue] = useState(
|
|
7
|
+
const [debouncedFilterValue, setFilterValue] = useState("");
|
|
15
8
|
const debouncedSetFilterValue = debounce(setFilterValue, 400);
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
return /*#__PURE__*/_jsx(DownloadableBlocksPanel, {
|
|
30
|
-
onSelect: onSelect,
|
|
31
|
-
onHover: onHover,
|
|
9
|
+
return /* @__PURE__ */ jsx(__unstableInserterMenuExtension, { children: ({ onSelect, onHover, filterValue, hasItems }) => {
|
|
10
|
+
if (debouncedFilterValue !== filterValue) {
|
|
11
|
+
debouncedSetFilterValue(filterValue);
|
|
12
|
+
}
|
|
13
|
+
if (!debouncedFilterValue) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
DownloadableBlocksPanel,
|
|
18
|
+
{
|
|
19
|
+
onSelect,
|
|
20
|
+
onHover,
|
|
32
21
|
filterValue: debouncedFilterValue,
|
|
33
22
|
hasLocalBlocks: hasItems,
|
|
34
23
|
isTyping: filterValue !== debouncedFilterValue
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
});
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
} });
|
|
38
27
|
}
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
var inserter_menu_downloadable_blocks_panel_default = InserterMenuDownloadableBlocksPanel;
|
|
29
|
+
export {
|
|
30
|
+
inserter_menu_downloadable_blocks_panel_default as default
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugins/inserter-menu-downloadable-blocks-panel/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __unstableInserterMenuExtension } from '@wordpress/block-editor';\nimport { debounce } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\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": "AA4BK;AAzBL,SAAS,uCAAuC;AAChD,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AAKzB,OAAO,6BAA6B;AAEpC,SAAS,sCAAsC;AAC9C,QAAM,CAAE,sBAAsB,cAAe,IAAI,SAAU,EAAG;AAC9D,QAAM,0BAA0B,SAAU,gBAAgB,GAAI;AAE9D,SACC,oBAAC,mCACE,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;AAAA;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": []
|
|
7
|
+
}
|
|
@@ -1,32 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import { store as blockDirectoryStore } from '../../store';
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
export default function InstalledBlocksPrePublishPanel() {
|
|
15
|
-
const newBlockTypes = useSelect(select => select(blockDirectoryStore).getNewBlockTypes(), []);
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { _n, sprintf } from "@wordpress/i18n";
|
|
3
|
+
import { useSelect } from "@wordpress/data";
|
|
4
|
+
import { PluginPrePublishPanel } from "@wordpress/editor";
|
|
5
|
+
import CompactList from "../../components/compact-list";
|
|
6
|
+
import { store as blockDirectoryStore } from "../../store";
|
|
7
|
+
function InstalledBlocksPrePublishPanel() {
|
|
8
|
+
const newBlockTypes = useSelect(
|
|
9
|
+
(select) => select(blockDirectoryStore).getNewBlockTypes(),
|
|
10
|
+
[]
|
|
11
|
+
);
|
|
16
12
|
if (!newBlockTypes.length) {
|
|
17
13
|
return null;
|
|
18
14
|
}
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
return /* @__PURE__ */ jsxs(
|
|
16
|
+
PluginPrePublishPanel,
|
|
17
|
+
{
|
|
18
|
+
title: sprintf(
|
|
19
|
+
// translators: %d: number of blocks (number).
|
|
20
|
+
_n(
|
|
21
|
+
"Added: %d block",
|
|
22
|
+
"Added: %d blocks",
|
|
23
|
+
newBlockTypes.length
|
|
24
|
+
),
|
|
25
|
+
newBlockTypes.length
|
|
26
|
+
),
|
|
27
|
+
initialOpen: true,
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsx("p", { className: "installed-blocks-pre-publish-panel__copy", children: _n(
|
|
30
|
+
"The following block has been added to your site.",
|
|
31
|
+
"The following blocks have been added to your site.",
|
|
32
|
+
newBlockTypes.length
|
|
33
|
+
) }),
|
|
34
|
+
/* @__PURE__ */ jsx(CompactList, { items: newBlockTypes })
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
);
|
|
31
38
|
}
|
|
32
|
-
|
|
39
|
+
export {
|
|
40
|
+
InstalledBlocksPrePublishPanel as default
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugins/installed-blocks-pre-publish-panel/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\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\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"],
|
|
5
|
+
"mappings": "AAwBE,SAYC,KAZD;AArBF,SAAS,IAAI,eAAe;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,6BAA6B;AAKtC,OAAO,iBAAiB;AACxB,SAAS,SAAS,2BAA2B;AAE9B,SAAR,iCAAkD;AACxD,QAAM,gBAAgB;AAAA,IACrB,CAAE,WAAY,OAAQ,mBAAoB,EAAE,iBAAiB;AAAA,IAC7D,CAAC;AAAA,EACF;AAEA,MAAK,CAAE,cAAc,QAAS;AAC7B,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ;AAAA;AAAA,QAEP;AAAA,UACC;AAAA,UACA;AAAA,UACA,cAAc;AAAA,QACf;AAAA,QACA,cAAc;AAAA,MACf;AAAA,MACA,aAAW;AAAA,MAEX;AAAA,4BAAC,OAAE,WAAU,4CACV;AAAA,UACD;AAAA,UACA;AAAA,UACA,cAAc;AAAA,QACf,GACD;AAAA,QACA,oBAAC,eAAY,OAAQ,eAAgB;AAAA;AAAA;AAAA,EACtC;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|