@wordpress/edit-post 7.11.0 → 7.12.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 (328) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-manager/category.js +14 -22
  3. package/build/components/block-manager/category.js.map +1 -1
  4. package/build/components/block-manager/checklist.js +6 -13
  5. package/build/components/block-manager/checklist.js.map +1 -1
  6. package/build/components/block-manager/index.js +29 -17
  7. package/build/components/block-manager/index.js.map +1 -1
  8. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +21 -26
  9. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  10. package/build/components/device-preview/index.js +3 -5
  11. package/build/components/device-preview/index.js.map +1 -1
  12. package/build/components/editor-initialization/index.js +3 -4
  13. package/build/components/editor-initialization/index.js.map +1 -1
  14. package/build/components/header/document-title/index.js +103 -0
  15. package/build/components/header/document-title/index.js.map +1 -0
  16. package/build/components/header/fullscreen-mode-close/index.js +8 -9
  17. package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
  18. package/build/components/header/header-toolbar/index.js +2 -2
  19. package/build/components/header/header-toolbar/index.js.map +1 -1
  20. package/build/components/header/header-toolbar/index.native.js +12 -13
  21. package/build/components/header/header-toolbar/index.native.js.map +1 -1
  22. package/build/components/header/index.js +14 -20
  23. package/build/components/header/index.js.map +1 -1
  24. package/build/components/header/main-dashboard-button/index.js +3 -4
  25. package/build/components/header/main-dashboard-button/index.js.map +1 -1
  26. package/build/components/header/more-menu/index.js +19 -23
  27. package/build/components/header/more-menu/index.js.map +1 -1
  28. package/build/components/header/plugin-sidebar-more-menu-item/index.js +4 -7
  29. package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -1
  30. package/build/components/header/post-publish-button-or-toggle.js +15 -16
  31. package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
  32. package/build/components/header/tools-more-menu-group/index.js +7 -10
  33. package/build/components/header/tools-more-menu-group/index.js.map +1 -1
  34. package/build/components/header/writing-menu/index.js +0 -8
  35. package/build/components/header/writing-menu/index.js.map +1 -1
  36. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
  37. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  38. package/build/components/keyboard-shortcut-help-modal/index.js +45 -54
  39. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  40. package/build/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
  41. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  42. package/build/components/keyboard-shortcuts/index.js +1 -1
  43. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  44. package/build/components/layout/actions-panel.js +5 -6
  45. package/build/components/layout/actions-panel.js.map +1 -1
  46. package/build/components/layout/index.js +3 -4
  47. package/build/components/layout/index.js.map +1 -1
  48. package/build/components/layout/index.native.js +3 -7
  49. package/build/components/layout/index.native.js.map +1 -1
  50. package/build/components/meta-boxes/index.js +9 -13
  51. package/build/components/meta-boxes/index.js.map +1 -1
  52. package/build/components/meta-boxes/meta-box-visibility.js +5 -8
  53. package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
  54. package/build/components/meta-boxes/meta-boxes-area/index.js +3 -4
  55. package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  56. package/build/components/preferences-modal/meta-boxes-section.js +18 -24
  57. package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
  58. package/build/components/preferences-modal/options/enable-custom-fields.js +8 -10
  59. package/build/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
  60. package/build/components/preferences-modal/options/enable-feature.js +12 -16
  61. package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
  62. package/build/components/preferences-modal/options/enable-panel.js +10 -17
  63. package/build/components/preferences-modal/options/enable-panel.js.map +1 -1
  64. package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js +7 -10
  65. package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +1 -1
  66. package/build/components/secondary-sidebar/inserter-sidebar.js +4 -8
  67. package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  68. package/build/components/secondary-sidebar/list-view-sidebar.js +58 -44
  69. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  70. package/build/components/sidebar/discussion-panel/index.js +5 -7
  71. package/build/components/sidebar/discussion-panel/index.js.map +1 -1
  72. package/build/components/sidebar/featured-image/index.js +9 -17
  73. package/build/components/sidebar/featured-image/index.js.map +1 -1
  74. package/build/components/sidebar/page-attributes/index.js +3 -9
  75. package/build/components/sidebar/page-attributes/index.js.map +1 -1
  76. package/build/components/sidebar/plugin-document-setting-panel/index.js +20 -25
  77. package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  78. package/build/components/sidebar/plugin-post-publish-panel/index.js +12 -15
  79. package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  80. package/build/components/sidebar/plugin-post-status-info/index.js +6 -9
  81. package/build/components/sidebar/plugin-post-status-info/index.js.map +1 -1
  82. package/build/components/sidebar/plugin-pre-publish-panel/index.js +12 -15
  83. package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  84. package/build/components/sidebar/plugin-sidebar/index.js +8 -12
  85. package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
  86. package/build/components/sidebar/post-excerpt/index.js +5 -7
  87. package/build/components/sidebar/post-excerpt/index.js.map +1 -1
  88. package/build/components/sidebar/post-schedule/index.js +16 -23
  89. package/build/components/sidebar/post-schedule/index.js.map +1 -1
  90. package/build/components/sidebar/post-status/index.js +8 -12
  91. package/build/components/sidebar/post-status/index.js.map +1 -1
  92. package/build/components/sidebar/post-taxonomies/taxonomy-panel.js +9 -15
  93. package/build/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
  94. package/build/components/sidebar/post-template/create-modal.js +3 -4
  95. package/build/components/sidebar/post-template/create-modal.js.map +1 -1
  96. package/build/components/sidebar/post-template/form.js +13 -20
  97. package/build/components/sidebar/post-template/form.js.map +1 -1
  98. package/build/components/sidebar/post-template/index.js +18 -25
  99. package/build/components/sidebar/post-template/index.js.map +1 -1
  100. package/build/components/sidebar/post-url/index.js +16 -23
  101. package/build/components/sidebar/post-url/index.js.map +1 -1
  102. package/build/components/sidebar/post-visibility/index.js +26 -36
  103. package/build/components/sidebar/post-visibility/index.js.map +1 -1
  104. package/build/components/sidebar/settings-header/index.js +3 -4
  105. package/build/components/sidebar/settings-header/index.js.map +1 -1
  106. package/build/components/sidebar/template-summary/index.js +1 -1
  107. package/build/components/sidebar/template-summary/index.js.map +1 -1
  108. package/build/components/start-page-options/index.js +3 -4
  109. package/build/components/start-page-options/index.js.map +1 -1
  110. package/build/components/view-link/index.js +1 -1
  111. package/build/components/view-link/index.js.map +1 -1
  112. package/build/components/visual-editor/block-inspector-button.js +4 -5
  113. package/build/components/visual-editor/block-inspector-button.js.map +1 -1
  114. package/build/components/visual-editor/header.native.js +6 -7
  115. package/build/components/visual-editor/header.native.js.map +1 -1
  116. package/build/components/visual-editor/index.js +49 -57
  117. package/build/components/visual-editor/index.js.map +1 -1
  118. package/build/components/welcome-guide/image.js +4 -5
  119. package/build/components/welcome-guide/image.js.map +1 -1
  120. package/build/editor.js +42 -30
  121. package/build/editor.js.map +1 -1
  122. package/build/editor.native.js +7 -11
  123. package/build/editor.native.js.map +1 -1
  124. package/build/hooks/validate-multiple-use/index.js +24 -37
  125. package/build/hooks/validate-multiple-use/index.js.map +1 -1
  126. package/build/index.js +18 -2
  127. package/build/index.js.map +1 -1
  128. package/build/{private-apis.js → lock-unlock.js} +1 -1
  129. package/build/lock-unlock.js.map +1 -0
  130. package/build/plugins/index.js +20 -23
  131. package/build/plugins/index.js.map +1 -1
  132. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +3 -4
  133. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
  134. package/build/store/actions.js +60 -88
  135. package/build/store/actions.js.map +1 -1
  136. package/build/store/reducer.js +11 -43
  137. package/build/store/reducer.js.map +1 -1
  138. package/build/store/selectors.js +11 -16
  139. package/build/store/selectors.js.map +1 -1
  140. package/build-module/components/block-manager/category.js +14 -22
  141. package/build-module/components/block-manager/category.js.map +1 -1
  142. package/build-module/components/block-manager/checklist.js +6 -13
  143. package/build-module/components/block-manager/checklist.js.map +1 -1
  144. package/build-module/components/block-manager/index.js +32 -20
  145. package/build-module/components/block-manager/index.js.map +1 -1
  146. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +21 -26
  147. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  148. package/build-module/components/device-preview/index.js +3 -5
  149. package/build-module/components/device-preview/index.js.map +1 -1
  150. package/build-module/components/editor-initialization/index.js +3 -4
  151. package/build-module/components/editor-initialization/index.js.map +1 -1
  152. package/build-module/components/header/document-title/index.js +88 -0
  153. package/build-module/components/header/document-title/index.js.map +1 -0
  154. package/build-module/components/header/fullscreen-mode-close/index.js +7 -8
  155. package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
  156. package/build-module/components/header/header-toolbar/index.js +1 -1
  157. package/build-module/components/header/header-toolbar/index.js.map +1 -1
  158. package/build-module/components/header/header-toolbar/index.native.js +12 -13
  159. package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
  160. package/build-module/components/header/index.js +14 -20
  161. package/build-module/components/header/index.js.map +1 -1
  162. package/build-module/components/header/main-dashboard-button/index.js +3 -4
  163. package/build-module/components/header/main-dashboard-button/index.js.map +1 -1
  164. package/build-module/components/header/more-menu/index.js +19 -23
  165. package/build-module/components/header/more-menu/index.js.map +1 -1
  166. package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +4 -4
  167. package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -1
  168. package/build-module/components/header/post-publish-button-or-toggle.js +15 -16
  169. package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
  170. package/build-module/components/header/tools-more-menu-group/index.js +7 -10
  171. package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
  172. package/build-module/components/header/writing-menu/index.js +0 -8
  173. package/build-module/components/header/writing-menu/index.js.map +1 -1
  174. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
  175. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  176. package/build-module/components/keyboard-shortcut-help-modal/index.js +43 -52
  177. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  178. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
  179. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  180. package/build-module/components/keyboard-shortcuts/index.js +1 -1
  181. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  182. package/build-module/components/layout/actions-panel.js +5 -6
  183. package/build-module/components/layout/actions-panel.js.map +1 -1
  184. package/build-module/components/layout/index.js +3 -4
  185. package/build-module/components/layout/index.js.map +1 -1
  186. package/build-module/components/layout/index.native.js +3 -7
  187. package/build-module/components/layout/index.native.js.map +1 -1
  188. package/build-module/components/meta-boxes/index.js +9 -13
  189. package/build-module/components/meta-boxes/index.js.map +1 -1
  190. package/build-module/components/meta-boxes/meta-box-visibility.js +5 -8
  191. package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
  192. package/build-module/components/meta-boxes/meta-boxes-area/index.js +3 -4
  193. package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  194. package/build-module/components/preferences-modal/meta-boxes-section.js +18 -24
  195. package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
  196. package/build-module/components/preferences-modal/options/enable-custom-fields.js +8 -10
  197. package/build-module/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
  198. package/build-module/components/preferences-modal/options/enable-feature.js +12 -16
  199. package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
  200. package/build-module/components/preferences-modal/options/enable-panel.js +10 -17
  201. package/build-module/components/preferences-modal/options/enable-panel.js.map +1 -1
  202. package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js +7 -10
  203. package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +1 -1
  204. package/build-module/components/secondary-sidebar/inserter-sidebar.js +4 -5
  205. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  206. package/build-module/components/secondary-sidebar/list-view-sidebar.js +58 -44
  207. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  208. package/build-module/components/sidebar/discussion-panel/index.js +5 -7
  209. package/build-module/components/sidebar/discussion-panel/index.js.map +1 -1
  210. package/build-module/components/sidebar/featured-image/index.js +9 -17
  211. package/build-module/components/sidebar/featured-image/index.js.map +1 -1
  212. package/build-module/components/sidebar/page-attributes/index.js +3 -9
  213. package/build-module/components/sidebar/page-attributes/index.js.map +1 -1
  214. package/build-module/components/sidebar/plugin-document-setting-panel/index.js +20 -25
  215. package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  216. package/build-module/components/sidebar/plugin-post-publish-panel/index.js +12 -15
  217. package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  218. package/build-module/components/sidebar/plugin-post-status-info/index.js +6 -9
  219. package/build-module/components/sidebar/plugin-post-status-info/index.js.map +1 -1
  220. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +12 -15
  221. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  222. package/build-module/components/sidebar/plugin-sidebar/index.js +8 -9
  223. package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
  224. package/build-module/components/sidebar/post-excerpt/index.js +5 -7
  225. package/build-module/components/sidebar/post-excerpt/index.js.map +1 -1
  226. package/build-module/components/sidebar/post-schedule/index.js +16 -23
  227. package/build-module/components/sidebar/post-schedule/index.js.map +1 -1
  228. package/build-module/components/sidebar/post-status/index.js +9 -13
  229. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  230. package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js +9 -15
  231. package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
  232. package/build-module/components/sidebar/post-template/create-modal.js +3 -4
  233. package/build-module/components/sidebar/post-template/create-modal.js.map +1 -1
  234. package/build-module/components/sidebar/post-template/form.js +13 -20
  235. package/build-module/components/sidebar/post-template/form.js.map +1 -1
  236. package/build-module/components/sidebar/post-template/index.js +18 -25
  237. package/build-module/components/sidebar/post-template/index.js.map +1 -1
  238. package/build-module/components/sidebar/post-url/index.js +16 -23
  239. package/build-module/components/sidebar/post-url/index.js.map +1 -1
  240. package/build-module/components/sidebar/post-visibility/index.js +26 -36
  241. package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
  242. package/build-module/components/sidebar/settings-header/index.js +3 -4
  243. package/build-module/components/sidebar/settings-header/index.js.map +1 -1
  244. package/build-module/components/sidebar/template-summary/index.js +1 -1
  245. package/build-module/components/sidebar/template-summary/index.js.map +1 -1
  246. package/build-module/components/start-page-options/index.js +3 -4
  247. package/build-module/components/start-page-options/index.js.map +1 -1
  248. package/build-module/components/view-link/index.js +1 -1
  249. package/build-module/components/view-link/index.js.map +1 -1
  250. package/build-module/components/visual-editor/block-inspector-button.js +4 -5
  251. package/build-module/components/visual-editor/block-inspector-button.js.map +1 -1
  252. package/build-module/components/visual-editor/header.native.js +6 -7
  253. package/build-module/components/visual-editor/header.native.js.map +1 -1
  254. package/build-module/components/visual-editor/index.js +47 -54
  255. package/build-module/components/visual-editor/index.js.map +1 -1
  256. package/build-module/components/welcome-guide/image.js +4 -5
  257. package/build-module/components/welcome-guide/image.js.map +1 -1
  258. package/build-module/editor.js +38 -26
  259. package/build-module/editor.js.map +1 -1
  260. package/build-module/editor.native.js +7 -10
  261. package/build-module/editor.native.js.map +1 -1
  262. package/build-module/hooks/validate-multiple-use/index.js +24 -34
  263. package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
  264. package/build-module/index.js +18 -2
  265. package/build-module/index.js.map +1 -1
  266. package/build-module/{private-apis.js → lock-unlock.js} +1 -1
  267. package/build-module/lock-unlock.js.map +1 -0
  268. package/build-module/plugins/index.js +20 -23
  269. package/build-module/plugins/index.js.map +1 -1
  270. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +3 -4
  271. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
  272. package/build-module/store/actions.js +60 -88
  273. package/build-module/store/actions.js.map +1 -1
  274. package/build-module/store/reducer.js +11 -43
  275. package/build-module/store/reducer.js.map +1 -1
  276. package/build-module/store/selectors.js +11 -16
  277. package/build-module/store/selectors.js.map +1 -1
  278. package/build-style/style-rtl.css +66 -102
  279. package/build-style/style.css +66 -102
  280. package/package.json +32 -32
  281. package/src/components/block-manager/index.js +51 -31
  282. package/src/components/block-manager/style.scss +3 -1
  283. package/src/components/device-preview/index.js +1 -2
  284. package/src/components/header/document-title/index.js +86 -0
  285. package/src/components/header/document-title/style.scss +61 -0
  286. package/src/components/header/header-toolbar/index.js +1 -1
  287. package/src/components/header/header-toolbar/style.scss +0 -1
  288. package/src/components/header/index.js +7 -10
  289. package/src/components/header/style.scss +6 -0
  290. package/src/components/header/writing-menu/index.js +0 -10
  291. package/src/components/keyboard-shortcuts/index.js +1 -1
  292. package/src/components/preferences-modal/options/enable-custom-fields.js +2 -2
  293. package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap +2 -2
  294. package/src/components/preferences-modal/test/__snapshots__/index.js.snap +10 -4
  295. package/src/components/secondary-sidebar/list-view-sidebar.js +68 -66
  296. package/src/components/secondary-sidebar/style.scss +28 -31
  297. package/src/components/sidebar/post-status/index.js +2 -1
  298. package/src/components/visual-editor/index.js +22 -32
  299. package/src/components/visual-editor/style.scss +0 -13
  300. package/src/editor.js +22 -1
  301. package/src/index.js +30 -3
  302. package/src/plugins/index.js +1 -1
  303. package/src/style.scss +1 -1
  304. package/src/test/editor.native.js +34 -9
  305. package/build/components/header/template-title/delete-template.js +0 -117
  306. package/build/components/header/template-title/delete-template.js.map +0 -1
  307. package/build/components/header/template-title/edit-template-title.js +0 -95
  308. package/build/components/header/template-title/edit-template-title.js.map +0 -1
  309. package/build/components/header/template-title/index.js +0 -124
  310. package/build/components/header/template-title/index.js.map +0 -1
  311. package/build/components/header/template-title/template-description.js +0 -55
  312. package/build/components/header/template-title/template-description.js.map +0 -1
  313. package/build/private-apis.js.map +0 -1
  314. package/build-module/components/header/template-title/delete-template.js +0 -104
  315. package/build-module/components/header/template-title/delete-template.js.map +0 -1
  316. package/build-module/components/header/template-title/edit-template-title.js +0 -83
  317. package/build-module/components/header/template-title/edit-template-title.js.map +0 -1
  318. package/build-module/components/header/template-title/index.js +0 -105
  319. package/build-module/components/header/template-title/index.js.map +0 -1
  320. package/build-module/components/header/template-title/template-description.js +0 -45
  321. package/build-module/components/header/template-title/template-description.js.map +0 -1
  322. package/build-module/private-apis.js.map +0 -1
  323. package/src/components/header/template-title/delete-template.js +0 -106
  324. package/src/components/header/template-title/edit-template-title.js +0 -78
  325. package/src/components/header/template-title/index.js +0 -115
  326. package/src/components/header/template-title/style.scss +0 -94
  327. package/src/components/header/template-title/template-description.js +0 -42
  328. /package/src/{private-apis.js → lock-unlock.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/store/reducer.js"],"names":["removedPanels","state","action","type","includes","panelName","activeModal","name","publishSidebarActive","isSavingMetaBoxes","mergeMetaboxes","metaboxes","newMetaboxes","mergedMetaboxes","metabox","existing","findIndex","box","id","push","metaBoxLocations","newState","location","Object","entries","metaBoxesPerLocation","deviceType","blockInserterPanel","isOpen","value","listViewPanel","isEditingTemplate","metaBoxesInitialized","metaBoxes","isSaving","locations","initialized"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,GAA6C;AAAA,MAArBC,KAAqB,uEAAb,EAAa;AAAA,MAATC,MAAS;;AACnD,UAASA,MAAM,CAACC,IAAhB;AACC,SAA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,kBAN+B;AAO/BG,EAAAA,aAP+B;AAQ/BC,EAAAA;AAR+B,CAAjB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer storing the list of all programmatically removed panels.\n *\n * @param {Array} state Current state.\n * @param {Object} action Action object.\n *\n * @return {Array} Updated state.\n */\nexport function removedPanels( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REMOVE_PANEL':\n\t\t\tif ( ! state.includes( action.panelName ) ) {\n\t\t\t\treturn [ ...state, action.panelName ];\n\t\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for storing the name of the open modal, or null if no modal is open.\n *\n * @param {Object} state Previous state.\n * @param {Object} action Action object containing the `name` of the modal\n *\n * @return {Object} Updated state\n */\nexport function activeModal( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_MODAL':\n\t\t\treturn action.name;\n\t\tcase 'CLOSE_MODAL':\n\t\t\treturn null;\n\t}\n\n\treturn state;\n}\n\nexport function publishSidebarActive( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_PUBLISH_SIDEBAR':\n\t\t\treturn true;\n\t\tcase 'CLOSE_PUBLISH_SIDEBAR':\n\t\t\treturn false;\n\t\tcase 'TOGGLE_PUBLISH_SIDEBAR':\n\t\t\treturn ! state;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the meta boxes isSaving state.\n * A \"true\" value means the meta boxes saving request is in-flight.\n *\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function isSavingMetaBoxes( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_META_BOX_UPDATES':\n\t\t\treturn true;\n\t\tcase 'META_BOX_UPDATES_SUCCESS':\n\t\tcase 'META_BOX_UPDATES_FAILURE':\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn state;\n\t}\n}\n\nfunction mergeMetaboxes( metaboxes = [], newMetaboxes ) {\n\tconst mergedMetaboxes = [ ...metaboxes ];\n\tfor ( const metabox of newMetaboxes ) {\n\t\tconst existing = mergedMetaboxes.findIndex(\n\t\t\t( box ) => box.id === metabox.id\n\t\t);\n\t\tif ( existing !== -1 ) {\n\t\t\tmergedMetaboxes[ existing ] = metabox;\n\t\t} else {\n\t\t\tmergedMetaboxes.push( metabox );\n\t\t}\n\t}\n\treturn mergedMetaboxes;\n}\n\n/**\n * Reducer keeping track of the meta boxes per location.\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function metaBoxLocations( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_META_BOXES_PER_LOCATIONS': {\n\t\t\tconst newState = { ...state };\n\t\t\tfor ( const [ location, metaboxes ] of Object.entries(\n\t\t\t\taction.metaBoxesPerLocation\n\t\t\t) ) {\n\t\t\t\tnewState[ location ] = mergeMetaboxes(\n\t\t\t\t\tnewState[ location ],\n\t\t\t\t\tmetaboxes\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn newState;\n\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the inserter panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking whether template editing is on or off.\n *\n * @param {boolean} state\n * @param {Object} action\n */\nfunction isEditingTemplate( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_EDITING_TEMPLATE':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking whether meta boxes are initialized.\n *\n * @param {boolean} state\n * @param {Object} action\n *\n * @return {boolean} Updated state.\n */\nfunction metaBoxesInitialized( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'META_BOXES_INITIALIZED':\n\t\t\treturn true;\n\t}\n\treturn state;\n}\n\nconst metaBoxes = combineReducers( {\n\tisSaving: isSavingMetaBoxes,\n\tlocations: metaBoxLocations,\n\tinitialized: metaBoxesInitialized,\n} );\n\nexport default combineReducers( {\n\tactiveModal,\n\tmetaBoxes,\n\tpublishSidebarActive,\n\tremovedPanels,\n\tdeviceType,\n\tblockInserterPanel,\n\tlistViewPanel,\n\tisEditingTemplate,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/store/reducer.js"],"names":["removedPanels","state","action","type","includes","panelName","activeModal","name","publishSidebarActive","isSavingMetaBoxes","mergeMetaboxes","metaboxes","newMetaboxes","mergedMetaboxes","metabox","existing","findIndex","box","id","push","metaBoxLocations","newState","location","Object","entries","metaBoxesPerLocation","deviceType","blockInserterPanel","isOpen","value","listViewPanel","isEditingTemplate","metaBoxesInitialized","metaBoxes","isSaving","locations","initialized"],"mappings":";;;;;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AA,aAJ+B;AAK/B0B,EAAAA,UAL+B;AAM/BC,EAAAA,kBAN+B;AAO/BG,EAAAA,aAP+B;AAQ/BC,EAAAA;AAR+B,CAAjB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer storing the list of all programmatically removed panels.\n *\n * @param {Array} state Current state.\n * @param {Object} action Action object.\n *\n * @return {Array} Updated state.\n */\nexport function removedPanels( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REMOVE_PANEL':\n\t\t\tif ( ! state.includes( action.panelName ) ) {\n\t\t\t\treturn [ ...state, action.panelName ];\n\t\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for storing the name of the open modal, or null if no modal is open.\n *\n * @param {Object} state Previous state.\n * @param {Object} action Action object containing the `name` of the modal\n *\n * @return {Object} Updated state\n */\nexport function activeModal( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_MODAL':\n\t\t\treturn action.name;\n\t\tcase 'CLOSE_MODAL':\n\t\t\treturn null;\n\t}\n\n\treturn state;\n}\n\nexport function publishSidebarActive( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_PUBLISH_SIDEBAR':\n\t\t\treturn true;\n\t\tcase 'CLOSE_PUBLISH_SIDEBAR':\n\t\t\treturn false;\n\t\tcase 'TOGGLE_PUBLISH_SIDEBAR':\n\t\t\treturn ! state;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the meta boxes isSaving state.\n * A \"true\" value means the meta boxes saving request is in-flight.\n *\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function isSavingMetaBoxes( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_META_BOX_UPDATES':\n\t\t\treturn true;\n\t\tcase 'META_BOX_UPDATES_SUCCESS':\n\t\tcase 'META_BOX_UPDATES_FAILURE':\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn state;\n\t}\n}\n\nfunction mergeMetaboxes( metaboxes = [], newMetaboxes ) {\n\tconst mergedMetaboxes = [ ...metaboxes ];\n\tfor ( const metabox of newMetaboxes ) {\n\t\tconst existing = mergedMetaboxes.findIndex(\n\t\t\t( box ) => box.id === metabox.id\n\t\t);\n\t\tif ( existing !== -1 ) {\n\t\t\tmergedMetaboxes[ existing ] = metabox;\n\t\t} else {\n\t\t\tmergedMetaboxes.push( metabox );\n\t\t}\n\t}\n\treturn mergedMetaboxes;\n}\n\n/**\n * Reducer keeping track of the meta boxes per location.\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function metaBoxLocations( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_META_BOXES_PER_LOCATIONS': {\n\t\t\tconst newState = { ...state };\n\t\t\tfor ( const [ location, metaboxes ] of Object.entries(\n\t\t\t\taction.metaBoxesPerLocation\n\t\t\t) ) {\n\t\t\t\tnewState[ location ] = mergeMetaboxes(\n\t\t\t\t\tnewState[ location ],\n\t\t\t\t\tmetaboxes\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn newState;\n\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the inserter panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking whether template editing is on or off.\n *\n * @param {boolean} state\n * @param {Object} action\n */\nfunction isEditingTemplate( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_EDITING_TEMPLATE':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking whether meta boxes are initialized.\n *\n * @param {boolean} state\n * @param {Object} action\n *\n * @return {boolean} Updated state.\n */\nfunction metaBoxesInitialized( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'META_BOXES_INITIALIZED':\n\t\t\treturn true;\n\t}\n\treturn state;\n}\n\nconst metaBoxes = combineReducers( {\n\tisSaving: isSavingMetaBoxes,\n\tlocations: metaBoxLocations,\n\tinitialized: metaBoxesInitialized,\n} );\n\nexport default combineReducers( {\n\tactiveModal,\n\tmetaBoxes,\n\tpublishSidebarActive,\n\tremovedPanels,\n\tdeviceType,\n\tblockInserterPanel,\n\tlistViewPanel,\n\tisEditingTemplate,\n} );\n"]}
