@wordpress/block-directory 6.1.0 → 6.3.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 (106) hide show
  1. package/build/components/auto-block-uninstaller/index.cjs.map +1 -1
  2. package/build/components/block-ratings/index.cjs +9 -7
  3. package/build/components/block-ratings/index.cjs.map +1 -1
  4. package/build/components/block-ratings/stars.cjs +5 -1
  5. package/build/components/block-ratings/stars.cjs.map +1 -1
  6. package/build/components/compact-list/index.cjs +14 -8
  7. package/build/components/compact-list/index.cjs.map +1 -1
  8. package/build/components/downloadable-block-list-item/index.cjs +45 -16
  9. package/build/components/downloadable-block-list-item/index.cjs.map +1 -1
  10. package/build/components/downloadable-block-notice/index.cjs +2 -3
  11. package/build/components/downloadable-block-notice/index.cjs.map +1 -1
  12. package/build/components/downloadable-blocks-list/index.cjs +9 -7
  13. package/build/components/downloadable-blocks-list/index.cjs.map +1 -1
  14. package/build/components/downloadable-blocks-panel/index.cjs +11 -9
  15. package/build/components/downloadable-blocks-panel/index.cjs.map +1 -1
  16. package/build/components/downloadable-blocks-panel/inserter-panel.cjs +5 -1
  17. package/build/components/downloadable-blocks-panel/inserter-panel.cjs.map +1 -1
  18. package/build/plugins/get-install-missing/index.cjs +19 -9
  19. package/build/plugins/get-install-missing/index.cjs.map +1 -1
  20. package/build/plugins/get-install-missing/install-button.cjs +5 -1
  21. package/build/plugins/get-install-missing/install-button.cjs.map +1 -1
  22. package/build/plugins/index.cjs +12 -10
  23. package/build/plugins/index.cjs.map +1 -1
  24. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.cjs +9 -7
  25. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.cjs.map +1 -1
  26. package/build/plugins/installed-blocks-pre-publish-panel/index.cjs +15 -9
  27. package/build/plugins/installed-blocks-pre-publish-panel/index.cjs.map +1 -1
  28. package/build/store/actions.cjs +14 -8
  29. package/build/store/actions.cjs.map +1 -1
  30. package/build/store/index.cjs +11 -9
  31. package/build/store/index.cjs.map +1 -1
  32. package/build/store/load-assets.cjs +8 -6
  33. package/build/store/load-assets.cjs.map +1 -1
  34. package/build/store/resolvers.cjs +9 -7
  35. package/build/store/resolvers.cjs.map +1 -1
  36. package/build-module/components/block-ratings/stars.mjs +5 -1
  37. package/build-module/components/block-ratings/stars.mjs.map +1 -1
  38. package/build-module/components/compact-list/index.mjs +5 -1
  39. package/build-module/components/compact-list/index.mjs.map +1 -1
  40. package/build-module/components/downloadable-block-list-item/index.mjs +33 -6
  41. package/build-module/components/downloadable-block-list-item/index.mjs.map +1 -1
  42. package/build-module/components/downloadable-block-notice/index.mjs +3 -4
  43. package/build-module/components/downloadable-block-notice/index.mjs.map +1 -1
  44. package/build-module/components/downloadable-blocks-panel/inserter-panel.mjs +5 -1
  45. package/build-module/components/downloadable-blocks-panel/inserter-panel.mjs.map +1 -1
  46. package/build-module/plugins/get-install-missing/index.mjs +10 -2
  47. package/build-module/plugins/get-install-missing/index.mjs.map +1 -1
  48. package/build-module/plugins/get-install-missing/install-button.mjs +5 -1
  49. package/build-module/plugins/get-install-missing/install-button.mjs.map +1 -1
  50. package/build-module/plugins/installed-blocks-pre-publish-panel/index.mjs +7 -3
  51. package/build-module/plugins/installed-blocks-pre-publish-panel/index.mjs.map +1 -1
  52. package/build-module/store/actions.mjs +5 -1
  53. package/build-module/store/actions.mjs.map +1 -1
  54. package/build-style/style-rtl.css +7 -7
  55. package/build-style/style.css +7 -7
  56. package/build-types/components/auto-block-uninstaller/index.d.ts +2 -0
  57. package/build-types/components/auto-block-uninstaller/index.d.ts.map +1 -0
  58. package/build-types/components/block-ratings/index.d.ts +5 -0
  59. package/build-types/components/block-ratings/index.d.ts.map +1 -0
  60. package/build-types/components/block-ratings/stars.d.ts +5 -0
  61. package/build-types/components/block-ratings/stars.d.ts.map +1 -0
  62. package/build-types/components/compact-list/index.d.ts +4 -0
  63. package/build-types/components/compact-list/index.d.ts.map +1 -0
  64. package/build-types/components/downloadable-block-icon/index.d.ts +5 -0
  65. package/build-types/components/downloadable-block-icon/index.d.ts.map +1 -0
  66. package/build-types/components/downloadable-block-list-item/index.d.ts +6 -0
  67. package/build-types/components/downloadable-block-list-item/index.d.ts.map +1 -0
  68. package/build-types/components/downloadable-block-notice/index.d.ts +5 -0
  69. package/build-types/components/downloadable-block-notice/index.d.ts.map +1 -0
  70. package/build-types/components/downloadable-blocks-list/index.d.ts +8 -0
  71. package/build-types/components/downloadable-blocks-list/index.d.ts.map +1 -0
  72. package/build-types/components/downloadable-blocks-panel/index.d.ts +8 -0
  73. package/build-types/components/downloadable-blocks-panel/index.d.ts.map +1 -0
  74. package/build-types/components/downloadable-blocks-panel/inserter-panel.d.ts +7 -0
  75. package/build-types/components/downloadable-blocks-panel/inserter-panel.d.ts.map +1 -0
  76. package/build-types/components/downloadable-blocks-panel/no-results.d.ts +3 -0
  77. package/build-types/components/downloadable-blocks-panel/no-results.d.ts.map +1 -0
  78. package/build-types/index.d.ts +3 -0
  79. package/build-types/index.d.ts.map +1 -0
  80. package/build-types/plugins/get-install-missing/index.d.ts +3 -0
  81. package/build-types/plugins/get-install-missing/index.d.ts.map +1 -0
  82. package/build-types/plugins/get-install-missing/install-button.d.ts +6 -0
  83. package/build-types/plugins/get-install-missing/install-button.d.ts.map +1 -0
  84. package/build-types/plugins/index.d.ts +2 -0
  85. package/build-types/plugins/index.d.ts.map +1 -0
  86. package/build-types/plugins/inserter-menu-downloadable-blocks-panel/index.d.ts +3 -0
  87. package/build-types/plugins/inserter-menu-downloadable-blocks-panel/index.d.ts.map +1 -0
  88. package/build-types/plugins/installed-blocks-pre-publish-panel/index.d.ts +2 -0
  89. package/build-types/plugins/installed-blocks-pre-publish-panel/index.d.ts.map +1 -0
  90. package/build-types/store/actions.d.ts +82 -0
  91. package/build-types/store/actions.d.ts.map +1 -0
  92. package/build-types/store/index.d.ts +17 -0
  93. package/build-types/store/index.d.ts.map +1 -0
  94. package/build-types/store/load-assets.d.ts +16 -0
  95. package/build-types/store/load-assets.d.ts.map +1 -0
  96. package/build-types/store/reducer.d.ts +38 -0
  97. package/build-types/store/reducer.d.ts.map +1 -0
  98. package/build-types/store/resolvers.d.ts +4 -0
  99. package/build-types/store/resolvers.d.ts.map +1 -0
  100. package/build-types/store/selectors.d.ts +80 -0
  101. package/build-types/store/selectors.d.ts.map +1 -0
  102. package/build-types/store/utils/get-plugin-url.d.ts +9 -0
  103. package/build-types/store/utils/get-plugin-url.d.ts.map +1 -0
  104. package/package.json +23 -23
  105. package/src/components/downloadable-block-notice/index.jsx +0 -4
  106. package/src/plugins/installed-blocks-pre-publish-panel/index.jsx +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["useDispatch","blockDirectoryStore","useSelect","editorStore"],"sources":["../../../src/components/auto-block-uninstaller/index.js"],"sourcesContent":["import { unregisterBlockType } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function AutoBlockUninstaller() {\n\tconst { uninstallBlockType } = useDispatch( blockDirectoryStore );\n\n\tconst shouldRemoveBlockTypes = useSelect( ( select ) => {\n\t\tconst { isAutosavingPost, isSavingPost } = select( editorStore );\n\t\treturn isSavingPost() && ! isAutosavingPost();\n\t}, [] );\n\n\tconst unusedBlockTypes = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).getUnusedBlockTypes(),\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( shouldRemoveBlockTypes && unusedBlockTypes.length ) {\n\t\t\tunusedBlockTypes.forEach( ( blockType ) => {\n\t\t\t\tuninstallBlockType( blockType );\n\t\t\t\tunregisterBlockType( blockType.name );\n\t\t\t} );\n\t\t}\n\t}, [ shouldRemoveBlockTypes ] );\n\n\treturn null;\n}\n"],"mappings":";;;;;;;;;;;AAMA,SAAwB,uBAAuB;CAC9C,MAAM,EAAE,wBAAA,GAAuBA,gBAAAA,YAAAA,CAAaC,qBAAAA,KAAoB;CAEhE,MAAM,0BAAA,GAAyBC,gBAAAA,UAAAA,EAAa,WAAY;EACvD,MAAM,EAAE,kBAAkB,iBAAiB,OAAQC,kBAAAA,KAAY;EAC/D,OAAO,aAAa,KAAK,CAAE,iBAAiB;CAC7C,GAAG,CAAC,CAAE;CAEN,MAAM,oBAAA,GAAmBD,gBAAAA,UAAAA,EACtB,WAAY,OAAQD,qBAAAA,KAAoB,CAAC,CAAC,oBAAoB,GAChE,CAAC,CACF;CAEA,CAAA,GAAA,mBAAA,UAAA,OAAiB;EAChB,IAAK,0BAA0B,iBAAiB,QAC/C,iBAAiB,SAAW,cAAe;GAC1C,mBAAoB,SAAU;GAC9B,CAAA,GAAA,kBAAA,oBAAA,CAAqB,UAAU,IAAK;EACrC,CAAE;CAEJ,GAAG,CAAE,sBAAuB,CAAE;CAE9B,OAAO;AACR"}
1
+ {"version":3,"file":"index.cjs","names":["useDispatch","blockDirectoryStore","useSelect","editorStore","useEffect","unregisterBlockType"],"sources":["../../../src/components/auto-block-uninstaller/index.js"],"sourcesContent":["import { unregisterBlockType } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function AutoBlockUninstaller() {\n\tconst { uninstallBlockType } = useDispatch( blockDirectoryStore );\n\n\tconst shouldRemoveBlockTypes = useSelect( ( select ) => {\n\t\tconst { isAutosavingPost, isSavingPost } = select( editorStore );\n\t\treturn isSavingPost() && ! isAutosavingPost();\n\t}, [] );\n\n\tconst unusedBlockTypes = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).getUnusedBlockTypes(),\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( shouldRemoveBlockTypes && unusedBlockTypes.length ) {\n\t\t\tunusedBlockTypes.forEach( ( blockType ) => {\n\t\t\t\tuninstallBlockType( blockType );\n\t\t\t\tunregisterBlockType( blockType.name );\n\t\t\t} );\n\t\t}\n\t}, [ shouldRemoveBlockTypes ] );\n\n\treturn null;\n}\n"],"mappings":";;;;;;;;;;;AAMA,SAAwB,uBAAuB;CAC9C,MAAM,EAAE,wBAAA,GAAuBA,gBAAAA,YAAAA,CAAaC,qBAAAA,KAAoB;CAEhE,MAAM,0BAAA,GAAyBC,gBAAAA,UAAAA,EAAa,WAAY;EACvD,MAAM,EAAE,kBAAkB,iBAAiB,OAAQC,kBAAAA,KAAY;EAC/D,OAAO,aAAa,KAAK,CAAE,iBAAiB;CAC7C,GAAG,CAAC,CAAE;CAEN,MAAM,oBAAA,GAAmBD,gBAAAA,UAAAA,EACtB,WAAY,OAAQD,qBAAAA,KAAoB,CAAC,CAAC,oBAAoB,GAChE,CAAC,CACF;CAEAG,CAAAA,GAAAA,mBAAAA,UAAAA,OAAiB;EAChB,IAAK,0BAA0B,iBAAiB,QAC/C,iBAAiB,SAAW,cAAe;GAC1C,mBAAoB,SAAU;GAC9BC,CAAAA,GAAAA,kBAAAA,oBAAAA,CAAqB,UAAU,IAAK;EACrC,CAAE;CAEJ,GAAG,CAAE,sBAAuB,CAAE;CAE9B,OAAO;AACR"}
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
11
11
  var __getProtoOf = Object.getPrototypeOf;
