@wordpress/block-directory 5.32.0 → 5.32.1-next.b8c8708f3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/build/components/auto-block-uninstaller/index.js +37 -31
  2. package/build/components/auto-block-uninstaller/index.js.map +7 -1
  3. package/build/components/block-ratings/index.js +40 -22
  4. package/build/components/block-ratings/index.js.map +7 -1
  5. package/build/components/block-ratings/stars.js +66 -40
  6. package/build/components/block-ratings/stars.js.map +7 -1
  7. package/build/components/compact-list/index.js +47 -46
  8. package/build/components/compact-list/index.js.map +7 -1
  9. package/build/components/downloadable-block-icon/index.js +28 -26
  10. package/build/components/downloadable-block-icon/index.js.map +7 -1
  11. package/build/components/downloadable-block-list-item/index.js +113 -127
  12. package/build/components/downloadable-block-list-item/index.js.map +7 -1
  13. package/build/components/downloadable-block-notice/index.js +41 -31
  14. package/build/components/downloadable-block-notice/index.js.map +7 -1
  15. package/build/components/downloadable-blocks-list/index.js +72 -56
  16. package/build/components/downloadable-blocks-list/index.js.map +7 -1
  17. package/build/components/downloadable-blocks-panel/index.js +108 -95
  18. package/build/components/downloadable-blocks-panel/index.js.map +7 -1
  19. package/build/components/downloadable-blocks-panel/inserter-panel.js +52 -38
  20. package/build/components/downloadable-blocks-panel/inserter-panel.js.map +7 -1
  21. package/build/components/downloadable-blocks-panel/no-results.js +37 -30
  22. package/build/components/downloadable-blocks-panel/no-results.js.map +7 -1
  23. package/build/index.js +27 -12
  24. package/build/index.js.map +7 -1
  25. package/build/lock-unlock.js +31 -15
  26. package/build/lock-unlock.js.map +7 -1
  27. package/build/plugins/get-install-missing/index.js +123 -102
  28. package/build/plugins/get-install-missing/index.js.map +7 -1
  29. package/build/plugins/get-install-missing/install-button.js +68 -50
  30. package/build/plugins/get-install-missing/install-button.js.map +7 -1
  31. package/build/plugins/index.js +46 -29
  32. package/build/plugins/index.js.map +7 -1
  33. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js +55 -42
  34. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +7 -1
  35. package/build/plugins/installed-blocks-pre-publish-panel/index.js +65 -34
  36. package/build/plugins/installed-blocks-pre-publish-panel/index.js.map +7 -1
  37. package/build/store/actions.js +142 -188
  38. package/build/store/actions.js.map +7 -1
  39. package/build/store/index.js +48 -46
  40. package/build/store/index.js.map +7 -1
  41. package/build/store/load-assets.js +48 -55
  42. package/build/store/load-assets.js.map +7 -1
  43. package/build/store/reducer.js +48 -54
  44. package/build/store/reducer.js.map +7 -1
  45. package/build/store/resolvers.js +52 -31
  46. package/build/store/resolvers.js.map +7 -1
  47. package/build/store/selectors.js +100 -127
  48. package/build/store/selectors.js.map +7 -1
  49. package/build/store/utils/get-plugin-url.js +23 -14
  50. package/build/store/utils/get-plugin-url.js.map +7 -1
  51. package/build-module/components/auto-block-uninstaller/index.js +18 -24
  52. package/build-module/components/auto-block-uninstaller/index.js.map +7 -1
  53. package/build-module/components/block-ratings/index.js +9 -15
  54. package/build-module/components/block-ratings/index.js.map +7 -1
  55. package/build-module/components/block-ratings/stars.js +48 -34
  56. package/build-module/components/block-ratings/stars.js.map +7 -1
  57. package/build-module/components/compact-list/index.js +19 -39
  58. package/build-module/components/compact-list/index.js.map +7 -1
  59. package/build-module/components/downloadable-block-icon/index.js +10 -20
  60. package/build-module/components/downloadable-block-icon/index.js.map +7 -1
  61. package/build-module/components/downloadable-block-list-item/index.js +89 -120
  62. package/build-module/components/downloadable-block-list-item/index.js.map +7 -1
  63. package/build-module/components/downloadable-block-notice/index.js +19 -24
  64. package/build-module/components/downloadable-block-notice/index.js.map +7 -1
  65. package/build-module/components/downloadable-blocks-list/index.js +44 -49
  66. package/build-module/components/downloadable-blocks-list/index.js.map +7 -1
  67. package/build-module/components/downloadable-blocks-panel/index.js +81 -89
  68. package/build-module/components/downloadable-blocks-panel/index.js.map +7 -1
  69. package/build-module/components/downloadable-blocks-panel/inserter-panel.js +33 -31
  70. package/build-module/components/downloadable-blocks-panel/inserter-panel.js.map +7 -1
  71. package/build-module/components/downloadable-blocks-panel/no-results.js +19 -24
  72. package/build-module/components/downloadable-blocks-panel/no-results.js.map +7 -1
  73. package/build-module/index.js +6 -6
  74. package/build-module/index.js.map +7 -1
  75. package/build-module/lock-unlock.js +8 -7
  76. package/build-module/lock-unlock.js.map +7 -1
  77. package/build-module/plugins/get-install-missing/index.js +99 -95
  78. package/build-module/plugins/get-install-missing/index.js.map +7 -1
  79. package/build-module/plugins/get-install-missing/install-button.js +50 -44
  80. package/build-module/plugins/get-install-missing/install-button.js.map +7 -1
  81. package/build-module/plugins/index.js +24 -25
  82. package/build-module/plugins/index.js.map +7 -1
  83. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js +26 -34
  84. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +7 -1
  85. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js +38 -28
  86. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js.map +7 -1
  87. package/build-module/store/actions.js +100 -168
  88. package/build-module/store/actions.js.map +7 -1
  89. package/build-module/store/index.js +13 -36
  90. package/build-module/store/index.js.map +7 -1
  91. package/build-module/store/load-assets.js +15 -47
  92. package/build-module/store/load-assets.js.map +7 -1
  93. package/build-module/store/reducer.js +27 -49
  94. package/build-module/store/reducer.js.map +7 -1
  95. package/build-module/store/resolvers.js +16 -19
  96. package/build-module/store/resolvers.js.map +7 -1
  97. package/build-module/store/selectors.js +77 -121
  98. package/build-module/store/selectors.js.map +7 -1
  99. package/build-module/store/utils/get-plugin-url.js +6 -10
  100. package/build-module/store/utils/get-plugin-url.js.map +7 -1
  101. package/build-style/style-rtl.css +9 -142
  102. package/build-style/style.css +9 -142
  103. package/package.json +28 -21
  104. package/src/components/block-ratings/style.scss +2 -0
  105. package/src/components/compact-list/style.scss +3 -0
  106. package/src/components/downloadable-block-icon/style.scss +3 -0
  107. package/src/components/downloadable-block-list-item/style.scss +4 -0
  108. package/src/components/downloadable-block-notice/style.scss +3 -0
  109. package/src/components/downloadable-blocks-panel/style.scss +3 -1
  110. package/src/style.scss +8 -7
