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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/build/components/auto-block-uninstaller/index.js +37 -31
  2. package/build/components/auto-block-uninstaller/index.js.map +7 -1
  3. package/build/components/block-ratings/index.js +40 -22
  4. package/build/components/block-ratings/index.js.map +7 -1
  5. package/build/components/block-ratings/stars.js +66 -40
  6. package/build/components/block-ratings/stars.js.map +7 -1
  7. package/build/components/compact-list/index.js +47 -46
  8. package/build/components/compact-list/index.js.map +7 -1
  9. package/build/components/downloadable-block-icon/index.js +28 -26
  10. package/build/components/downloadable-block-icon/index.js.map +7 -1
  11. package/build/components/downloadable-block-list-item/index.js +113 -127
  12. package/build/components/downloadable-block-list-item/index.js.map +7 -1
  13. package/build/components/downloadable-block-notice/index.js +41 -31
  14. package/build/components/downloadable-block-notice/index.js.map +7 -1
  15. package/build/components/downloadable-blocks-list/index.js +72 -56
  16. package/build/components/downloadable-blocks-list/index.js.map +7 -1
  17. package/build/components/downloadable-blocks-panel/index.js +108 -95
  18. package/build/components/downloadable-blocks-panel/index.js.map +7 -1
  19. package/build/components/downloadable-blocks-panel/inserter-panel.js +52 -38
  20. package/build/components/downloadable-blocks-panel/inserter-panel.js.map +7 -1
  21. package/build/components/downloadable-blocks-panel/no-results.js +37 -30
  22. package/build/components/downloadable-blocks-panel/no-results.js.map +7 -1
  23. package/build/index.js +27 -12
  24. package/build/index.js.map +7 -1
  25. package/build/lock-unlock.js +31 -15
  26. package/build/lock-unlock.js.map +7 -1
  27. package/build/plugins/get-install-missing/index.js +123 -102
  28. package/build/plugins/get-install-missing/index.js.map +7 -1
  29. package/build/plugins/get-install-missing/install-button.js +68 -50
  30. package/build/plugins/get-install-missing/install-button.js.map +7 -1
  31. package/build/plugins/index.js +46 -29
  32. package/build/plugins/index.js.map +7 -1
  33. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js +55 -42
  34. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +7 -1
  35. package/build/plugins/installed-blocks-pre-publish-panel/index.js +65 -34
  36. package/build/plugins/installed-blocks-pre-publish-panel/index.js.map +7 -1
  37. package/build/store/actions.js +142 -188
  38. package/build/store/actions.js.map +7 -1
  39. package/build/store/index.js +48 -46
  40. package/build/store/index.js.map +7 -1
  41. package/build/store/load-assets.js +48 -55
  42. package/build/store/load-assets.js.map +7 -1
  43. package/build/store/reducer.js +48 -54
  44. package/build/store/reducer.js.map +7 -1
  45. package/build/store/resolvers.js +52 -31
  46. package/build/store/resolvers.js.map +7 -1
  47. package/build/store/selectors.js +100 -127
  48. package/build/store/selectors.js.map +7 -1
  49. package/build/store/utils/get-plugin-url.js +23 -14
  50. package/build/store/utils/get-plugin-url.js.map +7 -1
  51. package/build-module/components/auto-block-uninstaller/index.js +18 -24
  52. package/build-module/components/auto-block-uninstaller/index.js.map +7 -1
  53. package/build-module/components/block-ratings/index.js +9 -15
  54. package/build-module/components/block-ratings/index.js.map +7 -1
  55. package/build-module/components/block-ratings/stars.js +48 -34
  56. package/build-module/components/block-ratings/stars.js.map +7 -1
  57. package/build-module/components/compact-list/index.js +19 -39
  58. package/build-module/components/compact-list/index.js.map +7 -1
  59. package/build-module/components/downloadable-block-icon/index.js +10 -20
  60. package/build-module/components/downloadable-block-icon/index.js.map +7 -1
  61. package/build-module/components/downloadable-block-list-item/index.js +89 -120
  62. package/build-module/components/downloadable-block-list-item/index.js.map +7 -1
  63. package/build-module/components/downloadable-block-notice/index.js +19 -24
  64. package/build-module/components/downloadable-block-notice/index.js.map +7 -1
  65. package/build-module/components/downloadable-blocks-list/index.js +44 -49
  66. package/build-module/components/downloadable-blocks-list/index.js.map +7 -1
  67. package/build-module/components/downloadable-blocks-panel/index.js +81 -89
  68. package/build-module/components/downloadable-blocks-panel/index.js.map +7 -1
  69. package/build-module/components/downloadable-blocks-panel/inserter-panel.js +33 -31
  70. package/build-module/components/downloadable-blocks-panel/inserter-panel.js.map +7 -1
  71. package/build-module/components/downloadable-blocks-panel/no-results.js +19 -24
  72. package/build-module/components/downloadable-blocks-panel/no-results.js.map +7 -1
  73. package/build-module/index.js +6 -6
  74. package/build-module/index.js.map +7 -1
  75. package/build-module/lock-unlock.js +8 -7
  76. package/build-module/lock-unlock.js.map +7 -1
  77. package/build-module/plugins/get-install-missing/index.js +99 -95
  78. package/build-module/plugins/get-install-missing/index.js.map +7 -1
  79. package/build-module/plugins/get-install-missing/install-button.js +50 -44
  80. package/build-module/plugins/get-install-missing/install-button.js.map +7 -1
  81. package/build-module/plugins/index.js +24 -25
  82. package/build-module/plugins/index.js.map +7 -1
  83. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js +26 -34
  84. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +7 -1
  85. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js +38 -28
  86. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js.map +7 -1
  87. package/build-module/store/actions.js +100 -168
  88. package/build-module/store/actions.js.map +7 -1
  89. package/build-module/store/index.js +13 -36
  90. package/build-module/store/index.js.map +7 -1
  91. package/build-module/store/load-assets.js +15 -47
  92. package/build-module/store/load-assets.js.map +7 -1
  93. package/build-module/store/reducer.js +27 -49
  94. package/build-module/store/reducer.js.map +7 -1
  95. package/build-module/store/resolvers.js +16 -19
  96. package/build-module/store/resolvers.js.map +7 -1
  97. package/build-module/store/selectors.js +77 -121
  98. package/build-module/store/selectors.js.map +7 -1
  99. package/build-module/store/utils/get-plugin-url.js +6 -10
  100. package/build-module/store/utils/get-plugin-url.js.map +7 -1
  101. package/build-style/style-rtl.css +9 -142
  102. package/build-style/style.css +9 -142
  103. package/package.json +28 -21
  104. package/src/components/block-ratings/style.scss +2 -0
  105. package/src/components/compact-list/style.scss +3 -0
  106. package/src/components/downloadable-block-icon/style.scss +3 -0
  107. package/src/components/downloadable-block-list-item/style.scss +4 -0
  108. package/src/components/downloadable-block-notice/style.scss +3 -0
  109. package/src/components/downloadable-blocks-panel/style.scss +3 -1
  110. package/src/style.scss +8 -7