12
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
- key = keys[i];
16
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
16
+ desc = __getOwnPropDesc(from, key);
17
+ __defProp(to, key, {
18
+ get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
19
+ enumerable: !desc || desc.enumerable
20
+ });
21
+ }
20
22
  }
21
23
  return to;
22
24
  };
@@ -25,8 +27,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
27
  enumerable: true
26
28
  }) : target, mod));
27
29
  let __stars_jsx = require("./stars.cjs");
28
- __stars_jsx = __toESM(__stars_jsx);
29
30
  let react_jsx_runtime = require("react/jsx-runtime");
31
+ __stars_jsx = __toESM(__stars_jsx);
30
32
  // packages/block-directory/src/components/block-ratings/index.jsx
31
33
  const BlockRatings = ({ rating }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
32
34
  className: "block-directory-block-ratings",
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["Stars"],"sources":["../../../src/components/block-ratings/index.jsx"],"sourcesContent":["import 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAa,gBAAiB,EAAE,aAC/B,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;CAAM,WAAU;CACf,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACA,YAAAA,SAAD,EAAgB,OAAU,CAAA;AACrB,CAAA"}
1
+ {"version":3,"file":"index.cjs","names":["Stars"],"sources":["../../../src/components/block-ratings/index.jsx"],"sourcesContent":["import 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAa,gBAAiB,EAAE,aAC/B,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;CAAM,WAAU;CACf,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACA,YAAAA,SAAD,EAAgB,OAAU,CAAA;AACrB,CAAA"}
@@ -13,7 +13,11 @@ function Stars({ rating }) {
13
13
  const halfStarCount = Math.ceil(rating - fullStarCount);
14
14
  const emptyStarCount = 5 - (fullStarCount + halfStarCount);
15
15
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
16
- "aria-label": (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("%s out of 5 stars"), stars),
16
+ "aria-label": (0, _wordpress_i18n.sprintf)(
17
+ /** translators: %s: number of stars. */
18
+ (0, _wordpress_i18n.__)("%s out of 5 stars"),
19
+ stars
20
+ ),
17
21
  children: [
18
22
  Array.from({ length: fullStarCount }).map((_, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_icons.Icon, {
19
23
  className: "block-directory-block-ratings__star-full",
@@ -1 +1 @@
1
- {"version":3,"file":"stars.cjs","names":["sprintf","__","Icon","starFilled","starHalf","starEmpty"],"sources":["../../../src/components/block-ratings/stars.jsx"],"sourcesContent":["import { __, 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,SAAS,MAAO,EAAE,UAAW;CAC5B,MAAM,QAAQ,KAAK,MAAO,SAAS,EAAI,IAAI;CAE3C,MAAM,gBAAgB,KAAK,MAAO,MAAO;CACzC,MAAM,gBAAgB,KAAK,KAAM,SAAS,aAAc;CACxD,MAAM,iBAAiB,KAAM,gBAAgB;CAE7C,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;EACC,eAAA,GAAaA,gBAAAA,QAAAA,EAAAA,GAEZC,gBAAAA,GAAAA,CAAI,mBAAoB,GACxB,KACD;EALD,UAAA;GAOG,MAAM,KAAM,EAAE,QAAQ,cAAc,CAAE,CAAC,CAAC,KAAO,GAAG,MACnD,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,MAAD;IAEC,WAAU;IACV,MAAOC,iBAAAA;IACP,MAAO;GACP,GAJM,cAAe,GAIrB,CACA;GACA,MAAM,KAAM,EAAE,QAAQ,cAAc,CAAE,CAAC,CAAC,KAAO,GAAG,MACnD,iBAAA,GAAA,kBAAA,IAAA,CAACD,iBAAAA,MAAD;IAEC,WAAU;IACV,MAAOE,iBAAAA;IACP,MAAO;GACP,GAJM,cAAe,GAIrB,CACA;GACA,MAAM,KAAM,EAAE,QAAQ,eAAe,CAAE,CAAC,CAAC,KAAO,GAAG,MACpD,iBAAA,GAAA,kBAAA,IAAA,CAACF,iBAAAA,MAAD;IAEC,WAAU;IACV,MAAOG,iBAAAA;IACP,MAAO;GACP,GAJM,eAAgB,GAItB,CACA;EACG;;AAER"}
1
+ {"version":3,"file":"stars.cjs","names":["sprintf","__","Icon","starFilled","starHalf","starEmpty"],"sources":["../../../src/components/block-ratings/stars.jsx"],"sourcesContent":["import { __, 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,SAAS,MAAO,EAAE,UAAW;CAC5B,MAAM,QAAQ,KAAK,MAAO,SAAS,EAAI,IAAI;CAE3C,MAAM,gBAAgB,KAAK,MAAO,MAAO;CACzC,MAAM,gBAAgB,KAAK,KAAM,SAAS,aAAc;CACxD,MAAM,iBAAiB,KAAM,gBAAgB;CAE7C,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;EACC,eAAA,GAAaA,gBAAAA,QAAAA;;IAEZC,GAAAA,gBAAAA,GAAAA,CAAI,mBAAoB;GACxB;EACD;EALD,UAAA;GAOG,MAAM,KAAM,EAAE,QAAQ,cAAc,CAAE,CAAC,CAAC,KAAO,GAAG,MACnD,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,MAAD;IAEC,WAAU;IACV,MAAOC,iBAAAA;IACP,MAAO;GACP,GAJM,cAAe,GAIrB,CACA;GACA,MAAM,KAAM,EAAE,QAAQ,cAAc,CAAE,CAAC,CAAC,KAAO,GAAG,MACnD,iBAAA,GAAA,kBAAA,IAAA,CAACD,iBAAAA,MAAD;IAEC,WAAU;IACV,MAAOE,iBAAAA;IACP,MAAO;GACP,GAJM,cAAe,GAIrB,CACA;GACA,MAAM,KAAM,EAAE,QAAQ,eAAe,CAAE,CAAC,CAAC,KAAO,GAAG,MACpD,iBAAA,GAAA,kBAAA,IAAA,CAACF,iBAAAA,MAAD;IAEC,WAAU;IACV,MAAOG,iBAAAA;IACP,MAAO;GACP,GAJM,eAAgB,GAItB,CACA;EACG;;AAER"}
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
11
11
  var __getProtoOf = Object.getPrototypeOf;
12
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
- key = keys[i];
16
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
16
+ desc = __getOwnPropDesc(from, key);
17
+ __defProp(to, key, {
18
+ get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
19
+ enumerable: !desc || desc.enumerable
20
+ });
21
+ }
20
22
  }
21
23
  return to;
22
24
  };
@@ -26,8 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
28
  }) : target, mod));
27
29
  let _wordpress_i18n = require("@wordpress/i18n");
28
30
  let ___downloadable_block_icon_index_jsx = require("../downloadable-block-icon/index.cjs");
29
- ___downloadable_block_icon_index_jsx = __toESM(___downloadable_block_icon_index_jsx);
30
31
  let react_jsx_runtime = require("react/jsx-runtime");
32
+ ___downloadable_block_icon_index_jsx = __toESM(___downloadable_block_icon_index_jsx);
31
33
  // packages/block-directory/src/components/compact-list/index.jsx
32
34
  function CompactList({ items }) {
33
35
  if (!items.length) return null;
@@ -45,7 +47,11 @@ function CompactList({ items }) {
45
47
  children: title
46
48
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
47
49
  className: "block-directory-compact-list__item-author",
48
- children: (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("By %s"), author)
50
+ children: (0, _wordpress_i18n.sprintf)(
51
+ /** translators: %s: Name of the block author. */
52
+ (0, _wordpress_i18n.__)("By %s"),
53
+ author
54
+ )
49
55
  })]
50
56
  })]
51
57
  }, id))
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["DownloadableBlockIcon","sprintf","__"],"sources":["../../../src/components/compact-list/index.jsx"],"sourcesContent":["import { __, sprintf } from '@wordpress/i18n';\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,SAAwB,YAAa,EAAE,SAAU;CAChD,IAAK,CAAE,MAAM,QACZ,OAAO;CAGR,OACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;EAAI,WAAU;EACX,UAAA,MAAM,KAAO,EAAE,MAAM,IAAI,OAAO,aACjC,iBAAA,GAAA,kBAAA,KAAA,CAAC,MAAD;GAAe,WAAU;GAAzB,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAACA,qCAAAA,SAAD;IAA8B;IAAe;GAAS,CAAA,GAEtD,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;KAAK,WAAU;KACZ,UAAA;IACE,CAAA,GACL,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;KAAK,WAAU;KACZC,WAAAA,GAAAA,gBAAAA,QAAAA,EAAAA,GAEDC,gBAAAA,GAAAA,CAAI,OAAQ,GACZ,MACD;IACI,CAAA,CACD;GACF,CAAA,CAAA;EAfM,GAAA,EAeN,CACH;CACC,CAAA;AAEN"}
1
+ {"version":3,"file":"index.cjs","names":["DownloadableBlockIcon","sprintf","__"],"sources":["../../../src/components/compact-list/index.jsx"],"sourcesContent":["import { __, sprintf } from '@wordpress/i18n';\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,SAAwB,YAAa,EAAE,SAAU;CAChD,IAAK,CAAE,MAAM,QACZ,OAAO;CAGR,OACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;EAAI,WAAU;EACX,UAAA,MAAM,KAAO,EAAE,MAAM,IAAI,OAAO,aACjC,iBAAA,GAAA,kBAAA,KAAA,CAAC,MAAD;GAAe,WAAU;GAAzB,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAACA,qCAAAA,SAAD;IAA8B;IAAe;GAAS,CAAA,GAEtD,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;KAAK,WAAU;KACZ,UAAA;IACE,CAAA,GACL,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;KAAK,WAAU;KACZC,WAAAA,GAAAA,gBAAAA,QAAAA;;OAEDC,GAAAA,gBAAAA,GAAAA,CAAI,OAAQ;MACZ;KACD;IACI,CAAA,CACD;GACF,CAAA,CAAA;EAfM,GAAA,EAeN,CACH;CACC,CAAA;AAEN"}
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
11
11
  var __getProtoOf = Object.getPrototypeOf;
12
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
- key = keys[i];
16
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
16
+ desc = __getOwnPropDesc(from, key);
17
+ __defProp(to, key, {
18
+ get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
19
+ enumerable: !desc || desc.enumerable
20
+ });
21
+ }
20
22
  }
21
23
  return to;
22
24
  };
@@ -25,7 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
27
  enumerable: true
26
28
  }) : target, mod));
27
29
  let clsx = require("clsx");
