@wordpress/block-directory 4.35.0 → 5.0.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/block-ratings/index.js +7 -6
  3. package/build/components/block-ratings/index.js.map +1 -1
  4. package/build/components/block-ratings/stars.js +23 -25
  5. package/build/components/block-ratings/stars.js.map +1 -1
  6. package/build/components/compact-list/index.js +26 -22
  7. package/build/components/compact-list/index.js.map +1 -1
  8. package/build/components/downloadable-block-icon/index.js +3 -3
  9. package/build/components/downloadable-block-icon/index.js.map +1 -1
  10. package/build/components/downloadable-block-list-item/index.js +37 -27
  11. package/build/components/downloadable-block-list-item/index.js.map +1 -1
  12. package/build/components/downloadable-block-notice/index.js +8 -6
  13. package/build/components/downloadable-block-notice/index.js.map +1 -1
  14. package/build/components/downloadable-blocks-list/index.js +26 -26
  15. package/build/components/downloadable-blocks-list/index.js.map +1 -1
  16. package/build/components/downloadable-blocks-panel/index.js +24 -17
  17. package/build/components/downloadable-blocks-panel/index.js.map +1 -1
  18. package/build/components/downloadable-blocks-panel/inserter-panel.js +21 -14
  19. package/build/components/downloadable-blocks-panel/inserter-panel.js.map +1 -1
  20. package/build/components/downloadable-blocks-panel/no-results.js +20 -11
  21. package/build/components/downloadable-blocks-panel/no-results.js.map +1 -1
  22. package/build/plugins/get-install-missing/index.js +18 -15
  23. package/build/plugins/get-install-missing/index.js.map +1 -1
  24. package/build/plugins/get-install-missing/install-button.js +6 -5
  25. package/build/plugins/get-install-missing/install-button.js.map +1 -1
  26. package/build/plugins/index.js +4 -2
  27. package/build/plugins/index.js.map +1 -1
  28. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js +21 -19
  29. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +1 -1
  30. package/build/plugins/installed-blocks-pre-publish-panel/index.js +10 -8
  31. package/build/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
  32. package/build-module/components/block-ratings/index.js +7 -6
  33. package/build-module/components/block-ratings/index.js.map +1 -1
  34. package/build-module/components/block-ratings/stars.js +24 -25
  35. package/build-module/components/block-ratings/stars.js.map +1 -1
  36. package/build-module/components/compact-list/index.js +27 -22
  37. package/build-module/components/compact-list/index.js.map +1 -1
  38. package/build-module/components/downloadable-block-icon/index.js +3 -3
  39. package/build-module/components/downloadable-block-icon/index.js.map +1 -1
  40. package/build-module/components/downloadable-block-list-item/index.js +39 -27
  41. package/build-module/components/downloadable-block-list-item/index.js.map +1 -1
  42. package/build-module/components/downloadable-block-notice/index.js +9 -6
  43. package/build-module/components/downloadable-block-notice/index.js.map +1 -1
  44. package/build-module/components/downloadable-blocks-list/index.js +26 -26
  45. package/build-module/components/downloadable-blocks-list/index.js.map +1 -1
  46. package/build-module/components/downloadable-blocks-panel/index.js +26 -17
  47. package/build-module/components/downloadable-blocks-panel/index.js.map +1 -1
  48. package/build-module/components/downloadable-blocks-panel/inserter-panel.js +23 -14
  49. package/build-module/components/downloadable-blocks-panel/inserter-panel.js.map +1 -1
  50. package/build-module/components/downloadable-blocks-panel/no-results.js +22 -11
  51. package/build-module/components/downloadable-blocks-panel/no-results.js.map +1 -1
  52. package/build-module/plugins/get-install-missing/index.js +19 -15
  53. package/build-module/plugins/get-install-missing/index.js.map +1 -1
  54. package/build-module/plugins/get-install-missing/install-button.js +6 -5
  55. package/build-module/plugins/get-install-missing/install-button.js.map +1 -1
  56. package/build-module/plugins/index.js +6 -2
  57. package/build-module/plugins/index.js.map +1 -1
  58. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js +21 -19
  59. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +1 -1
  60. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js +11 -8
  61. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
  62. package/package.json +23 -22
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = DownloadableBlocksPanel;
8
- var _react = require("react");
9
8
  var _i18n = require("@wordpress/i18n");
10
9
  var _components = require("@wordpress/components");
11
10
  var _coreData = require("@wordpress/core-data");
@@ -15,6 +14,7 @@ var _downloadableBlocksList = _interopRequireDefault(require("../downloadable-bl
15
14
  var _inserterPanel = _interopRequireDefault(require("./inserter-panel"));
16
15
  var _noResults = _interopRequireDefault(require("./no-results"));
17
16
  var _store = require("../../store");
17
+ var _jsxRuntime = require("react/jsx-runtime");
18
18
  /**
19
19
  * WordPress dependencies
20
20
  */
@@ -78,30 +78,37 @@ function DownloadableBlocksPanel({
78
78
  isLoading
79
79
  } = useDownloadableBlocks(filterValue);
80
80
  if (hasPermission === undefined || isLoading || isTyping) {
81
- return (0, _react.createElement)(_react.Fragment, null, hasPermission && !hasLocalBlocks && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("p", {
82
- className: "block-directory-downloadable-blocks-panel__no-local"
83
- }, (0, _i18n.__)('No results available from your installed blocks.')), (0, _react.createElement)("div", {
84
- className: "block-editor-inserter__quick-inserter-separator"
85
- })), (0, _react.createElement)("div", {
86
- className: "block-directory-downloadable-blocks-panel has-blocks-loading"
87
- }, (0, _react.createElement)(_components.Spinner, null)));
81
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
82
+ children: [hasPermission && !hasLocalBlocks && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
83
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
84
+ className: "block-directory-downloadable-blocks-panel__no-local",
85
+ children: (0, _i18n.__)('No results available from your installed blocks.')
86
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
87
+ className: "block-editor-inserter__quick-inserter-separator"
88
+ })]
89
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
90
+ className: "block-directory-downloadable-blocks-panel has-blocks-loading",
91
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {})
92
+ })]
93
+ });
88
94
  }
89
95
  if (false === hasPermission) {
90
96
  if (!hasLocalBlocks) {
91
- return (0, _react.createElement)(_noResults.default, null);
97
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_noResults.default, {});
92
98
  }
93
99
  return null;
94
100
  }
95
101
  if (downloadableBlocks.length === 0) {
96
- return hasLocalBlocks ? null : (0, _react.createElement)(_noResults.default, null);
102
+ return hasLocalBlocks ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_noResults.default, {});
97
103
  }
98
- return (0, _react.createElement)(_inserterPanel.default, {
104
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_inserterPanel.default, {
99
105
  downloadableItems: downloadableBlocks,
100
- hasLocalBlocks: hasLocalBlocks
101
- }, (0, _react.createElement)(_downloadableBlocksList.default, {
102
- items: downloadableBlocks,
103
- onSelect: onSelect,
104
- onHover: onHover
105
- }));
106
+ hasLocalBlocks: hasLocalBlocks,
107
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_downloadableBlocksList.default, {
108
+ items: downloadableBlocks,
109
+ onSelect: onSelect,
110
+ onHover: onHover
111
+ })
112
+ });
106
113
  }
