@wordpress/block-directory 4.16.0 → 4.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/auto-block-uninstaller/index.js +1 -6
  3. package/build/components/auto-block-uninstaller/index.js.map +1 -1
  4. package/build/components/block-ratings/index.js +1 -5
  5. package/build/components/block-ratings/index.js.map +1 -1
  6. package/build/components/block-ratings/stars.js +2 -7
  7. package/build/components/block-ratings/stars.js.map +1 -1
  8. package/build/components/compact-list/index.js +2 -8
  9. package/build/components/compact-list/index.js.map +1 -1
  10. package/build/components/downloadable-block-icon/index.js +1 -4
  11. package/build/components/downloadable-block-icon/index.js.map +1 -1
  12. package/build/components/downloadable-block-list-item/index.js +7 -28
  13. package/build/components/downloadable-block-list-item/index.js.map +1 -1
  14. package/build/components/downloadable-block-notice/index.js +1 -8
  15. package/build/components/downloadable-block-notice/index.js.map +1 -1
  16. package/build/components/downloadable-blocks-list/index.js +3 -15
  17. package/build/components/downloadable-blocks-list/index.js.map +1 -1
  18. package/build/components/downloadable-blocks-panel/index.js +1 -25
  19. package/build/components/downloadable-blocks-panel/index.js.map +1 -1
  20. package/build/components/downloadable-blocks-panel/inserter-panel.js +2 -7
  21. package/build/components/downloadable-blocks-panel/inserter-panel.js.map +1 -1
  22. package/build/components/downloadable-blocks-panel/no-results.js +1 -6
  23. package/build/components/downloadable-blocks-panel/no-results.js.map +1 -1
  24. package/build/index.js +0 -2
  25. package/build/index.js.map +1 -1
  26. package/build/plugins/get-install-missing/index.js +13 -28
  27. package/build/plugins/get-install-missing/index.js.map +1 -1
  28. package/build/plugins/get-install-missing/install-button.js +2 -11
  29. package/build/plugins/get-install-missing/install-button.js.map +1 -1
  30. package/build/plugins/index.js +1 -10
  31. package/build/plugins/index.js.map +1 -1
  32. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js +1 -9
  33. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +1 -1
  34. package/build/plugins/installed-blocks-pre-publish-panel/index.js +2 -13
  35. package/build/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
  36. package/build/store/actions.js +26 -46
  37. package/build/store/actions.js.map +1 -1
  38. package/build/store/index.js +2 -11
  39. package/build/store/index.js.map +1 -1
  40. package/build/store/load-assets.js +6 -12
  41. package/build/store/load-assets.js.map +1 -1
  42. package/build/store/reducer.js +16 -25
  43. package/build/store/reducer.js.map +1 -1
  44. package/build/store/resolvers.js +1 -7
  45. package/build/store/resolvers.js.map +1 -1
  46. package/build/store/selectors.js +7 -20
  47. package/build/store/selectors.js.map +1 -1
  48. package/build/store/utils/get-plugin-url.js +0 -4
  49. package/build/store/utils/get-plugin-url.js.map +1 -1
  50. package/build/store/utils/has-block-type.js +0 -4
  51. package/build/store/utils/has-block-type.js.map +1 -1
  52. package/build-module/components/auto-block-uninstaller/index.js +1 -1
  53. package/build-module/components/auto-block-uninstaller/index.js.map +1 -1
  54. package/build-module/components/block-ratings/index.js +0 -1
  55. package/build-module/components/block-ratings/index.js.map +1 -1
  56. package/build-module/components/block-ratings/stars.js +1 -5
  57. package/build-module/components/block-ratings/stars.js.map +1 -1
  58. package/build-module/components/compact-list/index.js +2 -5
  59. package/build-module/components/compact-list/index.js.map +1 -1
  60. package/build-module/components/downloadable-block-icon/index.js +0 -3
  61. package/build-module/components/downloadable-block-icon/index.js.map +1 -1
  62. package/build-module/components/downloadable-block-list-item/index.js +9 -19
  63. package/build-module/components/downloadable-block-list-item/index.js.map +1 -1
  64. package/build-module/components/downloadable-block-notice/index.js +1 -4
  65. package/build-module/components/downloadable-block-notice/index.js.map +1 -1
  66. package/build-module/components/downloadable-blocks-list/index.js +3 -9
  67. package/build-module/components/downloadable-blocks-list/index.js.map +1 -1
  68. package/build-module/components/downloadable-blocks-panel/index.js +1 -13
  69. package/build-module/components/downloadable-blocks-panel/index.js.map +1 -1
  70. package/build-module/components/downloadable-blocks-panel/inserter-panel.js +1 -5
  71. package/build-module/components/downloadable-blocks-panel/inserter-panel.js.map +1 -1
  72. package/build-module/components/downloadable-blocks-panel/no-results.js +0 -3
  73. package/build-module/components/downloadable-blocks-panel/no-results.js.map +1 -1
  74. package/build-module/index.js.map +1 -1
  75. package/build-module/plugins/get-install-missing/index.js +13 -20
  76. package/build-module/plugins/get-install-missing/index.js.map +1 -1
  77. package/build-module/plugins/get-install-missing/install-button.js +2 -5
  78. package/build-module/plugins/get-install-missing/install-button.js.map +1 -1
  79. package/build-module/plugins/index.js +1 -4
  80. package/build-module/plugins/index.js.map +1 -1
  81. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js +1 -6
  82. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +1 -1
  83. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js +6 -8
  84. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
  85. package/build-module/store/actions.js +28 -30
  86. package/build-module/store/actions.js.map +1 -1
  87. package/build-module/store/index.js +4 -4
  88. package/build-module/store/index.js.map +1 -1
  89. package/build-module/store/load-assets.js +7 -8
  90. package/build-module/store/load-assets.js.map +1 -1
  91. package/build-module/store/reducer.js +17 -17
  92. package/build-module/store/reducer.js.map +1 -1
  93. package/build-module/store/resolvers.js +2 -3
  94. package/build-module/store/resolvers.js.map +1 -1
  95. package/build-module/store/selectors.js +9 -11
  96. package/build-module/store/selectors.js.map +1 -1
  97. package/build-module/store/utils/get-plugin-url.js +0 -3
  98. package/build-module/store/utils/get-plugin-url.js.map +1 -1
  99. package/build-module/store/utils/has-block-type.js +0 -3
  100. package/build-module/store/utils/has-block-type.js.map +1 -1
  101. package/package.json +20 -20
  102. package/src/components/downloadable-block-list-item/test/index.js +1 -1
@@ -1,5 +1,4 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -7,15 +6,13 @@ import { __ } from '@wordpress/i18n';
7
6
  import { __unstableComposite as Composite, __unstableUseCompositeState as useCompositeState } from '@wordpress/components';
8
7
  import { getBlockType } from '@wordpress/blocks';
9
8
  import { useDispatch } from '@wordpress/data';
9
+
10
10
  /**
11
11
  * Internal dependencies
12
12
  */
13
-
14
13
  import DownloadableBlockListItem from '../downloadable-block-list-item';
15
14
  import { store as blockDirectoryStore } from '../../store';
16
-
17
15
  const noop = () => {};