28
- clsx = __toESM(clsx);
29
30
  let _wordpress_i18n = require("@wordpress/i18n");
30
31
  let _wordpress_components = require("@wordpress/components");
31
32
  let _wordpress_element = require("@wordpress/element");
@@ -34,21 +35,44 @@ let _wordpress_blocks = require("@wordpress/blocks");
34
35
  let _wordpress_data = require("@wordpress/data");
35
36
  let _wordpress_ui = require("@wordpress/ui");
36
37
  let ___block_ratings_index_jsx = require("../block-ratings/index.cjs");
37
- ___block_ratings_index_jsx = __toESM(___block_ratings_index_jsx);
38
38
  let ___downloadable_block_icon_index_jsx = require("../downloadable-block-icon/index.cjs");
39
- ___downloadable_block_icon_index_jsx = __toESM(___downloadable_block_icon_index_jsx);
40
39
  let ___downloadable_block_notice_index_jsx = require("../downloadable-block-notice/index.cjs");
41
- ___downloadable_block_notice_index_jsx = __toESM(___downloadable_block_notice_index_jsx);
42
40
  let ______store_index_js = require("../../store/index.cjs");
43
41
  let react_jsx_runtime = require("react/jsx-runtime");
42
+ clsx = __toESM(clsx);
43
+ ___block_ratings_index_jsx = __toESM(___block_ratings_index_jsx);
44
+ ___downloadable_block_icon_index_jsx = __toESM(___downloadable_block_icon_index_jsx);
45
+ ___downloadable_block_notice_index_jsx = __toESM(___downloadable_block_notice_index_jsx);
44
46
  // packages/block-directory/src/components/downloadable-block-list-item/index.jsx
45
47
  function getDownloadableBlockLabel({ title, rating, ratingCount }, { hasNotice, isInstalled, isInstalling }) {
46
48
  const stars = Math.round(rating / .5) * .5;
47
- if (!isInstalled && hasNotice) return (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("Retry installing %s."), (0, _wordpress_html_entities.decodeEntities)(title));
48
- if (isInstalled) return (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("Add %s."), (0, _wordpress_html_entities.decodeEntities)(title));
49
- if (isInstalling) return (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("Installing %s."), (0, _wordpress_html_entities.decodeEntities)(title));
50
- if (ratingCount < 1) return (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("Install %s."), (0, _wordpress_html_entities.decodeEntities)(title));
51
- return (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n._n)("Install %1$s. %2$s stars with %3$s review.", "Install %1$s. %2$s stars with %3$s reviews.", ratingCount), (0, _wordpress_html_entities.decodeEntities)(title), stars, ratingCount);
49
+ if (!isInstalled && hasNotice) return (0, _wordpress_i18n.sprintf)(
50
+ /** translators: %s: block title */
51
+ (0, _wordpress_i18n.__)("Retry installing %s."),
52
+ (0, _wordpress_html_entities.decodeEntities)(title)
53
+ );
54
+ if (isInstalled) return (0, _wordpress_i18n.sprintf)(
55
+ /** translators: %s: block title */
56
+ (0, _wordpress_i18n.__)("Add %s."),
57
+ (0, _wordpress_html_entities.decodeEntities)(title)
58
+ );
59
+ if (isInstalling) return (0, _wordpress_i18n.sprintf)(
60
+ /** translators: %s: block title */
61
+ (0, _wordpress_i18n.__)("Installing %s."),
62
+ (0, _wordpress_html_entities.decodeEntities)(title)
63
+ );
64
+ if (ratingCount < 1) return (0, _wordpress_i18n.sprintf)(
65
+ /** translators: %s: block title */
66
+ (0, _wordpress_i18n.__)("Install %s."),
67
+ (0, _wordpress_html_entities.decodeEntities)(title)
68
+ );
69
+ return (0, _wordpress_i18n.sprintf)(
70
+ /** translators: 1: block title, 2: average rating, 3: total ratings count. */
71
+ (0, _wordpress_i18n._n)("Install %1$s. %2$s stars with %3$s review.", "Install %1$s. %2$s stars with %3$s reviews.", ratingCount),
72
+ (0, _wordpress_html_entities.decodeEntities)(title),
73
+ stars,
74
+ ratingCount
75
+ );
52
76
  }
53
77
  function DownloadableBlockListItem({ item, onClick }) {
54
78
  const { author, description, icon, rating, title } = item;
@@ -95,7 +119,12 @@ function DownloadableBlockListItem({ item, onClick }) {
95
119
  className: "block-directory-downloadable-block-list-item__details",
96
120
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
97
121
  className: "block-directory-downloadable-block-list-item__title",
98
- children: (0, _wordpress_element.createInterpolateElement)((0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("%1$s <span>by %2$s</span>"), (0, _wordpress_html_entities.decodeEntities)(title), author), { span: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "block-directory-downloadable-block-list-item__author" }) })
122
+ children: (0, _wordpress_element.createInterpolateElement)((0, _wordpress_i18n.sprintf)(
123
+ /** translators: 1: block title. 2: author name. */
124
+ (0, _wordpress_i18n.__)("%1$s <span>by %2$s</span>"),
125
+ (0, _wordpress_html_entities.decodeEntities)(title),
126
+ author
127
+ ), { span: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "block-directory-downloadable-block-list-item__author" }) })
99
128
  }), hasNotice ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(___downloadable_block_notice_index_jsx.default, { block: item }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
100
129
  className: "block-directory-downloadable-block-list-item__desc",
101
130
  children: !!statusText ? statusText : (0, _wordpress_html_entities.decodeEntities)(description)
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["sprintf","__","decodeEntities","_n","getBlockType","useSelect","blockDirectoryStore","Tooltip","Composite","DownloadableBlockIcon","WCSpinner","BlockRatings","createInterpolateElement","DownloadableBlockNotice","VisuallyHidden"],"sources":["../../../src/components/downloadable-block-list-item/index.jsx"],"sourcesContent":["import clsx from 'clsx';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { Spinner as WCSpinner, Composite } from '@wordpress/components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { VisuallyHidden, Tooltip } from '@wordpress/ui';\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\treturn sprintf(\n\t\t\t/* translators: %s: block title */\n\t\t\t__( 'Retry installing %s.' ),\n\t\t\tdecodeEntities( title )\n\t\t);\n\t}\n\n\tif ( isInstalled ) {\n\t\treturn sprintf(\n\t\t\t/* translators: %s: block title */\n\t\t\t__( 'Add %s.' ),\n\t\t\tdecodeEntities( title )\n\t\t);\n\t}\n\n\tif ( isInstalling ) {\n\t\treturn sprintf(\n\t\t\t/* translators: %s: block title */\n\t\t\t__( 'Installing %s.' ),\n\t\t\tdecodeEntities( title )\n\t\t);\n\t}\n\n\t// No ratings yet, just use the title.\n\tif ( ratingCount < 1 ) {\n\t\treturn sprintf(\n\t\t\t/* translators: %s: block title */\n\t\t\t__( 'Install %s.' ),\n\t\t\tdecodeEntities( title )\n\t\t);\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.Root>\n\t\t\t<Tooltip.Trigger\n\t\t\t\trender={\n\t\t\t\t\t<Composite.Item\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'block-directory-downloadable-block-list-item',\n\t\t\t\t\t\t\tisInstalling && 'is-installing'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\tdisabled={ isInstalling || ! isInstallable }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tonClick();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\taria-label={ itemLabel }\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"block-directory-downloadable-block-list-item__icon\">\n\t\t\t\t\t\t\t<DownloadableBlockIcon\n\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ isInstalling ? (\n\t\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__spinner\">\n\t\t\t\t\t\t\t\t\t<WCSpinner />\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<BlockRatings rating={ rating } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__details\">\n\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__title\">\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: 1: block title. 2: author name. */\n\t\t\t\t\t\t\t\t\t\t__( '%1$s <span>by %2$s</span>' ),\n\t\t\t\t\t\t\t\t\t\tdecodeEntities( title ),\n\t\t\t\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tspan: (\n\t\t\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\t\t),\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</span>\n\t\t\t\t\t\t\t{ hasNotice ? (\n\t\t\t\t\t\t\t\t<DownloadableBlockNotice block={ item } />\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<>\n\t\t\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\t\t{ !! statusText\n\t\t\t\t\t\t\t\t\t\t\t? statusText\n\t\t\t\t\t\t\t\t\t\t\t: decodeEntities( description ) }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t{ isInstallable &&\n\t\t\t\t\t\t\t\t\t\t! ( isInstalled || isInstalling ) && (\n\t\t\t\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'Install block' ) }\n\t\t\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\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</span>\n\t\t\t\t\t</Composite.Item>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<Tooltip.Popup>{ itemLabel }</Tooltip.Popup>\n\t\t</Tooltip.Root>\n\t);\n}\n\nexport default DownloadableBlockListItem;\n"],"mappings":"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"}
1
+ {"version":3,"file":"index.cjs","names":["sprintf","__","decodeEntities","_n","getBlockType","useSelect","blockDirectoryStore","Tooltip","Composite","clsx","DownloadableBlockIcon","WCSpinner","BlockRatings","createInterpolateElement","DownloadableBlockNotice","VisuallyHidden"],"sources":["../../../src/components/downloadable-block-list-item/index.jsx"],"sourcesContent":["import clsx from 'clsx';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { Spinner as WCSpinner, Composite } from '@wordpress/components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { VisuallyHidden, Tooltip } from '@wordpress/ui';\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\treturn sprintf(\n\t\t\t/* translators: %s: block title */\n\t\t\t__( 'Retry installing %s.' ),\n\t\t\tdecodeEntities( title )\n\t\t);\n\t}\n\n\tif ( isInstalled ) {\n\t\treturn sprintf(\n\t\t\t/* translators: %s: block title */\n\t\t\t__( 'Add %s.' ),\n\t\t\tdecodeEntities( title )\n\t\t);\n\t}\n\n\tif ( isInstalling ) {\n\t\treturn sprintf(\n\t\t\t/* translators: %s: block title */\n\t\t\t__( 'Installing %s.' ),\n\t\t\tdecodeEntities( title )\n\t\t);\n\t}\n\n\t// No ratings yet, just use the title.\n\tif ( ratingCount < 1 ) {\n\t\treturn sprintf(\n\t\t\t/* translators: %s: block title */\n\t\t\t__( 'Install %s.' ),\n\t\t\tdecodeEntities( title )\n\t\t);\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.Root>\n\t\t\t<Tooltip.Trigger\n\t\t\t\trender={\n\t\t\t\t\t<Composite.Item\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'block-directory-downloadable-block-list-item',\n\t\t\t\t\t\t\tisInstalling && 'is-installing'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\tdisabled={ isInstalling || ! isInstallable }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tonClick();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\taria-label={ itemLabel }\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"block-directory-downloadable-block-list-item__icon\">\n\t\t\t\t\t\t\t<DownloadableBlockIcon\n\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ isInstalling ? (\n\t\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__spinner\">\n\t\t\t\t\t\t\t\t\t<WCSpinner />\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<BlockRatings rating={ rating } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__details\">\n\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__title\">\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: 1: block title. 2: author name. */\n\t\t\t\t\t\t\t\t\t\t__( '%1$s <span>by %2$s</span>' ),\n\t\t\t\t\t\t\t\t\t\tdecodeEntities( title ),\n\t\t\t\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tspan: (\n\t\t\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\t\t),\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</span>\n\t\t\t\t\t\t\t{ hasNotice ? (\n\t\t\t\t\t\t\t\t<DownloadableBlockNotice block={ item } />\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<>\n\t\t\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\t\t{ !! statusText\n\t\t\t\t\t\t\t\t\t\t\t? statusText\n\t\t\t\t\t\t\t\t\t\t\t: decodeEntities( description ) }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t{ isInstallable &&\n\t\t\t\t\t\t\t\t\t\t! ( isInstalled || isInstalling ) && (\n\t\t\t\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'Install block' ) }\n\t\t\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\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</span>\n\t\t\t\t\t</Composite.Item>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<Tooltip.Popup>{ itemLabel }</Tooltip.Popup>\n\t\t</Tooltip.Root>\n\t);\n}\n\nexport default DownloadableBlockListItem;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,0BACR,EAAE,OAAO,QAAQ,eACjB,EAAE,WAAW,aAAa,gBACzB;CACD,MAAM,QAAQ,KAAK,MAAO,SAAS,EAAI,IAAI;CAE3C,IAAK,CAAE,eAAe,WACrB,QAAA,GAAOA,gBAAAA,QAAAA;;GAENC,GAAAA,gBAAAA,GAAAA,CAAI,sBAAuB;GAC3BC,GAAAA,yBAAAA,eAAAA,CAAgB,KAAM;CACvB;CAGD,IAAK,aACJ,QAAA,GAAOF,gBAAAA,QAAAA;;GAENC,GAAAA,gBAAAA,GAAAA,CAAI,SAAU;GACdC,GAAAA,yBAAAA,eAAAA,CAAgB,KAAM;CACvB;CAGD,IAAK,cACJ,QAAA,GAAOF,gBAAAA,QAAAA;;GAENC,GAAAA,gBAAAA,GAAAA,CAAI,gBAAiB;GACrBC,GAAAA,yBAAAA,eAAAA,CAAgB,KAAM;CACvB;CAID,IAAK,cAAc,GAClB,QAAA,GAAOF,gBAAAA,QAAAA;;GAENC,GAAAA,gBAAAA,GAAAA,CAAI,aAAc;GAClBC,GAAAA,yBAAAA,eAAAA,CAAgB,KAAM;CACvB;CAGD,QAAA,GAAOF,gBAAAA,QAAAA;;GAENG,GAAAA,gBAAAA,GAAAA,CACC,8CACA,+CACA,WACD;GACAD,GAAAA,yBAAAA,eAAAA,CAAgB,KAAM;EACtB;EACA;CACD;AACD;AAEA,SAAS,0BAA2B,EAAE,MAAM,WAAY;CACvD,MAAM,EAAE,QAAQ,aAAa,MAAM,QAAQ,UAAU;CAErD,MAAM,cAAc,CAAC,EAAA,GAAEE,kBAAAA,aAAAA,CAAc,KAAK,IAAK;CAE/C,MAAM,EAAE,WAAW,cAAc,mBAAA,GAAkBC,gBAAAA,UAAAA,EAChD,WAAY;EACb,MAAM,EAAE,wBAAwB,cAAc,sBAC7C,OAAQC,qBAAAA,KAAoB;EAC7B,MAAM,SAAS,uBAAwB,KAAK,EAAG;EAC/C,MAAM,WAAW,UAAU,OAAO;EAClC,OAAO;GACN,WAAW,CAAC,CAAE;GACd,cAAc,kBAAmB,KAAK,EAAG;GACzC,eAAe,CAAE;EAClB;CACD,GACA,CAAE,IAAK,CACR;CAEA,IAAI,aAAa;CACjB,IAAK,aACJ,cAAA,GAAaL,gBAAAA,GAAAA,CAAI,YAAa;MACxB,IAAK,cACX,cAAA,GAAaA,gBAAAA,GAAAA,CAAI,aAAc;CAGhC,MAAM,YAAY,0BAA2B,MAAM;EAClD;EACA;EACA;CACD,CAAE;CAEF,OACC,iBAAA,GAAA,kBAAA,KAAA,CAACM,cAAAA,QAAQ,MAAT,EAAA,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAACA,cAAAA,QAAQ,SAAT,EACC,QACC,iBAAA,GAAA,kBAAA,KAAA,CAACC,sBAAAA,UAAU,MAAX;EACC,YAAA,GAAYC,KAAAA,QAAAA,CACX,gDACA,gBAAgB,eACjB;EACA,wBAAA;EACA,UAAW,gBAAgB,CAAE;EAC7B,UAAY,UAAW;GACtB,MAAM,eAAe;GACrB,QAAQ;EACT;EACA,cAAa;EACb,MAAK;EACL,MAAK;EAbN,UAAA,CAeC,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,qCAAAA,SAAD;IACQ;IACC;GACR,CAAA,GACC,eACD,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,WAAU;IACf,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,SAAD,CAAY,CAAA;GACP,CAAA,IAEN,iBAAA,GAAA,kBAAA,IAAA,CAACC,2BAAAA,SAAD,EAAuB,OAAU,CAAA,CAE9B;EACL,CAAA,GAAA,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,WAAU;IACbC,WAAAA,GAAAA,mBAAAA,yBAAAA,EAAAA,GACDb,gBAAAA,QAAAA;;MAECC,GAAAA,gBAAAA,GAAAA,CAAI,2BAA4B;MAChCC,GAAAA,yBAAAA,eAAAA,CAAgB,KAAM;KACtB;IACD,GACA,EACC,MACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD,EAAM,WAAU,uDAAwD,CAAA,EAE1E,CACD;GACK,CAAA,GACJ,YACD,iBAAA,GAAA,kBAAA,IAAA,CAACY,uCAAAA,SAAD,EAAyB,OAAQ,KAAQ,CAAA,IAEzC,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,WAAU;IACb,UAAA,CAAC,CAAE,aACF,cAAA,GACAZ,yBAAAA,eAAAA,CAAgB,WAAY;GAC1B,CAAA,GACJ,iBACD,EAAI,eAAe,iBAClB,iBAAA,GAAA,kBAAA,IAAA,CAACa,cAAAA,gBAAD,EAAA,WAAA,GACGd,gBAAAA,GAAAA,CAAI,eAAgB,EACP,CAAA,CAEjB,EAAA,CAAA,CAEE;EACS,CAAA,CAAA;CAEjB,CAAA,EAAA,CAAA,GACD,iBAAA,GAAA,kBAAA,IAAA,CAACM,cAAAA,QAAQ,OAAT,EAAA,UAAiB,UAA0B,CAAA,CAC9B,EAAA,CAAA;AAEhB"}
@@ -3,7 +3,6 @@ Object.defineProperties(exports, {
3
3
  __esModule: { value: true },
4
4
  [Symbol.toStringTag]: { value: "Module" }
5
5
  });
6
- let _wordpress_i18n = require("@wordpress/i18n");
7
6
  let _wordpress_data = require("@wordpress/data");
8
7
  let ______store_index_js = require("../../store/index.cjs");
9
8
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -13,9 +12,9 @@ const DownloadableBlockNotice = ({ block }) => {
13
12
  if (!errorNotice) return null;
14
13
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
15
14
  className: "block-directory-downloadable-block-notice",
16
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
15
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
17
16
  className: "block-directory-downloadable-block-notice__content",
18
- children: [errorNotice.message, errorNotice.isFatal ? " " + (0, _wordpress_i18n.__)("Try reloading the page.") : null]
17
+ children: errorNotice.message
19
18
  })
