@wordpress/block-directory 4.16.0 → 4.17.1

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 (102) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/auto-block-uninstaller/index.js +1 -6
  3. package/build/components/auto-block-uninstaller/index.js.map +1 -1
  4. package/build/components/block-ratings/index.js +1 -5
  5. package/build/components/block-ratings/index.js.map +1 -1
  6. package/build/components/block-ratings/stars.js +2 -7
  7. package/build/components/block-ratings/stars.js.map +1 -1
  8. package/build/components/compact-list/index.js +2 -8
  9. package/build/components/compact-list/index.js.map +1 -1
  10. package/build/components/downloadable-block-icon/index.js +1 -4
  11. package/build/components/downloadable-block-icon/index.js.map +1 -1
  12. package/build/components/downloadable-block-list-item/index.js +7 -28
  13. package/build/components/downloadable-block-list-item/index.js.map +1 -1
  14. package/build/components/downloadable-block-notice/index.js +1 -8
  15. package/build/components/downloadable-block-notice/index.js.map +1 -1
  16. package/build/components/downloadable-blocks-list/index.js +3 -15
  17. package/build/components/downloadable-blocks-list/index.js.map +1 -1
  18. package/build/components/downloadable-blocks-panel/index.js +1 -25
  19. package/build/components/downloadable-blocks-panel/index.js.map +1 -1
  20. package/build/components/downloadable-blocks-panel/inserter-panel.js +2 -7
  21. package/build/components/downloadable-blocks-panel/inserter-panel.js.map +1 -1
  22. package/build/components/downloadable-blocks-panel/no-results.js +1 -6
  23. package/build/components/downloadable-blocks-panel/no-results.js.map +1 -1
  24. package/build/index.js +0 -2
  25. package/build/index.js.map +1 -1
  26. package/build/plugins/get-install-missing/index.js +13 -28
  27. package/build/plugins/get-install-missing/index.js.map +1 -1
  28. package/build/plugins/get-install-missing/install-button.js +2 -11
  29. package/build/plugins/get-install-missing/install-button.js.map +1 -1
  30. package/build/plugins/index.js +1 -10
  31. package/build/plugins/index.js.map +1 -1
  32. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js +1 -9
  33. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +1 -1
  34. package/build/plugins/installed-blocks-pre-publish-panel/index.js +2 -13
  35. package/build/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
  36. package/build/store/actions.js +26 -46
  37. package/build/store/actions.js.map +1 -1
  38. package/build/store/index.js +2 -11
  39. package/build/store/index.js.map +1 -1
  40. package/build/store/load-assets.js +6 -12
  41. package/build/store/load-assets.js.map +1 -1
  42. package/build/store/reducer.js +16 -25
  43. package/build/store/reducer.js.map +1 -1
  44. package/build/store/resolvers.js +1 -7
  45. package/build/store/resolvers.js.map +1 -1
  46. package/build/store/selectors.js +7 -20
  47. package/build/store/selectors.js.map +1 -1
  48. package/build/store/utils/get-plugin-url.js +0 -4
  49. package/build/store/utils/get-plugin-url.js.map +1 -1
  50. package/build/store/utils/has-block-type.js +0 -4
  51. package/build/store/utils/has-block-type.js.map +1 -1
  52. package/build-module/components/auto-block-uninstaller/index.js +1 -1
  53. package/build-module/components/auto-block-uninstaller/index.js.map +1 -1
  54. package/build-module/components/block-ratings/index.js +0 -1
  55. package/build-module/components/block-ratings/index.js.map +1 -1
  56. package/build-module/components/block-ratings/stars.js +1 -5
  57. package/build-module/components/block-ratings/stars.js.map +1 -1
  58. package/build-module/components/compact-list/index.js +2 -5
  59. package/build-module/components/compact-list/index.js.map +1 -1
  60. package/build-module/components/downloadable-block-icon/index.js +0 -3
  61. package/build-module/components/downloadable-block-icon/index.js.map +1 -1
  62. package/build-module/components/downloadable-block-list-item/index.js +9 -19
  63. package/build-module/components/downloadable-block-list-item/index.js.map +1 -1
  64. package/build-module/components/downloadable-block-notice/index.js +1 -4
  65. package/build-module/components/downloadable-block-notice/index.js.map +1 -1
  66. package/build-module/components/downloadable-blocks-list/index.js +3 -9
  67. package/build-module/components/downloadable-blocks-list/index.js.map +1 -1
  68. package/build-module/components/downloadable-blocks-panel/index.js +1 -13
  69. package/build-module/components/downloadable-blocks-panel/index.js.map +1 -1
  70. package/build-module/components/downloadable-blocks-panel/inserter-panel.js +1 -5
  71. package/build-module/components/downloadable-blocks-panel/inserter-panel.js.map +1 -1
  72. package/build-module/components/downloadable-blocks-panel/no-results.js +0 -3
  73. package/build-module/components/downloadable-blocks-panel/no-results.js.map +1 -1
  74. package/build-module/index.js.map +1 -1
  75. package/build-module/plugins/get-install-missing/index.js +13 -20
  76. package/build-module/plugins/get-install-missing/index.js.map +1 -1
  77. package/build-module/plugins/get-install-missing/install-button.js +2 -5
  78. package/build-module/plugins/get-install-missing/install-button.js.map +1 -1
  79. package/build-module/plugins/index.js +1 -4
  80. package/build-module/plugins/index.js.map +1 -1
  81. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js +1 -6
  82. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +1 -1
  83. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js +6 -8
  84. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
  85. package/build-module/store/actions.js +28 -30
  86. package/build-module/store/actions.js.map +1 -1
  87. package/build-module/store/index.js +4 -4
  88. package/build-module/store/index.js.map +1 -1
  89. package/build-module/store/load-assets.js +7 -8
  90. package/build-module/store/load-assets.js.map +1 -1
  91. package/build-module/store/reducer.js +17 -17
  92. package/build-module/store/reducer.js.map +1 -1
  93. package/build-module/store/resolvers.js +2 -3
  94. package/build-module/store/resolvers.js.map +1 -1
  95. package/build-module/store/selectors.js +9 -11
  96. package/build-module/store/selectors.js.map +1 -1
  97. package/build-module/store/utils/get-plugin-url.js +0 -3
  98. package/build-module/store/utils/get-plugin-url.js.map +1 -1
  99. package/build-module/store/utils/has-block-type.js +0 -3
  100. package/build-module/store/utils/has-block-type.js.map +1 -1
  101. package/package.json +20 -20
  102. package/src/components/downloadable-block-list-item/test/index.js +1 -1
