@wordpress/block-directory 4.35.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/block-ratings/index.js +7 -6
  3. package/build/components/block-ratings/index.js.map +1 -1
  4. package/build/components/block-ratings/stars.js +23 -25
  5. package/build/components/block-ratings/stars.js.map +1 -1
  6. package/build/components/compact-list/index.js +26 -22
  7. package/build/components/compact-list/index.js.map +1 -1
  8. package/build/components/downloadable-block-icon/index.js +3 -3
  9. package/build/components/downloadable-block-icon/index.js.map +1 -1
  10. package/build/components/downloadable-block-list-item/index.js +37 -27
  11. package/build/components/downloadable-block-list-item/index.js.map +1 -1
  12. package/build/components/downloadable-block-notice/index.js +8 -6
  13. package/build/components/downloadable-block-notice/index.js.map +1 -1
  14. package/build/components/downloadable-blocks-list/index.js +26 -26
  15. package/build/components/downloadable-blocks-list/index.js.map +1 -1
  16. package/build/components/downloadable-blocks-panel/index.js +24 -17
  17. package/build/components/downloadable-blocks-panel/index.js.map +1 -1
  18. package/build/components/downloadable-blocks-panel/inserter-panel.js +21 -14
  19. package/build/components/downloadable-blocks-panel/inserter-panel.js.map +1 -1
  20. package/build/components/downloadable-blocks-panel/no-results.js +20 -11
  21. package/build/components/downloadable-blocks-panel/no-results.js.map +1 -1
  22. package/build/plugins/get-install-missing/index.js +18 -15
  23. package/build/plugins/get-install-missing/index.js.map +1 -1
  24. package/build/plugins/get-install-missing/install-button.js +6 -5
  25. package/build/plugins/get-install-missing/install-button.js.map +1 -1
  26. package/build/plugins/index.js +4 -2
  27. package/build/plugins/index.js.map +1 -1
  28. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js +21 -19
  29. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +1 -1
  30. package/build/plugins/installed-blocks-pre-publish-panel/index.js +10 -8
  31. package/build/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
  32. package/build-module/components/block-ratings/index.js +7 -6
  33. package/build-module/components/block-ratings/index.js.map +1 -1
  34. package/build-module/components/block-ratings/stars.js +24 -25
  35. package/build-module/components/block-ratings/stars.js.map +1 -1
  36. package/build-module/components/compact-list/index.js +27 -22
  37. package/build-module/components/compact-list/index.js.map +1 -1
  38. package/build-module/components/downloadable-block-icon/index.js +3 -3
  39. package/build-module/components/downloadable-block-icon/index.js.map +1 -1
  40. package/build-module/components/downloadable-block-list-item/index.js +39 -27
  41. package/build-module/components/downloadable-block-list-item/index.js.map +1 -1
  42. package/build-module/components/downloadable-block-notice/index.js +9 -6
  43. package/build-module/components/downloadable-block-notice/index.js.map +1 -1
  44. package/build-module/components/downloadable-blocks-list/index.js +26 -26
  45. package/build-module/components/downloadable-blocks-list/index.js.map +1 -1
  46. package/build-module/components/downloadable-blocks-panel/index.js +26 -17
  47. package/build-module/components/downloadable-blocks-panel/index.js.map +1 -1
  48. package/build-module/components/downloadable-blocks-panel/inserter-panel.js +23 -14
  49. package/build-module/components/downloadable-blocks-panel/inserter-panel.js.map +1 -1
  50. package/build-module/components/downloadable-blocks-panel/no-results.js +22 -11
  51. package/build-module/components/downloadable-blocks-panel/no-results.js.map +1 -1
  52. package/build-module/plugins/get-install-missing/index.js +19 -15
  53. package/build-module/plugins/get-install-missing/index.js.map +1 -1
  54. package/build-module/plugins/get-install-missing/install-button.js +6 -5
  55. package/build-module/plugins/get-install-missing/install-button.js.map +1 -1
  56. package/build-module/plugins/index.js +6 -2
  57. package/build-module/plugins/index.js.map +1 -1
  58. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js +21 -19
  59. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +1 -1
  60. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js +11 -8
  61. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
  62. package/package.json +23 -22
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 5.0.0 (2024-05-31)
6
+
7
+ ### Breaking Changes
8
+
9
+ - Increase the minimum required Node.js version to v18.12.0 matching long-term support releases ([#31270](https://github.com/WordPress/gutenberg/pull/61930)). Learn more about [Node.js releases](https://nodejs.org/en/about/previous-releases).
10
+
5
11
  ## 4.35.0 (2024-05-16)
6
12
 
7
13
  ## 4.34.0 (2024-05-02)
@@ -5,19 +5,20 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = exports.BlockRatings = void 0;
8
- var _react = require("react");
9
8
  var _stars = _interopRequireDefault(require("./stars"));
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
10
  /**
11
11
  * Internal dependencies
12
12
  */
13
13
 
14
14
  const BlockRatings = ({
15
15
  rating
16
- }) => (0, _react.createElement)("span", {
17
- className: "block-directory-block-ratings"
18
- }, (0, _react.createElement)(_stars.default, {
19
- rating: rating
20
- }));
16
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
17
+ className: "block-directory-block-ratings",
18
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_stars.default, {
19
+ rating: rating
20
+ })
21
+ });
21
22
  exports.BlockRatings = BlockRatings;