107
114
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_coreData","_data","_blocks","_downloadableBlocksList","_interopRequireDefault","_inserterPanel","_noResults","_store","EMPTY_ARRAY","useDownloadableBlocks","filterValue","useSelect","select","getDownloadableBlocks","isRequestingDownloadableBlocks","getInstalledBlockTypes","blockDirectoryStore","hasPermission","coreStore","canUser","downloadableBlocks","installedBlockTypes","installableBlocks","filter","name","isJustInstalled","some","blockType","isPreviouslyInstalled","getBlockType","length","isLoading","DownloadableBlocksPanel","onSelect","onHover","hasLocalBlocks","isTyping","undefined","_react","createElement","Fragment","className","__","Spinner","default","downloadableItems","items"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Spinner } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlocksList from '../downloadable-blocks-list';\nimport DownloadableBlocksInserterPanel from './inserter-panel';\nimport DownloadableBlocksNoResults from './no-results';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst EMPTY_ARRAY = [];\n\nconst useDownloadableBlocks = ( filterValue ) =>\n\tuseSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetDownloadableBlocks,\n\t\t\t\tisRequestingDownloadableBlocks,\n\t\t\t\tgetInstalledBlockTypes,\n\t\t\t} = select( blockDirectoryStore );\n\n\t\t\tconst hasPermission = select( coreStore ).canUser(\n\t\t\t\t'read',\n\t\t\t\t'block-directory/search'\n\t\t\t);\n\n\t\t\tlet downloadableBlocks = EMPTY_ARRAY;\n\t\t\tif ( hasPermission ) {\n\t\t\t\tdownloadableBlocks = getDownloadableBlocks( filterValue );\n\n\t\t\t\t// Filter out blocks that are already installed.\n\t\t\t\tconst installedBlockTypes = getInstalledBlockTypes();\n\t\t\t\tconst installableBlocks = downloadableBlocks.filter(\n\t\t\t\t\t( { name } ) => {\n\t\t\t\t\t\t// Check if the block has just been installed, in which case it\n\t\t\t\t\t\t// should still show in the list to avoid suddenly disappearing.\n\t\t\t\t\t\t// `installedBlockTypes` only returns blocks stored in state\n\t\t\t\t\t\t// immediately after installation, not all installed blocks.\n\t\t\t\t\t\tconst isJustInstalled = installedBlockTypes.some(\n\t\t\t\t\t\t\t( blockType ) => blockType.name === name\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst isPreviouslyInstalled = getBlockType( name );\n\t\t\t\t\t\treturn isJustInstalled || ! isPreviouslyInstalled;\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\t// Keep identity of the `downloadableBlocks` array if nothing was filtered out\n\t\t\t\tif ( installableBlocks.length !== downloadableBlocks.length ) {\n\t\t\t\t\tdownloadableBlocks = installableBlocks;\n\t\t\t\t}\n\n\t\t\t\t// Return identical empty array when there are no blocks\n\t\t\t\tif ( downloadableBlocks.length === 0 ) {\n\t\t\t\t\tdownloadableBlocks = EMPTY_ARRAY;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\thasPermission,\n\t\t\t\tdownloadableBlocks,\n\t\t\t\tisLoading: isRequestingDownloadableBlocks( filterValue ),\n\t\t\t};\n\t\t},\n\t\t[ filterValue ]\n\t);\n\nexport default function DownloadableBlocksPanel( {\n\tonSelect,\n\tonHover,\n\thasLocalBlocks,\n\tisTyping,\n\tfilterValue,\n} ) {\n\tconst { hasPermission, downloadableBlocks, isLoading } =\n\t\tuseDownloadableBlocks( filterValue );\n\n\tif ( hasPermission === undefined || isLoading || isTyping ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ hasPermission && ! hasLocalBlocks && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__no-local\">\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'No results available from your installed blocks.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<div className=\"block-directory-downloadable-blocks-panel has-blocks-loading\">\n\t\t\t\t\t<Spinner />\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tif ( false === hasPermission ) {\n\t\tif ( ! hasLocalBlocks ) {\n\t\t\treturn <DownloadableBlocksNoResults />;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tif ( downloadableBlocks.length === 0 ) {\n\t\treturn hasLocalBlocks ? null : <DownloadableBlocksNoResults />;\n\t}\n\n\treturn (\n\t\t<DownloadableBlocksInserterPanel\n\t\t\tdownloadableItems={ downloadableBlocks }\n\t\t\thasLocalBlocks={ hasLocalBlocks }\n\t\t>\n\t\t\t<DownloadableBlocksList\n\t\t\t\titems={ downloadableBlocks }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tonHover={ onHover }\n\t\t\t/>\n\t\t</DownloadableBlocksInserterPanel>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,uBAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,cAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA,IAAAQ,UAAA,GAAAF,sBAAA,CAAAN,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAfA;AACA;AACA;;AAOA;AACA;AACA;;AAMA,MAAMU,WAAW,GAAG,EAAE;AAEtB,MAAMC,qBAAqB,GAAKC,WAAW,IAC1C,IAAAC,eAAS,EACNC,MAAM,IAAM;EACb,MAAM;IACLC,qBAAqB;IACrBC,8BAA8B;IAC9BC;EACD,CAAC,GAAGH,MAAM,CAAEI,YAAoB,CAAC;EAEjC,MAAMC,aAAa,GAAGL,MAAM,CAAEM,eAAU,CAAC,CAACC,OAAO,CAChD,MAAM,EACN,wBACD,CAAC;EAED,IAAIC,kBAAkB,GAAGZ,WAAW;EACpC,IAAKS,aAAa,EAAG;IACpBG,kBAAkB,GAAGP,qBAAqB,CAAEH,WAAY,CAAC;;IAEzD;IACA,MAAMW,mBAAmB,GAAGN,sBAAsB,CAAC,CAAC;IACpD,MAAMO,iBAAiB,GAAGF,kBAAkB,CAACG,MAAM,CAClD,CAAE;MAAEC;IAAK,CAAC,KAAM;MACf;MACA;MACA;MACA;MACA,MAAMC,eAAe,GAAGJ,mBAAmB,CAACK,IAAI,CAC7CC,SAAS,IAAMA,SAAS,CAACH,IAAI,K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AEA,IAAK,KAAK,KAAK1B,aAAa,EAAG;IAC9B,IAAK,CAAEkB,cAAc,EAAG;MACvB,OAAO,IAAAG,MAAA,CAAAC,aAAA,EAACjC,UAAA,CAAAsC,OAA2B,MAAE,CAAC;IACvC;IAEA,OAAO,IAAI;EACZ;EAEA,IAAKxB,kBAAkB,CAACU,MAAM,KAAK,CAAC,EAAG;IACtC,OAAOK,cAAc,GAAG,IAAI,GAAG,IAAAG,MAAA,CAAAC,aAAA,EAACjC,UAAA,CAAAsC,OAA2B,MAAE,CAAC;EAC/D;EAEA,OACC,IAAAN,MAAA,CAAAC,aAAA,EAAClC,cAAA,CAAAuC,OAA+B;IAC/BC,iBAAiB,EAAGzB,kBAAoB;IACxCe,cAAc,EAAGA;EAAgB,GAEjC,IAAAG,MAAA,CAAAC,aAAA,EAACpC,uBAAA,CAAAyC,OAAsB;IACtBE,KAAK,EAAG1B,kBAAoB;IAC5Ba,QAAQ,EAAGA,QAAU;IACrBC,OAAO,EAAGA;EAAS,CACnB,CAC+B,CAAC;AAEpC","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_components","_coreData","_data","_blocks","_downloadableBlocksList","_interopRequireDefault","_inserterPanel","_noResults","_store","_jsxRuntime","EMPTY_ARRAY","useDownloadableBlocks","filterValue","useSelect","select","getDownloadableBlocks","isRequestingDownloadableBlocks","getInstalledBlockTypes","blockDirectoryStore","hasPermission","coreStore","canUser","downloadableBlocks","installedBlockTypes","installableBlocks","filter","name","isJustInstalled","some","blockType","isPreviouslyInstalled","getBlockType","length","isLoading","DownloadableBlocksPanel","onSelect","onHover","hasLocalBlocks","isTyping","undefined","jsxs","Fragment","children","jsx","className","__","Spinner","default","downloadableItems","items"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Spinner } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlocksList from '../downloadable-blocks-list';\nimport DownloadableBlocksInserterPanel from './inserter-panel';\nimport DownloadableBlocksNoResults from './no-results';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst EMPTY_ARRAY = [];\n\nconst useDownloadableBlocks = ( filterValue ) =>\n\tuseSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetDownloadableBlocks,\n\t\t\t\tisRequestingDownloadableBlocks,\n\t\t\t\tgetInstalledBlockTypes,\n\t\t\t} = select( blockDirectoryStore );\n\n\t\t\tconst hasPermission = select( coreStore ).canUser(\n\t\t\t\t'read',\n\t\t\t\t'block-directory/search'\n\t\t\t);\n\n\t\t\tlet downloadableBlocks = EMPTY_ARRAY;\n\t\t\tif ( hasPermission ) {\n\t\t\t\tdownloadableBlocks = getDownloadableBlocks( filterValue );\n\n\t\t\t\t// Filter out blocks that are already installed.\n\t\t\t\tconst installedBlockTypes = getInstalledBlockTypes();\n\t\t\t\tconst installableBlocks = downloadableBlocks.filter(\n\t\t\t\t\t( { name } ) => {\n\t\t\t\t\t\t// Check if the block has just been installed, in which case it\n\t\t\t\t\t\t// should still show in the list to avoid suddenly disappearing.\n\t\t\t\t\t\t// `installedBlockTypes` only returns blocks stored in state\n\t\t\t\t\t\t// immediately after installation, not all installed blocks.\n\t\t\t\t\t\tconst isJustInstalled = installedBlockTypes.some(\n\t\t\t\t\t\t\t( blockType ) => blockType.name === name\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst isPreviouslyInstalled = getBlockType( name );\n\t\t\t\t\t\treturn isJustInstalled || ! isPreviouslyInstalled;\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\t// Keep identity of the `downloadableBlocks` array if nothing was filtered out\n\t\t\t\tif ( installableBlocks.length !== downloadableBlocks.length ) {\n\t\t\t\t\tdownloadableBlocks = installableBlocks;\n\t\t\t\t}\n\n\t\t\t\t// Return identical empty array when there are no blocks\n\t\t\t\tif ( downloadableBlocks.length === 0 ) {\n\t\t\t\t\tdownloadableBlocks = EMPTY_ARRAY;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\thasPermission,\n\t\t\t\tdownloadableBlocks,\n\t\t\t\tisLoading: isRequestingDownloadableBlocks( filterValue ),\n\t\t\t};\n\t\t},\n\t\t[ filterValue ]\n\t);\n\nexport default function DownloadableBlocksPanel( {\n\tonSelect,\n\tonHover,\n\thasLocalBlocks,\n\tisTyping,\n\tfilterValue,\n} ) {\n\tconst { hasPermission, downloadableBlocks, isLoading } =\n\t\tuseDownloadableBlocks( filterValue );\n\n\tif ( hasPermission === undefined || isLoading || isTyping ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ hasPermission && ! hasLocalBlocks && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__no-local\">\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'No results available from your installed blocks.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<div className=\"block-directory-downloadable-blocks-panel has-blocks-loading\">\n\t\t\t\t\t<Spinner />\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tif ( false === hasPermission ) {\n\t\tif ( ! hasLocalBlocks ) {\n\t\t\treturn <DownloadableBlocksNoResults />;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tif ( downloadableBlocks.length === 0 ) {\n\t\treturn hasLocalBlocks ? null : <DownloadableBlocksNoResults />;\n\t}\n\n\treturn (\n\t\t<DownloadableBlocksInserterPanel\n\t\t\tdownloadableItems={ downloadableBlocks }\n\t\t\thasLocalBlocks={ hasLocalBlocks }\n\t\t>\n\t\t\t<DownloadableBlocksList\n\t\t\t\titems={ downloadableBlocks }\n\t\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AE;MAAC,CACP,CAAC;IAAA,CACL,CAAC;EAEL;EAEA,IAAK,KAAK,KAAK3B,aAAa,EAAG;IAC9B,IAAK,CAAEkB,cAAc,EAAG;MACvB,oBAAO,IAAA5B,WAAA,CAAAkC,GAAA,EAACpC,UAAA,CAAAwC,OAA2B,IAAE,CAAC;IACvC;IAEA,OAAO,IAAI;EACZ;EAEA,IAAKzB,kBAAkB,CAACU,MAAM,KAAK,CAAC,EAAG;IACtC,OAAOK,cAAc,GAAG,IAAI,gBAAG,IAAA5B,WAAA,CAAAkC,GAAA,EAACpC,UAAA,CAAAwC,OAA2B,IAAE,CAAC;EAC/D;EAEA,oBACC,IAAAtC,WAAA,CAAAkC,GAAA,EAACrC,cAAA,CAAAyC,OAA+B;IAC/BC,iBAAiB,EAAG1B,kBAAoB;IACxCe,cAAc,EAAGA,cAAgB;IAAAK,QAAA,eAEjC,IAAAjC,WAAA,CAAAkC,GAAA,EAACvC,uBAAA,CAAA2C,OAAsB;MACtBE,KAAK,EAAG3B,kBAAoB;MAC5Ba,QAAQ,EAAGA,QAAU;MACrBC,OAAO,EAAGA;IAAS,CACnB;EAAC,CAC8B,CAAC;AAEpC","ignoreList":[]}
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = require("react");
8
7
  var _i18n = require("@wordpress/i18n");
9
8
  var _element = require("@wordpress/element");
10
9
  var _a11y = require("@wordpress/a11y");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
11
  /**
12
12
  * WordPress dependencies
13
13
  */
@@ -22,19 +22,26 @@ function DownloadableBlocksInserterPanel({
22
22
  (0, _a11y.speak)((0, _i18n.sprintf)( /* translators: %d: number of available blocks. */
23
23
  (0, _i18n._n)('%d additional block is available to install.', '%d additional blocks are available to install.', count), count));
24
24
  }, [count]);
25
- return (0, _react.createElement)(_react.Fragment, null, !hasLocalBlocks && (0, _react.createElement)("p", {
26
- className: "block-directory-downloadable-blocks-panel__no-local"
27
- }, (0, _i18n.__)('No results available from your installed blocks.')), (0, _react.createElement)("div", {
28
- className: "block-editor-inserter__quick-inserter-separator"
29
- }), (0, _react.createElement)("div", {
30
- className: "block-directory-downloadable-blocks-panel"
31
- }, (0, _react.createElement)("div", {
32
- className: "block-directory-downloadable-blocks-panel__header"
33
- }, (0, _react.createElement)("h2", {
34
- className: "block-directory-downloadable-blocks-panel__title"
35
- }, (0, _i18n.__)('Available to install')), (0, _react.createElement)("p", {
36
- className: "block-directory-downloadable-blocks-panel__description"
37
- }, (0, _i18n.__)('Select a block to install and add it to your post.'))), children));
25
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
26
+ children: [!hasLocalBlocks && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
27
+ className: "block-directory-downloadable-blocks-panel__no-local",
28
+ children: (0, _i18n.__)('No results available from your installed blocks.')
29
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
30
+ className: "block-editor-inserter__quick-inserter-separator"
31
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
32
+ className: "block-directory-downloadable-blocks-panel",
33
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
34
+ className: "block-directory-downloadable-blocks-panel__header",
35
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
36
+ className: "block-directory-downloadable-blocks-panel__title",
37
+ children: (0, _i18n.__)('Available to install')
38
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
39
+ className: "block-directory-downloadable-blocks-panel__description",
40
+ children: (0, _i18n.__)('Select a block to install and add it to your post.')
41
+ })]
42
+ }), children]
43
+ })]
44
+ });
38
45
  }
