@wordpress/edit-site 6.3.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 (221) hide show
  1. package/CHANGELOG.md +2 -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-template/index.js +3 -1
  5. package/build/components/add-new-template/index.js.map +1 -1
  6. package/build/components/block-editor/use-site-editor-settings.js +1 -82
  7. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  8. package/build/components/global-styles/block-preview-panel.js +14 -5
  9. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  10. package/build/components/global-styles/font-families.js +42 -23
  11. package/build/components/global-styles/font-families.js.map +1 -1
  12. package/build/components/global-styles/font-library-modal/index.js +4 -4
  13. package/build/components/global-styles/font-library-modal/index.js.map +1 -1
  14. package/build/components/global-styles/font-library-modal/installed-fonts.js +58 -10
  15. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  16. package/build/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js +39 -0
  17. package/build/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js.map +1 -0
  18. package/build/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js +39 -0
  19. package/build/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js.map +1 -0
  20. package/build/components/global-styles/font-sizes/font-size-preview.js +44 -0
  21. package/build/components/global-styles/font-sizes/font-size-preview.js.map +1 -0
  22. package/build/components/global-styles/font-sizes/font-size.js +213 -0
  23. package/build/components/global-styles/font-sizes/font-size.js.map +1 -0
  24. package/build/components/global-styles/font-sizes/font-sizes-count.js +50 -0
  25. package/build/components/global-styles/font-sizes/font-sizes-count.js.map +1 -0
  26. package/build/components/global-styles/font-sizes/font-sizes.js +163 -0
  27. package/build/components/global-styles/font-sizes/font-sizes.js.map +1 -0
  28. package/build/components/global-styles/font-sizes/rename-font-size-dialog.js +67 -0
  29. package/build/components/global-styles/font-sizes/rename-font-size-dialog.js.map +1 -0
  30. package/build/components/global-styles/screen-block.js +10 -8
  31. package/build/components/global-styles/screen-block.js.map +1 -1
  32. package/build/components/global-styles/screen-style-variations.js +2 -2
  33. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  34. package/build/components/global-styles/screen-typography.js +3 -2
  35. package/build/components/global-styles/screen-typography.js.map +1 -1
  36. package/build/components/global-styles/size-control/index.js +85 -0
  37. package/build/components/global-styles/size-control/index.js.map +1 -0
  38. package/build/components/global-styles/style-variations-container.js +3 -0
  39. package/build/components/global-styles/style-variations-container.js.map +1 -1
  40. package/build/components/global-styles/ui.js +8 -0
  41. package/build/components/global-styles/ui.js.map +1 -1
  42. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  43. package/build/components/global-styles/variations/variations-typography.js +1 -1
  44. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  45. package/build/components/layout/index.js +6 -0
  46. package/build/components/layout/index.js.map +1 -1
  47. package/build/components/layout/router.js +14 -6
  48. package/build/components/layout/router.js.map +1 -1
  49. package/build/components/page-patterns/header.js +1 -1
  50. package/build/components/page-patterns/header.js.map +1 -1
  51. package/build/components/page-patterns/index.js +23 -11
  52. package/build/components/page-patterns/index.js.map +1 -1
  53. package/build/components/page-templates/index.js +41 -34
  54. package/build/components/page-templates/index.js.map +1 -1
  55. package/build/components/post-edit/index.js +105 -0
  56. package/build/components/post-edit/index.js.map +1 -0
  57. package/build/components/post-fields/index.js +314 -0
  58. package/build/components/post-fields/index.js.map +1 -0
  59. package/build/components/post-list/index.js +281 -0
  60. package/build/components/post-list/index.js.map +1 -0
  61. package/build/components/posts-app/router.js +3 -3
  62. package/build/components/posts-app/router.js.map +1 -1
  63. package/build/components/sidebar-dataviews/default-views.js +22 -10
  64. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  65. package/build/components/sidebar-dataviews/index.js +40 -1
  66. package/build/components/sidebar-dataviews/index.js.map +1 -1
  67. package/build/components/sidebar-navigation-screen-global-styles/content.js +64 -0
  68. package/build/components/sidebar-navigation-screen-global-styles/content.js.map +1 -0
  69. package/build/components/sidebar-navigation-screen-global-styles/index.js +2 -47
  70. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  71. package/build/hooks/push-changes-to-global-styles/index.js +1 -1
  72. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  73. package/build/index.js +5 -1
  74. package/build/index.js.map +1 -1
  75. package/build/store/selectors.js +34 -6
  76. package/build/store/selectors.js.map +1 -1
  77. package/build/utils/get-filtered-template-parts.js +64 -0
  78. package/build/utils/get-filtered-template-parts.js.map +1 -0
  79. package/build-module/components/add-new-pattern/index.js +8 -2
  80. package/build-module/components/add-new-pattern/index.js.map +1 -1
  81. package/build-module/components/add-new-template/index.js +3 -1
  82. package/build-module/components/add-new-template/index.js.map +1 -1
  83. package/build-module/components/block-editor/use-site-editor-settings.js +1 -82
  84. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  85. package/build-module/components/global-styles/block-preview-panel.js +14 -5
  86. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  87. package/build-module/components/global-styles/font-families.js +44 -25
  88. package/build-module/components/global-styles/font-families.js.map +1 -1
  89. package/build-module/components/global-styles/font-library-modal/index.js +4 -4
  90. package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
  91. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +61 -13
  92. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  93. package/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js +32 -0
  94. package/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js.map +1 -0
  95. package/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js +32 -0
  96. package/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js.map +1 -0
  97. package/build-module/components/global-styles/font-sizes/font-size-preview.js +37 -0
  98. package/build-module/components/global-styles/font-sizes/font-size-preview.js.map +1 -0
  99. package/build-module/components/global-styles/font-sizes/font-size.js +207 -0
  100. package/build-module/components/global-styles/font-sizes/font-size.js.map +1 -0
  101. package/build-module/components/global-styles/font-sizes/font-sizes-count.js +43 -0
  102. package/build-module/components/global-styles/font-sizes/font-sizes-count.js.map +1 -0
  103. package/build-module/components/global-styles/font-sizes/font-sizes.js +157 -0
  104. package/build-module/components/global-styles/font-sizes/font-sizes.js.map +1 -0
  105. package/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js +61 -0
  106. package/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js.map +1 -0
  107. package/build-module/components/global-styles/screen-block.js +10 -8
  108. package/build-module/components/global-styles/screen-block.js.map +1 -1
  109. package/build-module/components/global-styles/screen-style-variations.js +2 -2
  110. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  111. package/build-module/components/global-styles/screen-typography.js +3 -2
  112. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  113. package/build-module/components/global-styles/size-control/index.js +79 -0
  114. package/build-module/components/global-styles/size-control/index.js.map +1 -0
  115. package/build-module/components/global-styles/style-variations-container.js +3 -0
  116. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  117. package/build-module/components/global-styles/ui.js +8 -0
  118. package/build-module/components/global-styles/ui.js.map +1 -1
  119. package/build-module/components/global-styles/variations/variations-color.js +1 -1
  120. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  121. package/build-module/components/global-styles/variations/variations-typography.js +1 -2
  122. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  123. package/build-module/components/layout/index.js +6 -0
  124. package/build-module/components/layout/index.js.map +1 -1
  125. package/build-module/components/layout/router.js +14 -6
  126. package/build-module/components/layout/router.js.map +1 -1
  127. package/build-module/components/page-patterns/header.js +1 -1
  128. package/build-module/components/page-patterns/header.js.map +1 -1
  129. package/build-module/components/page-patterns/index.js +23 -11
  130. package/build-module/components/page-patterns/index.js.map +1 -1
  131. package/build-module/components/page-templates/index.js +43 -37
  132. package/build-module/components/page-templates/index.js.map +1 -1
  133. package/build-module/components/post-edit/index.js +98 -0
  134. package/build-module/components/post-edit/index.js.map +1 -0
  135. package/build-module/components/post-fields/index.js +306 -0
  136. package/build-module/components/post-fields/index.js.map +1 -0
  137. package/build-module/components/post-list/index.js +275 -0
  138. package/build-module/components/post-list/index.js.map +1 -0
  139. package/build-module/components/posts-app/router.js +3 -3
  140. package/build-module/components/posts-app/router.js.map +1 -1
  141. package/build-module/components/sidebar-dataviews/default-views.js +21 -9
  142. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  143. package/build-module/components/sidebar-dataviews/index.js +42 -3
  144. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  145. package/build-module/components/sidebar-navigation-screen-global-styles/content.js +57 -0
  146. package/build-module/components/sidebar-navigation-screen-global-styles/content.js.map +1 -0
  147. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +2 -47
  148. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  149. package/build-module/hooks/push-changes-to-global-styles/index.js +1 -1
  150. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  151. package/build-module/index.js +5 -1
  152. package/build-module/index.js.map +1 -1
  153. package/build-module/store/selectors.js +35 -7
  154. package/build-module/store/selectors.js.map +1 -1
  155. package/build-module/utils/get-filtered-template-parts.js +57 -0
  156. package/build-module/utils/get-filtered-template-parts.js.map +1 -0
  157. package/build-style/posts-rtl.css +581 -503
  158. package/build-style/posts.css +581 -503
  159. package/build-style/style-rtl.css +621 -519
  160. package/build-style/style.css +621 -519
  161. package/package.json +41 -41
  162. package/src/components/add-new-pattern/index.js +8 -2
  163. package/src/components/add-new-template/index.js +4 -1
  164. package/src/components/add-new-template/style.scss +4 -6
  165. package/src/components/block-editor/use-site-editor-settings.js +15 -111
  166. package/src/components/global-styles/block-preview-panel.js +22 -9
  167. package/src/components/global-styles/font-families.js +66 -31
  168. package/src/components/global-styles/font-library-modal/index.js +4 -2
  169. package/src/components/global-styles/font-library-modal/installed-fonts.js +92 -11
  170. package/src/components/global-styles/font-library-modal/style.scss +9 -0
  171. package/src/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js +43 -0
  172. package/src/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js +37 -0
  173. package/src/components/global-styles/font-sizes/font-size-preview.js +43 -0
  174. package/src/components/global-styles/font-sizes/font-size.js +250 -0
  175. package/src/components/global-styles/font-sizes/font-sizes-count.js +40 -0
  176. package/src/components/global-styles/font-sizes/font-sizes.js +263 -0
  177. package/src/components/global-styles/font-sizes/rename-font-size-dialog.js +70 -0
  178. package/src/components/global-styles/screen-block.js +12 -14
  179. package/src/components/global-styles/screen-style-variations.js +2 -2
  180. package/src/components/global-styles/screen-typography.js +3 -2
  181. package/src/components/global-styles/size-control/index.js +86 -0
  182. package/src/components/global-styles/style-variations-container.js +4 -0
  183. package/src/components/global-styles/style.scss +13 -3
  184. package/src/components/global-styles/ui.js +10 -0
  185. package/src/components/global-styles/variations/variations-color.js +1 -1
  186. package/src/components/global-styles/variations/variations-typography.js +1 -2
  187. package/src/components/layout/index.js +11 -0
  188. package/src/components/layout/router.js +13 -5
  189. package/src/components/layout/style.scss +26 -8
  190. package/src/components/page-patterns/header.js +1 -1
  191. package/src/components/page-patterns/index.js +15 -8
  192. package/src/components/page-templates/index.js +51 -46
  193. package/src/components/page-templates/style.scss +5 -3
  194. package/src/components/post-edit/index.js +96 -0
  195. package/src/components/post-edit/style.scss +9 -0
  196. package/src/components/post-fields/index.js +345 -0
  197. package/src/components/post-list/index.js +326 -0
  198. package/src/components/{posts-app → post-list}/style.scss +12 -9
  199. package/src/components/posts-app/router.js +3 -3
  200. package/src/components/sidebar-dataviews/default-views.js +21 -9
  201. package/src/components/sidebar-dataviews/index.js +36 -1
  202. package/src/components/sidebar-navigation-screen-global-styles/content.js +55 -0
  203. package/src/components/sidebar-navigation-screen-global-styles/index.js +1 -55
  204. package/src/hooks/push-changes-to-global-styles/index.js +1 -1
  205. package/src/index.js +7 -1
  206. package/src/posts.scss +1 -1
  207. package/src/store/selectors.js +53 -14
  208. package/src/store/test/selectors.js +1 -26
  209. package/src/style.scss +2 -1
  210. package/src/utils/get-filtered-template-parts.js +61 -0
  211. package/src/utils/test/get-filtered-template-parts.js +127 -0
  212. package/build/components/global-styles/screen-background.js +0 -36
  213. package/build/components/global-styles/screen-background.js.map +0 -1
  214. package/build/components/posts-app/posts-list.js +0 -568
  215. package/build/components/posts-app/posts-list.js.map +0 -1
  216. package/build-module/components/global-styles/screen-background.js +0 -30
  217. package/build-module/components/global-styles/screen-background.js.map +0 -1
  218. package/build-module/components/posts-app/posts-list.js +0 -560
  219. package/build-module/components/posts-app/posts-list.js.map +0 -1
  220. package/src/components/global-styles/screen-background.js +0 -29
  221. package/src/components/posts-app/posts-list.js +0 -651