22
23
  var _default = exports.default = BlockRatings;
23
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_stars","_interopRequireDefault","require","BlockRatings","rating","_react","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,MAAA,CAAAC,aAAA;EAAMC,SAAS,EAAC;AAA+B,GAC9C,IAAAF,MAAA,CAAAC,aAAA,EAACN,MAAA,CAAAQ,OAAK;EAACJ,MAAM,EAAGA;AAAQ,CAAE,CACrB,CACN;AAACK,OAAA,CAAAN,YAAA,GAAAA,YAAA;AAAA,IAAAO,QAAA,GAAAD,OAAA,CAAAD,OAAA,GAEaL,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["_stars","_interopRequireDefault","require","_jsxRuntime","BlockRatings","rating","jsx","className","children","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;AAA4B,IAAAC,WAAA,GAAAD,OAAA;AAH5B;AACA;AACA;;AAGO,MAAME,YAAY,GAAGA,CAAE;EAAEC;AAAO,CAAC,kBACvC,IAAAF,WAAA,CAAAG,GAAA;EAAMC,SAAS,EAAC,+BAA+B;EAAAC,QAAA,eAC9C,IAAAL,WAAA,CAAAG,GAAA,EAACN,MAAA,CAAAS,OAAK;IAACJ,MAAM,EAAGA;EAAQ,CAAE;AAAC,CACtB,CACN;AAACK,OAAA,CAAAN,YAAA,GAAAA,YAAA;AAAA,IAAAO,QAAA,GAAAD,OAAA,CAAAD,OAAA,GAEaL,YAAY","ignoreList":[]}
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = require("react");
8
7
  var _i18n = require("@wordpress/i18n");
9
8
  var _icons = require("@wordpress/icons");
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
10
  /**
11
11
  * WordPress dependencies
12
12
  */
@@ -18,31 +18,29 @@ function Stars({
18
18
  const fullStarCount = Math.floor(rating);
19
19
  const halfStarCount = Math.ceil(rating - fullStarCount);
20
20
  const emptyStarCount = 5 - (fullStarCount + halfStarCount);
21
- return (0, _react.createElement)("span", {
21
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
22
22
  "aria-label": (0, _i18n.sprintf)( /* translators: %s: number of stars. */
23
- (0, _i18n.__)('%s out of 5 stars'), stars)
24
- }, Array.from({
25
- length: fullStarCount
26
- }).map((_, i) => (0, _react.createElement)(_icons.Icon, {
27
- key: `full_stars_${i}`,
28
- className: "block-directory-block-ratings__star-full",
29
- icon: _icons.starFilled,
30
- size: 16
31
- })), Array.from({
32
- length: halfStarCount
33
- }).map((_, i) => (0, _react.createElement)(_icons.Icon, {
34
- key: `half_stars_${i}`,
35
- className: "block-directory-block-ratings__star-half-full",
36
- icon: _icons.starHalf,
37
- size: 16
38
- })), Array.from({
39
- length: emptyStarCount
40
- }).map((_, i) => (0, _react.createElement)(_icons.Icon, {
41
- key: `empty_stars_${i}`,
42
- className: "block-directory-block-ratings__star-empty",
43
- icon: _icons.starEmpty,
44
- size: 16
45
- })));
23
+ (0, _i18n.__)('%s out of 5 stars'), stars),
24
+ children: [Array.from({
25
+ length: fullStarCount
26
+ }).map((_, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
27
+ className: "block-directory-block-ratings__star-full",
28
+ icon: _icons.starFilled,
29
+ size: 16
30
+ }, `full_stars_${i}`)), Array.from({
31
+ length: halfStarCount
32
+ }).map((_, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
33
+ className: "block-directory-block-ratings__star-half-full",
34
+ icon: _icons.starHalf,
35
+ size: 16
36
+ }, `half_stars_${i}`)), Array.from({
37
+ length: emptyStarCount
38
+ }).map((_, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
39
+ className: "block-directory-block-ratings__star-empty",
40
+ icon: _icons.starEmpty,
41
+ size: 16
42
+ }, `empty_stars_${i}`))]
43
+ });
46
44
  }