39
46
  var _default = exports.default = DownloadableBlocksInserterPanel;
40
47
  //# sourceMappingURL=inserter-panel.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_element","_a11y","DownloadableBlocksInserterPanel","children","downloadableItems","hasLocalBlocks","count","length","useEffect","speak","sprintf","_n","_react","createElement","Fragment","className","__","_default","exports","default"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/inserter-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\n\nfunction DownloadableBlocksInserterPanel( {\n\tchildren,\n\tdownloadableItems,\n\thasLocalBlocks,\n} ) {\n\tconst count = downloadableItems.length;\n\tuseEffect( () => {\n\t\tspeak(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %d: number of available blocks. */\n\t\t\t\t_n(\n\t\t\t\t\t'%d additional block is available to install.',\n\t\t\t\t\t'%d additional blocks are available to install.',\n\t\t\t\t\tcount\n\t\t\t\t),\n\t\t\t\tcount\n\t\t\t)\n\t\t);\n\t}, [ count ] );\n\n\treturn (\n\t\t<>\n\t\t\t{ ! hasLocalBlocks && (\n\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__no-local\">\n\t\t\t\t\t{ __( 'No results available from your installed blocks.' ) }\n\t\t\t\t</p>\n\t\t\t) }\n\n\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\n\t\t\t<div className=\"block-directory-downloadable-blocks-panel\">\n\t\t\t\t<div className=\"block-directory-downloadable-blocks-panel__header\">\n\t\t\t\t\t<h2 className=\"block-directory-downloadable-blocks-panel__title\">\n\t\t\t\t\t\t{ __( 'Available to install' ) }\n\t\t\t\t\t</h2>\n\t\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__description\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select a block to install and add it to your post.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default DownloadableBlocksInserterPanel;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA,SAASG,+BAA+BA,CAAE;EACzCC,QAAQ;EACRC,iBAAiB;EACjBC;AACD,CAAC,EAAG;EACH,MAAMC,KAAK,GAAGF,iBAAiB,CAACG,MAAM;EACtC,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAAC,WAAK,EACJ,IAAAC,aAAO,GACN;IACA,IAAAC,QAAE,EACD,8CAA8C,EAC9C,gDAAgD,EAChDL,KACD,CAAC,EACDA,KACD,CACD,CAAC;EACF,CAAC,EAAE,CAAEA,KAAK,CAAG,CAAC;EAEd,OACC,IAAAM,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACG,CAAET,cAAc,IACjB,IAAAO,MAAA,CAAAC,aAAA;IAAGE,SAAS,EAAC;EAAqD,GAC/D,IAAAC,QAAE,EAAE,kDAAmD,CACvD,CACH,EAED,IAAAJ,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAAiD,CAAE,CAAC,EAEnE,IAAAH,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAA2C,GACzD,IAAAH,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAAmD,GACjE,IAAAH,MAAA,CAAAC,aAAA;IAAIE,SAAS,EAAC;EAAkD,GAC7D,IAAAC,QAAE,EAAE,sBAAuB,CAC1B,CAAC,EACL,IAAAJ,MAAA,CAAAC,aAAA;IAAGE,SAAS,EAAC;EAAwD,GAClE,IAAAC,QAAE,EACH,oDACD,CACE,CACC,CAAC,EACJb,QACE,CACJ,CAAC;AAEL;AAAC,IAAAc,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcjB,+BAA+B","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_element","_a11y","_jsxRuntime","DownloadableBlocksInserterPanel","children","downloadableItems","hasLocalBlocks","count","length","useEffect","speak","sprintf","_n","jsxs","Fragment","jsx","className","__","_default","exports","default"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/inserter-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\n\nfunction DownloadableBlocksInserterPanel( {\n\tchildren,\n\tdownloadableItems,\n\thasLocalBlocks,\n} ) {\n\tconst count = downloadableItems.length;\n\tuseEffect( () => {\n\t\tspeak(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %d: number of available blocks. */\n\t\t\t\t_n(\n\t\t\t\t\t'%d additional block is available to install.',\n\t\t\t\t\t'%d additional blocks are available to install.',\n\t\t\t\t\tcount\n\t\t\t\t),\n\t\t\t\tcount\n\t\t\t)\n\t\t);\n\t}, [ count ] );\n\n\treturn (\n\t\t<>\n\t\t\t{ ! hasLocalBlocks && (\n\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__no-local\">\n\t\t\t\t\t{ __( 'No results available from your installed blocks.' ) }\n\t\t\t\t</p>\n\t\t\t) }\n\n\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\n\t\t\t<div className=\"block-directory-downloadable-blocks-panel\">\n\t\t\t\t<div className=\"block-directory-downloadable-blocks-panel__header\">\n\t\t\t\t\t<h2 className=\"block-directory-downloadable-blocks-panel__title\">\n\t\t\t\t\t\t{ __( 'Available to install' ) }\n\t\t\t\t\t</h2>\n\t\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__description\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select a block to install and add it to your post.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default DownloadableBlocksInserterPanel;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAAwC,IAAAG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defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = require("react");
