@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
@@ -5,9 +5,7 @@ import { __ } from '@wordpress/i18n';
5
5
  import { edit, seen } from '@wordpress/icons';
6
6
  import { useSelect, useDispatch } from '@wordpress/data';
7
7
  import { store as coreStore } from '@wordpress/core-data';
8
- import { __experimentalVStack as VStack } from '@wordpress/components';
9
8
  import { useViewportMatch } from '@wordpress/compose';
10
- import { BlockEditorProvider } from '@wordpress/block-editor';
11
9
  import { useCallback } from '@wordpress/element';
12
10
  import { store as editorStore } from '@wordpress/editor';
13
11
  import { store as preferencesStore } from '@wordpress/preferences';
@@ -16,7 +14,6 @@ import { store as preferencesStore } from '@wordpress/preferences';
16
14
  * Internal dependencies
17
15
  */
18
16
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
19
- import StyleVariationsContainer from '../global-styles/style-variations-container';
20
17
  import { unlock } from '../../lock-unlock';
21
18
  import { store as editSiteStore } from '../../store';
22
19
  import SidebarButton from '../sidebar-button';
@@ -24,14 +21,7 @@ import SidebarNavigationItem from '../sidebar-navigation-item';
24
21
  import StyleBook from '../style-book';
25
22
  import useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';
26
23
  import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
27
- import ColorVariations from '../global-styles/variations/variations-color';
28
- import TypographyVariations from '../global-styles/variations/variations-typography';
29
- import {
30
- useColorVariations,
31
- useTypographyVariations,
32
- } from '../global-styles/hooks';
33
-
34
- const noop = () => {};
24
+ import SidebarNavigationScreenGlobalStylesContent from './content';
35
25
 
36
26
  export function SidebarNavigationItemGlobalStyles( props ) {
37
27
  const { openGeneralSidebar } = useDispatch( editSiteStore );
@@ -66,49 +56,6 @@ export function SidebarNavigationItemGlobalStyles( props ) {
66
56
  );
67
57
  }
68
58
 