47
45
  var _default = exports.default = Stars;
48
46
  //# sourceMappingURL=stars.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_icons","Stars","rating","stars","Math","round","fullStarCount","floor","halfStarCount","ceil","emptyStarCount","_react","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\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G;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,MAAA,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,GAAAC,OAAA,CAAAC,OAAA,GAEc9B,KAAK","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_icons","_jsxRuntime","Stars","rating","stars","Math","round","fullStarCount","floor","halfStarCount","ceil","emptyStarCount","jsxs","sprintf","__","children","Array","from","length","map","_","i","jsx","Icon","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;AAAyE,IAAAE,WAAA,GAAAF,OAAA;AAJzE;AACA;AACA;;AAIA,SAASG,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,oBACC,IAAAR,WAAA,CAAAW,IAAA;IACC,cAAa,IAAAC,aAAO,GACnB;IACA,IAAAC,QAAE,EAAE,mBAAoB,CAAC,EACzBV,KACD,CAAG;IAAAW,QAAA,GAEDC,KAAK,CAACC,IAAI,CAAE;MAAEC,MAAM,EAAEX;IAAc,CAAE,CAAC,CAACY,GAAG,CAAE,CAAEC,CAAC,EAAEC,CAAC,kBACpD,IAAApB,WAAA,CAAAqB,GAAA,EAACtB,MAAA,CAAAuB,IAAI;MAEJC,SAAS,EAAC,0CAA0C;MACpDC,IAAI,EAAGC,iBAAY;MACnBC,IAAI,EAAG;IAAI,GAHJ,cAAcN,CAAG,EAIxB,CACA,CAAC,EACDL,KAAK,CAACC,IAAI,CAAE;MAAEC,MAAM,EAAET;IAAc,CAAE,CAAC,CAACU,GAAG,CAAE,CAAEC,CAAC,EAAEC,CAAC,kBACpD,IAAApB,WAAA,CAAAqB,GAAA,EAACtB,MAAA,CAAAuB,IAAI;MAEJC,SAAS,EAAC,+CAA+C;MACzDC,IAAI,EAAGG,eAAU;MACjBD,IAAI,EAAG;IAAI,GAHJ,cAAcN,CAAG,EAIxB,CACA,CAAC,EACDL,KAAK,CAACC,IAAI,CAAE;MAAEC,MAAM,EAAEP;IAAe,CAAE,CAAC,CAACQ,GAAG,CAAE,CAAEC,CAAC,EAAEC,CAAC,kBACrD,IAAApB,WAAA,CAAAqB,GAAA,EAACtB,MAAA,CAAAuB,IAAI;MAEJC,SAAS,EAAC,2CAA2C;MACrDC,IAAI,EAAGI,gBAAW;MAClBF,IAAI,EAAG;IAAI,GAHJ,eAAeN,CAAG,EAIzB,CACA,CAAC;EAAA,CACE,CAAC;AAET;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc9B,KAAK","ignoreList":[]}
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = CompactList;
8
- var _react = require("react");
9
8
  var _i18n = require("@wordpress/i18n");
10
9
  var _downloadableBlockIcon = _interopRequireDefault(require("../downloadable-block-icon"));
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
11
  /**
12
12
  * WordPress dependencies
13
13
  */
@@ -22,26 +22,30 @@ function CompactList({
22
22
  if (!items.length) {
23
23
  return null;
24
24
  }
25
- return (0, _react.createElement)("ul", {
26
- className: "block-directory-compact-list"
27
- }, items.map(({
28
- icon,
29
- id,
30
- title,
31
- author
32
- }) => (0, _react.createElement)("li", {
33
- key: id,
34
- className: "block-directory-compact-list__item"
35
- }, (0, _react.createElement)(_downloadableBlockIcon.default, {
36
- icon: icon,
37
- title: title
38
- }), (0, _react.createElement)("div", {
39
- className: "block-directory-compact-list__item-details"
40
- }, (0, _react.createElement)("div", {
41
- className: "block-directory-compact-list__item-title"
42
- }, title), (0, _react.createElement)("div", {
43
- className: "block-directory-compact-list__item-author"
44
- }, (0, _i18n.sprintf)( /* translators: %s: Name of the block author. */
45
- (0, _i18n.__)('By %s'), author))))));
25
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
26
+ className: "block-directory-compact-list",
27
+ children: items.map(({
28
+ icon,
29
+ id,
30
+ title,
31
+ author
32
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
33
+ className: "block-directory-compact-list__item",
34
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_downloadableBlockIcon.default, {
35
+ icon: icon,
36
+ title: title
37
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
38
+ className: "block-directory-compact-list__item-details",
39
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
40
+ className: "block-directory-compact-list__item-title",
41
+ children: title
42
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
43
+ className: "block-directory-compact-list__item-author",
44
+ children: (0, _i18n.sprintf)( /* translators: %s: Name of the block author. */
45
+ (0, _i18n.__)('By %s'), author)
46
+ })]
47
+ })]
48
+ }, id))
49
+ });
46
50
  }