@@ -3,11 +3,12 @@
3
3
  */
4
4
  import { createRegistrySelector } from '@wordpress/data';
5
5
  import { store as blockEditorStore } from '@wordpress/block-editor';
6
+
6
7
  /**
7
8
  * Internal dependencies
8
9
  */
9
-
10
10
  import hasBlockType from './utils/has-block-type';
11
+
11
12
  /**
12
13
  * Returns true if application is requesting for downloadable blocks.
13
14
  *
@@ -16,12 +17,11 @@ import hasBlockType from './utils/has-block-type';
16
17
  *
17
18
  * @return {boolean} Whether a request is in progress for the blocks list.
18
19
  */
19
-
20
20
  export function isRequestingDownloadableBlocks(state, filterValue) {
21
21
  var _state$downloadableBl;
22
-
23
22
  return (_state$downloadableBl = state.downloadableBlocks[filterValue]?.isRequesting) !== null && _state$downloadableBl !== void 0 ? _state$downloadableBl : false;
24
23
  }
24
+
25
25
  /**
26
26
  * Returns the available uninstalled blocks.
27
27
  *
@@ -30,12 +30,11 @@ export function isRequestingDownloadableBlocks(state, filterValue) {
30
30
  *
31
31
  * @return {Array} Downloadable blocks.
32
32
  */
33
-
34
33
  export function getDownloadableBlocks(state, filterValue) {
35
34
  var _state$downloadableBl2;
36
-
37
35
  return (_state$downloadableBl2 = state.downloadableBlocks[filterValue]?.results) !== null && _state$downloadableBl2 !== void 0 ? _state$downloadableBl2 : [];
38
36
  }