@@ -1 +1,7 @@
1
- {"version":3,"names":["__","sprintf","DownloadableBlockIcon","jsx","_jsx","jsxs","_jsxs","CompactList","items","length","className","children","map","icon","id","title","author"],"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":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE/D,eAAe,SAASC,WAAWA,CAAE;EAAEC;AAAM,CAAC,EAAG;EAChD,IAAK,CAAEA,KAAK,CAACC,MAAM,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,oBACCL,IAAA;IAAIM,SAAS,EAAC,8BAA8B;IAAAC,QAAA,EACzCH,KAAK,CAACI,GAAG,CAAE,CAAE;MAAEC,IAAI;MAAEC,EAAE;MAAEC,KAAK;MAAEC;IAAO,CAAC,kBACzCV,KAAA;MAAeI,SAAS,EAAC,oCAAoC;MAAAC,QAAA,gBAC5DP,IAAA,CAACF,qBAAqB;QAACW,IAAI,EAAGA,IAAM;QAACE,KAAK,EAAGA;MAAO,CAAE,CAAC,eAEvDT,KAAA;QAAKI,SAAS,EAAC,4CAA4C;QAAAC,QAAA,gBAC1DP,IAAA;UAAKM,SAAS,EAAC,0CAA0C;UAAAC,QAAA,EACtDI;QAAK,CACH,CAAC,eACNX,IAAA;UAAKM,SAAS,EAAC,2CAA2C;UAAAC,QAAA,EACvDV,OAAO,CACR;UACAD,EAAE,CAAE,OAAQ,CAAC,EACbgB,MACD;QAAC,CACG,CAAC;MAAA,CACF,CAAC;IAAA,GAdGF,EAeN,CACH;EAAC,CACA,CAAC;AAEP","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/compact-list/index.js"],
4
+ "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"],
5
+ "mappings": "AAmBK,cAEA,YAFA;AAhBL,SAAS,IAAI,eAAe;AAK5B,OAAO,2BAA2B;AAEnB,SAAR,YAA8B,EAAE,MAAM,GAAI;AAChD,MAAK,CAAE,MAAM,QAAS;AACrB,WAAO;AAAA,EACR;AAEA,SACC,oBAAC,QAAG,WAAU,gCACX,gBAAM,IAAK,CAAE,EAAE,MAAM,IAAI,OAAO,OAAO,MACxC,qBAAC,QAAc,WAAU,sCACxB;AAAA,wBAAC,yBAAsB,MAAc,OAAgB;AAAA,IAErD,qBAAC,SAAI,WAAU,8CACd;AAAA,0BAAC,SAAI,WAAU,4CACZ,iBACH;AAAA,MACA,oBAAC,SAAI,WAAU,6CACZ;AAAA;AAAA,QAED,GAAI,OAAQ;AAAA,QACZ;AAAA,MACD,GACD;AAAA,OACD;AAAA,OAdS,EAeV,CACC,GACH;AAEF;",
6
+ "names": []
7
+ }
@@ -1,21 +1,11 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { BlockIcon } from '@wordpress/block-editor';
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- function DownloadableBlockIcon({
7
- icon
8
- }) {
9
- const className = 'block-directory-downloadable-block-icon';
10
- return icon.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/) !== null ? /*#__PURE__*/_jsx("img", {
11
- className: className,
12
- src: icon,
13
- alt: ""
14
- }) : /*#__PURE__*/_jsx(BlockIcon, {
15
- className: className,
16
- icon: icon,
17
- showColors: true
18
- });
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { BlockIcon } from "@wordpress/block-editor";
3
+ function DownloadableBlockIcon({ icon }) {
4
+ const className = "block-directory-downloadable-block-icon";
5
+ return icon.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/) !== null ? /* @__PURE__ */ jsx("img", { className, src: icon, alt: "" }) : /* @__PURE__ */ jsx(BlockIcon, { className, icon, showColors: true });
19
6
  }