47
51
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_downloadableBlockIcon","_interopRequireDefault","CompactList","items","length","_react","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,MAAA,CAAAC,aAAA;IAAIC,SAAS,EAAC;EAA8B,GACzCJ,KAAK,CAACK,GAAG,CAAE,CAAE;IAAEC,IAAI;IAAEC,EAAE;IAAEC,KAAK;IAAEC;EAAO,CAAC,KACzC,IAAAP,MAAA,CAAAC,aAAA;IAAIO,GAAG,EAAGH,EAAI;IAACH,SAAS,EAAC;EAAoC,GAC5D,IAAAF,MAAA,CAAAC,aAAA,EAACN,sBAAA,CAAAc,OAAqB;IAACL,IAAI,EAAGA,IAAM;IAACE,KAAK,EAAGA;EAAO,CAAE,CAAC,EAEvD,IAAAN,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAA4C,GAC1D,IAAAF,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAA0C,GACtDI,KACE,CAAC,EACN,IAAAN,MAAA,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","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_downloadableBlockIcon","_interopRequireDefault","_jsxRuntime","CompactList","items","length","jsx","className","children","map","icon","id","title","author","jsxs","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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
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = require("react");
8
7
  var _blockEditor = require("@wordpress/block-editor");
8
+ var _jsxRuntime = require("react/jsx-runtime");
9
9
  /**
10
10
  * WordPress dependencies
11
11
  */