18
-
19
16
  function DownloadableBlocksList({
20
17
  items,
21
18
  onHover = noop,
@@ -25,12 +22,11 @@ function DownloadableBlocksList({
25
22
  const {
26
23
  installBlockType
27
24
  } = useDispatch(blockDirectoryStore);
28
-
29
25
  if (!items.length) {
30
26
  return null;
31
27
  }
32
-
33
- return createElement(Composite, { ...composite,
28
+ return createElement(Composite, {
29
+ ...composite,
34
30
  role: "listbox",
35
31
  className: "block-directory-downloadable-blocks-list",
36
32
  "aria-label": __('Blocks available for install')
@@ -51,7 +47,6 @@ function DownloadableBlocksList({
51
47
  }
52
48
  });
53
49
  }
54
-
55
50
  onHover(null);
56
51
  },
57
52
  onHover: onHover,
@@ -59,6 +54,5 @@ function DownloadableBlocksList({
59
54
  });
60
55
  }));
61
56
  }
62
-
63
57
  export default DownloadableBlocksList;
64
58
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-list/index.js"],"names":["__","__unstableComposite","Composite","__unstableUseCompositeState","useCompositeState","getBlockType","useDispatch","DownloadableBlockListItem","store","blockDirectoryStore","noop","DownloadableBlocksList","items","onHover","onSelect","composite","installBlockType","length","map","item","id","name","then","success"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,mBAAmB,IAAIC,SADxB,EAECC,2BAA2B,IAAIC,iBAFhC,QAGO,uBAHP;AAIA,SAASC,YAAT,QAA6B,mBAA7B;AACA,SAASC,WAAT,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,yBAAP,MAAsC,iCAAtC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t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n} from '@wordpress/components';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlockListItem from '../downloadable-block-list-item';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst noop = () => {};\n\nfunction DownloadableBlocksList( { items, onHover = noop, onSelect } ) {\n\tconst composite = useCompositeState();\n\tconst { installBlockType } = useDispatch( blockDirectoryStore );\n\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Composite\n\t\t\t{ ...composite }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-directory-downloadable-blocks-list\"\n\t\t\taria-label={ __( 'Blocks available for install' ) }\n\t\t>\n\t\t\t{ items.map( ( item ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<DownloadableBlockListItem\n\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\tcomposite={ composite }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t// Check if the block is registered (`getBlockType`\n\t\t\t\t\t\t\t// will return an object). If so, insert the block.\n\t\t\t\t\t\t\t// This prevents installing existing plugins.\n\t\t\t\t\t\t\tif ( getBlockType( item.name ) ) {\n\t\t\t\t\t\t\t\tonSelect( item );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tinstallBlockType( item ).then( ( success ) => {\n\t\t\t\t\t\t\t\t\tif ( success ) {\n\t\t\t\t\t\t\t\t\t\tonSelect( item );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonHover( null );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\titem={ item }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Composite>\n\t);\n}\n\nexport default DownloadableBlocksList;\n"]}
1
+ {"version":3,"names":["__","__unstableComposite","Composite","__unstableUseCompositeState","useCompositeState","getBlockType","useDispatch","DownloadableBlockListItem","store","blockDirectoryStore","noop","DownloadableBlocksList","items","onHover","onSelect","composite","installBlockType","length","createElement","role","className","map","item","key","id","onClick","name","then","success"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n} from '@wordpress/components';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlockListItem from '../downloadable-block-list-item';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst noop = () => {};\n\nfunction DownloadableBlocksList( { items, onHover = noop, onSelect } ) {\n\tconst composite = useCompositeState();\n\tconst { installBlockType } = useDispatch( blockDirectoryStore );\n\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Composite\n\t\t\t{ ...composite }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-directory-downloadable-blocks-list\"\n\t\t\taria-label={ __( 'Blocks available for install' ) }\n\t\t>\n\t\t\t{ items.map( ( item ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<DownloadableBlockListItem\n\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\tcomposite={ composite }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t// Check if the block is registered (`getBlockType`\n\t\t\t\t\t\t\t// will return an object). If so, insert the block.\n\t\t\t\t\t\t\t// This prevents installing existing plugins.\n\t\t\t\t\t\t\tif ( getBlockType( item.name ) ) {\n\t\t\t\t\t\t\t\tonSelect( item );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tinstallBlockType( item ).then( ( success ) => {\n\t\t\t\t\t\t\t\t\tif ( success ) {\n\t\t\t\t\t\t\t\t\t\tonSelect( item );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonHover( null );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\titem={ item }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Composite>\n\t);\n}\n\nexport default DownloadableBlocksList;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SACCC,mBAAmB,IAAIC,SAAS,EAChCC,2BAA2B,IAAIC,iBAAiB,QAC1C,uBAAuB;AAC9B,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,SAASC,KAAK,IAAIC,mBAAmB,QAAQ,aAAa;AAE1D,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,SAASC,sBAAsBA,CAAE;EAAEC,KAAK;EAAEC,OAAO,GAAGH,IAAI;EAAEI;AAAS,CAAC,EAAG;EACtE,MAAMC,SAAS,GAAGX,iBAAiB,CAAC,CAAC;EACrC,MAAM;IAAEY;EAAiB,CAAC,GAAGV,WAAW,CAAEG,mBAAoB,CAAC;EAE/D,IAAK,CAAEG,KAAK,CAACK,MAAM,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,OACCC,aAAA,CAAChB,SAAS;IAAA,GACJa,SAAS;IACdI,IAAI,EAAC,SAAS;IACdC,SAAS,EAAC,0CAA0C;IACpD,cAAapB,EAAE,CAAE,8BAA+B;EAAG,GAEjDY,KAAK,CAACS,GAAG,CAAIC,IAAI,IAAM;IACxB,OACCJ,aAAA,CAACX,yBAAyB;MACzBgB,GAAG,EAAGD,IAAI,CAACE,EAAI;MACfT,SAAS,EAAGA,SAAW;MACvBU,OAAO,EAAGA,CAAA,KAAM;QACf;QACA;QACA;QACA,IAAKpB,YAAY,CAAEiB,IAAI,CAACI,IAAK,CAAC,EAAG;UAChCZ,QAAQ,CAAEQ,IAAK,CAAC;QACjB,CAAC,MAAM;UACNN,gBAAgB,CAAEM,IAAK,CAAC,CAACK,IAAI,CAAIC,OAAO,IAAM;YAC7C,IAAKA,OAAO,EAAG;cACdd,QAAQ,CAAEQ,IAAK,CAAC;YACjB;UACD,CAAE,CAAC;QACJ;QACAT,OAAO,CAAE,IAAK,CAAC;MAChB,CAAG;MACHA,OAAO,EAAGA,OAAS;MACnBS,IAAI,EAAGA;IAAM,CACb,CAAC;EAEJ,CAAE,CACQ,CAAC;AAEd;AAEA,eAAeX,sBAAsB"}
@@ -1,5 +1,4 @@
1
1
  import { createElement, Fragment } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -9,16 +8,15 @@ import { compose } from '@wordpress/compose';
9
8
  import { store as blockEditorStore } from '@wordpress/block-editor';
10
9
  import { store as coreStore } from '@wordpress/core-data';
11
10
  import { withSelect } from '@wordpress/data';
11
+
12
12
  /**
13
13
  * Internal dependencies
14
14
  */
15
-
16
15
  import DownloadableBlocksList from '../downloadable-blocks-list';
17
16
  import DownloadableBlocksInserterPanel from './inserter-panel';
18
17
  import DownloadableBlocksNoResults from './no-results';
19
18
  import { store as blockDirectoryStore } from '../../store';
20
19
  const EMPTY_ARRAY = [];
21
-
22
20
  function DownloadableBlocksPanel({
23
21
  downloadableItems,
24
22
  onSelect,
@@ -37,15 +35,12 @@ function DownloadableBlocksPanel({
37
35
  className: "block-directory-downloadable-blocks-panel has-blocks-loading"
38
36
  }, createElement(Spinner, null)));
39
37
  }
40
-
41
38
  if (false === hasPermission) {
42
39
  if (!hasLocalBlocks) {
43
40
  return createElement(DownloadableBlocksNoResults, null);
44
41
  }
45
-
46
42
  return null;
47
43
  }
48
-
49
44
  return !!downloadableItems.length ? createElement(DownloadableBlocksInserterPanel, {
50
45
  downloadableItems: downloadableItems,
51
46
  hasLocalBlocks: hasLocalBlocks
@@ -55,7 +50,6 @@ function DownloadableBlocksPanel({
55
50
  onHover: onHover
56
51
  })) : !hasLocalBlocks && createElement(DownloadableBlocksNoResults, null);
57
52
  }
58
-
59
53
  export default compose([withSelect((select, {
60
54
  filterValue,
61
55
  rootClientId = null
@@ -68,24 +62,18 @@ export default compose([withSelect((select, {
68
62
  canInsertBlockType
69
63
  } = select(blockEditorStore);
70
64
  const hasPermission = select(coreStore).canUser('read', 'block-directory/search');
71
-
72
65
  function getInstallableBlocks(term) {
73
66
  const downloadableBlocks = getDownloadableBlocks(term);
74
67
  const installableBlocks = downloadableBlocks.filter(block => canInsertBlockType(block, rootClientId, true));
75
-
76
68
  if (downloadableBlocks.length === installableBlocks.length) {
77
69
  return downloadableBlocks;
78
70
  }
79
-
80
71
  return installableBlocks;
81
72
  }
82
-
83
73
  let downloadableItems = hasPermission ? getInstallableBlocks(filterValue) : [];
84
-
85
74
  if (downloadableItems.length === 0) {
86
75
  downloadableItems = EMPTY_ARRAY;
87
76
  }
88
-
89
77
  const isLoading = isRequestingDownloadableBlocks(filterValue);
90
78
  return {
91
79
  downloadableItems,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/index.js"],"names":["__","Spinner","compose","store","blockEditorStore","coreStore","withSelect","DownloadableBlocksList","DownloadableBlocksInserterPanel","DownloadableBlocksNoResults","blockDirectoryStore","EMPTY_ARRAY","DownloadableBlocksPanel","downloadableItems","onSelect","onHover","hasLocalBlocks","hasPermission","isLoading","isTyping","length","select","filterValue","rootClientId","getDownloadableBlocks","isRequestingDownloadableBlocks","canInsertBlockType","canUser","getInstallableBlocks","term","downloadableBlocks","installableBlocks","filter","block"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,OAAT,QAAwB,uBAAxB;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SA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AAO,CAAE,CACvBI,UAAU,CAAE,CAAEe,MAAF,EAAU;AAAEC,EAAAA,WAAF;AAAeC,EAAAA,YAAY,GAAG;AAA9B,CAAV,KAAoD;AAC/D,QAAM;AAAEC,IAAAA,qBAAF;AAAyBC,IAAAA;AAAzB,MACLJ,MAAM,CAAEX,mBAAF,CADP;AAEA,QAAM;AAAEgB,IAAAA;AAAF,MAAyBL,MAAM,CAAEjB,gBAAF,CAArC;AAEA,QAAMa,aAAa,GAAGI,MAAM,CAAEhB,SAAF,CAAN,CAAoBsB,OAApB,CACrB,MADqB,EAErB,wBAFqB,CAAtB;;AAKA,WAASC,oBAAT,CAA+BC,IAA/B,EAAsC;AACrC,UAAMC,kBAAkB,GAAGN,qBAAqB,CAAEK,IAAF,CAAhD;AACA,UAAME,iBAAiB,GAAGD,kBAAkB,CAACE,MAAnB,CAA6BC,KAAF,IACpDP,kBAAkB,CAAEO,KAAF,EAASV,YAAT,EAAuB,IAAvB,CADO,CAA1B;;AAIA,QAAKO,kBAAkB,CAACV,MAAnB,KAA8BW,iBAAiB,CAACX,MAArD,EAA8D;AAC7D,aAAOU,kBAAP;AACA;;AACD,WAAOC,iBAAP;AACA;;AAED,MAAIlB,iBAAiB,GAAGI,aAAa,GAClCW,oBAAoB,CAAEN,WAAF,CADc,GAElC,EAFH;;AAIA,MAAKT,iBAAiB,CAACO,MAAlB,KAA6B,CAAlC,EAAsC;AACrCP,IAAAA,iBAAiB,GAAGF,WAApB;AACA;;AAED,QAAMO,SAAS,GAAGO,8BAA8B,CAAEH,WAAF,CAAhD;AAEA,SAAO;AACNT,IAAAA,iBADM;AAENI,IAAAA,aAFM;AAGNC,IAAAA;AAHM,GAAP;AAKA,CArCS,CADa,CAAF,CAAP,CAuCVN,uBAvCU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Spinner } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\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\nfunction DownloadableBlocksPanel( {\n\tdownloadableItems,\n\tonSelect,\n\tonHover,\n\thasLocalBlocks,\n\thasPermission,\n\tisLoading,\n\tisTyping,\n} ) {\n\tif ( typeof 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<Spinner />\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\treturn !! downloadableItems.length ? (\n\t\t<DownloadableBlocksInserterPanel\n\t\t\tdownloadableItems={ downloadableItems }\n\t\t\thasLocalBlocks={ hasLocalBlocks }\n\t\t>\n\t\t\t<DownloadableBlocksList\n\t\t\t\titems={ downloadableItems }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tonHover={ onHover }\n\t\t\t/>\n\t\t</DownloadableBlocksInserterPanel>\n\t) : (\n\t\t! hasLocalBlocks && <DownloadableBlocksNoResults />\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select, { filterValue, rootClientId = null } ) => {\n\t\tconst { getDownloadableBlocks, isRequestingDownloadableBlocks } =\n\t\t\tselect( blockDirectoryStore );\n\t\tconst { canInsertBlockType } = select( blockEditorStore );\n\n\t\tconst hasPermission = select( coreStore ).canUser(\n\t\t\t'read',\n\t\t\t'block-directory/search'\n\t\t);\n\n\t\tfunction getInstallableBlocks( term ) {\n\t\t\tconst downloadableBlocks = getDownloadableBlocks( term );\n\t\t\tconst installableBlocks = downloadableBlocks.filter( ( block ) =>\n\t\t\t\tcanInsertBlockType( block, rootClientId, true )\n\t\t\t);\n\n\t\t\tif ( downloadableBlocks.length === installableBlocks.length ) {\n\t\t\t\treturn downloadableBlocks;\n\t\t\t}\n\t\t\treturn installableBlocks;\n\t\t}\n\n\t\tlet downloadableItems = hasPermission\n\t\t\t? getInstallableBlocks( filterValue )\n\t\t\t: [];\n\n\t\tif ( downloadableItems.length === 0 ) {\n\t\t\tdownloadableItems = EMPTY_ARRAY;\n\t\t}\n\n\t\tconst isLoading = isRequestingDownloadableBlocks( filterValue );\n\n\t\treturn {\n\t\t\tdownloadableItems,\n\t\t\thasPermission,\n\t\t\tisLoading,\n\t\t};\n\t} ),\n] )( DownloadableBlocksPanel );\n"]}
1
+ {"version":3,"names":["__","Spinner","compose","store","blockEditorStore","coreStore","withSelect","DownloadableBlocksList","DownloadableBlocksInserterPanel","DownloadableBlocksNoResults","blockDirectoryStore","EMPTY_ARRAY","DownloadableBlocksPanel","downloadableItems","onSelect","onHover","hasLocalBlocks","hasPermission","isLoading","isTyping","createElement","Fragment","className","length","items","select","filterValue","rootClientId","getDownloadableBlocks","isRequestingDownloadableBlocks","canInsertBlockType","canUser","getInstallableBlocks","term","downloadableBlocks","installableBlocks","filter","block"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Spinner } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\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\nfunction DownloadableBlocksPanel( {\n\tdownloadableItems,\n\tonSelect,\n\tonHover,\n\thasLocalBlocks,\n\thasPermission,\n\tisLoading,\n\tisTyping,\n} ) {\n\tif ( typeof 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<Spinner />\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\treturn !! downloadableItems.length ? (\n\t\t<DownloadableBlocksInserterPanel\n\t\t\tdownloadableItems={ downloadableItems }\n\t\t\thasLocalBlocks={ hasLocalBlocks }\n\t\t>\n\t\t\t<DownloadableBlocksList\n\t\t\t\titems={ downloadableItems }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tonHover={ onHover }\n\t\t\t/>\n\t\t</DownloadableBlocksInserterPanel>\n\t) : (\n\t\t! hasLocalBlocks && <DownloadableBlocksNoResults />\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select, { filterValue, rootClientId = null } ) => {\n\t\tconst { getDownloadableBlocks, isRequestingDownloadableBlocks } =\n\t\t\tselect( blockDirectoryStore );\n\t\tconst { canInsertBlockType } = select( blockEditorStore );\n\n\t\tconst hasPermission = select( coreStore ).canUser(\n\t\t\t'read',\n\t\t\t'block-directory/search'\n\t\t);\n\n\t\tfunction getInstallableBlocks( term ) {\n\t\t\tconst downloadableBlocks = getDownloadableBlocks( term );\n\t\t\tconst installableBlocks = downloadableBlocks.filter( ( block ) =>\n\t\t\t\tcanInsertBlockType( block, rootClientId, true )\n\t\t\t);\n\n\t\t\tif ( downloadableBlocks.length === installableBlocks.length ) {\n\t\t\t\treturn downloadableBlocks;\n\t\t\t}\n\t\t\treturn installableBlocks;\n\t\t}\n\n\t\tlet downloadableItems = hasPermission\n\t\t\t? getInstallableBlocks( filterValue )\n\t\t\t: [];\n\n\t\tif ( downloadableItems.length === 0 ) {\n\t\t\tdownloadableItems = EMPTY_ARRAY;\n\t\t}\n\n\t\tconst isLoading = isRequestingDownloadableBlocks( filterValue );\n\n\t\treturn {\n\t\t\tdownloadableItems,\n\t\t\thasPermission,\n\t\t\tisLoading,\n\t\t};\n\t} ),\n] )( DownloadableBlocksPanel );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;AACzD,SAASC,UAAU,QAAQ,iBAAiB;;AAE5C;AACA;AACA;AACA,OAAOC,sBAAsB,MAAM,6BAA6B;AAChE,OAAOC,+BAA+B,MAAM,kBAAkB;AAC9D,OAAOC,2BAA2B,MAAM,cAAc;AACtD,SAASN,KAAK,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M,CAAEf,mBAAoB,CAAC;EAC9B,MAAM;IAAEoB;EAAmB,CAAC,GAAGL,MAAM,CAAErB,gBAAiB,CAAC;EAEzD,MAAMa,aAAa,GAAGQ,MAAM,CAAEpB,SAAU,CAAC,CAAC0B,OAAO,CAChD,MAAM,EACN,wBACD,CAAC;EAED,SAASC,oBAAoBA,CAAEC,IAAI,EAAG;IACrC,MAAMC,kBAAkB,GAAGN,qBAAqB,CAAEK,IAAK,CAAC;IACxD,MAAME,iBAAiB,GAAGD,kBAAkB,CAACE,MAAM,CAAIC,KAAK,IAC3DP,kBAAkB,CAAEO,KAAK,EAAEV,YAAY,EAAE,IAAK,CAC/C,CAAC;IAED,IAAKO,kBAAkB,CAACX,MAAM,KAAKY,iBAAiB,CAACZ,MAAM,EAAG;MAC7D,OAAOW,kBAAkB;IAC1B;IACA,OAAOC,iBAAiB;EACzB;EAEA,IAAItB,iBAAiB,GAAGI,aAAa,GAClCe,oBAAoB,CAAEN,WAAY,CAAC,GACnC,EAAE;EAEL,IAAKb,iBAAiB,CAACU,MAAM,KAAK,CAAC,EAAG;IACrCV,iBAAiB,GAAGF,WAAW;EAChC;EAEA,MAAMO,SAAS,GAAGW,8BAA8B,CAAEH,WAAY,CAAC;EAE/D,OAAO;IACNb,iBAAiB;IACjBI,aAAa;IACbC;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAEN,uBAAwB,CAAC"}
@@ -1,12 +1,10 @@
1
1
  import { createElement, Fragment } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
6
5
  import { __, _n, sprintf } from '@wordpress/i18n';
7
6
  import { useEffect } from '@wordpress/element';
8
7
  import { speak } from '@wordpress/a11y';
9
-
10
8
  function DownloadableBlocksInserterPanel({
11
9
  children,
12
10
  downloadableItems,
@@ -14,8 +12,7 @@ function DownloadableBlocksInserterPanel({
14
12
  }) {
15
13
  const count = downloadableItems.length;
16
14
  useEffect(() => {
17
- speak(sprintf(
18
- /* translators: %d: number of available blocks. */
15
+ speak(sprintf( /* translators: %d: number of available blocks. */
19
16
  _n('%d additional block is available to install.', '%d additional blocks are available to install.', count), count));
20
17
  }, [count]);
21
18
  return createElement(Fragment, null, !hasLocalBlocks && createElement("p", {
@@ -32,6 +29,5 @@ function DownloadableBlocksInserterPanel({
32
29
  className: "block-directory-downloadable-blocks-panel__description"
33
30
  }, __('Select a block to install and add it to your post.'))), children));
34
31
  }
35
-
36
32
  export default DownloadableBlocksInserterPanel;
37
33
  //# sourceMappingURL=inserter-panel.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/inserter-panel.js"],"names":["__","_n","sprintf","useEffect","speak","DownloadableBlocksInserterPanel","children","downloadableItems","hasLocalBlocks","count","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,KAAT,QAAsB,iBAAtB;;AAEA,SAASC,+BAAT,CAA0C;AACzCC,EAAAA,QADyC;AAEzCC,EAAAA,iBAFyC;AAGzCC,EAAAA;AAHyC,CAA1C,EAII;AACH,QAAMC,KAAK,GAAGF,iBAAiB,CAACG,MAAhC;AACAP,EAAAA,SAAS,CAAE,MAAM;AAChBC,IAAAA,KAAK,CACJF,OAAO;AACN;AACAD,IAAAA,EAAE,CACD,8CADC,EAED,gDAFC,EAGDQ,KAHC,CAFI,EAONA,KAPM,CADH,CAAL;AAWA,GAZQ,EAYN,CAAEA,KAAF,CAZM,CAAT;AAcA,SACC,8BACG,CAAED,cAAF,IACD;AAAG,IAAA,SAAS,EAAC;AAAb,KACGR,EAAE,CAAE,kDAAF,CADL,CAFF,EAOC;AAAK,IAAA,SAAS,EAAC;AAAf,IAPD,EASC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGA,EAAE,CAAE,sBAAF,CADL,CADD,EAIC;AAAG,IAAA,SAAS,EAAC;AAAb,KACGA,EAAE,CACH,oDADG,CADL,CAJD,CADD,EAWGM,QAXH,CATD,CADD;AAyBA;;AAED,eAAeD,+BAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _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"]}
1
+ {"version":3,"names":["__","_n","sprintf","useEffect","speak","DownloadableBlocksInserterPanel","children","downloadableItems","hasLocalBlocks","count","length","createElement","Fragment","className"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/inserter-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _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":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,KAAK,QAAQ,iBAAiB;AAEvC,SAASC,+BAA+BA,CAAE;EACzCC,QAAQ;EACRC,iBAAiB;EACjBC;AACD,CAAC,EAAG;EACH,MAAMC,KAAK,GAAGF,iBAAiB,CAACG,MAAM;EACtCP,SAAS,CAAE,MAAM;IAChBC,KAAK,CACJF,OAAO,EACN;IACAD,EAAE,CACD,8CAA8C,EAC9C,gDAAgD,EAChDQ,KACD,CAAC,EACDA,KACD,CACD,CAAC;EACF,CAAC,EAAE,CAAEA,KAAK,CAAG,CAAC;EAEd,OACCE,aAAA,CAAAC,QAAA,QACG,CAAEJ,cAAc,IACjBG,aAAA;IAAGE,SAAS,EAAC;EAAqD,GAC/Db,EAAE,CAAE,kDAAmD,CACvD,CACH,EAEDW,aAAA;IAAKE,SAAS,EAAC;EAAiD,CAAE,CAAC,EAEnEF,aAAA;IAAKE,SAAS,EAAC;EAA2C,GACzDF,aAAA;IAAKE,SAAS,EAAC;EAAmD,GACjEF,aAAA;IAAIE,SAAS,EAAC;EAAkD,GAC7Db,EAAE,CAAE,sBAAuB,CAC1B,CAAC,EACLW,aAAA;IAAGE,SAAS,EAAC;EAAwD,GAClEb,EAAE,CACH,oDACD,CACE,CACC,CAAC,EACJM,QACE,CACJ,CAAC;AAEL;AAEA,eAAeD,+BAA+B"}
@@ -1,12 +1,10 @@
1
1
  import { createElement, Fragment } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
6
5
  import { __ } from '@wordpress/i18n';
7
6
  import { Icon, blockDefault } from '@wordpress/icons';
8
7
  import { Tip, ExternalLink } from '@wordpress/components';
9
-
10
8
  function DownloadableBlocksNoResults() {
11
9
  return createElement(Fragment, null, createElement("div", {
12
10
  className: "block-editor-inserter__no-results"
@@ -19,6 +17,5 @@ function DownloadableBlocksNoResults() {
19
17
  href: "https://developer.wordpress.org/block-editor/"
20
18
  }, __('Get started here'), "."))));
21
19
  }
22
-
23
20
  export default DownloadableBlocksNoResults;
24
21
  //# sourceMappingURL=no-results.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/no-results.js"],"names":["__","Icon","blockDefault","Tip","ExternalLink","DownloadableBlocksNoResults"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,IAAT,EAAeC,YAAf,QAAmC,kBAAnC;AACA,SAASC,GAAT,EAAcC,YAAd,QAAkC,uBAAlC;;AAEA,SAASC,2BAAT,GAAuC;AACtC,SACC,8BACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,IAAD;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,IAAI,EAAGH;AAFR,IADD,EAKC,yBAAKF,EAAE,CAAE,mBAAF,CAAP,CALD,CADD,EAQC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,GAAD,QACGA,EAAE,CAAE,wCAAF,CADL,EAEC,yBAFD,EAGC,cAAC,YAAD;AAAc,IAAA,IAAI,EAAC;AAAnB,KACGA,EAAE,CAAE,kBAAF,CADL,MAHD,CADD,CARD,CADD;AAoBA;;AAED,eAAeK,2BAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, blockDefault } from '@wordpress/icons';\nimport { Tip, ExternalLink } from '@wordpress/components';\n\nfunction DownloadableBlocksNoResults() {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"block-editor-inserter__no-results\">\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"block-editor-inserter__no-results-icon\"\n\t\t\t\t\ticon={ blockDefault }\n\t\t\t\t/>\n\t\t\t\t<p>{ __( 'No results found.' ) }</p>\n\t\t\t</div>\n\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t<Tip>\n\t\t\t\t\t{ __( 'Interested in creating your own block?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink href=\"https://developer.wordpress.org/block-editor/\">\n\t\t\t\t\t\t{ __( 'Get started here' ) }.\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</Tip>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default DownloadableBlocksNoResults;\n"]}
1
+ {"version":3,"names":["__","Icon","blockDefault","Tip","ExternalLink","DownloadableBlocksNoResults","createElement","Fragment","className","icon","href"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/no-results.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, blockDefault } from '@wordpress/icons';\nimport { Tip, ExternalLink } from '@wordpress/components';\n\nfunction DownloadableBlocksNoResults() {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"block-editor-inserter__no-results\">\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"block-editor-inserter__no-results-icon\"\n\t\t\t\t\ticon={ blockDefault }\n\t\t\t\t/>\n\t\t\t\t<p>{ __( 'No results found.' ) }</p>\n\t\t\t</div>\n\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t<Tip>\n\t\t\t\t\t{ __( 'Interested in creating your own block?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink href=\"https://developer.wordpress.org/block-editor/\">\n\t\t\t\t\t\t{ __( 'Get started here' ) }.\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</Tip>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default DownloadableBlocksNoResults;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,YAAY,QAAQ,kBAAkB;AACrD,SAASC,GAAG,EAAEC,YAAY,QAAQ,uBAAuB;AAEzD,SAASC,2BAA2BA,CAAA,EAAG;EACtC,OACCC,aAAA,CAAAC,QAAA,QACCD,aAAA;IAAKE,SAAS,EAAC;EAAmC,GACjDF,aAAA,CAACL,IAAI;IACJO,SAAS,EAAC,wCAAwC;IAClDC,IAAI,EAAGP;EAAc,CACrB,CAAC,EACFI,aAAA,YAAKN,EAAE,CAAE,mBAAoB,CAAM,CAC/B,CAAC,EACNM,aAAA;IAAKE,SAAS,EAAC;EAA6B,GAC3CF,aAAA,CAACH,GAAG,QACDH,EAAE,CAAE,wCAAyC,CAAC,EAChDM,aAAA,WAAK,CAAC,EACNA,aAAA,CAACF,YAAY;IAACM,IAAI,EAAC;EAA+C,GAC/DV,EAAE,CAAE,kBAAmB,CAAC,EAAE,GACf,CACV,CACD,CACJ,CAAC;AAEL;AAEA,eAAeK,2BAA2B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/index.js"],"names":["store"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,WAAP;AAEA,SAASA,KAAT,QAAsB,SAAtB","sourcesContent":["/**\n * Internal dependencies\n */\nimport './plugins';\n\nexport { store } from './store';\n"]}
1
+ {"version":3,"names":["store"],"sources":["@wordpress/block-directory/src/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './plugins';\n\nexport { store } from './store';\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,WAAW;AAElB,SAASA,KAAK,QAAQ,SAAS"}
@@ -1,5 +1,4 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -10,19 +9,18 @@ import { RawHTML } from '@wordpress/element';
10
9
  import { useDispatch, useSelect } from '@wordpress/data';
11
10
  import { store as coreStore } from '@wordpress/core-data';
12
11
  import { Warning, useBlockProps, store as blockEditorStore } from '@wordpress/block-editor';
12
+
13
13
  /**
14
14
  * Internal dependencies
15
15
  */
16
-
17
16
  import InstallButton from './install-button';
18
17
  import { store as blockDirectoryStore } from '../../store';
19
-
20
18
  const getInstallMissing = OriginalComponent => props => {
21
19
  const {
22
20
  originalName
23
- } = props.attributes; // Disable reason: This is a valid component, but it's mistaken for a callback.
21
+ } = props.attributes;
22
+ // Disable reason: This is a valid component, but it's mistaken for a callback.
24
23
  // eslint-disable-next-line react-hooks/rules-of-hooks
25
-
26
24
  const {
27
25
  block,
28
26
  hasPermission
@@ -37,18 +35,19 @@ const getInstallMissing = OriginalComponent => props => {
37
35
  hasPermission: select(coreStore).canUser('read', 'block-directory/search'),
38
36
  block: blocks.length && blocks[0]
39
37
  };
40
- }, [originalName]); // The user can't install blocks, or the block isn't available for download.
38
+ }, [originalName]);
41
39
 
40
+ // The user can't install blocks, or the block isn't available for download.
42
41
  if (!hasPermission || !block) {
43
- return createElement(OriginalComponent, { ...props
42
+ return createElement(OriginalComponent, {
43
+ ...props
44
44
  });
45
45
  }
46
-
47
- return createElement(ModifiedWarning, { ...props,
46
+ return createElement(ModifiedWarning, {
47
+ ...props,
48
48
  originalBlock: block
49
49
  });
50
50
  };
51
-
52
51
  const ModifiedWarning = ({
53
52
  originalBlock,
54
53
  ...props
@@ -61,13 +60,11 @@ const ModifiedWarning = ({
61
60
  const {
62
61
  replaceBlock
63
62
  } = useDispatch(blockEditorStore);
64
-
65
63
  const convertToHTML = () => {
66
64
  replaceBlock(props.clientId, createBlock('core/html', {
67
65
  content: originalUndelimitedContent
68
66
  }));
69
67
  };
70
-
71
68
  const hasContent = !!originalUndelimitedContent;
72
69
  const hasHTMLBlock = useSelect(select => {
73
70
  const {
@@ -76,8 +73,7 @@ const ModifiedWarning = ({
76
73
  } = select(blockEditorStore);
77
74
  return canInsertBlockType('core/html', getBlockRootClientId(clientId));
78
75
  }, [clientId]);
79
- let messageHTML = sprintf(
80
- /* translators: %s: block name */
76
+ let messageHTML = sprintf( /* translators: %s: block name */
81
77
  __('Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely.'), originalBlock.title || originalName);
82
78
  const actions = [createElement(InstallButton, {
83
79
  key: "install",
@@ -85,10 +81,8 @@ const ModifiedWarning = ({
85
81
  attributes: props.attributes,
86
82
  clientId: props.clientId
87
83
  })];
88
-
89
84
  if (hasContent && hasHTMLBlock) {
90
- messageHTML = sprintf(
91
- /* translators: %s: block name */
85
+ messageHTML = sprintf( /* translators: %s: block name */
92
86
  __('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);
93
87
  actions.push(createElement(Button, {
94
88
  key: "convert",
@@ -96,12 +90,11 @@ const ModifiedWarning = ({
96
90
  variant: "tertiary"
97
91
  }, __('Keep as HTML')));
98
92
  }
99
-
100
- return createElement("div", { ...useBlockProps()
93
+ return createElement("div", {
94
+ ...useBlockProps()
101
95
  }, createElement(Warning, {
102
96
  actions: actions
103
97
  }, messageHTML), createElement(RawHTML, null, originalUndelimitedContent));
104
98
  };
105
-
106
99
  export default getInstallMissing;
107
100
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/plugins/get-install-missing/index.js"],"names":["__","sprintf","Button","createBlock","RawHTML","useDispatch","useSelect","store","coreStore","Warning","useBlockProps","blockEditorStore","InstallButton","blockDirectoryStore","getInstallMissing","OriginalComponent","props","originalName","attributes","block","hasPermission","select","getDownloadableBlocks","blocks","filter","name","canUser","length","ModifiedWarning","originalBlock","originalUndelimitedContent","clientId","replaceBlock","convertToHTML","content","hasContent","hasHTMLBlock","canInsertBlockType","getBlockRootClientId","messageHTML","title","actions","push"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SACCC,OADD,EAECC,aAFD,EAGCH,KAAK,IAAII,gBAHV,QAIO,yBAJP;AAMA;AACA;AACA;;AACA,OAAOC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OAAO,EAAG+B;AAAnB,KAA+BF,WAA/B,CADD,EAEC,cAAC,OAAD,QAAWT,0BAAX,CAFD,CADD;AAMA,CAhED;;AAkEA,eAAehB,iBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, 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';\n\n/**\n * Internal dependencies\n */\nimport InstallButton from './install-button';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst getInstallMissing = ( OriginalComponent ) => ( props ) => {\n\tconst { originalName } = props.attributes;\n\t// Disable reason: This is a valid component, but it's mistaken for a callback.\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\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', {\n\t\t\t\tcontent: originalUndelimitedContent,\n\t\t\t} )\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 key=\"convert\" onClick={ convertToHTML } variant=\"tertiary\">\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"]}
1
+ {"version":3,"names":["__","sprintf","Button","createBlock","RawHTML","useDispatch","useSelect","store","coreStore","Warning","useBlockProps","blockEditorStore","InstallButton","blockDirectoryStore","getInstallMissing","OriginalComponent","props","originalName","attributes","block","hasPermission","select","getDownloadableBlocks","blocks","filter","name","canUser","length","createElement","ModifiedWarning","originalBlock","originalUndelimitedContent","clientId","replaceBlock","convertToHTML","content","hasContent","hasHTMLBlock","canInsertBlockType","getBlockRootClientId","messageHTML","title","actions","key","push","onClick","variant"],"sources":["@wordpress/block-directory/src/plugins/get-install-missing/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, 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';\n\n/**\n * Internal dependencies\n */\nimport InstallButton from './install-button';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst getInstallMissing = ( OriginalComponent ) => ( props ) => {\n\tconst { originalName } = props.attributes;\n\t// Disable reason: This is a valid component, but it's mistaken for a callback.\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\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', {\n\t\t\t\tcontent: originalUndelimitedContent,\n\t\t\t} )\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 key=\"convert\" onClick={ convertToHTML } variant=\"tertiary\">\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":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB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AAS;MAACE,OAAO,EAAGX,aAAe;MAACY,OAAO,EAAC;IAAU,GAC/D9C,EAAE,CAAE,cAAe,CACd,CACT,CAAC;EACF;EAEA,OACC4B,aAAA;IAAA,GAAUlB,aAAa,CAAC;EAAC,GACxBkB,aAAA,CAACnB,OAAO;IAACiC,OAAO,EAAGA;EAAS,GAAGF,WAAsB,CAAC,EACtDZ,aAAA,CAACxB,OAAO,QAAG2B,0BAAqC,CAC5C,CAAC;AAER,CAAC;AAED,eAAejB,iBAAiB"}
@@ -1,5 +1,4 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -8,10 +7,10 @@ import { Button } from '@wordpress/components';
8
7
  import { createBlock, getBlockType, parse } from '@wordpress/blocks';
9
8
  import { useSelect, useDispatch } from '@wordpress/data';
10
9
  import { store as blockEditorStore } from '@wordpress/block-editor';
10
+
11
11
  /**
12
12
  * Internal dependencies
13
13
  */
14
-
15
14
  import { store as blockDirectoryStore } from '../../store';
16
15
  export default function InstallButton({
17
16
  attributes,
@@ -30,7 +29,6 @@ export default function InstallButton({
30
29
  if (success) {
31
30
  const blockType = getBlockType(block.name);
32
31
  const [originalBlock] = parse(attributes.originalContent);
33
-
34
32
  if (originalBlock && blockType) {
35
33
  replaceBlock(clientId, createBlock(blockType.name, originalBlock.attributes, originalBlock.innerBlocks));
36
34
  }
@@ -39,8 +37,7 @@ export default function InstallButton({
39
37
  disabled: isInstallingBlock,
40
38
  isBusy: isInstallingBlock,
41
39
  variant: "primary"
42
- }, sprintf(
43
- /* translators: %s: block name */
40
+ }, sprintf( /* translators: %s: block name */
44
41
  __('Install %s'), block.title));
45
42
  }
46
43
  //# sourceMappingURL=install-button.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/plugins/get-install-missing/install-button.js"],"names":["__","sprintf","Button","createBlock","getBlockType","parse","useSelect","useDispatch","store","blockEditorStore","blockDirectoryStore","InstallButton","attributes","block","clientId","isInstallingBlock","select","isInstalling","id","installBlockType","replaceBlock","then","success","blockType","name","originalBlock","originalContent","innerBlocks","title"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,WAAT,EAAsBC,YAAtB,EAAoCC,KAApC,QAAiD,mBAAjD;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,mBAAlB,QAA6C,aAA7C;AAEA,eAAe,SAASC,aAAT,CAAwB;AAAEC,EAAAA,UAAF;AAAcC,EAAAA,KAAd;AAAqBC,EAAAA;AAArB,CAAxB,EAA0D;AACxE,QAAMC,iBAAiB,GAAGT,SAAS,CAChCU,MAAF,IAAcA,MAAM,CAAEN,mBAAF,CAAN,CAA8BO,YAA9B,CAA4CJ,KAAK,CAACK,EAAlD,CADoB,EAElC,CAAEL,KAAK,CAACK,EAAR,CAFkC,CAAnC;AAIA,QAAM;AAAEC,IAAAA;AAAF,MAAuBZ,WAAW,CAAEG,mBAAF,CAAxC;AACA,QAAM;AAAEU,IAAAA;AAAF,MAAmBb,WAAW,CAAEE,gBAAF,CAApC;AAEA,SACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAG,MACTU,gBAAgB,CAAEN,KAAF,CAAhB,CAA0BQ,IAA1B,CAAkCC,OAAF,IAAe;AAC9C,UAAKA,OAAL,EAAe;AACd,cAAMC,SAAS,GAAGnB,YAAY,CAAES,KAAK,CAACW,IAAR,CAA9B;AACA,cAAM,CAAEC,aAAF,IAAoBpB,KAAK,CAC9BO,UAAU,CAACc,eADmB,CAA/B;;AAGA,YAAKD,aAAa,IAAIF,SAAtB,EAAkC;AACjCH,UAAAA,YAAY,CACXN,QADW,EAEXX,WAAW,CACVoB,SAAS,CAACC,IADA,EAEVC,aAAa,CAACb,UAFJ,EAGVa,aAAa,CAACE,WAHJ,CAFA,CAAZ;AAQA;AACD;AACD,KAjBD,CAFF;AAqBC,IAAA,QAAQ,EAAGZ,iBArBZ;AAsBC,IAAA,MAAM,EAAGA,iBAtBV;AAuBC,IAAA,OAAO,EAAC;AAvBT,KAyBGd,OAAO;AACR;AACAD,EAAAA,EAAE,CAAE,YAAF,CAFM,EAGRa,KAAK,CAACe,KAHE,CAzBV,CADD;AAiCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, 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';\n\n/**\n * Internal dependencies\n */\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\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\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"]}
1
+ {"version":3,"names":["__","sprintf","Button","createBlock","getBlockType","parse","useSelect","useDispatch","store","blockEditorStore","blockDirectoryStore","InstallButton","attributes","block","clientId","isInstallingBlock","select","isInstalling","id","installBlockType","replaceBlock","createElement","onClick","then","success","blockType","name","originalBlock","originalContent","innerBlocks","disabled","isBusy","variant","title"],"sources":["@wordpress/block-directory/src/plugins/get-install-missing/install-button.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, 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';\n\n/**\n * Internal dependencies\n */\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\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\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":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,WAAW,EAAEC,YAAY,EAAEC,KAAK,QAAQ,mBAAmB;AACpE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA,SAASD,KAAK,IAAIE,mBAAmB,QAAQ,aAAa;AAE1D,eAAe,SAASC,aAAaA,CAAE;EAAEC,UAAU;EAAEC,KAAK;EAAEC;AAAS,CAAC,EAAG;EACxE,MAAMC,iBAAiB,GAAGT,SAAS,CAChCU,MAAM,IAAMA,MAAM,CAAEN,mBAAoB,CAAC,CAACO,YAAY,CAAEJ,KAAK,CAACK,EAAG,CAAC,EACpE,CAAEL,KAAK,CAACK,EAAE,CACX,CAAC;EACD,MAAM;IAAEC;EAAiB,CAAC,GAAGZ,WAAW,CAAEG,mBAAoB,CAAC;EAC/D,MAAM;IAAEU;EAAa,CAAC,GAAGb,WAAW,CAAEE,gBAAiB,CAAC;EAExD,OACCY,aAAA,CAACnB,MAAM;IACNoB,OAAO,EAAGA,CAAA,KACTH,gBAAgB,CAAEN,KAAM,CAAC,CAACU,IAAI,CAAIC,OAAO,IAAM;MAC9C,IAAKA,OAAO,EAAG;QACd,MAAMC,SAAS,GAAGrB,YAAY,CAAES,KAAK,CAACa,IAAK,CAAC;QAC5C,MAAM,CAAEC,aAAa,CAAE,GAAGtB,KAAK,CAC9BO,UAAU,CAACgB,eACZ,CAAC;QACD,IAAKD,aAAa,IAAIF,SAAS,EAAG;UACjCL,YAAY,CACXN,QAAQ,EACRX,WAAW,CACVsB,SAAS,CAACC,IAAI,EACdC,aAAa,CAACf,UAAU,EACxBe,aAAa,CAACE,WACf,CACD,CAAC;QACF;MACD;IACD,CAAE,CACF;IACDC,QAAQ,EAAGf,iBAAmB;IAC9BgB,MAAM,EAAGhB,iBAAmB;IAC5BiB,OAAO,EAAC;EAAS,GAEf/B,OAAO,EACR;EACAD,EAAE,CAAE,YAAa,CAAC,EAClBa,KAAK,CAACoB,KACP,CACO,CAAC;AAEX"}
@@ -1,14 +1,13 @@
1
1
  import { createElement, Fragment } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
6
5
  import { registerPlugin } from '@wordpress/plugins';
7
6
  import { addFilter } from '@wordpress/hooks';
7
+
8
8
  /**
9
9
  * Internal dependencies
10
10
  */
11
-
12
11
  import AutoBlockUninstaller from '../components/auto-block-uninstaller';
13
12
  import InserterMenuDownloadableBlocksPanel from './inserter-menu-downloadable-blocks-panel';
14
13
  import InstalledBlocksPrePublishPanel from './installed-blocks-pre-publish-panel';
@@ -17,13 +16,11 @@ registerPlugin('block-directory', {
17
16
  render() {
18
17
  return createElement(Fragment, null, createElement(AutoBlockUninstaller, null), createElement(InserterMenuDownloadableBlocksPanel, null), createElement(InstalledBlocksPrePublishPanel, null));
19
18
  }
20
-
21
19
  });
22
20
  addFilter('blocks.registerBlockType', 'block-directory/fallback', (settings, name) => {
23
21
  if (name !== 'core/missing') {
24
22
  return settings;
25
23
  }
26
-
27
24
  settings.edit = getInstallMissing(settings.edit);
28
25
  return settings;
29
26
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/plugins/index.js"],"names":["registerPlugin","addFilter","AutoBlockUninstaller","InserterMenuDownloadableBlocksPanel","InstalledBlocksPrePublishPanel","getInstallMissing","render","settings","name","edit"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,oBAA/B;AACA,SAASC,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,sCAAjC;AACA,OAAOC,mCAAP,MAAgD,2CAAhD;AACA,OAAOC,8BAAP,MAA2C,sCAA3C;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AAEAL,cAAc,CAAE,iBAAF,EAAqB;AAClCM,EAAAA,MAAM,GAAG;AACR,WACC,8BACC,cAAC,oBAAD,OADD,EAEC,cAAC,mCAAD,OAFD,EAGC,cAAC,8BAAD,OAHD,CADD;AAOA;;AATiC,CAArB,CAAd;AAYAL,SAAS,CACR,0BADQ,EAER,0BAFQ,EAGR,CAAEM,QAAF,EAAYC,IAAZ,KAAsB;AACrB,MAAKA,IAAI,KAAK,cAAd,EAA+B;AAC9B,WAAOD,QAAP;AACA;;AACDA,EAAAA,QAAQ,CAACE,IAAT,GAAgBJ,iBAAiB,CAAEE,QAAQ,CAACE,IAAX,CAAjC;AAEA,SAAOF,QAAP;AACA,CAVO,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { registerPlugin } from '@wordpress/plugins';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport AutoBlockUninstaller from '../components/auto-block-uninstaller';\nimport InserterMenuDownloadableBlocksPanel from './inserter-menu-downloadable-blocks-panel';\nimport InstalledBlocksPrePublishPanel from './installed-blocks-pre-publish-panel';\nimport getInstallMissing from './get-install-missing';\n\nregisterPlugin( 'block-directory', {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<AutoBlockUninstaller />\n\t\t\t\t<InserterMenuDownloadableBlocksPanel />\n\t\t\t\t<InstalledBlocksPrePublishPanel />\n\t\t\t</>\n\t\t);\n\t},\n} );\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'block-directory/fallback',\n\t( settings, name ) => {\n\t\tif ( name !== 'core/missing' ) {\n\t\t\treturn settings;\n\t\t}\n\t\tsettings.edit = getInstallMissing( settings.edit );\n\n\t\treturn settings;\n\t}\n);\n"]}
1
+ {"version":3,"names":["registerPlugin","addFilter","AutoBlockUninstaller","InserterMenuDownloadableBlocksPanel","InstalledBlocksPrePublishPanel","getInstallMissing","render","createElement","Fragment","settings","name","edit"],"sources":["@wordpress/block-directory/src/plugins/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { registerPlugin } from '@wordpress/plugins';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport AutoBlockUninstaller from '../components/auto-block-uninstaller';\nimport InserterMenuDownloadableBlocksPanel from './inserter-menu-downloadable-blocks-panel';\nimport InstalledBlocksPrePublishPanel from './installed-blocks-pre-publish-panel';\nimport getInstallMissing from './get-install-missing';\n\nregisterPlugin( 'block-directory', {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<AutoBlockUninstaller />\n\t\t\t\t<InserterMenuDownloadableBlocksPanel />\n\t\t\t\t<InstalledBlocksPrePublishPanel />\n\t\t\t</>\n\t\t);\n\t},\n} );\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'block-directory/fallback',\n\t( settings, name ) => {\n\t\tif ( name !== 'core/missing' ) {\n\t\t\treturn settings;\n\t\t}\n\t\tsettings.edit = getInstallMissing( settings.edit );\n\n\t\treturn settings;\n\t}\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,oBAAoB;AACnD,SAASC,SAAS,QAAQ,kBAAkB;;AAE5C;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,sCAAsC;AACvE,OAAOC,mCAAmC,MAAM,2CAA2C;AAC3F,OAAOC,8BAA8B,MAAM,sCAAsC;AACjF,OAAOC,iBAAiB,MAAM,uBAAuB;AAErDL,cAAc,CAAE,iBAAiB,EAAE;EAClCM,MAAMA,CAAA,EAAG;IACR,OACCC,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACL,oBAAoB,MAAE,CAAC,EACxBK,aAAA,CAACJ,mCAAmC,MAAE,CAAC,EACvCI,aAAA,CAACH,8BAA8B,MAAE,CAChC,CAAC;EAEL;AACD,CAAE,CAAC;AAEHH,SAAS,CACR,0BAA0B,EAC1B,0BAA0B,EAC1B,CAAEQ,QAAQ,EAAEC,IAAI,KAAM;EACrB,IAAKA,IAAI,KAAK,cAAc,EAAG;IAC9B,OAAOD,QAAQ;EAChB;EACAA,QAAQ,CAACE,IAAI,GAAGN,iBAAiB,CAAEI,QAAQ,CAACE,IAAK,CAAC;EAElD,OAAOF,QAAQ;AAChB,CACD,CAAC"}
@@ -1,17 +1,15 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
6
5
  import { __unstableInserterMenuExtension } from '@wordpress/block-editor';
7
6
  import { debounce } from '@wordpress/compose';
8
7
  import { useState } from '@wordpress/element';
8
+
9
9
  /**
10
10
  * Internal dependencies
11
11
  */
12
-
13
12
  import DownloadableBlocksPanel from '../../components/downloadable-blocks-panel';
14
-
15
13
  function InserterMenuDownloadableBlocksPanel() {
16
14
  const [debouncedFilterValue, setFilterValue] = useState('');
17
15
  const debouncedSetFilterValue = debounce(setFilterValue, 400);
@@ -25,11 +23,9 @@ function InserterMenuDownloadableBlocksPanel() {
25
23
  if (debouncedFilterValue !== filterValue) {
26
24
  debouncedSetFilterValue(filterValue);
27
25
  }
28
-
29
26
  if (!debouncedFilterValue) {
30
27
  return null;
31
28
  }
32
-
33
29
  return createElement(DownloadableBlocksPanel, {
34
30
  onSelect: onSelect,
35
31
  onHover: onHover,
@@ -40,6 +36,5 @@ function InserterMenuDownloadableBlocksPanel() {
40
36
  });
41
37
  });
42
38
  }
43
-
44
39
  export default InserterMenuDownloadableBlocksPanel;
45
40
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/plugins/inserter-menu-downloadable-blocks-panel/index.js"],"names":["__unstableInserterMenuExtension","debounce","useState","DownloadableBlocksPanel","InserterMenuDownloadableBlocksPanel","debouncedFilterValue","setFilterValue","debouncedSetFilterValue","onSelect","onHover","filterValue","hasItems","rootClientId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,+BAAT,QAAgD,yBAAhD;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,4CAApC;;AAEA,SAASC,mCAAT,GAA+C;AAC9C,QAAM,CAAEC,oBAAF,EAAwBC,cAAxB,IAA2CJ,QAAQ,CAAE,EAAF,CAAzD;AACA,QAAMK,uBAAuB,GAAGN,QAAQ,CAAEK,cAAF,EAAkB,GAAlB,CAAxC;AAEA,SACC,cAAC,+BAAD,QACG,CAAE;AACHE,IAAAA,QADG;AAEHC,IAAAA,OAFG;AAGHC,IAAAA,WAHG;AAIHC,IAAAA,QAJG;AAKHC,IAAAA;AALG,GAAF,KAMK;AACN,QAAKP,oBAAoB,KAAKK,WAA9B,EAA4C;AAC3CH,MAAAA,uBAAuB,CAAEG,WAAF,CAAvB;AACA;;AAED,QAAK,CAAEL,oBAAP,EAA8B;AAC7B,aAAO,IAAP;AACA;;AAED,WACC,cAAC,uBAAD;AACC,MAAA,QAAQ,EAAGG,QADZ;AAEC,MAAA,OAAO,EAAGC,OAFX;AAGC,MAAA,YAAY,EAAGG,YAHhB;AAIC,MAAA,WAAW,EAAGP,oBAJf;AAKC,MAAA,cAAc,EAAGM,QALlB;AAMC,MAAA,QAAQ,EAAGD,WAAW,KAAKL;AAN5B,MADD;AAUA,GA1BF,CADD;AA8BA;;AAED,eAAeD,mCAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __unstableInserterMenuExtension } from '@wordpress/block-editor';\nimport { debounce } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlocksPanel from '../../components/downloadable-blocks-panel';\n\nfunction InserterMenuDownloadableBlocksPanel() {\n\tconst [ debouncedFilterValue, setFilterValue ] = useState( '' );\n\tconst debouncedSetFilterValue = debounce( setFilterValue, 400 );\n\n\treturn (\n\t\t<__unstableInserterMenuExtension>\n\t\t\t{ ( {\n\t\t\t\tonSelect,\n\t\t\t\tonHover,\n\t\t\t\tfilterValue,\n\t\t\t\thasItems,\n\t\t\t\trootClientId,\n\t\t\t} ) => {\n\t\t\t\tif ( debouncedFilterValue !== filterValue ) {\n\t\t\t\t\tdebouncedSetFilterValue( filterValue );\n\t\t\t\t}\n\n\t\t\t\tif ( ! debouncedFilterValue ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<DownloadableBlocksPanel\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tfilterValue={ debouncedFilterValue }\n\t\t\t\t\t\thasLocalBlocks={ hasItems }\n\t\t\t\t\t\tisTyping={ filterValue !== debouncedFilterValue }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} }\n\t\t</__unstableInserterMenuExtension>\n\t);\n}\n\nexport default InserterMenuDownloadableBlocksPanel;\n"]}
1
+ {"version":3,"names":["__unstableInserterMenuExtension","debounce","useState","DownloadableBlocksPanel","InserterMenuDownloadableBlocksPanel","debouncedFilterValue","setFilterValue","debouncedSetFilterValue","createElement","onSelect","onHover","filterValue","hasItems","rootClientId","hasLocalBlocks","isTyping"],"sources":["@wordpress/block-directory/src/plugins/inserter-menu-downloadable-blocks-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __unstableInserterMenuExtension } from '@wordpress/block-editor';\nimport { debounce } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlocksPanel from '../../components/downloadable-blocks-panel';\n\nfunction InserterMenuDownloadableBlocksPanel() {\n\tconst [ debouncedFilterValue, setFilterValue ] = useState( '' );\n\tconst debouncedSetFilterValue = debounce( setFilterValue, 400 );\n\n\treturn (\n\t\t<__unstableInserterMenuExtension>\n\t\t\t{ ( {\n\t\t\t\tonSelect,\n\t\t\t\tonHover,\n\t\t\t\tfilterValue,\n\t\t\t\thasItems,\n\t\t\t\trootClientId,\n\t\t\t} ) => {\n\t\t\t\tif ( debouncedFilterValue !== filterValue ) {\n\t\t\t\t\tdebouncedSetFilterValue( filterValue );\n\t\t\t\t}\n\n\t\t\t\tif ( ! debouncedFilterValue ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<DownloadableBlocksPanel\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tfilterValue={ debouncedFilterValue }\n\t\t\t\t\t\thasLocalBlocks={ hasItems }\n\t\t\t\t\t\tisTyping={ filterValue !== debouncedFilterValue }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} }\n\t\t</__unstableInserterMenuExtension>\n\t);\n}\n\nexport default InserterMenuDownloadableBlocksPanel;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,+BAA+B,QAAQ,yBAAyB;AACzE,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,4CAA4C;AAEhF,SAASC,mCAAmCA,CAAA,EAAG;EAC9C,MAAM,CAAEC,oBAAoB,EAAEC,cAAc,CAAE,GAAGJ,QAAQ,CAAE,EAAG,CAAC;EAC/D,MAAMK,uBAAuB,GAAGN,QAAQ,CAAEK,cAAc,EAAE,GAAI,CAAC;EAE/D,OACCE,aAAA,CAACR,+BAA+B,QAC7B,CAAE;IACHS,QAAQ;IACRC,OAAO;IACPC,WAAW;IACXC,QAAQ;IACRC;EACD,CAAC,KAAM;IACN,IAAKR,oBAAoB,KAAKM,WAAW,EAAG;MAC3CJ,uBAAuB,CAAEI,WAAY,CAAC;IACvC;IAEA,IAAK,CAAEN,oBAAoB,EAAG;MAC7B,OAAO,IAAI;IACZ;IAEA,OACCG,aAAA,CAACL,uBAAuB;MACvBM,QAAQ,EAAGA,QAAU;MACrBC,OAAO,EAAGA,OAAS;MACnBG,YAAY,EAAGA,YAAc;MAC7BF,WAAW,EAAGN,oBAAsB;MACpCS,cAAc,EAAGF,QAAU;MAC3BG,QAAQ,EAAGJ,WAAW,KAAKN;IAAsB,CACjD,CAAC;EAEJ,CACgC,CAAC;AAEpC;AAEA,eAAeD,mCAAmC"}
@@ -1,34 +1,32 @@
1
1
  var _window$wp$editPost;
2
-
3
2
  import { createElement } from "@wordpress/element";
4
-
5
3
  /**
6
4
  * WordPress dependencies
7
5
  */
8
6
  import { _n, sprintf } from '@wordpress/i18n';
9
7
  import { useSelect } from '@wordpress/data';
10
8
  import { blockDefault } from '@wordpress/icons';
9
+
11
10
  /**
12
11
  * Internal dependencies
13
12
  */
14
-
15
13
  import CompactList from '../../components/compact-list';
16
- import { store as blockDirectoryStore } from '../../store'; // We shouldn't import the edit-post package directly
17
- // because it would include the wp-edit-post in all pages loading the block-directory script.
14
+ import { store as blockDirectoryStore } from '../../store';
18
15
 
16
+ // We shouldn't import the edit-post package directly
17
+ // because it would include the wp-edit-post in all pages loading the block-directory script.
19
18
  const {
20
19
  PluginPrePublishPanel
21
20
  } = (_window$wp$editPost = window?.wp?.editPost) !== null && _window$wp$editPost !== void 0 ? _window$wp$editPost : {};
22
21
  export default function InstalledBlocksPrePublishPanel() {
23
22
  const newBlockTypes = useSelect(select => select(blockDirectoryStore).getNewBlockTypes(), []);
24
-
25
23
  if (!newBlockTypes.length) {
26
24
  return null;
27
25
  }
28
-
29
26
  return createElement(PluginPrePublishPanel, {
30
27
  icon: blockDefault,
31
- title: sprintf( // translators: %d: number of blocks (number).
28
+ title: sprintf(
29
+ // translators: %d: number of blocks (number).
32
30
  _n('Added: %d block', 'Added: %d blocks', newBlockTypes.length), newBlockTypes.length),
33
31
  initialOpen: true
34
32
  }, createElement("p", {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/plugins/installed-blocks-pre-publish-panel/index.js"],"names":["_n","sprintf","useSelect","blockDefault","CompactList","store","blockDirectoryStore","PluginPrePublishPanel","window","wp","editPost","InstalledBlocksPrePublishPanel","newBlockTypes","select","getNewBlockTypes","length"],"mappings":";;;;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,YAAT,QAA6B,kBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,WAAP,MAAwB,+BAAxB;AACA,SAASC,KAAK,IAAIC,mBAAlB,QAA6C,aAA7C,C,CAEA;AACA;;AACA,MAAM;AAAEC,EAAAA;AAAF,2BAA4BC,MAAM,EAAEC,EAAR,EAAYC,QAAxC,qEAAoD,EAA1D;AAEA,eAAe,SAASC,8BAAT,GAA0C;AACxD,QAAMC,aAAa,GAAGV,SAAS,CAC5BW,MAAF,IAAcA,MAAM,CAAEP,mBAAF,CAAN,CAA8BQ,gBAA9B,EADgB,EAE9B,EAF8B,CAA/B;;AAKA,MAAK,CAAEF,aAAa,CAACG,MAArB,EAA8B;AAC7B,WAAO,IAAP;AACA;;AAED,SACC,cAAC,qBAAD;AACC,IAAA,IAAI,EAAGZ,YADR;AAEC,IAAA,KAAK,EAAGF,OAAO,EACd;AACAD,IAAAA,EAAE,CACD,iBADC,EAED,kBAFC,EAGDY,aAAa,CAACG,MAHb,CAFY,EAOdH,aAAa,CAACG,MAPA,CAFhB;AAWC,IAAA,WAAW,EAAG;AAXf,KAaC;AAAG,IAAA,SAAS,EAAC;AAAb,KACGf,EAAE,CACH,kDADG,EAEH,oDAFG,EAGHY,aAAa,CAACG,MAHX,CADL,CAbD,EAoBC,cAAC,WAAD;AAAa,IAAA,KAAK,EAAGH;AAArB,IApBD,CADD;AAwBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { blockDefault } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport CompactList from '../../components/compact-list';\nimport { store as blockDirectoryStore } from '../../store';\n\n// We shouldn't import the edit-post package directly\n// because it would include the wp-edit-post in all pages loading the block-directory script.\nconst { PluginPrePublishPanel } = window?.wp?.editPost ?? {};\n\nexport default function InstalledBlocksPrePublishPanel() {\n\tconst newBlockTypes = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).getNewBlockTypes(),\n\t\t[]\n\t);\n\n\tif ( ! newBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PluginPrePublishPanel\n\t\t\ticon={ blockDefault }\n\t\t\ttitle={ sprintf(\n\t\t\t\t// translators: %d: number of blocks (number).\n\t\t\t\t_n(\n\t\t\t\t\t'Added: %d block',\n\t\t\t\t\t'Added: %d blocks',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t),\n\t\t\t\tnewBlockTypes.length\n\t\t\t) }\n\t\t\tinitialOpen={ true }\n\t\t>\n\t\t\t<p className=\"installed-blocks-pre-publish-panel__copy\">\n\t\t\t\t{ _n(\n\t\t\t\t\t'The following block has been added to your site.',\n\t\t\t\t\t'The following blocks have been added to your site.',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<CompactList items={ newBlockTypes } />\n\t\t</PluginPrePublishPanel>\n\t);\n}\n"]}
1
+ {"version":3,"names":["_n","sprintf","useSelect","blockDefault","CompactList","store","blockDirectoryStore","PluginPrePublishPanel","_window$wp$editPost","window","wp","editPost","InstalledBlocksPrePublishPanel","newBlockTypes","select","getNewBlockTypes","length","createElement","icon","title","initialOpen","className","items"],"sources":["@wordpress/block-directory/src/plugins/installed-blocks-pre-publish-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { blockDefault } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport CompactList from '../../components/compact-list';\nimport { store as blockDirectoryStore } from '../../store';\n\n// We shouldn't import the edit-post package directly\n// because it would include the wp-edit-post in all pages loading the block-directory script.\nconst { PluginPrePublishPanel } = window?.wp?.editPost ?? {};\n\nexport default function InstalledBlocksPrePublishPanel() {\n\tconst newBlockTypes = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).getNewBlockTypes(),\n\t\t[]\n\t);\n\n\tif ( ! newBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PluginPrePublishPanel\n\t\t\ticon={ blockDefault }\n\t\t\ttitle={ sprintf(\n\t\t\t\t// translators: %d: number of blocks (number).\n\t\t\t\t_n(\n\t\t\t\t\t'Added: %d block',\n\t\t\t\t\t'Added: %d blocks',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t),\n\t\t\t\tnewBlockTypes.length\n\t\t\t) }\n\t\t\tinitialOpen={ true }\n\t\t>\n\t\t\t<p className=\"installed-blocks-pre-publish-panel__copy\">\n\t\t\t\t{ _n(\n\t\t\t\t\t'The following block has been added to your site.',\n\t\t\t\t\t'The following blocks have been added to your site.',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<CompactList items={ newBlockTypes } />\n\t\t</PluginPrePublishPanel>\n\t);\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,YAAY,QAAQ,kBAAkB;;AAE/C;AACA;AACA;AACA,OAAOC,WAAW,MAAM,+BAA+B;AACvD,SAASC,KAAK,IAAIC,mBAAmB,QAAQ,aAAa;;AAE1D;AACA;AACA,MAAM;EAAEC;AAAsB,CAAC,IAAAC,mBAAA,GAAGC,MAAM,EAAEC,EAAE,EAAEC,QAAQ,cAAAH,mBAAA,cAAAA,mBAAA,GAAI,CAAC,CAAC;AAE5D,eAAe,SAASI,8BAA8BA,CAAA,EAAG;EACxD,MAAMC,aAAa,GAAGX,SAAS,CAC5BY,MAAM,IAAMA,MAAM,CAAER,mBAAoB,CAAC,CAACS,gBAAgB,CAAC,CAAC,EAC9D,EACD,CAAC;EAED,IAAK,CAAEF,aAAa,CAACG,MAAM,EAAG;IAC7B,OAAO,IAAI;EACZ;EAEA,OACCC,aAAA,CAACV,qBAAqB;IACrBW,IAAI,EAAGf,YAAc;IACrBgB,KAAK,EAAGlB,OAAO;IACd;IACAD,EAAE,CACD,iBAAiB,EACjB,kBAAkB,EAClBa,aAAa,CAACG,MACf,CAAC,EACDH,aAAa,CAACG,MACf,CAAG;IACHI,WAAW,EAAG;EAAM,GAEpBH,aAAA;IAAGI,SAAS,EAAC;EAA0C,GACpDrB,EAAE,CACH,kDAAkD,EAClD,oDAAoD,EACpDa,aAAa,CAACG,MACf,CACE,CAAC,EACJC,aAAA,CAACb,WAAW;IAACkB,KAAK,EAAGT;EAAe,CAAE,CAChB,CAAC;AAE1B"}