@wordpress/edit-site 6.2.0 → 6.4.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 (368) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-pattern/index.js +8 -2
  3. package/build/components/add-new-pattern/index.js.map +1 -1
  4. package/build/components/{add-new-page → add-new-post}/index.js +21 -17
  5. package/build/components/add-new-post/index.js.map +1 -0
  6. package/build/components/add-new-template/index.js +3 -1
  7. package/build/components/add-new-template/index.js.map +1 -1
  8. package/build/components/block-editor/use-site-editor-settings.js +6 -85
  9. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  10. package/build/components/editor/index.js +21 -3
  11. package/build/components/editor/index.js.map +1 -1
  12. package/build/components/global-styles/background-panel.js +0 -5
  13. package/build/components/global-styles/background-panel.js.map +1 -1
  14. package/build/components/global-styles/block-preview-panel.js +14 -5
  15. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  16. package/build/components/global-styles/font-families.js +42 -23
  17. package/build/components/global-styles/font-families.js.map +1 -1
  18. package/build/components/global-styles/font-library-modal/font-collection.js +13 -30
  19. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  20. package/build/components/global-styles/font-library-modal/index.js +4 -4
  21. package/build/components/global-styles/font-library-modal/index.js.map +1 -1
  22. package/build/components/global-styles/font-library-modal/installed-fonts.js +60 -12
  23. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  24. package/build/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js +39 -0
  25. package/build/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js.map +1 -0
  26. package/build/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js +39 -0
  27. package/build/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js.map +1 -0
  28. package/build/components/global-styles/font-sizes/font-size-preview.js +44 -0
  29. package/build/components/global-styles/font-sizes/font-size-preview.js.map +1 -0
  30. package/build/components/global-styles/font-sizes/font-size.js +213 -0
  31. package/build/components/global-styles/font-sizes/font-size.js.map +1 -0
  32. package/build/components/global-styles/font-sizes/font-sizes-count.js +50 -0
  33. package/build/components/global-styles/font-sizes/font-sizes-count.js.map +1 -0
  34. package/build/components/global-styles/font-sizes/font-sizes.js +163 -0
  35. package/build/components/global-styles/font-sizes/font-sizes.js.map +1 -0
  36. package/build/components/global-styles/font-sizes/rename-font-size-dialog.js +67 -0
  37. package/build/components/global-styles/font-sizes/rename-font-size-dialog.js.map +1 -0
  38. package/build/components/global-styles/hooks.js +0 -40
  39. package/build/components/global-styles/hooks.js.map +1 -1
  40. package/build/components/global-styles/preview-typography.js +47 -0
  41. package/build/components/global-styles/preview-typography.js.map +1 -0
  42. package/build/components/global-styles/screen-block.js +17 -1
  43. package/build/components/global-styles/screen-block.js.map +1 -1
  44. package/build/components/global-styles/screen-layout.js +5 -1
  45. package/build/components/global-styles/screen-layout.js.map +1 -1
  46. package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  47. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  48. package/build/components/global-styles/screen-style-variations.js +2 -2
  49. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  50. package/build/components/global-styles/screen-typography.js +3 -2
  51. package/build/components/global-styles/screen-typography.js.map +1 -1
  52. package/build/components/global-styles/shadows-edit-panel.js +1 -2
  53. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  54. package/build/components/global-styles/size-control/index.js +85 -0
  55. package/build/components/global-styles/size-control/index.js.map +1 -0
  56. package/build/components/global-styles/style-variations-container.js +8 -5
  57. package/build/components/global-styles/style-variations-container.js.map +1 -1
  58. package/build/components/global-styles/typography-elements.js +0 -2
  59. package/build/components/global-styles/typography-elements.js.map +1 -1
  60. package/build/components/global-styles/ui.js +8 -0
  61. package/build/components/global-styles/ui.js.map +1 -1
  62. package/build/components/global-styles/variations/variation.js +4 -4
  63. package/build/components/global-styles/variations/variation.js.map +1 -1
  64. package/build/components/global-styles/variations/variations-color.js +4 -3
  65. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  66. package/build/components/global-styles/variations/variations-typography.js +15 -29
  67. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  68. package/build/components/global-styles-sidebar/index.js +2 -2
  69. package/build/components/global-styles-sidebar/index.js.map +1 -1
  70. package/build/components/layout/index.js +22 -8
  71. package/build/components/layout/index.js.map +1 -1
  72. package/build/components/layout/router.js +30 -43
  73. package/build/components/layout/router.js.map +1 -1
  74. package/build/components/page-patterns/header.js +1 -1
  75. package/build/components/page-patterns/header.js.map +1 -1
  76. package/build/components/page-patterns/index.js +65 -49
  77. package/build/components/page-patterns/index.js.map +1 -1
  78. package/build/components/page-patterns/search-items.js +29 -4
  79. package/build/components/page-patterns/search-items.js.map +1 -1
  80. package/build/components/page-patterns/use-patterns.js +22 -55
  81. package/build/components/page-patterns/use-patterns.js.map +1 -1
  82. package/build/components/page-templates/index.js +56 -50
  83. package/build/components/page-templates/index.js.map +1 -1
  84. package/build/components/pagination/index.js +4 -4
  85. package/build/components/pagination/index.js.map +1 -1
  86. package/build/components/post-edit/index.js +105 -0
  87. package/build/components/post-edit/index.js.map +1 -0
  88. package/build/components/post-fields/index.js +314 -0
  89. package/build/components/post-fields/index.js.map +1 -0
  90. package/build/components/post-list/index.js +281 -0
  91. package/build/components/post-list/index.js.map +1 -0
  92. package/build/components/posts-app/index.js +11 -17
  93. package/build/components/posts-app/index.js.map +1 -1
  94. package/build/components/posts-app/router.js +85 -0
  95. package/build/components/posts-app/router.js.map +1 -0
  96. package/build/components/revisions/index.js +10 -7
  97. package/build/components/revisions/index.js.map +1 -1
  98. package/build/components/save-panel/index.js +1 -1
  99. package/build/components/save-panel/index.js.map +1 -1
  100. package/build/components/sidebar-dataviews/add-new-view.js +4 -1
  101. package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
  102. package/build/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
  103. package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  104. package/build/components/sidebar-dataviews/default-views.js +119 -93
  105. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  106. package/build/components/sidebar-dataviews/index.js +44 -2
  107. package/build/components/sidebar-dataviews/index.js.map +1 -1
  108. package/build/components/sidebar-navigation-screen-global-styles/content.js +64 -0
  109. package/build/components/sidebar-navigation-screen-global-styles/content.js.map +1 -0
  110. package/build/components/sidebar-navigation-screen-global-styles/index.js +2 -47
  111. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  112. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -2
  113. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  114. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
  115. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  116. package/build/components/site-hub/index.js +81 -1
  117. package/build/components/site-hub/index.js.map +1 -1
  118. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
  119. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  120. package/build/hooks/push-changes-to-global-styles/index.js +2 -2
  121. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  122. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +65 -42
  123. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  124. package/build/index.js +10 -0
  125. package/build/index.js.map +1 -1
  126. package/build/posts.js +57 -2
  127. package/build/posts.js.map +1 -1
  128. package/build/store/private-actions.js +7 -2
  129. package/build/store/private-actions.js.map +1 -1
  130. package/build/store/selectors.js +34 -6
  131. package/build/store/selectors.js.map +1 -1
  132. package/build/utils/get-filtered-template-parts.js +64 -0
  133. package/build/utils/get-filtered-template-parts.js.map +1 -0
  134. package/build-module/components/add-new-pattern/index.js +8 -2
  135. package/build-module/components/add-new-pattern/index.js.map +1 -1
  136. package/build-module/components/{add-new-page → add-new-post}/index.js +21 -17
  137. package/build-module/components/add-new-post/index.js.map +1 -0
  138. package/build-module/components/add-new-template/index.js +3 -1
  139. package/build-module/components/add-new-template/index.js.map +1 -1
  140. package/build-module/components/block-editor/use-site-editor-settings.js +6 -85
  141. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  142. package/build-module/components/editor/index.js +21 -3
  143. package/build-module/components/editor/index.js.map +1 -1
  144. package/build-module/components/global-styles/background-panel.js +0 -5
  145. package/build-module/components/global-styles/background-panel.js.map +1 -1
  146. package/build-module/components/global-styles/block-preview-panel.js +14 -5
  147. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  148. package/build-module/components/global-styles/font-families.js +44 -25
  149. package/build-module/components/global-styles/font-families.js.map +1 -1
  150. package/build-module/components/global-styles/font-library-modal/font-collection.js +14 -31
  151. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  152. package/build-module/components/global-styles/font-library-modal/index.js +4 -4
  153. package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
  154. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +63 -15
  155. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  156. package/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js +32 -0
  157. package/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js.map +1 -0
  158. package/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js +32 -0
  159. package/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js.map +1 -0
  160. package/build-module/components/global-styles/font-sizes/font-size-preview.js +37 -0
  161. package/build-module/components/global-styles/font-sizes/font-size-preview.js.map +1 -0
  162. package/build-module/components/global-styles/font-sizes/font-size.js +207 -0
  163. package/build-module/components/global-styles/font-sizes/font-size.js.map +1 -0
  164. package/build-module/components/global-styles/font-sizes/font-sizes-count.js +43 -0
  165. package/build-module/components/global-styles/font-sizes/font-sizes-count.js.map +1 -0
  166. package/build-module/components/global-styles/font-sizes/font-sizes.js +157 -0
  167. package/build-module/components/global-styles/font-sizes/font-sizes.js.map +1 -0
  168. package/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js +61 -0
  169. package/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js.map +1 -0
  170. package/build-module/components/global-styles/hooks.js +0 -38
  171. package/build-module/components/global-styles/hooks.js.map +1 -1
  172. package/build-module/components/global-styles/preview-typography.js +39 -0
  173. package/build-module/components/global-styles/preview-typography.js.map +1 -0
  174. package/build-module/components/global-styles/screen-block.js +18 -1
  175. package/build-module/components/global-styles/screen-block.js.map +1 -1
  176. package/build-module/components/global-styles/screen-layout.js +5 -1
  177. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  178. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  179. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  180. package/build-module/components/global-styles/screen-style-variations.js +2 -2
  181. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  182. package/build-module/components/global-styles/screen-typography.js +3 -2
  183. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  184. package/build-module/components/global-styles/shadows-edit-panel.js +1 -2
  185. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  186. package/build-module/components/global-styles/size-control/index.js +79 -0
  187. package/build-module/components/global-styles/size-control/index.js.map +1 -0
  188. package/build-module/components/global-styles/style-variations-container.js +9 -6
  189. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  190. package/build-module/components/global-styles/typography-elements.js +0 -2
  191. package/build-module/components/global-styles/typography-elements.js.map +1 -1
  192. package/build-module/components/global-styles/ui.js +8 -0
  193. package/build-module/components/global-styles/ui.js.map +1 -1
  194. package/build-module/components/global-styles/variations/variation.js +5 -5
  195. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  196. package/build-module/components/global-styles/variations/variations-color.js +5 -4
  197. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  198. package/build-module/components/global-styles/variations/variations-typography.js +16 -30
  199. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  200. package/build-module/components/global-styles-sidebar/index.js +2 -2
  201. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  202. package/build-module/components/layout/index.js +20 -8
  203. package/build-module/components/layout/index.js.map +1 -1
  204. package/build-module/components/layout/router.js +30 -43
  205. package/build-module/components/layout/router.js.map +1 -1
  206. package/build-module/components/page-patterns/header.js +1 -1
  207. package/build-module/components/page-patterns/header.js.map +1 -1
  208. package/build-module/components/page-patterns/index.js +66 -50
  209. package/build-module/components/page-patterns/index.js.map +1 -1
  210. package/build-module/components/page-patterns/search-items.js +28 -4
  211. package/build-module/components/page-patterns/search-items.js.map +1 -1
  212. package/build-module/components/page-patterns/use-patterns.js +23 -56
  213. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  214. package/build-module/components/page-templates/index.js +58 -53
  215. package/build-module/components/page-templates/index.js.map +1 -1
  216. package/build-module/components/pagination/index.js +4 -4
  217. package/build-module/components/pagination/index.js.map +1 -1
  218. package/build-module/components/post-edit/index.js +98 -0
  219. package/build-module/components/post-edit/index.js.map +1 -0
  220. package/build-module/components/post-fields/index.js +306 -0
  221. package/build-module/components/post-fields/index.js.map +1 -0
  222. package/build-module/components/post-list/index.js +275 -0
  223. package/build-module/components/post-list/index.js.map +1 -0
  224. package/build-module/components/posts-app/index.js +11 -17
  225. package/build-module/components/posts-app/index.js.map +1 -1
  226. package/build-module/components/posts-app/router.js +77 -0
  227. package/build-module/components/posts-app/router.js.map +1 -0
  228. package/build-module/components/revisions/index.js +10 -7
  229. package/build-module/components/revisions/index.js.map +1 -1
  230. package/build-module/components/save-panel/index.js +1 -1
  231. package/build-module/components/save-panel/index.js.map +1 -1
  232. package/build-module/components/sidebar-dataviews/add-new-view.js +4 -1
  233. package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
  234. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
  235. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  236. package/build-module/components/sidebar-dataviews/default-views.js +117 -92
  237. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  238. package/build-module/components/sidebar-dataviews/index.js +47 -5
  239. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  240. package/build-module/components/sidebar-navigation-screen-global-styles/content.js +57 -0
  241. package/build-module/components/sidebar-navigation-screen-global-styles/content.js.map +1 -0
  242. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +2 -47
  243. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  244. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -2
  245. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  246. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
  247. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  248. package/build-module/components/site-hub/index.js +81 -1
  249. package/build-module/components/site-hub/index.js.map +1 -1
  250. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
  251. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  252. package/build-module/hooks/push-changes-to-global-styles/index.js +2 -2
  253. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  254. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +61 -38
  255. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  256. package/build-module/index.js +11 -2
  257. package/build-module/index.js.map +1 -1
  258. package/build-module/posts.js +57 -2
  259. package/build-module/posts.js.map +1 -1
  260. package/build-module/store/private-actions.js +7 -2
  261. package/build-module/store/private-actions.js.map +1 -1
  262. package/build-module/store/selectors.js +35 -7
  263. package/build-module/store/selectors.js.map +1 -1
  264. package/build-module/utils/get-filtered-template-parts.js +57 -0
  265. package/build-module/utils/get-filtered-template-parts.js.map +1 -0
  266. package/build-style/posts-rtl.css +668 -510
  267. package/build-style/posts.css +668 -510
  268. package/build-style/style-rtl.css +772 -702
  269. package/build-style/style.css +772 -702
  270. package/package.json +41 -41
  271. package/src/components/add-new-pattern/index.js +8 -2
  272. package/src/components/{add-new-page → add-new-post}/index.js +28 -22
  273. package/src/components/add-new-template/index.js +4 -1
  274. package/src/components/add-new-template/style.scss +4 -6
  275. package/src/components/block-editor/use-site-editor-settings.js +10 -101
  276. package/src/components/editor/index.js +21 -5
  277. package/src/components/global-styles/background-panel.js +0 -8
  278. package/src/components/global-styles/block-preview-panel.js +22 -9
  279. package/src/components/global-styles/font-families.js +66 -31
  280. package/src/components/global-styles/font-library-modal/font-collection.js +17 -32
  281. package/src/components/global-styles/font-library-modal/index.js +4 -2
  282. package/src/components/global-styles/font-library-modal/installed-fonts.js +94 -13
  283. package/src/components/global-styles/font-library-modal/style.scss +26 -10
  284. package/src/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js +43 -0
  285. package/src/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js +37 -0
  286. package/src/components/global-styles/font-sizes/font-size-preview.js +43 -0
  287. package/src/components/global-styles/font-sizes/font-size.js +250 -0
  288. package/src/components/global-styles/font-sizes/font-sizes-count.js +40 -0
  289. package/src/components/global-styles/font-sizes/font-sizes.js +263 -0
  290. package/src/components/global-styles/font-sizes/rename-font-size-dialog.js +70 -0
  291. package/src/components/global-styles/hooks.js +0 -41
  292. package/src/components/global-styles/preview-typography.js +39 -0
  293. package/src/components/global-styles/screen-block.js +20 -0
  294. package/src/components/global-styles/screen-layout.js +5 -1
  295. package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  296. package/src/components/global-styles/screen-style-variations.js +2 -2
  297. package/src/components/global-styles/screen-typography.js +3 -2
  298. package/src/components/global-styles/shadows-edit-panel.js +1 -2
  299. package/src/components/global-styles/size-control/index.js +86 -0
  300. package/src/components/global-styles/style-variations-container.js +14 -7
  301. package/src/components/global-styles/style.scss +13 -3
  302. package/src/components/global-styles/typography-elements.js +0 -4
  303. package/src/components/global-styles/ui.js +10 -0
  304. package/src/components/global-styles/variations/variation.js +5 -5
  305. package/src/components/global-styles/variations/variations-color.js +6 -4
  306. package/src/components/global-styles/variations/variations-typography.js +15 -33
  307. package/src/components/global-styles-sidebar/index.js +2 -2
  308. package/src/components/layout/index.js +24 -4
  309. package/src/components/layout/router.js +29 -37
  310. package/src/components/layout/style.scss +38 -8
  311. package/src/components/page-patterns/header.js +1 -1
  312. package/src/components/page-patterns/index.js +62 -64
  313. package/src/components/page-patterns/search-items.js +37 -3
  314. package/src/components/page-patterns/style.scss +1 -8
  315. package/src/components/page-patterns/use-patterns.js +43 -82
  316. package/src/components/page-templates/index.js +67 -64
  317. package/src/components/page-templates/style.scss +6 -9
  318. package/src/components/pagination/index.js +4 -4
  319. package/src/components/post-edit/index.js +96 -0
  320. package/src/components/post-edit/style.scss +9 -0
  321. package/src/components/post-fields/index.js +345 -0
  322. package/src/components/post-list/index.js +326 -0
  323. package/src/components/{page-pages → post-list}/style.scss +25 -8
  324. package/src/components/posts-app/index.js +9 -11
  325. package/src/components/posts-app/router.js +69 -0
  326. package/src/components/revisions/index.js +9 -1
  327. package/src/components/save-panel/index.js +1 -1
  328. package/src/components/sidebar/style.scss +6 -0
  329. package/src/components/sidebar-dataviews/add-new-view.js +2 -1
  330. package/src/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
  331. package/src/components/sidebar-dataviews/default-views.js +131 -106
  332. package/src/components/sidebar-dataviews/index.js +39 -4
  333. package/src/components/sidebar-navigation-screen-global-styles/content.js +55 -0
  334. package/src/components/sidebar-navigation-screen-global-styles/index.js +1 -54
  335. package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -1
  336. package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -2
  337. package/src/components/site-hub/index.js +84 -1
  338. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -2
  339. package/src/hooks/push-changes-to-global-styles/index.js +2 -2
  340. package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +28 -24
  341. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +72 -47
  342. package/src/index.js +14 -1
  343. package/src/posts.js +63 -2
  344. package/src/posts.scss +9 -0
  345. package/src/store/private-actions.js +7 -3
  346. package/src/store/selectors.js +53 -14
  347. package/src/store/test/selectors.js +1 -26
  348. package/src/style.scss +2 -2
  349. package/src/utils/get-filtered-template-parts.js +61 -0
  350. package/src/utils/test/get-filtered-template-parts.js +127 -0
  351. package/build/components/add-new-page/index.js.map +0 -1
  352. package/build/components/global-styles/screen-background.js +0 -36
  353. package/build/components/global-styles/screen-background.js.map +0 -1
  354. package/build/components/page-pages/index.js +0 -473
  355. package/build/components/page-pages/index.js.map +0 -1
  356. package/build/components/table/index.js +0 -35
  357. package/build/components/table/index.js.map +0 -1
  358. package/build-module/components/add-new-page/index.js.map +0 -1
  359. package/build-module/components/global-styles/screen-background.js +0 -30
  360. package/build-module/components/global-styles/screen-background.js.map +0 -1
  361. package/build-module/components/page-pages/index.js +0 -465
  362. package/build-module/components/page-pages/index.js.map +0 -1
  363. package/build-module/components/table/index.js +0 -30
  364. package/build-module/components/table/index.js.map +0 -1
  365. package/src/components/global-styles/screen-background.js +0 -29
  366. package/src/components/page-pages/index.js +0 -564
  367. package/src/components/table/index.js +0 -33
  368. package/src/components/table/style.scss +0 -38