@@ -14,11 +14,11 @@ function DownloadableBlockIcon({
14
14
  icon
15
15
  }) {
16
16
  const className = 'block-directory-downloadable-block-icon';
17
- return icon.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/) !== null ? (0, _react.createElement)("img", {
17
+ return icon.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/) !== null ? /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
18
18
  className: className,
19
19
  src: icon,
20
20
  alt: ""
21
- }) : (0, _react.createElement)(_blockEditor.BlockIcon, {
21
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockIcon, {
22
22
  className: className,
23
23
  icon: icon,
24
24
  showColors: true
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","DownloadableBlockIcon","icon","className","match","_react","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,MAAA,CAAAC,aAAA;IAAKH,SAAS,EAAGA,SAAW;IAACI,GAAG,EAAGL,IAAM;IAACM,GAAG,EAAC;EAAE,CAAE,CAAC,GAEnD,IAAAH,MAAA,CAAAC,aAAA,EAACP,YAAA,CAAAU,SAAS;IAACN,SAAS,EAAGA,SAAW;IAACD,IAAI,EAAGA,IAAM;IAACQ,UAAU;EAAA,CAAE,CAC7D;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcZ,qBAAqB","ignoreList":[]}
1
+ {"version":3,"names":["_blockEditor","require","_jsxRuntime","DownloadableBlockIcon","icon","className","match","jsx","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;AAAoD,IAAAC,WAAA,GAAAD,OAAA;AAHpD;AACA;AACA;;AAGA,SAASE,qBAAqBA,CAAE;EAAEC;AAAK,CAAC,EAAG;EAC1C,MAAMC,SAAS,GAAG,yCAAyC;EAC3D,OAAOD,IAAI,CAACE,KAAK,CAAE,oCAAqC,CAAC,KAAK,IAAI,gBACjE,IAAAJ,WAAA,CAAAK,GAAA;IAAKF,SAAS,EAAGA,SAAW;IAACG,GAAG,EAAGJ,IAAM;IAACK,GAAG,EAAC;EAAE,CAAE,CAAC,gBAEnD,IAAAP,WAAA,CAAAK,GAAA,EAACP,YAAA,CAAAU,SAAS;IAACL,SAAS,EAAGA,SAAW;IAACD,IAAI,EAAGA,IAAM;IAACO,UAAU;EAAA,CAAE,CAC7D;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcX,qBAAqB","ignoreList":[]}
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _react = require("react");
9
8
  var _i18n = require("@wordpress/i18n");
10
9
  var _components = require("@wordpress/components");
11
10
  var _element = require("@wordpress/element");
@@ -17,6 +16,7 @@ var _downloadableBlockIcon = _interopRequireDefault(require("../downloadable-blo
17
16
  var _downloadableBlockNotice = _interopRequireDefault(require("../downloadable-block-notice"));
18
17
  var _store = require("../../store");
19
18
  var _lockUnlock = require("../../lock-unlock");
19
+ var _jsxRuntime = require("react/jsx-runtime");
20
20
  /**
21
21
  * WordPress dependencies
22
22
  */
@@ -98,8 +98,8 @@ function DownloadableBlockListItem({
98
98
  } else if (isInstalling) {
99
99
  statusText = (0, _i18n.__)('Installing…');
100
100
  }
101
- return (0, _react.createElement)(CompositeItem, {
102
- render: (0, _react.createElement)(_components.Button, {
101
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(CompositeItem, {
102
+ render: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
103
103
  __experimentalIsFocusable: true,
104
104
  type: "button",
105
105
  role: "option",
@@ -118,30 +118,40 @@ function DownloadableBlockListItem({
118
118
  tooltipPosition: "top center"
119
119
  }),
120
120
  store: composite,
121
- disabled: isInstalling || !isInstallable
122
- }, (0, _react.createElement)("div", {
123
- className: "block-directory-downloadable-block-list-item__icon"
124
- }, (0, _react.createElement)(_downloadableBlockIcon.default, {
125
- icon: icon,
126
- title: title
127
- }), isInstalling ? (0, _react.createElement)("span", {
128
- className: "block-directory-downloadable-block-list-item__spinner"
129
- }, (0, _react.createElement)(_components.Spinner, null)) : (0, _react.createElement)(_blockRatings.default, {
130
- rating: rating
131
- })), (0, _react.createElement)("span", {
132
- className: "block-directory-downloadable-block-list-item__details"
133
- }, (0, _react.createElement)("span", {
134
- className: "block-directory-downloadable-block-list-item__title"
135
- }, (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: %1$s: block title, %2$s: author name. */
136
- (0, _i18n.__)('%1$s <span>by %2$s</span>'), (0, _htmlEntities.decodeEntities)(title), author), {
137
- span: (0, _react.createElement)("span", {
138
- className: "block-directory-downloadable-block-list-item__author"
139
- })
140
- })), hasNotice ? (0, _react.createElement)(_downloadableBlockNotice.default, {
141
- block: item
142
- }) : (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("span", {
143
- className: "block-directory-downloadable-block-list-item__desc"
144
- }, !!statusText ? statusText : (0, _htmlEntities.decodeEntities)(description)), isInstallable && !(isInstalled || isInstalling) && (0, _react.createElement)(_components.VisuallyHidden, null, (0, _i18n.__)('Install block')))));
121
+ disabled: isInstalling || !isInstallable,
122
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
123
+ className: "block-directory-downloadable-block-list-item__icon",
124
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_downloadableBlockIcon.default, {
125
+ icon: icon,
126
+ title: title
127
+ }), isInstalling ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
128
+ className: "block-directory-downloadable-block-list-item__spinner",
129
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {})
130
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockRatings.default, {
131
+ rating: rating
132
+ })]
133
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
134
+ className: "block-directory-downloadable-block-list-item__details",
135
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
136
+ className: "block-directory-downloadable-block-list-item__title",
137
+ children: (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: %1$s: block title, %2$s: author name. */
138
+ (0, _i18n.__)('%1$s <span>by %2$s</span>'), (0, _htmlEntities.decodeEntities)(title), author), {
139
+ span: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
140
+ className: "block-directory-downloadable-block-list-item__author"
141
+ })
142
+ })
143
+ }), hasNotice ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_downloadableBlockNotice.default, {
144
+ block: item
145
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
146
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
147
+ className: "block-directory-downloadable-block-list-item__desc",
148
+ children: !!statusText ? statusText : (0, _htmlEntities.decodeEntities)(description)
149
+ }), isInstallable && !(isInstalled || isInstalling) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.VisuallyHidden, {
150
+ children: (0, _i18n.__)('Install block')
151
+ })]
152
+ })]
153
+ })]
154
+ });
145
155
  }
146
156
  var _default = exports.default = DownloadableBlockListItem;
