@wordpress/edit-site 5.12.4 → 5.12.6

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 (264) hide show
  1. package/build/components/add-new-template/new-template.js +1 -1
  2. package/build/components/add-new-template/new-template.js.map +1 -1
  3. package/build/components/block-editor/editor-canvas.js +1 -1
  4. package/build/components/block-editor/editor-canvas.js.map +1 -1
  5. package/build/components/create-pattern-modal/index.js +7 -7
  6. package/build/components/create-pattern-modal/index.js.map +1 -1
  7. package/build/components/header-edit-mode/document-actions/index.js +9 -1
  8. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  9. package/build/components/page/index.js +3 -1
  10. package/build/components/page/index.js.map +1 -1
  11. package/build/components/page-main/index.js +8 -4
  12. package/build/components/page-main/index.js.map +1 -1
  13. package/build/components/{page-library → page-patterns}/grid-item.js +52 -27
  14. package/build/components/page-patterns/grid-item.js.map +1 -0
  15. package/build/components/{page-library → page-patterns}/grid.js +1 -1
  16. package/build/components/page-patterns/grid.js.map +1 -0
  17. package/build/components/{page-library → page-patterns}/index.js +6 -6
  18. package/build/components/page-patterns/index.js.map +1 -0
  19. package/build/components/{page-library → page-patterns}/no-patterns.js +1 -1
  20. package/build/components/page-patterns/no-patterns.js.map +1 -0
  21. package/build/components/{page-library → page-patterns}/patterns-list.js +6 -6
  22. package/build/components/page-patterns/patterns-list.js.map +1 -0
  23. package/build/components/page-patterns/search-items.js.map +1 -0
  24. package/build/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +3 -3
  25. package/build/components/page-patterns/use-pattern-settings.js.map +1 -0
  26. package/build/components/{page-library → page-patterns}/use-patterns.js +12 -2
  27. package/build/components/page-patterns/use-patterns.js.map +1 -0
  28. package/build/components/{page-library → page-patterns}/utils.js +3 -3
  29. package/build/components/page-patterns/utils.js.map +1 -0
  30. package/build/components/page-template-parts/index.js +102 -0
  31. package/build/components/page-template-parts/index.js.map +1 -0
  32. package/build/components/sidebar/index.js +6 -6
  33. package/build/components/sidebar/index.js.map +1 -1
  34. package/build/components/sidebar-edit-mode/settings-header/index.js +7 -1
  35. package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  36. package/build/components/sidebar-navigation-screen-global-styles/index.js +20 -8
  37. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  38. package/build/components/sidebar-navigation-screen-main/index.js +2 -2
  39. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  40. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +2 -4
  41. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  42. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +16 -4
  43. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  44. package/build/components/sidebar-navigation-screen-pages/index.js +1 -1
  45. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  46. package/build/components/sidebar-navigation-screen-pattern/index.js +13 -8
  47. package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  48. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +23 -0
  49. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  50. package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
  51. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
  52. package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/index.js +55 -15
  53. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
  54. package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
  55. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +30 -0
  56. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
  57. package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +2 -20
  58. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
  59. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
  60. package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
  61. package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
  62. package/build/components/sidebar-navigation-screen-templates/index.js +11 -63
  63. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  64. package/build/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
  65. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  66. package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
  67. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  68. package/build/components/welcome-guide/editor.js +1 -1
  69. package/build/components/welcome-guide/editor.js.map +1 -1
  70. package/build/components/welcome-guide/index.js +5 -1
  71. package/build/components/welcome-guide/index.js.map +1 -1
  72. package/build/components/welcome-guide/page.js +70 -0
  73. package/build/components/welcome-guide/page.js.map +1 -0
  74. package/build/components/welcome-guide/styles.js +1 -1
  75. package/build/components/welcome-guide/styles.js.map +1 -1
  76. package/build/components/welcome-guide/template.js +71 -0
  77. package/build/components/welcome-guide/template.js.map +1 -0
  78. package/build/hooks/commands/use-common-commands.js +17 -2
  79. package/build/hooks/commands/use-common-commands.js.map +1 -1
  80. package/build/hooks/commands/use-edit-mode-commands.js +2 -1
  81. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  82. package/build/index.js +2 -0
  83. package/build/index.js.map +1 -1
  84. package/build/store/actions.js +5 -2
  85. package/build/store/actions.js.map +1 -1
  86. package/build/utils/get-is-list-page.js +2 -2
  87. package/build/utils/get-is-list-page.js.map +1 -1
  88. package/build-module/components/add-new-template/new-template.js +2 -2
  89. package/build-module/components/add-new-template/new-template.js.map +1 -1
  90. package/build-module/components/block-editor/editor-canvas.js +1 -1
  91. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  92. package/build-module/components/create-pattern-modal/index.js +7 -7
  93. package/build-module/components/create-pattern-modal/index.js.map +1 -1
  94. package/build-module/components/header-edit-mode/document-actions/index.js +10 -2
  95. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  96. package/build-module/components/page/index.js +2 -1
  97. package/build-module/components/page/index.js.map +1 -1
  98. package/build-module/components/page-main/index.js +6 -3
  99. package/build-module/components/page-main/index.js.map +1 -1
  100. package/build-module/components/{page-library → page-patterns}/grid-item.js +56 -29
  101. package/build-module/components/page-patterns/grid-item.js.map +1 -0
  102. package/build-module/components/{page-library → page-patterns}/grid.js +1 -1
  103. package/build-module/components/page-patterns/grid.js.map +1 -0
  104. package/build-module/components/{page-library → page-patterns}/index.js +5 -5
  105. package/build-module/components/page-patterns/index.js.map +1 -0
  106. package/build-module/components/{page-library → page-patterns}/no-patterns.js +1 -1
  107. package/build-module/components/page-patterns/no-patterns.js.map +1 -0
  108. package/build-module/components/{page-library → page-patterns}/patterns-list.js +6 -6
  109. package/build-module/components/page-patterns/patterns-list.js.map +1 -0
  110. package/build-module/components/page-patterns/search-items.js.map +1 -0
  111. package/build-module/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +2 -2
  112. package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -0
  113. package/build-module/components/{page-library → page-patterns}/use-patterns.js +12 -2
  114. package/build-module/components/page-patterns/use-patterns.js.map +1 -0
  115. package/build-module/components/{page-library → page-patterns}/utils.js +3 -3
  116. package/build-module/components/page-patterns/utils.js.map +1 -0
  117. package/build-module/components/page-template-parts/index.js +81 -0
  118. package/build-module/components/page-template-parts/index.js.map +1 -0
  119. package/build-module/components/sidebar/index.js +5 -5
  120. package/build-module/components/sidebar/index.js.map +1 -1
  121. package/build-module/components/sidebar-edit-mode/settings-header/index.js +6 -1
  122. package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  123. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +19 -8
  124. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  125. package/build-module/components/sidebar-navigation-screen-main/index.js +2 -2
  126. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  127. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +2 -4
  128. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  129. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +15 -5
  130. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  131. package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -2
  132. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  133. package/build-module/components/sidebar-navigation-screen-pattern/index.js +12 -7
  134. package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  135. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +21 -0
  136. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  137. package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
  138. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
  139. package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/index.js +54 -16
  140. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
  141. package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
  142. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +20 -0
  143. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
  144. package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +2 -17
  145. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
  146. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
  147. package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
  148. package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
  149. package/build-module/components/sidebar-navigation-screen-templates/index.js +12 -62
  150. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  151. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
  152. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  153. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
  154. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  155. package/build-module/components/welcome-guide/editor.js +1 -1
  156. package/build-module/components/welcome-guide/editor.js.map +1 -1
  157. package/build-module/components/welcome-guide/index.js +3 -1
  158. package/build-module/components/welcome-guide/index.js.map +1 -1
  159. package/build-module/components/welcome-guide/page.js +59 -0
  160. package/build-module/components/welcome-guide/page.js.map +1 -0
  161. package/build-module/components/welcome-guide/styles.js +1 -1
  162. package/build-module/components/welcome-guide/styles.js.map +1 -1
  163. package/build-module/components/welcome-guide/template.js +60 -0
  164. package/build-module/components/welcome-guide/template.js.map +1 -0
  165. package/build-module/hooks/commands/use-common-commands.js +16 -2
  166. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  167. package/build-module/hooks/commands/use-edit-mode-commands.js +2 -1
  168. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  169. package/build-module/index.js +2 -0
  170. package/build-module/index.js.map +1 -1
  171. package/build-module/store/actions.js +5 -2
  172. package/build-module/store/actions.js.map +1 -1
  173. package/build-module/utils/get-is-list-page.js +2 -2
  174. package/build-module/utils/get-is-list-page.js.map +1 -1
  175. package/build-style/style-rtl.css +43 -26
  176. package/build-style/style.css +43 -26
  177. package/package.json +19 -19
  178. package/src/components/add-new-template/new-template.js +2 -2
  179. package/src/components/block-editor/editor-canvas.js +3 -1
  180. package/src/components/create-pattern-modal/index.js +10 -11
  181. package/src/components/header-edit-mode/document-actions/index.js +9 -1
  182. package/src/components/page/index.js +5 -1
  183. package/src/components/page-main/index.js +6 -3
  184. package/src/components/{page-library → page-patterns}/grid-item.js +74 -24
  185. package/src/components/{page-library → page-patterns}/grid.js +1 -1
  186. package/src/components/{page-library → page-patterns}/index.js +5 -5
  187. package/src/components/{page-library → page-patterns}/no-patterns.js +1 -1
  188. package/src/components/{page-library → page-patterns}/patterns-list.js +6 -6
  189. package/src/components/{page-library → page-patterns}/style.scss +16 -12
  190. package/src/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +1 -1
  191. package/src/components/{page-library → page-patterns}/use-patterns.js +11 -2
  192. package/src/components/{page-library → page-patterns}/utils.js +3 -3
  193. package/src/components/page-template-parts/index.js +105 -0
  194. package/src/components/sidebar/index.js +6 -6
  195. package/src/components/sidebar-edit-mode/settings-header/index.js +7 -2
  196. package/src/components/sidebar-navigation-screen-global-styles/index.js +26 -15
  197. package/src/components/sidebar-navigation-screen-main/index.js +2 -2
  198. package/src/components/sidebar-navigation-screen-navigation-menu/index.js +2 -6
  199. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +12 -4
  200. package/src/components/sidebar-navigation-screen-pages/index.js +2 -2
  201. package/src/components/sidebar-navigation-screen-pattern/index.js +13 -6
  202. package/src/components/sidebar-navigation-screen-pattern/style.scss +4 -0
  203. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +43 -1
  204. package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
  205. package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/index.js +75 -22
  206. package/src/components/sidebar-navigation-screen-patterns/style.scss +3 -0
  207. package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +23 -0
  208. package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +1 -18
  209. package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
  210. package/src/components/sidebar-navigation-screen-templates/index.js +15 -82
  211. package/src/components/sidebar-navigation-screen-templates-browse/index.js +2 -0
  212. package/src/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
  213. package/src/components/welcome-guide/editor.js +1 -1
  214. package/src/components/welcome-guide/index.js +4 -0
  215. package/src/components/welcome-guide/page.js +75 -0
  216. package/src/components/welcome-guide/style.scss +15 -1
  217. package/src/components/welcome-guide/styles.js +1 -1
  218. package/src/components/welcome-guide/template.js +82 -0
  219. package/src/hooks/commands/use-common-commands.js +13 -1
  220. package/src/hooks/commands/use-edit-mode-commands.js +5 -1
  221. package/src/index.js +2 -0
  222. package/src/store/actions.js +8 -1
  223. package/src/style.scss +2 -2
  224. package/src/utils/get-is-list-page.js +4 -3
  225. package/build/components/page-library/grid-item.js.map +0 -1
  226. package/build/components/page-library/grid.js.map +0 -1
  227. package/build/components/page-library/index.js.map +0 -1
  228. package/build/components/page-library/no-patterns.js.map +0 -1
  229. package/build/components/page-library/patterns-list.js.map +0 -1
  230. package/build/components/page-library/search-items.js.map +0 -1
  231. package/build/components/page-library/use-library-settings.js.map +0 -1
  232. package/build/components/page-library/use-patterns.js.map +0 -1
  233. package/build/components/page-library/utils.js.map +0 -1
  234. package/build/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
  235. package/build/components/sidebar-navigation-screen-library/index.js.map +0 -1
  236. package/build/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
  237. package/build/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
  238. package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
  239. package/build/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
  240. package/build-module/components/page-library/grid-item.js.map +0 -1
  241. package/build-module/components/page-library/grid.js.map +0 -1
  242. package/build-module/components/page-library/index.js.map +0 -1
  243. package/build-module/components/page-library/no-patterns.js.map +0 -1
  244. package/build-module/components/page-library/patterns-list.js.map +0 -1
  245. package/build-module/components/page-library/search-items.js.map +0 -1
  246. package/build-module/components/page-library/use-library-settings.js.map +0 -1
  247. package/build-module/components/page-library/use-patterns.js.map +0 -1
  248. package/build-module/components/page-library/utils.js.map +0 -1
  249. package/build-module/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
  250. package/build-module/components/sidebar-navigation-screen-library/index.js.map +0 -1
  251. package/build-module/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
  252. package/build-module/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
  253. package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
  254. package/build-module/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
  255. package/src/components/sidebar-navigation-screen-library/style.scss +0 -3
  256. /package/build/components/{page-library → page-patterns}/search-items.js +0 -0
  257. /package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
  258. /package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-template-part-areas.js +0 -0
  259. /package/build-module/components/{page-library → page-patterns}/search-items.js +0 -0
  260. /package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
  261. /package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-template-part-areas.js +0 -0
  262. /package/src/components/{page-library → page-patterns}/search-items.js +0 -0
  263. /package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
  264. /package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-template-part-areas.js +0 -0