@@ -1,26 +1,14 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { combineReducers } from '@wordpress/data';
5
-
6
- /**
7
- * Reducer returning an array of downloadable blocks.
8
- *
9
- * @param {Object} state Current state.
10
- * @param {Object} action Dispatched action.
11
- *
12
- * @return {Object} Updated state.
13
- */
14
- export const downloadableBlocks = (state = {}, action) => {
1
+ import { combineReducers } from "@wordpress/data";
2
+ const downloadableBlocks = (state = {}, action) => {
15
3
  switch (action.type) {
16
- case 'FETCH_DOWNLOADABLE_BLOCKS':
4
+ case "FETCH_DOWNLOADABLE_BLOCKS":
17
5
  return {
18
6
  ...state,
19
7
  [action.filterValue]: {
20
8
  isRequesting: true
21
9
  }
22
10
  };
23
- case 'RECEIVE_DOWNLOADABLE_BLOCKS':
11
+ case "RECEIVE_DOWNLOADABLE_BLOCKS":
24
12
  return {
25
13
  ...state,
26
14
  [action.filterValue]: {
@@ -31,31 +19,27 @@ export const downloadableBlocks = (state = {}, action) => {
31
19
  }
32
20
  return state;
33
21
  };
34
-
35
- /**
36
- * Reducer managing the installation and deletion of blocks.
37
- *
38
- * @param {Object} state Current state.
39
- * @param {Object} action Dispatched action.
40
- *
41
- * @return {Object} Updated state.
42
- */
43
- export const blockManagement = (state = {
22
+ const blockManagement = (state = {
44
23
  installedBlockTypes: [],
45
24
  isInstalling: {}
46
25
  }, action) => {
47
26
  switch (action.type) {
48
- case 'ADD_INSTALLED_BLOCK_TYPE':
27
+ case "ADD_INSTALLED_BLOCK_TYPE":
49
28
  return {
50
29
  ...state,
51
- installedBlockTypes: [...state.installedBlockTypes, action.item]
30
+ installedBlockTypes: [
31
+ ...state.installedBlockTypes,
32
+ action.item
33
+ ]
52
34
  };
53
- case 'REMOVE_INSTALLED_BLOCK_TYPE':
35
+ case "REMOVE_INSTALLED_BLOCK_TYPE":
54
36
  return {
55
37
  ...state,
56
- installedBlockTypes: state.installedBlockTypes.filter(blockType => blockType.name !== action.item.name)
38
+ installedBlockTypes: state.installedBlockTypes.filter(
39
+ (blockType) => blockType.name !== action.item.name
40
+ )
57
41
  };
58
- case 'SET_INSTALLING_BLOCK':
42
+ case "SET_INSTALLING_BLOCK":
59
43
  return {
60
44
  ...state,
61
45
  isInstalling: {
@@ -66,18 +50,9 @@ export const blockManagement = (state = {
66
50
  }
67
51
  return state;
68
52
  };
69
-
70
- /**
71
- * Reducer returning an object of error notices.
72
- *
73
- * @param {Object} state Current state.
74
- * @param {Object} action Dispatched action.
75
- *
76
- * @return {Object} Updated state.
77
- */
78
- export const errorNotices = (state = {}, action) => {
53
+ const errorNotices = (state = {}, action) => {
79
54
  switch (action.type) {
80
- case 'SET_ERROR_NOTICE':
55
+ case "SET_ERROR_NOTICE":
81
56
  return {
82
57
  ...state,
83
58
  [action.blockId]: {
@@ -85,18 +60,21 @@ export const errorNotices = (state = {}, action) => {
85
60
  isFatal: action.isFatal
86
61
  }
87
62
  };
88
- case 'CLEAR_ERROR_NOTICE':
89
- const {
90
- [action.blockId]: blockId,
91
- ...restState
92
- } = state;
63
+ case "CLEAR_ERROR_NOTICE":
64
+ const { [action.blockId]: blockId, ...restState } = state;
93
65
  return restState;
94
66
  }
95
67
  return state;
96
68
  };
97
- export default combineReducers({
69
+ var reducer_default = combineReducers({
98
70
  downloadableBlocks,
99
71
  blockManagement,
100
72
  errorNotices
101
73
  });
102
- //# sourceMappingURL=reducer.js.map
74
+ export {
75
+ blockManagement,
76
+ reducer_default as default,
77
+ downloadableBlocks,
78
+ errorNotices
79
+ };
80
+ //# sourceMappingURL=reducer.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["combineReducers","downloadableBlocks","state","action","type","filterValue","isRequesting","results","blockManagement","installedBlockTypes","isInstalling","item","filter","blockType","name","blockId","errorNotices","message","isFatal","restState"],"sources":["@wordpress/block-directory/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning an array of downloadable blocks.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const downloadableBlocks = ( state = {}, action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'FETCH_DOWNLOADABLE_BLOCKS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.filterValue ]: {\n\t\t\t\t\tisRequesting: true,\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'RECEIVE_DOWNLOADABLE_BLOCKS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.filterValue ]: {\n\t\t\t\t\tresults: action.downloadableBlocks,\n\t\t\t\t\tisRequesting: false,\n\t\t\t\t},\n\t\t\t};\n\t}\n\treturn state;\n};\n\n/**\n * Reducer managing the installation and deletion of blocks.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const blockManagement = (\n\tstate = {\n\t\tinstalledBlockTypes: [],\n\t\tisInstalling: {},\n\t},\n\taction\n) => {\n\tswitch ( action.type ) {\n\t\tcase 'ADD_INSTALLED_BLOCK_TYPE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tinstalledBlockTypes: [\n\t\t\t\t\t...state.installedBlockTypes,\n\t\t\t\t\taction.item,\n\t\t\t\t],\n\t\t\t};\n\t\tcase 'REMOVE_INSTALLED_BLOCK_TYPE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tinstalledBlockTypes: state.installedBlockTypes.filter(\n\t\t\t\t\t( blockType ) => blockType.name !== action.item.name\n\t\t\t\t),\n\t\t\t};\n\t\tcase 'SET_INSTALLING_BLOCK':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisInstalling: {\n\t\t\t\t\t...state.isInstalling,\n\t\t\t\t\t[ action.blockId ]: action.isInstalling,\n\t\t\t\t},\n\t\t\t};\n\t}\n\treturn state;\n};\n\n/**\n * Reducer returning an object of error notices.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const errorNotices = ( state = {}, action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'SET_ERROR_NOTICE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.blockId ]: {\n\t\t\t\t\tmessage: action.message,\n\t\t\t\t\tisFatal: action.isFatal,\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'CLEAR_ERROR_NOTICE':\n\t\t\tconst { [ action.blockId ]: blockId, ...restState } = state;\n\t\t\treturn restState;\n\t}\n\treturn state;\n};\n\nexport default combineReducers( {\n\tdownloadableBlocks,\n\tblockManagement,\n\terrorNotices,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAGA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,KAAM;EAC3D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,2BAA2B;MAC/B,OAAO;QACN,GAAGF,KAAK;QACR,CAAEC,MAAM,CAACE,WAAW,GAAI;UACvBC,YAAY,EAAE;QACf;MACD,CAAC;IACF,KAAK,6BAA6B;MACjC,OAAO;QACN,GAAGJ,KAAK;QACR,CAAEC,MAAM,CAACE,WAAW,GAAI;UACvBE,OAAO,EAAEJ,MAAM,CAACF,kBAAkB;UAClCK,YAAY,EAAE;QACf;MACD,CAAC;EACH;EACA,OAAOJ,KAAK;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMM,eAAe,GAAGA,CAC9BN,KAAK,GAAG;EACPO,mBAAmB,EAAE,EAAE;EACvBC,YAAY,EAAE,CAAC;AAChB,CAAC,EACDP,MAAM,KACF;EACJ,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,0BAA0B;MAC9B,OAAO;QACN,GAAGF,KAAK;QACRO,mBAAmB,EAAE,CACpB,GAAGP,KAAK,CAACO,mBAAmB,EAC5BN,MAAM,CAACQ,IAAI;MAEb,CAAC;IACF,KAAK,6BAA6B;MACjC,OAAO;QACN,GAAGT,KAAK;QACRO,mBAAmB,EAAEP,KAAK,CAACO,mBAAmB,CAACG,MAAM,CAClDC,SAAS,IAAMA,SAAS,CAACC,IAAI,KAAKX,MAAM,CAACQ,IAAI,CAACG,IACjD;MACD,CAAC;IACF,KAAK,sBAAsB;MAC1B,OAAO;QACN,GAAGZ,KAAK;QACRQ,YAAY,EAAE;UACb,GAAGR,KAAK,CAACQ,YAAY;UACrB,CAAEP,MAAM,CAACY,OAAO,GAAIZ,MAAM,CAACO;QAC5B;MACD,CAAC;EACH;EACA,OAAOR,KAAK;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMc,YAAY,GAAGA,CAAEd,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,KAAM;EACrD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,kBAAkB;MACtB,OAAO;QACN,GAAGF,KAAK;QACR,CAAEC,MAAM,CAACY,OAAO,GAAI;UACnBE,OAAO,EAAEd,MAAM,CAACc,OAAO;UACvBC,OAAO,EAAEf,MAAM,CAACe;QACjB;MACD,CAAC;IACF,KAAK,oBAAoB;MACxB,MAAM;QAAE,CAAEf,MAAM,CAACY,OAAO,GAAIA,OAAO;QAAE,GAAGI;MAAU,CAAC,GAAGjB,KAAK;MAC3D,OAAOiB,SAAS;EAClB;EACA,OAAOjB,KAAK;AACb,CAAC;AAED,eAAeF,eAAe,CAAE;EAC/BC,kBAAkB;EAClBO,eAAe;EACfQ;AACD,CAAE,CAAC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/store/reducer.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning an array of downloadable blocks.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const downloadableBlocks = ( state = {}, action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'FETCH_DOWNLOADABLE_BLOCKS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.filterValue ]: {\n\t\t\t\t\tisRequesting: true,\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'RECEIVE_DOWNLOADABLE_BLOCKS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.filterValue ]: {\n\t\t\t\t\tresults: action.downloadableBlocks,\n\t\t\t\t\tisRequesting: false,\n\t\t\t\t},\n\t\t\t};\n\t}\n\treturn state;\n};\n\n/**\n * Reducer managing the installation and deletion of blocks.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const blockManagement = (\n\tstate = {\n\t\tinstalledBlockTypes: [],\n\t\tisInstalling: {},\n\t},\n\taction\n) => {\n\tswitch ( action.type ) {\n\t\tcase 'ADD_INSTALLED_BLOCK_TYPE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tinstalledBlockTypes: [\n\t\t\t\t\t...state.installedBlockTypes,\n\t\t\t\t\taction.item,\n\t\t\t\t],\n\t\t\t};\n\t\tcase 'REMOVE_INSTALLED_BLOCK_TYPE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tinstalledBlockTypes: state.installedBlockTypes.filter(\n\t\t\t\t\t( blockType ) => blockType.name !== action.item.name\n\t\t\t\t),\n\t\t\t};\n\t\tcase 'SET_INSTALLING_BLOCK':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisInstalling: {\n\t\t\t\t\t...state.isInstalling,\n\t\t\t\t\t[ action.blockId ]: action.isInstalling,\n\t\t\t\t},\n\t\t\t};\n\t}\n\treturn state;\n};\n\n/**\n * Reducer returning an object of error notices.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const errorNotices = ( state = {}, action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'SET_ERROR_NOTICE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.blockId ]: {\n\t\t\t\t\tmessage: action.message,\n\t\t\t\t\tisFatal: action.isFatal,\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'CLEAR_ERROR_NOTICE':\n\t\t\tconst { [ action.blockId ]: blockId, ...restState } = state;\n\t\t\treturn restState;\n\t}\n\treturn state;\n};\n\nexport default combineReducers( {\n\tdownloadableBlocks,\n\tblockManagement,\n\terrorNotices,\n} );\n"],
5
+ "mappings": "AAGA,SAAS,uBAAuB;AAUzB,MAAM,qBAAqB,CAAE,QAAQ,CAAC,GAAG,WAAY;AAC3D,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,OAAO,WAAY,GAAG;AAAA,UACvB,cAAc;AAAA,QACf;AAAA,MACD;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,OAAO,WAAY,GAAG;AAAA,UACvB,SAAS,OAAO;AAAA,UAChB,cAAc;AAAA,QACf;AAAA,MACD;AAAA,EACF;AACA,SAAO;AACR;AAUO,MAAM,kBAAkB,CAC9B,QAAQ;AAAA,EACP,qBAAqB,CAAC;AAAA,EACtB,cAAc,CAAC;AAChB,GACA,WACI;AACJ,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,qBAAqB;AAAA,UACpB,GAAG,MAAM;AAAA,UACT,OAAO;AAAA,QACR;AAAA,MACD;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,qBAAqB,MAAM,oBAAoB;AAAA,UAC9C,CAAE,cAAe,UAAU,SAAS,OAAO,KAAK;AAAA,QACjD;AAAA,MACD;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,cAAc;AAAA,UACb,GAAG,MAAM;AAAA,UACT,CAAE,OAAO,OAAQ,GAAG,OAAO;AAAA,QAC5B;AAAA,MACD;AAAA,EACF;AACA,SAAO;AACR;AAUO,MAAM,eAAe,CAAE,QAAQ,CAAC,GAAG,WAAY;AACrD,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,OAAO,OAAQ,GAAG;AAAA,UACnB,SAAS,OAAO;AAAA,UAChB,SAAS,OAAO;AAAA,QACjB;AAAA,MACD;AAAA,IACD,KAAK;AACJ,YAAM,EAAE,CAAE,OAAO,OAAQ,GAAG,SAAS,GAAG,UAAU,IAAI;AACtD,aAAO;AAAA,EACT;AACA,SAAO;AACR;AAEA,IAAO,kBAAQ,gBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AACD,CAAE;",
6
+ "names": []
7
+ }
@@ -1,20 +1,7 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { camelCase } from 'change-case';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import apiFetch from '@wordpress/api-fetch';
10
-
11
- /**
12
- * Internal dependencies
13
- */
14
- import { fetchDownloadableBlocks, receiveDownloadableBlocks } from './actions';
15
- export const getDownloadableBlocks = filterValue => async ({
16
- dispatch
17
- }) => {
1
+ import { camelCase } from "change-case";
2
+ import apiFetch from "@wordpress/api-fetch";
3
+ import { fetchDownloadableBlocks, receiveDownloadableBlocks } from "./actions";
4
+ const getDownloadableBlocks = (filterValue) => async ({ dispatch }) => {
18
5
  if (!filterValue) {
19
6
  return;
20
7
  }
@@ -23,10 +10,20 @@ export const getDownloadableBlocks = filterValue => async ({
23
10
  const results = await apiFetch({
24
11
  path: `wp/v2/block-directory/search?term=${filterValue}`
25
12
  });
26
- const blocks = results.map(result => Object.fromEntries(Object.entries(result).map(([key, value]) => [camelCase(key), value])));
13
+ const blocks = results.map(
14
+ (result) => Object.fromEntries(
15
+ Object.entries(result).map(([key, value]) => [
16
+ camelCase(key),
17
+ value
18
+ ])
19
+ )
20
+ );
27
21
  dispatch(receiveDownloadableBlocks(blocks, filterValue));
28
22
  } catch {
29
23
  dispatch(receiveDownloadableBlocks([], filterValue));
30
24
  }
31
25
  };
32
- //# sourceMappingURL=resolvers.js.map
26
+ export {
27
+ getDownloadableBlocks
28
+ };
29
+ //# sourceMappingURL=resolvers.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["camelCase","apiFetch","fetchDownloadableBlocks","receiveDownloadableBlocks","getDownloadableBlocks","filterValue","dispatch","results","path","blocks","map","result","Object","fromEntries","entries","key","value"],"sources":["@wordpress/block-directory/src/store/resolvers.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { camelCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { fetchDownloadableBlocks, receiveDownloadableBlocks } from './actions';\n\nexport const getDownloadableBlocks =\n\t( filterValue ) =>\n\tasync ( { dispatch } ) => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tdispatch( fetchDownloadableBlocks( filterValue ) );\n\t\t\tconst results = await apiFetch( {\n\t\t\t\tpath: `wp/v2/block-directory/search?term=${ filterValue }`,\n\t\t\t} );\n\t\t\tconst blocks = results.map( ( result ) =>\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\tObject.entries( result ).map( ( [ key, value ] ) => [\n\t\t\t\t\t\tcamelCase( key ),\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t] )\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tdispatch( receiveDownloadableBlocks( blocks, filterValue ) );\n\t\t} catch {\n\t\t\tdispatch( receiveDownloadableBlocks( [], filterValue ) );\n\t\t}\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,aAAa;;AAEvC;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,sBAAsB;;AAE3C;AACA;AACA;AACA,SAASC,uBAAuB,EAAEC,yBAAyB,QAAQ,WAAW;AAE9E,OAAO,MAAMC,qBAAqB,GAC/BC,WAAW,IACb,OAAQ;EAAEC;AAAS,CAAC,KAAM;EACzB,IAAK,CAAED,WAAW,EAAG;IACpB;EACD;EAEA,IAAI;IACHC,QAAQ,CAAEJ,uBAAuB,CAAEG,WAAY,CAAE,CAAC;IAClD,MAAME,OAAO,GAAG,MAAMN,QAAQ,CAAE;MAC/BO,IAAI,EAAE,qCAAsCH,WAAW;IACxD,CAAE,CAAC;IACH,MAAMI,MAAM,GAAGF,OAAO,CAACG,GAAG,CAAIC,MAAM,IACnCC,MAAM,CAACC,WAAW,CACjBD,MAAM,CAACE,OAAO,CAAEH,MAAO,CAAC,CAACD,GAAG,CAAE,CAAE,CAAEK,GAAG,EAAEC,KAAK,CAAE,KAAM,CACnDhB,SAAS,CAAEe,GAAI,CAAC,EAChBC,KAAK,CACJ,CACH,CACD,CAAC;IAEDV,QAAQ,CAAEH,yBAAyB,CAAEM,MAAM,EAAEJ,WAAY,CAAE,CAAC;EAC7D,CAAC,CAAC,MAAM;IACPC,QAAQ,CAAEH,yBAAyB,CAAE,EAAE,EAAEE,WAAY,CAAE,CAAC;EACzD;AACD,CAAC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/store/resolvers.js"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { camelCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { fetchDownloadableBlocks, receiveDownloadableBlocks } from './actions';\n\nexport const getDownloadableBlocks =\n\t( filterValue ) =>\n\tasync ( { dispatch } ) => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tdispatch( fetchDownloadableBlocks( filterValue ) );\n\t\t\tconst results = await apiFetch( {\n\t\t\t\tpath: `wp/v2/block-directory/search?term=${ filterValue }`,\n\t\t\t} );\n\t\t\tconst blocks = results.map( ( result ) =>\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\tObject.entries( result ).map( ( [ key, value ] ) => [\n\t\t\t\t\t\tcamelCase( key ),\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t] )\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tdispatch( receiveDownloadableBlocks( blocks, filterValue ) );\n\t\t} catch {\n\t\t\tdispatch( receiveDownloadableBlocks( [], filterValue ) );\n\t\t}\n\t};\n"],
5
+ "mappings": "AAGA,SAAS,iBAAiB;AAK1B,OAAO,cAAc;AAKrB,SAAS,yBAAyB,iCAAiC;AAE5D,MAAM,wBACZ,CAAE,gBACF,OAAQ,EAAE,SAAS,MAAO;AACzB,MAAK,CAAE,aAAc;AACpB;AAAA,EACD;AAEA,MAAI;AACH,aAAU,wBAAyB,WAAY,CAAE;AACjD,UAAM,UAAU,MAAM,SAAU;AAAA,MAC/B,MAAM,qCAAsC,WAAY;AAAA,IACzD,CAAE;AACF,UAAM,SAAS,QAAQ;AAAA,MAAK,CAAE,WAC7B,OAAO;AAAA,QACN,OAAO,QAAS,MAAO,EAAE,IAAK,CAAE,CAAE,KAAK,KAAM,MAAO;AAAA,UACnD,UAAW,GAAI;AAAA,UACf;AAAA,QACD,CAAE;AAAA,MACH;AAAA,IACD;AAEA,aAAU,0BAA2B,QAAQ,WAAY,CAAE;AAAA,EAC5D,QAAQ;AACP,aAAU,0BAA2B,CAAC,GAAG,WAAY,CAAE;AAAA,EACxD;AACD;",
6
+ "names": []
7
+ }
@@ -1,132 +1,88 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { createSelector, createRegistrySelector } from '@wordpress/data';
5
- import { store as blockEditorStore } from '@wordpress/block-editor';
1
+ import { createSelector, createRegistrySelector } from "@wordpress/data";
2
+ import { store as blockEditorStore } from "@wordpress/block-editor";
6
3
  const EMPTY_ARRAY = [];
7
-
8
- /**
9
- * Returns true if application is requesting for downloadable blocks.
10
- *
11
- * @param {Object} state Global application state.
12
- * @param {string} filterValue Search string.
13
- *
14
- * @return {boolean} Whether a request is in progress for the blocks list.
15
- */
16
- export function isRequestingDownloadableBlocks(state, filterValue) {
17
- var _state$downloadableBl;
18
- return (_state$downloadableBl = state.downloadableBlocks[filterValue]?.isRequesting) !== null && _state$downloadableBl !== void 0 ? _state$downloadableBl : false;
4
+ function isRequestingDownloadableBlocks(state, filterValue) {
5
+ return state.downloadableBlocks[filterValue]?.isRequesting ?? false;
19
6
  }
20
-
21
- /**
22
- * Returns the available uninstalled blocks.
23
- *
24
- * @param {Object} state Global application state.
25
- * @param {string} filterValue Search string.
26
- *
27
- * @return {Array} Downloadable blocks.
28
- */
29
- export function getDownloadableBlocks(state, filterValue) {
30
- var _state$downloadableBl2;
31
- return (_state$downloadableBl2 = state.downloadableBlocks[filterValue]?.results) !== null && _state$downloadableBl2 !== void 0 ? _state$downloadableBl2 : EMPTY_ARRAY;
7
+ function getDownloadableBlocks(state, filterValue) {
8
+ return state.downloadableBlocks[filterValue]?.results ?? EMPTY_ARRAY;
32
9
  }
33
-
34
- /**
35
- * Returns the block types that have been installed on the server in this
36
- * session.
37
- *
38
- * @param {Object} state Global application state.
39
- *
40
- * @return {Array} Block type items
41
- */
42
- export function getInstalledBlockTypes(state) {
10
+ function getInstalledBlockTypes(state) {
43
11
  return state.blockManagement.installedBlockTypes;
44
12
  }
45
-
46
- /**
47
- * Returns block types that have been installed on the server and used in the
48
- * current post.
49
- *
50
- * @param {Object} state Global application state.
51
- *
52
- * @return {Array} Block type items.
53
- */
54
- export const getNewBlockTypes = createRegistrySelector(select => createSelector(state => {
55
- const installedBlockTypes = getInstalledBlockTypes(state);
56
- if (!installedBlockTypes.length) {
57
- return EMPTY_ARRAY;
58
- }
59
- const {
60
- getBlockName,
61
- getClientIdsWithDescendants
62
- } = select(blockEditorStore);
63
- const installedBlockNames = installedBlockTypes.map(blockType => blockType.name);
64
- const foundBlockNames = getClientIdsWithDescendants().flatMap(clientId => {
65
- const blockName = getBlockName(clientId);
66
- return installedBlockNames.includes(blockName) ? blockName : [];
67
- });
68
- const newBlockTypes = installedBlockTypes.filter(blockType => foundBlockNames.includes(blockType.name));
69
- return newBlockTypes.length > 0 ? newBlockTypes : EMPTY_ARRAY;
70
- }, state => [getInstalledBlockTypes(state), select(blockEditorStore).getClientIdsWithDescendants()]));
71
-
72
- /**
73
- * Returns the block types that have been installed on the server but are not
74
- * used in the current post.
75
- *
76
- * @param {Object} state Global application state.
77
- *
78
- * @return {Array} Block type items.
79
- */
80
- export const getUnusedBlockTypes = createRegistrySelector(select => createSelector(state => {
81
- const installedBlockTypes = getInstalledBlockTypes(state);
82
- if (!installedBlockTypes.length) {
83
- return EMPTY_ARRAY;
84
- }
85
- const {
86
- getBlockName,
87
- getClientIdsWithDescendants
88
- } = select(blockEditorStore);
89
- const installedBlockNames = installedBlockTypes.map(blockType => blockType.name);
90
- const foundBlockNames = getClientIdsWithDescendants().flatMap(clientId => {
91
- const blockName = getBlockName(clientId);
92
- return installedBlockNames.includes(blockName) ? blockName : [];
93
- });
94
- const unusedBlockTypes = installedBlockTypes.filter(blockType => !foundBlockNames.includes(blockType.name));
95
- return unusedBlockTypes.length > 0 ? unusedBlockTypes : EMPTY_ARRAY;
96
- }, state => [getInstalledBlockTypes(state), select(blockEditorStore).getClientIdsWithDescendants()]));
97
-
98
- /**
99
- * Returns true if a block plugin install is in progress.
100
- *
101
- * @param {Object} state Global application state.
102
- * @param {string} blockId Id of the block.
103
- *
104
- * @return {boolean} Whether this block is currently being installed.
105
- */
106
- export function isInstalling(state, blockId) {
13
+ const getNewBlockTypes = createRegistrySelector(
14
+ (select) => createSelector(
15
+ (state) => {
16
+ const installedBlockTypes = getInstalledBlockTypes(state);
17
+ if (!installedBlockTypes.length) {
18
+ return EMPTY_ARRAY;
19
+ }
20
+ const { getBlockName, getClientIdsWithDescendants } = select(blockEditorStore);
21
+ const installedBlockNames = installedBlockTypes.map(
22
+ (blockType) => blockType.name
23
+ );
24
+ const foundBlockNames = getClientIdsWithDescendants().flatMap(
25
+ (clientId) => {
26
+ const blockName = getBlockName(clientId);
27
+ return installedBlockNames.includes(blockName) ? blockName : [];
28
+ }
29
+ );
30
+ const newBlockTypes = installedBlockTypes.filter(
31
+ (blockType) => foundBlockNames.includes(blockType.name)
32
+ );
33
+ return newBlockTypes.length > 0 ? newBlockTypes : EMPTY_ARRAY;
34
+ },
35
+ (state) => [
36
+ getInstalledBlockTypes(state),
37
+ select(blockEditorStore).getClientIdsWithDescendants()
38
+ ]
39
+ )
40
+ );
41
+ const getUnusedBlockTypes = createRegistrySelector(
42
+ (select) => createSelector(
43
+ (state) => {
44
+ const installedBlockTypes = getInstalledBlockTypes(state);
45
+ if (!installedBlockTypes.length) {
46
+ return EMPTY_ARRAY;
47
+ }
48
+ const { getBlockName, getClientIdsWithDescendants } = select(blockEditorStore);
49
+ const installedBlockNames = installedBlockTypes.map(
50
+ (blockType) => blockType.name
51
+ );
52
+ const foundBlockNames = getClientIdsWithDescendants().flatMap(
53
+ (clientId) => {
54
+ const blockName = getBlockName(clientId);
55
+ return installedBlockNames.includes(blockName) ? blockName : [];
56
+ }
57
+ );
58
+ const unusedBlockTypes = installedBlockTypes.filter(
59
+ (blockType) => !foundBlockNames.includes(blockType.name)
60
+ );
61
+ return unusedBlockTypes.length > 0 ? unusedBlockTypes : EMPTY_ARRAY;
62
+ },
63
+ (state) => [
64
+ getInstalledBlockTypes(state),
65
+ select(blockEditorStore).getClientIdsWithDescendants()
66
+ ]
67
+ )
68
+ );
69
+ function isInstalling(state, blockId) {
107
70
  return state.blockManagement.isInstalling[blockId] || false;
108
71
  }
109
-
110
- /**
111
- * Returns all block error notices.
112
- *
113
- * @param {Object} state Global application state.
114
- *
115
- * @return {Object} Object with error notices.
116
- */
117
- export function getErrorNotices(state) {
72
+ function getErrorNotices(state) {
118
73
  return state.errorNotices;
119
74
  }
120
-
121
- /**
122
- * Returns the error notice for a given block.
123
- *
124
- * @param {Object} state Global application state.
125
- * @param {string} blockId The ID of the block plugin. eg: my-block
126
- *
127
- * @return {string|boolean} The error text, or false if no error.
128
- */
129
- export function getErrorNoticeForBlock(state, blockId) {
75
+ function getErrorNoticeForBlock(state, blockId) {
130
76
  return state.errorNotices[blockId];
131
77
  }
132
- //# sourceMappingURL=selectors.js.map
78
+ export {
79
+ getDownloadableBlocks,
80
+ getErrorNoticeForBlock,
81
+ getErrorNotices,
82
+ getInstalledBlockTypes,
83
+ getNewBlockTypes,
84
+ getUnusedBlockTypes,
85
+ isInstalling,
86
+ isRequestingDownloadableBlocks
87
+ };
88
+ //# sourceMappingURL=selectors.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["createSelector","createRegistrySelector","store","blockEditorStore","EMPTY_ARRAY","isRequestingDownloadableBlocks","state","filterValue","_state$downloadableBl","downloadableBlocks","isRequesting","getDownloadableBlocks","_state$downloadableBl2","results","getInstalledBlockTypes","blockManagement","installedBlockTypes","getNewBlockTypes","select","length","getBlockName","getClientIdsWithDescendants","installedBlockNames","map","blockType","name","foundBlockNames","flatMap","clientId","blockName","includes","newBlockTypes","filter","getUnusedBlockTypes","unusedBlockTypes","isInstalling","blockId","getErrorNotices","errorNotices","getErrorNoticeForBlock"],"sources":["@wordpress/block-directory/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Returns true if application is requesting for downloadable blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {boolean} Whether a request is in progress for the blocks list.\n */\nexport function isRequestingDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.isRequesting ?? false;\n}\n\n/**\n * Returns the available uninstalled blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {Array} Downloadable blocks.\n */\nexport function getDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.results ?? EMPTY_ARRAY;\n}\n\n/**\n * Returns the block types that have been installed on the server in this\n * session.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items\n */\nexport function getInstalledBlockTypes( state ) {\n\treturn state.blockManagement.installedBlockTypes;\n}\n\n/**\n * Returns block types that have been installed on the server and used in the\n * current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getNewBlockTypes = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\t\t\tif ( ! installedBlockTypes.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\n\t\t\tconst { getBlockName, getClientIdsWithDescendants } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst installedBlockNames = installedBlockTypes.map(\n\t\t\t\t( blockType ) => blockType.name\n\t\t\t);\n\t\t\tconst foundBlockNames = getClientIdsWithDescendants().flatMap(\n\t\t\t\t( clientId ) => {\n\t\t\t\t\tconst blockName = getBlockName( clientId );\n\t\t\t\t\treturn installedBlockNames.includes( blockName )\n\t\t\t\t\t\t? blockName\n\t\t\t\t\t\t: [];\n\t\t\t\t}\n\t\t\t);\n\t\t\tconst newBlockTypes = installedBlockTypes.filter( ( blockType ) =>\n\t\t\t\tfoundBlockNames.includes( blockType.name )\n\t\t\t);\n\n\t\t\treturn newBlockTypes.length > 0 ? newBlockTypes : EMPTY_ARRAY;\n\t\t},\n\t\t( state ) => [\n\t\t\tgetInstalledBlockTypes( state ),\n\t\t\tselect( blockEditorStore ).getClientIdsWithDescendants(),\n\t\t]\n\t)\n);\n\n/**\n * Returns the block types that have been installed on the server but are not\n * used in the current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getUnusedBlockTypes = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\t\t\tif ( ! installedBlockTypes.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\n\t\t\tconst { getBlockName, getClientIdsWithDescendants } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst installedBlockNames = installedBlockTypes.map(\n\t\t\t\t( blockType ) => blockType.name\n\t\t\t);\n\t\t\tconst foundBlockNames = getClientIdsWithDescendants().flatMap(\n\t\t\t\t( clientId ) => {\n\t\t\t\t\tconst blockName = getBlockName( clientId );\n\t\t\t\t\treturn installedBlockNames.includes( blockName )\n\t\t\t\t\t\t? blockName\n\t\t\t\t\t\t: [];\n\t\t\t\t}\n\t\t\t);\n\t\t\tconst unusedBlockTypes = installedBlockTypes.filter(\n\t\t\t\t( blockType ) => ! foundBlockNames.includes( blockType.name )\n\t\t\t);\n\n\t\t\treturn unusedBlockTypes.length > 0 ? unusedBlockTypes : EMPTY_ARRAY;\n\t\t},\n\t\t( state ) => [\n\t\t\tgetInstalledBlockTypes( state ),\n\t\t\tselect( blockEditorStore ).getClientIdsWithDescendants(),\n\t\t]\n\t)\n);\n\n/**\n * Returns true if a block plugin install is in progress.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId Id of the block.\n *\n * @return {boolean} Whether this block is currently being installed.\n */\nexport function isInstalling( state, blockId ) {\n\treturn state.blockManagement.isInstalling[ blockId ] || false;\n}\n\n/**\n * Returns all block error notices.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Object with error notices.\n */\nexport function getErrorNotices( state ) {\n\treturn state.errorNotices;\n}\n\n/**\n * Returns the error notice for a given block.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId The ID of the block plugin. eg: my-block\n *\n * @return {string|boolean} The error text, or false if no error.\n */\nexport function getErrorNoticeForBlock( state, blockId ) {\n\treturn state.errorNotices[ blockId ];\n}\n"],"mappings":"AAA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AgB,GAAGlB,mBAAmB,CAACgB,MAAM,CAChDR,SAAS,IAAM,CAAEE,eAAe,CAACI,QAAQ,CAAEN,SAAS,CAACC,IAAK,CAC7D,CAAC;EAED,OAAOS,gBAAgB,CAACf,MAAM,GAAG,CAAC,GAAGe,gBAAgB,GAAG9B,WAAW;AACpE,CAAC,EACCE,KAAK,IAAM,CACZQ,sBAAsB,CAAER,KAAM,CAAC,EAC/BY,MAAM,CAAEf,gBAAiB,CAAC,CAACkB,2BAA2B,CAAC,CAAC,CAE1D,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASc,YAAYA,CAAE7B,KAAK,EAAE8B,OAAO,EAAG;EAC9C,OAAO9B,KAAK,CAACS,eAAe,CAACoB,YAAY,CAAEC,OAAO,CAAE,IAAI,KAAK;AAC9D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAAE/B,KAAK,EAAG;EACxC,OAAOA,KAAK,CAACgC,YAAY;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAAEjC,KAAK,EAAE8B,OAAO,EAAG;EACxD,OAAO9B,KAAK,CAACgC,YAAY,CAAEF,OAAO,CAAE;AACrC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/store/selectors.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Returns true if application is requesting for downloadable blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {boolean} Whether a request is in progress for the blocks list.\n */\nexport function isRequestingDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.isRequesting ?? false;\n}\n\n/**\n * Returns the available uninstalled blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {Array} Downloadable blocks.\n */\nexport function getDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.results ?? EMPTY_ARRAY;\n}\n\n/**\n * Returns the block types that have been installed on the server in this\n * session.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items\n */\nexport function getInstalledBlockTypes( state ) {\n\treturn state.blockManagement.installedBlockTypes;\n}\n\n/**\n * Returns block types that have been installed on the server and used in the\n * current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getNewBlockTypes = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\t\t\tif ( ! installedBlockTypes.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\n\t\t\tconst { getBlockName, getClientIdsWithDescendants } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst installedBlockNames = installedBlockTypes.map(\n\t\t\t\t( blockType ) => blockType.name\n\t\t\t);\n\t\t\tconst foundBlockNames = getClientIdsWithDescendants().flatMap(\n\t\t\t\t( clientId ) => {\n\t\t\t\t\tconst blockName = getBlockName( clientId );\n\t\t\t\t\treturn installedBlockNames.includes( blockName )\n\t\t\t\t\t\t? blockName\n\t\t\t\t\t\t: [];\n\t\t\t\t}\n\t\t\t);\n\t\t\tconst newBlockTypes = installedBlockTypes.filter( ( blockType ) =>\n\t\t\t\tfoundBlockNames.includes( blockType.name )\n\t\t\t);\n\n\t\t\treturn newBlockTypes.length > 0 ? newBlockTypes : EMPTY_ARRAY;\n\t\t},\n\t\t( state ) => [\n\t\t\tgetInstalledBlockTypes( state ),\n\t\t\tselect( blockEditorStore ).getClientIdsWithDescendants(),\n\t\t]\n\t)\n);\n\n/**\n * Returns the block types that have been installed on the server but are not\n * used in the current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getUnusedBlockTypes = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\t\t\tif ( ! installedBlockTypes.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\n\t\t\tconst { getBlockName, getClientIdsWithDescendants } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst installedBlockNames = installedBlockTypes.map(\n\t\t\t\t( blockType ) => blockType.name\n\t\t\t);\n\t\t\tconst foundBlockNames = getClientIdsWithDescendants().flatMap(\n\t\t\t\t( clientId ) => {\n\t\t\t\t\tconst blockName = getBlockName( clientId );\n\t\t\t\t\treturn installedBlockNames.includes( blockName )\n\t\t\t\t\t\t? blockName\n\t\t\t\t\t\t: [];\n\t\t\t\t}\n\t\t\t);\n\t\t\tconst unusedBlockTypes = installedBlockTypes.filter(\n\t\t\t\t( blockType ) => ! foundBlockNames.includes( blockType.name )\n\t\t\t);\n\n\t\t\treturn unusedBlockTypes.length > 0 ? unusedBlockTypes : EMPTY_ARRAY;\n\t\t},\n\t\t( state ) => [\n\t\t\tgetInstalledBlockTypes( state ),\n\t\t\tselect( blockEditorStore ).getClientIdsWithDescendants(),\n\t\t]\n\t)\n);\n\n/**\n * Returns true if a block plugin install is in progress.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId Id of the block.\n *\n * @return {boolean} Whether this block is currently being installed.\n */\nexport function isInstalling( state, blockId ) {\n\treturn state.blockManagement.isInstalling[ blockId ] || false;\n}\n\n/**\n * Returns all block error notices.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Object with error notices.\n */\nexport function getErrorNotices( state ) {\n\treturn state.errorNotices;\n}\n\n/**\n * Returns the error notice for a given block.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId The ID of the block plugin. eg: my-block\n *\n * @return {string|boolean} The error text, or false if no error.\n */\nexport function getErrorNoticeForBlock( state, blockId ) {\n\treturn state.errorNotices[ blockId ];\n}\n"],
5
+ "mapp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AAQ,gBAAiB;AAC1B,YAAM,sBAAsB,oBAAoB;AAAA,QAC/C,CAAE,cAAe,UAAU;AAAA,MAC5B;AACA,YAAM,kBAAkB,4BAA4B,EAAE;AAAA,QACrD,CAAE,aAAc;AACf,gBAAM,YAAY,aAAc,QAAS;AACzC,iBAAO,oBAAoB,SAAU,SAAU,IAC5C,YACA,CAAC;AAAA,QACL;AAAA,MACD;AACA,YAAM,mBAAmB,oBAAoB;AAAA,QAC5C,CAAE,cAAe,CAAE,gBAAgB,SAAU,UAAU,IAAK;AAAA,MAC7D;AAEA,aAAO,iBAAiB,SAAS,IAAI,mBAAmB;AAAA,IACzD;AAAA,IACA,CAAE,UAAW;AAAA,MACZ,uBAAwB,KAAM;AAAA,MAC9B,OAAQ,gBAAiB,EAAE,4BAA4B;AAAA,IACxD;AAAA,EACD;AACD;AAUO,SAAS,aAAc,OAAO,SAAU;AAC9C,SAAO,MAAM,gBAAgB,aAAc,OAAQ,KAAK;AACzD;AASO,SAAS,gBAAiB,OAAQ;AACxC,SAAO,MAAM;AACd;AAUO,SAAS,uBAAwB,OAAO,SAAU;AACxD,SAAO,MAAM,aAAc,OAAQ;AACpC;",
6
+ "names": []
7
+ }
@@ -1,18 +1,14 @@
1
- /**
2
- * Get the plugin's direct API link out of a block-directory response.
3
- *
4
- * @param {Object} block The block object
5
- *
6
- * @return {string} The plugin URL, if exists.
7
- */
8
- export default function getPluginUrl(block) {
1
+ function getPluginUrl(block) {
9
2
  if (!block) {
10
3
  return false;
11
4
  }
12
- const link = block.links['wp:plugin'] || block.links.self;
5
+ const link = block.links["wp:plugin"] || block.links.self;
13
6
  if (link && link.length) {
14
7
  return link[0].href;
15
8
  }
16
9
  return false;
17
10
  }
18
- //# sourceMappingURL=get-plugin-url.js.map
11
+ export {
12
+ getPluginUrl as default
13
+ };
14
+ //# sourceMappingURL=get-plugin-url.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["getPluginUrl","block","link","links","self","length","href"],"sources":["@wordpress/block-directory/src/store/utils/get-plugin-url.js"],"sourcesContent":["/**\n * Get the plugin's direct API link out of a block-directory response.\n *\n * @param {Object} block The block object\n *\n * @return {string} The plugin URL, if exists.\n */\nexport default function getPluginUrl( block ) {\n\tif ( ! block ) {\n\t\treturn false;\n\t}\n\tconst link = block.links[ 'wp:plugin' ] || block.links.self;\n\tif ( link && link.length ) {\n\t\treturn link[ 0 ].href;\n\t}\n\treturn false;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,YAAYA,CAAEC,KAAK,EAAG;EAC7C,IAAK,CAAEA,KAAK,EAAG;IACd,OAAO,KAAK;EACb;EACA,MAAMC,IAAI,GAAGD,KAAK,CAACE,KAAK,CAAE,WAAW,CAAE,IAAIF,KAAK,CAACE,KAAK,CAACC,IAAI;EAC3D,IAAKF,IAAI,IAAIA,IAAI,CAACG,MAAM,EAAG;IAC1B,OAAOH,IAAI,CAAE,CAAC,CAAE,CAACI,IAAI;EACtB;EACA,OAAO,KAAK;AACb","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/store/utils/get-plugin-url.js"],
4
+ "sourcesContent": ["/**\n * Get the plugin's direct API link out of a block-directory response.\n *\n * @param {Object} block The block object\n *\n * @return {string} The plugin URL, if exists.\n */\nexport default function getPluginUrl( block ) {\n\tif ( ! block ) {\n\t\treturn false;\n\t}\n\tconst link = block.links[ 'wp:plugin' ] || block.links.self;\n\tif ( link && link.length ) {\n\t\treturn link[ 0 ].href;\n\t}\n\treturn false;\n}\n"],
5
+ "mappings": "AAOe,SAAR,aAA+B,OAAQ;AAC7C,MAAK,CAAE,OAAQ;AACd,WAAO;AAAA,EACR;AACA,QAAM,OAAO,MAAM,MAAO,WAAY,KAAK,MAAM,MAAM;AACvD,MAAK,QAAQ,KAAK,QAAS;AAC1B,WAAO,KAAM,CAAE,EAAE;AAAA,EAClB;AACA,SAAO;AACR;",
6
+ "names": []
7
+ }