147
157
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_element","_htmlEntities","_blocks","_data","_blockRatings","_interopRequireDefault","_downloadableBlockIcon","_downloadableBlockNotice","_store","_lockUnlock","CompositeItemV2","CompositeItem","unlock","componentsPrivateApis","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","__","_react","createElement","render","Button","__experimentalIsFocusable","type","role","className","isBusy","event","preventDefault","label","showTooltip","tooltipPosition","store","disabled","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\tprivateApis as componentsPrivateApis,\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';\nimport { unlock } from '../../lock-unlock';\n\nconst { CompositeItemV2: CompositeItem } = unlock( componentsPrivateApis );\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\trender={\n\t\t\t\t<Button\n\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\trole=\"option\"\n\t\t\t\t\tclassName=\"block-directory-downloadable-block-list-item\"\n\t\t\t\t\tisBusy={ isInstalling }\n\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tonClick();\n\t\t\t\t\t} }\n\t\t\t\t\tlabel={ getDownloadableBlockLabel( item, {\n\t\t\t\t\t\thasNotice,\n\t\t\t\t\t\tisInstalled,\n\t\t\t\t\t\tisInstalling,\n\t\t\t\t\t} ) }\n\t\t\t\t\tshowTooltip\n\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t/>\n\t\t\t}\n\t\t\tstore={ composite }\n\t\t\tdisabled={ isInstalling || ! isInstallable }\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"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,I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AA,EAAC1C,wBAAA,CAAAyD,OAAuB;IAACI,KAAK,EAAGvC;EAAM,CAAE,CAAC,GAE1C,IAAAmB,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAqB,QAAA,QACC,IAAArB,MAAA,CAAAC,aAAA;IAAMM,SAAS,EAAC;EAAoD,GACjE,CAAC,CAAET,UAAU,GACZA,UAAU,GACV,IAAArB,4BAAc,EAAEO,WAAY,CAC1B,CAAC,EACLI,aAAa,IACd,EAAIjB,WAAW,IAAIC,YAAY,CAAE,IAChC,IAAA4B,MAAA,CAAAC,aAAA,EAAClD,WAAA,CAAAuE,cAAc,QACZ,IAAAvB,QAAE,EAAE,eAAgB,CACP,CAEjB,CAEE,CACQ,CAAC;AAElB;AAAC,IAAAwB,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAEcrC,yBAAyB","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_components","_element","_htmlEntities","_blocks","_data","_blockRatings","_interopRequireDefault","_downloadableBlockIcon","_downloadableBlockNotice","_store","_lockUnlock","_jsxRuntime","CompositeItemV2","CompositeItem","unlock","componentsPrivateApis","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","__","jsxs","render","jsx","Button","__experimentalIsFocusable","type","role","className","isBusy","event","preventDefault","label","showTooltip","tooltipPosition","store","disabled","children","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\tprivateApis as componentsPrivateApis,\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';\nimport { unlock } from '../../lock-unlock';\n\nconst { CompositeItemV2: CompositeItem } = unlock( componentsPrivateApis );\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\trender={\n\t\t\t\t<Button\n\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\trole=\"option\"\n\t\t\t\t\tclassName=\"block-directory-downloadable-block-list-item\"\n\t\t\t\t\tisBusy={ isInstalling }\n\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tonClick();\n\t\t\t\t\t} }\n\t\t\t\t\tlabel={ getDownloadableBlockLabel( item, {\n\t\t\t\t\t\thasNotice,\n\t\t\t\t\t\tisInstalled,\n\t\t\t\t\t\tisInstalling,\n\t\t\t\t\t} ) }\n\t\t\t\t\tshowTooltip\n\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t/>\n\t\t\t}\n\t\t\tstore={ composite }\n\t\t\tdisabled={ isInstalling || ! isInstallable }\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"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAA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CAAAyC,GAAA;YAAMK,SAAS,EAAC;UAAsD,CAAE;QAE1E,CACD;MAAC,CACI,CAAC,EACLrC,SAAS,gBACV,IAAAT,WAAA,CAAAyC,GAAA,EAAC5C,wBAAA,CAAA2D,OAAuB;QAACI,KAAK,EAAGxC;MAAM,CAAE,CAAC,gBAE1C,IAAApB,WAAA,CAAAuC,IAAA,EAAAvC,WAAA,CAAA6D,QAAA;QAAAN,QAAA,gBACC,IAAAvD,WAAA,CAAAyC,GAAA;UAAMK,SAAS,EAAC,oDAAoD;UAAAS,QAAA,EACjE,CAAC,CAAElB,UAAU,GACZA,UAAU,GACV,IAAArB,4BAAc,EAAEO,WAAY;QAAC,CAC3B,CAAC,EACLI,aAAa,IACd,EAAIjB,WAAW,IAAIC,YAAY,CAAE,iBAChC,IAAAX,WAAA,CAAAyC,GAAA,EAACpD,WAAA,CAAAyE,cAAc;UAAAP,QAAA,EACZ,IAAAjB,QAAE,EAAE,eAAgB;QAAC,CACR,CAChB;MAAA,CACD,CACF;IAAA,CACI,CAAC;EAAA,CACO,CAAC;AAElB;AAAC,IAAAyB,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAEctC,yBAAyB","ignoreList":[]}
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports.DownloadableBlockNotice = void 0;
7
- var _react = require("react");
8
7
  var _i18n = require("@wordpress/i18n");
9
8
  var _data = require("@wordpress/data");
10
9
  var _store = require("../../store");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
11
  /**
12
12
  * WordPress dependencies
13
13
  */
@@ -23,11 +23,13 @@ const DownloadableBlockNotice = ({
23
23
  if (!errorNotice) {
24
24
  return null;
25
25
  }
26
- return (0, _react.createElement)("div", {
27
- className: "block-directory-downloadable-block-notice"
28
- }, (0, _react.createElement)("div", {
29
- className: "block-directory-downloadable-block-notice__content"
30
- }, errorNotice.message, errorNotice.isFatal ? ' ' + (0, _i18n.__)('Try reloading the page.') : null));
26
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
27
+ className: "block-directory-downloadable-block-notice",
28
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
29
+ className: "block-directory-downloadable-block-notice__content",
30
+ children: [errorNotice.message, errorNotice.isFatal ? ' ' + (0, _i18n.__)('Try reloading the page.') : null]
31
+ })
32
+ });
31
33
  };