@@ -20,6 +20,7 @@ import {
20
20
  chevronLeftSmall as chevronLeftSmallIcon,
21
21
  page as pageIcon,
22
22
  navigation as navigationIcon,
23
+ symbol,
23
24
  } from '@wordpress/icons';
24
25
  import { displayShortcut } from '@wordpress/keycodes';
25
26
  import { useState, useEffect, useRef } from '@wordpress/element';
@@ -118,10 +119,17 @@ function TemplateDocumentActions( { className, onBack } ) {
118
119
 
119
120
  const entityLabel = getEntityLabel( record.type );
120
121
 
122
+ let typeIcon = icon;
123
+ if ( record.type === 'wp_navigation' ) {
124
+ typeIcon = navigationIcon;
125
+ } else if ( record.type === 'wp_block' ) {
126
+ typeIcon = symbol;
127
+ }
128
+
121
129
  return (
122
130
  <BaseDocumentActions
123
131
  className={ className }
124
- icon={ record.type === 'wp_navigation' ? navigationIcon : icon }
132
+ icon={ typeIcon }
125
133
  onBack={ onBack }
126
134
  >
127
135
  <VisuallyHidden as="span">
@@ -7,6 +7,7 @@ import classnames from 'classnames';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { NavigableRegion } from '@wordpress/interface';
10
+ import { EditorSnackbars } from '@wordpress/editor';
10
11
 
11
12
  /**
12
13
  * Internal dependencies
@@ -32,7 +33,10 @@ export default function Page( {
32
33
  actions={ actions }
33
34
  />
34
35
  ) }
35
- <div className="edit-site-page-content">{ children }</div>
36
+ <div className="edit-site-page-content">
37
+ { children }
38
+ <EditorSnackbars />
39
+ </div>
36
40
  </NavigableRegion>
37
41
  );
38
42
  }
@@ -6,8 +6,9 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
6
6
  /**
7
7
  * Internal dependencies
8
8
  */
9
+ import PagePatterns from '../page-patterns';
10
+ import PageTemplateParts from '../page-template-parts';
9
11
  import PageTemplates from '../page-templates';
10
- import PageLibrary from '../page-library';
11
12
  import { unlock } from '../../lock-unlock';
12
13
 
13
14
  const { useLocation } = unlock( routerPrivateApis );
@@ -19,8 +20,10 @@ export default function PageMain() {
19
20
 
20
21
  if ( path === '/wp_template/all' ) {
21
22
  return <PageTemplates />;
22
- } else if ( path === '/library' ) {
23
- return <PageLibrary />;
23
+ } else if ( path === '/wp_template_part/all' ) {
24
+ return <PageTemplateParts />;
25
+ } else if ( path === '/patterns' ) {
26
+ return <PagePatterns />;
24
27
  }
25
28
 
26
29
  return null;
@@ -15,12 +15,20 @@ import {
15
15
  __experimentalHeading as Heading,
16
16
  __experimentalHStack as HStack,
17
17
  __unstableCompositeItem as CompositeItem,
18
+ Tooltip,
19
+ Flex,
18
20
  } from '@wordpress/components';
19
- import { useInstanceId } from '@wordpress/compose';
20
21
  import { useDispatch } from '@wordpress/data';
21
- import { useState } from '@wordpress/element';
22
+ import { useState, useId } from '@wordpress/element';
22
23
  import { __, sprintf } from '@wordpress/i18n';
23
- import { Icon, moreHorizontal } from '@wordpress/icons';
24
+ import {
25
+ Icon,
26
+ header,
27
+ footer,
28
+ symbolFilled,
29
+ moreHorizontal,
30
+ lockSmall,
31
+ } from '@wordpress/icons';
24
32
  import { store as noticesStore } from '@wordpress/notices';
25
33
  import { store as reusableBlocksStore } from '@wordpress/reusable-blocks';
26
34
  import { DELETE, BACKSPACE } from '@wordpress/keycodes';
@@ -31,9 +39,10 @@ import { DELETE, BACKSPACE } from '@wordpress/keycodes';
31
39
  import { PATTERNS, USER_PATTERNS } from './utils';
32
40
  import { useLink } from '../routes/link';
33
41
 
42
+ const THEME_PATTERN_TOOLTIP = __( 'Theme patterns cannot be edited.' );
43
+
34
44
  export default function GridItem( { categoryId, composite, icon, item } ) {
35
- const instanceId = useInstanceId( GridItem );
36
- const descriptionId = `edit-site-library__pattern-description-${ instanceId }`;
45
+ const descriptionId = useId();
37
46
  const [ isDeleteDialogOpen, setIsDeleteDialogOpen ] = useState( false );
38
47
 
39
48
  const { __experimentalDeleteReusableBlock } =
@@ -46,7 +55,6 @@ export default function GridItem( { categoryId, composite, icon, item } ) {
46
55
  postId: item.type === USER_PATTERNS ? item.id : item.name,
47
56
  categoryId,
48
57
  categoryType: item.type,
49
- canvas: 'view',
50
58
  } );
51
59
 
52
60
  const onKeyDown = ( event ) => {
@@ -56,10 +64,10 @@ export default function GridItem( { categoryId, composite, icon, item } ) {
56
64
  };
57
65
 
58
66
  const isEmpty = ! item.blocks?.length;
59
- const patternClassNames = classnames( 'edit-site-library__pattern', {
67
+ const patternClassNames = classnames( 'edit-site-patterns__pattern', {
60
68
  'is-placeholder': isEmpty,
61
69
  } );
62
- const previewClassNames = classnames( 'edit-site-library__preview', {
70
+ const previewClassNames = classnames( 'edit-site-patterns__preview', {
63
71
  'is-inactive': item.type === PATTERNS,
64
72
  } );
65
73
 
@@ -79,14 +87,26 @@ export default function GridItem( { categoryId, composite, icon, item } ) {
79
87
  };
80
88
 
81
89
  const isUserPattern = item.type === USER_PATTERNS;
82
- let ariaDescription;
90
+ const ariaDescriptions = [];
83
91
  if ( isUserPattern ) {
84
92
  // User patterns don't have descriptions, but can be edited and deleted, so include some help text.
85
- ariaDescription = __(
86
- 'Press Enter to edit, or Delete to delete the pattern.'
93
+ ariaDescriptions.push(
94
+ __( 'Press Enter to edit, or Delete to delete the pattern.' )
87
95
  );
88
96
  } else if ( item.description ) {
89
- ariaDescription = item.description;
97
+ ariaDescriptions.push( item.description );
98
+ }
99
+ if ( item.type === PATTERNS ) {
100
+ ariaDescriptions.push( THEME_PATTERN_TOOLTIP );
101
+ }
102
+
103
+ let itemIcon = icon;
104
+ if ( categoryId === 'header' ) {
105
+ itemIcon = header;
106
+ } else if ( categoryId === 'footer' ) {
107
+ itemIcon = footer;
108
+ } else if ( categoryId === 'uncategorized' ) {
109
+ itemIcon = symbolFilled;
90
110
  }
91
111
 
92
112
  return (
@@ -101,43 +121,73 @@ export default function GridItem( { categoryId, composite, icon, item } ) {
101
121
  onKeyDown={ isUserPattern ? onKeyDown : undefined }
102
122
  aria-label={ item.title }
103
123
  aria-describedby={
104
- ariaDescription ? descriptionId : undefined
124
+ ariaDescriptions.length
125
+ ? ariaDescriptions.join( ' ' )
126
+ : undefined
105
127
  }
106
128
  >
107
129
  { isEmpty && __( 'Empty pattern' ) }
108
130
  { ! isEmpty && <BlockPreview blocks={ item.blocks } /> }
109
131
  </CompositeItem>
110
- { ariaDescription && (
132
+ { ariaDescriptions.map( ( ariaDescription, index ) => (
111
133
  <div
112
- aria-hidden="true"
113
- style={ { display: 'none' } }
114
- id={ descriptionId }
134
+ key={ index }
135
+ hidden
136
+ id={ `${ descriptionId }-${ index }` }
115
137
  >
116
138
  { ariaDescription }
117
139
  </div>
118
- ) }
140
+ ) ) }
119
141
  <HStack
120
142
  aria-hidden="true"
121
- className="edit-site-library__footer"
143
+ className="edit-site-patterns__footer"
122
144
  justify="space-between"
123
145
  >
124
146
  <HStack
125
147
  alignment="center"
126
148
  justify="left"
127
149
  spacing={ 3 }
128
- className="edit-site-library__pattern-title"
150
+ className="edit-site-patterns__pattern-title"
129
151
  >
130
- { icon && <Icon icon={ icon } /> }
131
- <Heading level={ 5 }>{ item.title }</Heading>
152
+ { icon && (
153
+ <Icon
154
+ className="edit-site-patterns__pattern-icon"
155
+ icon={ itemIcon }
156
+ />
157
+ ) }
158
+ <Flex
159
+ as={ Heading }
160
+ level={ 5 }
161
+ gap={ 0 }
162
+ justify="left"
163
+ >
164
+ { item.title }
165
+ { item.type === PATTERNS && (
166
+ <Tooltip
167
+ position="top center"
168
+ text={ __(
169
+ 'Theme patterns cannot be edited.'
170
+ ) }
171
+ >
172
+ <span className="edit-site-patterns__pattern-lock-icon">
173
+ <Icon
174
+ style={ { fill: 'currentcolor' } }
175
+ icon={ lockSmall }
176
+ size={ 24 }
177
+ />
178
+ </span>
179
+ </Tooltip>
180
+ ) }
181
+ </Flex>
132
182
  </HStack>
133
183
  { item.type === USER_PATTERNS && (
134
184
  <DropdownMenu
135
185
  icon={ moreHorizontal }
136
186
  label={ __( 'Actions' ) }
137
- className="edit-site-library__dropdown"
187
+ className="edit-site-patterns__dropdown"
138
188
  popoverProps={ { placement: 'bottom-end' } }
139
189
  toggleProps={ {
140
- className: 'edit-site-library__button',
190
+ className: 'edit-site-patterns__button',
141
191
  isSmall: true,
142
192
  describedBy: sprintf(
143
193
  /* translators: %s: pattern name */
@@ -22,7 +22,7 @@ export default function Grid( { categoryId, label, icon, items } ) {
22
22
  <Composite
23
23
  { ...composite }
24
24
  role="listbox"
25
- className="edit-site-library__grid"
25
+ className="edit-site-patterns__grid"
26
26
  aria-label={ label }
27
27
  >
28
28
  { items.map( ( item ) => (
@@ -11,16 +11,16 @@ import { getQueryArgs } from '@wordpress/url';
11
11
  import { DEFAULT_CATEGORY, DEFAULT_TYPE } from './utils';
12
12
  import Page from '../page';
13
13
  import PatternsList from './patterns-list';
14
- import useLibrarySettings from './use-library-settings';
14
+ import usePatternSettings from './use-pattern-settings';
15
15
  import { unlock } from '../../lock-unlock';
16
16
 
17
17
  const { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );
18
18
 
19
- export default function PageLibrary() {
19
+ export default function PagePatterns() {
20
20
  const { categoryType, categoryId } = getQueryArgs( window.location.href );
21
21
  const type = categoryType || DEFAULT_TYPE;
22
22
  const category = categoryId || DEFAULT_CATEGORY;
23
- const settings = useLibrarySettings();
23
+ const settings = usePatternSettings();
24
24
 
25
25
  // Wrap everything in a block editor provider.
26
26
  // This ensures 'styles' that are needed for the previews are synced
@@ -28,8 +28,8 @@ export default function PageLibrary() {
28
28
  return (
29
29
  <ExperimentalBlockEditorProvider settings={ settings }>
30
30
  <Page
31
- className="edit-site-library"
32
- title={ __( 'Library content' ) }
31
+ className="edit-site-patterns"
32
+ title={ __( 'Patterns content' ) }
33
33
  hideTitleFromUI
34
34
  >
35
35
  <PatternsList type={ type } categoryId={ category } />
@@ -5,7 +5,7 @@ import { __ } from '@wordpress/i18n';
5
5
 
6
6
  export default function NoPatterns() {
7
7
  return (
8
- <div className="edit-site-library__no-results">
8
+ <div className="edit-site-patterns__no-results">
9
9
  { __( 'No patterns found.' ) }
10
10
  </div>
11
11
  );
@@ -51,19 +51,19 @@ export default function PatternsList( { categoryId, type } ) {
51
51
  icon={ isRTL() ? chevronRight : chevronLeft }
52
52
  label={ __( 'Back' ) }
53
53
  onClick={ () => {
54
- // Go back in history if we came from the library page.
54
+ // Go back in history if we came from the Patterns page.
55
55
  // Otherwise push a stack onto the history.
56
- if ( location.state?.backPath === '/library' ) {
56
+ if ( location.state?.backPath === '/patterns' ) {
57
57
  history.back();
58
58
  } else {
59
- history.push( { path: '/library' } );
59
+ history.push( { path: '/patterns' } );
60
60
  }
61
61
  } }
62
62
  />
63
63
  ) }
64
64
  <FlexBlock>
65
65
  <SearchControl
66
- className="edit-site-library__search"
66
+ className="edit-site-patterns__search"
67
67
  onChange={ ( value ) => setFilterValue( value ) }
68
68
  placeholder={ __( 'Search patterns' ) }
69
69
  label={ __( 'Search patterns' ) }
@@ -75,7 +75,7 @@ export default function PatternsList( { categoryId, type } ) {
75
75
  { isResolving && __( 'Loading' ) }
76
76
  { ! isResolving && !! syncedPatterns.length && (
77
77
  <>
78
- <VStack className="edit-site-library__section-header">
78
+ <VStack className="edit-site-patterns__section-header">
79
79
  <Heading level={ 4 }>{ __( 'Synced' ) }</Heading>
80
80
  <Text variant="muted" as="p">
81
81
  { __(
@@ -93,7 +93,7 @@ export default function PatternsList( { categoryId, type } ) {
93
93
  ) }
94
94
  { ! isResolving && !! unsyncedPatterns.length && (
95
95
  <>
96
- <VStack className="edit-site-library__section-header">
96
+ <VStack className="edit-site-patterns__section-header">
97
97
  <Heading level={ 4 }>{ __( 'Standard' ) }</Heading>
98
98
  <Text variant="muted" as="p">
99
99
  { __(
@@ -1,4 +1,4 @@
1
- .edit-site-library {
1
+ .edit-site-patterns {
2
2
  background: rgba(0, 0, 0, 0.05);
3
3
  margin: $header-height 0 0;
4
4
  .components-text {
@@ -14,7 +14,7 @@
14
14
  }
15
15
  }
16
16
 
17
- .edit-site-library__grid {
17
+ .edit-site-patterns__grid {
18
18
  column-gap: $grid-unit-30;
19
19
  @include break-large() {
20
20
  column-count: 2;
@@ -25,13 +25,13 @@
25
25
  padding-top: $border-width-focus-fallback;
26
26
  margin-bottom: $grid-unit-40;
27
27
 
28
- .edit-site-library__pattern {
28
+ .edit-site-patterns__pattern {
29
29
  break-inside: avoid-column;
30
30
  display: flex;
31
31
  flex-direction: column;
32
32
  margin-bottom: $grid-unit-60;
33
33
 
34
- .edit-site-library__preview {
34
+ .edit-site-patterns__preview {
35
35
  border-radius: $radius-block-ui;
36
36
  cursor: pointer;
37
37
  overflow: hidden;
@@ -48,12 +48,12 @@
48
48
  }
49
49
  }
50
50
 
51
- .edit-site-library__footer,
52
- .edit-site-library__button {
51
+ .edit-site-patterns__footer,
52
+ .edit-site-patterns__button {
53
53
  color: $gray-600;
54
54
  }
55
55
 
56
- &.is-placeholder .edit-site-library__preview {
56
+ &.is-placeholder .edit-site-patterns__preview {
57
57
  min-height: $grid-unit-80;
58
58
  color: $gray-600;
59
59
  border: 1px dashed $gray-800;
@@ -67,7 +67,7 @@
67
67
  }
68
68
  }
69
69
 
70
- .edit-site-library__preview {
70
+ .edit-site-patterns__preview {
71
71
  flex: 1;
72
72
  margin-bottom: $grid-unit-20;
73
73
  }
@@ -75,7 +75,7 @@
75
75
 
76
76
  // The increased specificity here is to overcome component styles
77
77
  // without relying on internal component class names.
78
- .edit-site-library__search {
78
+ .edit-site-patterns__search {
79
79
  &#{&} input[type="search"] {
80
80
  background: $gray-800;
81
81
  color: $gray-200;
@@ -90,16 +90,20 @@
90
90
  }
91
91
  }
92
92
 
93
- .edit-site-library__pattern-title {
93
+ .edit-site-patterns__pattern-title {
94
94
  color: $gray-600;
95
95
 
96
- svg {
96
+ .edit-site-patterns__pattern-icon {
97
97
  border-radius: $grid-unit-05;
98
98
  background: var(--wp-block-synced-color);
99
99
  fill: $white;
100
100
  }
101
+
102
+ .edit-site-patterns__pattern-lock-icon {
103
+ display: inline-flex;
104
+ }
101
105
  }
102
106
 
103
- .edit-site-library__no-results {
107
+ .edit-site-patterns__no-results {
104
108
  color: $gray-600;
105
109
  }
@@ -12,7 +12,7 @@ import { unlock } from '../../lock-unlock';
12
12
  import { store as editSiteStore } from '../../store';
13
13
  import { filterOutDuplicatesByName } from './utils';
14
14
 
15
- export default function useLibrarySettings() {
15
+ export default function usePatternSettings() {
16
16
  const storedSettings = useSelect( ( select ) => {
17
17
  const { getSettings } = unlock( select( editSiteStore ) );
18
18
  return getSettings();
@@ -38,6 +38,15 @@ const templatePartToPattern = ( templatePart ) => ( {
38
38
  templatePart,
39
39
  } );
40
40
 
41
+ const templatePartCategories = [ 'header', 'footer', 'sidebar' ];
42
+ const templatePartHasCategory = ( item, category ) => {
43
+ if ( category === 'uncategorized' ) {
44
+ return ! templatePartCategories.includes( item.templatePart.area );
45
+ }
46
+
47
+ return item.templatePart.area === category;
48
+ };
49
+
41
50
  const useTemplatePartsAsPatterns = (
42
51
  categoryId,
43
52
  postType = TEMPLATE_PARTS,
@@ -83,7 +92,7 @@ const useTemplatePartsAsPatterns = (
83
92
 
84
93
  return searchItems( templateParts, filterValue, {
85
94
  categoryId,
86
- hasCategory: ( item, area ) => item.templatePart.area === area,
95
+ hasCategory: templatePartHasCategory,
87
96
  } );
88
97
  }, [ templateParts, filterValue, categoryId ] );
89
98
 
@@ -145,7 +154,7 @@ const reusableBlockToPattern = ( reusableBlock ) => ( {
145
154
  categories: reusableBlock.wp_pattern,
146
155
  id: reusableBlock.id,
147
156
  name: reusableBlock.slug,
148
- syncStatus: reusableBlock.meta?.sync_status,
157
+ syncStatus: reusableBlock.meta?.sync_status || SYNC_TYPES.full,
149
158
  title: reusableBlock.title.raw,
150
159
  type: reusableBlock.type,
151
160
  reusableBlock,
@@ -1,9 +1,9 @@
1
- export const DEFAULT_CATEGORY = 'header';
2
- export const DEFAULT_TYPE = 'wp_template_part';
1
+ export const DEFAULT_CATEGORY = 'my-patterns';
2
+ export const DEFAULT_TYPE = 'wp_block';
3
3
  export const PATTERNS = 'pattern';
4
4
  export const TEMPLATE_PARTS = 'wp_template_part';
5
5
  export const USER_PATTERNS = 'wp_block';
6
- export const USER_PATTERN_CATEGORY = 'custom-patterns';
6
+ export const USER_PATTERN_CATEGORY = 'my-patterns';
7
7
 
8
8
  export const CORE_PATTERN_SOURCES = [
9
9
  'core',
@@ -0,0 +1,105 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ VisuallyHidden,
6
+ __experimentalHeading as Heading,
7
+ __experimentalVStack as VStack,
8
+ } from '@wordpress/components';
9
+ import { __ } from '@wordpress/i18n';
10
+ import { useSelect } from '@wordpress/data';
11
+ import { store as coreStore, useEntityRecords } from '@wordpress/core-data';
12
+ import { decodeEntities } from '@wordpress/html-entities';
13
+
14
+ /**
15
+ * Internal dependencies
16
+ */
17
+ import Page from '../page';
18
+ import Table from '../table';
19
+ import Link from '../routes/link';
20
+ import AddedBy from '../list/added-by';
21
+ import TemplateActions from '../template-actions';
22
+ import AddNewTemplate from '../add-new-template';
23
+ import { store as editSiteStore } from '../../store';
24
+
25
+ export default function PageTemplateParts() {
26
+ const { records: templateParts } = useEntityRecords(
27
+ 'postType',
28
+ 'wp_template_part',
29
+ {
30
+ per_page: -1,
31
+ }
32
+ );
33
+
34
+ const { canCreate } = useSelect( ( select ) => {
35
+ const { supportsTemplatePartsMode } =
36
+ select( editSiteStore ).getSettings();
37
+ return {
38
+ postType: select( coreStore ).getPostType( 'wp_template_part' ),
39
+ canCreate: ! supportsTemplatePartsMode,
40
+ };
41
+ } );
42
+
43
+ const columns = [
44
+ {
45
+ header: __( 'Template Part' ),
46
+ cell: ( templatePart ) => (
47
+ <VStack>
48
+ <Heading level={ 5 }>
49
+ <Link
50
+ params={ {
51
+ postId: templatePart.id,
52
+ postType: templatePart.type,
53
+ canvas: 'view',
54
+ } }
55
+ state={ { backPath: '/wp_template_part/all' } }
56
+ >
57
+ { decodeEntities(
58
+ templatePart.title?.rendered ||
59
+ templatePart.slug
60
+ ) }
61
+ </Link>
62
+ </Heading>
63
+ </VStack>
64
+ ),
65
+ maxWidth: 400,
66
+ },
67
+ {
68
+ header: __( 'Added by' ),
69
+ cell: ( templatePart ) => (
70
+ <AddedBy
71
+ postType={ templatePart.type }
72
+ postId={ templatePart.id }
73
+ />
74
+ ),
75
+ },
76
+ {
77
+ header: <VisuallyHidden>{ __( 'Actions' ) }</VisuallyHidden>,
78
+ cell: ( templatePart ) => (
79
+ <TemplateActions
80
+ postType={ templatePart.type }
81
+ postId={ templatePart.id }
82
+ />
83
+ ),
84
+ },
85
+ ];
86
+
87
+ return (
88
+ <Page
89
+ title={ __( 'Template Parts' ) }
90
+ actions={
91
+ canCreate && (
92
+ <AddNewTemplate
93
+ templateType={ 'wp_template_part' }
94
+ showIcon={ false }
95
+ toggleProps={ { variant: 'primary' } }
96
+ />
97
+ )
98
+ }
99
+ >
100
+ { templateParts && (
101
+ <Table data={ templateParts } columns={ columns } />
102
+ ) }
103
+ </Page>
104
+ );
105
+ }
@@ -12,9 +12,9 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
12
12
  * Internal dependencies
13
13
  */
14
14
  import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';
15
- import SidebarNavigationScreenLibrary from '../sidebar-navigation-screen-library';
16
15
  import SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';
17
16
  import SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';
17
+ import SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';
18
18
  import SidebarNavigationScreenPattern from '../sidebar-navigation-screen-pattern';
19
19
  import useSyncPathWithURL, {
20
20
  getPathFromURL,
@@ -56,15 +56,15 @@ function SidebarScreens() {
56
56
  <NavigatorScreen path="/:postType(wp_template)">
57
57
  <SidebarNavigationScreenTemplates />
58
58
  </NavigatorScreen>
59
- <NavigatorScreen path="/library">
60
- <SidebarNavigationScreenLibrary />
59
+ <NavigatorScreen path="/patterns">
60
+ <SidebarNavigationScreenPatterns />
61
+ </NavigatorScreen>
62
+ <NavigatorScreen path="/:postType(wp_template|wp_template_part)/all">
63
+ <SidebarNavigationScreenTemplatesBrowse />
61
64
  </NavigatorScreen>
62
65
  <NavigatorScreen path="/:postType(wp_template_part|wp_block)/:postId">
63
66
  <SidebarNavigationScreenPattern />
64
67
  </NavigatorScreen>
65
- <NavigatorScreen path="/:postType(wp_template)/all">
66
- <SidebarNavigationScreenTemplatesBrowse />
67
- </NavigatorScreen>
68
68
  <NavigatorScreen path="/:postType(wp_template)/:postId">
69
69
  <SidebarNavigationScreenTemplate />
70
70
  </NavigatorScreen>
@@ -18,6 +18,12 @@ import { STORE_NAME } from '../../../store/constants';
18
18
  import { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from '../constants';
19
19
  import { store as editSiteStore } from '../../../store';
20
20
 
21
+ const entityLabels = {
22
+ wp_navigation: __( 'Navigation' ),
23
+ wp_block: __( 'Pattern' ),
24
+ wp_template: __( 'Template' ),
25
+ };
26
+
21
27
  const SettingsHeader = ( { sidebarName } ) => {
22
28
  const { hasPageContentFocus, entityType } = useSelect( ( select ) => {
23
29
  const { getEditedPostType, hasPageContentFocus: _hasPageContentFocus } =
@@ -29,8 +35,7 @@ const SettingsHeader = ( { sidebarName } ) => {
29
35
  };
30
36
  } );
31
37
 
32
- const entityLabel =
33
- entityType === 'wp_navigation' ? __( 'Navigation' ) : __( 'Template' );
38
+ const entityLabel = entityLabels[ entityType ] || entityLabels.wp_template;
34
39
 
35
40
  const { enableComplementaryArea } = useDispatch( interfaceStore );
36
41
  const openTemplateSettings = () =>