20
19
  });
21
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["useSelect","blockDirectoryStore","__"],"sources":["../../../src/components/downloadable-block-notice/index.jsx"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\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":";;;;;;;;;;AAIA,MAAa,2BAA4B,EAAE,YAAa;CACvD,MAAM,eAAA,GAAcA,gBAAAA,UAAAA,EACjB,WACD,OAAQC,qBAAAA,KAAoB,CAAC,CAAC,uBAAwB,MAAM,EAAG,GAChE,CAAE,KAAM,CACT;CAEA,IAAK,CAAE,aACN,OAAO;CAGR,OACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAU;EACd,UAAA,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACG,YAAY,SACZ,YAAY,UACX,OAAA,GAAMC,gBAAAA,GAAAA,CAAI,yBAA0B,IACpC,IACC;;CACD,CAAA;AAEP"}
1
+ {"version":3,"file":"index.cjs","names":["useSelect","blockDirectoryStore"],"sources":["../../../src/components/downloadable-block-notice/index.jsx"],"sourcesContent":["import { useSelect } from '@wordpress/data';\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</div>\n\t\t</div>\n\t);\n};\n\nexport default DownloadableBlockNotice;\n"],"mappings":";;;;;;;;;AAGA,MAAa,2BAA4B,EAAE,YAAa;CACvD,MAAM,eAAA,GAAcA,gBAAAA,UAAAA,EACjB,WACD,OAAQC,qBAAAA,KAAoB,CAAC,CAAC,uBAAwB,MAAM,EAAG,GAChE,CAAE,KAAM,CACT;CAEA,IAAK,CAAE,aACN,OAAO;CAGR,OACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAU;EACd,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,WAAU;GACZ,UAAA,YAAY;EACV,CAAA;CACD,CAAA;AAEP"}
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
11
11
  var __getProtoOf = Object.getPrototypeOf;
12
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
- key = keys[i];
16
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
16
+ desc = __getOwnPropDesc(from, key);
17
+ __defProp(to, key, {
18
+ get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
19
+ enumerable: !desc || desc.enumerable
20
+ });
21
+ }
20
22
  }
21
23
  return to;
22
24
  };
@@ -29,9 +31,9 @@ let _wordpress_components = require("@wordpress/components");
29
31
  let _wordpress_blocks = require("@wordpress/blocks");
30
32
  let _wordpress_data = require("@wordpress/data");
31
33
  let ___downloadable_block_list_item_index_jsx = require("../downloadable-block-list-item/index.cjs");
32
- ___downloadable_block_list_item_index_jsx = __toESM(___downloadable_block_list_item_index_jsx);
33
34
  let ______store_index_js = require("../../store/index.cjs");
34
35
  let react_jsx_runtime = require("react/jsx-runtime");
36
+ ___downloadable_block_list_item_index_jsx = __toESM(___downloadable_block_list_item_index_jsx);
35
37
  // packages/block-directory/src/components/downloadable-blocks-list/index.jsx
36
38
  const noop = () => {};
37
39
  function DownloadableBlocksList({ items, onHover = noop, onSelect }) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["useDispatch","blockDirectoryStore","Composite","__","DownloadableBlockListItem","getBlockType"],"sources":["../../../src/components/downloadable-blocks-list/index.jsx"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { Composite } from '@wordpress/components';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useDispatch } from '@wordpress/data';\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,aAAa,CAAC;AAEpB,SAAS,uBAAwB,EAAE,OAAO,UAAU,MAAM,YAAa;CACtE,MAAM,EAAE,sBAAA,GAAqBA,gBAAAA,YAAAA,CAAaC,qBAAAA,KAAoB;CAE9D,IAAK,CAAE,MAAM,QACZ,OAAO;CAGR,OACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,WAAD;EACC,MAAK;EACL,WAAU;EACV,eAAA,GAAaC,gBAAAA,GAAAA,CAAI,8BAA+B;EAE9C,UAAA,MAAM,KAAO,SAAU;GACxB,OACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,0CAAAA,SAAD;IAEC,eAAgB;KAIf,KAAA,GAAKC,kBAAAA,aAAAA,CAAc,KAAK,IAAK,GAC5B,SAAU,IAAK;UAEf,iBAAkB,IAAK,CAAC,CAAC,MAAQ,YAAa;MAC7C,IAAK,SACJ,SAAU,IAAK;KAEjB,CAAE;KAEH,QAAS,IAAK;IACf;IACU;IACH;GACP,GAlBM,KAAK,EAkBX;EAEH,CAAE;CACQ,CAAA;AAEb"}