20
- export default DownloadableBlockIcon;
21
- //# sourceMappingURL=index.js.map
7
+ var downloadable_block_icon_default = DownloadableBlockIcon;
8
+ export {
9
+ downloadable_block_icon_default as default
10
+ };
11
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["BlockIcon","jsx","_jsx","DownloadableBlockIcon","icon","className","match","src","alt","showColors"],"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":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEpD,SAASC,qBAAqBA,CAAE;EAAEC;AAAK,CAAC,EAAG;EAC1C,MAAMC,SAAS,GAAG,yCAAyC;EAC3D,OAAOD,IAAI,CAACE,KAAK,CAAE,oCAAqC,CAAC,KAAK,IAAI,gBACjEJ,IAAA;IAAKG,SAAS,EAAGA,SAAW;IAACE,GAAG,EAAGH,IAAM;IAACI,GAAG,EAAC;EAAE,CAAE,CAAC,gBAEnDN,IAAA,CAACF,SAAS;IAACK,SAAS,EAAGA,SAAW;IAACD,IAAI,EAAGA,IAAM;IAACK,UAAU;EAAA,CAAE,CAC7D;AACF;AAEA,eAAeN,qBAAqB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/downloadable-block-icon/index.js"],
4
+ "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"],
5
+ "mappings": "AAQE;AALF,SAAS,iBAAiB;AAE1B,SAAS,sBAAuB,EAAE,KAAK,GAAI;AAC1C,QAAM,YAAY;AAClB,SAAO,KAAK,MAAO,oCAAqC,MAAM,OAC7D,oBAAC,SAAI,WAAwB,KAAM,MAAO,KAAI,IAAG,IAEjD,oBAAC,aAAU,WAAwB,MAAc,YAAU,MAAC;AAE9D;AAEA,IAAO,kCAAQ;",
6
+ "names": []
7
+ }
@@ -1,148 +1,117 @@
1
- /**
2
- * External dependencies
3
- */
4
- import clsx from 'clsx';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { __, _n, sprintf } from '@wordpress/i18n';
10
- import { Tooltip, Spinner, VisuallyHidden, Composite } from '@wordpress/components';
11
- import { createInterpolateElement } from '@wordpress/element';
12
- import { decodeEntities } from '@wordpress/html-entities';
13
- import { getBlockType } from '@wordpress/blocks';
14
- import { useSelect } from '@wordpress/data';
15
-
16
- /**
17
- * Internal dependencies
18
- */
19
- import BlockRatings from '../block-ratings';
20
- import DownloadableBlockIcon from '../downloadable-block-icon';
21
- import DownloadableBlockNotice from '../downloadable-block-notice';
22
- import { store as blockDirectoryStore } from '../../store';
23
-
24
- // Return the appropriate block item label, given the block data and status.
25
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
26
- function getDownloadableBlockLabel({
27
- title,
28
- rating,
29
- ratingCount
30
- }, {
31
- hasNotice,
32
- isInstalled,
33
- isInstalling
34
- }) {
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import { __, _n, sprintf } from "@wordpress/i18n";
4
+ import {
5
+ Tooltip,
6
+ Spinner,
7
+ VisuallyHidden,
8
+ Composite
9
+ } from "@wordpress/components";
10
+ import { createInterpolateElement } from "@wordpress/element";
11
+ import { decodeEntities } from "@wordpress/html-entities";
12
+ import { getBlockType } from "@wordpress/blocks";
13
+ import { useSelect } from "@wordpress/data";
14
+ import BlockRatings from "../block-ratings";
15
+ import DownloadableBlockIcon from "../downloadable-block-icon";
16
+ import DownloadableBlockNotice from "../downloadable-block-notice";
17
+ import { store as blockDirectoryStore } from "../../store";
18
+ function getDownloadableBlockLabel({ title, rating, ratingCount }, { hasNotice, isInstalled, isInstalling }) {
35
19
  const stars = Math.round(rating / 0.5) * 0.5;
36
20
  if (!isInstalled && hasNotice) {
37
- /* translators: %s: block title */
38
- return sprintf('Retry installing %s.', decodeEntities(title));
21
+ return sprintf("Retry installing %s.", decodeEntities(title));
39
22
  }
40
23
  if (isInstalled) {
41
- /* translators: %s: block title */
42
- return sprintf('Add %s.', decodeEntities(title));
24
+ return sprintf("Add %s.", decodeEntities(title));
43
25
  }
44
26
  if (isInstalling) {
45
- /* translators: %s: block title */
46
- return sprintf('Installing %s.', decodeEntities(title));
27
+ return sprintf("Installing %s.", decodeEntities(title));
47
28
  }
48
-
49
- // No ratings yet, just use the title.
50
29
  if (ratingCount < 1) {
51
- /* translators: %s: block title */
52
- return sprintf('Install %s.', decodeEntities(title));
30
+ return sprintf("Install %s.", decodeEntities(title));
53
31
  }
54
- return sprintf(/* translators: 1: block title, 2: average rating, 3: total ratings count. */
55
- _n('Install %1$s. %2$s stars with %3$s review.', 'Install %1$s. %2$s stars with %3$s reviews.', ratingCount), decodeEntities(title), stars, ratingCount);
32
+ return sprintf(
33
+ /* translators: 1: block title, 2: average rating, 3: total ratings count. */
34
+ _n(
35
+ "Install %1$s. %2$s stars with %3$s review.",
36
+ "Install %1$s. %2$s stars with %3$s reviews.",
37
+ ratingCount
38
+ ),
39
+ decodeEntities(title),
40
+ stars,
41
+ ratingCount
42
+ );
56
43
  }
57
- function DownloadableBlockListItem({
58
- item,
59
- onClick
60
- }) {
61
- const {
62
- author,
63
- description,
64
- icon,
65
- rating,
66
- title
67
- } = item;
68
- // getBlockType returns a block object if this block exists, or null if not.
44
+ function DownloadableBlockListItem({ item, onClick }) {
45
+ const { author, description, icon, rating, title } = item;
69
46
  const isInstalled = !!getBlockType(item.name);
70
- const {
71
- hasNotice,
72
- isInstalling,
73
- isInstallable
74
- } = useSelect(select => {
75
- const {
76
- getErrorNoticeForBlock,
77
- isInstalling: isBlockInstalling
78
- } = select(blockDirectoryStore);
79
- const notice = getErrorNoticeForBlock(item.id);
80
- const hasFatal = notice && notice.isFatal;
81
- return {
82
- hasNotice: !!notice,
83
- isInstalling: isBlockInstalling(item.id),
84
- isInstallable: !hasFatal
85
- };
86
- }, [item]);
87
- let statusText = '';
47
+ const { hasNotice, isInstalling, isInstallable } = useSelect(
48
+ (select) => {
49
+ const { getErrorNoticeForBlock, isInstalling: isBlockInstalling } = select(blockDirectoryStore);
50
+ const notice = getErrorNoticeForBlock(item.id);
51
+ const hasFatal = notice && notice.isFatal;
52
+ return {
53
+ hasNotice: !!notice,
54
+ isInstalling: isBlockInstalling(item.id),
55
+ isInstallable: !hasFatal
56
+ };
57
+ },
58
+ [item]
59
+ );
60
+ let statusText = "";
88
61
  if (isInstalled) {
89
- statusText = __('Installed!');
62
+ statusText = __("Installed!");
90
63
  } else if (isInstalling) {
91
- statusText = __('Installing…');
64
+ statusText = __("Installing\u2026");
92
65
  }
93
66
  const itemLabel = getDownloadableBlockLabel(item, {
94
67
  hasNotice,
95
68
  isInstalled,
96
69
  isInstalling
97
70
  });
98
- return /*#__PURE__*/_jsx(Tooltip, {
99
- placement: "top",
100
- text: itemLabel,
101
- children: /*#__PURE__*/_jsxs(Composite.Item, {
102
- className: clsx('block-directory-downloadable-block-list-item', isInstalling && 'is-installing'),
71
+ return /* @__PURE__ */ jsx(Tooltip, { placement: "top", text: itemLabel, children: /* @__PURE__ */ jsxs(
72
+ Composite.Item,
73
+ {
74
+ className: clsx(
75
+ "block-directory-downloadable-block-list-item",
76
+ isInstalling && "is-installing"
77
+ ),
103
78
  accessibleWhenDisabled: true,
104
79
  disabled: isInstalling || !isInstallable,
105
- onClick: event => {
80
+ onClick: (event) => {
106
81
  event.preventDefault();
107
82
  onClick();
108
83
  },
109
84
  "aria-label": itemLabel,
110
85
  type: "button",
111
86
  role: "option",
112
- children: [/*#__PURE__*/_jsxs("div", {
113
- className: "block-directory-downloadable-block-list-item__icon",
114
- children: [/*#__PURE__*/_jsx(DownloadableBlockIcon, {
115
- icon: icon,
116
- title: title
117
- }), isInstalling ? /*#__PURE__*/_jsx("span", {
118
- className: "block-directory-downloadable-block-list-item__spinner",
119
- children: /*#__PURE__*/_jsx(Spinner, {})
120
- }) : /*#__PURE__*/_jsx(BlockRatings, {
121
- rating: rating
122
- })]
123
- }), /*#__PURE__*/_jsxs("span", {
124
- className: "block-directory-downloadable-block-list-item__details",
125
- children: [/*#__PURE__*/_jsx("span", {
126
- className: "block-directory-downloadable-block-list-item__title",
127
- children: createInterpolateElement(sprintf(/* translators: 1: block title. 2: author name. */
128
- __('%1$s <span>by %2$s</span>'), decodeEntities(title), author), {
129
- span: /*#__PURE__*/_jsx("span", {
130
- className: "block-directory-downloadable-block-list-item__author"
131
- })
132
- })
133
- }), hasNotice ? /*#__PURE__*/_jsx(DownloadableBlockNotice, {
134
- block: item
135
- }) : /*#__PURE__*/_jsxs(_Fragment, {
136
- children: [/*#__PURE__*/_jsx("span", {
137
- className: "block-directory-downloadable-block-list-item__desc",
138
- children: !!statusText ? statusText : decodeEntities(description)
139
- }), isInstallable && !(isInstalled || isInstalling) && /*#__PURE__*/_jsx(VisuallyHidden, {
140
- children: __('Install block')
141
- })]
142
- })]
143
- })]
144
- })
145
- });
87
+ children: [
88
+ /* @__PURE__ */ jsxs("div", { className: "block-directory-downloadable-block-list-item__icon", children: [
89
+ /* @__PURE__ */ jsx(DownloadableBlockIcon, { icon, title }),
90
+ isInstalling ? /* @__PURE__ */ jsx("span", { className: "block-directory-downloadable-block-list-item__spinner", children: /* @__PURE__ */ jsx(Spinner, {}) }) : /* @__PURE__ */ jsx(BlockRatings, { rating })
91
+ ] }),
92
+ /* @__PURE__ */ jsxs("span", { className: "block-directory-downloadable-block-list-item__details", children: [
93
+ /* @__PURE__ */ jsx("span", { className: "block-directory-downloadable-block-list-item__title", children: createInterpolateElement(
94
+ sprintf(
95
+ /* translators: 1: block title. 2: author name. */
96
+ __("%1$s <span>by %2$s</span>"),
97
+ decodeEntities(title),
98
+ author
99
+ ),
100
+ {
101
+ span: /* @__PURE__ */ jsx("span", { className: "block-directory-downloadable-block-list-item__author" })
102
+ }
103
+ ) }),
104
+ hasNotice ? /* @__PURE__ */ jsx(DownloadableBlockNotice, { block: item }) : /* @__PURE__ */ jsxs(Fragment, { children: [
105
+ /* @__PURE__ */ jsx("span", { className: "block-directory-downloadable-block-list-item__desc", children: !!statusText ? statusText : decodeEntities(description) }),
106
+ isInstallable && !(isInstalled || isInstalling) && /* @__PURE__ */ jsx(VisuallyHidden, { children: __("Install block") })
107
+ ] })
108
+ ] })
109
+ ]
110
+ }
111
+ ) });
146
112
  }
147
- export default DownloadableBlockListItem;
148
- //# sourceMappingURL=index.js.map
113
+ var downloadable_block_list_item_default = DownloadableBlockListItem;
114
+ export {
115
+ downloadable_block_list_item_default as default
116
+ };
117
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["clsx","__","_n","sprintf","Tooltip","Spinner","VisuallyHidden","Composite","createInterpolateElement","decodeEntities","getBlockType","useSelect","BlockRatings","DownloadableBlockIcon","DownloadableBlockNotice","store","blockDirectoryStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","getDownloadableBlockLabel","title","rating","ratingCount","hasNotice","isInstalled","isInstalling","stars","Math","round","DownloadableBlockListItem","item","onClick","author","description","icon","name","isInstallable","select","getErrorNoticeForBlock","isBlockInstalling","notice","id","hasFatal","isFatal","statusText","itemLabel","placement","text","children","Item","className","accessibleWhenDisabled","disabled","event","preventDefault","type","role","span","block"],"sources":["@wordpress/block-directory/src/components/downloadable-block-list-item/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tTooltip,\n\tSpinner,\n\tVisuallyHidden,\n\tComposite,\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: %s: block title */\n\t\treturn sprintf( 'Retry installing %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalled ) {\n\t\t/* translators: %s: block title */\n\t\treturn sprintf( 'Add %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalling ) {\n\t\t/* translators: %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: %s: block title */\n\t\treturn sprintf( 'Install %s.', decodeEntities( title ) );\n\t}\n\n\treturn sprintf(\n\t\t/* translators: 1: block title, 2: average rating, 3: 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( { 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\tconst itemLabel = getDownloadableBlockLabel( item, {\n\t\thasNotice,\n\t\tisInstalled,\n\t\tisInstalling,\n\t} );\n\n\treturn (\n\t\t<Tooltip placement=\"top\" text={ itemLabel }>\n\t\t\t<Composite.Item\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-directory-downloadable-block-list-item',\n\t\t\t\t\tisInstalling && 'is-installing'\n\t\t\t\t) }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tdisabled={ isInstalling || ! isInstallable }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonClick();\n\t\t\t\t} }\n\t\t\t\taria-label={ itemLabel }\n\t\t\t\ttype=\"button\"\n\t\t\t\trole=\"option\"\n\t\t\t>\n\t\t\t\t<div className=\"block-directory-downloadable-block-list-item__icon\">\n\t\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\t\t\t\t\t{ isInstalling ? (\n\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__spinner\">\n\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<BlockRatings rating={ rating } />\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__details\">\n\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__title\">\n\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: 1: block title. 2: author name. */\n\t\t\t\t\t\t\t\t__( '%1$s <span>by %2$s</span>' ),\n\t\t\t\t\t\t\t\tdecodeEntities( title ),\n\t\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: (\n\t\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\t),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</span>\n\t\t\t\t\t{ hasNotice ? (\n\t\t\t\t\t\t<DownloadableBlockNotice block={ item } />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__desc\">\n\t\t\t\t\t\t\t\t{ !! statusText\n\t\t\t\t\t\t\t\t\t? statusText\n\t\t\t\t\t\t\t\t\t: decodeEntities( description ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{ isInstallable &&\n\t\t\t\t\t\t\t\t! ( isInstalled || isInstalling ) && (\n\t\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Install block' ) }\n\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\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</Composite.Item>\n\t\t</Tooltip>\n\t);\n}\n\nexport default DownloadableBlockListItem;\n"],"mappings":"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","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/downloadable-block-list-item/index.js"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tTooltip,\n\tSpinner,\n\tVisuallyHidden,\n\tComposite,\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: %s: block title */\n\t\treturn sprintf( 'Retry installing %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalled ) {\n\t\t/* translators: %s: block title */\n\t\treturn sprintf( 'Add %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalling ) {\n\t\t/* translators: %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: %s: block title */\n\t\treturn sprintf( 'Install %s.', decodeEntities( title ) );\n\t}\n\n\treturn sprintf(\n\t\t/* translators: 1: block title, 2: average rating, 3: 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( { 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\u2026' );\n\t}\n\n\tconst itemLabel = getDownloadableBlockLabel( item, {\n\t\thasNotice,\n\t\tisInstalled,\n\t\tisInstalling,\n\t} );\n\n\treturn (\n\t\t<Tooltip placement=\"top\" text={ itemLabel }>\n\t\t\t<Composite.Item\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-directory-downloadable-block-list-item',\n\t\t\t\t\tisInstalling && 'is-installing'\n\t\t\t\t) }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tdisabled={ isInstalling || ! isInstallable }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonClick();\n\t\t\t\t} }\n\t\t\t\taria-label={ itemLabel }\n\t\t\t\ttype=\"button\"\n\t\t\t\trole=\"option\"\n\t\t\t>\n\t\t\t\t<div className=\"block-directory-downloadable-block-list-item__icon\">\n\t\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\t\t\t\t\t{ isInstalling ? (\n\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__spinner\">\n\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<BlockRatings rating={ rating } />\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__details\">\n\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__title\">\n\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: 1: block title. 2: author name. */\n\t\t\t\t\t\t\t\t__( '%1$s <span>by %2$s</span>' ),\n\t\t\t\t\t\t\t\tdecodeEntities( title ),\n\t\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: (\n\t\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\t),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</span>\n\t\t\t\t\t{ hasNotice ? (\n\t\t\t\t\t\t<DownloadableBlockNotice block={ item } />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__desc\">\n\t\t\t\t\t\t\t\t{ !! statusText\n\t\t\t\t\t\t\t\t\t? statusText\n\t\t\t\t\t\t\t\t\t: decodeEntities( description ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{ isInstallable &&\n\t\t\t\t\t\t\t\t! ( isInstalled || isInstalling ) && (\n\t\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Install block' ) }\n\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\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</Composite.Item>\n\t\t</Tooltip>\n\t);\n}\n\nexport default DownloadableBlockListItem;\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -1,28 +1,23 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
- import { useSelect } from '@wordpress/data';
6
-
7
- /**
8
- * Internal dependencies
9
- */
10
- import { store as blockDirectoryStore } from '../../store';
11
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
12
- export const DownloadableBlockNotice = ({
13
- block
14
- }) => {
15
- const errorNotice = useSelect(select => select(blockDirectoryStore).getErrorNoticeForBlock(block.id), [block]);
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { __ } from "@wordpress/i18n";
3
+ import { useSelect } from "@wordpress/data";
4
+ import { store as blockDirectoryStore } from "../../store";
5
+ const DownloadableBlockNotice = ({ block }) => {
6
+ const errorNotice = useSelect(
7
+ (select) => select(blockDirectoryStore).getErrorNoticeForBlock(block.id),
8
+ [block]
9
+ );
16
10
  if (!errorNotice) {
17
11
  return null;
18
12
  }
19
- return /*#__PURE__*/_jsx("div", {
20
- className: "block-directory-downloadable-block-notice",
21
- children: /*#__PURE__*/_jsxs("div", {
22
- className: "block-directory-downloadable-block-notice__content",
23
- children: [errorNotice.message, errorNotice.isFatal ? ' ' + __('Try reloading the page.') : null]
24
- })
25
- });
13
+ return /* @__PURE__ */ jsx("div", { className: "block-directory-downloadable-block-notice", children: /* @__PURE__ */ jsxs("div", { className: "block-directory-downloadable-block-notice__content", children: [
14
+ errorNotice.message,
15
+ errorNotice.isFatal ? " " + __("Try reloading the page.") : null
16
+ ] }) });
26
17
  };
27
- export default DownloadableBlockNotice;
28
- //# sourceMappingURL=index.js.map
18
+ var downloadable_block_notice_default = DownloadableBlockNotice;
19
+ export {
20
+ DownloadableBlockNotice,
21
+ downloadable_block_notice_default as default
22
+ };
23
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["__","useSelect","store","blockDirectoryStore","jsxs","_jsxs","jsx","_jsx","DownloadableBlockNotice","block","errorNotice","select","getErrorNoticeForBlock","id","className","children","message","isFatal"],"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":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,mBAAmB,QAAQ,aAAa;AAAC,SAAAC,IAAA,IAAAC,KAAA,EAAAC,GAAA,IAAAC,IAAA;AAE3D,OAAO,MAAMC,uBAAuB,GAAGA,CAAE;EAAEC;AAAM,CAAC,KAAM;EACvD,MAAMC,WAAW,GAAGT,SAAS,CAC1BU,MAAM,IACPA,MAAM,CAAER,mBAAoB,CAAC,CAACS,sBAAsB,CAAEH,KAAK,CAACI,EAAG,CAAC,EACjE,CAAEJ,KAAK,CACR,CAAC;EAED,IAAK,CAAEC,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,oBACCH,IAAA;IAAKO,SAAS,EAAC,2CAA2C;IAAAC,QAAA,eACzDV,KAAA;MAAKS,SAAS,EAAC,oDAAoD;MAAAC,QAAA,GAChEL,WAAW,CAACM,OAAO,EACnBN,WAAW,CAACO,OAAO,GAClB,GAAG,GAAGjB,EAAE,CAAE,yBAA0B,CAAC,GACrC,IAAI;IAAA,CACH;EAAC,CACF,CAAC;AAER,CAAC;AAED,eAAeQ,uBAAuB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/downloadable-block-notice/index.js"],
4
+ "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"],
5
+ "mappings": "AAuBE,cACC,YADD;AApBF,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAK1B,SAAS,SAAS,2BAA2B;AAEtC,MAAM,0BAA0B,CAAE,EAAE,MAAM,MAAO;AACvD,QAAM,cAAc;AAAA,IACnB,CAAE,WACD,OAAQ,mBAAoB,EAAE,uBAAwB,MAAM,EAAG;AAAA,IAChE,CAAE,KAAM;AAAA,EACT;AAEA,MAAK,CAAE,aAAc;AACpB,WAAO;AAAA,EACR;AAEA,SACC,oBAAC,SAAI,WAAU,6CACd,+BAAC,SAAI,WAAU,sDACZ;AAAA,gBAAY;AAAA,IACZ,YAAY,UACX,MAAM,GAAI,yBAA0B,IACpC;AAAA,KACJ,GACD;AAEF;AAEA,IAAO,oCAAQ;",
6
+ "names": []
7
+ }
@@ -1,55 +1,50 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
- import { Composite } from '@wordpress/components';
6
- import { getBlockType } from '@wordpress/blocks';
7
- import { useDispatch } from '@wordpress/data';
8
-
9
- /**
10
- * Internal dependencies
11
- */
12
- import DownloadableBlockListItem from '../downloadable-block-list-item';
13
- import { store as blockDirectoryStore } from '../../store';
14
- import { jsx as _jsx } from "react/jsx-runtime";
15
- const noop = () => {};
16
- function DownloadableBlocksList({
17
- items,
18
- onHover = noop,
19
- onSelect
20
- }) {
21
- const {
22
- installBlockType
23
- } = useDispatch(blockDirectoryStore);
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { __ } from "@wordpress/i18n";
3
+ import { Composite } from "@wordpress/components";
4
+ import { getBlockType } from "@wordpress/blocks";
5
+ import { useDispatch } from "@wordpress/data";
6
+ import DownloadableBlockListItem from "../downloadable-block-list-item";
7
+ import { store as blockDirectoryStore } from "../../store";
8
+ const noop = () => {
9
+ };
10
+ function DownloadableBlocksList({ items, onHover = noop, onSelect }) {
11
+ const { installBlockType } = useDispatch(blockDirectoryStore);
24
12
  if (!items.length) {
25
13
  return null;
26
14
  }
27
- return /*#__PURE__*/_jsx(Composite, {
28
- role: "listbox",
29
- className: "block-directory-downloadable-blocks-list",
30
- "aria-label": __('Blocks available for install'),
31
- children: items.map(item => {
32
- return /*#__PURE__*/_jsx(DownloadableBlockListItem, {
33
- onClick: () => {
34
- // Check if the block is registered (`getBlockType`
35
- // will return an object). If so, insert the block.
36
- // This prevents installing existing plugins.
37
- if (getBlockType(item.name)) {
38
- onSelect(item);
39
- } else {
40
- installBlockType(item).then(success => {
41
- if (success) {
15
+ return /* @__PURE__ */ jsx(
16
+ Composite,
17
+ {
18
+ role: "listbox",
19
+ className: "block-directory-downloadable-blocks-list",
20
+ "aria-label": __("Blocks available for install"),
21
+ children: items.map((item) => {
22
+ return /* @__PURE__ */ jsx(
23
+ DownloadableBlockListItem,
24
+ {
25
+ onClick: () => {
26
+ if (getBlockType(item.name)) {
42
27
  onSelect(item);
28
+ } else {
29
+ installBlockType(item).then((success) => {
30
+ if (success) {
31
+ onSelect(item);
32
+ }
33
+ });
43
34
  }
44
- });
45
- }
46
- onHover(null);
47
- },
48
- onHover: onHover,
49
- item: item
50
- }, item.id);
51
- })
52
- });
35
+ onHover(null);
36
+ },
37
+ onHover,
38
+ item
39
+ },
40
+ item.id
41
+ );
42
+ })
43
+ }
44
+ );
53
45
  }
54
- export default DownloadableBlocksList;
55
- //# sourceMappingURL=index.js.map
46
+ var downloadable_blocks_list_default = DownloadableBlocksList;
47
+ export {
48
+ downloadable_blocks_list_default as default
49
+ };
50
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["__","Composite","getBlockType","useDispatch","DownloadableBlockListItem","store","blockDirectoryStore","jsx","_jsx","noop","DownloadableBlocksList","items","onHover","onSelect","installBlockType","length","role","className","children","map","item","onClick","name","then","success","id"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Composite } 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 { installBlockType } = useDispatch( blockDirectoryStore );\n\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\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\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":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,SAASC,KAAK,IAAIC,mBAAmB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3D,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,SAASC,sBAAsBA,CAAE;EAAEC,KAAK;EAAEC,OAAO,GAAGH,IAAI;EAAEI;AAAS,CAAC,EAAG;EACtE,MAAM;IAAEC;EAAiB,CAAC,GAAGX,WAAW,CAAEG,mBAAoB,CAAC;EAE/D,IAAK,CAAEK,KAAK,CAACI,MAAM,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,oBACCP,IAAA,CAACP,SAAS;IACTe,IAAI,EAAC,SAAS;IACdC,SAAS,EAAC,0CAA0C;IACpD,cAAajB,EAAE,CAAE,8BAA+B,CAAG;IAAAkB,QAAA,EAEjDP,KAAK,CAACQ,GAAG,CAAIC,IAAI,IAAM;MACxB,oBACCZ,IAAA,CAACJ,yBAAyB;QAEzBiB,OAAO,EAAGA,CAAA,KAAM;UACf;UACA;UACA;UACA,IAAKnB,YAAY,CAAEkB,IAAI,CAACE,IAAK,CAAC,EAAG;YAChCT,QAAQ,CAAEO,IAAK,CAAC;UACjB,CAAC,MAAM;YACNN,gBAAgB,CAAEM,IAAK,CAAC,CAACG,IAAI,CAAIC,OAAO,IAAM;cAC7C,IAAKA,OAAO,EAAG;gBACdX,QAAQ,CAAEO,IAAK,CAAC;cACjB;YACD,CAAE,CAAC;UACJ;UACAR,OAAO,CAAE,IAAK,CAAC;QAChB,CAAG;QACHA,OAAO,EAAGA,OAAS;QACnBQ,IAAI,EAAGA;MAAM,GAjBPA,IAAI,CAACK,EAkBX,CAAC;IAEJ,CAAE;EAAC,CACO,CAAC;AAEd;AAEA,eAAef,sBAAsB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/downloadable-blocks-list/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Composite } 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 { installBlockType } = useDispatch( blockDirectoryStore );\n\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\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\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"],
5
+ "mappings": "AA+BK;AA5BL,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAK5B,OAAO,+BAA+B;AACtC,SAAS,SAAS,2BAA2B;AAE7C,MAAM,OAAO,MAAM;AAAC;AAEpB,SAAS,uBAAwB,EAAE,OAAO,UAAU,MAAM,SAAS,GAAI;AACtE,QAAM,EAAE,iBAAiB,IAAI,YAAa,mBAAoB;AAE9D,MAAK,CAAE,MAAM,QAAS;AACrB,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAK;AAAA,MACL,WAAU;AAAA,MACV,cAAa,GAAI,8BAA+B;AAAA,MAE9C,gBAAM,IAAK,CAAE,SAAU;AACxB,eACC;AAAA,UAAC;AAAA;AAAA,YAEA,SAAU,MAAM;AAIf,kBAAK,aAAc,KAAK,IAAK,GAAI;AAChC,yBAAU,IAAK;AAAA,cAChB,OAAO;AACN,iCAAkB,IAAK,EAAE,KAAM,CAAE,YAAa;AAC7C,sBAAK,SAAU;AACd,6BAAU,IAAK;AAAA,kBAChB;AAAA,gBACD,CAAE;AAAA,cACH;AACA,sBAAS,IAAK;AAAA,YACf;AAAA,YACA;AAAA,YACA;AAAA;AAAA,UAjBM,KAAK;AAAA,QAkBZ;AAAA,MAEF,CAAE;AAAA;AAAA,EACH;AAEF;AAEA,IAAO,mCAAQ;",
6
+ "names": []
7
+ }