37
+
39
38
  /**
40
39
  * Returns the block types that have been installed on the server in this
41
40
  * session.
@@ -44,10 +43,10 @@ export function getDownloadableBlocks(state, filterValue) {
44
43
  *
45
44
  * @return {Array} Block type items
46
45
  */
47
-
48
46
  export function getInstalledBlockTypes(state) {
49
47
  return state.blockManagement.installedBlockTypes;
50
48
  }
49
+
51
50
  /**
52
51
  * Returns block types that have been installed on the server and used in the
53
52
  * current post.
@@ -56,12 +55,12 @@ export function getInstalledBlockTypes(state) {
56
55
  *
57
56
  * @return {Array} Block type items.
58
57
  */
59
-
60
58
  export const getNewBlockTypes = createRegistrySelector(select => state => {
61
59
  const usedBlockTree = select(blockEditorStore).getBlocks();
62
60
  const installedBlockTypes = getInstalledBlockTypes(state);
63
61
  return installedBlockTypes.filter(blockType => hasBlockType(blockType, usedBlockTree));
64
62
  });
63
+
65
64
  /**
66
65
  * Returns the block types that have been installed on the server but are not
67
66
  * used in the current post.
@@ -70,12 +69,12 @@ export const getNewBlockTypes = createRegistrySelector(select => state => {
70
69
  *
71
70
  * @return {Array} Block type items.
72
71
  */
73
-
74
72
  export const getUnusedBlockTypes = createRegistrySelector(select => state => {
75
73
  const usedBlockTree = select(blockEditorStore).getBlocks();
76
74
  const installedBlockTypes = getInstalledBlockTypes(state);
77
75
  return installedBlockTypes.filter(blockType => !hasBlockType(blockType, usedBlockTree));
78
76
  });
77
+
79
78
  /**
80
79
  * Returns true if a block plugin install is in progress.
81
80
  *
@@ -84,10 +83,10 @@ export const getUnusedBlockTypes = createRegistrySelector(select => state => {
84
83
  *
85
84
  * @return {boolean} Whether this block is currently being installed.
86
85
  */
87
-
88
86
  export function isInstalling(state, blockId) {
89
87
  return state.blockManagement.isInstalling[blockId] || false;
90
88
  }
89
+
91
90
  /**
92
91
  * Returns all block error notices.
93
92
  *
@@ -95,10 +94,10 @@ export function isInstalling(state, blockId) {
95
94
  *
96
95
  * @return {Object} Object with error notices.
97
96
  */
98
-
99
97
  export function getErrorNotices(state) {
100
98
  return state.errorNotices;
101
99
  }
100
+
102
101
  /**
103
102
  * Returns the error notice for a given block.
104
103
  *
@@ -107,7 +106,6 @@ export function getErrorNotices(state) {
107
106
  *
108
107
  * @return {string|boolean} The error text, or false if no error.
109
108
  */