1
+ {"version":3,"file":"index.cjs","names":["useDispatch","blockDirectoryStore","Composite","__","DownloadableBlockListItem","getBlockType"],"sources":["../../../src/components/downloadable-blocks-list/index.jsx"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { Composite } from '@wordpress/components';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useDispatch } from '@wordpress/data';\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,aAAa,CAAC;AAEpB,SAAS,uBAAwB,EAAE,OAAO,UAAU,MAAM,YAAa;CACtE,MAAM,EAAE,sBAAA,GAAqBA,gBAAAA,YAAAA,CAAaC,qBAAAA,KAAoB;CAE9D,IAAK,CAAE,MAAM,QACZ,OAAO;CAGR,OACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,WAAD;EACC,MAAK;EACL,WAAU;EACV,eAAA,GAAaC,gBAAAA,GAAAA,CAAI,8BAA+B;EAE9C,UAAA,MAAM,KAAO,SAAU;GACxB,OACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,0CAAAA,SAAD;IAEC,eAAgB;KAIf,KAAA,GAAKC,kBAAAA,aAAAA,CAAc,KAAK,IAAK,GAC5B,SAAU,IAAK;UAEf,iBAAkB,IAAK,CAAC,CAAC,MAAQ,YAAa;MAC7C,IAAK,SACJ,SAAU,IAAK;KAEjB,CAAE;KAEH,QAAS,IAAK;IACf;IACU;IACH;GACP,GAlBM,KAAK,EAkBX;EAEH,CAAE;CACQ,CAAA;AAEb"}
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
11
11
  var __getProtoOf = Object.getPrototypeOf;
12
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
- key = keys[i];
16
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
16
+ desc = __getOwnPropDesc(from, key);
17
+ __defProp(to, key, {
18
+ get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
19
+ enumerable: !desc || desc.enumerable
20
+ });
21
+ }
20
22
  }
21
23
  return to;
22
24
  };
@@ -30,13 +32,13 @@ let _wordpress_core_data = require("@wordpress/core-data");
30
32
  let _wordpress_data = require("@wordpress/data");
31
33
  let _wordpress_blocks = require("@wordpress/blocks");
32
34
  let ___downloadable_blocks_list_index_jsx = require("../downloadable-blocks-list/index.cjs");
33
- ___downloadable_blocks_list_index_jsx = __toESM(___downloadable_blocks_list_index_jsx);
34
35
  let __inserter_panel_jsx = require("./inserter-panel.cjs");
35
- __inserter_panel_jsx = __toESM(__inserter_panel_jsx);
36
36
  let __no_results_jsx = require("./no-results.cjs");
37
- __no_results_jsx = __toESM(__no_results_jsx);
38
37
  let ______store_index_js = require("../../store/index.cjs");
39
38
  let react_jsx_runtime = require("react/jsx-runtime");
39
+ ___downloadable_blocks_list_index_jsx = __toESM(___downloadable_blocks_list_index_jsx);
40
+ __inserter_panel_jsx = __toESM(__inserter_panel_jsx);
41
+ __no_results_jsx = __toESM(__no_results_jsx);
40
42
  // packages/block-directory/src/components/downloadable-blocks-panel/index.jsx
41
43
  const EMPTY_ARRAY = [];