8
7
  var _i18n = require("@wordpress/i18n");
9
8
  var _icons = require("@wordpress/icons");
10
9
  var _components = require("@wordpress/components");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
11
  /**
12
12
  * WordPress dependencies
13
13
  */
14
14
 
15
15
  function DownloadableBlocksNoResults() {
16
- return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
17
- className: "block-editor-inserter__no-results"
18
- }, (0, _react.createElement)(_icons.Icon, {
19
- className: "block-editor-inserter__no-results-icon",
20
- icon: _icons.blockDefault
21
- }), (0, _react.createElement)("p", null, (0, _i18n.__)('No results found.'))), (0, _react.createElement)("div", {
22
- className: "block-editor-inserter__tips"
23
- }, (0, _react.createElement)(_components.Tip, null, (0, _i18n.__)('Interested in creating your own block?'), (0, _react.createElement)("br", null), (0, _react.createElement)(_components.ExternalLink, {
24
- href: "https://developer.wordpress.org/block-editor/"
25
- }, (0, _i18n.__)('Get started here'), "."))));
16
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
17
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
18
+ className: "block-editor-inserter__no-results",
19
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
20
+ className: "block-editor-inserter__no-results-icon",
21
+ icon: _icons.blockDefault
22
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
23
+ children: (0, _i18n.__)('No results found.')
24
+ })]
25
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
26
+ className: "block-editor-inserter__tips",
27
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Tip, {
28
+ children: [(0, _i18n.__)('Interested in creating your own block?'), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.ExternalLink, {
29
+ href: "https://developer.wordpress.org/block-editor/",
30
+ children: [(0, _i18n.__)('Get started here'), "."]
31
+ })]
32
+ })
33
+ })]
34
+ });
26
35
  }
27
36
  var _default = exports.default = DownloadableBlocksNoResults;