@@ -1,16 +1,16 @@
1
- .posts-list-page__featured-image {
1
+ .edit-site-post-list__featured-image {
2
2
  height: 100%;
3
3
  object-fit: cover;
4
4
  width: 100%;
5
5
  }
6
6
 
7
- .posts-list-page__featured-image-wrapper {
7
+ .edit-site-post-list__featured-image-wrapper {
8
8
  height: 100%;
9
9
  width: 100%;
10
10
  border-radius: $grid-unit-05;
11
11
 
12
- &.is-layout-table:not(:has(.posts-list-page-preview-field__button)),
13
- &.is-layout-table .posts-list-page-preview-field__button {
12
+ &.is-layout-table:not(:has(.edit-site-post-list__featured-image-button)),
13
+ &.is-layout-table .edit-site-post-list__featured-image-button {
14
14
  width: $grid-unit-40;
15
15
  height: $grid-unit-40;
16
16
  display: block;
@@ -33,7 +33,7 @@
33
33
  }
34
34
  }
35
35
 
36
- .posts-list-page-preview-field__button {
36
+ .edit-site-post-list__featured-image-button {
37
37
  box-shadow: none;
38
38
  border: none;
39
39
  padding: 0;
@@ -53,18 +53,18 @@
53
53
  }
54
54
 
55
55
  .dataviews-view-grid__card.is-selected {
56
- .posts-list-page-preview-field__button::after {
56
+ .edit-site-post-list__featured-image-button::after {
57
57
  box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
58
58
  background: rgba(var(--wp-admin-theme-color--rgb), 0.04);
59
59
  }
60
60
  }
61
61
 
62
- .posts-list-page-title span {
62
+ .edit-site-post-list__title span {
63
63
  text-overflow: ellipsis;
64
64
  overflow: hidden;
65
65
  }
66
66
 
67
- .posts-list-page-title-badge {
67
+ .edit-site-post-list__title-badge {
68
68
  background: $gray-100;
69
69
  color: $gray-700;
70
70
  padding: 0 $grid-unit-05;
@@ -72,11 +72,14 @@
72
72
  font-size: 12px;
73
73
  font-weight: 400;
74
74
  flex-shrink: 0;
75
+ line-height: $grid-unit-05 * 5;
75
76
  }
76
77
 
77
- .posts-list-page-post-author-field__icon-container {
78
+ .edit-site-post-list__status-icon {
78
79
  height: $grid-unit-30;
80
+ width: $grid-unit-30;
79
81
  svg {
80
82
  fill: currentColor;
83
+ margin-left: -$grid-unit-05;
81
84
  }
82
85
  }
@@ -13,7 +13,7 @@ import Editor from '../editor';
13
13
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
14
14
  import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';
15
15
  import DataViewsSidebarContent from '../sidebar-dataviews';
16
- import PostsList from '../posts-app/posts-list';
16
+ import PostList from '../post-list';
17
17
 
18
18
  const { useLocation } = unlock( routerPrivateApis );
19
19
 
@@ -40,7 +40,7 @@ export default function useLayoutAreas() {
40
40
  content={ <DataViewsSidebarContent /> }
41
41
  />
42
42
  ),
43
- content: <PostsList postType={ postType } />,
43
+ content: <PostList postType={ postType } />,
44
44
  preview: ( isListLayout || canvas === 'edit' ) && (
45
45
  <Editor isPostsList />
46
46
  ),
@@ -48,7 +48,7 @@ export default function useLayoutAreas() {
48
48
  canvas === 'edit' ? (
49
49
  <Editor isPostsList />
50
50
  ) : (
51
- <PostsList postType={ postType } />
51
+ <PostList postType={ postType } />
52
52
  ),
53
53
  },
54
54
  widths: {
@@ -26,17 +26,31 @@ import {
26
26
  OPERATOR_IS_ANY,
27
27
  } from '../../utils/constants';
28
28
 
29
- export const DEFAULT_CONFIG_PER_VIEW_TYPE = {
29
+ export const defaultLayouts = {
30
30
  [ LAYOUT_TABLE ]: {
31
- primaryField: 'title',
31
+ layout: {
32
+ primaryField: 'title',
33
+ styles: {
34
+ 'featured-image': {
35
+ width: '1%',
36
+ },
37
+ title: {
38
+ maxWidth: 300,
39
+ },
40
+ },
41
+ },
32
42
  },
33
43
  [ LAYOUT_GRID ]: {
34
- mediaField: 'featured-image',
35
- primaryField: 'title',
44
+ layout: {
45
+ mediaField: 'featured-image',
46
+ primaryField: 'title',
47
+ },
36
48
  },
37
49
  [ LAYOUT_LIST ]: {
38
- primaryField: 'title',
39
- mediaField: 'featured-image',
50
+ layout: {
51
+ primaryField: 'title',
52
+ mediaField: 'featured-image',
53
+ },
40
54
  },
41
55
  };
42
56
 
@@ -51,9 +65,7 @@ const DEFAULT_POST_BASE = {
51
65
  direction: 'desc',
52
66
  },
53
67
  fields: [ 'title', 'author', 'status' ],
54
- layout: {
55
- ...DEFAULT_CONFIG_PER_VIEW_TYPE[ LAYOUT_LIST ],
56
- },
68
+ layout: defaultLayouts[ LAYOUT_LIST ].layout,
57
69
  };
58
70
 
59
71
  export function useDefaultViews( { postType } ) {
@@ -3,20 +3,55 @@
3
3
  */
4
4
  import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
5
5
  import { privateApis as routerPrivateApis } from '@wordpress/router';
6
+ import { useRef, useEffect } from '@wordpress/element';
7
+ import { usePrevious } from '@wordpress/compose';
6
8
 
7
9
  /**
8
10
  * Internal dependencies
9
11
  */
10
12
  import { useDefaultViews } from './default-views';
11
13
  import { unlock } from '../../lock-unlock';
12
- const { useLocation } = unlock( routerPrivateApis );
13
14
  import DataViewItem from './dataview-item';
14
15
  import CustomDataViewsList from './custom-dataviews-list';
15
16
 
17
+ const { useLocation, useHistory } = unlock( routerPrivateApis );
18
+
19
+ /**
20
+ * Hook to switch to table layout when switching to the trash view.
21
+ * When going out of the trash view, it switches back to the previous layout if
22
+ * there was an automatic switch to table layout.
23
+ */
24
+ function useSwitchToTableOnTrash() {
25
+ const {
26
+ params: { activeView, layout, ...restParams },
27
+ } = useLocation();
28
+ const history = useHistory();
29
+ const viewToSwitchOutOfTrash = useRef( undefined );
30
+ const previousActiveView = usePrevious( activeView );
31
+ useEffect( () => {
32
+ if ( activeView === 'trash' && previousActiveView !== 'trash' ) {
33
+ viewToSwitchOutOfTrash.current = layout || 'list';
34
+ history.push( { ...restParams, layout: 'table', activeView } );
35
+ } else if (
36
+ previousActiveView === 'trash' &&
37
+ activeView !== 'trash' &&
38
+ viewToSwitchOutOfTrash.current
39
+ ) {
40
+ history.push( {
41
+ ...restParams,
42
+ layout: viewToSwitchOutOfTrash.current,
43
+ activeView,
44
+ } );
45
+ viewToSwitchOutOfTrash.current = undefined;
46
+ }
47
+ }, [ previousActiveView, activeView, layout, history, restParams ] );
48
+ }
49
+
16
50
  export default function DataViewsSidebarContent() {
17
51
  const {
18
52
  params: { postType, activeView = 'all', isCustom = 'false' },
19
53
  } = useLocation();
54
+ useSwitchToTableOnTrash();
20
55
  const DEFAULT_VIEWS = useDefaultViews( { postType } );
21
56
  if ( ! postType ) {
22
57
  return null;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+ import { useSelect } from '@wordpress/data';
6
+ import { __experimentalVStack as VStack } from '@wordpress/components';
7
+ import { BlockEditorProvider } from '@wordpress/block-editor';
8
+
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+ import StyleVariationsContainer from '../global-styles/style-variations-container';
13
+ import { unlock } from '../../lock-unlock';
14
+ import { store as editSiteStore } from '../../store';
15
+ import ColorVariations from '../global-styles/variations/variations-color';
16
+ import TypographyVariations from '../global-styles/variations/variations-typography';
17
+
18
+ const noop = () => {};
19
+
20
+ export default function SidebarNavigationScreenGlobalStylesContent() {
21
+ const { storedSettings } = useSelect( ( select ) => {
22
+ const { getSettings } = unlock( select( editSiteStore ) );
23
+
24
+ return {
25
+ storedSettings: getSettings(),
26
+ };
27
+ }, [] );
28
+
29
+ const gap = 3;
30
+
31
+ // Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are
32
+ // loaded. This is necessary because the Iframe component waits until
33
+ // the block editor store's `__internalIsInitialized` is true before
34
+ // rendering the iframe. Without this, the iframe previews will not render
35
+ // in mobile viewport sizes, where the editor canvas is hidden.
36
+ return (
37
+ <BlockEditorProvider
38
+ settings={ storedSettings }
39
+ onChange={ noop }
40
+ onInput={ noop }
41
+ >
42
+ <VStack
43
+ spacing={ 10 }
44
+ className="edit-site-global-styles-variation-container"
45
+ >
46
+ <StyleVariationsContainer gap={ gap } />
47
+ <ColorVariations title={ __( 'Palettes' ) } gap={ gap } />
48
+ <TypographyVariations
49
+ title={ __( 'Typography' ) }
50
+ gap={ gap }
51
+ />
52
+ </VStack>
53
+ </BlockEditorProvider>
54
+ );
55
+ }
@@ -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,11 +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 { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
30
-
31
- const noop = () => {};
24
+ import SidebarNavigationScreenGlobalStylesContent from './content';
32
25
 
33
26
  export function SidebarNavigationItemGlobalStyles( props ) {
34
27
  const { openGeneralSidebar } = useDispatch( editSiteStore );
@@ -63,53 +56,6 @@ export function SidebarNavigationItemGlobalStyles( props ) {
63
56
  );
64
57
  }
65
58
 
66
- function SidebarNavigationScreenGlobalStylesContent() {
67
- const { storedSettings } = useSelect( ( select ) => {
68
- const { getSettings } = unlock( select( editSiteStore ) );
69
-
70
- return {
71
- storedSettings: getSettings(),
72
- };
73
- }, [] );
74
-
75
- const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig( [
76
- 'color',
77
- ] );
78
- const typographyVariations =
79
- useCurrentMergeThemeStyleVariationsWithUserConfig( [ 'typography' ] );
80
-
81
- const gap = 3;
82
-
83
- // Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are
84
- // loaded. This is necessary because the Iframe component waits until
85
- // the block editor store's `__internalIsInitialized` is true before
86
- // rendering the iframe. Without this, the iframe previews will not render
87
- // in mobile viewport sizes, where the editor canvas is hidden.
88
- return (
89
- <BlockEditorProvider
90
- settings={ storedSettings }
91
- onChange={ noop }
92
- onInput={ noop }
93
- >
94
- <VStack
95
- spacing={ 10 }
96
- className="edit-site-global-styles-variation-container"
97
- >
98
- <StyleVariationsContainer gap={ gap } />
99
- { colorVariations?.length && (
100
- <ColorVariations title={ __( 'Palettes' ) } gap={ gap } />
101
- ) }
102
- { typographyVariations?.length && (
103
- <TypographyVariations
104
- title={ __( 'Typography' ) }
105
- gap={ gap }
106
- />
107
- ) }
108
- </VStack>
109
- </BlockEditorProvider>
110
- );
111
- }
112
-
113
59
  export default function SidebarNavigationScreenGlobalStyles( { backPath } ) {
114
60
  const { revisions, isLoading: isLoadingRevisions } =
115
61
  useGlobalStylesRevisions();
@@ -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
  )
package/src/index.js CHANGED
@@ -28,7 +28,11 @@ import { store as editSiteStore } from './store';
28
28
  import { unlock } from './lock-unlock';
29
29
  import App from './components/app';
30
30
 
31
- const { registerDefaultActions } = unlock( editorPrivateApis );
31
+ const {
32
+ registerDefaultActions,
33
+ registerCoreBlockBindingsSources,
34
+ bootstrapBlockBindingsSourcesFromServer,
35
+ } = unlock( editorPrivateApis );
32
36
 
33
37
  /**
34
38
  * Initializes the site editor screen.
@@ -45,6 +49,8 @@ export function initializeEditor( id, settings ) {
45
49
  ( { name } ) => name !== 'core/freeform'
46
50
  );
47
51
  registerCoreBlocks( coreBlocks );
52
+ bootstrapBlockBindingsSourcesFromServer( settings?.blockBindingsSources );
53
+ registerCoreBlockBindingsSources();
48
54
  dispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );
49
55
  registerLegacyWidgetBlock( { inserter: false } );
50
56
  registerWidgetGroupBlock( { inserter: false } );
package/src/posts.scss CHANGED
@@ -7,7 +7,7 @@
7
7
  @import "./components/site-hub/style.scss";
8
8
  @import "./components/site-icon/style.scss";
9
9
  @import "./components/editor-canvas-container/style.scss";
10
- @import "./components/posts-app/style.scss";
10
+ @import "./components/post-list/style.scss";
11
11
  @import "./components/resizable-frame/style.scss";
12
12
 
13
13
  @include wordpress-admin-schemes();
@@ -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.
@@ -71,7 +74,17 @@ export const __experimentalGetPreviewDeviceType = createRegistrySelector(
71
74
  * @return {Object} Whether the current user can create media or not.
72
75
  */
73
76
  export const getCanUserCreateMedia = createRegistrySelector(
74
- ( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )
77
+ ( select ) => () => {
78
+ deprecated(
79
+ `wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`,
80
+ {
81
+ since: '6.7',
82
+ alternative: `wp.data.select( 'core' ).canUser( 'create', { kind: 'root', type: 'media' } )`,
83
+ }
84
+ );
85
+
86
+ return select( coreDataStore ).canUser( 'create', 'media' );
87
+ }
75
88
  );
76
89
 
77
90
  /**
@@ -82,13 +95,11 @@ export const getCanUserCreateMedia = createRegistrySelector(
82
95
  * @return {Array} The available reusable blocks.
83
96
  */
84
97
  export const getReusableBlocks = createRegistrySelector( ( select ) => () => {
85
- deprecated(
86
- "select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )",
87
- {
88
- since: '6.5',
89
- version: '6.8',
90
- }
91
- );
98
+ deprecated( `select( 'core/edit-site' ).getReusableBlocks()`, {
99
+ since: '6.5',
100
+ version: '6.8',
101
+ alternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )`,
102
+ } );
92
103
  const isWeb = Platform.OS === 'web';
93
104
  return isWeb
94
105
  ? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {
@@ -232,18 +243,46 @@ export function isSaveViewOpened( state ) {
232
243
  return state.saveViewPanel;
233
244
  }
234
245
 
246
+ function getBlocksAndTemplateParts( select ) {
247
+ const templateParts = select( coreDataStore ).getEntityRecords(
248
+ 'postType',
249
+ TEMPLATE_PART_POST_TYPE,
250
+ { per_page: -1 }
251
+ );
252
+
253
+ const { getBlocksByName, getBlocksByClientId } = select( blockEditorStore );
254
+
255
+ const clientIds = getBlocksByName( 'core/template-part' );
256
+ const blocks = getBlocksByClientId( clientIds );
257
+ return [ blocks, templateParts ];
258
+ }
259
+
235
260
  /**
236
261
  * Returns the template parts and their blocks for the current edited template.
237
262
  *
263
+ * @deprecated
238
264
  * @param {Object} state Global application state.
239
265
  * @return {Array} Template parts and their blocks in an array.
240
266
  */
241
267
  export const getCurrentTemplateTemplateParts = createRegistrySelector(
242
- ( select ) => () => {
243
- return unlock(
244
- select( editorStore )
245
- ).getCurrentTemplateTemplateParts();
246
- }
268
+ ( select ) =>
269
+ createSelector(
270
+ () => {
271
+ deprecated(
272
+ `select( 'core/edit-site' ).getCurrentTemplateTemplateParts()`,
273
+ {
274
+ since: '6.7',
275
+ version: '6.9',
276
+ alternative: `select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )`,
277
+ }
278
+ );
279
+
280
+ return getFilteredTemplatePartBlocks(
281
+ ...getBlocksAndTemplateParts( select )
282
+ );
283
+ },
284
+ () => getBlocksAndTemplateParts( select )
285
+ )
247
286
  );
248
287
 
249
288
  /**
@@ -1,34 +1,9 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { store as coreDataStore } from '@wordpress/core-data';
5
-
6
1
  /**
7
2
  * Internal dependencies
8
3
  */
9
- import {
10
- getCanUserCreateMedia,
11
- getEditedPostType,
12
- getEditedPostId,
13
- isPage,
14
- } from '../selectors';
4
+ import { getEditedPostType, getEditedPostId, isPage } from '../selectors';
15
5
 
16
6
  describe( 'selectors', () => {
17
- const canUser = jest.fn( () => true );
18
- getCanUserCreateMedia.registry = {
19
- select: jest.fn( () => ( { canUser } ) ),
20
- };
21
-
22
- describe( 'getCanUserCreateMedia', () => {
23
- it( "selects `canUser( 'create', 'media' )` from the core store", () => {
24
- expect( getCanUserCreateMedia() ).toBe( true );
25
- expect(
26
- getCanUserCreateMedia.registry.select
27
- ).toHaveBeenCalledWith( coreDataStore );
28
- expect( canUser ).toHaveBeenCalledWith( 'create', 'media' );
29
- } );
30
- } );
31
-
32
7
  describe( 'getEditedPostId', () => {
33
8
  it( 'returns the template ID', () => {
34
9
  const state = { editedPost: { id: 10 } };
package/src/style.scss CHANGED
@@ -28,7 +28,8 @@
28
28
  @import "./components/site-icon/style.scss";
29
29
  @import "./components/style-book/style.scss";
30
30
  @import "./components/editor-canvas-container/style.scss";
31
- @import "./components/posts-app/style.scss";
31
+ @import "./components/post-edit/style.scss";
32
+ @import "./components/post-list/style.scss";
32
33
  @import "./components/resizable-frame/style.scss";
33
34
  @import "./hooks/push-changes-to-global-styles/style.scss";
34
35
  @import "./components/global-styles/font-library-modal/style.scss";
@@ -0,0 +1,61 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { isTemplatePart } from '@wordpress/blocks';
5
+
6
+ const EMPTY_ARRAY = [];
7
+
8
+ /**
9
+ * Get a flattened and filtered list of template parts and the matching block for that template part.
10
+ *
11
+ * Takes a list of blocks defined within a template, and a list of template parts, and returns a
12
+ * flattened list of template parts and the matching block for that template part.
13
+ *
14
+ * @param {Array} blocks Blocks to flatten.
15
+ * @param {?Array} templateParts Available template parts.
16
+ * @return {Array} An array of template parts and their blocks.
17
+ */
18
+ export default function getFilteredTemplatePartBlocks(
19
+ blocks = EMPTY_ARRAY,
20
+ templateParts
21
+ ) {
22
+ const templatePartsById = templateParts
23
+ ? // Key template parts by their ID.
24
+ templateParts.reduce(
25
+ ( newTemplateParts, part ) => ( {
26
+ ...newTemplateParts,
27
+ [ part.id ]: part,
28
+ } ),
29
+ {}
30
+ )
31
+ : {};
32
+
33
+ const result = [];
34
+
35
+ // Iterate over all blocks, recursing into inner blocks.
36
+ // Output will be based on a depth-first traversal.
37
+ const stack = [ ...blocks ];
38
+ while ( stack.length ) {
39
+ const { innerBlocks, ...block } = stack.shift();
40
+ // Place inner blocks at the beginning of the stack to preserve order.
41
+ stack.unshift( ...innerBlocks );
42
+
43
+ if ( isTemplatePart( block ) ) {
44
+ const {
45
+ attributes: { theme, slug },
46
+ } = block;
47
+ const templatePartId = `${ theme }//${ slug }`;
48
+ const templatePart = templatePartsById[ templatePartId ];
49
+
50
+ // Only add to output if the found template part block is in the list of available template parts.
51
+ if ( templatePart ) {
52
+ result.push( {
53
+ templatePart,
54
+ block,
55
+ } );
56
+ }
57
+ }
58
+ }
59
+
60
+ return result;
61
+ }