@@ -134,7 +134,7 @@ function convertPanelsToOldFormat(inactivePanels, openPanels) {
134
134
  var _ref;
135
135
 
136
136
  // First reduce the inactive panels.
137
- const panelsWithEnabledState = inactivePanels === null || inactivePanels === void 0 ? void 0 : inactivePanels.reduce((accumulatedPanels, panelName) => ({ ...accumulatedPanels,
137
+ const panelsWithEnabledState = inactivePanels?.reduce((accumulatedPanels, panelName) => ({ ...accumulatedPanels,
138
138
  [panelName]: {
139
139
  enabled: false
140
140
  }
@@ -142,8 +142,8 @@ function convertPanelsToOldFormat(inactivePanels, openPanels) {
142
142
  // reduction as the initial value so that both open and inactive
143
143
  // panel state is combined.
144
144
 
145
- const panels = openPanels === null || openPanels === void 0 ? void 0 : openPanels.reduce((accumulatedPanels, panelName) => {
146
- const currentPanelState = accumulatedPanels === null || accumulatedPanels === void 0 ? void 0 : accumulatedPanels[panelName];
145
+ const panels = openPanels?.reduce((accumulatedPanels, panelName) => {
146
+ const currentPanelState = accumulatedPanels?.[panelName];
147
147
  return { ...accumulatedPanels,
148
148
  [panelName]: { ...currentPanelState,
149
149
  opened: true
@@ -262,7 +262,7 @@ function isEditorPanelRemoved(state, panelName) {
262
262
 
263
263
  const isEditorPanelEnabled = (0, _data.createRegistrySelector)(select => (state, panelName) => {
264
264
  const inactivePanels = select(_preferences.store).get('core/edit-post', 'inactivePanels');
265
- return !isEditorPanelRemoved(state, panelName) && !(inactivePanels !== null && inactivePanels !== void 0 && inactivePanels.includes(panelName));
265
+ return !isEditorPanelRemoved(state, panelName) && !inactivePanels?.includes(panelName);
266
266
  });
267
267
  /**
268
268
  * Returns true if the given panel is open, or false otherwise. Panels are
@@ -277,7 +277,7 @@ const isEditorPanelEnabled = (0, _data.createRegistrySelector)(select => (state,
277
277
  exports.isEditorPanelEnabled = isEditorPanelEnabled;
278
278
  const isEditorPanelOpened = (0, _data.createRegistrySelector)(select => (state, panelName) => {
279
279
  const openPanels = select(_preferences.store).get('core/edit-post', 'openPanels');
280
- return !!(openPanels !== null && openPanels !== void 0 && openPanels.includes(panelName));
280
+ return !!openPanels?.includes(panelName);
281
281
  });
282
282
  /**
283
283
  * Returns true if a modal is active, or false otherwise.
@@ -344,14 +344,11 @@ const getActiveMetaBoxLocations = (0, _rememo.default)(state => {
344
344
  exports.getActiveMetaBoxLocations = getActiveMetaBoxLocations;
345
345
 
346
346
  function isMetaBoxLocationVisible(state, location) {
347
- var _getMetaBoxesPerLocat;
348
-
349
- return isMetaBoxLocationActive(state, location) && ((_getMetaBoxesPerLocat = getMetaBoxesPerLocation(state, location)) === null || _getMetaBoxesPerLocat === void 0 ? void 0 : _getMetaBoxesPerLocat.some(_ref2 => {
350
- let {
351
- id
352
- } = _ref2;
347
+ return isMetaBoxLocationActive(state, location) && getMetaBoxesPerLocation(state, location)?.some(({
348
+ id
349
+ }) => {
353
350
  return isEditorPanelEnabled(state, `meta-box-${id}`);
354
- }));
351
+ });
355
352
  }
356
353
  /**
357
354
  * Returns true if there is an active meta box in the given location, or false
@@ -510,11 +507,9 @@ const getEditedPostTemplate = (0, _data.createRegistrySelector)(select => () =>
510
507
  const currentTemplate = select(_editor.store).getEditedPostAttribute('template');
511
508
 
512
509
  if (currentTemplate) {
513
- var _select$getEntityReco;
514
-
515
- const templateWithSameSlug = (_select$getEntityReco = select(_coreData.store).getEntityRecords('postType', 'wp_template', {
510
+ const templateWithSameSlug = select(_coreData.store).getEntityRecords('postType', 'wp_template', {
516
511
  per_page: -1
517
- })) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco.find(template => template.slug === currentTemplate);
512
+ })?.find(template => template.slug === currentTemplate);
518
513
 
519
514
  if (!templateWithSameSlug) {
520
515
  return templateWithSameSlug;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/store/selectors.js"],"names":["EMPTY_ARRAY","EMPTY_OBJECT","getEditorMode","select","preferencesStore","get","isEditorSidebarOpened","activeGeneralSidebar","interfaceStore","getActiveComplementaryArea","includes","isPluginSidebarOpened","getActiveGeneralSidebarName","convertPanelsToOldFormat","inactivePanels","openPanels","panelsWithEnabledState","reduce","accumulatedPanels","panelName","enabled","panels","currentPanelState","opened","getPreferences","since","alternative","preferences","accumulatedPrefs","preferenceKey","value","getPreference","state","defaultValue","undefined","getHiddenBlockTypes","isPublishSidebarOpened","publishSidebarActive","isEditorPanelRemoved","removedPanels","isEditorPanelEnabled","isEditorPanelOpened","isModalActive","modalName","activeModal","isFeatureActive","feature","isPluginItemPinned","pluginName","isItemPinned","getActiveMetaBoxLocations","Object","keys","metaBoxes","locations","filter","location","isMetaBoxLocationActive","isMetaBoxLocationVisible","getMetaBoxesPerLocation","some","id","length","getAllMetaBoxes","values","flat","hasMetaBoxes","isSavingMetaBoxes","isSaving","__experimentalGetPreviewDeviceType","deviceType","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isEditingTemplate","areMetaBoxesInitialized","initialized","getEditedPostTemplate","currentTemplate","editorStore","getEditedPostAttribute","templateWithSameSlug","coreStore","getEntityRecords","per_page","find","template","slug","getEditedEntityRecord","post","getCurrentPost","link","__experimentalGetTemplateForLink"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;AAQA,MAAMA,WAAW,GAAG,EAApB;AACA,MAAMC,YAAY,GAAG,EAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMC,aAAa,GAAG,kCAC1BC,MAAF,IAAc;AAAA;;AAAA,wBACbA,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,GAA3B,CAAgC,gBAAhC,EAAkD,YAAlD,CADa,qDAEb,QAFa;AAAA,CADc,CAAtB;AAMP;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMC,qBAAqB,GAAG,kCAClCH,MAAF,IAAc,MAAM;AACnB,QAAMI,oBAAoB,GACzBJ,MAAM,CAAEK,gBAAF,CAAN,CAAyBC,0BAAzB,CACC,gBADD,CADD;AAIA,SAAO,CAAE,oBAAF,EAAwB,iBAAxB,EAA4CC,QAA5C,CACNH,oBADM,CAAP;AAGA,CATmC,CAA9B;AAYP;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMI,qBAAqB,GAAG,kCAClCR,MAAF,IAAc,MAAM;AACnB,QAAMI,oBAA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AAoB,4BAAGnF,MAAM,CAAEoF,eAAF,CAAN,CAC3BC,gBAD2B,CACT,UADS,EACG,aADH,EACkB;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KADlB,CAAH,0DAAG,sBAE1BC,IAF0B,CAElBC,QAAF,IAAgBA,QAAQ,CAACC,IAAT,KAAkBT,eAFd,CAA7B;;AAGA,QAAK,CAAEG,oBAAP,EAA8B;AAC7B,aAAOA,oBAAP;AACA;;AACD,WAAOnF,MAAM,CAAEoF,eAAF,CAAN,CAAoBM,qBAApB,CACN,UADM,EAEN,aAFM,EAGNP,oBAAoB,CAACzB,EAHf,CAAP;AAKA;;AAED,QAAMiC,IAAI,GAAG3F,MAAM,CAAEiF,aAAF,CAAN,CAAsBW,cAAtB,EAAb;;AACA,MAAKD,IAAI,CAACE,IAAV,EAAiB;AAChB,WAAO7F,MAAM,CAAEoF,eAAF,CAAN,CAAoBU,gCAApB,CACNH,IAAI,CAACE,IADC,CAAP;AAGA;;AAED,SAAO,IAAP;AACA,CA1BmC,CAA9B","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport deprecated from '@wordpress/deprecated';\n\nconst EMPTY_ARRAY = [];\nconst EMPTY_OBJECT = {};\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector(\n\t( select ) => () =>\n\t\tselect( preferencesStore ).get( 'core/edit-post', 'editorMode' ) ??\n\t\t'visual'\n);\n\n/**\n * Returns true if the editor sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the editor sidebar is opened.\n */\nexport const isEditorSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t'core/edit-post'\n\t\t\t);\n\t\treturn [ 'edit-post/document', 'edit-post/block' ].includes(\n\t\t\tactiveGeneralSidebar\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the plugin sidebar is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the plugin sidebar is opened.\n */\nexport const isPluginSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t'core/edit-post'\n\t\t\t);\n\t\treturn (\n\t\t\t!! activeGeneralSidebar &&\n\t\t\t! [ 'edit-post/document', 'edit-post/block' ].includes(\n\t\t\t\tactiveGeneralSidebar\n\t\t\t)\n\t\t);\n\t}\n);\n\n/**\n * Returns the current active general sidebar name, or null if there is no\n * general sidebar active. The active general sidebar is a unique name to\n * identify either an editor or plugin sidebar.\n *\n * Examples:\n *\n * - `edit-post/document`\n * - `my-plugin/insert-image-sidebar`\n *\n * @param {Object} state Global application state.\n *\n * @return {?string} Active general sidebar name.\n */\nexport const getActiveGeneralSidebarName = createRegistrySelector(\n\t( select ) => () => {\n\t\treturn select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t'core/edit-post'\n\t\t);\n\t}\n);\n\n/**\n * Converts panels from the new preferences store format to the old format\n * that the post editor previously used.\n *\n * The resultant converted data should look like this:\n * {\n * panelName: {\n * enabled: false,\n * opened: true,\n * },\n * anotherPanelName: {\n * opened: true\n * },\n * }\n *\n * @param {string[] | undefined} inactivePanels An array of inactive panel names.\n * @param {string[] | undefined} openPanels An array of open panel names.\n *\n * @return {Object} The converted panel data.\n */\nfunction convertPanelsToOldFormat( inactivePanels, openPanels ) {\n\t// First reduce the inactive panels.\n\tconst panelsWithEnabledState = inactivePanels?.reduce(\n\t\t( accumulatedPanels, panelName ) => ( {\n\t\t\t...accumulatedPanels,\n\t\t\t[ panelName ]: {\n\t\t\t\tenabled: false,\n\t\t\t},\n\t\t} ),\n\t\t{}\n\t);\n\n\t// Then reduce the open panels, passing in the result of the previous\n\t// reduction as the initial value so that both open and inactive\n\t// panel state is combined.\n\tconst panels = openPanels?.reduce( ( accumulatedPanels, panelName ) => {\n\t\tconst currentPanelState = accumulatedPanels?.[ panelName ];\n\t\treturn {\n\t\t\t...accumulatedPanels,\n\t\t\t[ panelName ]: {\n\t\t\t\t...currentPanelState,\n\t\t\t\topened: true,\n\t\t\t},\n\t\t};\n\t}, panelsWithEnabledState ?? {} );\n\n\t// The panels variable will only be set if openPanels wasn't `undefined`.\n\t// If it isn't set just return `panelsWithEnabledState`, and if that isn't\n\t// set return an empty object.\n\treturn panels ?? panelsWithEnabledState ?? EMPTY_OBJECT;\n}\n\n/**\n * Returns the preferences (these preferences are persisted locally).\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Preferences Object.\n */\nexport const getPreferences = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-post' ).getPreferences`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\t// These preferences now exist in the preferences store.\n\t// Fetch them so that they can be merged into the post\n\t// editor preferences.\n\tconst preferences = [\n\t\t'hiddenBlockTypes',\n\t\t'editorMode',\n\t\t'preferredStyleVariations',\n\t].reduce( ( accumulatedPrefs, preferenceKey ) => {\n\t\tconst value = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\tpreferenceKey\n\t\t);\n\n\t\treturn {\n\t\t\t...accumulatedPrefs,\n\t\t\t[ preferenceKey ]: value,\n\t\t};\n\t}, {} );\n\n\t// Panels were a preference, but the data structure changed when the state\n\t// was migrated to the preferences store. They need to be converted from\n\t// the new preferences store format to old format to ensure no breaking\n\t// changes for plugins.\n\tconst inactivePanels = select( preferencesStore ).get(\n\t\t'core/edit-post',\n\t\t'inactivePanels'\n\t);\n\tconst openPanels = select( preferencesStore ).get(\n\t\t'core/edit-post',\n\t\t'openPanels'\n\t);\n\tconst panels = convertPanelsToOldFormat( inactivePanels, openPanels );\n\n\treturn {\n\t\t...preferences,\n\t\tpanels,\n\t};\n} );\n\n/**\n *\n * @param {Object} state Global application state.\n * @param {string} preferenceKey Preference Key.\n * @param {*} defaultValue Default Value.\n *\n * @return {*} Preference Value.\n */\nexport function getPreference( state, preferenceKey, defaultValue ) {\n\tdeprecated( `select( 'core/edit-post' ).getPreference`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\t// Avoid using the `getPreferences` registry selector where possible.\n\tconst preferences = getPreferences( state );\n\tconst value = preferences[ preferenceKey ];\n\treturn value === undefined ? defaultValue : value;\n}\n\n/**\n * Returns an array of blocks that are hidden.\n *\n * @return {Array} A list of the hidden block types\n */\nexport const getHiddenBlockTypes = createRegistrySelector( ( select ) => () => {\n\treturn (\n\t\tselect( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'hiddenBlockTypes'\n\t\t) ?? EMPTY_ARRAY\n\t);\n} );\n\n/**\n * Returns true if the publish sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the publish sidebar is open.\n */\nexport function isPublishSidebarOpened( state ) {\n\treturn state.publishSidebarActive;\n}\n\n/**\n * Returns true if the given panel was programmatically removed, or false otherwise.\n * All panels are not removed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is removed.\n */\nexport function isEditorPanelRemoved( state, panelName ) {\n\treturn state.removedPanels.includes( panelName );\n}\n\n/**\n * Returns true if the given panel is enabled, or false otherwise. Panels are\n * enabled by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is enabled.\n */\nexport const isEditorPanelEnabled = createRegistrySelector(\n\t( select ) => ( state, panelName ) => {\n\t\tconst inactivePanels = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'inactivePanels'\n\t\t);\n\t\treturn (\n\t\t\t! isEditorPanelRemoved( state, panelName ) &&\n\t\t\t! inactivePanels?.includes( panelName )\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the given panel is open, or false otherwise. Panels are\n * closed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is open.\n */\nexport const isEditorPanelOpened = createRegistrySelector(\n\t( select ) => ( state, panelName ) => {\n\t\tconst openPanels = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'openPanels'\n\t\t);\n\t\treturn !! openPanels?.includes( panelName );\n\t}\n);\n\n/**\n * Returns true if a modal is active, or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} modalName A string that uniquely identifies the modal.\n *\n * @return {boolean} Whether the modal is active.\n */\nexport function isModalActive( state, modalName ) {\n\treturn state.activeModal === modalName;\n}\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} feature Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( state, feature ) => {\n\t\treturn !! select( preferencesStore ).get( 'core/edit-post', feature );\n\t}\n);\n\n/**\n * Returns true if the plugin item is pinned to the header.\n * When the value is not set it defaults to true.\n *\n * @param {Object} state Global application state.\n * @param {string} pluginName Plugin item name.\n *\n * @return {boolean} Whether the plugin item is pinned.\n */\nexport const isPluginItemPinned = createRegistrySelector(\n\t( select ) => ( state, pluginName ) => {\n\t\treturn select( interfaceStore ).isItemPinned(\n\t\t\t'core/edit-post',\n\t\t\tpluginName\n\t\t);\n\t}\n);\n\n/**\n * Returns an array of active meta box locations.\n *\n * @param {Object} state Post editor state.\n *\n * @return {string[]} Active meta box locations.\n */\nexport const getActiveMetaBoxLocations = createSelector(\n\t( state ) => {\n\t\treturn Object.keys( state.metaBoxes.locations ).filter( ( location ) =>\n\t\t\tisMetaBoxLocationActive( state, location )\n\t\t);\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if a metabox location is active and visible\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active and visible.\n */\nexport function isMetaBoxLocationVisible( state, location ) {\n\treturn (\n\t\tisMetaBoxLocationActive( state, location ) &&\n\t\tgetMetaBoxesPerLocation( state, location )?.some( ( { id } ) => {\n\t\t\treturn isEditorPanelEnabled( state, `meta-box-${ id }` );\n\t\t} )\n\t);\n}\n\n/**\n * Returns true if there is an active meta box in the given location, or false\n * otherwise.\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active.\n */\nexport function isMetaBoxLocationActive( state, location ) {\n\tconst metaBoxes = getMetaBoxesPerLocation( state, location );\n\treturn !! metaBoxes && metaBoxes.length !== 0;\n}\n\n/**\n * Returns the list of all the available meta boxes for a given location.\n *\n * @param {Object} state Global application state.\n * @param {string} location Meta box location to test.\n *\n * @return {?Array} List of meta boxes.\n */\nexport function getMetaBoxesPerLocation( state, location ) {\n\treturn state.metaBoxes.locations[ location ];\n}\n\n/**\n * Returns the list of all the available meta boxes.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} List of meta boxes.\n */\nexport const getAllMetaBoxes = createSelector(\n\t( state ) => {\n\t\treturn Object.values( state.metaBoxes.locations ).flat();\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if the post is using Meta Boxes\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether there are metaboxes or not.\n */\nexport function hasMetaBoxes( state ) {\n\treturn getActiveMetaBoxLocations( state ).length > 0;\n}\n\n/**\n * Returns true if the Meta Boxes are being saved.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the metaboxes are being saved.\n */\nexport function isSavingMetaBoxes( state ) {\n\treturn state.metaBoxes.isSaving;\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst { rootClientId, insertionIndex, filterValue } =\n\t\tstate.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns true if the template editing mode is enabled.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether we're editing the template.\n */\nexport function isEditingTemplate( state ) {\n\treturn state.isEditingTemplate;\n}\n\n/**\n * Returns true if meta boxes are initialized.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether meta boxes are initialized.\n */\nexport function areMetaBoxesInitialized( state ) {\n\treturn state.metaBoxes.initialized;\n}\n\n/**\n * Retrieves the template of the currently edited post.\n *\n * @return {Object?} Post Template.\n */\nexport const getEditedPostTemplate = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst currentTemplate =\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' );\n\t\tif ( currentTemplate ) {\n\t\t\tconst templateWithSameSlug = select( coreStore )\n\t\t\t\t.getEntityRecords( 'postType', 'wp_template', { per_page: -1 } )\n\t\t\t\t?.find( ( template ) => template.slug === currentTemplate );\n\t\t\tif ( ! templateWithSameSlug ) {\n\t\t\t\treturn templateWithSameSlug;\n\t\t\t}\n\t\t\treturn select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\ttemplateWithSameSlug.id\n\t\t\t);\n\t\t}\n\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tif ( post.link ) {\n\t\t\treturn select( coreStore ).__experimentalGetTemplateForLink(\n\t\t\t\tpost.link\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t}\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/store/selectors.js"],"names":["EMPTY_ARRAY","EMPTY_OBJECT","getEditorMode","select","preferencesStore","get","isEditorSidebarOpened","activeGeneralSidebar","interfaceStore","getActiveComplementaryArea","includes","isPluginSidebarOpened","getActiveGeneralSidebarName","convertPanelsToOldFormat","inactivePanels","openPanels","panelsWithEnabledState","reduce","accumulatedPanels","panelName","enabled","panels","currentPanelState","opened","getPreferences","since","alternative","preferences","accumulatedPrefs","preferenceKey","value","getPreference","state","defaultValue","undefined","getHiddenBlockTypes","isPublishSidebarOpened","publishSidebarActive","isEditorPanelRemoved","removedPanels","isEditorPanelEnabled","isEditorPanelOpened","isModalActive","modalName","activeModal","isFeatureActive","feature","isPluginItemPinned","pluginName","isItemPinned","getActiveMetaBoxLocations","Object","keys","metaBoxes","locations","filter","location","isMetaBoxLocationActive","isMetaBoxLocationVisible","getMetaBoxesPerLocation","some","id","length","getAllMetaBoxes","values","flat","hasMetaBoxes","isSavingMetaBoxes","isSaving","__experimentalGetPreviewDeviceType","deviceType","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isEditingTemplate","areMetaBoxesInitialized","initialized","getEditedPostTemplate","currentTemplate","editorStore","getEditedPostAttribute","templateWithSameSlug","coreStore","getEntityRecords","per_page","find","template","slug","getEditedEntityRecord","post","getCurrentPost","link","__experimentalGetTemplateForLink"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAGA;AACA;AACA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;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,iBAAT,CAA4B/C,KAA5B,EAAoC;AAC1C,SAAOA,KAAK,CAAC+C,iBAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,uBAAT,CAAkChD,KAAlC,EAA0C;AAChD,SAAOA,KAAK,CAACqB,SAAN,CAAgB4B,WAAvB;AACA;AAED;AACA;AACA;AACA;AACA;;;AACO,MAAMC,qBAAqB,GAAG,kCAClC/E,MAAF,IAAc,MAAM;AACnB,QAAMgF,eAAe,GACpBhF,MAAM,CAAEiF,aAAF,CAAN,CAAsBC,sBAAtB,CAA8C,UAA9C,CADD;;AAEA,MAAKF,eAAL,EAAuB;AACtB,UAAMG,oBAAoB,GAAGnF,MAAM,CAAEoF,eAAF,CAAN,CAC3BC,gBAD2B,CACT,UADS,EACG,aADH,EACkB;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KADlB,GAE1BC,IAF0B,CAElBC,QAAF,IAAgBA,QAAQ,CAACC,IAAT,KAAkBT,eAFd,CAA7B;;AAGA,QAAK,CAAEG,oBAAP,EAA8B;AAC7B,aAAOA,oBAAP;AACA;;AACD,WAAOnF,MAAM,CAAEoF,eAAF,CAAN,CAAoBM,qBAApB,CACN,UADM,EAEN,aAFM,EAGNP,oBAAoB,CAACzB,EAHf,CAAP;AAKA;;AAED,QAAMiC,IAAI,GAAG3F,MAAM,CAAEiF,aAAF,CAAN,CAAsBW,cAAtB,EAAb;;AACA,MAAKD,IAAI,CAACE,IAAV,EAAiB;AAChB,WAAO7F,MAAM,CAAEoF,eAAF,CAAN,CAAoBU,gCAApB,CACNH,IAAI,CAACE,IADC,CAAP;AAGA;;AAED,SAAO,IAAP;AACA,CA1BmC,CAA9B","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport deprecated from '@wordpress/deprecated';\n\nconst EMPTY_ARRAY = [];\nconst EMPTY_OBJECT = {};\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector(\n\t( select ) => () =>\n\t\tselect( preferencesStore ).get( 'core/edit-post', 'editorMode' ) ??\n\t\t'visual'\n);\n\n/**\n * Returns true if the editor sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the editor sidebar is opened.\n */\nexport const isEditorSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t'core/edit-post'\n\t\t\t);\n\t\treturn [ 'edit-post/document', 'edit-post/block' ].includes(\n\t\t\tactiveGeneralSidebar\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the plugin sidebar is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the plugin sidebar is opened.\n */\nexport const isPluginSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t'core/edit-post'\n\t\t\t);\n\t\treturn (\n\t\t\t!! activeGeneralSidebar &&\n\t\t\t! [ 'edit-post/document', 'edit-post/block' ].includes(\n\t\t\t\tactiveGeneralSidebar\n\t\t\t)\n\t\t);\n\t}\n);\n\n/**\n * Returns the current active general sidebar name, or null if there is no\n * general sidebar active. The active general sidebar is a unique name to\n * identify either an editor or plugin sidebar.\n *\n * Examples:\n *\n * - `edit-post/document`\n * - `my-plugin/insert-image-sidebar`\n *\n * @param {Object} state Global application state.\n *\n * @return {?string} Active general sidebar name.\n */\nexport const getActiveGeneralSidebarName = createRegistrySelector(\n\t( select ) => () => {\n\t\treturn select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t'core/edit-post'\n\t\t);\n\t}\n);\n\n/**\n * Converts panels from the new preferences store format to the old format\n * that the post editor previously used.\n *\n * The resultant converted data should look like this:\n * {\n * panelName: {\n * enabled: false,\n * opened: true,\n * },\n * anotherPanelName: {\n * opened: true\n * },\n * }\n *\n * @param {string[] | undefined} inactivePanels An array of inactive panel names.\n * @param {string[] | undefined} openPanels An array of open panel names.\n *\n * @return {Object} The converted panel data.\n */\nfunction convertPanelsToOldFormat( inactivePanels, openPanels ) {\n\t// First reduce the inactive panels.\n\tconst panelsWithEnabledState = inactivePanels?.reduce(\n\t\t( accumulatedPanels, panelName ) => ( {\n\t\t\t...accumulatedPanels,\n\t\t\t[ panelName ]: {\n\t\t\t\tenabled: false,\n\t\t\t},\n\t\t} ),\n\t\t{}\n\t);\n\n\t// Then reduce the open panels, passing in the result of the previous\n\t// reduction as the initial value so that both open and inactive\n\t// panel state is combined.\n\tconst panels = openPanels?.reduce( ( accumulatedPanels, panelName ) => {\n\t\tconst currentPanelState = accumulatedPanels?.[ panelName ];\n\t\treturn {\n\t\t\t...accumulatedPanels,\n\t\t\t[ panelName ]: {\n\t\t\t\t...currentPanelState,\n\t\t\t\topened: true,\n\t\t\t},\n\t\t};\n\t}, panelsWithEnabledState ?? {} );\n\n\t// The panels variable will only be set if openPanels wasn't `undefined`.\n\t// If it isn't set just return `panelsWithEnabledState`, and if that isn't\n\t// set return an empty object.\n\treturn panels ?? panelsWithEnabledState ?? EMPTY_OBJECT;\n}\n\n/**\n * Returns the preferences (these preferences are persisted locally).\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Preferences Object.\n */\nexport const getPreferences = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-post' ).getPreferences`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\t// These preferences now exist in the preferences store.\n\t// Fetch them so that they can be merged into the post\n\t// editor preferences.\n\tconst preferences = [\n\t\t'hiddenBlockTypes',\n\t\t'editorMode',\n\t\t'preferredStyleVariations',\n\t].reduce( ( accumulatedPrefs, preferenceKey ) => {\n\t\tconst value = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\tpreferenceKey\n\t\t);\n\n\t\treturn {\n\t\t\t...accumulatedPrefs,\n\t\t\t[ preferenceKey ]: value,\n\t\t};\n\t}, {} );\n\n\t// Panels were a preference, but the data structure changed when the state\n\t// was migrated to the preferences store. They need to be converted from\n\t// the new preferences store format to old format to ensure no breaking\n\t// changes for plugins.\n\tconst inactivePanels = select( preferencesStore ).get(\n\t\t'core/edit-post',\n\t\t'inactivePanels'\n\t);\n\tconst openPanels = select( preferencesStore ).get(\n\t\t'core/edit-post',\n\t\t'openPanels'\n\t);\n\tconst panels = convertPanelsToOldFormat( inactivePanels, openPanels );\n\n\treturn {\n\t\t...preferences,\n\t\tpanels,\n\t};\n} );\n\n/**\n *\n * @param {Object} state Global application state.\n * @param {string} preferenceKey Preference Key.\n * @param {*} defaultValue Default Value.\n *\n * @return {*} Preference Value.\n */\nexport function getPreference( state, preferenceKey, defaultValue ) {\n\tdeprecated( `select( 'core/edit-post' ).getPreference`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\t// Avoid using the `getPreferences` registry selector where possible.\n\tconst preferences = getPreferences( state );\n\tconst value = preferences[ preferenceKey ];\n\treturn value === undefined ? defaultValue : value;\n}\n\n/**\n * Returns an array of blocks that are hidden.\n *\n * @return {Array} A list of the hidden block types\n */\nexport const getHiddenBlockTypes = createRegistrySelector( ( select ) => () => {\n\treturn (\n\t\tselect( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'hiddenBlockTypes'\n\t\t) ?? EMPTY_ARRAY\n\t);\n} );\n\n/**\n * Returns true if the publish sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the publish sidebar is open.\n */\nexport function isPublishSidebarOpened( state ) {\n\treturn state.publishSidebarActive;\n}\n\n/**\n * Returns true if the given panel was programmatically removed, or false otherwise.\n * All panels are not removed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is removed.\n */\nexport function isEditorPanelRemoved( state, panelName ) {\n\treturn state.removedPanels.includes( panelName );\n}\n\n/**\n * Returns true if the given panel is enabled, or false otherwise. Panels are\n * enabled by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is enabled.\n */\nexport const isEditorPanelEnabled = createRegistrySelector(\n\t( select ) => ( state, panelName ) => {\n\t\tconst inactivePanels = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'inactivePanels'\n\t\t);\n\t\treturn (\n\t\t\t! isEditorPanelRemoved( state, panelName ) &&\n\t\t\t! inactivePanels?.includes( panelName )\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the given panel is open, or false otherwise. Panels are\n * closed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is open.\n */\nexport const isEditorPanelOpened = createRegistrySelector(\n\t( select ) => ( state, panelName ) => {\n\t\tconst openPanels = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'openPanels'\n\t\t);\n\t\treturn !! openPanels?.includes( panelName );\n\t}\n);\n\n/**\n * Returns true if a modal is active, or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} modalName A string that uniquely identifies the modal.\n *\n * @return {boolean} Whether the modal is active.\n */\nexport function isModalActive( state, modalName ) {\n\treturn state.activeModal === modalName;\n}\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} feature Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( state, feature ) => {\n\t\treturn !! select( preferencesStore ).get( 'core/edit-post', feature );\n\t}\n);\n\n/**\n * Returns true if the plugin item is pinned to the header.\n * When the value is not set it defaults to true.\n *\n * @param {Object} state Global application state.\n * @param {string} pluginName Plugin item name.\n *\n * @return {boolean} Whether the plugin item is pinned.\n */\nexport const isPluginItemPinned = createRegistrySelector(\n\t( select ) => ( state, pluginName ) => {\n\t\treturn select( interfaceStore ).isItemPinned(\n\t\t\t'core/edit-post',\n\t\t\tpluginName\n\t\t);\n\t}\n);\n\n/**\n * Returns an array of active meta box locations.\n *\n * @param {Object} state Post editor state.\n *\n * @return {string[]} Active meta box locations.\n */\nexport const getActiveMetaBoxLocations = createSelector(\n\t( state ) => {\n\t\treturn Object.keys( state.metaBoxes.locations ).filter( ( location ) =>\n\t\t\tisMetaBoxLocationActive( state, location )\n\t\t);\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if a metabox location is active and visible\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active and visible.\n */\nexport function isMetaBoxLocationVisible( state, location ) {\n\treturn (\n\t\tisMetaBoxLocationActive( state, location ) &&\n\t\tgetMetaBoxesPerLocation( state, location )?.some( ( { id } ) => {\n\t\t\treturn isEditorPanelEnabled( state, `meta-box-${ id }` );\n\t\t} )\n\t);\n}\n\n/**\n * Returns true if there is an active meta box in the given location, or false\n * otherwise.\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active.\n */\nexport function isMetaBoxLocationActive( state, location ) {\n\tconst metaBoxes = getMetaBoxesPerLocation( state, location );\n\treturn !! metaBoxes && metaBoxes.length !== 0;\n}\n\n/**\n * Returns the list of all the available meta boxes for a given location.\n *\n * @param {Object} state Global application state.\n * @param {string} location Meta box location to test.\n *\n * @return {?Array} List of meta boxes.\n */\nexport function getMetaBoxesPerLocation( state, location ) {\n\treturn state.metaBoxes.locations[ location ];\n}\n\n/**\n * Returns the list of all the available meta boxes.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} List of meta boxes.\n */\nexport const getAllMetaBoxes = createSelector(\n\t( state ) => {\n\t\treturn Object.values( state.metaBoxes.locations ).flat();\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if the post is using Meta Boxes\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether there are metaboxes or not.\n */\nexport function hasMetaBoxes( state ) {\n\treturn getActiveMetaBoxLocations( state ).length > 0;\n}\n\n/**\n * Returns true if the Meta Boxes are being saved.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the metaboxes are being saved.\n */\nexport function isSavingMetaBoxes( state ) {\n\treturn state.metaBoxes.isSaving;\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst { rootClientId, insertionIndex, filterValue } =\n\t\tstate.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns true if the template editing mode is enabled.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether we're editing the template.\n */\nexport function isEditingTemplate( state ) {\n\treturn state.isEditingTemplate;\n}\n\n/**\n * Returns true if meta boxes are initialized.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether meta boxes are initialized.\n */\nexport function areMetaBoxesInitialized( state ) {\n\treturn state.metaBoxes.initialized;\n}\n\n/**\n * Retrieves the template of the currently edited post.\n *\n * @return {Object?} Post Template.\n */\nexport const getEditedPostTemplate = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst currentTemplate =\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' );\n\t\tif ( currentTemplate ) {\n\t\t\tconst templateWithSameSlug = select( coreStore )\n\t\t\t\t.getEntityRecords( 'postType', 'wp_template', { per_page: -1 } )\n\t\t\t\t?.find( ( template ) => template.slug === currentTemplate );\n\t\t\tif ( ! templateWithSameSlug ) {\n\t\t\t\treturn templateWithSameSlug;\n\t\t\t}\n\t\t\treturn select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\ttemplateWithSameSlug.id\n\t\t\t);\n\t\t}\n\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tif ( post.link ) {\n\t\t\treturn select( coreStore ).__experimentalGetTemplateForLink(\n\t\t\t\tpost.link\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t}\n);\n"]}
@@ -15,11 +15,10 @@ import { store as editorStore } from '@wordpress/editor';
15
15
  import BlockTypesChecklist from './checklist';
16
16
  import { store as editPostStore } from '../../store';
17
17
 
18
- function BlockManagerCategory(_ref) {
19
- let {
20
- title,
21
- blockTypes
22
- } = _ref;
18
+ function BlockManagerCategory({
19
+ title,
20
+ blockTypes
21
+ }) {
23
22
  const instanceId = useInstanceId(BlockManagerCategory);
24
23
  const {
25
24
  defaultAllowedBlockTypes,
@@ -41,11 +40,10 @@ function BlockManagerCategory(_ref) {
41
40
  return blockTypes;
42
41
  }
43
42
 
44
- return blockTypes.filter(_ref2 => {
45
- let {
46
- name
47
- } = _ref2;
48
- return defaultAllowedBlockTypes === null || defaultAllowedBlockTypes === void 0 ? void 0 : defaultAllowedBlockTypes.includes(name);
43
+ return blockTypes.filter(({
44
+ name
45
+ }) => {
46
+ return defaultAllowedBlockTypes?.includes(name);
49
47
  });
50
48
  }, [defaultAllowedBlockTypes, blockTypes]);
51
49
  const {
@@ -60,12 +58,9 @@ function BlockManagerCategory(_ref) {
60
58
  }
61
59
  }, []);
62
60
  const toggleAllVisible = useCallback(nextIsChecked => {
63
- const blockNames = blockTypes.map(_ref3 => {
64
- let {
65
- name
66
- } = _ref3;
67
- return name;
68
- });
61
+ const blockNames = blockTypes.map(({
62
+ name
63
+ }) => name);
69
64
 
70
65
  if (nextIsChecked) {
71
66
  showBlockTypes(blockNames);
@@ -78,12 +73,9 @@ function BlockManagerCategory(_ref) {
78
73
  return null;
79
74
  }
80
75
 
81
- const checkedBlockNames = filteredBlockTypes.map(_ref4 => {
82
- let {
83
- name
84
- } = _ref4;
85
- return name;
86
- }).filter(type => !hiddenBlockTypes.includes(type));
76
+ const checkedBlockNames = filteredBlockTypes.map(({
77
+ name
78
+ }) => name).filter(type => !hiddenBlockTypes.includes(type));
87
79
  const titleId = 'edit-post-block-manager__category-title-' + instanceId;
88
80
  const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;
89
81
  const isIndeterminate = !isAllChecked && checkedBlockNames.length > 0;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/category.js"],"names":["useMemo","useCallback","useDispatch","useSelect","useInstanceId","CheckboxControl","store","editorStore","BlockTypesChecklist","editPostStore","BlockManagerCategory","title","blockTypes","instanceId","defaultAllowedBlockTypes","hiddenBlockTypes","select","getEditorSettings","getHiddenBlockTypes","filteredBlockTypes","filter","name","includes","showBlockTypes","hideBlockTypes","toggleVisible","blockName","nextIsChecked","toggleAllVisible","blockNames","map","length","checkedBlockNames","type","titleId","isAllChecked","isIndeterminate"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,WAAlB,QAAqC,oBAArC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,eAAT,QAAgC,uBAAhC;A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B;AAMC,IAAA,KAAK,EAAG;AAAM,MAAA,EAAE,EAAGF;AAAX,OAAuBvB,KAAvB;AANT,IALD,EAaC,cAAC,mBAAD;AACC,IAAA,UAAU,EAAGQ,kBADd;AAEC,IAAA,KAAK,EAAGa,iBAFT;AAGC,IAAA,YAAY,EAAGP;AAHhB,IAbD,CADD;AAqBA;;AAED,eAAef,oBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { CheckboxControl } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesChecklist from './checklist';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManagerCategory( { title, blockTypes } ) {\n\tconst instanceId = useInstanceId( BlockManagerCategory );\n\tconst { defaultAllowedBlockTypes, hiddenBlockTypes } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getHiddenBlockTypes } = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tdefaultAllowedBlockTypes:\n\t\t\t\t\tgetEditorSettings().defaultAllowedBlockTypes,\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( defaultAllowedBlockTypes === true ) {\n\t\t\treturn blockTypes;\n\t\t}\n\t\treturn blockTypes.filter( ( { name } ) => {\n\t\t\treturn defaultAllowedBlockTypes?.includes( name );\n\t\t} );\n\t}, [ defaultAllowedBlockTypes, blockTypes ] );\n\tconst { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore );\n\tconst toggleVisible = useCallback( ( blockName, nextIsChecked ) => {\n\t\tif ( nextIsChecked ) {\n\t\t\tshowBlockTypes( blockName );\n\t\t} else {\n\t\t\thideBlockTypes( blockName );\n\t\t}\n\t}, [] );\n\tconst toggleAllVisible = useCallback(\n\t\t( nextIsChecked ) => {\n\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t} else {\n\t\t\t\thideBlockTypes( blockNames );\n\t\t\t}\n\t\t},\n\t\t[ blockTypes ]\n\t);\n\n\tif ( ! filteredBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\tconst checkedBlockNames = filteredBlockTypes\n\t\t.map( ( { name } ) => name )\n\t\t.filter( ( type ) => ! hiddenBlockTypes.includes( type ) );\n\n\tconst titleId = 'edit-post-block-manager__category-title-' + instanceId;\n\n\tconst isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;\n\tconst isIndeterminate = ! isAllChecked && checkedBlockNames.length > 0;\n\n\treturn (\n\t\t<div\n\t\t\trole=\"group\"\n\t\t\taria-labelledby={ titleId }\n\t\t\tclassName=\"edit-post-block-manager__category\"\n\t\t>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tchecked={ isAllChecked }\n\t\t\t\tonChange={ toggleAllVisible }\n\t\t\t\tclassName=\"edit-post-block-manager__category-title\"\n\t\t\t\tindeterminate={ isIndeterminate }\n\t\t\t\tlabel={ <span id={ titleId }>{ title }</span> }\n\t\t\t/>\n\t\t\t<BlockTypesChecklist\n\t\t\t\tblockTypes={ filteredBlockTypes }\n\t\t\t\tvalue={ checkedBlockNames }\n\t\t\t\tonItemChange={ toggleVisible }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default BlockManagerCategory;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/category.js"],"names":["useMemo","useCallback","useDispatch","useSelect","useInstanceId","CheckboxControl","store","editorStore","BlockTypesChecklist","editPostStore","BlockManagerCategory","title","blockTypes","instanceId","defaultAllowedBlockTypes","hiddenBlockTypes","select","getEditorSettings","getHiddenBlockTypes","filteredBlockTypes","filter","name","includes","showBlockTypes","hideBlockTypes","toggleVisible","blockName","nextIsChecked","toggleAllVisible","blockNames","map","length","checkedBlockNames","type","titleId","isAllChecked","isIndeterminate"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,WAAlB,QAAqC,oBAArC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,aAAhC;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,oBAAT,CAA+B;AAAEC,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAA/B,EAAuD;AACtD,QAAMC,UAAU,GAAGT,aAAa,CAAEM,oBAAF,CAAhC;AACA,QAAM;AAAEI,IAAAA,wBAAF;AAA4BC,IAAAA;AAA5B,MAAiDZ,SAAS,CAC7Da,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAwBD,MAAM,CAAET,WAAF,CAApC;AACA,UAAM;AAAEW,MAAAA;AAAF,QAA0BF,MAAM,CAAEP,aAAF,CAAtC;AACA,WAAO;AACNK,MAAAA,wBAAwB,EACvBG,iBAAiB,GAAGH,wBAFf;AAGNC,MAAAA,gBAAgB,EAAEG,mBAAmB;AAH/B,KAAP;AAKA,GAT8D,EAU/D,EAV+D,CAAhE;AAYA,QAAMC,kBAAkB,GAAGnB,OAAO,CAAE,MAAM;AACzC,QAAKc,wBAAwB,KAAK,IAAlC,EAAyC;AACxC,aAAOF,UAAP;AACA;;AACD,WAAOA,UAAU,CAACQ,MAAX,CAAmB,CAAE;AAAEC,MAAAA;AAAF,KAAF,KAAgB;AACzC,aAAOP,wBAAwB,EAAEQ,QAA1B,CAAoCD,IAApC,CAAP;AACA,KAFM,CAAP;AAGA,GAPiC,EAO/B,CAAEP,wBA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A,SAAS,EAAC;AAHX,KAKC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,OAAO,EAAGC,YAFX;AAGC,IAAA,QAAQ,EAAGP,gBAHZ;AAIC,IAAA,SAAS,EAAC,yCAJX;AAKC,IAAA,aAAa,EAAGQ,eALjB;AAMC,IAAA,KAAK,EAAG;AAAM,MAAA,EAAE,EAAGF;AAAX,OAAuBvB,KAAvB;AANT,IALD,EAaC,cAAC,mBAAD;AACC,IAAA,UAAU,EAAGQ,kBADd;AAEC,IAAA,KAAK,EAAGa,iBAFT;AAGC,IAAA,YAAY,EAAGP;AAHhB,IAbD,CADD;AAqBA;;AAED,eAAef,oBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { CheckboxControl } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesChecklist from './checklist';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManagerCategory( { title, blockTypes } ) {\n\tconst instanceId = useInstanceId( BlockManagerCategory );\n\tconst { defaultAllowedBlockTypes, hiddenBlockTypes } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getHiddenBlockTypes } = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tdefaultAllowedBlockTypes:\n\t\t\t\t\tgetEditorSettings().defaultAllowedBlockTypes,\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( defaultAllowedBlockTypes === true ) {\n\t\t\treturn blockTypes;\n\t\t}\n\t\treturn blockTypes.filter( ( { name } ) => {\n\t\t\treturn defaultAllowedBlockTypes?.includes( name );\n\t\t} );\n\t}, [ defaultAllowedBlockTypes, blockTypes ] );\n\tconst { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore );\n\tconst toggleVisible = useCallback( ( blockName, nextIsChecked ) => {\n\t\tif ( nextIsChecked ) {\n\t\t\tshowBlockTypes( blockName );\n\t\t} else {\n\t\t\thideBlockTypes( blockName );\n\t\t}\n\t}, [] );\n\tconst toggleAllVisible = useCallback(\n\t\t( nextIsChecked ) => {\n\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t} else {\n\t\t\t\thideBlockTypes( blockNames );\n\t\t\t}\n\t\t},\n\t\t[ blockTypes ]\n\t);\n\n\tif ( ! filteredBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\tconst checkedBlockNames = filteredBlockTypes\n\t\t.map( ( { name } ) => name )\n\t\t.filter( ( type ) => ! hiddenBlockTypes.includes( type ) );\n\n\tconst titleId = 'edit-post-block-manager__category-title-' + instanceId;\n\n\tconst isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;\n\tconst isIndeterminate = ! isAllChecked && checkedBlockNames.length > 0;\n\n\treturn (\n\t\t<div\n\t\t\trole=\"group\"\n\t\t\taria-labelledby={ titleId }\n\t\t\tclassName=\"edit-post-block-manager__category\"\n\t\t>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tchecked={ isAllChecked }\n\t\t\t\tonChange={ toggleAllVisible }\n\t\t\t\tclassName=\"edit-post-block-manager__category-title\"\n\t\t\t\tindeterminate={ isIndeterminate }\n\t\t\t\tlabel={ <span id={ titleId }>{ title }</span> }\n\t\t\t/>\n\t\t\t<BlockTypesChecklist\n\t\t\t\tblockTypes={ filteredBlockTypes }\n\t\t\t\tvalue={ checkedBlockNames }\n\t\t\t\tonItemChange={ toggleVisible }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default BlockManagerCategory;\n"]}
@@ -6,12 +6,11 @@ import { createElement } from "@wordpress/element";
6
6
  import { BlockIcon } from '@wordpress/block-editor';
7
7
  import { CheckboxControl } from '@wordpress/components';
8
8
 
9
- function BlockTypesChecklist(_ref) {
10
- let {
11
- blockTypes,
12
- value,
13
- onItemChange
14
- } = _ref;
9
+ function BlockTypesChecklist({
10
+ blockTypes,
11
+ value,
12
+ onItemChange
13
+ }) {
15
14
  return createElement("ul", {
16
15
  className: "edit-post-block-manager__checklist"
17
16
  }, blockTypes.map(blockType => createElement("li", {
@@ -21,13 +20,7 @@ function BlockTypesChecklist(_ref) {
21
20
  __nextHasNoMarginBottom: true,
22
21
  label: blockType.title,
23
22
  checked: value.includes(blockType.name),
24
- onChange: function () {
25
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
26
- args[_key] = arguments[_key];
27
- }
28
-
29
- return onItemChange(blockType.name, ...args);
30
- }
23
+ onChange: (...args) => onItemChange(blockType.name, ...args)
31
24
  }), createElement(BlockIcon, {
32
25
  icon: blockType.icon
33
26
  }))));
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/checklist.js"],"names":["BlockIcon","CheckboxControl","BlockTypesChecklist","blockTypes","value","onItemChange","map","blockType","name","title","includes","args","icon"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,yBAA1B;AACA,SAASC,eAAT,QAAgC,uBAAhC;;AAEA,SAASC,mBAAT,OAAoE;AAAA,MAAtC;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,KAAd;AAAqBC,IAAAA;AAArB,GAAsC;AACnE,SACC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGF,UAAU,CAACG,GAAX,CAAkBC,SAAF,IACjB;AACC,IAAA,GAAG,EAAGA,SAAS,CAACC,IADjB;AAEC,IAAA,SAAS,EAAC;AAFX,KAIC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGD,SAAS,CAACE,KAFnB;AAGC,IAAA,OAAO,EAAGL,KAAK,CAACM,QAAN,CAAgBH,SAAS,CAACC,IAA1B,CAHX;AAIC,IAAA,QAAQ,EAAG;AAAA,wCAAKG,IAAL;AAAKA,QAAAA,IAAL;AAAA;;AAAA,aACVN,YAAY,CAAEE,SAAS,CAACC,IAAZ,EAAkB,GAAGG,IAArB,CADF;AAAA;AAJZ,IAJD,EAYC,cAAC,SAAD;AAAW,IAAA,IAAI,EAAGJ,SAAS,CAACK;AAA5B,IAZD,CADC,CADH,CADD;AAoBA;;AAED,eAAeV,mBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { CheckboxControl } from '@wordpress/components';\n\nfunction BlockTypesChecklist( { blockTypes, value, onItemChange } ) {\n\treturn (\n\t\t<ul className=\"edit-post-block-manager__checklist\">\n\t\t\t{ blockTypes.map( ( blockType ) => (\n\t\t\t\t<li\n\t\t\t\t\tkey={ blockType.name }\n\t\t\t\t\tclassName=\"edit-post-block-manager__checklist-item\"\n\t\t\t\t>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ blockType.title }\n\t\t\t\t\t\tchecked={ value.includes( blockType.name ) }\n\t\t\t\t\t\tonChange={ ( ...args ) =>\n\t\t\t\t\t\t\tonItemChange( blockType.name, ...args )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<BlockIcon icon={ blockType.icon } />\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n\nexport default BlockTypesChecklist;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/checklist.js"],"names":["BlockIcon","CheckboxControl","BlockTypesChecklist","blockTypes","value","onItemChange","map","blockType","name","title","includes","args","icon"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,yBAA1B;AACA,SAASC,eAAT,QAAgC,uBAAhC;;AAEA,SAASC,mBAAT,CAA8B;AAAEC,EAAAA,UAAF;AAAcC,EAAAA,KAAd;AAAqBC,EAAAA;AAArB,CAA9B,EAAoE;AACnE,SACC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGF,UAAU,CAACG,GAAX,CAAkBC,SAAF,IACjB;AACC,IAAA,GAAG,EAAGA,SAAS,CAACC,IADjB;AAEC,IAAA,SAAS,EAAC;AAFX,KAIC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGD,SAAS,CAACE,KAFnB;AAGC,IAAA,OAAO,EAAGL,KAAK,CAACM,QAAN,CAAgBH,SAAS,CAACC,IAA1B,CAHX;AAIC,IAAA,QAAQ,EAAG,CAAE,GAAGG,IAAL,KACVN,YAAY,CAAEE,SAAS,CAACC,IAAZ,EAAkB,GAAGG,IAArB;AALd,IAJD,EAYC,cAAC,SAAD;AAAW,IAAA,IAAI,EAAGJ,SAAS,CAACK;AAA5B,IAZD,CADC,CADH,CADD;AAoBA;;AAED,eAAeV,mBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { CheckboxControl } from '@wordpress/components';\n\nfunction BlockTypesChecklist( { blockTypes, value, onItemChange } ) {\n\treturn (\n\t\t<ul className=\"edit-post-block-manager__checklist\">\n\t\t\t{ blockTypes.map( ( blockType ) => (\n\t\t\t\t<li\n\t\t\t\t\tkey={ blockType.name }\n\t\t\t\t\tclassName=\"edit-post-block-manager__checklist-item\"\n\t\t\t\t>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ blockType.title }\n\t\t\t\t\t\tchecked={ value.includes( blockType.name ) }\n\t\t\t\t\t\tonChange={ ( ...args ) =>\n\t\t\t\t\t\t\tonItemChange( blockType.name, ...args )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<BlockIcon icon={ blockType.icon } />\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n\nexport default BlockTypesChecklist;\n"]}
@@ -4,11 +4,11 @@ import { createElement } from "@wordpress/element";
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { store as blocksStore } from '@wordpress/blocks';
7
- import { withSelect } from '@wordpress/data';
8
- import { SearchControl } from '@wordpress/components';
7
+ import { withSelect, withDispatch } from '@wordpress/data';
8
+ import { SearchControl, Button } from '@wordpress/components';
9
9
  import { __, _n, sprintf } from '@wordpress/i18n';
10
10
  import { useEffect, useState } from '@wordpress/element';
11
- import { useDebounce } from '@wordpress/compose';
11
+ import { useDebounce, compose } from '@wordpress/compose';
12
12
  import { speak } from '@wordpress/a11y';
13
13
  /**
14
14
  * Internal dependencies
@@ -17,14 +17,14 @@ import { speak } from '@wordpress/a11y';
17
17
  import BlockManagerCategory from './category';
18
18
  import { store as editPostStore } from '../../store';
19
19
 
20
- function BlockManager(_ref) {
21
- let {
22
- blockTypes,
23
- categories,
24
- hasBlockSupport,
25
- isMatchingSearchTerm,
26
- numberOfHiddenBlocks
27
- } = _ref;
20
+ function BlockManager({
21
+ blockTypes,
22
+ categories,
23
+ hasBlockSupport,
24
+ isMatchingSearchTerm,
25
+ numberOfHiddenBlocks,
26
+ enableAllBlockTypes
27
+ }) {
28
28
  const debouncedSpeak = useDebounce(speak, 500);
29
29
  const [search, setSearch] = useState(''); // Filtering occurs here (as opposed to `withSelect`) to avoid
30
30
  // wasted renders by consequence of `Array#filter` producing
@@ -49,7 +49,10 @@ function BlockManager(_ref) {
49
49
  className: "edit-post-block-manager__disabled-blocks-count"
50
50
  }, sprintf(
51
51
  /* translators: %d: number of blocks. */
52
- _n('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks)), createElement(SearchControl, {
52
+ _n('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks), createElement(Button, {
53
+ variant: "link",
54
+ onClick: () => enableAllBlockTypes(blockTypes)
55
+ }, __('Reset'))), createElement(SearchControl, {
53
56
  __nextHasNoMarginBottom: true,
54
57
  label: __('Search for a block'),
55
58
  placeholder: __('Search for a block'),
@@ -69,16 +72,13 @@ function BlockManager(_ref) {
69
72
  blockTypes: blockTypes.filter(blockType => blockType.category === category.slug)
70
73
  })), createElement(BlockManagerCategory, {
71
74
  title: __('Uncategorized'),
72
- blockTypes: blockTypes.filter(_ref2 => {
73
- let {
74
- category
75
- } = _ref2;
76
- return !category;
77
- })
75
+ blockTypes: blockTypes.filter(({
76
+ category
77
+ }) => !category)
78
78
  })));
79
79
  }
80
80
 
81
- export default withSelect(select => {
81
+ export default compose([withSelect(select => {
82
82
  const {
83
83
  getBlockTypes,
84
84
  getCategories,
@@ -105,5 +105,17 @@ export default withSelect(select => {
105
105
  isMatchingSearchTerm,
106
106
  numberOfHiddenBlocks
107
107
  };
108
- })(BlockManager);
108
+ }), withDispatch(dispatch => {
109
+ const {
110
+ showBlockTypes
111
+ } = dispatch(editPostStore);
112
+ return {
113
+ enableAllBlockTypes: blockTypes => {
114
+ const blockNames = blockTypes.map(({
115
+ name
116
+ }) => name);
117
+ showBlockTypes(blockNames);
118
+ }
119
+ };
120
+ })])(BlockManager);
109
121
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/index.js"],"names":["store","blocksStore","withSelect","SearchControl","__","_n","sprintf","useEffect","useState","useDebounce","speak","BlockManagerCategory","editPostStore","BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","debouncedSpeak","search","setSearch","filter","blockType","parent","includes","count","length","resultsFoundMessage","nextSearch","map","category","slug","title","select","getBlockTypes","getCategories","getHiddenBlockTypes","hiddenBlockTypes","hiddenBlock","some","registeredBlock","name","Array","isArray"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,EAAT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ArBD,CAtBD,CADD;AAqDA;;AAED,eAAe7B,UAAU,CAAIgC,MAAF,IAAc;AACxC,QAAM;AACLC,IAAAA,aADK;AAELC,IAAAA,aAFK;AAGLpB,IAAAA,eAHK;AAILC,IAAAA;AAJK,MAKFiB,MAAM,CAAEjC,WAAF,CALV;AAMA,QAAM;AAAEoC,IAAAA;AAAF,MAA0BH,MAAM,CAAEtB,aAAF,CAAtC,CAPwC,CASxC;AACA;AACA;AACA;AACA;;AACA,QAAME,UAAU,GAAGqB,aAAa,EAAhC;AACA,QAAMG,gBAAgB,GAAGD,mBAAmB,GAAGf,MAAtB,CAAgCiB,WAAF,IAAmB;AACzE,WAAOzB,UAAU,CAAC0B,IAAX,CACJC,eAAF,IAAuBA,eAAe,CAACC,IAAhB,KAAyBH,WAD1C,CAAP;AAGA,GAJwB,CAAzB;AAKA,QAAMrB,oBAAoB,GACzByB,KAAK,CAACC,OAAN,CAAeN,gBAAf,KAAqCA,gBAAgB,CAACX,MADvD;AAGA,SAAO;AACNb,IAAAA,UADM;AAENC,IAAAA,UAAU,EAAEqB,aAAa,EAFnB;AAGNpB,IAAAA,eAHM;AAINC,IAAAA,oBAJM;AAKNC,IAAAA;AALM,GAAP;AAOA,CA9BwB,CAAV,CA8BVL,YA9BU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { withSelect } from '@wordpress/data';\nimport { SearchControl } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockManagerCategory from './category';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManager( {\n\tblockTypes,\n\tcategories,\n\thasBlockSupport,\n\tisMatchingSearchTerm,\n\tnumberOfHiddenBlocks,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ search, setSearch ] = useState( '' );\n\n\t// Filtering occurs here (as opposed to `withSelect`) to avoid\n\t// wasted renders by consequence of `Array#filter` producing\n\t// a new value reference on each call.\n\tblockTypes = blockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! search || isMatchingSearchTerm( blockType, search ) ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tblockType.parent.includes( 'core/post-content' ) )\n\t);\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! search ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = blockTypes.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ blockTypes.length, search, debouncedSpeak ] );\n\n\treturn (\n\t\t<div className=\"edit-post-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"edit-post-block-manager__disabled-blocks-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d block is hidden.',\n\t\t\t\t\t\t\t'%d blocks are hidden.',\n\t\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Search for a block' ) }\n\t\t\t\tplaceholder={ __( 'Search for a block' ) }\n\t\t\t\tvalue={ search }\n\t\t\t\tonChange={ ( nextSearch ) => setSearch( nextSearch ) }\n\t\t\t\tclassName=\"edit-post-block-manager__search\"\n\t\t\t/>\n\t\t\t<div\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"region\"\n\t\t\t\taria-label={ __( 'Available block types' ) }\n\t\t\t\tclassName=\"edit-post-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ blockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"edit-post-block-manager__no-results\">\n\t\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<BlockManagerCategory\n\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t\t( blockType ) =>\n\t\t\t\t\t\t\t\tblockType.category === category.slug\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t\t<BlockManagerCategory\n\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t( { category } ) => ! category\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst {\n\t\tgetBlockTypes,\n\t\tgetCategories,\n\t\thasBlockSupport,\n\t\tisMatchingSearchTerm,\n\t} = select( blocksStore );\n\tconst { getHiddenBlockTypes } = select( editPostStore );\n\n\t// Some hidden blocks become unregistered\n\t// by removing for instance the plugin that registered them, yet\n\t// they're still remain as hidden by the user's action.\n\t// We consider \"hidden\", blocks which were hidden and\n\t// are still registered.\n\tconst blockTypes = getBlockTypes();\n\tconst hiddenBlockTypes = getHiddenBlockTypes().filter( ( hiddenBlock ) => {\n\t\treturn blockTypes.some(\n\t\t\t( registeredBlock ) => registeredBlock.name === hiddenBlock\n\t\t);\n\t} );\n\tconst numberOfHiddenBlocks =\n\t\tArray.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length;\n\n\treturn {\n\t\tblockTypes,\n\t\tcategories: getCategories(),\n\t\thasBlockSupport,\n\t\tisMatchingSearchTerm,\n\t\tnumberOfHiddenBlocks,\n\t};\n} )( BlockManager );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/index.js"],"names":["store","blocksStore","withSelect","withDispatch","SearchControl","Button","__","_n","sprintf","useEffect","useState","useDebounce","compose","speak","BlockManagerCategory","editPostStore","BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","enableAllBlockTypes","debouncedSpeak","search","setSearch","filter","blockType","parent","includes","count","length","resultsFoundMessage","nextSearch","map","category","slug","title","select","getBlockTypes","getCategories","getHiddenBlockTypes","hiddenBlockTypes","hiddenBlock","some","registeredBlock","name","Array","isArray","dispatch","showBlockTypes","blockNames"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,aAAT,EAAwBC,MAAxB,QAAsC,uBAAtC;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,WAAT,EAAsBC,OAAtB,QAAqC,oBAArC;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,YAAjC;AACA,SAASd,KAAK,IAAIe,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,YAAT,CAAuB;AACtBC,EAAAA,UADsB;AAEtBC,EAAAA,UAFsB;AAGtBC,EAAAA,eAHsB;AAItBC,EAAAA,oBAJsB;AAKtBC,EAAAA,oBALsB;AAMtBC,EAAAA;AANsB,CAAvB,EAOI;AACH,QAAMC,cAAc,GAAGZ,WAAW,CAAEE,KAAF,EAAS,GAAT,CAAlC;AACA,QAAM,CAAEW,MAAF,EAAUC,SAAV,IAAwBf,QAAQ,CAAE,EAAF,CAAtC,CAFG,CAIH;AACA;AACA;;AACAO,EAAAA,UAA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,IAAuBA,eAAe,CAACC,IAAhB,KAAyBH,WAD1C,CAAP;AAGA,GALuB,CAAzB;AAOA,QAAMtB,oBAAoB,GACzB0B,KAAK,CAACC,OAAN,CAAeN,gBAAf,KAAqCA,gBAAgB,CAACX,MADvD;AAGA,SAAO;AACNd,IAAAA,UADM;AAENC,IAAAA,UAAU,EAAEsB,aAAa,EAFnB;AAGNrB,IAAAA,eAHM;AAINC,IAAAA,oBAJM;AAKNC,IAAAA;AALM,GAAP;AAOA,CAhCS,CADa,EAkCvBlB,YAAY,CAAI8C,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAqBD,QAAQ,CAAElC,aAAF,CAAnC;AACA,SAAO;AACNO,IAAAA,mBAAmB,EAAIL,UAAF,IAAkB;AACtC,YAAMkC,UAAU,GAAGlC,UAAU,CAACiB,GAAX,CAAgB,CAAE;AAAEY,QAAAA;AAAF,OAAF,KAAgBA,IAAhC,CAAnB;AACAI,MAAAA,cAAc,CAAEC,UAAF,CAAd;AACA;AAJK,GAAP;AAMA,CARW,CAlCW,CAAF,CAAP,CA2CVnC,YA3CU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { SearchControl, Button } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce, compose } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockManagerCategory from './category';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManager( {\n\tblockTypes,\n\tcategories,\n\thasBlockSupport,\n\tisMatchingSearchTerm,\n\tnumberOfHiddenBlocks,\n\tenableAllBlockTypes,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ search, setSearch ] = useState( '' );\n\n\t// Filtering occurs here (as opposed to `withSelect`) to avoid\n\t// wasted renders by consequence of `Array#filter` producing\n\t// a new value reference on each call.\n\tblockTypes = blockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! search || isMatchingSearchTerm( blockType, search ) ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tblockType.parent.includes( 'core/post-content' ) )\n\t);\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! search ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = blockTypes.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ blockTypes.length, search, debouncedSpeak ] );\n\n\treturn (\n\t\t<div className=\"edit-post-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"edit-post-block-manager__disabled-blocks-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d block is hidden.',\n\t\t\t\t\t\t\t'%d blocks are hidden.',\n\t\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t) }\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => enableAllBlockTypes( blockTypes ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Search for a block' ) }\n\t\t\t\tplaceholder={ __( 'Search for a block' ) }\n\t\t\t\tvalue={ search }\n\t\t\t\tonChange={ ( nextSearch ) => setSearch( nextSearch ) }\n\t\t\t\tclassName=\"edit-post-block-manager__search\"\n\t\t\t/>\n\t\t\t<div\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"region\"\n\t\t\t\taria-label={ __( 'Available block types' ) }\n\t\t\t\tclassName=\"edit-post-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ blockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"edit-post-block-manager__no-results\">\n\t\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<BlockManagerCategory\n\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t\t( blockType ) =>\n\t\t\t\t\t\t\t\tblockType.category === category.slug\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t\t<BlockManagerCategory\n\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t( { category } ) => ! category\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockTypes,\n\t\t\tgetCategories,\n\t\t\thasBlockSupport,\n\t\t\tisMatchingSearchTerm,\n\t\t} = select( blocksStore );\n\t\tconst { getHiddenBlockTypes } = select( editPostStore );\n\n\t\t// Some hidden blocks become unregistered\n\t\t// by removing for instance the plugin that registered them, yet\n\t\t// they're still remain as hidden by the user's action.\n\t\t// We consider \"hidden\", blocks which were hidden and\n\t\t// are still registered.\n\t\tconst blockTypes = getBlockTypes();\n\t\tconst hiddenBlockTypes = getHiddenBlockTypes().filter(\n\t\t\t( hiddenBlock ) => {\n\t\t\t\treturn blockTypes.some(\n\t\t\t\t\t( registeredBlock ) => registeredBlock.name === hiddenBlock\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\t\tconst numberOfHiddenBlocks =\n\t\t\tArray.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length;\n\n\t\treturn {\n\t\t\tblockTypes,\n\t\t\tcategories: getCategories(),\n\t\t\thasBlockSupport,\n\t\t\tisMatchingSearchTerm,\n\t\t\tnumberOfHiddenBlocks,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { showBlockTypes } = dispatch( editPostStore );\n\t\treturn {\n\t\t\tenableAllBlockTypes: ( blockTypes ) => {\n\t\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t},\n\t\t};\n\t} ),\n] )( BlockManager );\n"]}
@@ -79,33 +79,28 @@ const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allow
79
79
  */
80
80
 
81
81
 
82
- const PluginBlockSettingsMenuItem = _ref => {
83
- let {
84
- allowedBlocks,
85
- icon,
86
- label,
87
- onClick,
88
- small,
89
- role
90
- } = _ref;
91
- return createElement(BlockSettingsMenuControls, null, _ref2 => {
92
- let {
93
- selectedBlocks,
94
- onClose
95
- } = _ref2;
82
+ const PluginBlockSettingsMenuItem = ({
83
+ allowedBlocks,
84
+ icon,
85
+ label,
86
+ onClick,
87
+ small,
88
+ role
89
+ }) => createElement(BlockSettingsMenuControls, null, ({
90
+ selectedBlocks,
91
+ onClose
92
+ }) => {
93
+ if (!shouldRenderItem(selectedBlocks, allowedBlocks)) {
94
+ return null;
95
+ }
96
96
 
97
- if (!shouldRenderItem(selectedBlocks, allowedBlocks)) {
98
- return null;
99
- }
100
-
101
- return createElement(MenuItem, {
102
- onClick: compose(onClick, onClose),
103
- icon: icon,
104
- label: small ? label : undefined,
105
- role: role
106
- }, !small && label);
107
- });
108
- };
97
+ return createElement(MenuItem, {
98
+ onClick: compose(onClick, onClose),
99
+ icon: icon,
100
+ label: small ? label : undefined,
101
+ role: role
102
+ }, !small && label);
103
+ });
109
104
 
110
105
  export default PluginBlockSettingsMenuItem;
111
106
  //# sourceMappingURL=plugin-block-settings-menu-item.js.map