@wordpress/edit-site 4.19.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/add-new-template/add-custom-template-modal.js +1 -0
  3. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  4. package/build/components/add-new-template/index.js +8 -5
  5. package/build/components/add-new-template/index.js.map +1 -1
  6. package/build/components/add-new-template/new-template-part.js +21 -6
  7. package/build/components/add-new-template/new-template-part.js.map +1 -1
  8. package/build/components/add-new-template/new-template.js +12 -8
  9. package/build/components/add-new-template/new-template.js.map +1 -1
  10. package/build/components/app/index.js +15 -30
  11. package/build/components/app/index.js.map +1 -1
  12. package/build/components/block-editor/editor-canvas.js +64 -0
  13. package/build/components/block-editor/editor-canvas.js.map +1 -0
  14. package/build/components/block-editor/index.js +61 -59
  15. package/build/components/block-editor/index.js.map +1 -1
  16. package/build/components/block-editor/resizable-editor.js +10 -44
  17. package/build/components/block-editor/resizable-editor.js.map +1 -1
  18. package/build/components/editor/index.js +80 -127
  19. package/build/components/editor/index.js.map +1 -1
  20. package/build/components/global-styles/block-preview-panel.js +42 -0
  21. package/build/components/global-styles/block-preview-panel.js.map +1 -0
  22. package/build/components/global-styles/context-menu.js +6 -2
  23. package/build/components/global-styles/context-menu.js.map +1 -1
  24. package/build/components/global-styles/custom-css.js +61 -0
  25. package/build/components/global-styles/custom-css.js.map +1 -0
  26. package/build/components/global-styles/dimensions-panel.js +2 -6
  27. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  28. package/build/components/global-styles/global-styles-provider.js +15 -2
  29. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  30. package/build/components/global-styles/hooks.js +5 -2
  31. package/build/components/global-styles/hooks.js.map +1 -1
  32. package/build/components/global-styles/palette.js +1 -1
  33. package/build/components/global-styles/palette.js.map +1 -1
  34. package/build/components/global-styles/screen-block-list.js +2 -1
  35. package/build/components/global-styles/screen-block-list.js.map +1 -1
  36. package/build/components/global-styles/screen-block.js +10 -2
  37. package/build/components/global-styles/screen-block.js.map +1 -1
  38. package/build/components/global-styles/screen-border.js +43 -0
  39. package/build/components/global-styles/screen-border.js.map +1 -0
  40. package/build/components/global-styles/screen-colors.js +1 -1
  41. package/build/components/global-styles/screen-colors.js.map +1 -1
  42. package/build/components/global-styles/screen-css.js +42 -0
  43. package/build/components/global-styles/screen-css.js.map +1 -0
  44. package/build/components/global-styles/screen-layout.js +0 -5
  45. package/build/components/global-styles/screen-layout.js.map +1 -1
  46. package/build/components/global-styles/screen-root.js +14 -1
  47. package/build/components/global-styles/screen-root.js.map +1 -1
  48. package/build/components/global-styles/screen-style-variations.js +3 -3
  49. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  50. package/build/components/global-styles/ui.js +50 -4
  51. package/build/components/global-styles/ui.js.map +1 -1
  52. package/build/components/global-styles/use-global-styles-output.js +5 -1
  53. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  54. package/build/components/global-styles/utils.js +3 -3
  55. package/build/components/global-styles/utils.js.map +1 -1
  56. package/build/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +4 -8
  57. package/build/components/global-styles-renderer/index.js.map +1 -0
  58. package/build/components/header-edit-mode/document-actions/index.js +12 -5
  59. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  60. package/build/components/header-edit-mode/index.js +19 -12
  61. package/build/components/header-edit-mode/index.js.map +1 -1
  62. package/build/components/keyboard-shortcuts/index.js +11 -1
  63. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  64. package/build/components/layout/index.js +231 -0
  65. package/build/components/layout/index.js.map +1 -0
  66. package/build/components/list/header.js +5 -1
  67. package/build/components/list/header.js.map +1 -1
  68. package/build/components/list/index.js +4 -22
  69. package/build/components/list/index.js.map +1 -1
  70. package/build/components/navigate-to-link/index.js +1 -3
  71. package/build/components/navigate-to-link/index.js.map +1 -1
  72. package/build/components/routes/index.js +1 -1
  73. package/build/components/routes/index.js.map +1 -1
  74. package/build/components/sidebar/index.js +42 -0
  75. package/build/components/sidebar/index.js.map +1 -0
  76. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +24 -4
  77. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  78. package/build/components/sidebar-edit-mode/index.js +1 -1
  79. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  80. package/build/components/sidebar-navigation-item/index.js +53 -0
  81. package/build/components/sidebar-navigation-item/index.js.map +1 -0
  82. package/build/components/sidebar-navigation-screen/index.js +49 -0
  83. package/build/components/sidebar-navigation-screen/index.js.map +1 -0
  84. package/build/components/sidebar-navigation-screen-main/index.js +76 -0
  85. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -0
  86. package/build/components/sidebar-navigation-screen-templates/index.js +188 -0
  87. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -0
  88. package/build/components/site-icon/index.js +70 -0
  89. package/build/components/site-icon/index.js.map +1 -0
  90. package/build/components/site-title/index.js +55 -0
  91. package/build/components/site-title/index.js.map +1 -0
  92. package/build/components/style-book/index.js +173 -0
  93. package/build/components/style-book/index.js.map +1 -0
  94. package/build/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +5 -4
  95. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -0
  96. package/build/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +53 -0
  97. package/build/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +1 -0
  98. package/build/index.js +2 -45
  99. package/build/index.js.map +1 -1
  100. package/build/store/actions.js +93 -43
  101. package/build/store/actions.js.map +1 -1
  102. package/build/store/reducer.js +35 -107
  103. package/build/store/reducer.js.map +1 -1
  104. package/build/store/selectors.js +69 -78
  105. package/build/store/selectors.js.map +1 -1
  106. package/build-module/components/add-new-template/add-custom-template-modal.js +1 -0
  107. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  108. package/build-module/components/add-new-template/index.js +7 -5
  109. package/build-module/components/add-new-template/index.js.map +1 -1
  110. package/build-module/components/add-new-template/new-template-part.js +18 -6
  111. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  112. package/build-module/components/add-new-template/new-template.js +13 -9
  113. package/build-module/components/add-new-template/new-template.js.map +1 -1
  114. package/build-module/components/app/index.js +15 -28
  115. package/build-module/components/app/index.js.map +1 -1
  116. package/build-module/components/block-editor/editor-canvas.js +51 -0
  117. package/build-module/components/block-editor/editor-canvas.js.map +1 -0
  118. package/build-module/components/block-editor/index.js +61 -60
  119. package/build-module/components/block-editor/index.js.map +1 -1
  120. package/build-module/components/block-editor/resizable-editor.js +11 -40
  121. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  122. package/build-module/components/editor/index.js +81 -124
  123. package/build-module/components/editor/index.js.map +1 -1
  124. package/build-module/components/global-styles/block-preview-panel.js +32 -0
  125. package/build-module/components/global-styles/block-preview-panel.js.map +1 -0
  126. package/build-module/components/global-styles/context-menu.js +7 -3
  127. package/build-module/components/global-styles/context-menu.js.map +1 -1
  128. package/build-module/components/global-styles/custom-css.js +51 -0
  129. package/build-module/components/global-styles/custom-css.js.map +1 -0
  130. package/build-module/components/global-styles/dimensions-panel.js +3 -7
  131. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  132. package/build-module/components/global-styles/global-styles-provider.js +15 -2
  133. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  134. package/build-module/components/global-styles/hooks.js +5 -3
  135. package/build-module/components/global-styles/hooks.js.map +1 -1
  136. package/build-module/components/global-styles/palette.js +1 -1
  137. package/build-module/components/global-styles/palette.js.map +1 -1
  138. package/build-module/components/global-styles/screen-block-list.js +2 -1
  139. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  140. package/build-module/components/global-styles/screen-block.js +8 -2
  141. package/build-module/components/global-styles/screen-block.js.map +1 -1
  142. package/build-module/components/global-styles/screen-border.js +27 -0
  143. package/build-module/components/global-styles/screen-border.js.map +1 -0
  144. package/build-module/components/global-styles/screen-colors.js +1 -1
  145. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  146. package/build-module/components/global-styles/screen-css.js +28 -0
  147. package/build-module/components/global-styles/screen-css.js.map +1 -0
  148. package/build-module/components/global-styles/screen-layout.js +0 -4
  149. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  150. package/build-module/components/global-styles/screen-root.js +14 -1
  151. package/build-module/components/global-styles/screen-root.js.map +1 -1
  152. package/build-module/components/global-styles/screen-style-variations.js +2 -2
  153. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  154. package/build-module/components/global-styles/ui.js +48 -5
  155. package/build-module/components/global-styles/ui.js.map +1 -1
  156. package/build-module/components/global-styles/use-global-styles-output.js +5 -1
  157. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  158. package/build-module/components/global-styles/utils.js +4 -4
  159. package/build-module/components/global-styles/utils.js.map +1 -1
  160. package/build-module/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +4 -7
  161. package/build-module/components/global-styles-renderer/index.js.map +1 -0
  162. package/build-module/components/header-edit-mode/document-actions/index.js +13 -6
  163. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  164. package/build-module/components/header-edit-mode/index.js +16 -11
  165. package/build-module/components/header-edit-mode/index.js.map +1 -1
  166. package/build-module/components/keyboard-shortcuts/index.js +10 -1
  167. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  168. package/build-module/components/layout/index.js +203 -0
  169. package/build-module/components/layout/index.js.map +1 -0
  170. package/build-module/components/list/header.js +5 -1
  171. package/build-module/components/list/header.js.map +1 -1
  172. package/build-module/components/list/index.js +4 -19
  173. package/build-module/components/list/index.js.map +1 -1
  174. package/build-module/components/navigate-to-link/index.js +1 -3
  175. package/build-module/components/navigate-to-link/index.js.map +1 -1
  176. package/build-module/components/routes/index.js +1 -1
  177. package/build-module/components/routes/index.js.map +1 -1
  178. package/build-module/components/sidebar/index.js +30 -0
  179. package/build-module/components/sidebar/index.js.map +1 -0
  180. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +27 -7
  181. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  182. package/build-module/components/sidebar-edit-mode/index.js +3 -3
  183. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  184. package/build-module/components/sidebar-navigation-item/index.js +40 -0
  185. package/build-module/components/sidebar-navigation-item/index.js.map +1 -0
  186. package/build-module/components/sidebar-navigation-screen/index.js +39 -0
  187. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -0
  188. package/build-module/components/sidebar-navigation-screen-main/index.js +57 -0
  189. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -0
  190. package/build-module/components/sidebar-navigation-screen-templates/index.js +165 -0
  191. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -0
  192. package/build-module/components/site-icon/index.js +55 -0
  193. package/build-module/components/site-icon/index.js.map +1 -0
  194. package/build-module/components/site-title/index.js +43 -0
  195. package/build-module/components/site-title/index.js.map +1 -0
  196. package/build-module/components/style-book/index.js +156 -0
  197. package/build-module/components/style-book/index.js.map +1 -0
  198. package/build-module/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +4 -3
  199. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -0
  200. package/build-module/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +43 -0
  201. package/build-module/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +1 -0
  202. package/build-module/index.js +5 -36
  203. package/build-module/index.js.map +1 -1
  204. package/build-module/store/actions.js +87 -42
  205. package/build-module/store/actions.js.map +1 -1
  206. package/build-module/store/reducer.js +35 -102
  207. package/build-module/store/reducer.js.map +1 -1
  208. package/build-module/store/selectors.js +60 -72
  209. package/build-module/store/selectors.js.map +1 -1
  210. package/build-style/style-rtl.css +550 -346
  211. package/build-style/style.css +550 -346
  212. package/package.json +32 -31
  213. package/src/components/add-new-template/add-custom-template-modal.js +1 -0
  214. package/src/components/add-new-template/index.js +6 -3
  215. package/src/components/add-new-template/new-template-part.js +15 -3
  216. package/src/components/add-new-template/new-template.js +14 -7
  217. package/src/components/add-new-template/style.scss +0 -4
  218. package/src/components/app/index.js +14 -43
  219. package/src/components/block-editor/editor-canvas.js +69 -0
  220. package/src/components/block-editor/index.js +102 -87
  221. package/src/components/block-editor/resizable-editor.js +9 -64
  222. package/src/components/block-editor/style.scss +25 -1
  223. package/src/components/code-editor/style.scss +1 -1
  224. package/src/components/editor/index.js +170 -236
  225. package/src/components/editor/style.scss +0 -22
  226. package/src/components/global-styles/block-preview-panel.js +29 -0
  227. package/src/components/global-styles/context-menu.js +11 -2
  228. package/src/components/global-styles/custom-css.js +73 -0
  229. package/src/components/global-styles/dimensions-panel.js +2 -5
  230. package/src/components/global-styles/global-styles-provider.js +39 -17
  231. package/src/components/global-styles/hooks.js +8 -3
  232. package/src/components/global-styles/palette.js +1 -1
  233. package/src/components/global-styles/screen-block-list.js +2 -1
  234. package/src/components/global-styles/screen-block.js +9 -1
  235. package/src/components/global-styles/screen-border.js +23 -0
  236. package/src/components/global-styles/screen-colors.js +2 -1
  237. package/src/components/global-styles/screen-css.js +33 -0
  238. package/src/components/global-styles/screen-layout.js +0 -3
  239. package/src/components/global-styles/screen-root.js +30 -1
  240. package/src/components/global-styles/screen-style-variations.js +5 -2
  241. package/src/components/global-styles/style.scss +31 -2
  242. package/src/components/global-styles/ui.js +47 -4
  243. package/src/components/global-styles/use-global-styles-output.js +5 -0
  244. package/src/components/global-styles/utils.js +8 -5
  245. package/src/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +3 -9
  246. package/src/components/header-edit-mode/document-actions/index.js +14 -9
  247. package/src/components/header-edit-mode/document-actions/style.scss +8 -1
  248. package/src/components/header-edit-mode/index.js +96 -78
  249. package/src/components/header-edit-mode/style.scss +5 -33
  250. package/src/components/keyboard-shortcuts/index.js +13 -0
  251. package/src/components/layout/index.js +278 -0
  252. package/src/components/layout/style.scss +176 -0
  253. package/src/components/list/header.js +5 -1
  254. package/src/components/list/index.js +12 -31
  255. package/src/components/list/style.scss +10 -4
  256. package/src/components/navigate-to-link/index.js +2 -8
  257. package/src/components/routes/index.js +1 -1
  258. package/src/components/sidebar/index.js +34 -0
  259. package/src/components/sidebar/style.scss +8 -0
  260. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +42 -7
  261. package/src/components/sidebar-edit-mode/index.js +3 -3
  262. package/src/components/sidebar-edit-mode/navigation-menu-sidebar/style.scss +21 -3
  263. package/src/components/sidebar-edit-mode/settings-header/style.scss +47 -34
  264. package/src/components/sidebar-edit-mode/style.scss +0 -13
  265. package/src/components/sidebar-navigation-item/index.js +51 -0
  266. package/src/components/sidebar-navigation-item/style.scss +17 -0
  267. package/src/components/sidebar-navigation-screen/index.js +55 -0
  268. package/src/components/sidebar-navigation-screen/style.scss +41 -0
  269. package/src/components/sidebar-navigation-screen-main/index.js +72 -0
  270. package/src/components/sidebar-navigation-screen-templates/index.js +181 -0
  271. package/src/components/sidebar-navigation-screen-templates/style.scss +9 -0
  272. package/src/components/site-icon/index.js +56 -0
  273. package/src/components/site-icon/style.scss +10 -0
  274. package/src/components/site-title/index.js +39 -0
  275. package/src/components/style-book/index.js +193 -0
  276. package/src/components/style-book/style.scss +78 -0
  277. package/src/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +3 -3
  278. package/src/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +36 -0
  279. package/src/components/template-details/style.scss +4 -0
  280. package/src/index.js +3 -53
  281. package/src/store/actions.js +93 -48
  282. package/src/store/reducer.js +29 -91
  283. package/src/store/selectors.js +61 -101
  284. package/src/store/test/actions.js +3 -15
  285. package/src/store/test/reducer.js +8 -192
  286. package/src/store/test/selectors.js +3 -42
  287. package/src/style.scss +19 -3
  288. package/build/components/editor/global-styles-renderer.js.map +0 -1
  289. package/build/components/navigation-sidebar/index.js +0 -62
  290. package/build/components/navigation-sidebar/index.js.map +0 -1
  291. package/build/components/navigation-sidebar/navigation-panel/constants.js +0 -77
  292. package/build/components/navigation-sidebar/navigation-panel/constants.js.map +0 -1
  293. package/build/components/navigation-sidebar/navigation-panel/index.js +0 -152
  294. package/build/components/navigation-sidebar/navigation-panel/index.js.map +0 -1
  295. package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -81
  296. package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +0 -1
  297. package/build/components/navigation-sidebar/navigation-toggle/index.js +0 -124
  298. package/build/components/navigation-sidebar/navigation-toggle/index.js.map +0 -1
  299. package/build/components/url-query-controller/index.js.map +0 -1
  300. package/build-module/components/editor/global-styles-renderer.js.map +0 -1
  301. package/build-module/components/navigation-sidebar/index.js +0 -45
  302. package/build-module/components/navigation-sidebar/index.js.map +0 -1
  303. package/build-module/components/navigation-sidebar/navigation-panel/constants.js +0 -49
  304. package/build-module/components/navigation-sidebar/navigation-panel/constants.js.map +0 -1
  305. package/build-module/components/navigation-sidebar/navigation-panel/index.js +0 -131
  306. package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +0 -1
  307. package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -66
  308. package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +0 -1
  309. package/build-module/components/navigation-sidebar/navigation-toggle/index.js +0 -108
  310. package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +0 -1
  311. package/build-module/components/url-query-controller/index.js.map +0 -1
  312. package/src/components/navigation-sidebar/index.js +0 -46
  313. package/src/components/navigation-sidebar/navigation-panel/constants.js +0 -94
  314. package/src/components/navigation-sidebar/navigation-panel/index.js +0 -142
  315. package/src/components/navigation-sidebar/navigation-panel/style.scss +0 -152
  316. package/src/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -81
  317. package/src/components/navigation-sidebar/navigation-toggle/index.js +0 -114
  318. package/src/components/navigation-sidebar/navigation-toggle/style.scss +0 -71
  319. package/src/components/navigation-sidebar/navigation-toggle/test/index.js +0 -65
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { map } from 'lodash';
5
4
  import createSelector from 'rememo';