@@ -14,47 +14,64 @@ import { __ } from '@wordpress/i18n';
14
14
  import cloneDeep from '../../utils/clone-deep';
15
15
  import { unlock } from '../../lock-unlock';
16
16
  const {
17
- GlobalStylesContext
17
+ GlobalStylesContext,
18
+ areGlobalStyleConfigsEqual
18
19
  } = unlock(blockEditorPrivateApis);
19
20
  const {
20
21
  mergeBaseAndUserConfigs
21
22
  } = unlock(editorPrivateApis);
22
23
 
23
24
  /**
24
- * Removes all instances of a property from an object.
25
+ * Removes all instances of properties from an object.
25
26
  *
26
- * @param {Object} object The object to remove the property from.
27
- * @param {string} property The property to remove.
27
+ * @param {Object} object The object to remove the properties from.
28
+ * @param {string[]} properties The properties to remove.
28
29
  * @return {Object} The modified object.
29
30
  */
30
- export function removePropertyFromObject(object, property) {
31
- if (!property || typeof property !== 'string') {
31
+ export function removePropertiesFromObject(object, properties) {
32
+ if (!properties?.length) {
32
33
  return object;
33
34
  }
34
35
  if (typeof object !== 'object' || !object || !Object.keys(object).length) {
35
36
  return object;
36
37
  }
37
38
  for (const key in object) {
38
- if (key === property) {
39
+ if (properties.includes(key)) {
39
40
  delete object[key];
40
41
  } else if (typeof object[key] === 'object') {
41
- removePropertyFromObject(object[key], property);
42
+ removePropertiesFromObject(object[key], properties);
42
43
  }
43
44
  }
44
45
  return object;
45
46
  }
46
47
 
47
48
  /**
48
- * Fetches the current theme style variations that contain only the specified property
49
+ * Checks whether a style variation is empty.
50
+ *
51
+ * @param {Object} variation A style variation object.
52
+ * @param {string} variation.title The title of the variation.
53
+ * @param {Object} variation.settings The settings of the variation.
54
+ * @param {Object} variation.styles The styles of the variation.
55
+ * @return {boolean} Whether the variation is empty.
56
+ */
57
+ function hasThemeVariation({
58
+ title,
59
+ settings,
60
+ styles
61
+ }) {
62
+ return title === __('Default') ||
63
+ // Always preserve the default variation.
64
+ Object.keys(settings).length > 0 || Object.keys(styles).length > 0;
65
+ }
66
+
67
+ /**
68
+ * Fetches the current theme style variations that contain only the specified properties
49
69
  * and merges them with the user config.
50
70
  *
51
- * @param {Object} props Object of hook args.
52
- * @param {string} props.property The property to filter by.
71
+ * @param {string[]} properties The properties to filter by.
53
72
  * @return {Object[]|*} The merged object.
54
73
  */
55
- export function useCurrentMergeThemeStyleVariationsWithUserConfig({
56
- property
57
- }) {
74
+ export function useCurrentMergeThemeStyleVariationsWithUserConfig(properties = []) {
58
75
  const {
59
76
  variationsFromTheme
60
77
  } = useSelect(select => {
@@ -66,41 +83,47 @@ export function useCurrentMergeThemeStyleVariationsWithUserConfig({
66
83
  const {
67
84
  user: userVariation
68
85
  } = useContext(GlobalStylesContext);
86
+ const propertiesAsString = properties.toString();
69
87
  return useMemo(() => {
70
88
  const clonedUserVariation = cloneDeep(userVariation);
71
89
 
72
90
  // Get user variation and remove the settings for the given property.
73
- const userVariationWithoutProperty = removePropertyFromObject(clonedUserVariation, property);
74
- userVariationWithoutProperty.title = __('Default');
75
- const variationsWithSinglePropertyAndBase = variationsFromTheme.filter(variation => {
76
- return isVariationWithSingleProperty(variation, property);
91
+ const userVariationWithoutProperties = removePropertiesFromObject(clonedUserVariation, properties);
92
+ userVariationWithoutProperties.title = __('Default');
93
+ const variationsWithPropertiesAndBase = variationsFromTheme.filter(variation => {
94
+ return isVariationWithProperties(variation, properties);
77
95
  }).map(variation => {
78
- return mergeBaseAndUserConfigs(userVariationWithoutProperty, variation);
96
+ return mergeBaseAndUserConfigs(userVariationWithoutProperties, variation);
79
97
  });
80
- return [userVariationWithoutProperty, ...variationsWithSinglePropertyAndBase];
81
- }, [property, userVariation, variationsFromTheme]);
98
+ const variationsByProperties = [userVariationWithoutProperties, ...variationsWithPropertiesAndBase];
99
+
100
+ /*
101
+ * Filter out variations with no settings or styles.
102
+ */
103
+ return variationsByProperties?.length ? variationsByProperties.filter(hasThemeVariation) : [];
104
+ }, [propertiesAsString, userVariation, variationsFromTheme]);
82
105
  }
83
106
 
84
107
  /**
85
- * Returns a new object, with properties specified in `property`,
108
+ * Returns a new object, with properties specified in `properties` array.,
86
109
  * maintain the original object tree structure.
87
- * The function is recursive, so it will perform a deep search for the given property.
88
- * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the property is `test`.
110
+ * The function is recursive, so it will perform a deep search for the given properties.
111
+ * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the properties are `[ 'test' ]`.
89
112
  *
90
- * @param {Object} object The object to filter
91
- * @param {Object} property The property to filter by
113
+ * @param {Object} object The object to filter
114
+ * @param {string[]} properties The properties to filter by
92
115
  * @return {Object} The merged object.
93
116
  */
94
- export const filterObjectByProperty = (object, property) => {
95
- if (!object) {
117
+ export const filterObjectByProperties = (object, properties) => {
118
+ if (!object || !properties?.length) {
96
119
  return {};
97
120
  }
98
121
  const newObject = {};
99
122
  Object.keys(object).forEach(key => {
100
- if (key === property) {
123
+ if (properties.includes(key)) {
101
124
  newObject[key] = object[key];
102
125
  } else if (typeof object[key] === 'object') {
103
- const newFilter = filterObjectByProperty(object[key], property);
126
+ const newFilter = filterObjectByProperties(object[key], properties);
104
127
  if (Object.keys(newFilter).length) {
105
128
  newObject[key] = newFilter;
106
129
  }
@@ -110,15 +133,15 @@ export const filterObjectByProperty = (object, property) => {
110
133
  };
111
134
 
112
135
  /**
113
- * Compares a style variation to the same variation filtered by a single property.
114
- * Returns true if the variation contains only the property specified.
136
+ * Compares a style variation to the same variation filtered by the specified properties.
137
+ * Returns true if the variation contains only the properties specified.
115
138
  *
116
- * @param {Object} variation The variation to compare.
117
- * @param {string} property The property to compare.
118
- * @return {boolean} Whether the variation contains only a single property.
139
+ * @param {Object} variation The variation to compare.
140
+ * @param {string[]} properties The properties to compare.
141
+ * @return {boolean} Whether the variation contains only the specified properties.
119
142
  */
120
- export function isVariationWithSingleProperty(variation, property) {
121
- const variationWithProperty = filterObjectByProperty(cloneDeep(variation), property);
122
- return JSON.stringify(variationWithProperty?.styles) === JSON.stringify(variation?.styles) && JSON.stringify(variationWithProperty?.settings) === JSON.stringify(variation?.settings);
143
+ export function isVariationWithProperties(variation, properties) {
144
+ const variationWithProperties = filterObjectByProperties(cloneDeep(variation), properties);
145
+ return areGlobalStyleConfigsEqual(variationWithProperties, variation);
123
146
  }
124
147
  //# sourceMappingURL=use-theme-style-variations-by-property.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","store","coreStore","useContext","useMemo","privateApis","blockEditorPrivateApis","editorPrivateApis","__","cloneDeep","unlock","GlobalStylesContext","mergeBaseAndUserConfigs","removePropertyFromObject","object","property","Object","keys","length","key","useCurrentMergeThemeStyleVariationsWithUserConfig","variationsFromTheme","select","_variationsFromTheme","__experimentalGetCurrentThemeGlobalStylesVariations","user","userVariation","clonedUserVariation","userVariationWithoutProperty","title","variationsWithSinglePropertyAndBase","filter","variation","isVariationWithSingleProperty","map","filterObjectByProperty","newObject","forEach","newFilter","variationWithProperty","JSON","stringify","styles","settings"],"sources":["@wordpress/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport cloneDeep from '../../utils/clone-deep';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\n\n/**\n * Removes all instances of a property from an object.\n *\n * @param {Object} object The object to remove the property from.\n * @param {string} property The property to remove.\n * @return {Object} The modified object.\n */\nexport function removePropertyFromObject( object, property ) {\n\tif ( ! property || typeof property !== 'string' ) {\n\t\treturn object;\n\t}\n\n\tif (\n\t\ttypeof object !== 'object' ||\n\t\t! object ||\n\t\t! Object.keys( object ).length\n\t) {\n\t\treturn object;\n\t}\n\n\tfor ( const key in object ) {\n\t\tif ( key === property ) {\n\t\t\tdelete object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tremovePropertyFromObject( object[ key ], property );\n\t\t}\n\t}\n\treturn object;\n}\n\n/**\n * Fetches the current theme style variations that contain only the specified property\n * and merges them with the user config.\n *\n * @param {Object} props Object of hook args.\n * @param {string} props.property The property to filter by.\n * @return {Object[]|*} The merged object.\n */\nexport function useCurrentMergeThemeStyleVariationsWithUserConfig( {\n\tproperty,\n} ) {\n\tconst { variationsFromTheme } = useSelect( ( select ) => {\n\t\tconst _variationsFromTheme =\n\t\t\tselect(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations();\n\n\t\treturn {\n\t\t\tvariationsFromTheme: _variationsFromTheme || [],\n\t\t};\n\t}, [] );\n\tconst { user: userVariation } = useContext( GlobalStylesContext );\n\n\treturn useMemo( () => {\n\t\tconst clonedUserVariation = cloneDeep( userVariation );\n\n\t\t// Get user variation and remove the settings for the given property.\n\t\tconst userVariationWithoutProperty = removePropertyFromObject(\n\t\t\tclonedUserVariation,\n\t\t\tproperty\n\t\t);\n\t\tuserVariationWithoutProperty.title = __( 'Default' );\n\n\t\tconst variationsWithSinglePropertyAndBase = variationsFromTheme\n\t\t\t.filter( ( variation ) => {\n\t\t\t\treturn isVariationWithSingleProperty( variation, property );\n\t\t\t} )\n\t\t\t.map( ( variation ) => {\n\t\t\t\treturn mergeBaseAndUserConfigs(\n\t\t\t\t\tuserVariationWithoutProperty,\n\t\t\t\t\tvariation\n\t\t\t\t);\n\t\t\t} );\n\n\t\treturn [\n\t\t\tuserVariationWithoutProperty,\n\t\t\t...variationsWithSinglePropertyAndBase,\n\t\t];\n\t}, [ property, userVariation, variationsFromTheme ] );\n}\n\n/**\n * Returns a new object, with properties specified in `property`,\n * maintain the original object tree structure.\n * The function is recursive, so it will perform a deep search for the given property.\n * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the property is `test`.\n *\n * @param {Object} object The object to filter\n * @param {Object} property The property to filter by\n * @return {Object} The merged object.\n */\nexport const filterObjectByProperty = ( object, property ) => {\n\tif ( ! object ) {\n\t\treturn {};\n\t}\n\n\tconst newObject = {};\n\tObject.keys( object ).forEach( ( key ) => {\n\t\tif ( key === property ) {\n\t\t\tnewObject[ key ] = object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tconst newFilter = filterObjectByProperty( object[ key ], property );\n\t\t\tif ( Object.keys( newFilter ).length ) {\n\t\t\t\tnewObject[ key ] = newFilter;\n\t\t\t}\n\t\t}\n\t} );\n\treturn newObject;\n};\n\n/**\n * Compares a style variation to the same variation filtered by a single property.\n * Returns true if the variation contains only the property specified.\n *\n * @param {Object} variation The variation to compare.\n * @param {string} property The property to compare.\n * @return {boolean} Whether the variation contains only a single property.\n */\nexport function isVariationWithSingleProperty( variation, property ) {\n\tconst variationWithProperty = filterObjectByProperty(\n\t\tcloneDeep( variation ),\n\t\tproperty\n\t);\n\n\treturn (\n\t\tJSON.stringify( variationWithProperty?.styles ) ===\n\t\t\tJSON.stringify( variation?.styles ) &&\n\t\tJSON.stringify( variationWithProperty?.settings ) ===\n\t\t\tJSON.stringify( variation?.settings )\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;AACxD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASD,WAAW,IAAIE,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,SAAS,MAAM,wBAAwB;AAC9C,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAoB,CAAC,GAAGD,MAAM,CAAEJ,sBAAuB,CAAC;AAChE,MAAM;EAAEM;AAAwB,CAAC,GAAGF,MAAM,CAAEH,iBAAkB,CAAC;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,wBAAwBA,CAAEC,MAAM,EAAEC,QAAQ,EAAG;EAC5D,IAAK,CAAEA,QAAQ,IAAI,OAAOA,QAAQ,KAAK,QAAQ,EAAG;IACjD,OAAOD,MAAM;EACd;EAEA,IACC,OAAOA,MAAM,KAAK,QAAQ,IAC1B,CAAEA,MAAM,IACR,CAAEE,MAAM,CAACC,IAAI,CAAEH,MAAO,CAAC,CAACI,MAAM,EAC7B;IACD,OAAOJ,MAAM;EACd;EAEA,KAAM,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AI,CAACC,SAAS,CAAET,SAAS,EAAEW,QAAS,CAAC;AAExC","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","store","coreStore","useContext","useMemo","privateApis","blockEditorPrivateApis","editorPrivateApis","__","cloneDeep","unlock","GlobalStylesContext","areGlobalStyleConfigsEqual","mergeBaseAndUserConfigs","removePropertiesFromObject","object","properties","length","Object","keys","key","includes","hasThemeVariation","title","settings","styles","useCurrentMergeThemeStyleVariationsWithUserConfig","variationsFromTheme","select","_variationsFromTheme","__experimentalGetCurrentThemeGlobalStylesVariations","user","userVariation","propertiesAsString","toString","clonedUserVariation","userVariationWithoutProperties","variationsWithPropertiesAndBase","filter","variation","isVariationWithProperties","map","variationsByProperties","filterObjectByProperties","newObject","forEach","newFilter","variationWithProperties"],"sources":["@wordpress/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport cloneDeep from '../../utils/clone-deep';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(\n\tblockEditorPrivateApis\n);\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\n\n/**\n * Removes all instances of properties from an object.\n *\n * @param {Object} object The object to remove the properties from.\n * @param {string[]} properties The properties to remove.\n * @return {Object} The modified object.\n */\nexport function removePropertiesFromObject( object, properties ) {\n\tif ( ! properties?.length ) {\n\t\treturn object;\n\t}\n\n\tif (\n\t\ttypeof object !== 'object' ||\n\t\t! object ||\n\t\t! Object.keys( object ).length\n\t) {\n\t\treturn object;\n\t}\n\n\tfor ( const key in object ) {\n\t\tif ( properties.includes( key ) ) {\n\t\t\tdelete object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tremovePropertiesFromObject( object[ key ], properties );\n\t\t}\n\t}\n\treturn object;\n}\n\n/**\n * Checks whether a style variation is empty.\n *\n * @param {Object} variation A style variation object.\n * @param {string} variation.title The title of the variation.\n * @param {Object} variation.settings The settings of the variation.\n * @param {Object} variation.styles The styles of the variation.\n * @return {boolean} Whether the variation is empty.\n */\nfunction hasThemeVariation( { title, settings, styles } ) {\n\treturn (\n\t\ttitle === __( 'Default' ) || // Always preserve the default variation.\n\t\tObject.keys( settings ).length > 0 ||\n\t\tObject.keys( styles ).length > 0\n\t);\n}\n\n/**\n * Fetches the current theme style variations that contain only the specified properties\n * and merges them with the user config.\n *\n * @param {string[]} properties The properties to filter by.\n * @return {Object[]|*} The merged object.\n */\nexport function useCurrentMergeThemeStyleVariationsWithUserConfig(\n\tproperties = []\n) {\n\tconst { variationsFromTheme } = useSelect( ( select ) => {\n\t\tconst _variationsFromTheme =\n\t\t\tselect(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations();\n\n\t\treturn {\n\t\t\tvariationsFromTheme: _variationsFromTheme || [],\n\t\t};\n\t}, [] );\n\tconst { user: userVariation } = useContext( GlobalStylesContext );\n\n\tconst propertiesAsString = properties.toString();\n\n\treturn useMemo( () => {\n\t\tconst clonedUserVariation = cloneDeep( userVariation );\n\n\t\t// Get user variation and remove the settings for the given property.\n\t\tconst userVariationWithoutProperties = removePropertiesFromObject(\n\t\t\tclonedUserVariation,\n\t\t\tproperties\n\t\t);\n\t\tuserVariationWithoutProperties.title = __( 'Default' );\n\n\t\tconst variationsWithPropertiesAndBase = variationsFromTheme\n\t\t\t.filter( ( variation ) => {\n\t\t\t\treturn isVariationWithProperties( variation, properties );\n\t\t\t} )\n\t\t\t.map( ( variation ) => {\n\t\t\t\treturn mergeBaseAndUserConfigs(\n\t\t\t\t\tuserVariationWithoutProperties,\n\t\t\t\t\tvariation\n\t\t\t\t);\n\t\t\t} );\n\n\t\tconst variationsByProperties = [\n\t\t\tuserVariationWithoutProperties,\n\t\t\t...variationsWithPropertiesAndBase,\n\t\t];\n\n\t\t/*\n\t\t * Filter out variations with no settings or styles.\n\t\t */\n\t\treturn variationsByProperties?.length\n\t\t\t? variationsByProperties.filter( hasThemeVariation )\n\t\t\t: [];\n\t}, [ propertiesAsString, userVariation, variationsFromTheme ] );\n}\n\n/**\n * Returns a new object, with properties specified in `properties` array.,\n * maintain the original object tree structure.\n * The function is recursive, so it will perform a deep search for the given properties.\n * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the properties are `[ 'test' ]`.\n *\n * @param {Object} object The object to filter\n * @param {string[]} properties The properties to filter by\n * @return {Object} The merged object.\n */\nexport const filterObjectByProperties = ( object, properties ) => {\n\tif ( ! object || ! properties?.length ) {\n\t\treturn {};\n\t}\n\n\tconst newObject = {};\n\tObject.keys( object ).forEach( ( key ) => {\n\t\tif ( properties.includes( key ) ) {\n\t\t\tnewObject[ key ] = object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tconst newFilter = filterObjectByProperties(\n\t\t\t\tobject[ key ],\n\t\t\t\tproperties\n\t\t\t);\n\t\t\tif ( Object.keys( newFilter ).length ) {\n\t\t\t\tnewObject[ key ] = newFilter;\n\t\t\t}\n\t\t}\n\t} );\n\treturn newObject;\n};\n\n/**\n * Compares a style variation to the same variation filtered by the specified properties.\n * Returns true if the variation contains only the properties specified.\n *\n * @param {Object} variation The variation to compare.\n * @param {string[]} properties The properties to compare.\n * @return {boolean} Whether the variation contains only the specified properties.\n */\nexport function isVariationWithProperties( variation, properties ) {\n\tconst variationWithProperties = filterObjectByProperties(\n\t\tcloneDeep( variation ),\n\t\tproperties\n\t);\n\n\treturn areGlobalStyleConfigsEqual( variationWithProperties, variation );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,I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":[]}
@@ -6,7 +6,7 @@ import { registerCoreBlocks, __experimentalGetCoreBlocks, __experimentalRegister
6
6
  import { dispatch } from '@wordpress/data';
7
7
  import deprecated from '@wordpress/deprecated';
8
8
  import { createRoot, StrictMode } from '@wordpress/element';
9
- import { store as editorStore } from '@wordpress/editor';
9
+ import { store as editorStore, privateApis as editorPrivateApis } from '@wordpress/editor';
10
10
  import { store as preferencesStore } from '@wordpress/preferences';
11
11
  import { registerLegacyWidgetBlock, registerWidgetGroupBlock } from '@wordpress/widgets';
12
12
 
@@ -15,7 +15,14 @@ import { registerLegacyWidgetBlock, registerWidgetGroupBlock } from '@wordpress/
15
15
  */
16
16
  import './hooks';
17
17
  import { store as editSiteStore } from './store';
18
+ import { unlock } from './lock-unlock';
18
19
  import App from './components/app';
20
+ import { jsx as _jsx } from "react/jsx-runtime";
21
+ const {
22
+ registerDefaultActions,
23
+ registerCoreBlockBindingsSources,
24
+ bootstrapBlockBindingsSourcesFromServer
25
+ } = unlock(editorPrivateApis);
19
26
 
20
27
  /**
21
28
  * Initializes the site editor screen.
@@ -23,7 +30,6 @@ import App from './components/app';
23
30
  * @param {string} id ID of the root element to render the screen in.
24
31
  * @param {Object} settings Editor settings.
25
32
  */
26
- import { jsx as _jsx } from "react/jsx-runtime";
27
33
  export function initializeEditor(id, settings) {
28
34
  const target = document.getElementById(id);
29
35
  const root = createRoot(target);
@@ -32,6 +38,8 @@ export function initializeEditor(id, settings) {
32
38
  name
33
39
  }) => name !== 'core/freeform');
34
40
  registerCoreBlocks(coreBlocks);
41
+ bootstrapBlockBindingsSourcesFromServer(settings?.blockBindingsSources);
42
+ registerCoreBlockBindingsSources();
35
43
  dispatch(blocksStore).setFreeformFallbackBlockName('core/html');
36
44
  registerLegacyWidgetBlock({
37
45
  inserter: false
@@ -44,6 +52,7 @@ export function initializeEditor(id, settings) {
44
52
  enableFSEBlocks: true
45
53
  });
46
54
  }
55
+ registerDefaultActions();
47
56
 
48
57
  // We dispatch actions and update the store synchronously before rendering
49
58
  // so that we won't trigger unnecessary re-renders with useEffect.
@@ -1 +1 @@
1
- {"version":3,"names":["store","blocksStore","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","deprecated","createRoot","StrictMode","editorStore","preferencesStore","registerLegacyWidgetBlock","registerWidgetGroupBlock","editSiteStore","App","jsx","_jsx","initializeEditor","id","settings","target","document","getElementById","root","reapplyBlockTypeFilters","coreBlocks","filter","name","setFreeformFallbackBlockName","inserter","globalThis","IS_GUTENBERG_PLUGIN","enableFSEBlocks","setDefaults","welcomeGuide","welcomeGuideStyles","welcomeGuidePage","welcomeGuideTemplate","allowRightClickOverrides","distractionFree","editorMode","fixedToolbar","focusMode","inactivePanels","keepCaretInsideBlock","openPanels","showBlockBreadcrumbs","showListViewByDefault","updateSettings","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","children","reinitializeEditor","since","version","default","PluginTemplateSettingPanel","initializePostsDashboard"],"sources":["@wordpress/edit-site/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport App from './components/app';\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<App />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\nexport { store } from './store';\nexport * from './deprecated';\n\n// Temporary: While the posts dashboard is being iterated on\n// it's being built in the same package as the site editor.\nexport { initializePostsDashboard } from './posts';\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SACCC,kBAAkB,EAClBC,2BAA2B,EAC3BC,4CAA4C,QACtC,0BAA0B;AACjC,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;AAC3D,SAASR,KAAK,IAAIS,WAAW,QAAQ,mBAAmB;AACxD,SAAST,KAAK,IAAIU,gBAAgB,QAAQ,wBAAwB;AAClE,SACCC,yBAAyB,EACzBC,wBAAwB,QAClB,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAO,SAAS;AAChB,SAASZ,KAAK,IAAIa,aAAa,QAAQ,SAAS;AAChD,OAAOC,GAAG,MAAM,kBAAkB;;AAElC;AACA;AACA;AACA;AACA;AACA;AALA,SAAAC,GAAA,IAAAC,IAAA;AAMA,OAAO,SAASC,gBAAgBA,CAAEC,EAAE,EAAEC,QAAQ,EAAG;EAChD,MAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAc,CAAEJ,EAAG,CAAC;EAC5C,MAAMK,IAAI,GAAGhB,UAAU,CAAEa,MAAO,CAAC;EAEjCf,QAAQ,CAAEJ,WAAY,CAAC,CAACuB,uBAAuB,CAAC,CAAC;EACjD,MAAMC,UAAU,GAAGtB,2BAA2B,CAAC,CAAC,CAACuB,MAAM,CACtD,CAAE;IAAEC;EAAK,CAAC,KAAMA,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AIC,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EACzEH,MAAM,CAACC,gBAAgB,CAAE,MAAM,EAAIC,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EAErEhC,IAAI,CAACiC,MAAM,eACVxC,IAAA,CAACR,UAAU;IAAAiD,QAAA,eACVzC,IAAA,CAACF,GAAG,IAAE;EAAC,CACI,CACb,CAAC;EAED,OAAOS,IAAI;AACZ;AAEA,OAAO,SAASmC,kBAAkBA,CAAA,EAAG;EACpCpD,UAAU,CAAE,gCAAgC,EAAE;IAC7CqD,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;AAEA,SAASC,OAAO,IAAIC,0BAA0B,QAAQ,4CAA4C;AAClG,SAAS9D,KAAK,QAAQ,SAAS;AAC/B,cAAc,cAAc;;AAE5B;AACA;AACA,SAAS+D,wBAAwB,QAAQ,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["store","blocksStore","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","deprecated","createRoot","StrictMode","editorStore","privateApis","editorPrivateApis","preferencesStore","registerLegacyWidgetBlock","registerWidgetGroupBlock","editSiteStore","unlock","App","jsx","_jsx","registerDefaultActions","registerCoreBlockBindingsSources","bootstrapBlockBindingsSourcesFromServer","initializeEditor","id","settings","target","document","getElementById","root","reapplyBlockTypeFilters","coreBlocks","filter","name","blockBindingsSources","setFreeformFallbackBlockName","inserter","globalThis","IS_GUTENBERG_PLUGIN","enableFSEBlocks","setDefaults","welcomeGuide","welcomeGuideStyles","welcomeGuidePage","welcomeGuideTemplate","allowRightClickOverrides","distractionFree","editorMode","fixedToolbar","focusMode","inactivePanels","keepCaretInsideBlock","openPanels","showBlockBreadcrumbs","showListViewByDefault","updateSettings","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","children","reinitializeEditor","since","version","default","PluginTemplateSettingPanel","initializePostsDashboard"],"sources":["@wordpress/edit-site/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport { unlock } from './lock-unlock';\nimport App from './components/app';\n\nconst {\n\tregisterDefaultActions,\n\tregisterCoreBlockBindingsSources,\n\tbootstrapBlockBindingsSourcesFromServer,\n} = unlock( editorPrivateApis );\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tbootstrapBlockBindingsSourcesFromServer( settings?.blockBindingsSources );\n\tregisterCoreBlockBindingsSources();\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\tregisterDefaultActions();\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<App />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\nexport { store } from './store';\nexport * from './deprecated';\n\n// Temporary: While the posts dashboard is being iterated on\n// it's being built in the same package as the site editor.\nexport { initializePostsDashboard } from './posts';\n"],"mappings":"AAAA;AACA;AACA;AACA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EH,MAAM,CAACC,gBAAgB,CAAE,MAAM,EAAIC,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EAErEjC,IAAI,CAACkC,MAAM,eACV5C,IAAA,CAACX,UAAU;IAAAwD,QAAA,eACV7C,IAAA,CAACF,GAAG,IAAE;EAAC,CACI,CACb,CAAC;EAED,OAAOY,IAAI;AACZ;AAEA,OAAO,SAASoC,kBAAkBA,CAAA,EAAG;EACpC3D,UAAU,CAAE,gCAAgC,EAAE;IAC7C4D,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;AAEA,SAASC,OAAO,IAAIC,0BAA0B,QAAQ,4CAA4C;AAClG,SAASrE,KAAK,QAAQ,SAAS;AAC/B,cAAc,cAAc;;AAE5B;AACA;AACA,SAASsE,wBAAwB,QAAQ,SAAS","ignoreList":[]}
@@ -1,7 +1,18 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
+ import { store as blocksStore } from '@wordpress/blocks';
5
+ import { registerCoreBlocks, __experimentalGetCoreBlocks, __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';
6
+ import { dispatch } from '@wordpress/data';
4
7
  import { createRoot, StrictMode } from '@wordpress/element';
8
+ import { store as preferencesStore } from '@wordpress/preferences';
9
+ import { registerLegacyWidgetBlock, registerWidgetGroupBlock } from '@wordpress/widgets';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import './hooks';
15
+ import { store as editSiteStore } from './store';
5
16
 
6
17
  /**
7
18
  * Internal dependencies
@@ -10,15 +21,59 @@ import PostsApp from './components/posts-app';
10
21
 
11
22
  /**
12
23
  * Initializes the "Posts Dashboard"
13
- * @param {string} id DOM element id.
24
+ * @param {string} id ID of the root element to render the screen in.
25
+ * @param {Object} settings Editor settings.
14
26
  */
15
27
  import { jsx as _jsx } from "react/jsx-runtime";
16
- export function initializePostsDashboard(id) {
28
+ export function initializePostsDashboard(id, settings) {
17
29
  if (!globalThis.IS_GUTENBERG_PLUGIN) {
18
30
  return;
19
31
  }
20
32
  const target = document.getElementById(id);
21
33
  const root = createRoot(target);
34
+ dispatch(blocksStore).reapplyBlockTypeFilters();
35
+ const coreBlocks = __experimentalGetCoreBlocks().filter(({
36
+ name
37
+ }) => name !== 'core/freeform');
38
+ registerCoreBlocks(coreBlocks);
39
+ dispatch(blocksStore).setFreeformFallbackBlockName('core/html');
40
+ registerLegacyWidgetBlock({
41
+ inserter: false
42
+ });
43
+ registerWidgetGroupBlock({
44
+ inserter: false
45
+ });
46
+ if (globalThis.IS_GUTENBERG_PLUGIN) {
47
+ __experimentalRegisterExperimentalCoreBlocks({
48
+ enableFSEBlocks: true
49
+ });
50
+ }
51
+
52
+ // We dispatch actions and update the store synchronously before rendering
53
+ // so that we won't trigger unnecessary re-renders with useEffect.
54
+ dispatch(preferencesStore).setDefaults('core/edit-site', {
55
+ welcomeGuide: true,
56
+ welcomeGuideStyles: true,
57
+ welcomeGuidePage: true,
58
+ welcomeGuideTemplate: true
59
+ });
60
+ dispatch(preferencesStore).setDefaults('core', {
61
+ allowRightClickOverrides: true,
62
+ distractionFree: false,
63
+ editorMode: 'visual',
64
+ fixedToolbar: false,
65
+ focusMode: false,
66
+ inactivePanels: [],
67
+ keepCaretInsideBlock: false,
68
+ openPanels: ['post-status'],
69
+ showBlockBreadcrumbs: true,
70
+ showListViewByDefault: false
71
+ });
72
+ dispatch(editSiteStore).updateSettings(settings);
73
+
74
+ // Prevent the default browser action for files dropped outside of dropzones.
75
+ window.addEventListener('dragover', e => e.preventDefault(), false);
76
+ window.addEventListener('drop', e => e.preventDefault(), false);
22
77
  root.render( /*#__PURE__*/_jsx(StrictMode, {
23
78
  children: /*#__PURE__*/_jsx(PostsApp, {})
24
79
  }));
@@ -1 +1 @@
1
- {"version":3,"names":["createRoot","StrictMode","PostsApp","jsx","_jsx","initializePostsDashboard","id","globalThis","IS_GUTENBERG_PLUGIN","target","document","getElementById","root","render","children"],"sources":["@wordpress/edit-site/src/posts.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRoot, StrictMode } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PostsApp from './components/posts-app';\n\n/**\n * Initializes the \"Posts Dashboard\"\n * @param {string} id DOM element id.\n */\nexport function initializePostsDashboard( id ) {\n\tif ( ! globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\treturn;\n\t}\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<PostsApp />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,wBAAwB;;AAE7C;AACA;AACA;AACA;AAHA,SAAAC,GAAA,IAAAC,IAAA;AAIA,OAAO,SAASC,wBAAwBA,CAAEC,EAAE,EAAG;EAC9C,IAAK,CAAEC,UAAU,CAACC,mBAAmB,EAAG;IACvC;EACD;EACA,MAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAc,CAAEL,EAAG,CAAC;EAC5C,MAAMM,IAAI,GAAGZ,UAAU,CAAES,MAAO,CAAC;EAEjCG,IAAI,CAACC,MAAM,eACVT,IAAA,CAACH,UAAU;IAAAa,QAAA,eACVV,IAAA,CAACF,QAAQ,IAAE;EAAC,CACD,CACb,CAAC;EAED,OAAOU,IAAI;AACZ","ignoreList":[]}
1
+ {"version":3,"names":["store","blocksStore","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","createRoot","StrictMode","preferencesStore","registerLegacyWidgetBlock","registerWidgetGroupBlock","editSiteStore","PostsApp","jsx","_jsx","initializePostsDashboard","id","settings","globalThis","IS_GUTENBERG_PLUGIN","target","document","getElementById","root","reapplyBlockTypeFilters","coreBlocks","filter","name","setFreeformFallbackBlockName","inserter","enableFSEBlocks","setDefaults","welcomeGuide","welcomeGuideStyles","welcomeGuidePage","welcomeGuideTemplate","allowRightClickOverrides","distractionFree","editorMode","fixedToolbar","focusMode","inactivePanels","keepCaretInsideBlock","openPanels","showBlockBreadcrumbs","showListViewByDefault","updateSettings","window","addEventListener","e","preventDefault","render","children"],"sources":["@wordpress/edit-site/src/posts.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\n\n/**\n * Internal dependencies\n */\nimport PostsApp from './components/posts-app';\n\n/**\n * Initializes the \"Posts Dashboard\"\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializePostsDashboard( id, settings ) {\n\tif ( ! globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\treturn;\n\t}\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<PostsApp />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SACCC,kBAAkB,EAClBC,2BAA2B,EAC3BC,4CAA4C,QACtC,0BAA0B;AACjC,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;AAC3D,SAASP,KAAK,IAAIQ,gBAAgB,QAAQ,wBAAwB;AAClE,SACCC,yBAAyB,EACzBC,wBAAwB,QAClB,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAO,SAAS;AAChB,SAASV,KAAK,IAAIW,aAAa,QAAQ,SAAS;;AAEhD;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,wBAAwB;;AAE7C;AACA;AACA;AACA;AACA;AAJA,SAAAC,GAAA,IAAAC,IAAA;AAKA,OAAO,SAASC,wBAAwBA,CAAEC,EAAE,EAAEC,QAAQ,EAAG;E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C,qBAAqB,EAAE;EACxB,CAAE,CAAC;EAEHxC,QAAQ,CAAEM,aAAc,CAAC,CAACmC,cAAc,CAAE7B,QAAS,CAAC;;EAEpD;EACA8B,MAAM,CAACC,gBAAgB,CAAE,UAAU,EAAIC,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EACzEH,MAAM,CAACC,gBAAgB,CAAE,MAAM,EAAIC,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EAErE3B,IAAI,CAAC4B,MAAM,eACVrC,IAAA,CAACP,UAAU;IAAA6C,QAAA,eACVtC,IAAA,CAACF,QAAQ,IAAE;EAAC,CACD,CACb,CAAC;EAED,OAAOW,IAAI;AACZ","ignoreList":[]}
@@ -14,9 +14,9 @@ export const setCanvasMode = mode => ({
14
14
  registry,
15
15
  dispatch
16
16
  }) => {
17
+ const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
17
18
  const switchCanvasMode = () => {
18
19
  registry.batch(() => {
19
- const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
20
20
  registry.dispatch(blockEditorStore).clearSelectedBlock();
21
21
  registry.dispatch(editorStore).setDeviceType('Desktop');
22
22
  registry.dispatch(blockEditorStore).__unstableSetEditorMode('edit');
@@ -41,7 +41,12 @@ export const setCanvasMode = mode => ({
41
41
  registry.dispatch(editorStore).setIsInserterOpened(false);
42
42
  });
43
43
  };
44
- if (!document.startViewTransition) {
44
+
45
+ /*
46
+ * Skip transition in mobile, otherwise it crashes the browser.
47
+ * See: https://github.com/WordPress/gutenberg/pull/63002.
48
+ */
49
+ if (!isMediumOrBigger || !document.startViewTransition) {
45
50
  switchCanvasMode();
46
51
  } else {
47
52
  document.documentElement.classList.add(`canvas-mode-${mode}-transition`);
@@ -1 +1 @@
1
- {"version":3,"names":["store","blockEditorStore","preferencesStore","editorStore","setCanvasMode","mode","registry","dispatch","switchCanvasMode","batch","isMediumOrBigger","window","matchMedia","matches","clearSelectedBlock","setDeviceType","__unstableSetEditorMode","isPublishSidebarOpened","select","type","isEditMode","closePublishSidebar","get","setIsListViewOpened","setIsInserterOpened","document","startViewTransition","documentElement","classList","add","transition","finished","finally","remove","setEditorCanvasContainerView","view"],"sources":["@wordpress/edit-site/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tconst switchCanvasMode = () => {\n\t\t\tregistry.batch( () => {\n\t\t\t\tconst isMediumOrBigger =\n\t\t\t\t\twindow.matchMedia( '(min-width: 782px)' ).matches;\n\t\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t\t\tregistry.dispatch( editorStore ).setDeviceType( 'Desktop' );\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t\t.__unstableSetEditorMode( 'edit' );\n\t\t\t\tconst isPublishSidebarOpened = registry\n\t\t\t\t\t.select( editorStore )\n\t\t\t\t\t.isPublishSidebarOpened();\n\t\t\t\tdispatch( {\n\t\t\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\t\t\tmode,\n\t\t\t\t} );\n\t\t\t\tconst isEditMode = mode === 'edit';\n\t\t\t\tif ( isPublishSidebarOpened && ! isEditMode ) {\n\t\t\t\t\tregistry.dispatch( editorStore ).closePublishSidebar();\n\t\t\t\t}\n\n\t\t\t\t// Check if the block list view should be open by default.\n\t\t\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\t\t\t// This behavior is disabled for small viewports.\n\t\t\t\tif (\n\t\t\t\t\tisMediumOrBigger &&\n\t\t\t\t\tisEditMode &&\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'showListViewByDefault' ) &&\n\t\t\t\t\t! registry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'distractionFree' )\n\t\t\t\t) {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( true );\n\t\t\t\t} else {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( false );\n\t\t\t\t}\n\t\t\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t\t\t} );\n\t\t};\n\n\t\tif ( ! document.startViewTransition ) {\n\t\t\tswitchCanvasMode();\n\t\t} else {\n\t\t\tdocument.documentElement.classList.add(\n\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t);\n\t\t\tconst transition = document.startViewTransition( () =>\n\t\t\t\tswitchCanvasMode()\n\t\t\t);\n\t\t\ttransition.finished.finally( () => {\n\t\t\t\tdocument.documentElement.classList.remove(\n\t\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,wBAAwB;AAClE,SAASF,KAAK,IAAIG,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GACvBC,IAAI,IACN,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC7B,MAAMC,gBAA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AAmB,CAAE,KAAM,CAAC;IAC9D,CAAE,CAAC;EACJ,CAAC;EAED,IAAK,CAAEC,QAAQ,CAACC,mBAAmB,EAAG;IACrClB,gBAAgB,CAAC,CAAC;EACnB,CAAC,MAAM;IACNiB,QAAQ,CAACE,eAAe,CAACC,SAAS,CAACC,GAAG,CACpC,eAAexB,IAAM,aACvB,CAAC;IACD,MAAMyB,UAAU,GAAGL,QAAQ,CAACC,mBAAmB,CAAE,MAChDlB,gBAAgB,CAAC,CAClB,CAAC;IACDsB,UAAU,CAACC,QAAQ,CAACC,OAAO,CAAE,MAAM;MAClCP,QAAQ,CAACE,eAAe,CAACC,SAAS,CAACK,MAAM,CACvC,eAAe5B,IAAM,aACvB,CAAC;IACF,CAAE,CAAC;EACJ;AACD,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM6B,4BAA4B,GACtCC,IAAI,IACN,CAAE;EAAE5B;AAAS,CAAC,KAAM;EACnBA,QAAQ,CAAE;IACTY,IAAI,EAAE,kCAAkC;IACxCgB;EACD,CAAE,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["store","blockEditorStore","preferencesStore","editorStore","setCanvasMode","mode","registry","dispatch","isMediumOrBigger","window","matchMedia","matches","switchCanvasMode","batch","clearSelectedBlock","setDeviceType","__unstableSetEditorMode","isPublishSidebarOpened","select","type","isEditMode","closePublishSidebar","get","setIsListViewOpened","setIsInserterOpened","document","startViewTransition","documentElement","classList","add","transition","finished","finally","remove","setEditorCanvasContainerView","view"],"sources":["@wordpress/edit-site/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tconst isMediumOrBigger =\n\t\t\twindow.matchMedia( '(min-width: 782px)' ).matches;\n\t\tconst switchCanvasMode = () => {\n\t\t\tregistry.batch( () => {\n\t\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t\t\tregistry.dispatch( editorStore ).setDeviceType( 'Desktop' );\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t\t.__unstableSetEditorMode( 'edit' );\n\t\t\t\tconst isPublishSidebarOpened = registry\n\t\t\t\t\t.select( editorStore )\n\t\t\t\t\t.isPublishSidebarOpened();\n\t\t\t\tdispatch( {\n\t\t\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\t\t\tmode,\n\t\t\t\t} );\n\t\t\t\tconst isEditMode = mode === 'edit';\n\t\t\t\tif ( isPublishSidebarOpened && ! isEditMode ) {\n\t\t\t\t\tregistry.dispatch( editorStore ).closePublishSidebar();\n\t\t\t\t}\n\n\t\t\t\t// Check if the block list view should be open by default.\n\t\t\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\t\t\t// This behavior is disabled for small viewports.\n\t\t\t\tif (\n\t\t\t\t\tisMediumOrBigger &&\n\t\t\t\t\tisEditMode &&\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'showListViewByDefault' ) &&\n\t\t\t\t\t! registry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'distractionFree' )\n\t\t\t\t) {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( true );\n\t\t\t\t} else {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( false );\n\t\t\t\t}\n\t\t\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t\t\t} );\n\t\t};\n\n\t\t/*\n\t\t * Skip transition in mobile, otherwise it crashes the browser.\n\t\t * See: https://github.com/WordPress/gutenberg/pull/63002.\n\t\t */\n\t\tif ( ! isMediumOrBigger || ! document.startViewTransition ) {\n\t\t\tswitchCanvasMode();\n\t\t} else {\n\t\t\tdocument.documentElement.classList.add(\n\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t);\n\t\t\tconst transition = document.startViewTransition( () =>\n\t\t\t\tswitchCanvasMode()\n\t\t\t);\n\t\t\ttransition.finished.finally( () => {\n\t\t\t\tdocument.documentElement.classList.remove(\n\t\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,wBAAwB;AAClE,SAASF,KAAK,IAAIG,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GACvBC,IAAI,IACN,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC7B,MAAMC,gBAAgB,GACrBC,MAAM,CAACC,UAAU,CAAE,oBAAqB,CAAC,CAACC,OAAO;EAClD,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;IAC9BN,QAAQ,CAACO,KAAK,CAAE,MAAM;MACrBP,QAAQ,CAACC,QAAQ,CAAEN,gBAAiB,CAAC,CAACa,kBAAkB,CAAC,CAAC;MAC1DR,QAAQ,CAACC,QAAQ,CAAEJ,WAAY,CAAC,CAACY,aAAa,CAAE,SAAU,CAAC;MAC3DT,QAAQ,CACNC,QAAQ,CAAEN,gBAAiB,CAAC,CAC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AClB,CAAC;IACDkB,UAAU,CAACC,QAAQ,CAACC,OAAO,CAAE,MAAM;MAClCP,QAAQ,CAACE,eAAe,CAACC,SAAS,CAACK,MAAM,CACvC,eAAe5B,IAAM,aACvB,CAAC;IACF,CAAE,CAAC;EACJ;AACD,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM6B,4BAA4B,GACtCC,IAAI,IACN,CAAE;EAAE5B;AAAS,CAAC,KAAM;EACnBA,QAAQ,CAAE;IACTY,IAAI,EAAE,kCAAkC;IACxCgB;EACD,CAAE,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -2,16 +2,19 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { store as coreDataStore } from '@wordpress/core-data';
5
- import { createRegistrySelector } from '@wordpress/data';
5
+ import { createRegistrySelector, createSelector } from '@wordpress/data';
6
6
  import deprecated from '@wordpress/deprecated';
7
7
  import { Platform } from '@wordpress/element';
8
8
  import { store as preferencesStore } from '@wordpress/preferences';
9
9
  import { store as editorStore } from '@wordpress/editor';
10
+ import { store as blockEditorStore } from '@wordpress/block-editor';
10
11
 
11
12
  /**
12
13
  * Internal dependencies
13
14
  */
14
15
  import { unlock } from '../lock-unlock';
16
+ import { TEMPLATE_PART_POST_TYPE } from '../utils/constants';
17
+ import getFilteredTemplatePartBlocks from '../utils/get-filtered-template-parts';
15
18
 
16
19
  /**
17
20
  * @typedef {'template'|'template_type'} TemplateType Template type.
@@ -59,7 +62,13 @@ export const __experimentalGetPreviewDeviceType = createRegistrySelector(select
59
62
  *
60
63
  * @return {Object} Whether the current user can create media or not.
61
64
  */
62
- export const getCanUserCreateMedia = createRegistrySelector(select => () => select(coreDataStore).canUser('create', 'media'));
65
+ export const getCanUserCreateMedia = createRegistrySelector(select => () => {
66
+ deprecated(`wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`, {
67
+ since: '6.7',
68
+ alternative: `wp.data.select( 'core' ).canUser( 'create', { kind: 'root', type: 'media' } )`
69
+ });
70
+ return select(coreDataStore).canUser('create', 'media');
71
+ });
63
72
 
64
73
  /**
65
74
  * Returns any available Reusable blocks.
@@ -69,9 +78,10 @@ export const getCanUserCreateMedia = createRegistrySelector(select => () => sele
69
78
  * @return {Array} The available reusable blocks.
70
79
  */
71
80
  export const getReusableBlocks = createRegistrySelector(select => () => {
72
- deprecated("select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )", {
81
+ deprecated(`select( 'core/edit-site' ).getReusableBlocks()`, {
73
82
  since: '6.5',
74
- version: '6.8'
83
+ version: '6.8',
84
+ alternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )`
75
85
  });
76
86
  const isWeb = Platform.OS === 'web';
77
87
  return isWeb ? select(coreDataStore).getEntityRecords('postType', 'wp_block', {
@@ -210,16 +220,34 @@ export const isListViewOpened = createRegistrySelector(select => () => {
210
220
  export function isSaveViewOpened(state) {
211
221
  return state.saveViewPanel;
212
222
  }
223
+ function getBlocksAndTemplateParts(select) {
224
+ const templateParts = select(coreDataStore).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, {
225
+ per_page: -1
226
+ });
227
+ const {
228
+ getBlocksByName,
229
+ getBlocksByClientId
230
+ } = select(blockEditorStore);
231
+ const clientIds = getBlocksByName('core/template-part');
232
+ const blocks = getBlocksByClientId(clientIds);
233
+ return [blocks, templateParts];
234
+ }
213
235
 
214
236
  /**
215
237
  * Returns the template parts and their blocks for the current edited template.
216
238
  *
239
+ * @deprecated
217
240
  * @param {Object} state Global application state.
218
241
  * @return {Array} Template parts and their blocks in an array.
219
242
  */
220
- export const getCurrentTemplateTemplateParts = createRegistrySelector(select => () => {
221
- return unlock(select(editorStore)).getCurrentTemplateTemplateParts();
222
- });
243
+ export const getCurrentTemplateTemplateParts = createRegistrySelector(select => createSelector(() => {
244
+ deprecated(`select( 'core/edit-site' ).getCurrentTemplateTemplateParts()`, {
245
+ since: '6.7',
246
+ version: '6.9',
247
+ alternative: `select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )`
248
+ });
249
+ return getFilteredTemplatePartBlocks(...getBlocksAndTemplateParts(select));
250
+ }, () => getBlocksAndTemplateParts(select)));
223
251
 
224
252
  /**
225
253
  * Returns the current editing mode.