28
37
  //# sourceMappingURL=no-results.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_icons","_components","DownloadableBlocksNoResults","_react","createElement","Fragment","className","Icon","icon","blockDefault","__","Tip","ExternalLink","href","_default","exports","default"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/no-results.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, blockDefault } from '@wordpress/icons';\nimport { Tip, ExternalLink } from '@wordpress/components';\n\nfunction DownloadableBlocksNoResults() {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"block-editor-inserter__no-results\">\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"block-editor-inserter__no-results-icon\"\n\t\t\t\t\ticon={ blockDefault }\n\t\t\t\t/>\n\t\t\t\t<p>{ __( 'No results found.' ) }</p>\n\t\t\t</div>\n\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t<Tip>\n\t\t\t\t\t{ __( 'Interested in creating your own block?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink href=\"https://developer.wordpress.org/block-editor/\">\n\t\t\t\t\t\t{ __( 'Get started here' ) }.\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</Tip>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default DownloadableBlocksNoResults;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA,SAASG,2BAA2BA,CAAA,EAAG;EACtC,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAAmC,GACjD,IAAAH,MAAA,CAAAC,aAAA,EAACJ,MAAA,CAAAO,IAAI;IACJD,SAAS,EAAC,wCAAwC;IAClDE,IAAI,EAAGC;EAAc,CACrB,CAAC,EACF,IAAAN,MAAA,CAAAC,aAAA,aAAK,IAAAM,QAAE,EAAE,mBAAoB,CAAM,CAC/B,CAAC,EACN,IAAAP,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAA6B,GAC3C,IAAAH,MAAA,CAAAC,aAAA,EAACH,WAAA,CAAAU,GAAG,QACD,IAAAD,QAAE,EAAE,wCAAyC,CAAC,EAChD,IAAAP,MAAA,CAAAC,aAAA,YAAK,CAAC,EACN,IAAAD,MAAA,CAAAC,aAAA,EAACH,WAAA,CAAAW,YAAY;IAACC,IAAI,EAAC;EAA+C,GAC/D,IAAAH,QAAE,EAAE,kBAAmB,CAAC,EAAE,GACf,CACV,CACD,CACJ,CAAC;AAEL;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcd,2BAA2B","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_icons","_components","_jsxRuntime","DownloadableBlocksNoResults","jsxs","Fragment","children","className","jsx","Icon","icon","blockDefault","__","Tip","ExternalLink","href","_default","exports","default"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/no-results.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, blockDefault } from '@wordpress/icons';\nimport { Tip, ExternalLink } from '@wordpress/components';\n\nfunction DownloadableBlocksNoResults() {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"block-editor-inserter__no-results\">\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"block-editor-inserter__no-results-icon\"\n\t\t\t\t\ticon={ blockDefault }\n\t\t\t\t/>\n\t\t\t\t<p>{ __( 'No results found.' ) }</p>\n\t\t\t</div>\n\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t<Tip>\n\t\t\t\t\t{ __( 'Interested in creating your own block?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink href=\"https://developer.wordpress.org/block-editor/\">\n\t\t\t\t\t\t{ __( 'Get started here' ) }.\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</Tip>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default DownloadableBlocksNoResults;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAA0D,IAAAG,WAAA,GAAAH,OAAA;AAL1D;AACA;AACA;;AAKA,SAASI,2BAA2BA,CAAA,EAAG;EACtC,oBACC,IAAAD,WAAA,CAAAE,IAAA,EAAAF,WAAA,CAAAG,QAAA;IAAAC,QAAA,gBACC,IAAAJ,WAAA,CAAAE,IAAA;MAAKG,SAAS,EAAC,mCAAmC;MAAAD,QAAA,gBACjD,IAAAJ,WAAA,CAAAM,GAAA,EAACR,MAAA,CAAAS,IAAI;QACJF,SAAS,EAAC,wCAAwC;QAClDG,IAAI,EAAGC;MAAc,CACrB,CAAC,eACF,IAAAT,WAAA,CAAAM,GAAA;QAAAF,QAAA,EAAK,IAAAM,QAAE,EAAE,mBAAoB;MAAC,CAAK,CAAC;IAAA,CAChC,CAAC,eACN,IAAAV,WAAA,CAAAM,GAAA;MAAKD,SAAS,EAAC,6BAA6B;MAAAD,QAAA,eAC3C,IAAAJ,WAAA,CAAAE,IAAA,EAACH,WAAA,CAAAY,GAAG;QAAAP,QAAA,GACD,IAAAM,QAAE,EAAE,wCAAyC,CAAC,eAChD,IAAAV,WAAA,CAAAM,GAAA,UAAK,CAAC,eACN,IAAAN,WAAA,CAAAE,IAAA,EAACH,WAAA,CAAAa,YAAY;UAACC,IAAI,EAAC,+CAA+C;UAAAT,QAAA,GAC/D,IAAAM,QAAE,EAAE,kBAAmB,CAAC,EAAE,GAC7B;QAAA,CAAc,CAAC;MAAA,CACX;IAAC,CACF,CAAC;EAAA,CACL,CAAC;AAEL;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcf,2BAA2B","ignoreList":[]}
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _react = require("react");
9
8
  var _i18n = require("@wordpress/i18n");
10
9
  var _components = require("@wordpress/components");
11
10
  var _blocks = require("@wordpress/blocks");
@@ -15,6 +14,7 @@ var _coreData = require("@wordpress/core-data");
15
14
  var _blockEditor = require("@wordpress/block-editor");
16
15
  var _installButton = _interopRequireDefault(require("./install-button"));
17
16
  var _store = require("../../store");
17
+ var _jsxRuntime = require("react/jsx-runtime");
18
18
  /**
19
19
  * WordPress dependencies
20
20
  */
@@ -47,11 +47,11 @@ const getInstallMissing = OriginalComponent => props => {
47
47
 
48
48
  // The user can't install blocks, or the block isn't available for download.
49
49
  if (!hasPermission || !block) {
50
- return (0, _react.createElement)(OriginalComponent, {
50
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(OriginalComponent, {
51
51
  ...props
52
52
  });
53
53
  }
54
- return (0, _react.createElement)(ModifiedWarning, {
54
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(ModifiedWarning, {
55
55
  ...props,
56
56
  originalBlock: block
57
57
  });
@@ -83,26 +83,29 @@ const ModifiedWarning = ({
83
83
  }, [clientId]);
84
84
  let messageHTML = (0, _i18n.sprintf)( /* translators: %s: block name */
85
85
  (0, _i18n.__)('Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely.'), originalBlock.title || originalName);
86
- const actions = [(0, _react.createElement)(_installButton.default, {
87
- key: "install",
86
+ const actions = [/*#__PURE__*/(0, _jsxRuntime.jsx)(_installButton.default, {
88
87
  block: originalBlock,
89
88
  attributes: props.attributes,
90
89
  clientId: props.clientId
91
- })];
90
+ }, "install")];
92
91
  if (hasContent && hasHTMLBlock) {
93
92
  messageHTML = (0, _i18n.sprintf)( /* translators: %s: block name */
94
93
  (0, _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);
95
- actions.push((0, _react.createElement)(_components.Button, {
96
- key: "convert",
94
+ actions.push( /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
97
95
  onClick: convertToHTML,
98
- variant: "tertiary"
99
- }, (0, _i18n.__)('Keep as HTML')));
96
+ variant: "tertiary",
97
+ children: (0, _i18n.__)('Keep as HTML')
98
+ }, "convert"));
100
99
  }
101
- return (0, _react.createElement)("div", {
102
- ...(0, _blockEditor.useBlockProps)()
103
- }, (0, _react.createElement)(_blockEditor.Warning, {
104
- actions: actions
105
- }, messageHTML), (0, _react.createElement)(_element.RawHTML, null, originalUndelimitedContent));
100
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
101
+ ...(0, _blockEditor.useBlockProps)(),
102
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.Warning, {
103
+ actions: actions,
104
+ children: messageHTML
105
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_element.RawHTML, {
106
+ children: originalUndelimitedContent
107
+ })]
108
+ });
106
109
  };