6
5
  /**
7
6
  * WordPress dependencies
@@ -14,12 +13,6 @@ import { uploadMedia } from '@wordpress/media-utils';
14
13
  import { isTemplatePart } from '@wordpress/blocks';
15
14
  import { Platform } from '@wordpress/element';
16
15
  import { store as preferencesStore } from '@wordpress/preferences';
17
- /**
18
- * Internal dependencies
19
- */
20
-
21
- import { MENU_ROOT, MENU_TEMPLATE_PARTS, MENU_TEMPLATES_UNUSED, TEMPLATE_PARTS_SUB_MENUS } from '../components/navigation-sidebar/navigation-panel/constants';
22
- import { getTemplateLocation, isTemplateSuperseded } from '../components/navigation-sidebar/navigation-panel/template-hierarchy';
23
16
  /**
24
17
  * @typedef {'template'|'template_type'} TemplateType Template type.
25
18
  */
@@ -131,19 +124,14 @@ export const getSettings = createSelector((state, setIsInserterOpen) => {
131
124
  return settings;
132
125
  }, state => [getCanUserCreateMedia(state), state.settings, __unstableGetPreference(state, 'focusMode'), __unstableGetPreference(state, 'fixedToolbar'), __unstableGetPreference(state, 'keepCaretInsideBlock'), __unstableGetPreference(state, 'showIconLabels'), getReusableBlocks(state), getEditedPostType(state)]);