32
34
  exports.DownloadableBlockNotice = DownloadableBlockNotice;
33
35
  var _default = exports.default = DownloadableBlockNotice;
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_data","_store","DownloadableBlockNotice","block","errorNotice","useSelect","select","blockDirectoryStore","getErrorNoticeForBlock","id","_react","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,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAA2C,GACzD,IAAAF,MAAA,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,GAAAD,OAAA,CAAAE,OAAA,GAEahB,uBAAuB","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_data","_store","_jsxRuntime","DownloadableBlockNotice","block","errorNotice","useSelect","select","blockDirectoryStore","getErrorNoticeForBlock","id","jsx","className","children","jsxs","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;AAA2D,IAAAG,WAAA,GAAAH,OAAA;AAT3D;AACA;AACA;;AAIA;AACA;AACA;;AAGO,MAAMI,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,oBACC,IAAAH,WAAA,CAAAS,GAAA;IAAKC,SAAS,EAAC,2CAA2C;IAAAC,QAAA,eACzD,IAAAX,WAAA,CAAAY,IAAA;MAAKF,SAAS,EAAC,oDAAoD;MAAAC,QAAA,GAChER,WAAW,CAACU,OAAO,EACnBV,WAAW,CAACW,OAAO,GAClB,GAAG,GAAG,IAAAC,QAAE,EAAE,yBAA0B,CAAC,GACrC,IAAI;IAAA,CACH;EAAC,CACF,CAAC;AAER,CAAC;AAACC,OAAA,CAAAf,uBAAA,GAAAA,uBAAA;AAAA,IAAAgB,QAAA,GAAAD,OAAA,CAAAE,OAAA,GAEajB,uBAAuB","ignoreList":[]}
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _react = require("react");
9
8
  var _i18n = require("@wordpress/i18n");
10
9
  var _components = require("@wordpress/components");
11
10
  var _blocks = require("@wordpress/blocks");
@@ -13,6 +12,7 @@ var _data = require("@wordpress/data");
13
12
  var _downloadableBlockListItem = _interopRequireDefault(require("../downloadable-block-list-item"));
14
13
  var _store = require("../../store");
15
14
  var _lockUnlock = require("../../lock-unlock");
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
16
  /**
17
17
  * WordPress dependencies
18
18
  */
@@ -38,34 +38,34 @@ function DownloadableBlocksList({
38
38
  if (!items.length) {
39
39
  return null;
40
40
  }
41
- return (0, _react.createElement)(Composite, {
41
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Composite, {
42
42
  store: composite,
43
43
  role: "listbox",
44
44
  className: "block-directory-downloadable-blocks-list",
45
- "aria-label": (0, _i18n.__)('Blocks available for install')
46
- }, items.map(item => {
47
- return (0, _react.createElement)(_downloadableBlockListItem.default, {
48
- key: item.id,
49
- composite: composite,
50
- onClick: () => {
51
- // Check if the block is registered (`getBlockType`
52
- // will return an object). If so, insert the block.
53
- // This prevents installing existing plugins.
54
- if ((0, _blocks.getBlockType)(item.name)) {
55
- onSelect(item);
56
- } else {
57
- installBlockType(item).then(success => {
58
- if (success) {
59
- onSelect(item);
60
- }
61
- });
62
- }
63
- onHover(null);
64
- },
65
- onHover: onHover,
66
- item: item
67
- });
68
- }));
45
+ "aria-label": (0, _i18n.__)('Blocks available for install'),
46
+ children: items.map(item => {
47
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_downloadableBlockListItem.default, {
48
+ composite: composite,
49
+ onClick: () => {
50
+ // Check if the block is registered (`getBlockType`
51
+ // will return an object). If so, insert the block.
52
+ // This prevents installing existing plugins.
53
+ if ((0, _blocks.getBlockType)(item.name)) {
54
+ onSelect(item);
55
+ } else {
56
+ installBlockType(item).then(success => {
57
+ if (success) {
58
+ onSelect(item);
59
+ }
60
+ });
61
+ }
62
+ onHover(null);
63
+ },
64
+ onHover: onHover,
65
+ item: item
66
+ }, item.id);
67
+ })
68
+ });
69
69
  }