110
-
111
109
  export function getErrorNoticeForBlock(state, blockId) {
112
110
  return state.errorNotices[blockId];
113
111
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/store/selectors.js"],"names":["createRegistrySelector","store","blockEditorStore","hasBlockType","isRequestingDownloadableBlocks","state","filterValue","downloadableBlocks","isRequesting","getDownloadableBlocks","results","getInstalledBlockTypes","blockManagement","installedBlockTypes","getNewBlockTypes","select","usedBlockTree","getBlocks","filter","blockType","getUnusedBlockTypes","isInstalling","blockId","getErrorNotices","errorNotices","getErrorNoticeForBlock"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,sBAAT,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,gBA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A,SAAOQ,mBAAmB,CAACK,MAApB,CACJC,SAAF,IAAiB,CAAEhB,YAAY,CAAEgB,SAAF,EAAaH,aAAb,CADzB,CAAP;AAGA,CARuD,CAAlD;AAWP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASK,YAAT,CAAuBhB,KAAvB,EAA8BiB,OAA9B,EAAwC;AAC9C,SAAOjB,KAAK,CAACO,eAAN,CAAsBS,YAAtB,CAAoCC,OAApC,KAAiD,KAAxD;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,eAAT,CAA0BlB,KAA1B,EAAkC;AACxC,SAAOA,KAAK,CAACmB,YAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,sBAAT,CAAiCpB,KAAjC,EAAwCiB,OAAxC,EAAkD;AACxD,SAAOjB,KAAK,CAACmB,YAAN,CAAoBF,OAApB,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport hasBlockType from './utils/has-block-type';\n\n/**\n * Returns true if application is requesting for downloadable blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {boolean} Whether a request is in progress for the blocks list.\n */\nexport function isRequestingDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.isRequesting ?? false;\n}\n\n/**\n * Returns the available uninstalled blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {Array} Downloadable blocks.\n */\nexport function getDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.results ?? [];\n}\n\n/**\n * Returns the block types that have been installed on the server in this\n * session.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items\n */\nexport function getInstalledBlockTypes( state ) {\n\treturn state.blockManagement.installedBlockTypes;\n}\n\n/**\n * Returns block types that have been installed on the server and used in the\n * current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getNewBlockTypes = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst usedBlockTree = select( blockEditorStore ).getBlocks();\n\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\n\t\treturn installedBlockTypes.filter( ( blockType ) =>\n\t\t\thasBlockType( blockType, usedBlockTree )\n\t\t);\n\t}\n);\n\n/**\n * Returns the block types that have been installed on the server but are not\n * used in the current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getUnusedBlockTypes = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst usedBlockTree = select( blockEditorStore ).getBlocks();\n\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\n\t\treturn installedBlockTypes.filter(\n\t\t\t( blockType ) => ! hasBlockType( blockType, usedBlockTree )\n\t\t);\n\t}\n);\n\n/**\n * Returns true if a block plugin install is in progress.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId Id of the block.\n *\n * @return {boolean} Whether this block is currently being installed.\n */\nexport function isInstalling( state, blockId ) {\n\treturn state.blockManagement.isInstalling[ blockId ] || false;\n}\n\n/**\n * Returns all block error notices.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Object with error notices.\n */\nexport function getErrorNotices( state ) {\n\treturn state.errorNotices;\n}\n\n/**\n * Returns the error notice for a given block.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId The ID of the block plugin. eg: my-block\n *\n * @return {string|boolean} The error text, or false if no error.\n */\nexport function getErrorNoticeForBlock( state, blockId ) {\n\treturn state.errorNotices[ blockId ];\n}\n"]}
1
+ {"version":3,"names":["createRegistrySelector","store","blockEditorStore","hasBlockType","isRequestingDownloadableBlocks","state","filterValue","_state$downloadableBl","downloadableBlocks","isRequesting","getDownloadableBlocks","_state$downloadableBl2","results","getInstalledBlockTypes","blockManagement","installedBlockTypes","getNewBlockTypes","select","usedBlockTree","getBlocks","filter","blockType","getUnusedBlockTypes","isInstalling","blockId","getErrorNotices","errorNotices","getErrorNoticeForBlock"],"sources":["@wordpress/block-directory/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport hasBlockType from './utils/has-block-type';\n\n/**\n * Returns true if application is requesting for downloadable blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {boolean} Whether a request is in progress for the blocks list.\n */\nexport function isRequestingDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.isRequesting ?? false;\n}\n\n/**\n * Returns the available uninstalled blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {Array} Downloadable blocks.\n */\nexport function getDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.results ?? [];\n}\n\n/**\n * Returns the block types that have been installed on the server in this\n * session.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items\n */\nexport function getInstalledBlockTypes( state ) {\n\treturn state.blockManagement.installedBlockTypes;\n}\n\n/**\n * Returns block types that have been installed on the server and used in the\n * current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getNewBlockTypes = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst usedBlockTree = select( blockEditorStore ).getBlocks();\n\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\n\t\treturn installedBlockTypes.filter( ( blockType ) =>\n\t\t\thasBlockType( blockType, usedBlockTree )\n\t\t);\n\t}\n);\n\n/**\n * Returns the block types that have been installed on the server but are not\n * used in the current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getUnusedBlockTypes = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst usedBlockTree = select( blockEditorStore ).getBlocks();\n\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\n\t\treturn installedBlockTypes.filter(\n\t\t\t( blockType ) => ! hasBlockType( blockType, usedBlockTree )\n\t\t);\n\t}\n);\n\n/**\n * Returns true if a block plugin install is in progress.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId Id of the block.\n *\n * @return {boolean} Whether this block is currently being installed.\n */\nexport function isInstalling( state, blockId ) {\n\treturn state.blockManagement.isInstalling[ blockId ] || false;\n}\n\n/**\n * Returns all block error notices.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Object with error notices.\n */\nexport function getErrorNotices( state ) {\n\treturn state.errorNotices;\n}\n\n/**\n * Returns the error notice for a given block.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId The ID of the block plugin. eg: my-block\n *\n * @return {string|boolean} The error text, or false if no error.\n */\nexport function getErrorNoticeForBlock( state, blockId ) {\n\treturn state.errorNotices[ blockId ];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,sBAAsB,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA,OAAOC,YAAY,MAAM,wBAAwB;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,8BAA8BA,CAAEC,KAAK,EAAEC,WAAW,EAAG;EAAA,IAAAC,qBAAA;EACpE,QAAAA,qBAAA,GAAOF,KAAK,CAACG,kBAAkB,CAAEF,WAAW,CAAE,EAAEG,YAAY,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,KAAK;AACtE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,qBAAqBA,CAAEL,KAAK,EAAEC,WAAW,EAAG;EAAA,IAAAK,sBAAA;EAC3D,QAAAA,sBAAA,GAAON,KAAK,CAACG,kBAAkB,CAAEF,WAAW,CAAE,EAAEM,OAAO,cAAAD,sBAAA,cAAAA,sBAAA,GAAI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A;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAAEtB,KAAK,EAAEmB,OAAO,EAAG;EACxD,OAAOnB,KAAK,CAACqB,YAAY,CAAEF,OAAO,CAAE;AACrC"}
@@ -9,13 +9,10 @@ export default function getPluginUrl(block) {
9
9
  if (!block) {
10
10
  return false;
11
11
  }
12
-
13
12
  const link = block.links['wp:plugin'] || block.links.self;
14
-
15
13
  if (link && link.length) {
16
14
  return link[0].href;
17
15
  }
18
-
19
16
  return false;
20
17
  }
21
18
  //# sourceMappingURL=get-plugin-url.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/store/utils/get-plugin-url.js"],"names":["getPluginUrl","block","link","links","self","length","href"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,YAAT,CAAuBC,KAAvB,EAA+B;AAC7C,MAAK,CAAEA,KAAP,EAAe;AACd,WAAO,KAAP;AACA;;AACD,QAAMC,IAAI,GAAGD,KAAK,CAACE,KAAN,CAAa,WAAb,KAA8BF,KAAK,CAACE,KAAN,CAAYC,IAAvD;;AACA,MAAKF,IAAI,IAAIA,IAAI,CAACG,MAAlB,EAA2B;AAC1B,WAAOH,IAAI,CAAE,CAAF,CAAJ,CAAUI,IAAjB;AACA;;AACD,SAAO,KAAP;AACA","sourcesContent":["/**\n * Get the plugin's direct API link out of a block-directory response.\n *\n * @param {Object} block The block object\n *\n * @return {string} The plugin URL, if exists.\n */\nexport default function getPluginUrl( block ) {\n\tif ( ! block ) {\n\t\treturn false;\n\t}\n\tconst link = block.links[ 'wp:plugin' ] || block.links.self;\n\tif ( link && link.length ) {\n\t\treturn link[ 0 ].href;\n\t}\n\treturn false;\n}\n"]}
1
+ {"version":3,"names":["getPluginUrl","block","link","links","self","length","href"],"sources":["@wordpress/block-directory/src/store/utils/get-plugin-url.js"],"sourcesContent":["/**\n * Get the plugin's direct API link out of a block-directory response.\n *\n * @param {Object} block The block object\n *\n * @return {string} The plugin URL, if exists.\n */\nexport default function getPluginUrl( block ) {\n\tif ( ! block ) {\n\t\treturn false;\n\t}\n\tconst link = block.links[ 'wp:plugin' ] || block.links.self;\n\tif ( link && link.length ) {\n\t\treturn link[ 0 ].href;\n\t}\n\treturn false;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,YAAYA,CAAEC,KAAK,EAAG;EAC7C,IAAK,CAAEA,KAAK,EAAG;IACd,OAAO,KAAK;EACb;EACA,MAAMC,IAAI,GAAGD,KAAK,CAACE,KAAK,CAAE,WAAW,CAAE,IAAIF,KAAK,CAACE,KAAK,CAACC,IAAI;EAC3D,IAAKF,IAAI,IAAIA,IAAI,CAACG,MAAM,EAAG;IAC1B,OAAOH,IAAI,CAAE,CAAC,CAAE,CAACI,IAAI;EACtB;EACA,OAAO,KAAK;AACb"}
@@ -11,19 +11,16 @@ export default function hasBlockType(blockType, blocks = []) {
11
11
  if (!blocks.length) {
12
12
  return false;
13
13
  }
14
-
15
14
  if (blocks.some(({
16
15
  name
17
16
  }) => name === blockType.name)) {
18
17
  return true;
19
18
  }
20
-
21
19
  for (let i = 0; i < blocks.length; i++) {
22
20
  if (hasBlockType(blockType, blocks[i].innerBlocks)) {
23
21
  return true;
24
22
  }
25
23
  }
26
-
27
24
  return false;
28
25
  }
29
26
  //# sourceMappingURL=has-block-type.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/store/utils/has-block-type.js"],"names":["hasBlockType","blockType","blocks","length","some","name","i","innerBlocks"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,YAAT,CAAuBC,SAAvB,EAAkCC,MAAM,GAAG,EAA3C,EAAgD;AAC9D,MAAK,CAAEA,MAAM,CAACC,MAAd,EAAuB;AACtB,WAAO,KAAP;AACA;;AACD,MAAKD,MAAM,CAACE,IAAP,CAAa,CAAE;AAAEC,IAAAA;AAAF,GAAF,KAAgBA,IAAI,KAAKJ,SAAS,CAACI,IAAhD,CAAL,EAA8D;AAC7D,WAAO,IAAP;AACA;;AACD,OAAM,IAAIC,CAAC,GAAG,CAAd,EAAiBA,CAAC,GAAGJ,MAAM,CAACC,MAA5B,EAAoCG,CAAC,EAArC,EAA0C;AACzC,QAAKN,YAAY,CAAEC,SAAF,EAAaC,MAAM,CAAEI,CAAF,CAAN,CAAYC,WAAzB,CAAjB,EAA0D;AACzD,aAAO,IAAP;AACA;AACD;;AAED,SAAO,KAAP;AACA","sourcesContent":["/**\n * Check if a block list contains a specific block type. Recursively searches\n * through `innerBlocks` if they exist.\n *\n * @param {Object} blockType A block object to search for.\n * @param {Object[]} blocks The list of blocks to look through.\n *\n * @return {boolean} Whether the blockType is found.\n */\nexport default function hasBlockType( blockType, blocks = [] ) {\n\tif ( ! blocks.length ) {\n\t\treturn false;\n\t}\n\tif ( blocks.some( ( { name } ) => name === blockType.name ) ) {\n\t\treturn true;\n\t}\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( hasBlockType( blockType, blocks[ i ].innerBlocks ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n"]}
1
+ {"version":3,"names":["hasBlockType","blockType","blocks","length","some","name","i","innerBlocks"],"sources":["@wordpress/block-directory/src/store/utils/has-block-type.js"],"sourcesContent":["/**\n * Check if a block list contains a specific block type. Recursively searches\n * through `innerBlocks` if they exist.\n *\n * @param {Object} blockType A block object to search for.\n * @param {Object[]} blocks The list of blocks to look through.\n *\n * @return {boolean} Whether the blockType is found.\n */\nexport default function hasBlockType( blockType, blocks = [] ) {\n\tif ( ! blocks.length ) {\n\t\treturn false;\n\t}\n\tif ( blocks.some( ( { name } ) => name === blockType.name ) ) {\n\t\treturn true;\n\t}\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( hasBlockType( blockType, blocks[ i ].innerBlocks ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,YAAYA,CAAEC,SAAS,EAAEC,MAAM,GAAG,EAAE,EAAG;EAC9D,IAAK,CAAEA,MAAM,CAACC,MAAM,EAAG;IACtB,OAAO,KAAK;EACb;EACA,IAAKD,MAAM,CAACE,IAAI,CAAE,CAAE;IAAEC;EAAK,CAAC,KAAMA,IAAI,KAAKJ,SAAS,CAACI,IAAK,CAAC,EAAG;IAC7D,OAAO,IAAI;EACZ;EACA,KAAM,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,MAAM,CAACC,MAAM,EAAEG,CAAC,EAAE,EAAG;IACzC,IAAKN,YAAY,CAAEC,SAAS,EAAEC,MAAM,CAAEI,CAAC,CAAE,CAACC,WAAY,CAAC,EAAG;MACzD,OAAO,IAAI;IACZ;EACD;EAEA,OAAO,KAAK;AACb"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-directory",
3
- "version": "4.16.0",
3
+ "version": "4.17.1",
4
4
  "description": "Extend editor with block directory features to search, download and install blocks.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -26,24 +26,24 @@
26
26
  "react-native": "src/index",
27
27
  "dependencies": {
28
28
  "@babel/runtime": "^7.16.0",
29
- "@wordpress/a11y": "^3.39.0",
30
- "@wordpress/api-fetch": "^6.36.0",
31
- "@wordpress/block-editor": "^12.7.0",
32
- "@wordpress/blocks": "^12.16.0",
33
- "@wordpress/components": "^25.5.0",
34
- "@wordpress/compose": "^6.16.0",
35
- "@wordpress/core-data": "^6.16.0",
36
- "@wordpress/data": "^9.9.0",
37
- "@wordpress/edit-post": "^7.16.0",
38
- "@wordpress/editor": "^13.16.0",
39
- "@wordpress/element": "^5.16.0",
40
- "@wordpress/hooks": "^3.39.0",
41
- "@wordpress/html-entities": "^3.39.0",
42
- "@wordpress/i18n": "^4.39.0",
43
- "@wordpress/icons": "^9.30.0",
44
- "@wordpress/notices": "^4.7.0",
45
- "@wordpress/plugins": "^6.7.0",
46
- "@wordpress/url": "^3.40.0",
29
+ "@wordpress/a11y": "^3.40.1",
30
+ "@wordpress/api-fetch": "^6.37.1",
31
+ "@wordpress/block-editor": "^12.8.1",
32
+ "@wordpress/blocks": "^12.17.1",
33
+ "@wordpress/components": "^25.6.1",
34
+ "@wordpress/compose": "^6.17.1",
35
+ "@wordpress/core-data": "^6.17.1",
36
+ "@wordpress/data": "^9.10.1",
37
+ "@wordpress/edit-post": "^7.17.1",
38
+ "@wordpress/editor": "^13.17.1",
39
+ "@wordpress/element": "^5.17.1",
40
+ "@wordpress/hooks": "^3.40.1",
41
+ "@wordpress/html-entities": "^3.40.1",
42
+ "@wordpress/i18n": "^4.40.1",
43
+ "@wordpress/icons": "^9.31.1",
44
+ "@wordpress/notices": "^4.8.1",
45
+ "@wordpress/plugins": "^6.8.1",
46
+ "@wordpress/url": "^3.41.1",
47
47
  "change-case": "^4.1.2"
48
48
  },
49
49
  "peerDependencies": {
@@ -53,5 +53,5 @@
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  },
56
- "gitHead": "b898cf1dc8e70841d1647ea0994ac6278acc18a7"
56
+ "gitHead": "bb1fbf87bb0f451744530fc6a85de2dff1263bed"
57
57
  }
@@ -61,7 +61,7 @@ describe( 'DownloadableBlockListItem', () => {
61
61
  );
62
62
  const button = screen.getByRole( 'option' );
63
63
  // Keeping it false to avoid focus loss and disable it using aria-disabled.
64
- expect( button.disabled ).toBe( false );
64
+ expect( button ).toBeEnabled();
65
65
  expect( button ).toHaveAttribute( 'aria-disabled', 'true' );
66
66
  } );
67
67