133
126
  /**
134
- * Returns the current home template ID.
135
- *
136
- * @param {Object} state Global application state.
137
- *
138
- * @return {number?} Home template ID.
127
+ * @deprecated
139
128
  */
140
129
 
141
- export function getHomeTemplateId(state) {
142
- return state.homeTemplateId;
143
- }
144
-
145
- function getCurrentEditedPost(state) {
146
- return state.editedPost;
130
+ export function getHomeTemplateId() {
131
+ deprecated("select( 'core/edit-site' ).getHomeTemplateId", {
132
+ since: '6.2',
133
+ version: '6.4'
134
+ });
147
135
  }
148
136
  /**
149
137
  * Returns the current edited post type (wp_template or wp_template_part).
@@ -153,9 +141,8 @@ function getCurrentEditedPost(state) {
153
141
  * @return {TemplateType?} Template type.
154
142
  */
155
143
 
156
-
157
144
  export function getEditedPostType(state) {
158
- return getCurrentEditedPost(state).type;
145
+ return state.editedPost.postType;
159
146
  }
160
147
  /**
161
148
  * Returns the ID of the currently edited template or template part.
@@ -166,73 +153,33 @@ export function getEditedPostType(state) {
166
153
  */
167
154
 
168
155
  export function getEditedPostId(state) {
169
- return getCurrentEditedPost(state).id;
156
+ return state.editedPost.id;
170
157
  }
171
158
  /**
172
- * Returns the current page object.
159
+ * Returns the edited post's context object.
173
160
  *
161
+ * @deprecated
174
162
  * @param {Object} state Global application state.
175
163
  *
176
164
  * @return {Object} Page.
177
165
  */
178
166
 
179
- export function getPage(state) {
180
- return getCurrentEditedPost(state).page;
181
- }
182
- /**
183
- * Returns the active menu in the navigation panel.
184
- *
185
- * @param {Object} state Global application state.
186
- *
187
- * @return {string} Active menu.
188
- */
189
-
190
- export function getNavigationPanelActiveMenu(state) {
191
- return state.navigationPanel.menu;
167
+ export function getEditedPostContext(state) {
168
+ return state.editedPost.context;
192
169
  }
193
170
  /**
194
- * Returns the current template or template part's corresponding
195
- * navigation panel's sub menu, to be used with `openNavigationPanelToMenu`.
196
- *
197
- * @param {Object} state Global application state.
198
- *
199
- * @return {string} The current template or template part's sub menu.
200
- */
201
-
202
- export const getCurrentTemplateNavigationPanelSubMenu = createRegistrySelector(select => state => {
203
- const templateType = getEditedPostType(state);
204
- const templateId = getEditedPostId(state);
205
- const template = templateId ? select(coreDataStore).getEntityRecord('postType', templateType, templateId) : null;
206
-
207
- if (!template) {
208
- return MENU_ROOT;
209
- }
210
-
211
- if ('wp_template_part' === templateType) {
212
- var _TEMPLATE_PARTS_SUB_M;
213
-
214
- return ((_TEMPLATE_PARTS_SUB_M = TEMPLATE_PARTS_SUB_MENUS.find(submenu => submenu.area === (template === null || template === void 0 ? void 0 : template.area))) === null || _TEMPLATE_PARTS_SUB_M === void 0 ? void 0 : _TEMPLATE_PARTS_SUB_M.menu) || MENU_TEMPLATE_PARTS;
215
- }
216
-
217
- const templates = select(coreDataStore).getEntityRecords('postType', 'wp_template');
218
- const showOnFront = select(coreDataStore).getEditedEntityRecord('root', 'site').show_on_front;
219
-
220
- if (isTemplateSuperseded(template.slug, map(templates, 'slug'), showOnFront)) {
221
- return MENU_TEMPLATES_UNUSED;
222
- }
223
-
224
- return getTemplateLocation(template.slug);
225
- });
226
- /**
227
- * Returns the current opened/closed state of the navigation panel.
171
+ * Returns the current page object.
228
172
  *
173
+ * @deprecated
229
174
  * @param {Object} state Global application state.
230
175
  *
231
- * @return {boolean} True if the navigation panel should be open; false if closed.
176
+ * @return {Object} Page.
232
177
  */
233
178
 
234
- export function isNavigationOpened(state) {
235
- return state.navigationPanel.isOpen;
179
+ export function getPage(state) {
180
+ return {
181
+ context: state.editedPost.context
182
+ };
236
183
  }
237
184
  /**
238
185
  * Returns the current opened/closed state of the inserter panel.
@@ -338,4 +285,45 @@ export const getCurrentTemplateTemplateParts = createRegistrySelector(select =>
338
285
  export function getEditorMode(state) {
339
286
  return __unstableGetPreference(state, 'editorMode');
340
287
  }
288
+ /**
289
+ * Returns the current canvas mode.
290
+ *
291
+ * @param {Object} state Global application state.
292
+ *
293
+ * @return {string} Canvas mode.
294
+ */
295
+
296
+ export function __unstableGetCanvasMode(state) {
297
+ return state.canvasMode;
298
+ }
299
+ /**
300
+ * @deprecated
301
+ */
302
+
303
+ export function getCurrentTemplateNavigationPanelSubMenu() {
304
+ deprecated("dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu", {
305
+ since: '6.2',
306
+ version: '6.4'
307
+ });
308
+ }
309
+ /**
310
+ * @deprecated
311
+ */
312
+
313
+ export function getNavigationPanelActiveMenu() {
314
+ deprecated("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu", {
315
+ since: '6.2',
316
+ version: '6.4'
317
+ });
318
+ }
319
+ /**
320
+ * @deprecated
321
+ */
322
+
323
+ export function isNavigationOpened() {
324
+ deprecated("dispatch( 'core/edit-site' ).isNavigationOpened", {
325
+ since: '6.2',
326
+ version: '6.4'
327
+ });
328
+ }
341
329
  //# sourceMappingURL=selectors.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["map","createSelector","store","coreDataStore","createRegistrySelector","deprecated","uploadMedia","isTemplatePart","Platform","preferencesStore","MENU_ROOT","MENU_TEMPLATE_PARTS","MENU_TEMPLATES_UNUSED","TEMPLATE_PARTS_SUB_MENUS","getTemplateLocation","isTemplateSuperseded","__unstableGetPreference","select","state","name","get","isFeatureActive","featureName","since","alternative","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","canUser","getReusableBlocks","isWeb","OS","getEntityRecords","per_page","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","keepCaretInsideBlock","showIconLabels","__experimentalSetIsInserterOpened","__experimentalReusableBlocks","__experimentalPreferPatternsOnRoot","getEditedPostType","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","homeTemplateId","getCurrentEditedPost","editedPost","type","getEditedPostId","id","getPage","page","getNavigationPanelActiveMenu","navigationPanel","menu","getCurrentTemplateNavigationPanelSubMenu","templateType","templateId","template","getEntityRecord","find","submenu","area","templates","showOnFront","getEditedEntityRecord","show_on_front","slug","isNavigationOpened","isOpen","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateParts","templatePartsById","reduce","newTemplateParts","part","blocks","filter","block","attributes","theme","templatePartId","templatePart","getEditorMode"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AACA,OAAOC,cAAP,MAA2B,QAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,WAAT,QAA4B,wBAA5B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AAN,CAAwB6B,gBAAxB,CACrB,UADqB,EAErB,kBAFqB,EAGrB;AAAEC,IAAAA,QAAQ,EAAE,CAAC;AAAb,GAHqB,CAAtB;AAKA,QAAM2D,iBAAiB,GAAGD,aAAa,GACpC;AACAA,EAAAA,aAAa,CAACE,MAAd,CACA,CAAEC,gBAAF,EAAoBC,IAApB,MAAgC,EAC/B,GAAGD,gBAD4B;AAE/B,KAAEC,IAAI,CAACpC,EAAP,GAAaoC;AAFkB,GAAhC,CADA,EAKA,EALA,CAFoC,GASpC,EATH;AAWA,SAAO,qBAAE3B,QAAQ,CAAC4B,MAAX,+DAAqB,EAArB,EACLC,MADK,CACKC,KAAF,IAAa3F,cAAc,CAAE2F,KAAF,CAD9B,EAELlG,GAFK,CAEEkG,KAAF,IAAa;AAClB,UAAM;AACLC,MAAAA,UAAU,EAAE;AAAEC,QAAAA,KAAF;AAASvB,QAAAA;AAAT;AADP,QAEFqB,KAFJ;AAGA,UAAMG,cAAc,GAAI,GAAGD,KAAO,KAAKvB,IAAM,EAA7C;AACA,UAAMyB,YAAY,GAAGV,iBAAiB,CAAES,cAAF,CAAtC;AAEA,WAAO;AACNC,MAAAA,YADM;AAENJ,MAAAA;AAFM,KAAP;AAIA,GAbK,EAcLD,MAdK,CAcG;AAAA,QAAE;AAAEK,MAAAA;AAAF,KAAF;AAAA,WAAwB,CAAC,CAAEA,YAA3B;AAAA,GAdH,CAAP;AAeA,CAzCmE,CAA9D;AA4CP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBrF,KAAxB,EAAgC;AACtC,SAAOF,uBAAuB,CAAEE,KAAF,EAAS,YAAT,CAA9B;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { map } from 'lodash';\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { isTemplatePart } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMENU_ROOT,\n\tMENU_TEMPLATE_PARTS,\n\tMENU_TEMPLATES_UNUSED,\n\tTEMPLATE_PARTS_SUB_MENUS,\n} from '../components/navigation-sidebar/navigation-panel/constants';\nimport {\n\tgetTemplateLocation,\n\tisTemplateSuperseded,\n} from '../components/navigation-sidebar/navigation-panel/template-hierarchy';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Helper for getting a preference from the preferences store.\n *\n * This is only present so that `getSettings` doesn't need to be made a\n * registry selector.\n *\n * It's unstable because the selector needs to be exported and so part of the\n * public API to work.\n */\nexport const __unstableGetPreference = createRegistrySelector(\n\t( select ) => ( state, name ) =>\n\t\tselect( preferencesStore ).get( 'core/edit-site', name )\n);\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, featureName ) {\n\tdeprecated( `select( 'core/interface' ).isFeatureActive`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\treturn !! __unstableGetPreference( state, featureName );\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 whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: !! __unstableGetPreference( state, 'focusMode' ),\n\t\t\thasFixedToolbar: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tshowIconLabels: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t\t__experimentalReusableBlocks: getReusableBlocks( state ),\n\t\t\t__experimentalPreferPatternsOnRoot:\n\t\t\t\t'wp_template' === getEditedPostType( state ),\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\t__unstableGetPreference( state, 'focusMode' ),\n\t\t__unstableGetPreference( state, 'fixedToolbar' ),\n\t\t__unstableGetPreference( state, 'keepCaretInsideBlock' ),\n\t\t__unstableGetPreference( state, 'showIconLabels' ),\n\t\tgetReusableBlocks( state ),\n\t\tgetEditedPostType( state ),\n\t]\n);\n\n/**\n * Returns the current home template ID.\n *\n * @param {Object} state Global application state.\n *\n * @return {number?} Home template ID.\n */\nexport function getHomeTemplateId( state ) {\n\treturn state.homeTemplateId;\n}\n\nfunction getCurrentEditedPost( state ) {\n\treturn state.editedPost;\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn getCurrentEditedPost( state ).type;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn getCurrentEditedPost( state ).id;\n}\n\n/**\n * Returns the current page object.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn getCurrentEditedPost( state ).page;\n}\n\n/**\n * Returns the active menu in the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Active menu.\n */\nexport function getNavigationPanelActiveMenu( state ) {\n\treturn state.navigationPanel.menu;\n}\n\n/**\n * Returns the current template or template part's corresponding\n * navigation panel's sub menu, to be used with `openNavigationPanelToMenu`.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} The current template or template part's sub menu.\n */\nexport const getCurrentTemplateNavigationPanelSubMenu = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = templateId\n\t\t\t? select( coreDataStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplateType,\n\t\t\t\t\ttemplateId\n\t\t\t )\n\t\t\t: null;\n\n\t\tif ( ! template ) {\n\t\t\treturn MENU_ROOT;\n\t\t}\n\n\t\tif ( 'wp_template_part' === templateType ) {\n\t\t\treturn (\n\t\t\t\tTEMPLATE_PARTS_SUB_MENUS.find(\n\t\t\t\t\t( submenu ) => submenu.area === template?.area\n\t\t\t\t)?.menu || MENU_TEMPLATE_PARTS\n\t\t\t);\n\t\t}\n\n\t\tconst templates = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template'\n\t\t);\n\t\tconst showOnFront = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'root',\n\t\t\t'site'\n\t\t).show_on_front;\n\n\t\tif (\n\t\t\tisTemplateSuperseded(\n\t\t\t\ttemplate.slug,\n\t\t\t\tmap( templates, 'slug' ),\n\t\t\t\tshowOnFront\n\t\t\t)\n\t\t) {\n\t\t\treturn MENU_TEMPLATES_UNUSED;\n\t\t}\n\n\t\treturn getTemplateLocation( template.slug );\n\t}\n);\n\n/**\n * Returns the current opened/closed state of the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the navigation panel should be open; false if closed.\n */\nexport function isNavigationOpened( state ) {\n\treturn state.navigationPanel.isOpen;\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\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 the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplateType,\n\t\t\ttemplateId\n\t\t);\n\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{ per_page: -1 }\n\t\t);\n\t\tconst templatePartsById = templateParts\n\t\t\t? // Key template parts by their ID.\n\t\t\t templateParts.reduce(\n\t\t\t\t\t( newTemplateParts, part ) => ( {\n\t\t\t\t\t\t...newTemplateParts,\n\t\t\t\t\t\t[ part.id ]: part,\n\t\t\t\t\t} ),\n\t\t\t\t\t{}\n\t\t\t )\n\t\t\t: {};\n\n\t\treturn ( template.blocks ?? [] )\n\t\t\t.filter( ( block ) => isTemplatePart( block ) )\n\t\t\t.map( ( block ) => {\n\t\t\t\tconst {\n\t\t\t\t\tattributes: { theme, slug },\n\t\t\t\t} = block;\n\t\t\t\tconst templatePartId = `${ theme }//${ slug }`;\n\t\t\t\tconst templatePart = templatePartsById[ templatePartId ];\n\n\t\t\t\treturn {\n\t\t\t\t\ttemplatePart,\n\t\t\t\t\tblock,\n\t\t\t\t};\n\t\t\t} )\n\t\t\t.filter( ( { templatePart } ) => !! templatePart );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn __unstableGetPreference( state, 'editorMode' );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["createSelector","store","coreDataStore","createRegistrySelector","deprecated","uploadMedia","isTemplatePart","Platform","preferencesStore","__unstableGetPreference","select","state","name","get","isFeatureActive","featureName","since","alternative","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","canUser","getReusableBlocks","isWeb","OS","getEntityRecords","per_page","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","keepCaretInsideBlock","showIconLabels","__experimentalSetIsInserterOpened","__experimentalReusableBlocks","__experimentalPreferPatternsOnRoot","getEditedPostType","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","version","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateType","templateId","template","getEditedEntityRecord","templateParts","templatePartsById","reduce","newTemplateParts","part","blocks","filter","block","map","attributes","theme","slug","templatePartId","templatePart","getEditorMode","__unstableGetCanvasMode","canvasMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,WAAT,QAA4B,wBAA5B;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASN,KAAK,IAAIO,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,uBAAuB,GAAGN,sBAAsB,CAC1DO,MAAF,IAAc,CAAEC,KAAF,EAASC,IAAT,KACbF,MAAM,CAAEF,gBAAF,CAAN,CAA2BK,GAA3B,CAAgC,gBAAhC,EAAkDD,IAAlD,C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EAAE;AAAEC,QAAAA,KAAF;AAASC,QAAAA;AAAT;AADP,QAEFJ,KAFJ;AAGA,UAAMK,cAAc,GAAI,GAAGF,KAAO,KAAKC,IAAM,EAA7C;AACA,UAAME,YAAY,GAAGZ,iBAAiB,CAAEW,cAAF,CAAtC;AAEA,WAAO;AACNC,MAAAA,YADM;AAENN,MAAAA;AAFM,KAAP;AAIA,GAbK,EAcLD,MAdK,CAcG;AAAA,QAAE;AAAEO,MAAAA;AAAF,KAAF;AAAA,WAAwB,CAAC,CAAEA,YAA3B;AAAA,GAdH,CAAP;AAeA,CAzCmE,CAA9D;AA4CP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBzE,KAAxB,EAAgC;AACtC,SAAOF,uBAAuB,CAAEE,KAAF,EAAS,YAAT,CAA9B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAAS0E,uBAAT,CAAkC1E,KAAlC,EAA0C;AAChD,SAAOA,KAAK,CAAC2E,UAAb;AACA;AAED;AACA;AACA;;AACA,OAAO,SAASC,wCAAT,GAAoD;AAC1DnF,EAAAA,UAAU,CACT,uEADS,EAET;AACCY,IAAAA,KAAK,EAAE,KADR;AAEC+B,IAAAA,OAAO,EAAE;AAFV,GAFS,CAAV;AAOA;AAED;AACA;AACA;;AACA,OAAO,SAASyC,4BAAT,GAAwC;AAC9CpF,EAAAA,UAAU,CAAE,2DAAF,EAA+D;AACxEY,IAAAA,KAAK,EAAE,KADiE;AAExE+B,IAAAA,OAAO,EAAE;AAF+D,GAA/D,CAAV;AAIA;AAED;AACA;AACA;;AACA,OAAO,SAAS0C,kBAAT,GAA8B;AACpCrF,EAAAA,UAAU,CAAE,iDAAF,EAAqD;AAC9DY,IAAAA,KAAK,EAAE,KADuD;AAE9D+B,IAAAA,OAAO,EAAE;AAFqD,GAArD,CAAV;AAIA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { isTemplatePart } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Helper for getting a preference from the preferences store.\n *\n * This is only present so that `getSettings` doesn't need to be made a\n * registry selector.\n *\n * It's unstable because the selector needs to be exported and so part of the\n * public API to work.\n */\nexport const __unstableGetPreference = createRegistrySelector(\n\t( select ) => ( state, name ) =>\n\t\tselect( preferencesStore ).get( 'core/edit-site', name )\n);\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, featureName ) {\n\tdeprecated( `select( 'core/interface' ).isFeatureActive`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\treturn !! __unstableGetPreference( state, featureName );\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 whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: !! __unstableGetPreference( state, 'focusMode' ),\n\t\t\thasFixedToolbar: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tshowIconLabels: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t\t__experimentalReusableBlocks: getReusableBlocks( state ),\n\t\t\t__experimentalPreferPatternsOnRoot:\n\t\t\t\t'wp_template' === getEditedPostType( state ),\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\t__unstableGetPreference( state, 'focusMode' ),\n\t\t__unstableGetPreference( state, 'fixedToolbar' ),\n\t\t__unstableGetPreference( state, 'keepCaretInsideBlock' ),\n\t\t__unstableGetPreference( state, 'showIconLabels' ),\n\t\tgetReusableBlocks( state ),\n\t\tgetEditedPostType( state ),\n\t]\n);\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\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 the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplateType,\n\t\t\ttemplateId\n\t\t);\n\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{ per_page: -1 }\n\t\t);\n\t\tconst templatePartsById = templateParts\n\t\t\t? // Key template parts by their ID.\n\t\t\t templateParts.reduce(\n\t\t\t\t\t( newTemplateParts, part ) => ( {\n\t\t\t\t\t\t...newTemplateParts,\n\t\t\t\t\t\t[ part.id ]: part,\n\t\t\t\t\t} ),\n\t\t\t\t\t{}\n\t\t\t )\n\t\t\t: {};\n\n\t\treturn ( template.blocks ?? [] )\n\t\t\t.filter( ( block ) => isTemplatePart( block ) )\n\t\t\t.map( ( block ) => {\n\t\t\t\tconst {\n\t\t\t\t\tattributes: { theme, slug },\n\t\t\t\t} = block;\n\t\t\t\tconst templatePartId = `${ theme }//${ slug }`;\n\t\t\t\tconst templatePart = templatePartsById[ templatePartId ];\n\n\t\t\t\treturn {\n\t\t\t\t\ttemplatePart,\n\t\t\t\t\tblock,\n\t\t\t\t};\n\t\t\t} )\n\t\t\t.filter( ( { templatePart } ) => !! templatePart );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn __unstableGetPreference( state, 'editorMode' );\n}\n\n/**\n * Returns the current canvas mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Canvas mode.\n */\nexport function __unstableGetCanvasMode( state ) {\n\treturn state.canvasMode;\n}\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n"]}