70
70
  var _default = exports.default = DownloadableBlocksList;
71
71
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_blocks","_data","_downloadableBlockListItem","_interopRequireDefault","_store","_lockUnlock","CompositeV2","Composite","useCompositeStoreV2","useCompositeStore","unlock","componentsPrivateApis","noop","DownloadableBlocksList","items","onHover","onSelect","composite","installBlockType","useDispatch","blockDirectoryStore","length","_react","createElement","store","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 { privateApis as componentsPrivateApis } 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';\nimport { unlock } from '../../lock-unlock';\n\nconst { CompositeV2: Composite, useCompositeStoreV2: useCompositeStore } =\n\tunlock( componentsPrivateApis );\nconst noop = () => {};\n\nfunction DownloadableBlocksList( { items, onHover = noop, onSelect } ) {\n\tconst composite = useCompositeStore();\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\tstore={ 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;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,0BAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAbA;AACA;AACA;;AAMA;AACA;AACA;;AAKA,MAAM;EAAEQ,WAAW,EAAEC,SAAS;EAAEC,mBAAmB,EAAEC;AAAkB,CAAC,GACvE,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AAChC,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,SAASC,sBAAsBA,CAAE;EAAEC,KAAK;EAAEC,OAAO,GAAGH,IAAI;EAAEI;AAAS,CAAC,EAAG;EACtE,MAAMC,SAAS,GAAGR,iBAAiB,CAAC,CAAC;EACrC,MAAM;IAAES;EAAiB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAoB,CAAC;EAE/D,IAAK,CAAEN,KAAK,CAACO,MAAM,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAChB,SAAS;IACTiB,KAAK,EAAGP,SAAW;IACnBQ,IAAI,EAAC,SAAS;IACdC,SAAS,EAAC,0CAA0C;IACpD,cAAa,IAAAC,QAAE,EAAE,8BAA+B;EAAG,GAEjDb,KAAK,CAACc,GAAG,CAAIC,IAAI,IAAM;IACxB,OACC,IAAAP,MAAA,CAAAC,aAAA,EAACrB,0BAAA,CAAA4B,OAAyB;MACzBC,GAAG,EAAGF,IAAI,CAACG,EAAI;MACff,SAAS,EAAGA,SAAW;MACvBgB,OAAO,EAAGA,CAAA,KAAM;QACf;QACA;QACA;QACA,IAAK,IAAAC,oBAAY,EAAEL,IAAI,CAACM,IAAK,CAAC,EAAG;UAChCnB,QAAQ,CAAEa,IAAK,CAAC;QACjB,CAAC,MAAM;UACNX,gBAAgB,CAAEW,IAAK,CAAC,CAACO,IAAI,CAAIC,OAAO,IAAM;YAC7C,IAAKA,OAAO,EAAG;cACdrB,QAAQ,CAAEa,IAAK,CAAC;YACjB;UACD,CAAE,CAAC;QACJ;QACAd,OAAO,CAAE,IAAK,CAAC;MAChB,CAAG;MACHA,OAAO,EAAGA,OAAS;MACnBc,IAAI,EAAGA;IAAM,CACb,CAAC;EAEJ,CAAE,CACQ,CAAC;AAEd;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAT,OAAA,GAEcjB,sBAAsB","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_components","_blocks","_data","_downloadableBlockListItem","_interopRequireDefault","_store","_lockUnlock","_jsxRuntime","CompositeV2","Composite","useCompositeStoreV2","useCompositeStore","unlock","componentsPrivateApis","noop","DownloadableBlocksList","items","onHover","onSelect","composite","installBlockType","useDispatch","blockDirectoryStore","length","jsx","store","role","className","__","children","map","item","default","onClick","getBlockType","name","then","success","id","_default","exports"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as componentsPrivateApis } 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';\nimport { unlock } from '../../lock-unlock';\n\nconst { CompositeV2: Composite, useCompositeStoreV2: useCompositeStore } =\n\tunlock( componentsPrivateApis );\nconst noop = () => {};\n\nfunction DownloadableBlocksList( { items, onHover = noop, onSelect } ) {\n\tconst composite = useCompositeStore();\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\tstore={ 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,WAA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