69
- function SidebarNavigationScreenGlobalStylesContent() {
70
- const { storedSettings } = useSelect( ( select ) => {
71
- const { getSettings } = unlock( select( editSiteStore ) );
72
-
73
- return {
74
- storedSettings: getSettings(),
75
- };
76
- }, [] );
77
-
78
- const colorVariations = useColorVariations();
79
- const typographyVariations = useTypographyVariations();
80
- const gap = 3;
81
-
82
- // Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are
83
- // loaded. This is necessary because the Iframe component waits until
84
- // the block editor store's `__internalIsInitialized` is true before
85
- // rendering the iframe. Without this, the iframe previews will not render
86
- // in mobile viewport sizes, where the editor canvas is hidden.
87
- return (
88
- <BlockEditorProvider
89
- settings={ storedSettings }
90
- onChange={ noop }
91
- onInput={ noop }
92
- >
93
- <VStack
94
- spacing={ 10 }
95
- className="edit-site-global-styles-variation-container"
96
- >
97
- <StyleVariationsContainer gap={ gap } />
98
- { colorVariations?.length && (
99
- <ColorVariations title={ __( 'Palettes' ) } gap={ gap } />
100
- ) }
101
- { typographyVariations?.length && (
102
- <TypographyVariations
103
- title={ __( 'Typography' ) }
104
- gap={ gap }
105
- />
106
- ) }
107
- </VStack>
108
- </BlockEditorProvider>
109
- );
110
- }
111
-
112
59
  export default function SidebarNavigationScreenGlobalStyles( { backPath } ) {
113
60
  const { revisions, isLoading: isLoadingRevisions } =
114
61
  useGlobalStylesRevisions();
@@ -36,6 +36,7 @@ export default function RenameModal( { menuTitle, onClose, onSave } ) {
36
36
  value={ editedMenuTitle }
37
37
  placeholder={ __( 'Navigation title' ) }
38
38
  onChange={ setEditedMenuTitle }
39
+ label={ __( 'Name' ) }
39
40
  />
40
41
  <HStack justify="right">
41
42
  <Button
@@ -48,7 +49,7 @@ export default function RenameModal( { menuTitle, onClose, onSave } ) {
48
49
 
49
50
  <Button
50
51
  __next40pxDefaultSize
51
- __experimentalIsFocusable
52
+ accessibleWhenDisabled
52
53
  disabled={ ! isEditedMenuTitleValid }
53
54
  variant="primary"
54
55
  type="submit"
@@ -58,13 +58,21 @@ export default function usePatternCategories() {
58
58
 
59
59
  // Update the category counts to reflect user registered patterns.
60
60
  userPatterns.forEach( ( pattern ) => {
61
- pattern.categories?.forEach( ( category ) => {
61
+ pattern.wp_pattern_category?.forEach( ( catId ) => {
62
+ const category = userPatternCategories.find(
63
+ ( cat ) => cat.id === catId
64
+ )?.name;
62
65
  if ( categoryMap[ category ] ) {
63
66
  categoryMap[ category ].count += 1;
64
67
  }
65
68
  } );
66
69
  // If the pattern has no categories, add it to uncategorized.
67
- if ( ! pattern.categories?.length ) {
70
+ if (
71
+ ! pattern.wp_pattern_category?.length ||
72
+ ! pattern.wp_pattern_category.some( ( catId ) =>
73
+ userPatternCategories.find( ( cat ) => cat.id === catId )
74
+ )
75
+ ) {
68
76
  categoryMap.uncategorized.count += 1;
69
77
  }
70
78
  } );
@@ -11,11 +11,12 @@ import { Button, __experimentalHStack as HStack } from '@wordpress/components';
11
11
  import { __ } from '@wordpress/i18n';
12
12
  import { store as coreStore } from '@wordpress/core-data';
13
13
  import { decodeEntities } from '@wordpress/html-entities';
14
- import { memo, forwardRef } from '@wordpress/element';
14
+ import { memo, forwardRef, useContext } from '@wordpress/element';
15
15
  import { search } from '@wordpress/icons';
16
16
  import { store as commandsStore } from '@wordpress/commands';
17
17
  import { displayShortcut } from '@wordpress/keycodes';
18
18
  import { filterURLForDisplay } from '@wordpress/url';
19
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
19
20
 
20
21
  /**
21
22
  * Internal dependencies
@@ -23,6 +24,8 @@ import { filterURLForDisplay } from '@wordpress/url';
23
24
  import { store as editSiteStore } from '../../store';
24
25
  import SiteIcon from '../site-icon';
25
26
  import { unlock } from '../../lock-unlock';
27
+ const { useHistory } = unlock( routerPrivateApis );
28
+ import { SidebarNavigationContext } from '../sidebar';
26
29
 
27
30
  const SiteHub = memo(
28
31
  forwardRef( ( { isTransparent }, ref ) => {
@@ -103,3 +106,83 @@ const SiteHub = memo(
103
106
  );
104
107
 
105
108
  export default SiteHub;
109
+
110
+ export const SiteHubMobile = memo(
111
+ forwardRef( ( { isTransparent }, ref ) => {
112
+ const history = useHistory();
113
+ const { navigate } = useContext( SidebarNavigationContext );
114
+
115
+ const { homeUrl, siteTitle } = useSelect( ( select ) => {
116
+ const {
117
+ getSite,
118
+ getUnstableBase, // Site index.
119
+ } = select( coreStore );
120
+ const _site = getSite();
121
+ return {
122
+ homeUrl: getUnstableBase()?.home,
123
+ siteTitle:
124
+ ! _site?.title && !! _site?.url
125
+ ? filterURLForDisplay( _site?.url )
126
+ : _site?.title,
127
+ };
128
+ }, [] );
129
+ const { open: openCommandCenter } = useDispatch( commandsStore );
130
+
131
+ return (
132
+ <div className="edit-site-site-hub">
133
+ <HStack justify="flex-start" spacing="0">
134
+ <div
135
+ className={ clsx(
136
+ 'edit-site-site-hub__view-mode-toggle-container',
137
+ {
138
+ 'has-transparent-background': isTransparent,
139
+ }
140
+ ) }
141
+ >
142
+ <Button
143
+ ref={ ref }
144
+ label={ __( 'Go to Site Editor' ) }
145
+ className="edit-site-layout__view-mode-toggle"
146
+ style={ {
147
+ transform: 'scale(0.5)',
148
+ borderRadius: 4,
149
+ } }
150
+ onClick={ () => {
151
+ history.push( {} );
152
+ navigate( 'back' );
153
+ } }
154
+ >
155
+ <SiteIcon className="edit-site-layout__view-mode-toggle-icon" />
156
+ </Button>
157
+ </div>
158
+
159
+ <HStack>
160
+ <div className="edit-site-site-hub__title">
161
+ <Button
162
+ variant="link"
163
+ href={ homeUrl }
164
+ target="_blank"
165
+ label={ __( 'View site (opens in a new tab)' ) }
166
+ >
167
+ { decodeEntities( siteTitle ) }
168
+ </Button>
169
+ </div>
170
+ <HStack
171
+ spacing={ 0 }
172
+ expanded={ false }
173
+ className="edit-site-site-hub__actions"
174
+ >
175
+ <Button
176
+ className="edit-site-site-hub_toggle-command-center"
177
+ icon={ search }
178
+ onClick={ () => openCommandCenter() }
179
+ label={ __( 'Open command palette' ) }
180
+ shortcut={ displayShortcut.primary( 'k' ) }
181
+ />
182
+ </HStack>
183
+ </HStack>
184
+ </HStack>
185
+ </div>
186
+ );
187
+ } )
188
+ );
@@ -27,7 +27,7 @@ const postTypesWithoutParentTemplate = [
27
27
  PATTERN_TYPES.user,
28
28
  ];
29
29
 
30
- const authorizedPostTypes = [ 'page' ];
30
+ const authorizedPostTypes = [ 'page', 'post' ];
31
31
 
32
32
  function useResolveEditedEntityAndContext( { postId, postType } ) {
33
33
  const {
@@ -213,7 +213,8 @@ function useResolveEditedEntityAndContext( { postId, postType } ) {
213
213
  if ( postType && postId && authorizedPostTypes.includes( postType ) ) {
214
214
  return { postType, postId };
215
215
  }
216
-
216
+ // TODO: for post types lists we should probably not render the front page, but maybe a placeholder
217
+ // with a message like "Select a page" or something similar.
217
218
  if ( homepageId ) {
218
219
  return { postType: 'page', postId: homepageId };
219
220
  }
@@ -339,7 +339,7 @@ function PushChangesToGlobalStylesControl( {
339
339
  <Button
340
340
  __next40pxDefaultSize
341
341
  variant="secondary"
342
- __experimentalIsFocusable
342
+ accessibleWhenDisabled
343
343
  disabled={ changes.length === 0 }
344
344
  onClick={ pushChanges }
345
345
  >
@@ -375,7 +375,7 @@ function PushChangesToGlobalStyles( props ) {
375
375
  const withPushChangesToGlobalStyles = createHigherOrderComponent(
376
376
  ( BlockEdit ) => ( props ) => (
377
377
  <>
378
- <BlockEdit { ...props } />
378
+ <BlockEdit key="edit" { ...props } />
379
379
  { props.isSelected && <PushChangesToGlobalStyles { ...props } /> }
380
380
  </>
381
381
  )
@@ -2,11 +2,11 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import {
5
- filterObjectByProperty,
6
- removePropertyFromObject,
5
+ filterObjectByProperties,
6
+ removePropertiesFromObject,
7
7
  } from '../use-theme-style-variations-by-property';
8
8
 
9
- describe( 'filterObjectByProperty', () => {
9
+ describe( 'filterObjectByProperties', () => {
10
10
  const noop = () => {};
11
11
  test.each( [
12
12
  {
@@ -14,21 +14,21 @@ describe( 'filterObjectByProperty', () => {
14
14
  foo: 'bar',
15
15
  array: [ 1, 3, 4 ],
16
16
  },
17
- property: 'array',
17
+ properties: [ 'array' ],
18
18
  expected: { array: [ 1, 3, 4 ] },
19
19
  },
20
20
  {
21
21
  object: {
22
22
  foo: 'bar',
23
23
  },
24
- property: 'does-not-exist',
24
+ properties: [ 'does-not-exist' ],
25
25
  expected: {},
26
26
  },
27
27
  {
28
28
  object: {
29
29
  foo: 'bar',
30
30
  },
31
- property: false,
31
+ properties: false,
32
32
  expected: {},
33
33
  },
34
34
  {
@@ -39,7 +39,7 @@ describe( 'filterObjectByProperty', () => {
39
39
  },
40
40
  },
41
41
  },
42
- property: 'null',
42
+ properties: [ 'null' ],
43
43
  expected: {
44
44
  dig: {
45
45
  deeper: {
@@ -52,19 +52,19 @@ describe( 'filterObjectByProperty', () => {
52
52
  object: {
53
53
  function: noop,
54
54
  },
55
- property: 'function',
55
+ properties: [ 'function' ],
56
56
  expected: {
57
57
  function: noop,
58
58
  },
59
59
  },
60
60
  {
61
61
  object: [],
62
- property: 'something',
62
+ properties: [ 'something' ],
63
63
  expected: {},
64
64
  },
65
65
  {
66
66
  object: {},
67
- property: undefined,
67
+ properties: undefined,
68
68
  expected: {},
69
69
  },
70
70
  {
@@ -74,7 +74,7 @@ describe( 'filterObjectByProperty', () => {
74
74
  array: [ 1, 3, 4 ],
75
75
  },
76
76
  },
77
- property: 'nested-object-foo',
77
+ properties: [ 'nested-object-foo' ],
78
78
  expected: {
79
79
  'nested-object': {
80
80
  'nested-object-foo': 'bar',
@@ -82,15 +82,15 @@ describe( 'filterObjectByProperty', () => {
82
82
  },
83
83
  },
84
84
  ] )(
85
- 'should filter object by $property',
86
- ( { expected, object, property } ) => {
87
- const result = filterObjectByProperty( object, property );
85
+ 'should filter object by $properties',
86
+ ( { expected, object, properties } ) => {
87
+ const result = filterObjectByProperties( object, properties );
88
88
  expect( result ).toEqual( expected );
89
89
  }
90
90
  );
91
91
  } );
92
92
 
93
- describe( 'removePropertyFromObject', () => {
93
+ describe( 'removePropertiesFromObject', () => {
94
94
  const mockBaseVariation = {
95
95
  settings: {
96
96
  typography: {
@@ -188,34 +188,38 @@ describe( 'removePropertyFromObject', () => {
188
188
  },
189
189
  };
190
190
 
191
- it( 'should return with no property', () => {
191
+ it( 'should return with no properties', () => {
192
192
  const object = { test: 'me' };
193
- expect( removePropertyFromObject( object, undefined ) ).toEqual(
193
+ expect( removePropertiesFromObject( object, undefined ) ).toEqual(
194
194
  object
195
195
  );
196
196
  } );
197
197
 
198
- it( 'should return with non-string property', () => {
198
+ it( 'should return with non-string properties', () => {
199
199
  const object = { test: 'you' };
200
- expect( removePropertyFromObject( object, true ) ).toEqual( object );
200
+ expect( removePropertiesFromObject( object, true ) ).toEqual( object );
201
201
  } );
202
202
 
203
203
  it( 'should return with empty object', () => {
204
204
  const object = {};
205
- expect( removePropertyFromObject( object, 'color' ) ).toEqual( object );
205
+ expect( removePropertiesFromObject( object, [ 'color' ] ) ).toEqual(
206
+ object
207
+ );
206
208
  } );
207
209
 
208
210
  it( 'should return with null', () => {
209
- expect( removePropertyFromObject( null, 'color' ) ).toEqual( null );
211
+ expect( removePropertiesFromObject( null, [ 'color' ] ) ).toEqual(
212
+ null
213
+ );
210
214
  } );
211
215
 
212
- it( 'should remove the specified property from the object', () => {
216
+ it( 'should remove the specified properties from the object', () => {
213
217
  expect(
214
- removePropertyFromObject(
218
+ removePropertiesFromObject(
215
219
  {
216
220
  ...mockBaseVariation,
217
221
  },
218
- 'typography'
222
+ [ 'typography' ]
219
223
  )
220
224
  ).toEqual( {
221
225
  settings: {
@@ -14,18 +14,20 @@ import { __ } from '@wordpress/i18n';
14
14
  import cloneDeep from '../../utils/clone-deep';
15
15
  import { unlock } from '../../lock-unlock';
16
16
 
17
- const { GlobalStylesContext } = unlock( blockEditorPrivateApis );
17
+ const { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(
18
+ blockEditorPrivateApis
19
+ );
18
20
  const { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );
19
21
 
20
22
  /**
21
- * Removes all instances of a property from an object.
23
+ * Removes all instances of properties from an object.
22
24
  *
23
- * @param {Object} object The object to remove the property from.
24
- * @param {string} property The property to remove.
25
+ * @param {Object} object The object to remove the properties from.
26
+ * @param {string[]} properties The properties to remove.
25
27
  * @return {Object} The modified object.
26
28
  */
27
- export function removePropertyFromObject( object, property ) {
28
- if ( ! property || typeof property !== 'string' ) {
29
+ export function removePropertiesFromObject( object, properties ) {
30
+ if ( ! properties?.length ) {
29
31
  return object;
30
32
  }
31
33
 
@@ -38,26 +40,42 @@ export function removePropertyFromObject( object, property ) {
38
40
  }
39
41
 
40
42
  for ( const key in object ) {
41
- if ( key === property ) {
43
+ if ( properties.includes( key ) ) {
42
44
  delete object[ key ];
43
45
  } else if ( typeof object[ key ] === 'object' ) {
44
- removePropertyFromObject( object[ key ], property );
46
+ removePropertiesFromObject( object[ key ], properties );
45
47
  }
46
48
  }
47
49
  return object;
48
50
  }
49
51
 
50
52
  /**
51
- * Fetches the current theme style variations that contain only the specified property
53
+ * Checks whether a style variation is empty.
54
+ *
55
+ * @param {Object} variation A style variation object.
56
+ * @param {string} variation.title The title of the variation.
57
+ * @param {Object} variation.settings The settings of the variation.
58
+ * @param {Object} variation.styles The styles of the variation.
59
+ * @return {boolean} Whether the variation is empty.
60
+ */
61
+ function hasThemeVariation( { title, settings, styles } ) {
62
+ return (
63
+ title === __( 'Default' ) || // Always preserve the default variation.
64
+ Object.keys( settings ).length > 0 ||
65
+ Object.keys( styles ).length > 0
66
+ );
67
+ }
68
+
69
+ /**
70
+ * Fetches the current theme style variations that contain only the specified properties
52
71
  * and merges them with the user config.
53
72
  *
54
- * @param {Object} props Object of hook args.
55
- * @param {string} props.property The property to filter by.
73
+ * @param {string[]} properties The properties to filter by.
56
74
  * @return {Object[]|*} The merged object.
57
75
  */
58
- export function useCurrentMergeThemeStyleVariationsWithUserConfig( {
59
- property,
60
- } ) {
76
+ export function useCurrentMergeThemeStyleVariationsWithUserConfig(
77
+ properties = []
78
+ ) {
61
79
  const { variationsFromTheme } = useSelect( ( select ) => {
62
80
  const _variationsFromTheme =
63
81
  select(
@@ -70,55 +88,67 @@ export function useCurrentMergeThemeStyleVariationsWithUserConfig( {
70
88
  }, [] );
71
89
  const { user: userVariation } = useContext( GlobalStylesContext );
72
90
 
91
+ const propertiesAsString = properties.toString();
92
+
73
93
  return useMemo( () => {
74
94
  const clonedUserVariation = cloneDeep( userVariation );
75
95
 
76
96
  // Get user variation and remove the settings for the given property.
77
- const userVariationWithoutProperty = removePropertyFromObject(
97
+ const userVariationWithoutProperties = removePropertiesFromObject(
78
98
  clonedUserVariation,
79
- property
99
+ properties
80
100
  );
81
- userVariationWithoutProperty.title = __( 'Default' );
101
+ userVariationWithoutProperties.title = __( 'Default' );
82
102
 
83
- const variationsWithSinglePropertyAndBase = variationsFromTheme
103
+ const variationsWithPropertiesAndBase = variationsFromTheme
84
104
  .filter( ( variation ) => {
85
- return isVariationWithSingleProperty( variation, property );
105
+ return isVariationWithProperties( variation, properties );
86
106
  } )
87
107
  .map( ( variation ) => {
88
108
  return mergeBaseAndUserConfigs(
89
- userVariationWithoutProperty,
109
+ userVariationWithoutProperties,
90
110
  variation
91
111
  );
92
112
  } );
93
113
 
94
- return [
95
- userVariationWithoutProperty,
96
- ...variationsWithSinglePropertyAndBase,
114
+ const variationsByProperties = [
115
+ userVariationWithoutProperties,
116
+ ...variationsWithPropertiesAndBase,
97
117
  ];
98
- }, [ property, userVariation, variationsFromTheme ] );
118
+
119
+ /*
120
+ * Filter out variations with no settings or styles.
121
+ */
122
+ return variationsByProperties?.length
123
+ ? variationsByProperties.filter( hasThemeVariation )
124
+ : [];
125
+ }, [ propertiesAsString, userVariation, variationsFromTheme ] );
99
126
  }
100
127
 
101
128
  /**
102
- * Returns a new object, with properties specified in `property`,
129
+ * Returns a new object, with properties specified in `properties` array.,
103
130
  * maintain the original object tree structure.
104
- * The function is recursive, so it will perform a deep search for the given property.
105
- * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the property is `test`.
131
+ * The function is recursive, so it will perform a deep search for the given properties.
132
+ * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the properties are `[ 'test' ]`.
106
133
  *
107
- * @param {Object} object The object to filter
108
- * @param {Object} property The property to filter by
134
+ * @param {Object} object The object to filter
135
+ * @param {string[]} properties The properties to filter by
109
136
  * @return {Object} The merged object.
110
137
  */
111
- export const filterObjectByProperty = ( object, property ) => {
112
- if ( ! object ) {
138
+ export const filterObjectByProperties = ( object, properties ) => {
139
+ if ( ! object || ! properties?.length ) {
113
140
  return {};
114
141
  }
115
142
 
116
143
  const newObject = {};
117
144
  Object.keys( object ).forEach( ( key ) => {
118
- if ( key === property ) {
145
+ if ( properties.includes( key ) ) {
119
146
  newObject[ key ] = object[ key ];
120
147
  } else if ( typeof object[ key ] === 'object' ) {
121
- const newFilter = filterObjectByProperty( object[ key ], property );
148
+ const newFilter = filterObjectByProperties(
149
+ object[ key ],
150
+ properties
151
+ );
122
152
  if ( Object.keys( newFilter ).length ) {
123
153
  newObject[ key ] = newFilter;
124
154
  }
@@ -128,23 +158,18 @@ export const filterObjectByProperty = ( object, property ) => {
128
158
  };
129
159
 
130
160
  /**
131
- * Compares a style variation to the same variation filtered by a single property.
132
- * Returns true if the variation contains only the property specified.
161
+ * Compares a style variation to the same variation filtered by the specified properties.
162
+ * Returns true if the variation contains only the properties specified.
133
163
  *
134
- * @param {Object} variation The variation to compare.
135
- * @param {string} property The property to compare.
136
- * @return {boolean} Whether the variation contains only a single property.
164
+ * @param {Object} variation The variation to compare.
165
+ * @param {string[]} properties The properties to compare.
166
+ * @return {boolean} Whether the variation contains only the specified properties.
137
167
  */
138
- export function isVariationWithSingleProperty( variation, property ) {
139
- const variationWithProperty = filterObjectByProperty(
168
+ export function isVariationWithProperties( variation, properties ) {
169
+ const variationWithProperties = filterObjectByProperties(
140
170
  cloneDeep( variation ),
141
- property
171
+ properties
142
172
  );
143
173
 
144
- return (
145
- JSON.stringify( variationWithProperty?.styles ) ===
146
- JSON.stringify( variation?.styles ) &&
147
- JSON.stringify( variationWithProperty?.settings ) ===
148
- JSON.stringify( variation?.settings )
149
- );
174
+ return areGlobalStyleConfigsEqual( variationWithProperties, variation );
150
175
  }
package/src/index.js CHANGED
@@ -10,7 +10,10 @@ import {
10
10
  import { dispatch } from '@wordpress/data';
11
11
  import deprecated from '@wordpress/deprecated';
12
12
  import { createRoot, StrictMode } from '@wordpress/element';
13
- import { store as editorStore } from '@wordpress/editor';
13
+ import {
14
+ store as editorStore,
15
+ privateApis as editorPrivateApis,
16
+ } from '@wordpress/editor';
14
17
  import { store as preferencesStore } from '@wordpress/preferences';
15
18
  import {
16
19
  registerLegacyWidgetBlock,
@@ -22,8 +25,15 @@ import {
22
25
  */
23
26
  import './hooks';
24
27
  import { store as editSiteStore } from './store';
28
+ import { unlock } from './lock-unlock';
25
29
  import App from './components/app';
26
30
 
31
+ const {
32
+ registerDefaultActions,
33
+ registerCoreBlockBindingsSources,
34
+ bootstrapBlockBindingsSourcesFromServer,
35
+ } = unlock( editorPrivateApis );
36
+
27
37
  /**
28
38
  * Initializes the site editor screen.
29
39
  *
@@ -39,6 +49,8 @@ export function initializeEditor( id, settings ) {
39
49
  ( { name } ) => name !== 'core/freeform'
40
50
  );
41
51
  registerCoreBlocks( coreBlocks );
52
+ bootstrapBlockBindingsSourcesFromServer( settings?.blockBindingsSources );
53
+ registerCoreBlockBindingsSources();
42
54
  dispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );
43
55
  registerLegacyWidgetBlock( { inserter: false } );
44
56
  registerWidgetGroupBlock( { inserter: false } );
@@ -47,6 +59,7 @@ export function initializeEditor( id, settings ) {
47
59
  enableFSEBlocks: true,
48
60
  } );
49
61
  }
62
+ registerDefaultActions();
50
63
 
51
64
  // We dispatch actions and update the store synchronously before rendering
52
65
  // so that we won't trigger unnecessary re-renders with useEffect.