107
110
  var _default = exports.default = getInstallMissing;
108
111
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_blocks","_element","_data","_coreData","_blockEditor","_installButton","_interopRequireDefault","_store","getInstallMissing","OriginalComponent","props","originalName","attributes","block","hasPermission","useSelect","select","getDownloadableBlocks","blockDirectoryStore","blocks","filter","name","coreStore","canUser","length","_react","createElement","ModifiedWarning","originalBlock","originalUndelimitedContent","clientId","replaceBlock","useDispatch","blockEditorStore","convertToHTML","createBlock","content","hasContent","hasHTMLBlock","canInsertBlockType","getBlockRootClientId","messageHTML","sprintf","__","title","actions","default","key","push","Button","onClick","variant","useBlockProps","Warning","RawHTML","_default","exports"],"sources":["@wordpress/block-directory/src/plugins/get-install-missing/index.js"],"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’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 key=\"convert\" onClick={ convertToHTML } variant=\"tertiary\">\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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AASA,IAAAO,cAAA,GAAAC,sBAAA,CAAAR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,GAAU,IAAA0B,0BAAa,EAAC;EAAC,GACxB,IAAA3B,MAAA,CAAAC,aAAA,EAACtB,YAAA,CAAAiD,OAAO;IAACR,OAAO,EAAGA;EAAS,GAAGJ,WAAsB,CAAC,EACtD,IAAAhB,MAAA,CAAAC,aAAA,EAACzB,QAAA,CAAAqD,OAAO,QAAGzB,0BAAqC,CAC5C,CAAC;AAER,CAAC;AAAC,IAAA0B,QAAA,GAAAC,OAAA,CAAAV,OAAA,GAEatC,iBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_components","_blocks","_element","_data","_coreData","_blockEditor","_installButton","_interopRequireDefault","_store","_jsxRuntime","getInstallMissing","OriginalComponent","props","originalName","attributes","block","hasPermission","useSelect","select","getDownloadableBlocks","blockDirectoryStore","blocks","filter","name","coreStore","canUser","length","jsx","ModifiedWarning","originalBlock","originalUndelimitedContent","clientId","replaceBlock","useDispatch","blockEditorStore","convertToHTML","createBlock","content","hasContent","hasHTMLBlock","canInsertBlockType","getBlockRootClientId","messageHTML","sprintf","__","title","actions","default","push","Button","onClick","variant","children","jsxs","useBlockProps","Warning","RawHTML","_default","exports"],"sources":["@wordpress/block-directory/src/plugins/get-install-missing/index.js"],"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’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 key=\"convert\" onClick={ convertToHTML } variant=\"tertiary\">\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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AASA,IAAAO,cAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAA2D,IAAAU,WAAA,GAAAV,OAAA;AAnB3D;AACA;AACA;;AAaA;AACA;AACA;;AAIA,MAAMW,iBAAiB,GAAKC,iBAAiB,IAAQC,KAAK,IAAM;EAC/D,MAAM;IAAEC;EAAa,CAAC,GAAGD,KAAK,CAACE,UAAU;EACzC;EACA;EACA,MAAM;IAAEC,KAAK;IAAEC;EAAc,CAAC,GAAG,IAAAC,eAAS,EACvCC,MAAM,IAAM;IACb,MAAM;MAAEC;IAAsB,CAAC,GAAGD,MAAM,CAAEE,YAAoB,CAAC;IAC/D,MAAMC,MAAM,GAAGF,qBAAqB,CACnC,QAAQ,GAAGN,YACZ,CAAC,CAACS,MAAM,CAAE,CAAE;MAAEC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
6
  exports.default = InstallButton;
7
- var _react = require("react");
8
7
  var _i18n = require("@wordpress/i18n");
9
8
  var _components = require("@wordpress/components");
10
9
  var _blocks = require("@wordpress/blocks");
11
10
  var _data = require("@wordpress/data");
12
11
  var _blockEditor = require("@wordpress/block-editor");
13
12
  var _store = require("../../store");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
14
  /**
15
15
  * WordPress dependencies
16
16
  */
@@ -31,7 +31,7 @@ function InstallButton({
31
31
  const {
32
32
  replaceBlock
33
33
  } = (0, _data.useDispatch)(_blockEditor.store);
34
- return (0, _react.createElement)(_components.Button, {
34
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
35
35
  onClick: () => installBlockType(block).then(success => {
36
36
  if (success) {
37
37
  const blockType = (0, _blocks.getBlockType)(block.name);
@@ -43,8 +43,9 @@ function InstallButton({
43
43
  }),
44
44
  disabled: isInstallingBlock,
45
45
  isBusy: isInstallingBlock,
46
- variant: "primary"
47
- }, (0, _i18n.sprintf)( /* translators: %s: block name */
48
- (0, _i18n.__)('Install %s'), block.title));
46
+ variant: "primary",
47
+ children: (0, _i18n.sprintf)( /* translators: %s: block name */
48
+ (0, _i18n.__)('Install %s'), block.title)
49
+ });
49
50
  }
50
51
  //# sourceMappingURL=install-button.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_blocks","_data","_blockEditor","_store","InstallButton","attributes","block","clientId","isInstallingBlock","useSelect","select","blockDirectoryStore","isInstalling","id","installBlockType","useDispatch","replaceBlock","blockEditorStore","_react","createElement","Button","onClick","then","success","blockType","getBlockType","name","originalBlock","parse","originalContent","createBlock","innerBlocks","disabled","isBusy","variant","sprintf","__","title"],"sources":["@wordpress/block-directory/src/plugins/get-install-missing/install-button.js"],"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\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\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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,MA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ockEditor","_store","_jsxRuntime","InstallButton","attributes","block","clientId","isInstallingBlock","useSelect","select","blockDirectoryStore","isInstalling","id","installBlockType","useDispatch","replaceBlock","blockEditorStore","jsx","Button","onClick","then","success","blockType","getBlockType","name","originalBlock","parse","originalContent","createBlock","innerBlocks","disabled","isBusy","variant","children","sprintf","__","title"],"sources":["@wordpress/block-directory/src/plugins/get-install-missing/install-button.js"],"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\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\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":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAA2D,IAAAM,WAAA,GAAAN,OAAA;AAZ3D;AACA;AACA;;AAOA;AACA;AACA;;AAGe,SAASO,aAAaA,CAAE;EAAEC,UAAU;EAAEC,KAAK;EAAEC;AAAS,CAAC,EAAG;EACxE,MAAMC,iBAAiB,GAAG,IAAAC,eAAS,EAChCC,MAAM,IAAMA,MAAM,CAAEC,YAAoB,CAAC,CAACC,YAAY,CAAEN,KAAK,CAACO,EAAG,CAAC,EACpE,CAAEP,KAAK,CAACO,EAAE,CACX,CAAC;EACD,MAAM;IAAEC;EAAiB,CAAC,GAAG,IAAAC,iBAAW,EAAEJ,YAAoB,CAAC;EAC/D,MAAM;IAAEK;EAAa,CAAC,GAAG,IAAAD,iBAAW,EAAEE,kBAAiB,CAAC;EAExD,oBACC,IAAAd,WAAA,CAAAe,GAAA,EAACpB,WAAA,CAAAqB,MAAM;IACNC,OAAO,EAAGA,CAAA,KACTN,gBAAgB,CAAER,KAAM,CAAC,CAACe,IAAI,CAAIC,OAAO,IAAM;MAC9C,IAAKA,OAAO,EAAG;QACd,MAAMC,SAAS,GAAG,IAAAC,oBAAY,EAAElB,KAAK,CAACmB,IAAK,CAAC;QAC5C,MAAM,CAAEC,aAAa,CAAE,GAAG,IAAAC,aAAK,EAC9BtB,UAAU,CAACuB,eACZ,CAAC;QACD,IAAKF,aAAa,IAAIH,SAAS,EAAG;UACjCP,YAAY,CACXT,QAAQ,EACR,IAAAsB,mBAAW,EACVN,SAAS,CAACE,IAAI,EACdC,aAAa,CAACrB,UAAU,EACxBqB,aAAa,CAACI,WACf,CACD,CAAC;QACF;MACD;IACD,CAAE,CACF;IACDC,QAAQ,EAAGvB,iBAAmB;IAC9BwB,MAAM,EAAGxB,iBAAmB;IAC5ByB,OAAO,EAAC,SAAS;IAAAC,QAAA,EAEf,IAAAC,aAAO,GACR;IACA,IAAAC,QAAE,EAAE,YAAa,CAAC,EAClB9B,KAAK,CAAC+B,KACP;EAAC,CACM,CAAC;AAEX","ignoreList":[]}
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _react = require("react");
5
4
  var _plugins = require("@wordpress/plugins");
6
5
  var _hooks = require("@wordpress/hooks");
7
6
  var _autoBlockUninstaller = _interopRequireDefault(require("../components/auto-block-uninstaller"));
8
7
  var _inserterMenuDownloadableBlocksPanel = _interopRequireDefault(require("./inserter-menu-downloadable-blocks-panel"));
9
8
  var _installedBlocksPrePublishPanel = _interopRequireDefault(require("./installed-blocks-pre-publish-panel"));
10
9
  var _getInstallMissing = _interopRequireDefault(require("./get-install-missing"));
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
11
  /**
12
12
  * WordPress dependencies
13
13
  */
@@ -18,7 +18,9 @@ var _getInstallMissing = _interopRequireDefault(require("./get-install-missing")
18
18
 
19
19
  (0, _plugins.registerPlugin)('block-directory', {
20
20
  render() {
21
- return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_autoBlockUninstaller.default, null), (0, _react.createElement)(_inserterMenuDownloadableBlocksPanel.default, null), (0, _react.createElement)(_installedBlocksPrePublishPanel.default, null));
21
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
22
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_autoBlockUninstaller.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_inserterMenuDownloadableBlocksPanel.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_installedBlocksPrePublishPanel.default, {})]
23
+ });
22
24
  }