42
44
  const useDownloadableBlocks = (filterValue) => (0, _wordpress_data.useSelect)((select) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["useSelect","blockDirectoryStore","coreStore","getBlockType","__","WCSpinner","DownloadableBlocksNoResults","DownloadableBlocksInserterPanel","DownloadableBlocksList"],"sources":["../../../src/components/downloadable-blocks-panel/index.jsx"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { Spinner as WCSpinner } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { getBlockType } from '@wordpress/blocks';\nimport DownloadableBlocksList from '../downloadable-blocks-list';\nimport DownloadableBlocksInserterPanel from './inserter-panel';\nimport DownloadableBlocksNoResults from './no-results';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst EMPTY_ARRAY = [];\n\nconst useDownloadableBlocks = ( filterValue ) =>\n\tuseSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetDownloadableBlocks,\n\t\t\t\tisRequestingDownloadableBlocks,\n\t\t\t\tgetInstalledBlockTypes,\n\t\t\t} = select( blockDirectoryStore );\n\n\t\t\tconst hasPermission = select( coreStore ).canUser(\n\t\t\t\t'read',\n\t\t\t\t'block-directory/search'\n\t\t\t);\n\n\t\t\tlet downloadableBlocks = EMPTY_ARRAY;\n\t\t\tif ( hasPermission ) {\n\t\t\t\tdownloadableBlocks = getDownloadableBlocks( filterValue );\n\n\t\t\t\t// Filter out blocks that are already installed.\n\t\t\t\tconst installedBlockTypes = getInstalledBlockTypes();\n\t\t\t\tconst installableBlocks = downloadableBlocks.filter(\n\t\t\t\t\t( { name } ) => {\n\t\t\t\t\t\t// Check if the block has just been installed, in which case it\n\t\t\t\t\t\t// should still show in the list to avoid suddenly disappearing.\n\t\t\t\t\t\t// `installedBlockTypes` only returns blocks stored in state\n\t\t\t\t\t\t// immediately after installation, not all installed blocks.\n\t\t\t\t\t\tconst isJustInstalled = installedBlockTypes.some(\n\t\t\t\t\t\t\t( blockType ) => blockType.name === name\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst isPreviouslyInstalled = getBlockType( name );\n\t\t\t\t\t\treturn isJustInstalled || ! isPreviouslyInstalled;\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\t// Keep identity of the `downloadableBlocks` array if nothing was filtered out\n\t\t\t\tif ( installableBlocks.length !== downloadableBlocks.length ) {\n\t\t\t\t\tdownloadableBlocks = installableBlocks;\n\t\t\t\t}\n\n\t\t\t\t// Return identical empty array when there are no blocks\n\t\t\t\tif ( downloadableBlocks.length === 0 ) {\n\t\t\t\t\tdownloadableBlocks = EMPTY_ARRAY;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\thasPermission,\n\t\t\t\tdownloadableBlocks,\n\t\t\t\tisLoading: isRequestingDownloadableBlocks( filterValue ),\n\t\t\t};\n\t\t},\n\t\t[ filterValue ]\n\t);\n\nexport default function DownloadableBlocksPanel( {\n\tonSelect,\n\tonHover,\n\thasLocalBlocks,\n\tisTyping,\n\tfilterValue,\n} ) {\n\tconst { hasPermission, downloadableBlocks, isLoading } =\n\t\tuseDownloadableBlocks( filterValue );\n\n\tif ( hasPermission === undefined || isLoading || isTyping ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ hasPermission && ! hasLocalBlocks && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__no-local\">\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'No results available from your installed blocks.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<div className=\"block-directory-downloadable-blocks-panel has-blocks-loading\">\n\t\t\t\t\t<WCSpinner />\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tif ( false === hasPermission ) {\n\t\tif ( ! hasLocalBlocks ) {\n\t\t\treturn <DownloadableBlocksNoResults />;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tif ( downloadableBlocks.length === 0 ) {\n\t\treturn hasLocalBlocks ? null : <DownloadableBlocksNoResults />;\n\t}\n\n\treturn (\n\t\t<DownloadableBlocksInserterPanel\n\t\t\tdownloadableItems={ downloadableBlocks }\n\t\t\thasLocalBlocks={ hasLocalBlocks }\n\t\t>\n\t\t\t<DownloadableBlocksList\n\t\t\t\titems={ downloadableBlocks }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tonHover={ onHover }\n\t\t\t/>\n\t\t</DownloadableBlocksInserterPanel>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,cAAc,CAAC;AAErB,MAAM,yBAA0B,iBAAA,GAC/BA,gBAAAA,UAAAA,EACG,WAAY;CACb,MAAM,EACL,uBACA,gCACA,2BACG,OAAQC,qBAAAA,KAAoB;CAEhC,MAAM,gBAAgB,OAAQC,qBAAAA,KAAU,CAAC,CAAC,QACzC,QACA,wBACD;CAEA,IAAI,qBAAqB;CACzB,IAAK,eAAgB;EACpB,qBAAqB,sBAAuB,WAAY;EAGxD,MAAM,sBAAsB,uBAAuB;EACnD,MAAM,oBAAoB,mBAAmB,QAC1C,EAAE,WAAY;GAKf,MAAM,kBAAkB,oBAAoB,MACzC,cAAe,UAAU,SAAS,IACrC;GACA,MAAM,yBAAA,GAAwBC,kBAAAA,aAAAA,CAAc,IAAK;GACjD,OAAO,mBAAmB,CAAE;EAC7B,CACD;EAGA,IAAK,kBAAkB,WAAW,mBAAmB,QACpD,qBAAqB;EAItB,IAAK,mBAAmB,WAAW,GAClC,qBAAqB;CAEvB;CAEA,OAAO;EACN;EACA;EACA,WAAW,+BAAgC,WAAY;CACxD;AACD,GACA,CAAE,WAAY,CACf;AAED,SAAwB,wBAAyB,EAChD,UACA,SACA,gBACA,UACA,eACG;CACH,MAAM,EAAE,eAAe,oBAAoB,cAC1C,sBAAuB,WAAY;CAEpC,IAAK,kBAAkB,KAAA,KAAa,aAAa,UAChD,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACG,iBAAiB,CAAE,kBACpB,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;EAAG,WAAU;EACVC,WAAAA,GAAAA,gBAAAA,GAAAA,CACD,kDACD;CACE,CAAA,GACH,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD,EAAK,WAAU,kDAAmD,CAAA,CACjE,EAAA,CAAA,GAEH,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAU;EACd,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,SAAD,CAAY,CAAA;CACR,CAAA,CACJ,EAAA,CAAA;CAIJ,IAAK,UAAU,eAAgB;EAC9B,IAAK,CAAE,gBACN,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,SAAD,CAA8B,CAAA;EAGtC,OAAO;CACR;CAEA,IAAK,mBAAmB,WAAW,GAClC,OAAO,iBAAiB,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACA,iBAAAA,SAAD,CAA8B,CAAA;CAG9D,OACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,qBAAAA,SAAD;EACC,mBAAoB;EACH;EAEjB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,sCAAAA,SAAD;GACC,OAAQ;GACG;GACD;EACV,CAAA;CAC+B,CAAA;AAEnC"}
1
+ {"version":3,"file":"index.cjs","names":["useSelect","blockDirectoryStore","coreStore","getBlockType","__","WCSpinner","DownloadableBlocksNoResults","DownloadableBlocksInserterPanel","DownloadableBlocksList"],"sources":["../../../src/components/downloadable-blocks-panel/index.jsx"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { Spinner as WCSpinner } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { getBlockType } from '@wordpress/blocks';\nimport DownloadableBlocksList from '../downloadable-blocks-list';\nimport DownloadableBlocksInserterPanel from './inserter-panel';\nimport DownloadableBlocksNoResults from './no-results';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst EMPTY_ARRAY = [];\n\nconst useDownloadableBlocks = ( filterValue ) =>\n\tuseSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetDownloadableBlocks,\n\t\t\t\tisRequestingDownloadableBlocks,\n\t\t\t\tgetInstalledBlockTypes,\n\t\t\t} = select( blockDirectoryStore );\n\n\t\t\tconst hasPermission = select( coreStore ).canUser(\n\t\t\t\t'read',\n\t\t\t\t'block-directory/search'\n\t\t\t);\n\n\t\t\tlet downloadableBlocks = EMPTY_ARRAY;\n\t\t\tif ( hasPermission ) {\n\t\t\t\tdownloadableBlocks = getDownloadableBlocks( filterValue );\n\n\t\t\t\t// Filter out blocks that are already installed.\n\t\t\t\tconst installedBlockTypes = getInstalledBlockTypes();\n\t\t\t\tconst installableBlocks = downloadableBlocks.filter(\n\t\t\t\t\t( { name } ) => {\n\t\t\t\t\t\t// Check if the block has just been installed, in which case it\n\t\t\t\t\t\t// should still show in the list to avoid suddenly disappearing.\n\t\t\t\t\t\t// `installedBlockTypes` only returns blocks stored in state\n\t\t\t\t\t\t// immediately after installation, not all installed blocks.\n\t\t\t\t\t\tconst isJustInstalled = installedBlockTypes.some(\n\t\t\t\t\t\t\t( blockType ) => blockType.name === name\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst isPreviouslyInstalled = getBlockType( name );\n\t\t\t\t\t\treturn isJustInstalled || ! isPreviouslyInstalled;\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\t// Keep identity of the `downloadableBlocks` array if nothing was filtered out\n\t\t\t\tif ( installableBlocks.length !== downloadableBlocks.length ) {\n\t\t\t\t\tdownloadableBlocks = installableBlocks;\n\t\t\t\t}\n\n\t\t\t\t// Return identical empty array when there are no blocks\n\t\t\t\tif ( downloadableBlocks.length === 0 ) {\n\t\t\t\t\tdownloadableBlocks = EMPTY_ARRAY;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\thasPermission,\n\t\t\t\tdownloadableBlocks,\n\t\t\t\tisLoading: isRequestingDownloadableBlocks( filterValue ),\n\t\t\t};\n\t\t},\n\t\t[ filterValue ]\n\t);\n\nexport default function DownloadableBlocksPanel( {\n\tonSelect,\n\tonHover,\n\thasLocalBlocks,\n\tisTyping,\n\tfilterValue,\n} ) {\n\tconst { hasPermission, downloadableBlocks, isLoading } =\n\t\tuseDownloadableBlocks( filterValue );\n\n\tif ( hasPermission === undefined || isLoading || isTyping ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ hasPermission && ! hasLocalBlocks && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__no-local\">\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'No results available from your installed blocks.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<div className=\"block-directory-downloadable-blocks-panel has-blocks-loading\">\n\t\t\t\t\t<WCSpinner />\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tif ( false === hasPermission ) {\n\t\tif ( ! hasLocalBlocks ) {\n\t\t\treturn <DownloadableBlocksNoResults />;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tif ( downloadableBlocks.length === 0 ) {\n\t\treturn hasLocalBlocks ? null : <DownloadableBlocksNoResults />;\n\t}\n\n\treturn (\n\t\t<DownloadableBlocksInserterPanel\n\t\t\tdownloadableItems={ downloadableBlocks }\n\t\t\thasLocalBlocks={ hasLocalBlocks }\n\t\t>\n\t\t\t<DownloadableBlocksList\n\t\t\t\titems={ downloadableBlocks }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tonHover={ onHover }\n\t\t\t/>\n\t\t</DownloadableBlocksInserterPanel>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,cAAc,CAAC;AAErB,MAAM,yBAA0B,iBAAA,GAC/BA,gBAAAA,UAAAA,EACG,WAAY;CACb,MAAM,EACL,uBACA,gCACA,2BACG,OAAQC,qBAAAA,KAAoB;CAEhC,MAAM,gBAAgB,OAAQC,qBAAAA,KAAU,CAAC,CAAC,QACzC,QACA,wBACD;CAEA,IAAI,qBAAqB;CACzB,IAAK,eAAgB;EACpB,qBAAqB,sBAAuB,WAAY;EAGxD,MAAM,sBAAsB,uBAAuB;EACnD,MAAM,oBAAoB,mBAAmB,QAC1C,EAAE,WAAY;GAKf,MAAM,kBAAkB,oBAAoB,MACzC,cAAe,UAAU,SAAS,IACrC;GACA,MAAM,yBAAA,GAAwBC,kBAAAA,aAAAA,CAAc,IAAK;GACjD,OAAO,mBAAmB,CAAE;EAC7B,CACD;EAGA,IAAK,kBAAkB,WAAW,mBAAmB,QACpD,qBAAqB;EAItB,IAAK,mBAAmB,WAAW,GAClC,qBAAqB;CAEvB;CAEA,OAAO;EACN;EACA;EACA,WAAW,+BAAgC,WAAY;CACxD;AACD,GACA,CAAE,WAAY,CACf;AAED,SAAwB,wBAAyB,EAChD,UACA,SACA,gBACA,UACA,eACG;CACH,MAAM,EAAE,eAAe,oBAAoB,cAC1C,sBAAuB,WAAY;CAEpC,IAAK,kBAAkB,KAAA,KAAa,aAAa,UAChD,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACG,iBAAiB,CAAE,kBACpB,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;EAAG,WAAU;EACVC,WAAAA,GAAAA,gBAAAA,GAAAA,CACD,kDACD;CACE,CAAA,GACH,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD,EAAK,WAAU,kDAAmD,CAAA,CACjE,EAAA,CAAA,GAEH,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAU;EACd,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,SAAD,CAAY,CAAA;CACR,CAAA,CACJ,EAAA,CAAA;CAIJ,IAAK,UAAU,eAAgB;EAC9B,IAAK,CAAE,gBACN,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,SAAD,CAA8B,CAAA;EAGtC,OAAO;CACR;CAEA,IAAK,mBAAmB,WAAW,GAClC,OAAO,iBAAiB,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACA,iBAAAA,SAAD,CAA8B,CAAA;CAG9D,OACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,qBAAAA,SAAD;EACC,mBAAoB;EACH;EAEjB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,sCAAAA,SAAD;GACC,OAAQ;GACG;GACD;EACV,CAAA;CAC+B,CAAA;AAEnC"}
@@ -11,7 +11,11 @@ let react_jsx_runtime = require("react/jsx-runtime");
11
11
  function DownloadableBlocksInserterPanel({ children, downloadableItems, hasLocalBlocks }) {
12
12
  const count = downloadableItems.length;
13
13
  (0, _wordpress_element.useEffect)(() => {
14
- (0, _wordpress_a11y.speak)((0, _wordpress_i18n.sprintf)((0, _wordpress_i18n._n)("%d additional block is available to install.", "%d additional blocks are available to install.", count), count));
14
+ (0, _wordpress_a11y.speak)((0, _wordpress_i18n.sprintf)(
15
+ /** translators: %d: number of available blocks. */
16
+ (0, _wordpress_i18n._n)("%d additional block is available to install.", "%d additional blocks are available to install.", count),
17
+ count
18
+ ));
15
19
  }, [count]);
16
20
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
17
21
  !hasLocalBlocks && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
@@ -1 +1 @@
1
- {"version":3,"file":"inserter-panel.cjs","names":["sprintf","_n","__"],"sources":["../../../src/components/downloadable-blocks-panel/inserter-panel.jsx"],"sourcesContent":["import { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\n\nfunction DownloadableBlocksInserterPanel( {\n\tchildren,\n\tdownloadableItems,\n\thasLocalBlocks,\n} ) {\n\tconst count = downloadableItems.length;\n\tuseEffect( () => {\n\t\tspeak(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %d: number of available blocks. */\n\t\t\t\t_n(\n\t\t\t\t\t'%d additional block is available to install.',\n\t\t\t\t\t'%d additional blocks are available to install.',\n\t\t\t\t\tcount\n\t\t\t\t),\n\t\t\t\tcount\n\t\t\t)\n\t\t);\n\t}, [ count ] );\n\n\treturn (\n\t\t<>\n\t\t\t{ ! hasLocalBlocks && (\n\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__no-local\">\n\t\t\t\t\t{ __( 'No results available from your installed blocks.' ) }\n\t\t\t\t</p>\n\t\t\t) }\n\n\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\n\t\t\t<div className=\"block-directory-downloadable-blocks-panel\">\n\t\t\t\t<div className=\"block-directory-downloadable-blocks-panel__header\">\n\t\t\t\t\t<h2 className=\"block-directory-downloadable-blocks-panel__title\">\n\t\t\t\t\t\t{ __( 'Available to install' ) }\n\t\t\t\t\t</h2>\n\t\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__description\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select a block to install and add it to your post.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default DownloadableBlocksInserterPanel;\n"],"mappings":";;;;;;;;;;AAIA,SAAS,gCAAiC,EACzC,UACA,mBACA,kBACG;CACH,MAAM,QAAQ,kBAAkB;CAChC,CAAA,GAAA,mBAAA,UAAA,OAAiB;EAChB,CAAA,GAAA,gBAAA,MAAA,EAAA,GACCA,gBAAAA,QAAAA,EAAAA,GAECC,gBAAAA,GAAAA,CACC,gDACA,kDACA,KACD,GACA,KACD,CACD;CACD,GAAG,CAAE,KAAM,CAAE;CAEb,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA;EACG,CAAE,kBACH,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;GAAG,WAAU;GACVC,WAAAA,GAAAA,gBAAAA,GAAAA,CAAI,kDAAmD;EACvD,CAAA;EAGJ,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD,EAAK,WAAU,kDAAmD,CAAA;EAElE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACC,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;KAAI,WAAU;KACXA,WAAAA,GAAAA,gBAAAA,GAAAA,CAAI,sBAAuB;IAC1B,CAAA,GACJ,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;KAAG,WAAU;KACVA,WAAAA,GAAAA,gBAAAA,GAAAA,CACD,oDACD;IACE,CAAA,CACC;GACH,CAAA,GAAA,QACE;;CACJ,EAAA,CAAA;AAEJ"}
1
+ {"version":3,"file":"inserter-panel.cjs","names":["useEffect","speak","sprintf","_n","__"],"sources":["../../../src/components/downloadable-blocks-panel/inserter-panel.jsx"],"sourcesContent":["import { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\n\nfunction DownloadableBlocksInserterPanel( {\n\tchildren,\n\tdownloadableItems,\n\thasLocalBlocks,\n} ) {\n\tconst count = downloadableItems.length;\n\tuseEffect( () => {\n\t\tspeak(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %d: number of available blocks. */\n\t\t\t\t_n(\n\t\t\t\t\t'%d additional block is available to install.',\n\t\t\t\t\t'%d additional blocks are available to install.',\n\t\t\t\t\tcount\n\t\t\t\t),\n\t\t\t\tcount\n\t\t\t)\n\t\t);\n\t}, [ count ] );\n\n\treturn (\n\t\t<>\n\t\t\t{ ! hasLocalBlocks && (\n\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__no-local\">\n\t\t\t\t\t{ __( 'No results available from your installed blocks.' ) }\n\t\t\t\t</p>\n\t\t\t) }\n\n\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\n\t\t\t<div className=\"block-directory-downloadable-blocks-panel\">\n\t\t\t\t<div className=\"block-directory-downloadable-blocks-panel__header\">\n\t\t\t\t\t<h2 className=\"block-directory-downloadable-blocks-panel__title\">\n\t\t\t\t\t\t{ __( 'Available to install' ) }\n\t\t\t\t\t</h2>\n\t\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__description\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select a block to install and add it to your post.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default DownloadableBlocksInserterPanel;\n"],"mappings":";;;;;;;;;;AAIA,SAAS,gCAAiC,EACzC,UACA,mBACA,kBACG;CACH,MAAM,QAAQ,kBAAkB;CAChCA,CAAAA,GAAAA,mBAAAA,UAAAA,OAAiB;EAChBC,CAAAA,GAAAA,gBAAAA,MAAAA,EAAAA,GACCC,gBAAAA,QAAAA;;IAECC,GAAAA,gBAAAA,GAAAA,CACC,gDACA,kDACA,KACD;GACA;EACD,CACD;CACD,GAAG,CAAE,KAAM,CAAE;CAEb,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA;EACG,CAAE,kBACH,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;GAAG,WAAU;GACVC,WAAAA,GAAAA,gBAAAA,GAAAA,CAAI,kDAAmD;EACvD,CAAA;EAGJ,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD,EAAK,WAAU,kDAAmD,CAAA;EAElE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACC,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;KAAI,WAAU;KACXA,WAAAA,GAAAA,gBAAAA,GAAAA,CAAI,sBAAuB;IAC1B,CAAA,GACJ,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;KAAG,WAAU;KACVA,WAAAA,GAAAA,gBAAAA,GAAAA,CACD,oDACD;IACE,CAAA,CACC;GACH,CAAA,GAAA,QACE;;CACJ,EAAA,CAAA;AAEJ"}
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
11
11
  var __getProtoOf = Object.getPrototypeOf;
12
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
- key = keys[i];
16
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
16
+ desc = __getOwnPropDesc(from, key);
17
+ __defProp(to, key, {
18
+ get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
19
+ enumerable: !desc || desc.enumerable
20
+ });
21
+ }
20
22
  }
21
23
  return to;
22
24
  };
@@ -32,9 +34,9 @@ let _wordpress_data = require("@wordpress/data");
32
34
  let _wordpress_core_data = require("@wordpress/core-data");
33
35
  let _wordpress_block_editor = require("@wordpress/block-editor");
34
36
  let __install_button_jsx = require("./install-button.cjs");
35
- __install_button_jsx = __toESM(__install_button_jsx);
36
37
  let ______store_index_js = require("../../store/index.cjs");
37
38
  let react_jsx_runtime = require("react/jsx-runtime");
39
+ __install_button_jsx = __toESM(__install_button_jsx);
38
40
  // packages/block-directory/src/plugins/get-install-missing/index.jsx
39
41
  const getInstallMissing = (OriginalComponent) => (props) => {
40
42
  const { originalName } = props.attributes;
@@ -63,14 +65,22 @@ const ModifiedWarning = ({ originalBlock, ...props }) => {
63
65
  const { canInsertBlockType, getBlockRootClientId } = select(_wordpress_block_editor.store);
64
66
  return canInsertBlockType("core/html", getBlockRootClientId(clientId));
65
67
  }, [clientId]);
66
- let messageHTML = (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely."), originalBlock.title || originalName);
68
+ let messageHTML = (0, _wordpress_i18n.sprintf)(
69
+ /** translators: %s: block name */
70
+ (0, _wordpress_i18n.__)("Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely."),
71
+ originalBlock.title || originalName
72
+ );
67
73
  const actions = [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__install_button_jsx.default, {
68
74
  block: originalBlock,
69
75
  attributes: props.attributes,
70
76
  clientId: props.clientId
71
77
  }, "install")];
72
78
  if (hasContent && hasHTMLBlock) {
73
- messageHTML = (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely."), originalBlock.title || originalName);
79
+ messageHTML = (0, _wordpress_i18n.sprintf)(
80
+ /** translators: %s: block name */
81
+ (0, _wordpress_i18n.__)("Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely."),
82
+ originalBlock.title || originalName
83
+ );
74
84
  actions.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.Button, {
75
85
  __next40pxDefaultSize: true,
76
86
  onClick: convertToHTML,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["useSelect","blockDirectoryStore","coreStore","useDispatch","blockEditorStore","createBlock","sprintf","__","InstallButton","Button","useBlockProps","Warning","RawHTML"],"sources":["../../../src/plugins/get-install-missing/index.jsx"],"sourcesContent":["import { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { RawHTML } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport InstallButton from './install-button';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst getInstallMissing = ( OriginalComponent ) => ( props ) => {\n\tconst { originalName } = props.attributes;\n\tconst { block, hasPermission } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getDownloadableBlocks } = select( blockDirectoryStore );\n\t\t\tconst blocks = getDownloadableBlocks(\n\t\t\t\t'block:' + originalName\n\t\t\t).filter( ( { name } ) => originalName === name );\n\t\t\treturn {\n\t\t\t\thasPermission: select( coreStore ).canUser(\n\t\t\t\t\t'read',\n\t\t\t\t\t'block-directory/search'\n\t\t\t\t),\n\t\t\t\tblock: blocks.length && blocks[ 0 ],\n\t\t\t};\n\t\t},\n\t\t[ originalName ]\n\t);\n\n\t// The user can't install blocks, or the block isn't available for download.\n\tif ( ! hasPermission || ! block ) {\n\t\treturn <OriginalComponent { ...props } />;\n\t}\n\n\treturn <ModifiedWarning { ...props } originalBlock={ block } />;\n};\n\nconst ModifiedWarning = ( { originalBlock, ...props } ) => {\n\tconst { originalName, originalUndelimitedContent, clientId } =\n\t\tprops.attributes;\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\tconst convertToHTML = () => {\n\t\treplaceBlock(\n\t\t\tprops.clientId,\n\t\t\tcreateBlock( 'core/html', {}, [], [ originalUndelimitedContent ] )\n\t\t);\n\t};\n\n\tconst hasContent = !! originalUndelimitedContent;\n\tconst hasHTMLBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canInsertBlockType, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn canInsertBlockType(\n\t\t\t\t'core/html',\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tlet messageHTML = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__(\n\t\t\t'Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely.'\n\t\t),\n\t\toriginalBlock.title || originalName\n\t);\n\tconst actions = [\n\t\t<InstallButton\n\t\t\tkey=\"install\"\n\t\t\tblock={ originalBlock }\n\t\t\tattributes={ props.attributes }\n\t\t\tclientId={ props.clientId }\n\t\t/>,\n\t];\n\n\tif ( hasContent && hasHTMLBlock ) {\n\t\tmessageHTML = sprintf(\n\t\t\t/* translators: %s: block name */\n\t\t\t__(\n\t\t\t\t'Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely.'\n\t\t\t),\n\t\t\toriginalBlock.title || originalName\n\t\t);\n\t\tactions.push(\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tkey=\"convert\"\n\t\t\t\tonClick={ convertToHTML }\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t>\n\t\t\t\t{ __( 'Keep as HTML' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div { ...useBlockProps() }>\n\t\t\t<Warning actions={ actions }>{ messageHTML }</Warning>\n\t\t\t<RawHTML>{ originalUndelimitedContent }</RawHTML>\n\t\t</div>\n\t);\n};\n\nexport default getInstallMissing;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAM,qBAAsB,uBAAyB,UAAW;CAC/D,MAAM,EAAE,iBAAiB,MAAM;CAC/B,MAAM,EAAE,OAAO,mBAAA,GAAkBA,gBAAAA,UAAAA,EAC9B,WAAY;EACb,MAAM,EAAE,0BAA0B,OAAQC,qBAAAA,KAAoB;EAC9D,MAAM,SAAS,sBACd,WAAW,YACZ,CAAC,CAAC,QAAU,EAAE,WAAY,iBAAiB,IAAK;EAChD,OAAO;GACN,eAAe,OAAQC,qBAAAA,KAAU,CAAC,CAAC,QAClC,QACA,wBACD;GACA,OAAO,OAAO,UAAU,OAAQ;EACjC;CACD,GACA,CAAE,YAAa,CAChB;CAGA,IAAK,CAAE,iBAAiB,CAAE,OACzB,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,mBAAD,EAAmB,GAAK,MAAS,CAAA;CAGzC,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAD;EAAiB,GAAK;EAAQ,eAAgB;CAAS,CAAA;AAC/D;AAEA,MAAM,mBAAoB,EAAE,eAAe,GAAG,YAAa;CAC1D,MAAM,EAAE,cAAc,4BAA4B,aACjD,MAAM;CACP,MAAM,EAAE,kBAAA,GAAiBC,gBAAAA,YAAAA,CAAaC,wBAAAA,KAAiB;CACvD,MAAM,sBAAsB;EAC3B,aACC,MAAM,WAAA,GACNC,kBAAAA,YAAAA,CAAa,aAAa,CAAC,GAAG,CAAC,GAAG,CAAE,0BAA2B,CAAE,CAClE;CACD;CAEA,MAAM,aAAa,CAAC,CAAE;CACtB,MAAM,gBAAA,GAAeL,gBAAAA,UAAAA,EAClB,WAAY;EACb,MAAM,EAAE,oBAAoB,yBAC3B,OAAQI,wBAAAA,KAAiB;EAE1B,OAAO,mBACN,aACA,qBAAsB,QAAS,CAChC;CACD,GACA,CAAE,QAAS,CACZ;CAEA,IAAI,eAAA,GAAcE,gBAAAA,QAAAA,EAAAA,GAEjBC,gBAAAA,GAAAA,CACC,6GACD,GACA,cAAc,SAAS,YACxB;CACA,MAAM,UAAU,CACf,iBAAA,GAAA,kBAAA,IAAA,CAACC,qBAAAA,SAAD;EAEC,OAAQ;EACR,YAAa,MAAM;EACnB,UAAW,MAAM;CACjB,GAJI,SAIJ,CACF;CAEA,IAAK,cAAc,cAAe;EACjC,eAAA,GAAcF,gBAAAA,QAAAA,EAAAA,GAEbC,gBAAAA,GAAAA,CACC,iJACD,GACA,cAAc,SAAS,YACxB;EACA,QAAQ,KACP,iBAAA,GAAA,kBAAA,IAAA,CAACE,sBAAAA,QAAD;GACC,uBAAA;GAEA,SAAU;GACV,SAAQ;GAENF,WAAAA,GAAAA,gBAAAA,GAAAA,CAAI,cAAe;EACd,GALH,SAKG,CACT;CACD;CAEA,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,IAAA,GAAKG,wBAAAA,cAAAA,CAAc;EAAxB,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,SAAD;GAAmB;GAAY,UAAA;EAAsB,CAAA,GACrD,iBAAA,GAAA,kBAAA,IAAA,CAACC,mBAAAA,SAAD,EAAA,UAAW,2BAAqC,CAAA,CAC5C;;AAEP"}
1
+ {"version":3,"file":"index.cjs","names":["useSelect","blockDirectoryStore","coreStore","useDispatch","blockEditorStore","createBlock","sprintf","__","InstallButton","Button","useBlockProps","Warning","RawHTML"],"sources":["../../../src/plugins/get-install-missing/index.jsx"],"sourcesContent":["import { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { RawHTML } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport InstallButton from './install-button';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst getInstallMissing = ( OriginalComponent ) => ( props ) => {\n\tconst { originalName } = props.attributes;\n\tconst { block, hasPermission } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getDownloadableBlocks } = select( blockDirectoryStore );\n\t\t\tconst blocks = getDownloadableBlocks(\n\t\t\t\t'block:' + originalName\n\t\t\t).filter( ( { name } ) => originalName === name );\n\t\t\treturn {\n\t\t\t\thasPermission: select( coreStore ).canUser(\n\t\t\t\t\t'read',\n\t\t\t\t\t'block-directory/search'\n\t\t\t\t),\n\t\t\t\tblock: blocks.length && blocks[ 0 ],\n\t\t\t};\n\t\t},\n\t\t[ originalName ]\n\t);\n\n\t// The user can't install blocks, or the block isn't available for download.\n\tif ( ! hasPermission || ! block ) {\n\t\treturn <OriginalComponent { ...props } />;\n\t}\n\n\treturn <ModifiedWarning { ...props } originalBlock={ block } />;\n};\n\nconst ModifiedWarning = ( { originalBlock, ...props } ) => {\n\tconst { originalName, originalUndelimitedContent, clientId } =\n\t\tprops.attributes;\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\tconst convertToHTML = () => {\n\t\treplaceBlock(\n\t\t\tprops.clientId,\n\t\t\tcreateBlock( 'core/html', {}, [], [ originalUndelimitedContent ] )\n\t\t);\n\t};\n\n\tconst hasContent = !! originalUndelimitedContent;\n\tconst hasHTMLBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canInsertBlockType, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn canInsertBlockType(\n\t\t\t\t'core/html',\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tlet messageHTML = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__(\n\t\t\t'Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely.'\n\t\t),\n\t\toriginalBlock.title || originalName\n\t);\n\tconst actions = [\n\t\t<InstallButton\n\t\t\tkey=\"install\"\n\t\t\tblock={ originalBlock }\n\t\t\tattributes={ props.attributes }\n\t\t\tclientId={ props.clientId }\n\t\t/>,\n\t];\n\n\tif ( hasContent && hasHTMLBlock ) {\n\t\tmessageHTML = sprintf(\n\t\t\t/* translators: %s: block name */\n\t\t\t__(\n\t\t\t\t'Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely.'\n\t\t\t),\n\t\t\toriginalBlock.title || originalName\n\t\t);\n\t\tactions.push(\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tkey=\"convert\"\n\t\t\t\tonClick={ convertToHTML }\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t>\n\t\t\t\t{ __( 'Keep as HTML' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div { ...useBlockProps() }>\n\t\t\t<Warning actions={ actions }>{ messageHTML }</Warning>\n\t\t\t<RawHTML>{ originalUndelimitedContent }</RawHTML>\n\t\t</div>\n\t);\n};\n\nexport default getInstallMissing;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAM,qBAAsB,uBAAyB,UAAW;CAC/D,MAAM,EAAE,iBAAiB,MAAM;CAC/B,MAAM,EAAE,OAAO,mBAAA,GAAkBA,gBAAAA,UAAAA,EAC9B,WAAY;EACb,MAAM,EAAE,0BAA0B,OAAQC,qBAAAA,KAAoB;EAC9D,MAAM,SAAS,sBACd,WAAW,YACZ,CAAC,CAAC,QAAU,EAAE,WAAY,iBAAiB,IAAK;EAChD,OAAO;GACN,eAAe,OAAQC,qBAAAA,KAAU,CAAC,CAAC,QAClC,QACA,wBACD;GACA,OAAO,OAAO,UAAU,OAAQ;EACjC;CACD,GACA,CAAE,YAAa,CAChB;CAGA,IAAK,CAAE,iBAAiB,CAAE,OACzB,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,mBAAD,EAAmB,GAAK,MAAS,CAAA;CAGzC,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAD;EAAiB,GAAK;EAAQ,eAAgB;CAAS,CAAA;AAC/D;AAEA,MAAM,mBAAoB,EAAE,eAAe,GAAG,YAAa;CAC1D,MAAM,EAAE,cAAc,4BAA4B,aACjD,MAAM;CACP,MAAM,EAAE,kBAAA,GAAiBC,gBAAAA,YAAAA,CAAaC,wBAAAA,KAAiB;CACvD,MAAM,sBAAsB;EAC3B,aACC,MAAM,WAAA,GACNC,kBAAAA,YAAAA,CAAa,aAAa,CAAC,GAAG,CAAC,GAAG,CAAE,0BAA2B,CAAE,CAClE;CACD;CAEA,MAAM,aAAa,CAAC,CAAE;CACtB,MAAM,gBAAA,GAAeL,gBAAAA,UAAAA,EAClB,WAAY;EACb,MAAM,EAAE,oBAAoB,yBAC3B,OAAQI,wBAAAA,KAAiB;EAE1B,OAAO,mBACN,aACA,qBAAsB,QAAS,CAChC;CACD,GACA,CAAE,QAAS,CACZ;CAEA,IAAI,eAAA,GAAcE,gBAAAA,QAAAA;;GAEjBC,GAAAA,gBAAAA,GAAAA,CACC,6GACD;EACA,cAAc,SAAS;CACxB;CACA,MAAM,UAAU,CACf,iBAAA,GAAA,kBAAA,IAAA,CAACC,qBAAAA,SAAD;EAEC,OAAQ;EACR,YAAa,MAAM;EACnB,UAAW,MAAM;CACjB,GAJI,SAIJ,CACF;CAEA,IAAK,cAAc,cAAe;EACjC,eAAA,GAAcF,gBAAAA,QAAAA;;IAEbC,GAAAA,gBAAAA,GAAAA,CACC,iJACD;GACA,cAAc,SAAS;EACxB;EACA,QAAQ,KACP,iBAAA,GAAA,kBAAA,IAAA,CAACE,sBAAAA,QAAD;GACC,uBAAA;GAEA,SAAU;GACV,SAAQ;GAENF,WAAAA,GAAAA,gBAAAA,GAAAA,CAAI,cAAe;EACd,GALH,SAKG,CACT;CACD;CAEA,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,IAAA,GAAKG,wBAAAA,cAAAA,CAAc;EAAxB,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,SAAD;GAAmB;GAAY,UAAA;EAAsB,CAAA,GACrD,iBAAA,GAAA,kBAAA,IAAA,CAACC,mBAAAA,SAAD,EAAA,UAAW,2BAAqC,CAAA,CAC5C;;AAEP"}
@@ -28,7 +28,11 @@ function InstallButton({ attributes, block, clientId }) {
28
28
  disabled: isInstallingBlock,
29
29
  isBusy: isInstallingBlock,
30
30
  variant: "primary",
31
- children: (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("Install %s"), block.title)
31
+ children: (0, _wordpress_i18n.sprintf)(
32
+ /** translators: %s: block name */
33
+ (0, _wordpress_i18n.__)("Install %s"),
34
+ block.title
35
+ )
32
36
  });
33
37
  }
34
38
  exports.default = InstallButton;
@@ -1 +1 @@
1
- {"version":3,"file":"install-button.cjs","names":["useSelect","blockDirectoryStore","useDispatch","blockEditorStore","Button","getBlockType","parse","createBlock","sprintf","__"],"sources":["../../../src/plugins/get-install-missing/install-button.jsx"],"sourcesContent":["import { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createBlock, getBlockType, parse } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function InstallButton( { attributes, block, clientId } ) {\n\tconst isInstallingBlock = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).isInstalling( block.id ),\n\t\t[ block.id ]\n\t);\n\tconst { installBlockType } = useDispatch( blockDirectoryStore );\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tonClick={ () =>\n\t\t\t\tinstallBlockType( block ).then( ( success ) => {\n\t\t\t\t\tif ( success ) {\n\t\t\t\t\t\tconst blockType = getBlockType( block.name );\n\t\t\t\t\t\tconst [ originalBlock ] = parse(\n\t\t\t\t\t\t\tattributes.originalContent\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( originalBlock && blockType ) {\n\t\t\t\t\t\t\treplaceBlock(\n\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\tblockType.name,\n\t\t\t\t\t\t\t\t\toriginalBlock.attributes,\n\t\t\t\t\t\t\t\t\toriginalBlock.innerBlocks\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} )\n\t\t\t}\n\t\t\taccessibleWhenDisabled\n\t\t\tdisabled={ isInstallingBlock }\n\t\t\tisBusy={ isInstallingBlock }\n\t\t\tvariant=\"primary\"\n\t\t>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: %s: block name */\n\t\t\t\t__( 'Install %s' ),\n\t\t\t\tblock.title\n\t\t\t) }\n\t\t</Button>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;AAOA,SAAwB,cAAe,EAAE,YAAY,OAAO,YAAa;CACxE,MAAM,qBAAA,GAAoBA,gBAAAA,UAAAA,EACvB,WAAY,OAAQC,qBAAAA,KAAoB,CAAC,CAAC,aAAc,MAAM,EAAG,GACnE,CAAE,MAAM,EAAG,CACZ;CACA,MAAM,EAAE,sBAAA,GAAqBC,gBAAAA,YAAAA,CAAaD,qBAAAA,KAAoB;CAC9D,MAAM,EAAE,kBAAA,GAAiBC,gBAAAA,YAAAA,CAAaC,wBAAAA,KAAiB;CAEvD,OACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,QAAD;EACC,uBAAA;EACA,eACC,iBAAkB,KAAM,CAAC,CAAC,MAAQ,YAAa;GAC9C,IAAK,SAAU;IACd,MAAM,aAAA,GAAYC,kBAAAA,aAAAA,CAAc,MAAM,IAAK;IAC3C,MAAM,CAAE,kBAAA,GAAkBC,kBAAAA,MAAAA,CACzB,WAAW,eACZ;IACA,IAAK,iBAAiB,WACrB,aACC,WAAA,GACAC,kBAAAA,YAAAA,CACC,UAAU,MACV,cAAc,YACd,cAAc,WACf,CACD;GAEF;EACD,CAAE;EAEH,wBAAA;EACA,UAAW;EACX,QAAS;EACT,SAAQ;EAENC,WAAAA,GAAAA,gBAAAA,QAAAA,EAAAA,GAEDC,gBAAAA,GAAAA,CAAI,YAAa,GACjB,MAAM,KACP;CACO,CAAA;AAEV"}
1
+ {"version":3,"file":"install-button.cjs","names":["useSelect","blockDirectoryStore","useDispatch","blockEditorStore","Button","getBlockType","parse","createBlock","sprintf","__"],"sources":["../../../src/plugins/get-install-missing/install-button.jsx"],"sourcesContent":["import { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createBlock, getBlockType, parse } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function InstallButton( { attributes, block, clientId } ) {\n\tconst isInstallingBlock = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).isInstalling( block.id ),\n\t\t[ block.id ]\n\t);\n\tconst { installBlockType } = useDispatch( blockDirectoryStore );\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tonClick={ () =>\n\t\t\t\tinstallBlockType( block ).then( ( success ) => {\n\t\t\t\t\tif ( success ) {\n\t\t\t\t\t\tconst blockType = getBlockType( block.name );\n\t\t\t\t\t\tconst [ originalBlock ] = parse(\n\t\t\t\t\t\t\tattributes.originalContent\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( originalBlock && blockType ) {\n\t\t\t\t\t\t\treplaceBlock(\n\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\tblockType.name,\n\t\t\t\t\t\t\t\t\toriginalBlock.attributes,\n\t\t\t\t\t\t\t\t\toriginalBlock.innerBlocks\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} )\n\t\t\t}\n\t\t\taccessibleWhenDisabled\n\t\t\tdisabled={ isInstallingBlock }\n\t\t\tisBusy={ isInstallingBlock }\n\t\t\tvariant=\"primary\"\n\t\t>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: %s: block name */\n\t\t\t\t__( 'Install %s' ),\n\t\t\t\tblock.title\n\t\t\t) }\n\t\t</Button>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;AAOA,SAAwB,cAAe,EAAE,YAAY,OAAO,YAAa;CACxE,MAAM,qBAAA,GAAoBA,gBAAAA,UAAAA,EACvB,WAAY,OAAQC,qBAAAA,KAAoB,CAAC,CAAC,aAAc,MAAM,EAAG,GACnE,CAAE,MAAM,EAAG,CACZ;CACA,MAAM,EAAE,sBAAA,GAAqBC,gBAAAA,YAAAA,CAAaD,qBAAAA,KAAoB;CAC9D,MAAM,EAAE,kBAAA,GAAiBC,gBAAAA,YAAAA,CAAaC,wBAAAA,KAAiB;CAEvD,OACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,QAAD;EACC,uBAAA;EACA,eACC,iBAAkB,KAAM,CAAC,CAAC,MAAQ,YAAa;GAC9C,IAAK,SAAU;IACd,MAAM,aAAA,GAAYC,kBAAAA,aAAAA,CAAc,MAAM,IAAK;IAC3C,MAAM,CAAE,kBAAA,GAAkBC,kBAAAA,MAAAA,CACzB,WAAW,eACZ;IACA,IAAK,iBAAiB,WACrB,aACC,WAAA,GACAC,kBAAAA,YAAAA,CACC,UAAU,MACV,cAAc,YACd,cAAc,WACf,CACD;GAEF;EACD,CAAE;EAEH,wBAAA;EACA,UAAW;EACX,QAAS;EACT,SAAQ;EAENC,WAAAA,GAAAA,gBAAAA,QAAAA;;IAEDC,GAAAA,gBAAAA,GAAAA,CAAI,YAAa;GACjB,MAAM;EACP;CACO,CAAA;AAEV"}