@wordpress/block-directory 4.16.0 → 4.17.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 (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
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.17.0 (2023-08-16)
6
+
5
7
  ## 4.16.0 (2023-08-10)
6
8
 
7
9
  ## 4.15.0 (2023-07-20)
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = AutoBlockUninstaller;
7
-
8
7
  var _blocks = require("@wordpress/blocks");
9
-
10
8
  var _data = require("@wordpress/data");
11
-
12
9
  var _element = require("@wordpress/element");
13
-
14
10
  var _editor = require("@wordpress/editor");
15
-
16
11
  var _store = require("../../store");
17
-
18
12
  /**
19
13
  * WordPress dependencies
20
14
  */
@@ -22,6 +16,7 @@ var _store = require("../../store");
22
16
  /**
23
17
  * Internal dependencies
24
18
  */
19
+
25
20
  function AutoBlockUninstaller() {
26
21
  const {
27
22
  uninstallBlockType
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/components/auto-block-uninstaller/index.js"],"names":["AutoBlockUninstaller","uninstallBlockType","blockDirectoryStore","shouldRemoveBlockTypes","select","isAutosavingPost","isSavingPost","editorStore","unusedBlockTypes","getUnusedBlockTypes","length","forEach","blockType","name"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGe,SAASA,oBAAT,GAAgC;AAC9C,QAAM;AAAEC,IAAAA;AAAF,MAAyB,uBAAaC,YAAb,CAA/B;AAEA,QAAMC,sBAAsB,GAAG,qBAAaC,MAAF,IAAc;AACvD,UAAM;AAAEC,MAAAA,gBAAF;AAAoBC,MAAAA;AAApB,QAAqCF,MAAM,CAAEG,aAAF,CAAjD;AACA,WAAOD,YAAY,MAAM,CAAED,gBAAgB,EAA3C;AACA,GAH8B,EAG5B,EAH4B,CAA/B;AAKA,QAAMG,gBAAgB,GAAG,qBACtBJ,MAAF,IAAcA,MAAM,CAAEF,YAAF,CAAN,CAA8BO,mBAA9B,EADU,EAExB,EAFwB,CAAzB;AAKA,0BAAW,MAAM;AAChB,QAAKN,sBAAsB,IAAIK,gBAAgB,CAACE,MAAhD,EAAyD;AACxDF,MAAAA,gBAAgB,CAACG,OAAjB,CAA4BC,SAAF,IAAiB;AAC1CX,QAAAA,kBAAkB,CAAEW,SAAF,CAAlB;AACA,yCAAqBA,SAAS,CAACC,IAA/B;AACA,OAHD;AAIA;AACD,GAPD,EAOG,CAAEV,sBAAF,CAPH;AASA,SAAO,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { unregisterBlockType } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function AutoBlockUninstaller() {\n\tconst { uninstallBlockType } = useDispatch( blockDirectoryStore );\n\n\tconst shouldRemoveBlockTypes = useSelect( ( select ) => {\n\t\tconst { isAutosavingPost, isSavingPost } = select( editorStore );\n\t\treturn isSavingPost() && ! isAutosavingPost();\n\t}, [] );\n\n\tconst unusedBlockTypes = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).getUnusedBlockTypes(),\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( shouldRemoveBlockTypes && unusedBlockTypes.length ) {\n\t\t\tunusedBlockTypes.forEach( ( blockType ) => {\n\t\t\t\tuninstallBlockType( blockType );\n\t\t\t\tunregisterBlockType( blockType.name );\n\t\t\t} );\n\t\t}\n\t}, [ shouldRemoveBlockTypes ] );\n\n\treturn null;\n}\n"]}
1
+ {"version":3,"names":["_blocks","require","_data","_element","_editor","_store","AutoBlockUninstaller","uninstallBlockType","useDispatch","blockDirectoryStore","shouldRemoveBlockTypes","useSelect","select","isAutosavingPost","isSavingPost","editorStore","unusedBlockTypes","getUnusedBlockTypes","useEffect","length","forEach","blockType","unregisterBlockType","name"],"sources":["@wordpress/block-directory/src/components/auto-block-uninstaller/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { unregisterBlockType } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function AutoBlockUninstaller() {\n\tconst { uninstallBlockType } = useDispatch( blockDirectoryStore );\n\n\tconst shouldRemoveBlockTypes = useSelect( ( select ) => {\n\t\tconst { isAutosavingPost, isSavingPost } = select( editorStore );\n\t\treturn isSavingPost() && ! isAutosavingPost();\n\t}, [] );\n\n\tconst unusedBlockTypes = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).getUnusedBlockTypes(),\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( shouldRemoveBlockTypes && unusedBlockTypes.length ) {\n\t\t\tunusedBlockTypes.forEach( ( blockType ) => {\n\t\t\t\tuninstallBlockType( blockType );\n\t\t\t\tunregisterBlockType( blockType.name );\n\t\t\t} );\n\t\t}\n\t}, [ shouldRemoveBlockTypes ] );\n\n\treturn null;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAMA;AACA;AACA;;AAGe,SAASK,oBAAoBA,CAAA,EAAG;EAC9C,MAAM;IAAEC;EAAmB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAoB,CAAC;EAEjE,MAAMC,sBAAsB,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACvD,MAAM;MAAEC,gBAAgB;MAAEC;IAAa,CAAC,GAAGF,MAAM,CAAEG,aAAY,CAAC;IAChE,OAAOD,YAAY,CAAC,CAAC,IAAI,CAAED,gBAAgB,CAAC,CAAC;EAC9C,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMG,gBAAgB,GAAG,IAAAL,eAAS,EAC/BC,MAAM,IAAMA,MAAM,CAAEH,YAAoB,CAAC,CAACQ,mBAAmB,CAAC,CAAC,EACjE,EACD,CAAC;EAED,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKR,sBAAsB,IAAIM,gBAAgB,CAACG,MAAM,EAAG;MACxDH,gBAAgB,CAACI,OAAO,CAAIC,SAAS,IAAM;QAC1Cd,kBAAkB,CAAEc,SAAU,CAAC;QAC/B,IAAAC,2BAAmB,EAAED,SAAS,CAACE,IAAK,CAAC;MACtC,CAAE,CAAC;IACJ;EACD,CAAC,EAAE,CAAEb,sBAAsB,CAAG,CAAC;EAE/B,OAAO,IAAI;AACZ"}
@@ -1,19 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = exports.BlockRatings = void 0;
9
-
10
8
  var _element = require("@wordpress/element");
11
-
12
9
  var _stars = _interopRequireDefault(require("./stars"));
13
-
14
10
  /**
15
11
  * Internal dependencies
16
12
  */
13
+
17
14
  const BlockRatings = ({
18
15
  rating
19
16
  }) => (0, _element.createElement)("span", {
@@ -21,7 +18,6 @@ const BlockRatings = ({
21
18
  }, (0, _element.createElement)(_stars.default, {
22
19
  rating: rating
23
20
  }));
24
-
25
21
  exports.BlockRatings = BlockRatings;
26
22
  var _default = BlockRatings;
27
23
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/components/block-ratings/index.js"],"names":["BlockRatings","rating"],"mappings":";;;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,YAAY,GAAG,CAAE;AAAEC,EAAAA;AAAF,CAAF,KAC3B;AAAM,EAAA,SAAS,EAAC;AAAhB,GACC,4BAAC,cAAD;AAAO,EAAA,MAAM,EAAGA;AAAhB,EADD,CADM;;;eAMQD,Y","sourcesContent":["/**\n * Internal dependencies\n */\nimport Stars from './stars';\n\nexport const BlockRatings = ( { rating } ) => (\n\t<span className=\"block-directory-block-ratings\">\n\t\t<Stars rating={ rating } />\n\t</span>\n);\n\nexport default BlockRatings;\n"]}
1
+ {"version":3,"names":["_stars","_interopRequireDefault","require","BlockRatings","rating","_element","createElement","className","default","exports","_default"],"sources":["@wordpress/block-directory/src/components/block-ratings/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport Stars from './stars';\n\nexport const BlockRatings = ( { rating } ) => (\n\t<span className=\"block-directory-block-ratings\">\n\t\t<Stars rating={ rating } />\n\t</span>\n);\n\nexport default BlockRatings;\n"],"mappings":";;;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAMC,YAAY,GAAGA,CAAE;EAAEC;AAAO,CAAC,KACvC,IAAAC,QAAA,CAAAC,aAAA;EAAMC,SAAS,EAAC;AAA+B,GAC9C,IAAAF,QAAA,CAAAC,aAAA,EAACN,MAAA,CAAAQ,OAAK;EAACJ,MAAM,EAAGA;AAAQ,CAAE,CACrB,CACN;AAACK,OAAA,CAAAN,YAAA,GAAAA,YAAA;AAAA,IAAAO,QAAA,GAEaP,YAAY;AAAAM,OAAA,CAAAD,OAAA,GAAAE,QAAA"}
@@ -4,16 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _element = require("@wordpress/element");
9
-
10
8
  var _i18n = require("@wordpress/i18n");
11
-
12
9
  var _icons = require("@wordpress/icons");
13
-
14
10
  /**
15
11
  * WordPress dependencies
16
12
  */
13
+
17
14
  function Stars({
18
15
  rating
19
16
  }) {
@@ -22,8 +19,7 @@ function Stars({
22
19
  const halfStarCount = Math.ceil(rating - fullStarCount);
23
20
  const emptyStarCount = 5 - (fullStarCount + halfStarCount);
24
21
  return (0, _element.createElement)("span", {
25
- "aria-label": (0, _i18n.sprintf)(
26
- /* translators: %s: number of stars. */
22
+ "aria-label": (0, _i18n.sprintf)( /* translators: %s: number of stars. */
27
23
  (0, _i18n.__)('%s out of 5 stars'), stars)
28
24
  }, Array.from({
29
25
  length: fullStarCount
@@ -48,7 +44,6 @@ function Stars({
48
44
  size: 16
49
45
  })));
50
46
  }
51
-
52
47
  var _default = Stars;
53
48
  exports.default = _default;
54
49
  //# sourceMappingURL=stars.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/components/block-ratings/stars.js"],"names":["Stars","rating","stars","Math","round","fullStarCount","floor","halfStarCount","ceil","emptyStarCount","Array","from","length","map","_","i","starFilled","starHalf","starEmpty"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,SAASA,KAAT,CAAgB;AAAEC,EAAAA;AAAF,CAAhB,EAA6B;AAC5B,QAAMC,KAAK,GAAGC,IAAI,CAACC,KAAL,CAAYH,MAAM,GAAG,GAArB,IAA6B,GAA3C;AAEA,QAAMI,aAAa,GAAGF,IAAI,CAACG,KAAL,CAAYL,MAAZ,CAAtB;AACA,QAAMM,aAAa,GAAGJ,IAAI,CAACK,IAAL,CAAWP,MAAM,GAAGI,aAApB,CAAtB;AACA,QAAMI,cAAc,GAAG,KAAMJ,aAAa,GAAGE,aAAtB,CAAvB;AAEA,SACC;AACC,kBAAa;AACZ;AACA,kBAAI,mBAAJ,CAFY,EAGZL,KAHY;AADd,KAOGQ,KAAK,CAACC,IAAN,CAAY;AAAEC,IAAAA,MAAM,EAAEP;AAAV,GAAZ,EAAwCQ,GAAxC,CAA6C,CAAEC,CAAF,EAAKC,CAAL,KAC9C,4BAAC,WAAD;AACC,IAAA,GAAG,EAAI,cAAcA,CAAG,EADzB;AAEC,IAAA,SAAS,EAAC,0CAFX;AAGC,IAAA,IAAI,EAAGC,iBAHR;AAIC,IAAA,IAAI,EAAG;AAJR,IADC,CAPH,EAeGN,KAAK,CAACC,IAAN,CAAY;AAAEC,IAAAA,MAAM,EAAEL;AAAV,GAAZ,EAAwCM,GAAxC,CAA6C,CAAEC,CAAF,EAAKC,CAAL,KAC9C,4BAAC,WAAD;AACC,IAAA,GAAG,EAAI,cAAcA,CAAG,EADzB;AAEC,IAAA,SAAS,EAAC,+CAFX;AAGC,IAAA,IAAI,EAAGE,eAHR;AAIC,IAAA,IAAI,EAAG;AAJR,IADC,CAfH,EAuBGP,KAAK,CAACC,IAAN,CAAY;AAAEC,IAAAA,MAAM,EAAEH;AAAV,GAAZ,EAAyCI,GAAzC,CAA8C,CAAEC,CAAF,EAAKC,CAAL,KAC/C,4BAAC,WAAD;AACC,IAAA,GAAG,EAAI,eAAeA,CAAG,EAD1B;AAEC,IAAA,SAAS,EAAC,2CAFX;AAGC,IAAA,IAAI,EAAGG,gBAHR;AAIC,IAAA,IAAI,EAAG;AAJR,IADC,CAvBH,CADD;AAkCA;;eAEclB,K","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Icon, starEmpty, starFilled, starHalf } from '@wordpress/icons';\n\nfunction Stars( { rating } ) {\n\tconst stars = Math.round( rating / 0.5 ) * 0.5;\n\n\tconst fullStarCount = Math.floor( rating );\n\tconst halfStarCount = Math.ceil( rating - fullStarCount );\n\tconst emptyStarCount = 5 - ( fullStarCount + halfStarCount );\n\n\treturn (\n\t\t<span\n\t\t\taria-label={ sprintf(\n\t\t\t\t/* translators: %s: number of stars. */\n\t\t\t\t__( '%s out of 5 stars' ),\n\t\t\t\tstars\n\t\t\t) }\n\t\t>\n\t\t\t{ Array.from( { length: fullStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `full_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-full\"\n\t\t\t\t\ticon={ starFilled }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ Array.from( { length: halfStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `half_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-half-full\"\n\t\t\t\t\ticon={ starHalf }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ Array.from( { length: emptyStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `empty_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-empty\"\n\t\t\t\t\ticon={ starEmpty }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</span>\n\t);\n}\n\nexport default Stars;\n"]}
1
+ {"version":3,"names":["_i18n","require","_icons","Stars","rating","stars","Math","round","fullStarCount","floor","halfStarCount","ceil","emptyStarCount","_element","createElement","sprintf","__","Array","from","length","map","_","i","Icon","key","className","icon","starFilled","size","starHalf","starEmpty","_default","exports","default"],"sources":["@wordpress/block-directory/src/components/block-ratings/stars.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Icon, starEmpty, starFilled, starHalf } from '@wordpress/icons';\n\nfunction Stars( { rating } ) {\n\tconst stars = Math.round( rating / 0.5 ) * 0.5;\n\n\tconst fullStarCount = Math.floor( rating );\n\tconst halfStarCount = Math.ceil( rating - fullStarCount );\n\tconst emptyStarCount = 5 - ( fullStarCount + halfStarCount );\n\n\treturn (\n\t\t<span\n\t\t\taria-label={ sprintf(\n\t\t\t\t/* translators: %s: number of stars. */\n\t\t\t\t__( '%s out of 5 stars' ),\n\t\t\t\tstars\n\t\t\t) }\n\t\t>\n\t\t\t{ Array.from( { length: fullStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `full_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-full\"\n\t\t\t\t\ticon={ starFilled }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ Array.from( { length: halfStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `half_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-half-full\"\n\t\t\t\t\ticon={ starHalf }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ Array.from( { length: emptyStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `empty_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-empty\"\n\t\t\t\t\ticon={ starEmpty }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</span>\n\t);\n}\n\nexport default Stars;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,SAASE,KAAKA,CAAE;EAAEC;AAAO,CAAC,EAAG;EAC5B,MAAMC,KAAK,GAAGC,IAAI,CAACC,KAAK,CAAEH,MAAM,GAAG,GAAI,CAAC,GAAG,GAAG;EAE9C,MAAMI,aAAa,GAAGF,IAAI,CAACG,KAAK,CAAEL,MAAO,CAAC;EAC1C,MAAMM,aAAa,GAAGJ,IAAI,CAACK,IAAI,CAAEP,MAAM,GAAGI,aAAc,CAAC;EACzD,MAAMI,cAAc,GAAG,CAAC,IAAKJ,aAAa,GAAGE,aAAa,CAAE;EAE5D,OACC,IAAAG,QAAA,CAAAC,aAAA;IACC,cAAa,IAAAC,aAAO,GACnB;IACA,IAAAC,QAAE,EAAE,mBAAoB,CAAC,EACzBX,KACD;EAAG,GAEDY,KAAK,CAACC,IAAI,CAAE;IAAEC,MAAM,EAAEX;EAAc,CAAE,CAAC,CAACY,GAAG,CAAE,CAAEC,CAAC,EAAEC,CAAC,KACpD,IAAAT,QAAA,CAAAC,aAAA,EAACZ,MAAA,CAAAqB,IAAI;IACJC,GAAG,EAAI,cAAcF,CAAG,EAAG;IAC3BG,SAAS,EAAC,0CAA0C;IACpDC,IAAI,EAAGC,iBAAY;IACnBC,IAAI,EAAG;EAAI,CACX,CACA,CAAC,EACDX,KAAK,CAACC,IAAI,CAAE;IAAEC,MAAM,EAAET;EAAc,CAAE,CAAC,CAACU,GAAG,CAAE,CAAEC,CAAC,EAAEC,CAAC,KACpD,IAAAT,QAAA,CAAAC,aAAA,EAACZ,MAAA,CAAAqB,IAAI;IACJC,GAAG,EAAI,cAAcF,CAAG,EAAG;IAC3BG,SAAS,EAAC,+CAA+C;IACzDC,IAAI,EAAGG,eAAU;IACjBD,IAAI,EAAG;EAAI,CACX,CACA,CAAC,EACDX,KAAK,CAACC,IAAI,CAAE;IAAEC,MAAM,EAAEP;EAAe,CAAE,CAAC,CAACQ,GAAG,CAAE,CAAEC,CAAC,EAAEC,CAAC,KACrD,IAAAT,QAAA,CAAAC,aAAA,EAACZ,MAAA,CAAAqB,IAAI;IACJC,GAAG,EAAI,eAAeF,CAAG,EAAG;IAC5BG,SAAS,EAAC,2CAA2C;IACrDC,IAAI,EAAGI,gBAAW;IAClBF,IAAI,EAAG;EAAI,CACX,CACA,CACG,CAAC;AAET;AAAC,IAAAG,QAAA,GAEc5B,KAAK;AAAA6B,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -1,18 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = CompactList;
9
-
10
8
  var _element = require("@wordpress/element");
11
-
12
9
  var _i18n = require("@wordpress/i18n");
13
-
14
10
  var _downloadableBlockIcon = _interopRequireDefault(require("../downloadable-block-icon"));
15
-
16
11
  /**
17
12
  * WordPress dependencies
18
13
  */
@@ -20,13 +15,13 @@ var _downloadableBlockIcon = _interopRequireDefault(require("../downloadable-blo
20
15
  /**
21
16
  * Internal dependencies
22
17
  */
18
+
23
19
  function CompactList({
24
20
  items
25
21
  }) {
26
22
  if (!items.length) {
27
23
  return null;
28
24
  }
29
-
30
25
  return (0, _element.createElement)("ul", {
31
26
  className: "block-directory-compact-list"
32
27
  }, items.map(({
@@ -46,8 +41,7 @@ function CompactList({
46
41
  className: "block-directory-compact-list__item-title"
47
42
  }, title), (0, _element.createElement)("div", {
48
43
  className: "block-directory-compact-list__item-author"
49
- }, (0, _i18n.sprintf)(
50
- /* translators: %s: Name of the block author. */
44
+ }, (0, _i18n.sprintf)( /* translators: %s: Name of the block author. */
51
45
  (0, _i18n.__)('By %s'), author))))));
52
46
  }
53
47
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/components/compact-list/index.js"],"names":["CompactList","items","length","map","icon","id","title","author"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGe,SAASA,WAAT,CAAsB;AAAEC,EAAAA;AAAF,CAAtB,EAAkC;AAChD,MAAK,CAAEA,KAAK,CAACC,MAAb,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGD,KAAK,CAACE,GAAN,CAAW,CAAE;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,EAAR;AAAYC,IAAAA,KAAZ;AAAmBC,IAAAA;AAAnB,GAAF,KACZ;AAAI,IAAA,GAAG,EAAGF,EAAV;AAAe,IAAA,SAAS,EAAC;AAAzB,KACC,4BAAC,8BAAD;AAAuB,IAAA,IAAI,EAAGD,IAA9B;AAAqC,IAAA,KAAK,EAAGE;AAA7C,IADD,EAGC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGA,KADH,CADD,EAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG;AACD;AACA,gBAAI,OAAJ,CAFC,EAGDC,MAHC,CADH,CAJD,CAHD,CADC,CADH,CADD;AAsBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlockIcon from '../downloadable-block-icon';\n\nexport default function CompactList( { items } ) {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ul className=\"block-directory-compact-list\">\n\t\t\t{ items.map( ( { icon, id, title, author } ) => (\n\t\t\t\t<li key={ id } className=\"block-directory-compact-list__item\">\n\t\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\n\t\t\t\t\t<div className=\"block-directory-compact-list__item-details\">\n\t\t\t\t\t\t<div className=\"block-directory-compact-list__item-title\">\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"block-directory-compact-list__item-author\">\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: Name of the block author. */\n\t\t\t\t\t\t\t\t__( 'By %s' ),\n\t\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n"]}
1
+ {"version":3,"names":["_i18n","require","_downloadableBlockIcon","_interopRequireDefault","CompactList","items","length","_element","createElement","className","map","icon","id","title","author","key","default","sprintf","__"],"sources":["@wordpress/block-directory/src/components/compact-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlockIcon from '../downloadable-block-icon';\n\nexport default function CompactList( { items } ) {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ul className=\"block-directory-compact-list\">\n\t\t\t{ items.map( ( { icon, id, title, author } ) => (\n\t\t\t\t<li key={ id } className=\"block-directory-compact-list__item\">\n\t\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\n\t\t\t\t\t<div className=\"block-directory-compact-list__item-details\">\n\t\t\t\t\t\t<div className=\"block-directory-compact-list__item-title\">\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"block-directory-compact-list__item-author\">\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: Name of the block author. */\n\t\t\t\t\t\t\t\t__( 'By %s' ),\n\t\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,sBAAA,GAAAC,sBAAA,CAAAF,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGe,SAASG,WAAWA,CAAE;EAAEC;AAAM,CAAC,EAAG;EAChD,IAAK,CAAEA,KAAK,CAACC,MAAM,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAC,QAAA,CAAAC,aAAA;IAAIC,SAAS,EAAC;EAA8B,GACzCJ,KAAK,CAACK,GAAG,CAAE,CAAE;IAAEC,IAAI;IAAEC,EAAE;IAAEC,KAAK;IAAEC;EAAO,CAAC,KACzC,IAAAP,QAAA,CAAAC,aAAA;IAAIO,GAAG,EAAGH,EAAI;IAACH,SAAS,EAAC;EAAoC,GAC5D,IAAAF,QAAA,CAAAC,aAAA,EAACN,sBAAA,CAAAc,OAAqB;IAACL,IAAI,EAAGA,IAAM;IAACE,KAAK,EAAGA;EAAO,CAAE,CAAC,EAEvD,IAAAN,QAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAA4C,GAC1D,IAAAF,QAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAA0C,GACtDI,KACE,CAAC,EACN,IAAAN,QAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAA2C,GACvD,IAAAQ,aAAO,GACR;EACA,IAAAC,QAAE,EAAE,OAAQ,CAAC,EACbJ,MACD,CACI,CACD,CACF,CACH,CACC,CAAC;AAEP"}
@@ -4,14 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _element = require("@wordpress/element");
9
-
10
8
  var _blockEditor = require("@wordpress/block-editor");
11
-
12
9
  /**
13
10
  * WordPress dependencies
14
11
  */
12
+
15
13
  function DownloadableBlockIcon({
16
14
  icon
17
15
  }) {
@@ -26,7 +24,6 @@ function DownloadableBlockIcon({
26
24
  showColors: true
27
25
  });
28
26
  }
29
-
30
27
  var _default = DownloadableBlockIcon;
31
28
  exports.default = _default;
32
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-block-icon/index.js"],"names":["DownloadableBlockIcon","icon","className","match"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,SAASA,qBAAT,CAAgC;AAAEC,EAAAA;AAAF,CAAhC,EAA2C;AAC1C,QAAMC,SAAS,GAAG,yCAAlB;AACA,SAAOD,IAAI,CAACE,KAAL,CAAY,oCAAZ,MAAuD,IAAvD,GACN;AAAK,IAAA,SAAS,EAAGD,SAAjB;AAA6B,IAAA,GAAG,EAAGD,IAAnC;AAA0C,IAAA,GAAG,EAAC;AAA9C,IADM,GAGN,4BAAC,sBAAD;AAAW,IAAA,SAAS,EAAGC,SAAvB;AAAmC,IAAA,IAAI,EAAGD,IAA1C;AAAiD,IAAA,UAAU;AAA3D,IAHD;AAKA;;eAEcD,qB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockIcon } from '@wordpress/block-editor';\n\nfunction DownloadableBlockIcon( { icon } ) {\n\tconst className = 'block-directory-downloadable-block-icon';\n\treturn icon.match( /\\.(jpeg|jpg|gif|png|svg)(?:\\?.*)?$/ ) !== null ? (\n\t\t<img className={ className } src={ icon } alt=\"\" />\n\t) : (\n\t\t<BlockIcon className={ className } icon={ icon } showColors />\n\t);\n}\n\nexport default DownloadableBlockIcon;\n"]}
1
+ {"version":3,"names":["_blockEditor","require","DownloadableBlockIcon","icon","className","match","_element","createElement","src","alt","BlockIcon","showColors","_default","exports","default"],"sources":["@wordpress/block-directory/src/components/downloadable-block-icon/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockIcon } from '@wordpress/block-editor';\n\nfunction DownloadableBlockIcon( { icon } ) {\n\tconst className = 'block-directory-downloadable-block-icon';\n\treturn icon.match( /\\.(jpeg|jpg|gif|png|svg)(?:\\?.*)?$/ ) !== null ? (\n\t\t<img className={ className } src={ icon } alt=\"\" />\n\t) : (\n\t\t<BlockIcon className={ className } icon={ icon } showColors />\n\t);\n}\n\nexport default DownloadableBlockIcon;\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,SAASC,qBAAqBA,CAAE;EAAEC;AAAK,CAAC,EAAG;EAC1C,MAAMC,SAAS,GAAG,yCAAyC;EAC3D,OAAOD,IAAI,CAACE,KAAK,CAAE,oCAAqC,CAAC,KAAK,IAAI,GACjE,IAAAC,QAAA,CAAAC,aAAA;IAAKH,SAAS,EAAGA,SAAW;IAACI,GAAG,EAAGL,IAAM;IAACM,GAAG,EAAC;EAAE,CAAE,CAAC,GAEnD,IAAAH,QAAA,CAAAC,aAAA,EAACP,YAAA,CAAAU,SAAS;IAACN,SAAS,EAAGA,SAAW;IAACD,IAAI,EAAGA,IAAM;IAACQ,UAAU;EAAA,CAAE,CAC7D;AACF;AAAC,IAAAC,QAAA,GAEcV,qBAAqB;AAAAW,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -1,32 +1,20 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _element = require("@wordpress/element");
11
-
12
9
  var _i18n = require("@wordpress/i18n");
13
-
14
10
  var _components = require("@wordpress/components");
15
-
16
11
  var _htmlEntities = require("@wordpress/html-entities");
17
-
18
12
  var _blocks = require("@wordpress/blocks");
19
-
20
13
  var _data = require("@wordpress/data");
21
-
22
14
  var _blockRatings = _interopRequireDefault(require("../block-ratings"));
23
-
24
15
  var _downloadableBlockIcon = _interopRequireDefault(require("../downloadable-block-icon"));
25
-
26
16
  var _downloadableBlockNotice = _interopRequireDefault(require("../downloadable-block-notice"));
27
-
28
17
  var _store = require("../../store");
29
-
30
18
  /**
31
19
  * WordPress dependencies
32
20
  */
@@ -34,6 +22,7 @@ var _store = require("../../store");
34
22
  /**
35
23
  * Internal dependencies
36
24
  */
25
+
37
26
  // Return the appropriate block item label, given the block data and status.
38
27
  function getDownloadableBlockLabel({
39
28
  title,
@@ -45,33 +34,27 @@ function getDownloadableBlockLabel({
45
34
  isInstalling
46
35
  }) {
47
36
  const stars = Math.round(rating / 0.5) * 0.5;
48
-
49
37
  if (!isInstalled && hasNotice) {
50
38
  /* translators: %1$s: block title */
51
39
  return (0, _i18n.sprintf)('Retry installing %s.', (0, _htmlEntities.decodeEntities)(title));
52
40
  }
53
-
54
41
  if (isInstalled) {
55
42
  /* translators: %1$s: block title */
56
43
  return (0, _i18n.sprintf)('Add %s.', (0, _htmlEntities.decodeEntities)(title));
57
44
  }
58
-
59
45
  if (isInstalling) {
60
46
  /* translators: %1$s: block title */
61
47
  return (0, _i18n.sprintf)('Installing %s.', (0, _htmlEntities.decodeEntities)(title));
62
- } // No ratings yet, just use the title.
63
-
48
+ }
64
49
 
50
+ // No ratings yet, just use the title.
65
51
  if (ratingCount < 1) {
66
52
  /* translators: %1$s: block title */
67
53
  return (0, _i18n.sprintf)('Install %s.', (0, _htmlEntities.decodeEntities)(title));
68
54
  }
69
-
70
- return (0, _i18n.sprintf)(
71
- /* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */
55
+ return (0, _i18n.sprintf)( /* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */
72
56
  (0, _i18n._n)('Install %1$s. %2$s stars with %3$s review.', 'Install %1$s. %2$s stars with %3$s reviews.', ratingCount), (0, _htmlEntities.decodeEntities)(title), stars, ratingCount);
73
57
  }
74
-
75
58
  function DownloadableBlockListItem({
76
59
  composite,
77
60
  item,
@@ -83,8 +66,8 @@ function DownloadableBlockListItem({
83
66
  icon,
84
67
  rating,
85
68
  title
86
- } = item; // getBlockType returns a block object if this block exists, or null if not.
87
-
69
+ } = item;
70
+ // getBlockType returns a block object if this block exists, or null if not.
88
71
  const isInstalled = !!(0, _blocks.getBlockType)(item.name);
89
72
  const {
90
73
  hasNotice,
@@ -104,13 +87,11 @@ function DownloadableBlockListItem({
104
87
  };
105
88
  }, [item]);
106
89
  let statusText = '';
107
-
108
90
  if (isInstalled) {
109
91
  statusText = (0, _i18n.__)('Installed!');
110
92
  } else if (isInstalling) {
111
93
  statusText = (0, _i18n.__)('Installing…');
112
94
  }
113
-
114
95
  return (0, _element.createElement)(_components.__unstableCompositeItem, {
115
96
  __experimentalIsFocusable: true,
116
97
  role: "option",
@@ -143,8 +124,7 @@ function DownloadableBlockListItem({
143
124
  className: "block-directory-downloadable-block-list-item__details"
144
125
  }, (0, _element.createElement)("span", {
145
126
  className: "block-directory-downloadable-block-list-item__title"
146
- }, (0, _element.createInterpolateElement)((0, _i18n.sprintf)(
147
- /* translators: %1$s: block title, %2$s: author name. */
127
+ }, (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: %1$s: block title, %2$s: author name. */
148
128
  (0, _i18n.__)('%1$s <span>by %2$s</span>'), (0, _htmlEntities.decodeEntities)(title), author), {
149
129
  span: (0, _element.createElement)("span", {
150
130
  className: "block-directory-downloadable-block-list-item__author"
@@ -155,7 +135,6 @@ function DownloadableBlockListItem({
155
135
  className: "block-directory-downloadable-block-list-item__desc"
156
136
  }, !!statusText ? statusText : (0, _htmlEntities.decodeEntities)(description)), isInstallable && !(isInstalled || isInstalling) && (0, _element.createElement)(_components.VisuallyHidden, null, (0, _i18n.__)('Install block')))));
157
137
  }
158
-
159
138
  var _default = DownloadableBlockListItem;
160
139
  exports.default = _default;
161
140
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-block-list-item/index.js"],"names":["getDownloadableBlockLabel","title","rating","ratingCount","hasNotice","isInstalled","isInstalling","stars","Math","round","DownloadableBlockListItem","composite","item","onClick","author","description","icon","name","isInstallable","select","getErrorNoticeForBlock","isBlockInstalling","blockDirectoryStore","notice","id","hasFatal","isFatal","statusText","Button","event","preventDefault","span"],"mappings":";;;;;;;;;AAUA;;AAPA;;AACA;;AAOA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAaA;AACA;AACA;AAMA;AACA,SAASA,yBAAT,CACC;AAAEC,EAAAA,KAAF;AAASC,EAAAA,MAAT;AAAiBC,EAAAA;AAAjB,CADD,EAEC;AAAEC,EAAAA,SAAF;AAAaC,EAAAA,WAAb;AAA0BC,EAAAA;AAA1B,CAFD,EAGE;AACD,QAAMC,KAAK,GAAGC,IAAI,CAACC,KAAL,CAAYP,MAAM,GAAG,GAArB,IAA6B,GAA3C;;AAEA,MAAK,CAAEG,WAAF,IAAiBD,SAAtB,EAAkC;AACjC;AACA,WAAO,mBAAS,sBAAT,EAAiC,kCAAgBH,KAAhB,CAAjC,CAAP;AACA;;AAED,MAAKI,WAAL,EAAmB;AAClB;AACA,WAAO,mBAAS,SAAT,EAAoB,kCAAgBJ,KAAhB,CAApB,CAAP;AACA;;AAED,MAAKK,YAAL,EAAoB;AACnB;AACA,WAAO,mBAAS,gBAAT,EAA2B,kCAAgBL,KAAhB,CAA3B,CAAP;AACA,GAhBA,CAkBD;;;AACA,MAAKE,WAAW,GAAG,CAAnB,EAAuB;AACtB;AACA,WAAO,mBAAS,aAAT,EAAwB,kCAAgBF,KAAhB,CAAxB,CAAP;AACA;;AAED,SAAO;AACN;AACA,gBACC,4CADD,EAEC,6C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IAEA,4BAAC,0BAAD,QACG,cAAI,eAAJ,CADH,CARH,CAnBF,CA9BD,CADD;AAmEA;;eAEcI,yB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tSpinner,\n\tVisuallyHidden,\n\t__unstableCompositeItem as CompositeItem,\n} from '@wordpress/components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockRatings from '../block-ratings';\nimport DownloadableBlockIcon from '../downloadable-block-icon';\nimport DownloadableBlockNotice from '../downloadable-block-notice';\nimport { store as blockDirectoryStore } from '../../store';\n\n// Return the appropriate block item label, given the block data and status.\nfunction getDownloadableBlockLabel(\n\t{ title, rating, ratingCount },\n\t{ hasNotice, isInstalled, isInstalling }\n) {\n\tconst stars = Math.round( rating / 0.5 ) * 0.5;\n\n\tif ( ! isInstalled && hasNotice ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Retry installing %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalled ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Add %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalling ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Installing %s.', decodeEntities( title ) );\n\t}\n\n\t// No ratings yet, just use the title.\n\tif ( ratingCount < 1 ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Install %s.', decodeEntities( title ) );\n\t}\n\n\treturn sprintf(\n\t\t/* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */\n\t\t_n(\n\t\t\t'Install %1$s. %2$s stars with %3$s review.',\n\t\t\t'Install %1$s. %2$s stars with %3$s reviews.',\n\t\t\tratingCount\n\t\t),\n\t\tdecodeEntities( title ),\n\t\tstars,\n\t\tratingCount\n\t);\n}\n\nfunction DownloadableBlockListItem( { composite, item, onClick } ) {\n\tconst { author, description, icon, rating, title } = item;\n\t// getBlockType returns a block object if this block exists, or null if not.\n\tconst isInstalled = !! getBlockType( item.name );\n\n\tconst { hasNotice, isInstalling, isInstallable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getErrorNoticeForBlock, isInstalling: isBlockInstalling } =\n\t\t\t\tselect( blockDirectoryStore );\n\t\t\tconst notice = getErrorNoticeForBlock( item.id );\n\t\t\tconst hasFatal = notice && notice.isFatal;\n\t\t\treturn {\n\t\t\t\thasNotice: !! notice,\n\t\t\t\tisInstalling: isBlockInstalling( item.id ),\n\t\t\t\tisInstallable: ! hasFatal,\n\t\t\t};\n\t\t},\n\t\t[ item ]\n\t);\n\n\tlet statusText = '';\n\tif ( isInstalled ) {\n\t\tstatusText = __( 'Installed!' );\n\t} else if ( isInstalling ) {\n\t\tstatusText = __( 'Installing…' );\n\t}\n\n\treturn (\n\t\t<CompositeItem\n\t\t\t__experimentalIsFocusable\n\t\t\trole=\"option\"\n\t\t\tas={ Button }\n\t\t\t{ ...composite }\n\t\t\tclassName=\"block-directory-downloadable-block-list-item\"\n\t\t\tonClick={ ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonClick();\n\t\t\t} }\n\t\t\tisBusy={ isInstalling }\n\t\t\tdisabled={ isInstalling || ! isInstallable }\n\t\t\tlabel={ getDownloadableBlockLabel( item, {\n\t\t\t\thasNotice,\n\t\t\t\tisInstalled,\n\t\t\t\tisInstalling,\n\t\t\t} ) }\n\t\t\tshowTooltip={ true }\n\t\t\ttooltipPosition=\"top center\"\n\t\t>\n\t\t\t<div className=\"block-directory-downloadable-block-list-item__icon\">\n\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\t\t\t\t{ isInstalling ? (\n\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__spinner\">\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</span>\n\t\t\t\t) : (\n\t\t\t\t\t<BlockRatings rating={ rating } />\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t<span className=\"block-directory-downloadable-block-list-item__details\">\n\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__title\">\n\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %1$s: block title, %2$s: author name. */\n\t\t\t\t\t\t\t__( '%1$s <span>by %2$s</span>' ),\n\t\t\t\t\t\t\tdecodeEntities( title ),\n\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__author\" />\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</span>\n\t\t\t\t{ hasNotice ? (\n\t\t\t\t\t<DownloadableBlockNotice block={ item } />\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__desc\">\n\t\t\t\t\t\t\t{ !! statusText\n\t\t\t\t\t\t\t\t? statusText\n\t\t\t\t\t\t\t\t: decodeEntities( description ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ isInstallable &&\n\t\t\t\t\t\t\t! ( isInstalled || isInstalling ) && (\n\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t{ __( 'Install block' ) }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</span>\n\t\t</CompositeItem>\n\t);\n}\n\nexport default DownloadableBlockListItem;\n"]}
1
+ {"version":3,"names":["_element","require","_i18n","_components","_htmlEntities","_blocks","_data","_blockRatings","_interopRequireDefault","_downloadableBlockIcon","_downloadableBlockNotice","_store","getDownloadableBlockLabel","title","rating","ratingCount","hasNotice","isInstalled","isInstalling","stars","Math","round","sprintf","decodeEntities","_n","DownloadableBlockListItem","composite","item","onClick","author","description","icon","getBlockType","name","isInstallable","useSelect","select","getErrorNoticeForBlock","isBlockInstalling","blockDirectoryStore","notice","id","hasFatal","isFatal","statusText","__","createElement","__unstableCompositeItem","__experimentalIsFocusable","role","as","Button","className","event","preventDefault","isBusy","disabled","label","showTooltip","tooltipPosition","default","Spinner","createInterpolateElement","span","block","Fragment","VisuallyHidden","_default","exports"],"sources":["@wordpress/block-directory/src/components/downloadable-block-list-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tSpinner,\n\tVisuallyHidden,\n\t__unstableCompositeItem as CompositeItem,\n} from '@wordpress/components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockRatings from '../block-ratings';\nimport DownloadableBlockIcon from '../downloadable-block-icon';\nimport DownloadableBlockNotice from '../downloadable-block-notice';\nimport { store as blockDirectoryStore } from '../../store';\n\n// Return the appropriate block item label, given the block data and status.\nfunction getDownloadableBlockLabel(\n\t{ title, rating, ratingCount },\n\t{ hasNotice, isInstalled, isInstalling }\n) {\n\tconst stars = Math.round( rating / 0.5 ) * 0.5;\n\n\tif ( ! isInstalled && hasNotice ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Retry installing %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalled ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Add %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalling ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Installing %s.', decodeEntities( title ) );\n\t}\n\n\t// No ratings yet, just use the title.\n\tif ( ratingCount < 1 ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Install %s.', decodeEntities( title ) );\n\t}\n\n\treturn sprintf(\n\t\t/* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */\n\t\t_n(\n\t\t\t'Install %1$s. %2$s stars with %3$s review.',\n\t\t\t'Install %1$s. %2$s stars with %3$s reviews.',\n\t\t\tratingCount\n\t\t),\n\t\tdecodeEntities( title ),\n\t\tstars,\n\t\tratingCount\n\t);\n}\n\nfunction DownloadableBlockListItem( { composite, item, onClick } ) {\n\tconst { author, description, icon, rating, title } = item;\n\t// getBlockType returns a block object if this block exists, or null if not.\n\tconst isInstalled = !! getBlockType( item.name );\n\n\tconst { hasNotice, isInstalling, isInstallable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getErrorNoticeForBlock, isInstalling: isBlockInstalling } =\n\t\t\t\tselect( blockDirectoryStore );\n\t\t\tconst notice = getErrorNoticeForBlock( item.id );\n\t\t\tconst hasFatal = notice && notice.isFatal;\n\t\t\treturn {\n\t\t\t\thasNotice: !! notice,\n\t\t\t\tisInstalling: isBlockInstalling( item.id ),\n\t\t\t\tisInstallable: ! hasFatal,\n\t\t\t};\n\t\t},\n\t\t[ item ]\n\t);\n\n\tlet statusText = '';\n\tif ( isInstalled ) {\n\t\tstatusText = __( 'Installed!' );\n\t} else if ( isInstalling ) {\n\t\tstatusText = __( 'Installing…' );\n\t}\n\n\treturn (\n\t\t<CompositeItem\n\t\t\t__experimentalIsFocusable\n\t\t\trole=\"option\"\n\t\t\tas={ Button }\n\t\t\t{ ...composite }\n\t\t\tclassName=\"block-directory-downloadable-block-list-item\"\n\t\t\tonClick={ ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonClick();\n\t\t\t} }\n\t\t\tisBusy={ isInstalling }\n\t\t\tdisabled={ isInstalling || ! isInstallable }\n\t\t\tlabel={ getDownloadableBlockLabel( item, {\n\t\t\t\thasNotice,\n\t\t\t\tisInstalled,\n\t\t\t\tisInstalling,\n\t\t\t} ) }\n\t\t\tshowTooltip={ true }\n\t\t\ttooltipPosition=\"top center\"\n\t\t>\n\t\t\t<div className=\"block-directory-downloadable-block-list-item__icon\">\n\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\t\t\t\t{ isInstalling ? (\n\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__spinner\">\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</span>\n\t\t\t\t) : (\n\t\t\t\t\t<BlockRatings rating={ rating } />\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t<span className=\"block-directory-downloadable-block-list-item__details\">\n\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__title\">\n\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %1$s: block title, %2$s: author name. */\n\t\t\t\t\t\t\t__( '%1$s <span>by %2$s</span>' ),\n\t\t\t\t\t\t\tdecodeEntities( title ),\n\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__author\" />\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</span>\n\t\t\t\t{ hasNotice ? (\n\t\t\t\t\t<DownloadableBlockNotice block={ item } />\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__desc\">\n\t\t\t\t\t\t\t{ !! statusText\n\t\t\t\t\t\t\t\t? statusText\n\t\t\t\t\t\t\t\t: decodeEntities( description ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ isInstallable &&\n\t\t\t\t\t\t\t! ( isInstalled || isInstalling ) && (\n\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t{ __( 'Install block' ) }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t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AS,EAAC;IAAsD,CAAE;EAE1E,CACD,CACK,CAAC,EACLpC,SAAS,GACV,IAAAhB,QAAA,CAAA8C,aAAA,EAACpC,wBAAA,CAAAkD,OAAuB;IAACI,KAAK,EAAGrC;EAAM,CAAE,CAAC,GAE1C,IAAA3B,QAAA,CAAA8C,aAAA,EAAA9C,QAAA,CAAAiE,QAAA,QACC,IAAAjE,QAAA,CAAA8C,aAAA;IAAMM,SAAS,EAAC;EAAoD,GACjE,CAAC,CAAER,UAAU,GACZA,UAAU,GACV,IAAArB,4BAAc,EAAEO,WAAY,CAC1B,CAAC,EACLI,aAAa,IACd,EAAIjB,WAAW,IAAIC,YAAY,CAAE,IAChC,IAAAlB,QAAA,CAAA8C,aAAA,EAAC3C,WAAA,CAAA+D,cAAc,QACZ,IAAArB,QAAE,EAAE,eAAgB,CACP,CAEjB,CAEE,CACQ,CAAC;AAElB;AAAC,IAAAsB,QAAA,GAEc1C,yBAAyB;AAAA2C,OAAA,CAAAR,OAAA,GAAAO,QAAA"}
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports.DownloadableBlockNotice = void 0;
7
-
8
7
  var _element = require("@wordpress/element");
9
-
10
8
  var _i18n = require("@wordpress/i18n");
11
-
12
9
  var _data = require("@wordpress/data");
13
-
14
10
  var _store = require("../../store");
15
-
16
11
  /**
17
12
  * WordPress dependencies
18
13
  */
@@ -20,22 +15,20 @@ var _store = require("../../store");
20
15
  /**
21
16
  * Internal dependencies
22
17
  */
18
+
23
19
  const DownloadableBlockNotice = ({
24
20
  block
25
21
  }) => {
26
22
  const errorNotice = (0, _data.useSelect)(select => select(_store.store).getErrorNoticeForBlock(block.id), [block]);
27
-
28
23
  if (!errorNotice) {
29
24
  return null;
30
25
  }
31
-
32
26
  return (0, _element.createElement)("div", {
33
27
  className: "block-directory-downloadable-block-notice"
34
28
  }, (0, _element.createElement)("div", {
35
29
  className: "block-directory-downloadable-block-notice__content"
36
30
  }, errorNotice.message, errorNotice.isFatal ? ' ' + (0, _i18n.__)('Try reloading the page.') : null));
37
31
  };
38
-
39
32
  exports.DownloadableBlockNotice = DownloadableBlockNotice;
40
33
  var _default = DownloadableBlockNotice;
41
34
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-block-notice/index.js"],"names":["DownloadableBlockNotice","block","errorNotice","select","blockDirectoryStore","getErrorNoticeForBlock","id","message","isFatal"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGO,MAAMA,uBAAuB,GAAG,CAAE;AAAEC,EAAAA;AAAF,CAAF,KAAiB;AACvD,QAAMC,WAAW,GAAG,qBACjBC,MAAF,IACCA,MAAM,CAAEC,YAAF,CAAN,CAA8BC,sBAA9B,CAAsDJ,KAAK,CAACK,EAA5D,CAFkB,EAGnB,CAAEL,KAAF,CAHmB,CAApB;;AAMA,MAAK,CAAEC,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AAED,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGA,WAAW,CAACK,OADf,EAEGL,WAAW,CAACM,OAAZ,GACC,MAAM,cAAI,yBAAJ,CADP,GAEC,IAJJ,CADD,CADD;AAUA,CArBM;;;eAuBQR,uB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockDirectoryStore } from '../../store';\n\nexport const DownloadableBlockNotice = ( { block } ) => {\n\tconst errorNotice = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockDirectoryStore ).getErrorNoticeForBlock( block.id ),\n\t\t[ block ]\n\t);\n\n\tif ( ! errorNotice ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"block-directory-downloadable-block-notice\">\n\t\t\t<div className=\"block-directory-downloadable-block-notice__content\">\n\t\t\t\t{ errorNotice.message }\n\t\t\t\t{ errorNotice.isFatal\n\t\t\t\t\t? ' ' + __( 'Try reloading the page.' )\n\t\t\t\t\t: null }\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default DownloadableBlockNotice;\n"]}
1
+ {"version":3,"names":["_i18n","require","_data","_store","DownloadableBlockNotice","block","errorNotice","useSelect","select","blockDirectoryStore","getErrorNoticeForBlock","id","_element","createElement","className","message","isFatal","__","exports","_default","default"],"sources":["@wordpress/block-directory/src/components/downloadable-block-notice/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockDirectoryStore } from '../../store';\n\nexport const DownloadableBlockNotice = ( { block } ) => {\n\tconst errorNotice = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockDirectoryStore ).getErrorNoticeForBlock( block.id ),\n\t\t[ block ]\n\t);\n\n\tif ( ! errorNotice ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"block-directory-downloadable-block-notice\">\n\t\t\t<div className=\"block-directory-downloadable-block-notice__content\">\n\t\t\t\t{ errorNotice.message }\n\t\t\t\t{ errorNotice.isFatal\n\t\t\t\t\t? ' ' + __( 'Try reloading the page.' )\n\t\t\t\t\t: null }\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default DownloadableBlockNotice;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGO,MAAMG,uBAAuB,GAAGA,CAAE;EAAEC;AAAM,CAAC,KAAM;EACvD,MAAMC,WAAW,GAAG,IAAAC,eAAS,EAC1BC,MAAM,IACPA,MAAM,CAAEC,YAAoB,CAAC,CAACC,sBAAsB,CAAEL,KAAK,CAACM,EAAG,CAAC,EACjE,CAAEN,KAAK,CACR,CAAC;EAED,IAAK,CAAEC,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAM,QAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAA2C,GACzD,IAAAF,QAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAAoD,GAChER,WAAW,CAACS,OAAO,EACnBT,WAAW,CAACU,OAAO,GAClB,GAAG,GAAG,IAAAC,QAAE,EAAE,yBAA0B,CAAC,GACrC,IACC,CACD,CAAC;AAER,CAAC;AAACC,OAAA,CAAAd,uBAAA,GAAAA,uBAAA;AAAA,IAAAe,QAAA,GAEaf,uBAAuB;AAAAc,OAAA,CAAAE,OAAA,GAAAD,QAAA"}
@@ -1,26 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _element = require("@wordpress/element");
11
-
12
9
  var _i18n = require("@wordpress/i18n");
13
-
14
10
  var _components = require("@wordpress/components");
15
-
16
11
  var _blocks = require("@wordpress/blocks");
17
-
18
12
  var _data = require("@wordpress/data");
19
-
20
13
  var _downloadableBlockListItem = _interopRequireDefault(require("../downloadable-block-list-item"));
21
-
22
14
  var _store = require("../../store");
23
-
24
15
  /**
25
16
  * WordPress dependencies
26
17
  */
@@ -28,8 +19,8 @@ var _store = require("../../store");
28
19
  /**
29
20
  * Internal dependencies
30
21
  */
31
- const noop = () => {};
32
22
 
23
+ const noop = () => {};
33
24
  function DownloadableBlocksList({
34
25
  items,
35
26
  onHover = noop,
@@ -39,12 +30,11 @@ function DownloadableBlocksList({
39
30
  const {
40
31
  installBlockType
41
32
  } = (0, _data.useDispatch)(_store.store);
42
-
43
33
  if (!items.length) {
44
34
  return null;
45
35
  }
46
-
47
- return (0, _element.createElement)(_components.__unstableComposite, { ...composite,
36
+ return (0, _element.createElement)(_components.__unstableComposite, {
37
+ ...composite,
48
38
  role: "listbox",
49
39
  className: "block-directory-downloadable-blocks-list",
50
40
  "aria-label": (0, _i18n.__)('Blocks available for install')
@@ -65,7 +55,6 @@ function DownloadableBlocksList({
65
55
  }
66
56
  });
67
57
  }
68
-
69
58
  onHover(null);
70
59
  },
71
60
  onHover: onHover,
@@ -73,7 +62,6 @@ function DownloadableBlocksList({
73
62
  });
74
63
  }));
75
64
  }
76
-
77
65
  var _default = DownloadableBlocksList;
78
66
  exports.default = _default;
79
67
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-list/index.js"],"names":["noop","DownloadableBlocksList","items","onHover","onSelect","composite","installBlockType","blockDirectoryStore","length","map","item","id","name","then","success"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AASA;AACA;AACA;AAIA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,sBAAT,CAAiC;AAAEC,EAAAA,KAAF;AAASC,EAAAA,OAAO,GAAGH,IAAnB;AAAyBI,EAAAA;AAAzB,CAAjC,EAAuE;AACtE,QAAMC,SAAS,GAAG,8CAAlB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAuB,uBAAaC,YAAb,CAA7B;;AAEA,MAAK,CAAEL,KAAK,CAACM,MAAb,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,+BAAD,OACMH,SADN;AAEC,IAAA,IAAI,EAAC,SAFN;AAGC,IAAA,SAAS,EAAC,0CAHX;AAIC,kBAAa,cAAI,8BAAJ;AAJd,KAMGH,KAAK,CAACO,GAAN,CAAaC,IAAF,IAAY;AACxB,WACC,4BAAC,kCAAD;AACC,MAAA,GAAG,EAAGA,IAAI,CAACC,EADZ;AAEC,MAAA,SAAS,EAAGN,SAFb;AAGC,MAAA,OAAO,EAAG,MAAM;AACf;AACA;AACA;AACA,YAAK,0BAAcK,IAAI,CAACE,IAAnB,CAAL,EAAiC;AAChCR,UAAAA,QAAQ,CAAEM,IAAF,CAAR;AACA,SAFD,MAEO;AACNJ,UAAAA,gBAAgB,CAAEI,IAAF,CAAhB,CAAyBG,IAAzB,CAAiCC,OAAF,IAAe;AAC7C,gBAAKA,OAAL,EAAe;AACdV,cAAAA,QAAQ,CAAEM,IAAF,CAAR;AACA;AACD,WAJD;AAKA;;AACDP,QAAAA,OAAO,CAAE,IAAF,CAAP;AACA,OAjBF;AAkBC,MAAA,OAAO,EAAGA,OAlBX;AAmBC,MAAA,IAAI,EAAGO;AAnBR,MADD;AAuBA,GAxBC,CANH,CADD;AAkCA;;eAEcT,sB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n} from '@wordpress/components';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlockListItem from '../downloadable-block-list-item';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst noop = () => {};\n\nfunction DownloadableBlocksList( { items, onHover = noop, onSelect } ) {\n\tconst composite = useCompositeState();\n\tconst { installBlockType } = useDispatch( blockDirectoryStore );\n\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Composite\n\t\t\t{ ...composite }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-directory-downloadable-blocks-list\"\n\t\t\taria-label={ __( 'Blocks available for install' ) }\n\t\t>\n\t\t\t{ items.map( ( item ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<DownloadableBlockListItem\n\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\tcomposite={ composite }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t// Check if the block is registered (`getBlockType`\n\t\t\t\t\t\t\t// will return an object). If so, insert the block.\n\t\t\t\t\t\t\t// This prevents installing existing plugins.\n\t\t\t\t\t\t\tif ( getBlockType( item.name ) ) {\n\t\t\t\t\t\t\t\tonSelect( item );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tinstallBlockType( item ).then( ( success ) => {\n\t\t\t\t\t\t\t\t\tif ( success ) {\n\t\t\t\t\t\t\t\t\t\tonSelect( item );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonHover( null );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\titem={ item }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Composite>\n\t);\n}\n\nexport default DownloadableBlocksList;\n"]}
1
+ {"version":3,"names":["_i18n","require","_components","_blocks","_data","_downloadableBlockListItem","_interopRequireDefault","_store","noop","DownloadableBlocksList","items","onHover","onSelect","composite","useCompositeState","installBlockType","useDispatch","blockDirectoryStore","length","_element","createElement","__unstableComposite","role","className","__","map","item","default","key","id","onClick","getBlockType","name","then","success","_default","exports"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n} from '@wordpress/components';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlockListItem from '../downloadable-block-list-item';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst noop = () => {};\n\nfunction DownloadableBlocksList( { items, onHover = noop, onSelect } ) {\n\tconst composite = useCompositeState();\n\tconst { installBlockType } = useDispatch( blockDirectoryStore );\n\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Composite\n\t\t\t{ ...composite }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-directory-downloadable-blocks-list\"\n\t\t\taria-label={ __( 'Blocks available for install' ) }\n\t\t>\n\t\t\t{ items.map( ( item ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<DownloadableBlockListItem\n\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\tcomposite={ composite }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t// Check if the block is registered (`getBlockType`\n\t\t\t\t\t\t\t// will return an object). If so, insert the block.\n\t\t\t\t\t\t\t// This prevents installing existing plugins.\n\t\t\t\t\t\t\tif ( getBlockType( item.name ) ) {\n\t\t\t\t\t\t\t\tonSelect( item );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tinstallBlockType( item ).then( ( success ) => {\n\t\t\t\t\t\t\t\t\tif ( success ) {\n\t\t\t\t\t\t\t\t\t\tonSelect( item );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonHover( null );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\titem={ item }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Composite>\n\t);\n}\n\nexport default DownloadableBlocksList;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,0BAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAfA;AACA;AACA;;AASA;AACA;AACA;;AAIA,MAAMO,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,SAASC,sBAAsBA,CAAE;EAAEC,KAAK;EAAEC,OAAO,GAAGH,IAAI;EAAEI;AAAS,CAAC,EAAG;EACtE,MAAMC,SAAS,GAAG,IAAAC,uCAAiB,EAAC,CAAC;EACrC,MAAM;IAAEC;EAAiB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAoB,CAAC;EAE/D,IAAK,CAAEP,KAAK,CAACQ,MAAM,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAC,QAAA,CAAAC,aAAA,EAAClB,WAAA,CAAAmB,mBAAS;IAAA,GACJR,SAAS;IACdS,IAAI,EAAC,SAAS;IACdC,SAAS,EAAC,0CAA0C;IACpD,cAAa,IAAAC,QAAE,EAAE,8BAA+B;EAAG,GAEjDd,KAAK,CAACe,GAAG,CAAIC,IAAI,IAAM;IACxB,OACC,IAAAP,QAAA,CAAAC,aAAA,EAACf,0BAAA,CAAAsB,OAAyB;MACzBC,GAAG,EAAGF,IAAI,CAACG,EAAI;MACfhB,SAAS,EAAGA,SAAW;MACvBiB,OAAO,EAAGA,CAAA,KAAM;QACf;QACA;QACA;QACA,IAAK,IAAAC,oBAAY,EAAEL,IAAI,CAACM,IAAK,CAAC,EAAG;UAChCpB,QAAQ,CAAEc,IAAK,CAAC;QACjB,CAAC,MAAM;UACNX,gBAAgB,CAAEW,IAAK,CAAC,CAACO,IAAI,CAAIC,OAAO,IAAM;YAC7C,IAAKA,OAAO,EAAG;cACdtB,QAAQ,CAAEc,IAAK,CAAC;YACjB;UACD,CAAE,CAAC;QACJ;QACAf,OAAO,CAAE,IAAK,CAAC;MAChB,CAAG;MACHA,OAAO,EAAGA,OAAS;MACnBe,IAAI,EAAGA;IAAM,CACb,CAAC;EAEJ,CAAE,CACQ,CAAC;AAEd;AAAC,IAAAS,QAAA,GAEc1B,sBAAsB;AAAA2B,OAAA,CAAAT,OAAA,GAAAQ,QAAA"}
@@ -1,34 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _element = require("@wordpress/element");
11
-
12
9
  var _i18n = require("@wordpress/i18n");
13
-
14
10
  var _components = require("@wordpress/components");
15
-
16
11
  var _compose = require("@wordpress/compose");
17
-
18
12
  var _blockEditor = require("@wordpress/block-editor");
19
-
20
13
  var _coreData = require("@wordpress/core-data");
21
-
22
14
  var _data = require("@wordpress/data");
23
-
24
15
  var _downloadableBlocksList = _interopRequireDefault(require("../downloadable-blocks-list"));
25
-
26
16
  var _inserterPanel = _interopRequireDefault(require("./inserter-panel"));
27
-
28
17
  var _noResults = _interopRequireDefault(require("./no-results"));
29
-
30
18
  var _store = require("../../store");
31
-
32
19
  /**
33
20
  * WordPress dependencies
34
21
  */
@@ -36,8 +23,8 @@ var _store = require("../../store");
36
23
  /**
37
24
  * Internal dependencies
38
25
  */
39
- const EMPTY_ARRAY = [];
40
26
 
27
+ const EMPTY_ARRAY = [];
41
28
  function DownloadableBlocksPanel({
42
29
  downloadableItems,
43
30
  onSelect,
@@ -56,15 +43,12 @@ function DownloadableBlocksPanel({
56
43
  className: "block-directory-downloadable-blocks-panel has-blocks-loading"
57
44
  }, (0, _element.createElement)(_components.Spinner, null)));
58
45
  }
59
-
60
46
  if (false === hasPermission) {
61
47
  if (!hasLocalBlocks) {
62
48
  return (0, _element.createElement)(_noResults.default, null);
63
49
  }
64
-
65
50
  return null;
66
51
  }
67
-
68
52
  return !!downloadableItems.length ? (0, _element.createElement)(_inserterPanel.default, {
69
53
  downloadableItems: downloadableItems,
70
54
  hasLocalBlocks: hasLocalBlocks
@@ -74,7 +58,6 @@ function DownloadableBlocksPanel({
74
58
  onHover: onHover
75
59
  })) : !hasLocalBlocks && (0, _element.createElement)(_noResults.default, null);
76
60
  }
77
-
78
61
  var _default = (0, _compose.compose)([(0, _data.withSelect)((select, {
79
62
  filterValue,
80
63
  rootClientId = null
@@ -87,24 +70,18 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)((select, {
87
70
  canInsertBlockType
88
71
  } = select(_blockEditor.store);
89
72
  const hasPermission = select(_coreData.store).canUser('read', 'block-directory/search');
90
-
91
73
  function getInstallableBlocks(term) {
92
74
  const downloadableBlocks = getDownloadableBlocks(term);
93
75
  const installableBlocks = downloadableBlocks.filter(block => canInsertBlockType(block, rootClientId, true));
94
-
95
76
  if (downloadableBlocks.length === installableBlocks.length) {
96
77
  return downloadableBlocks;
97
78
  }
98
-
99
79
  return installableBlocks;
100
80
  }
101
-
102
81
  let downloadableItems = hasPermission ? getInstallableBlocks(filterValue) : [];
103
-
104
82
  if (downloadableItems.length === 0) {
105
83
  downloadableItems = EMPTY_ARRAY;
106
84
  }
107
-
108
85
  const isLoading = isRequestingDownloadableBlocks(filterValue);
109
86
  return {
110
87
  downloadableItems,
@@ -112,6 +89,5 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)((select, {
112
89
  isLoading
113
90
  };
114
91
  })])(DownloadableBlocksPanel);
115
-
116
92
  exports.default = _default;
117
93
  //# sourceMappingURL=index.js.map