23
25
  });
24
26
  (0, _hooks.addFilter)('blocks.registerBlockType', 'block-directory/fallback', (settings, name) => {
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","_hooks","_autoBlockUninstaller","_interopRequireDefault","_inserterMenuDownloadableBlocksPanel","_installedBlocksPrePublishPanel","_getInstallMissing","registerPlugin","render","_react","createElement","Fragment","default","addFilter","settings","name","edit","getInstallMissing"],"sources":["@wordpress/block-directory/src/plugins/index.js"],"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\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":";;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,qBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,oCAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,+BAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,kBAAA,GAAAH,sBAAA,CAAAH,OAAA;AAZA;AACA;AACA;;AAIA;AACA;AACA;;AAMA,IAAAO,uBAAc,EAAE,iBAAiB,EAAE;EAClCC,MAAMA,CAAA,EAAG;IACR,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAACR,qBAAA,CAAAU,OAAoB,MAAE,CAAC,EACxB,IAAAH,MAAA,CAAAC,aAAA,EAACN,oCAAA,CAAAQ,OAAmC,MAAE,CAAC,EACvC,IAAAH,MAAA,CAAAC,aAAA,EAACL,+BAAA,CAAAO,OAA8B,MAAE,CAChC,CAAC;EAEL;AACD,CAAE,CAAC;AAEH,IAAAC,gBAAS,EACR,0BAA0B,EAC1B,0BAA0B,EAC1B,CAAEC,QAAQ,EAAEC,IAAI,KAAM;EACrB,IAAKA,IAAI,KAAK,cAAc,EAAG;IAC9B,OAAOD,QAAQ;EAChB;EACAA,QAAQ,CAACE,IAAI,GAAG,IAAAC,0BAAiB,EAAEH,QAAQ,CAACE,IAAK,CAAC;EAElD,OAAOF,QAAQ;AAChB,CACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_plugins","require","_hooks","_autoBlockUninstaller","_interopRequireDefault","_inserterMenuDownloadableBlocksPanel","_installedBlocksPrePublishPanel","_getInstallMissing","_jsxRuntime","registerPlugin","render","jsxs","Fragment","children","jsx","default","addFilter","settings","name","edit","getInstallMissing"],"sources":["@wordpress/block-directory/src/plugins/index.js"],"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\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":";;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,qBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,oCAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,+BAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,kBAAA,GAAAH,sBAAA,CAAAH,OAAA;AAAsD,IAAAO,WAAA,GAAAP,OAAA;AAZtD;AACA;AACA;;AAIA;AACA;AACA;;AAMA,IAAAQ,uBAAc,EAAE,iBAAiB,EAAE;EAClCC,MAAMA,CAAA,EAAG;IACR,oBACC,IAAAF,WAAA,CAAAG,IAAA,EAAAH,WAAA,CAAAI,QAAA;MAAAC,QAAA,gBACC,IAAAL,WAAA,CAAAM,GAAA,EAACX,qBAAA,CAAAY,OAAoB,IAAE,CAAC,eACxB,IAAAP,WAAA,CAAAM,GAAA,EAACT,oCAAA,CAAAU,OAAmC,IAAE,CAAC,eACvC,IAAAP,WAAA,CAAAM,GAAA,EAACR,+BAAA,CAAAS,OAA8B,IAAE,CAAC;IAAA,CACjC,CAAC;EAEL;AACD,CAAE,CAAC;AAEH,IAAAC,gBAAS,EACR,0BAA0B,EAC1B,0BAA0B,EAC1B,CAAEC,QAAQ,EAAEC,IAAI,KAAM;EACrB,IAAKA,IAAI,KAAK,cAAc,EAAG;IAC9B,OAAOD,QAAQ;EAChB;EACAA,QAAQ,CAACE,IAAI,GAAG,IAAAC,0BAAiB,EAAEH,QAAQ,CAACE,IAAK,CAAC;EAElD,OAAOF,QAAQ;AAChB,CACD,CAAC","ignoreList":[]}
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _react = require("react");
9
8
  var _blockEditor = require("@wordpress/block-editor");
10
9
  var _compose = require("@wordpress/compose");
11
10
  var _element = require("@wordpress/element");
12
11
  var _downloadableBlocksPanel = _interopRequireDefault(require("../../components/downloadable-blocks-panel"));
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
13
  /**
14
14
  * WordPress dependencies
15
15
  */
@@ -21,25 +21,27 @@ var _downloadableBlocksPanel = _interopRequireDefault(require("../../components/
21
21
  function InserterMenuDownloadableBlocksPanel() {
22
22
  const [debouncedFilterValue, setFilterValue] = (0, _element.useState)('');
23
23
  const debouncedSetFilterValue = (0, _compose.debounce)(setFilterValue, 400);
24
- return (0, _react.createElement)(_blockEditor.__unstableInserterMenuExtension, null, ({
25
- onSelect,
26
- onHover,
27
- filterValue,
28
- hasItems
29
- }) => {
30
- if (debouncedFilterValue !== filterValue) {
31
- debouncedSetFilterValue(filterValue);
24
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.__unstableInserterMenuExtension, {
25
+ children: ({
26
+ onSelect,
27
+ onHover,
28
+ filterValue,
29
+ hasItems
30
+ }) => {
31
+ if (debouncedFilterValue !== filterValue) {
32
+ debouncedSetFilterValue(filterValue);
33
+ }
34
+ if (!debouncedFilterValue) {
35
+ return null;
36
+ }
37
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_downloadableBlocksPanel.default, {
38
+ onSelect: onSelect,
39
+ onHover: onHover,
40
+ filterValue: debouncedFilterValue,
41
+ hasLocalBlocks: hasItems,
42
+ isTyping: filterValue !== debouncedFilterValue
43
+ });
32
44
  }
33
- if (!debouncedFilterValue) {
34
- return null;
35
- }
36
- return (0, _react.createElement)(_downloadableBlocksPanel.default, {
37
- onSelect: onSelect,
38
- onHover: onHover,
39
- filterValue: debouncedFilterValue,
40
- hasLocalBlocks: hasItems,
41
- isTyping: filterValue !== debouncedFilterValue
42
- });
43
45
  });
44
46
  }
45
47
  var _default = exports.default = InserterMenuDownloadableBlocksPanel;
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_compose","_element","_downloadableBlocksPanel","_interopRequireDefault","InserterMenuDownloadableBlocksPanel","debouncedFilterValue","setFilterValue","useState","debouncedSetFilterValue","debounce","_react","createElement","__unstableInserterMenuExtension","onSelect","onHover","filterValue","hasItems","default","hasLocalBlocks","isTyping","_default","exports"],"sources":["@wordpress/block-directory/src/plugins/inserter-menu-downloadable-blocks-panel/index.js"],"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"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,wBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGA,SAASK,mCAAmCA,CAAA,EAAG;EAC9C,MAAM,CAAEC,oBAAoB,EAAEC,cAAc,CAAE,GAAG,IAAAC,iBAAQ,EAAE,EAAG,CAAC;EAC/D,MAAMC,uBAAuB,GAAG,IAAAC,iBAAQ,EAAEH,cAAc,EAAE,GAAI,CAAC;EAE/D,OACC,IAAAI,MAAA,CAAAC,aAAA,EAACb,YAAA,CAAAc,+BAA+B,QAC7B,CAAE;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,WAAW;IAAEC;EAAS,CAAC,KAAM;IACrD,IAAKX,oBAAoB,KAAKU,WAAW,EAAG;MAC3CP,uBAAuB,CAAEO,WAAY,CAAC;IACvC;IAEA,IAAK,CAAEV,oBAAoB,EAAG;MAC7B,OAAO,IAAI;IACZ;IAEA,OACC,IAAAK,MAAA,CAAAC,aAAA,EAACT,wBAAA,CAAAe,OAAuB;MACvBJ,QAAQ,EAAGA,QAAU;MACrBC,OAAO,EAAGA,OAAS;MACnBC,WAAW,EAAGV,oBAAsB;MACpCa,cAAc,EAAGF,QAAU;MAC3BG,QAAQ,EAAGJ,WAAW,KAAKV;IAAsB,CACjD,CAAC;EAEJ,CACgC,CAAC;AAEpC;AAAC,IAAAe,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEcb,mCAAmC","ignoreList":[]}
1
+ {"version":3,"names":["_blockEditor","require","_compose","_element","_downloadableBlocksPanel","_interopRequireDefault","_jsxRuntime","InserterMenuDownloadableBlocksPanel","debouncedFilterValue","setFilterValue","useState","debouncedSetFilterValue","debounce","jsx","__unstableInserterMenuExtension","children","onSelect","onHover","filterValue","hasItems","default","hasLocalBlocks","isTyping","_default","exports"],"sources":["@wordpress/block-directory/src/plugins/inserter-menu-downloadable-blocks-panel/index.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,wBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAiF,IAAAK,WAAA,GAAAL,OAAA;AAVjF;AACA;AACA;;AAKA;AACA;AACA;;AAGA,SAASM,mCAAmCA,CAAA,EAAG;EAC9C,MAAM,CAAEC,oBAAoB,EAAEC,cAAc,CAAE,GAAG,IAAAC,iBAAQ,EAAE,EAAG,CAAC;EAC/D,MAAMC,uBAAuB,GAAG,IAAAC,iBAAQ,EAAEH,cAAc,EAAE,GAAI,CAAC;EAE/D,oBACC,IAAAH,WAAA,CAAAO,GAAA,EAACb,YAAA,CAAAc,+BAA+B;IAAAC,QAAA,EAC7BA,CAAE;MAAEC,QAAQ;MAAEC,OAAO;MAAEC,WAAW;MAAEC;IAAS,CAAC,KAAM;MACrD,IAAKX,oBAAoB,KAAKU,WAAW,EAAG;QAC3CP,uBAAuB,CAAEO,WAAY,CAAC;MACvC;MAEA,IAAK,CAAEV,oBAAoB,EAAG;QAC7B,OAAO,IAAI;MACZ;MAEA,oBACC,IAAAF,WAAA,CAAAO,GAAA,EAACT,wBAAA,CAAAgB,OAAuB;QACvBJ,QAAQ,EAAGA,QAAU;QACrBC,OAAO,EAAGA,OAAS;QACnBC,WAAW,EAAGV,oBAAsB;QACpCa,cAAc,EAAGF,QAAU;QAC3BG,QAAQ,EAAGJ,WAAW,KAAKV;MAAsB,CACjD,CAAC;IAEJ;EAAC,CAC+B,CAAC;AAEpC;AAAC,IAAAe,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEcb,mCAAmC","ignoreList":[]}
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = InstalledBlocksPrePublishPanel;
8
- var _react = require("react");
9
8
  var _i18n = require("@wordpress/i18n");
10
9
  var _data = require("@wordpress/data");
11
10
  var _icons = require("@wordpress/icons");
12
11
  var _compactList = _interopRequireDefault(require("../../components/compact-list"));
13
12
  var _store = require("../../store");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
14
  var _window$wp$editor;
15
15
  /**
16
16
  * WordPress dependencies
@@ -28,16 +28,18 @@ function InstalledBlocksPrePublishPanel() {
28
28
  if (!newBlockTypes.length) {
29
29
  return null;
30
30
  }
31
- return (0, _react.createElement)(PluginPrePublishPanel, {
31
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(PluginPrePublishPanel, {
32
32
  icon: _icons.blockDefault,
33
33
  title: (0, _i18n.sprintf)(
34
34
  // translators: %d: number of blocks (number).
35
35
  (0, _i18n._n)('Added: %d block', 'Added: %d blocks', newBlockTypes.length), newBlockTypes.length),
36
- initialOpen: true
37
- }, (0, _react.createElement)("p", {
38
- className: "installed-blocks-pre-publish-panel__copy"
39
- }, (0, _i18n._n)('The following block has been added to your site.', 'The following blocks have been added to your site.', newBlockTypes.length)), (0, _react.createElement)(_compactList.default, {
40
- items: newBlockTypes
41
- }));
36
+ initialOpen: true,
37
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
38
+ className: "installed-blocks-pre-publish-panel__copy",
39
+ children: (0, _i18n._n)('The following block has been added to your site.', 'The following blocks have been added to your site.', newBlockTypes.length)
40
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_compactList.default, {
41
+ items: newBlockTypes
42
+ })]
43
+ });
42
44
  }
43
45
  //# sourceMappingURL=index.js.map