@wordpress/edit-site 5.14.0 → 5.16.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 (461) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-page/index.js +1 -6
  3. package/build/components/add-new-page/index.js.map +1 -1
  4. package/build/components/add-new-pattern/index.js +22 -7
  5. package/build/components/add-new-pattern/index.js.map +1 -1
  6. package/build/components/add-new-template/utils.js +10 -8
  7. package/build/components/add-new-template/utils.js.map +1 -1
  8. package/build/components/block-editor/constants.js +1 -1
  9. package/build/components/block-editor/constants.js.map +1 -1
  10. package/build/components/block-editor/editor-canvas.js +1 -1
  11. package/build/components/block-editor/editor-canvas.js.map +1 -1
  12. package/build/components/block-editor/index.js +0 -4
  13. package/build/components/block-editor/index.js.map +1 -1
  14. package/build/components/block-editor/use-site-editor-settings.js +114 -13
  15. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  16. package/build/components/code-editor/index.js +60 -28
  17. package/build/components/code-editor/index.js.map +1 -1
  18. package/build/components/create-pattern-modal/index.js +7 -3
  19. package/build/components/create-pattern-modal/index.js.map +1 -1
  20. package/build/components/editor/index.js +5 -5
  21. package/build/components/editor/index.js.map +1 -1
  22. package/build/components/global-styles/global-styles-provider.js +12 -7
  23. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  24. package/build/components/global-styles/screen-block.js +16 -0
  25. package/build/components/global-styles/screen-block.js.map +1 -1
  26. package/build/components/global-styles/screen-revisions/index.js +12 -5
  27. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  28. package/build/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
  29. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  30. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +32 -25
  31. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  32. package/build/components/global-styles/style-variations-container.js +5 -3
  33. package/build/components/global-styles/style-variations-container.js.map +1 -1
  34. package/build/components/header-edit-mode/document-actions/index.js +4 -2
  35. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  36. package/build/components/header-edit-mode/index.js +13 -9
  37. package/build/components/header-edit-mode/index.js.map +1 -1
  38. package/build/components/keyboard-shortcuts/edit-mode.js +7 -5
  39. package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  40. package/build/components/layout/index.js +17 -5
  41. package/build/components/layout/index.js.map +1 -1
  42. package/build/components/page/index.js +3 -3
  43. package/build/components/page/index.js.map +1 -1
  44. package/build/components/page-actions/index.js +2 -2
  45. package/build/components/page-actions/index.js.map +1 -1
  46. package/build/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -16
  47. package/build/components/page-actions/trash-page-menu-item.js.map +1 -0
  48. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -5
  49. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  50. package/build/components/page-patterns/duplicate-menu-item.js +163 -0
  51. package/build/components/page-patterns/duplicate-menu-item.js.map +1 -0
  52. package/build/components/page-patterns/grid-item.js +83 -58
  53. package/build/components/page-patterns/grid-item.js.map +1 -1
  54. package/build/components/page-patterns/grid.js +5 -18
  55. package/build/components/page-patterns/grid.js.map +1 -1
  56. package/build/components/page-patterns/header.js +69 -0
  57. package/build/components/page-patterns/header.js.map +1 -0
  58. package/build/components/page-patterns/index.js +3 -1
  59. package/build/components/page-patterns/index.js.map +1 -1
  60. package/build/components/page-patterns/pagination.js +63 -0
  61. package/build/components/page-patterns/pagination.js.map +1 -0
  62. package/build/components/page-patterns/patterns-list.js +110 -31
  63. package/build/components/page-patterns/patterns-list.js.map +1 -1
  64. package/build/components/page-patterns/rename-menu-item.js +109 -0
  65. package/build/components/page-patterns/rename-menu-item.js.map +1 -0
  66. package/build/components/page-patterns/use-patterns.js +116 -118
  67. package/build/components/page-patterns/use-patterns.js.map +1 -1
  68. package/build/components/page-template-parts/add-new-template-part.js +74 -0
  69. package/build/components/page-template-parts/add-new-template-part.js.map +1 -0
  70. package/build/components/page-template-parts/index.js +3 -25
  71. package/build/components/page-template-parts/index.js.map +1 -1
  72. package/build/components/page-templates/index.js +1 -16
  73. package/build/components/page-templates/index.js.map +1 -1
  74. package/build/components/resizable-frame/index.js +85 -51
  75. package/build/components/resizable-frame/index.js.map +1 -1
  76. package/build/components/save-button/index.js +4 -2
  77. package/build/components/save-button/index.js.map +1 -1
  78. package/build/components/save-hub/index.js +10 -4
  79. package/build/components/save-hub/index.js.map +1 -1
  80. package/build/components/save-panel/index.js +5 -5
  81. package/build/components/save-panel/index.js.map +1 -1
  82. package/build/components/sidebar-edit-mode/page-panels/page-content.js +4 -3
  83. package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  84. package/build/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
  85. package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
  86. package/build/components/sidebar-edit-mode/template-panel/index.js +15 -8
  87. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  88. package/build/components/sidebar-navigation-screen/index.js +31 -15
  89. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  90. package/build/components/sidebar-navigation-screen-global-styles/index.js +34 -40
  91. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  92. package/build/components/sidebar-navigation-screen-main/index.js +4 -2
  93. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  94. package/build/components/sidebar-navigation-screen-main/template-part-hint.js +45 -0
  95. package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
  96. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +4 -4
  97. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  98. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  99. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  100. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
  101. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  102. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +5 -4
  103. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  104. package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
  105. package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
  106. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
  107. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  108. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +8 -0
  109. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  110. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -1
  111. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  112. package/build/components/sidebar-navigation-screen-page/index.js +2 -3
  113. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
  114. package/build/components/sidebar-navigation-screen-page/status-label.js +1 -34
  115. package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  116. package/build/components/sidebar-navigation-screen-pages/index.js +35 -25
  117. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  118. package/build/components/sidebar-navigation-screen-pattern/index.js +9 -7
  119. package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  120. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +4 -3
  121. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  122. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
  123. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  124. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +19 -4
  125. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
  126. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +55 -28
  127. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  128. package/build/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
  129. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  130. package/build/components/sidebar-navigation-screen-patterns/index.js +72 -60
  131. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  132. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
  133. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
  134. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +11 -1
  135. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  136. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +20 -9
  137. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  138. package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
  139. package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
  140. package/build/components/sidebar-navigation-screen-templates/index.js +1 -10
  141. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  142. package/build/components/sidebar-navigation-screen-templates-browse/index.js +9 -0
  143. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  144. package/build/components/site-hub/index.js +29 -13
  145. package/build/components/site-hub/index.js.map +1 -1
  146. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +10 -5
  147. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  148. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
  149. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  150. package/build/components/sync-state-with-url/use-sync-path-with-url.js +15 -12
  151. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  152. package/build/components/template-actions/index.js +3 -1
  153. package/build/components/template-actions/index.js.map +1 -1
  154. package/build/components/template-actions/rename-menu-item.js +12 -8
  155. package/build/components/template-actions/rename-menu-item.js.map +1 -1
  156. package/build/components/use-edited-entity-record/index.js +6 -1
  157. package/build/components/use-edited-entity-record/index.js.map +1 -1
  158. package/build/hooks/commands/use-common-commands.js +120 -32
  159. package/build/hooks/commands/use-common-commands.js.map +1 -1
  160. package/build/hooks/commands/use-edit-mode-commands.js +65 -7
  161. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  162. package/build/hooks/push-changes-to-global-styles/index.js +138 -57
  163. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  164. package/build/store/private-actions.js +9 -2
  165. package/build/store/private-actions.js.map +1 -1
  166. package/build/utils/normalize-record-key.js +19 -0
  167. package/build/utils/normalize-record-key.js.map +1 -0
  168. package/build/utils/use-activate-theme.js +1 -1
  169. package/build/utils/use-activate-theme.js.map +1 -1
  170. package/build/utils/use-debounced-input.js +5 -7
  171. package/build/utils/use-debounced-input.js.map +1 -1
  172. package/build-module/components/add-new-page/index.js +1 -6
  173. package/build-module/components/add-new-page/index.js.map +1 -1
  174. package/build-module/components/add-new-pattern/index.js +20 -7
  175. package/build-module/components/add-new-pattern/index.js.map +1 -1
  176. package/build-module/components/add-new-template/utils.js +9 -6
  177. package/build-module/components/add-new-template/utils.js.map +1 -1
  178. package/build-module/components/block-editor/constants.js +1 -1
  179. package/build-module/components/block-editor/constants.js.map +1 -1
  180. package/build-module/components/block-editor/editor-canvas.js +1 -1
  181. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  182. package/build-module/components/block-editor/index.js +0 -4
  183. package/build-module/components/block-editor/index.js.map +1 -1
  184. package/build-module/components/block-editor/use-site-editor-settings.js +116 -14
  185. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  186. package/build-module/components/code-editor/index.js +62 -30
  187. package/build-module/components/code-editor/index.js.map +1 -1
  188. package/build-module/components/create-pattern-modal/index.js +6 -3
  189. package/build-module/components/create-pattern-modal/index.js.map +1 -1
  190. package/build-module/components/editor/index.js +5 -5
  191. package/build-module/components/editor/index.js.map +1 -1
  192. package/build-module/components/global-styles/global-styles-provider.js +12 -7
  193. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  194. package/build-module/components/global-styles/screen-block.js +16 -0
  195. package/build-module/components/global-styles/screen-block.js.map +1 -1
  196. package/build-module/components/global-styles/screen-revisions/index.js +13 -6
  197. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  198. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
  199. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  200. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +28 -21
  201. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  202. package/build-module/components/global-styles/style-variations-container.js +5 -3
  203. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  204. package/build-module/components/header-edit-mode/document-actions/index.js +6 -4
  205. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  206. package/build-module/components/header-edit-mode/index.js +13 -9
  207. package/build-module/components/header-edit-mode/index.js.map +1 -1
  208. package/build-module/components/keyboard-shortcuts/edit-mode.js +7 -5
  209. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  210. package/build-module/components/layout/index.js +17 -5
  211. package/build-module/components/layout/index.js.map +1 -1
  212. package/build-module/components/page/index.js +3 -3
  213. package/build-module/components/page/index.js.map +1 -1
  214. package/build-module/components/page-actions/index.js +2 -2
  215. package/build-module/components/page-actions/index.js.map +1 -1
  216. package/build-module/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -17
  217. package/build-module/components/page-actions/trash-page-menu-item.js.map +1 -0
  218. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -3
  219. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  220. package/build-module/components/page-patterns/duplicate-menu-item.js +147 -0
  221. package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -0
  222. package/build-module/components/page-patterns/grid-item.js +84 -64
  223. package/build-module/components/page-patterns/grid-item.js.map +1 -1
  224. package/build-module/components/page-patterns/grid.js +5 -17
  225. package/build-module/components/page-patterns/grid.js.map +1 -1
  226. package/build-module/components/page-patterns/header.js +54 -0
  227. package/build-module/components/page-patterns/header.js.map +1 -0
  228. package/build-module/components/page-patterns/index.js +3 -1
  229. package/build-module/components/page-patterns/index.js.map +1 -1
  230. package/build-module/components/page-patterns/pagination.js +54 -0
  231. package/build-module/components/page-patterns/pagination.js.map +1 -0
  232. package/build-module/components/page-patterns/patterns-list.js +111 -34
  233. package/build-module/components/page-patterns/patterns-list.js.map +1 -1
  234. package/build-module/components/page-patterns/rename-menu-item.js +97 -0
  235. package/build-module/components/page-patterns/rename-menu-item.js.map +1 -0
  236. package/build-module/components/page-patterns/use-patterns.js +116 -119
  237. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  238. package/build-module/components/page-template-parts/add-new-template-part.js +58 -0
  239. package/build-module/components/page-template-parts/add-new-template-part.js.map +1 -0
  240. package/build-module/components/page-template-parts/index.js +4 -24
  241. package/build-module/components/page-template-parts/index.js.map +1 -1
  242. package/build-module/components/page-templates/index.js +2 -15
  243. package/build-module/components/page-templates/index.js.map +1 -1
  244. package/build-module/components/resizable-frame/index.js +87 -55
  245. package/build-module/components/resizable-frame/index.js.map +1 -1
  246. package/build-module/components/save-button/index.js +4 -2
  247. package/build-module/components/save-button/index.js.map +1 -1
  248. package/build-module/components/save-hub/index.js +10 -4
  249. package/build-module/components/save-hub/index.js.map +1 -1
  250. package/build-module/components/save-panel/index.js +5 -5
  251. package/build-module/components/save-panel/index.js.map +1 -1
  252. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +5 -2
  253. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  254. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
  255. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
  256. package/build-module/components/sidebar-edit-mode/template-panel/index.js +15 -9
  257. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  258. package/build-module/components/sidebar-navigation-screen/index.js +29 -16
  259. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  260. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +34 -40
  261. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  262. package/build-module/components/sidebar-navigation-screen-main/index.js +4 -3
  263. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  264. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +33 -0
  265. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
  266. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +4 -4
  267. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  268. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  269. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  270. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
  271. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  272. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +5 -4
  273. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  274. package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
  275. package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
  276. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
  277. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  278. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +7 -0
  279. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  280. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +2 -2
  281. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  282. package/build-module/components/sidebar-navigation-screen-page/index.js +2 -3
  283. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
  284. package/build-module/components/sidebar-navigation-screen-page/status-label.js +1 -32
  285. package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  286. package/build-module/components/sidebar-navigation-screen-pages/index.js +35 -25
  287. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  288. package/build-module/components/sidebar-navigation-screen-pattern/index.js +8 -7
  289. package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  290. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +4 -3
  291. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  292. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
  293. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  294. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +18 -4
  295. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
  296. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +53 -28
  297. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  298. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
  299. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  300. package/build-module/components/sidebar-navigation-screen-patterns/index.js +76 -60
  301. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  302. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
  303. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
  304. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -1
  305. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  306. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +18 -9
  307. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  308. package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
  309. package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
  310. package/build-module/components/sidebar-navigation-screen-templates/index.js +1 -8
  311. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  312. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -0
  313. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  314. package/build-module/components/site-hub/index.js +28 -13
  315. package/build-module/components/site-hub/index.js.map +1 -1
  316. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +7 -5
  317. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  318. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
  319. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  320. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +16 -12
  321. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  322. package/build-module/components/template-actions/index.js +2 -1
  323. package/build-module/components/template-actions/index.js.map +1 -1
  324. package/build-module/components/template-actions/rename-menu-item.js +11 -8
  325. package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
  326. package/build-module/components/use-edited-entity-record/index.js +3 -1
  327. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  328. package/build-module/hooks/commands/use-common-commands.js +116 -32
  329. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  330. package/build-module/hooks/commands/use-edit-mode-commands.js +65 -9
  331. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  332. package/build-module/hooks/push-changes-to-global-styles/index.js +139 -57
  333. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  334. package/build-module/store/private-actions.js +9 -2
  335. package/build-module/store/private-actions.js.map +1 -1
  336. package/build-module/utils/normalize-record-key.js +12 -0
  337. package/build-module/utils/normalize-record-key.js.map +1 -0
  338. package/build-module/utils/use-activate-theme.js +1 -1
  339. package/build-module/utils/use-activate-theme.js.map +1 -1
  340. package/build-module/utils/use-debounced-input.js +5 -7
  341. package/build-module/utils/use-debounced-input.js.map +1 -1
  342. package/build-style/style-rtl.css +281 -103
  343. package/build-style/style.css +281 -103
  344. package/package.json +39 -40
  345. package/src/components/add-new-page/index.js +0 -3
  346. package/src/components/add-new-pattern/index.js +25 -12
  347. package/src/components/add-new-template/utils.js +9 -6
  348. package/src/components/block-editor/constants.js +5 -1
  349. package/src/components/block-editor/editor-canvas.js +1 -1
  350. package/src/components/block-editor/index.js +0 -4
  351. package/src/components/block-editor/use-site-editor-settings.js +119 -20
  352. package/src/components/canvas-spinner/style.scss +14 -0
  353. package/src/components/code-editor/index.js +51 -33
  354. package/src/components/create-pattern-modal/index.js +5 -2
  355. package/src/components/editor/index.js +5 -5
  356. package/src/components/global-styles/global-styles-provider.js +7 -2
  357. package/src/components/global-styles/screen-block.js +15 -0
  358. package/src/components/global-styles/screen-revisions/index.js +64 -58
  359. package/src/components/global-styles/screen-revisions/revisions-buttons.js +17 -31
  360. package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +14 -1
  361. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +64 -48
  362. package/src/components/global-styles/style-variations-container.js +2 -0
  363. package/src/components/header-edit-mode/document-actions/index.js +8 -4
  364. package/src/components/header-edit-mode/document-actions/style.scss +45 -28
  365. package/src/components/header-edit-mode/index.js +29 -22
  366. package/src/components/keyboard-shortcuts/edit-mode.js +4 -5
  367. package/src/components/layout/index.js +49 -22
  368. package/src/components/layout/style.scss +4 -3
  369. package/src/components/page/index.js +8 -8
  370. package/src/components/page/style.scss +8 -5
  371. package/src/components/page-actions/index.js +2 -2
  372. package/src/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +9 -22
  373. package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +12 -3
  374. package/src/components/page-patterns/duplicate-menu-item.js +196 -0
  375. package/src/components/page-patterns/grid-item.js +189 -133
  376. package/src/components/page-patterns/grid.js +3 -20
  377. package/src/components/page-patterns/header.js +69 -0
  378. package/src/components/page-patterns/index.js +6 -1
  379. package/src/components/page-patterns/pagination.js +80 -0
  380. package/src/components/page-patterns/patterns-list.js +172 -71
  381. package/src/components/page-patterns/rename-menu-item.js +115 -0
  382. package/src/components/page-patterns/style.scss +141 -30
  383. package/src/components/page-patterns/use-patterns.js +115 -169
  384. package/src/components/page-template-parts/add-new-template-part.js +57 -0
  385. package/src/components/page-template-parts/index.js +3 -23
  386. package/src/components/page-templates/index.js +6 -19
  387. package/src/components/resizable-frame/index.js +104 -51
  388. package/src/components/resizable-frame/style.scss +9 -9
  389. package/src/components/save-button/index.js +2 -0
  390. package/src/components/save-hub/index.js +6 -1
  391. package/src/components/save-hub/style.scss +1 -1
  392. package/src/components/save-panel/index.js +10 -4
  393. package/src/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
  394. package/src/components/sidebar-edit-mode/page-panels/page-status.js +2 -5
  395. package/src/components/sidebar-edit-mode/template-panel/index.js +15 -11
  396. package/src/components/sidebar-navigation-item/style.scss +5 -12
  397. package/src/components/sidebar-navigation-screen/index.js +30 -15
  398. package/src/components/sidebar-navigation-screen/style.scss +18 -0
  399. package/src/components/sidebar-navigation-screen-details-panel/style.scss +1 -0
  400. package/src/components/sidebar-navigation-screen-global-styles/index.js +48 -44
  401. package/src/components/sidebar-navigation-screen-main/index.js +44 -40
  402. package/src/components/sidebar-navigation-screen-main/template-part-hint.js +34 -0
  403. package/src/components/sidebar-navigation-screen-navigation-menu/index.js +4 -3
  404. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  405. package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +1 -1
  406. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +16 -7
  407. package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
  408. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
  409. package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +27 -15
  410. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -4
  411. package/src/components/sidebar-navigation-screen-page/index.js +3 -3
  412. package/src/components/sidebar-navigation-screen-page/status-label.js +1 -35
  413. package/src/components/sidebar-navigation-screen-pages/index.js +48 -33
  414. package/src/components/sidebar-navigation-screen-pattern/index.js +5 -2
  415. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
  416. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +2 -1
  417. package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +23 -3
  418. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +74 -43
  419. package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -13
  420. package/src/components/sidebar-navigation-screen-patterns/index.js +103 -106
  421. package/src/components/sidebar-navigation-screen-patterns/style.scss +20 -0
  422. package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +7 -6
  423. package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +9 -0
  424. package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +31 -9
  425. package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -1
  426. package/src/components/sidebar-navigation-screen-templates/index.js +1 -9
  427. package/src/components/sidebar-navigation-screen-templates-browse/index.js +10 -0
  428. package/src/components/site-hub/index.js +48 -29
  429. package/src/components/site-hub/style.scss +14 -2
  430. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -2
  431. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -4
  432. package/src/components/sync-state-with-url/use-sync-path-with-url.js +73 -66
  433. package/src/components/table/style.scss +1 -0
  434. package/src/components/template-actions/index.js +2 -1
  435. package/src/components/template-actions/rename-menu-item.js +17 -10
  436. package/src/components/use-edited-entity-record/index.js +6 -1
  437. package/src/hooks/commands/use-common-commands.js +105 -32
  438. package/src/hooks/commands/use-edit-mode-commands.js +94 -23
  439. package/src/hooks/push-changes-to-global-styles/index.js +141 -50
  440. package/src/store/private-actions.js +10 -2
  441. package/src/style.scss +10 -12
  442. package/src/utils/normalize-record-key.js +11 -0
  443. package/src/utils/use-activate-theme.js +1 -1
  444. package/src/utils/use-debounced-input.js +8 -7
  445. package/build/components/code-editor/code-editor-text-area.js +0 -96
  446. package/build/components/code-editor/code-editor-text-area.js.map +0 -1
  447. package/build/components/keyboard-shortcuts/index.js +0 -148
  448. package/build/components/keyboard-shortcuts/index.js.map +0 -1
  449. package/build/components/page-actions/delete-page-menu-item.js.map +0 -1
  450. package/build/components/page-content-focus-manager/constants.js +0 -9
  451. package/build/components/page-content-focus-manager/constants.js.map +0 -1
  452. package/build-module/components/code-editor/code-editor-text-area.js +0 -84
  453. package/build-module/components/code-editor/code-editor-text-area.js.map +0 -1
  454. package/build-module/components/keyboard-shortcuts/index.js +0 -132
  455. package/build-module/components/keyboard-shortcuts/index.js.map +0 -1
  456. package/build-module/components/page-actions/delete-page-menu-item.js.map +0 -1
  457. package/build-module/components/page-content-focus-manager/constants.js +0 -2
  458. package/build-module/components/page-content-focus-manager/constants.js.map +0 -1
  459. package/src/components/code-editor/code-editor-text-area.js +0 -84
  460. package/src/components/keyboard-shortcuts/index.js +0 -137
  461. package/src/components/page-content-focus-manager/constants.js +0 -5
@@ -54,6 +54,8 @@ const PageItem = ({
54
54
  const linkInfo = (0, _link.useLink)({
55
55
  postType,
56
56
  postId
57
+ }, {
58
+ backPath: '/page'
57
59
  });
58
60
  return (0, _element.createElement)(_sidebarNavigationItem.default, { ...linkInfo,
59
61
  ...props
@@ -78,6 +80,9 @@ function SidebarNavigationScreenPages() {
78
80
  slug
79
81
  }) => ['404', 'search'].includes(slug));
80
82
  const homeTemplate = templates?.find(template => template.slug === 'front-page') || templates?.find(template => template.slug === 'home') || templates?.find(template => template.slug === 'index');
83
+
84
+ const getPostsPageTemplate = () => templates?.find(template => template.slug === 'home') || templates?.find(template => template.slug === 'index');
85
+
81
86
  const pagesAndTemplates = pages?.concat(dynamicPageTemplates, [homeTemplate]);
82
87
  const {
83
88
  frontPage,
@@ -120,6 +125,27 @@ function SidebarNavigationScreenPages() {
120
125
  setShowAddPage(false);
121
126
  };
122
127
 
128
+ const getPageProps = id => {
129
+ let itemIcon = _icons.page;
130
+ const postsPageTemplateId = postsPage && postsPage === id ? getPostsPageTemplate()?.id : null;
131
+
132
+ switch (id) {
133
+ case frontPage:
134
+ itemIcon = _icons.home;
135
+ break;
136
+
137
+ case postsPage:
138
+ itemIcon = _icons.verse;
139
+ break;
140
+ }
141
+
142
+ return {
143
+ icon: itemIcon,
144
+ postType: postsPageTemplateId ? 'wp_template' : 'page',
145
+ postId: postsPageTemplateId || id
146
+ };
147
+ };
148
+
123
149
  return (0, _element.createElement)(_element.Fragment, null, showAddPage && (0, _element.createElement)(_addNewPage.default, {
124
150
  onSave: handleNewPage,
125
151
  onClose: () => setShowAddPage(false)
@@ -139,31 +165,15 @@ function SidebarNavigationScreenPages() {
139
165
  withChevron: true
140
166
  }, (0, _element.createElement)(_components.__experimentalTruncate, {
141
167
  numberOfLines: 1
142
- }, (0, _htmlEntities.decodeEntities)(homeTemplate.title?.rendered || (0, _i18n.__)('(no title)')))), reorderedPages?.map(item => {
143
- let itemIcon;
144
-
145
- switch (item.id) {
146
- case frontPage:
147
- itemIcon = _icons.home;
148
- break;
149
-
150
- case postsPage:
151
- itemIcon = _icons.verse;
152
- break;
153
-
154
- default:
155
- itemIcon = _icons.page;
156
- }
157
-
158
- return (0, _element.createElement)(PageItem, {
159
- postId: item.id,
160
- key: item.id,
161
- icon: itemIcon,
162
- withChevron: true
163
- }, (0, _element.createElement)(_components.__experimentalTruncate, {
164
- numberOfLines: 1
165
- }, (0, _htmlEntities.decodeEntities)(item?.title?.rendered || (0, _i18n.__)('(no title)'))));
166
- }))),
168
+ }, (0, _htmlEntities.decodeEntities)(homeTemplate.title?.rendered || (0, _i18n.__)('(no title)')))), reorderedPages?.map(({
169
+ id,
170
+ title
171
+ }) => (0, _element.createElement)(PageItem, { ...getPageProps(id),
172
+ key: id,
173
+ withChevron: true
174
+ }, (0, _element.createElement)(_components.__experimentalTruncate, {
175
+ numberOfLines: 1
176
+ }, (0, _htmlEntities.decodeEntities)(title?.rendered || (0, _i18n.__)('(no title)'))))))),
167
177
  footer: (0, _element.createElement)(_components.__experimentalVStack, {
168
178
  spacing: 0
169
179
  }, dynamicPageTemplates?.map(item => (0, _element.createElement)(PageItem, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pages/index.js"],"names":["useHistory","routerPrivateApis","PageItem","postType","postId","props","linkInfo","SidebarNavigationScreenPages","records","pages","isResolving","isLoadingPages","status","per_page","templates","isLoadingTemplates","dynamicPageTemplates","filter","slug","includes","homeTemplate","find","template","pagesAndTemplates","concat","frontPage","postsPage","select","getEntityRecord","coreStore","siteSettings","page_on_front","page_for_posts","isHomePageBlog","reorderedPages","length","homePageIndex","findIndex","item","id","homePage","splice","postsPageIndex","blogPage","showAddPage","setShowAddPage","history","handleNewPage","type","push","canvas","plus","home","title","rendered","map","itemIcon","verse","page","layout","document","location"],"mappings":";;;;;;;;;AASA;;AANA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAeA;AACA;AACA;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAiB,wBAAQC,mBAAR,CAAvB;;AAEA,MAAMC,QAAQ,GAAG,CAAE;AAAEC,EAAAA,QAAQ,GAAG,MAAb;AAAqBC,EAAAA,MAArB;AAA6B,KAAGC;AAAhC,CAAF,KAA+C;AAC/D,QAAMC,QA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["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalTruncate as Truncate,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { layout, page, home, verse, plus } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport SidebarButton from '../sidebar-button';\nimport AddNewPageModal from '../add-new-page';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst PageItem = ( { postType = 'page', postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenPages() {\n\tconst { records: pages, isResolving: isLoadingPages } = useEntityRecords(\n\t\t'postType',\n\t\t'page',\n\t\t{\n\t\t\tstatus: 'any',\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\tconst { records: templates, isResolving: isLoadingTemplates } =\n\t\tuseEntityRecords( 'postType', 'wp_template', {\n\t\t\tper_page: -1,\n\t\t} );\n\n\tconst dynamicPageTemplates = templates?.filter( ( { slug } ) =>\n\t\t[ '404', 'search' ].includes( slug )\n\t);\n\n\tconst homeTemplate =\n\t\ttemplates?.find( ( template ) => template.slug === 'front-page' ) ||\n\t\ttemplates?.find( ( template ) => template.slug === 'home' ) ||\n\t\ttemplates?.find( ( template ) => template.slug === 'index' );\n\n\tconst pagesAndTemplates = pages?.concat( dynamicPageTemplates, [\n\t\thomeTemplate,\n\t] );\n\n\tconst { frontPage, postsPage } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreStore );\n\n\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\treturn {\n\t\t\tfrontPage: siteSettings?.page_on_front,\n\t\t\tpostsPage: siteSettings?.page_for_posts,\n\t\t};\n\t}, [] );\n\n\tconst isHomePageBlog = frontPage === postsPage;\n\n\tconst reorderedPages = pages && [ ...pages ];\n\n\tif ( ! isHomePageBlog && reorderedPages?.length ) {\n\t\tconst homePageIndex = reorderedPages.findIndex(\n\t\t\t( item ) => item.id === frontPage\n\t\t);\n\t\tconst homePage = reorderedPages.splice( homePageIndex, 1 );\n\t\treorderedPages?.splice( 0, 0, ...homePage );\n\n\t\tconst postsPageIndex = reorderedPages.findIndex(\n\t\t\t( item ) => item.id === postsPage\n\t\t);\n\n\t\tconst blogPage = reorderedPages.splice( postsPageIndex, 1 );\n\n\t\treorderedPages.splice( 1, 0, ...blogPage );\n\t}\n\n\tconst [ showAddPage, setShowAddPage ] = useState( false );\n\n\tconst history = useHistory();\n\n\tconst handleNewPage = ( { type, id } ) => {\n\t\t// Navigate to the created template editor.\n\t\thistory.push( {\n\t\t\tpostId: id,\n\t\t\tpostType: type,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t\tsetShowAddPage( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{ showAddPage && (\n\t\t\t\t<AddNewPageModal\n\t\t\t\t\tonSave={ handleNewPage }\n\t\t\t\t\tonClose={ () => setShowAddPage( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Pages' ) }\n\t\t\t\tdescription={ __( 'Browse and edit pages on your site.' ) }\n\t\t\t\tactions={\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ __( 'Draft a new page' ) }\n\t\t\t\t\t\tonClick={ () => setShowAddPage( true ) }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tcontent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ( isLoadingPages || isLoadingTemplates ) && (\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t<Item>{ __( 'Loading pages' ) }</Item>\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! ( isLoadingPages || isLoadingTemplates ) && (\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t{ ! pagesAndTemplates?.length && (\n\t\t\t\t\t\t\t\t\t<Item>{ __( 'No page found' ) }</Item>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ isHomePageBlog && homeTemplate && (\n\t\t\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\t\t\tpostType=\"wp_template\"\n\t\t\t\t\t\t\t\t\t\tpostId={ homeTemplate.id }\n\t\t\t\t\t\t\t\t\t\tkey={ homeTemplate.id }\n\t\t\t\t\t\t\t\t\t\ticon={ home }\n\t\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\t\thomeTemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ reorderedPages?.map( ( item ) => {\n\t\t\t\t\t\t\t\t\tlet itemIcon;\n\t\t\t\t\t\t\t\t\tswitch ( item.id ) {\n\t\t\t\t\t\t\t\t\t\tcase frontPage:\n\t\t\t\t\t\t\t\t\t\t\titemIcon = home;\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase postsPage:\n\t\t\t\t\t\t\t\t\t\t\titemIcon = verse;\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\titemIcon = page;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\t\t\t\tpostId={ item.id }\n\t\t\t\t\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\t\t\t\t\ticon={ itemIcon }\n\t\t\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\t\t\titem?.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t\t\t{ dynamicPageTemplates?.map( ( item ) => (\n\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\tpostType=\"wp_template\"\n\t\t\t\t\t\t\t\tpostId={ item.id }\n\t\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\titem.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-pages__see-all\"\n\t\t\t\t\t\t\thref=\"edit.php?post_type=page\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tdocument.location = 'edit.php?post_type=page';\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Manage all pages' ) }\n\t\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t\t</VStack>\n\t\t\t\t}\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pages/index.js"],"names":["useHistory","routerPrivateApis","PageItem","postType","postId","props","linkInfo","backPath","SidebarNavigationScreenPages","records","pages","isResolving","isLoadingPages","status","per_page","templates","isLoadingTemplates","dynamicPageTemplates","filter","slug","includes","homeTemplate","find","template","getPostsPageTemplate","pagesAndTemplates","concat","frontPage","postsPage","select","getEntityRecord","coreStore","siteSettings","page_on_front","page_for_posts","isHomePageBlog","reorderedPages","length","homePageIndex","findIndex","item","id","homePage","splice","postsPageIndex","blogPage","showAddPage","setShowAddPage","history","handleNewPage","type","push","canvas","getPageProps","itemIcon","page","postsPageTemplateId","home","verse","icon","plus","title","rendered","map","layout","document","location"],"mappings":";;;;;;;;;AASA;;AANA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAeA;AACA;AACA;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAiB,wBAAQC,mBAAR,CAAvB;;AAEA,MAAMC,QAAQ,GAAG,CAAE;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GAAtB,CAA6BvB,IAAF,IAC5B,4BAAC,QAAD;AACC,MAAA,QAAQ,EAAC,aADV;AAEC,MAAA,MAAM,EAAGA,IAAI,CAACC,EAFf;AAGC,MAAA,GAAG,EAAGD,IAAI,CAACC,EAHZ;AAIC,MAAA,IAAI,EAAGuB,aAJR;AAKC,MAAA,WAAW;AALZ,OAOC,4BAAC,kCAAD;AAAU,MAAA,aAAa,EAAG;AAA1B,OACG,kCACDxB,IAAI,CAACqB,KAAL,EAAYC,QAAZ,IACC,cAAI,YAAJ,CAFA,CADH,CAPD,CADC,CADH,EAiBC,4BAAC,8BAAD;AACC,MAAA,SAAS,EAAC,oDADX;AAEC,MAAA,IAAI,EAAC,yBAFN;AAGC,MAAA,OAAO,EAAG,MAAM;AACfG,QAAAA,QAAQ,CAACC,QAAT,GAAoB,yBAApB;AACA;AALF,OAOG,cAAI,kBAAJ,CAPH,CAjBD;AAzDF,IAPD,CADD;AAgGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalTruncate as Truncate,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { layout, page, home, verse, plus } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport SidebarButton from '../sidebar-button';\nimport AddNewPageModal from '../add-new-page';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst PageItem = ( { postType = 'page', postId, ...props } ) => {\n\tconst linkInfo = useLink(\n\t\t{\n\t\t\tpostType,\n\t\t\tpostId,\n\t\t},\n\t\t{\n\t\t\tbackPath: '/page',\n\t\t}\n\t);\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenPages() {\n\tconst { records: pages, isResolving: isLoadingPages } = useEntityRecords(\n\t\t'postType',\n\t\t'page',\n\t\t{\n\t\t\tstatus: 'any',\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\tconst { records: templates, isResolving: isLoadingTemplates } =\n\t\tuseEntityRecords( 'postType', 'wp_template', {\n\t\t\tper_page: -1,\n\t\t} );\n\n\tconst dynamicPageTemplates = templates?.filter( ( { slug } ) =>\n\t\t[ '404', 'search' ].includes( slug )\n\t);\n\n\tconst homeTemplate =\n\t\ttemplates?.find( ( template ) => template.slug === 'front-page' ) ||\n\t\ttemplates?.find( ( template ) => template.slug === 'home' ) ||\n\t\ttemplates?.find( ( template ) => template.slug === 'index' );\n\n\tconst getPostsPageTemplate = () =>\n\t\ttemplates?.find( ( template ) => template.slug === 'home' ) ||\n\t\ttemplates?.find( ( template ) => template.slug === 'index' );\n\n\tconst pagesAndTemplates = pages?.concat( dynamicPageTemplates, [\n\t\thomeTemplate,\n\t] );\n\n\tconst { frontPage, postsPage } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\treturn {\n\t\t\tfrontPage: siteSettings?.page_on_front,\n\t\t\tpostsPage: siteSettings?.page_for_posts,\n\t\t};\n\t}, [] );\n\n\tconst isHomePageBlog = frontPage === postsPage;\n\n\tconst reorderedPages = pages && [ ...pages ];\n\n\tif ( ! isHomePageBlog && reorderedPages?.length ) {\n\t\tconst homePageIndex = reorderedPages.findIndex(\n\t\t\t( item ) => item.id === frontPage\n\t\t);\n\t\tconst homePage = reorderedPages.splice( homePageIndex, 1 );\n\t\treorderedPages?.splice( 0, 0, ...homePage );\n\n\t\tconst postsPageIndex = reorderedPages.findIndex(\n\t\t\t( item ) => item.id === postsPage\n\t\t);\n\n\t\tconst blogPage = reorderedPages.splice( postsPageIndex, 1 );\n\n\t\treorderedPages.splice( 1, 0, ...blogPage );\n\t}\n\n\tconst [ showAddPage, setShowAddPage ] = useState( false );\n\n\tconst history = useHistory();\n\n\tconst handleNewPage = ( { type, id } ) => {\n\t\t// Navigate to the created template editor.\n\t\thistory.push( {\n\t\t\tpostId: id,\n\t\t\tpostType: type,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t\tsetShowAddPage( false );\n\t};\n\n\tconst getPageProps = ( id ) => {\n\t\tlet itemIcon = page;\n\t\tconst postsPageTemplateId =\n\t\t\tpostsPage && postsPage === id ? getPostsPageTemplate()?.id : null;\n\n\t\tswitch ( id ) {\n\t\t\tcase frontPage:\n\t\t\t\titemIcon = home;\n\t\t\t\tbreak;\n\t\t\tcase postsPage:\n\t\t\t\titemIcon = verse;\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn {\n\t\t\ticon: itemIcon,\n\t\t\tpostType: postsPageTemplateId ? 'wp_template' : 'page',\n\t\t\tpostId: postsPageTemplateId || id,\n\t\t};\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{ showAddPage && (\n\t\t\t\t<AddNewPageModal\n\t\t\t\t\tonSave={ handleNewPage }\n\t\t\t\t\tonClose={ () => setShowAddPage( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Pages' ) }\n\t\t\t\tdescription={ __( 'Browse and edit pages on your site.' ) }\n\t\t\t\tactions={\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ __( 'Draft a new page' ) }\n\t\t\t\t\t\tonClick={ () => setShowAddPage( true ) }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tcontent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ( isLoadingPages || isLoadingTemplates ) && (\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t<Item>{ __( 'Loading pages' ) }</Item>\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! ( isLoadingPages || isLoadingTemplates ) && (\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t{ ! pagesAndTemplates?.length && (\n\t\t\t\t\t\t\t\t\t<Item>{ __( 'No page found' ) }</Item>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ isHomePageBlog && homeTemplate && (\n\t\t\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\t\t\tpostType=\"wp_template\"\n\t\t\t\t\t\t\t\t\t\tpostId={ homeTemplate.id }\n\t\t\t\t\t\t\t\t\t\tkey={ homeTemplate.id }\n\t\t\t\t\t\t\t\t\t\ticon={ home }\n\t\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\t\thomeTemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ reorderedPages?.map( ( { id, title } ) => (\n\t\t\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\t\t\t{ ...getPageProps( id ) }\n\t\t\t\t\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\t\ttitle?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t\t\t{ dynamicPageTemplates?.map( ( item ) => (\n\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\tpostType=\"wp_template\"\n\t\t\t\t\t\t\t\tpostId={ item.id }\n\t\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\titem.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-pages__see-all\"\n\t\t\t\t\t\t\thref=\"edit.php?post_type=page\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tdocument.location = 'edit.php?post_type=page';\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Manage all pages' ) }\n\t\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t\t</VStack>\n\t\t\t\t}\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
@@ -31,6 +31,8 @@ var _store = require("../../store");
31
31
 
32
32
  var _lockUnlock = require("../../lock-unlock");
33
33
 
34
+ var _normalizeRecordKey = _interopRequireDefault(require("../../utils/normalize-record-key"));
35
+
34
36
  /**
35
37
  * WordPress dependencies
36
38
  */
@@ -39,19 +41,19 @@ var _lockUnlock = require("../../lock-unlock");
39
41
  * Internal dependencies
40
42
  */
41
43
  function SidebarNavigationScreenPattern() {
42
- const {
43
- params
44
- } = (0, _components.__experimentalUseNavigator)();
45
44
  const {
46
45
  categoryType
47
46
  } = (0, _url.getQueryArgs)(window.location.href);
48
- const {
49
- postType,
50
- postId
51
- } = params;
52
47
  const {
53
48
  setCanvasMode
54
49
  } = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
50
+ const {
51
+ params
52
+ } = (0, _components.__experimentalUseNavigator)();
53
+ const {
54
+ postType
55
+ } = params;
56
+ const postId = (0, _normalizeRecordKey.default)(params?.postId);
55
57
  (0, _useInitEditedEntityFromUrl.default)();
56
58
  const patternDetails = (0, _usePatternDetails.default)(postType, postId); // The absence of a category type in the query params for template parts
57
59
  // indicates the user has arrived at the template part via the "manage all"
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/index.js"],"names":["SidebarNavigationScreenPattern","params","categoryType","window","location","href","postType","postId","setCanvasMode","editSiteStore","patternDetails","backPath","pencil"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAOA;AACA;AACA;AAQe,SAASA,8BAAT,GAA0C;AACxD,QAAM;AAAEC,IAAAA;AAAF,MAAa,6CAAnB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAmB,uBAAcC,MAAM,CAACC,QAAP,CAAgBC,IAA9B,CAAzB;AACA,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAuBN,MAA7B;AACA,QAAM;AAAEO,IAAAA;AAAF,MAAoB,wBAAQ,uBAAaC,YAAb,CAAR,CAA1B;AAEA;AAEA,QAAMC,cAAc,GAAG,gCAAmBJ,QAAnB,EAA6BC,MAA7B,CAAvB,CARwD,CAUxD;AACA;AACA;;AACA,QAAMI,QAAQ,GACb,CAAET,YAAF,IAAkBI,QAAQ,KAAK,kBAA/B,GACG,uBADH,GAEG,WAHJ;AAKA,SACC,4BAAC,gCAAD;AACC,IAAA,OAAO,EACN,4BAAC,sBAAD;AACC,MAAA,OAAO,EAAG,MAAME,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,MAAA,IAAI,EAAGI;AAHR,MAFF;AAQC,IAAA,QAAQ,EAAGD,QARZ;AAAA,OASMD;AATN,IADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { pencil } from '@wordpress/icons';\nimport { getQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';\nimport usePatternDetails from './use-pattern-details';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function SidebarNavigationScreenPattern() {\n\tconst { params } = useNavigator();\n\tconst { categoryType } = getQueryArgs( window.location.href );\n\tconst { postType, postId } = params;\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tuseInitEditedEntityFromURL();\n\n\tconst patternDetails = usePatternDetails( postType, postId );\n\n\t// The absence of a category type in the query params for template parts\n\t// indicates the user has arrived at the template part via the \"manage all\"\n\t// page and the back button should return them to that list page.\n\tconst backPath =\n\t\t! categoryType && postType === 'wp_template_part'\n\t\t\t? '/wp_template_part/all'\n\t\t\t: '/patterns';\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tbackPath={ backPath }\n\t\t\t{ ...patternDetails }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/index.js"],"names":["SidebarNavigationScreenPattern","categoryType","window","location","href","setCanvasMode","editSiteStore","params","postType","postId","patternDetails","backPath","pencil"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAOA;AACA;AACA;AASe,SAASA,8BAAT,GAA0C;AACxD,QAAM;AAAEC,IAAAA;AAAF,MAAmB,uBAAcC,MAAM,CAACC,QAAP,CAAgBC,IAA9B,CAAzB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,wBAAQ,uBAAaC,YAAb,CAAR,CAA1B;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAa,6CAAnB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAeD,MAArB;AACA,QAAME,MAAM,GAAG,iCAAoBF,MAAM,EAAEE,MAA5B,CAAf;AAEA;AAEA,QAAMC,cAAc,GAAG,gCAAmBF,QAAnB,EAA6BC,MAA7B,CAAvB,CAVwD,CAYxD;AACA;AACA;;AACA,QAAME,QAAQ,GACb,CAAEV,YAAF,IAAkBO,QAAQ,KAAK,kBAA/B,GACG,uBADH,GAEG,WAHJ;AAKA,SACC,4BAAC,gCAAD;AACC,IAAA,OAAO,EACN,4BAAC,sBAAD;AACC,MAAA,OAAO,EAAG,MAAMH,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,MAAA,IAAI,EAAGO;AAHR,MAFF;AAQC,IAAA,QAAQ,EAAGD,QARZ;AAAA,OASMD;AATN,IADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { pencil } from '@wordpress/icons';\nimport { getQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';\nimport usePatternDetails from './use-pattern-details';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport normalizeRecordKey from '../../utils/normalize-record-key';\n\nexport default function SidebarNavigationScreenPattern() {\n\tconst { categoryType } = getQueryArgs( window.location.href );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst { params } = useNavigator();\n\tconst { postType } = params;\n\tconst postId = normalizeRecordKey( params?.postId );\n\n\tuseInitEditedEntityFromURL();\n\n\tconst patternDetails = usePatternDetails( postType, postId );\n\n\t// The absence of a category type in the query params for template parts\n\t// indicates the user has arrived at the template part via the \"manage all\"\n\t// page and the back button should return them to that list page.\n\tconst backPath =\n\t\t! categoryType && postType === 'wp_template_part'\n\t\t\t? '/wp_template_part/all'\n\t\t\t: '/patterns';\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tbackPath={ backPath }\n\t\t\t{ ...patternDetails }\n\t\t/>\n\t);\n}\n"]}
@@ -31,9 +31,10 @@ function TemplatePartNavigationMenu({
31
31
  if (!id) return null;
32
32
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalHeading, {
33
33
  className: "edit-site-sidebar-navigation-screen-template-part-navigation-menu__title",
34
- size: "12",
35
- upperCase: true
36
- }, title?.rendered || title || (0, _i18n.__)('Navigation')), (0, _element.createElement)(_navigationMenuEditor.default, {
34
+ size: "11",
35
+ upperCase: true,
36
+ weight: 500
37
+ }, title || (0, _i18n.__)('Navigation')), (0, _element.createElement)(_navigationMenuEditor.default, {
37
38
  navigationMenuId: id
38
39
  }));
39
40
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js"],"names":["TemplatePartNavigationMenu","id","title","rendered"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAGe,SAASA,0BAAT,CAAqC;AAAEC,EAAAA;AAAF,CAArC,EAA8C;AAC5D,QAAM,CAAEC,KAAF,IAAY,6BAAe,UAAf,EAA2B,eAA3B,EAA4C,OAA5C,EAAqDD,EAArD,CAAlB;AAEA,MAAK,CAAEA,EAAP,EAAY,OAAO,IAAP;AAEZ,SACC,qDACC,4BAAC,iCAAD;AACC,IAAA,SAAS,EAAC,0EADX;AAEC,IAAA,IAAI,EAAC,IAFN;AAGC,IAAA,SAAS,EAAG;AAHb,KAKGC,KAAK,EAAEC,QAAP,IAAmBD,KAAnB,IAA4B,cAAI,YAAJ,CAL/B,CADD,EAQC,4BAAC,6BAAD;AAAsB,IAAA,gBAAgB,EAAGD;AAAzC,IARD,CADD;AAYA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\nimport { useEntityProp } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport NavigationMenuEditor from '../sidebar-navigation-screen-navigation-menu/navigation-menu-editor';\n\nexport default function TemplatePartNavigationMenu( { id } ) {\n\tconst [ title ] = useEntityProp( 'postType', 'wp_navigation', 'title', id );\n\n\tif ( ! id ) return null;\n\n\treturn (\n\t\t<>\n\t\t\t<Heading\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title\"\n\t\t\t\tsize=\"12\"\n\t\t\t\tupperCase={ true }\n\t\t\t>\n\t\t\t\t{ title?.rendered || title || __( 'Navigation' ) }\n\t\t\t</Heading>\n\t\t\t<NavigationMenuEditor navigationMenuId={ id } />\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js"],"names":["TemplatePartNavigationMenu","id","title"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAGe,SAASA,0BAAT,CAAqC;AAAEC,EAAAA;AAAF,CAArC,EAA8C;AAC5D,QAAM,CAAEC,KAAF,IAAY,6BAAe,UAAf,EAA2B,eAA3B,EAA4C,OAA5C,EAAqDD,EAArD,CAAlB;AAEA,MAAK,CAAEA,EAAP,EAAY,OAAO,IAAP;AAEZ,SACC,qDACC,4BAAC,iCAAD;AACC,IAAA,SAAS,EAAC,0EADX;AAEC,IAAA,IAAI,EAAC,IAFN;AAGC,IAAA,SAAS,EAAG,IAHb;AAIC,IAAA,MAAM,EAAG;AAJV,KAMGC,KAAK,IAAI,cAAI,YAAJ,CANZ,CADD,EASC,4BAAC,6BAAD;AAAsB,IAAA,gBAAgB,EAAGD;AAAzC,IATD,CADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\nimport { useEntityProp } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport NavigationMenuEditor from '../sidebar-navigation-screen-navigation-menu/navigation-menu-editor';\n\nexport default function TemplatePartNavigationMenu( { id } ) {\n\tconst [ title ] = useEntityProp( 'postType', 'wp_navigation', 'title', id );\n\n\tif ( ! id ) return null;\n\n\treturn (\n\t\t<>\n\t\t\t<Heading\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title\"\n\t\t\t\tsize=\"11\"\n\t\t\t\tupperCase={ true }\n\t\t\t\tweight={ 500 }\n\t\t\t>\n\t\t\t\t{ title || __( 'Navigation' ) }\n\t\t\t</Heading>\n\t\t\t<NavigationMenuEditor navigationMenuId={ id } />\n\t\t</>\n\t);\n}\n"]}
@@ -38,8 +38,9 @@ function TemplatePartNavigationMenus({
38
38
 
39
39
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalHeading, {
40
40
  className: "edit-site-sidebar-navigation-screen-template-part-navigation-menu__title",
41
- size: "12",
42
- upperCase: true
41
+ size: "11",
42
+ upperCase: true,
43
+ weight: 500
43
44
  }, (0, _i18n.__)('Navigation')), (0, _element.createElement)(_templatePartNavigationMenuList.default, {
44
45
  menus: menus
45
46
  }));
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js"],"names":["TemplatePartNavigationMenus","menus","length"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIe,SAASA,2BAAT,CAAsC;AAAEC,EAAAA;AAAF,CAAtC,EAAkD;AAChE,MAAK,CAAEA,KAAK,CAACC,MAAb,EAAsB,OAAO,IAAP,CAD0C,CAGhE;;AACA,MAAKD,KAAK,CAACC,MAAN,KAAiB,CAAtB,EAA0B;AACzB,WAAO,4BAAC,mCAAD;AAA4B,MAAA,EAAE,EAAGD,KAAK,CAAE,CAAF;AAAtC,MAAP;AACA,GAN+D,CAQhE;;;AACA,SACC,qDACC,4BAAC,iCAAD;AACC,IAAA,SAAS,EAAC,0EADX;AAEC,IAAA,IAAI,EAAC,IAFN;AAGC,IAAA,SAAS,EAAG;AAHb,KAKG,cAAI,YAAJ,CALH,CADD,EAQC,4BAAC,uCAAD;AAAgC,IAAA,KAAK,EAAGA;AAAxC,IARD,CADD;AAYA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n/**\n * Internal dependencies\n */\nimport TemplatePartNavigationMenu from './template-part-navigation-menu';\nimport TemplatePartNavigationMenuList from './template-part-navigation-menu-list';\n\nexport default function TemplatePartNavigationMenus( { menus } ) {\n\tif ( ! menus.length ) return null;\n\n\t// if there is a single menu then render TemplatePartNavigationMenu\n\tif ( menus.length === 1 ) {\n\t\treturn <TemplatePartNavigationMenu id={ menus[ 0 ] } />;\n\t}\n\n\t// if there are multiple menus then render TemplatePartNavigationMenuList\n\treturn (\n\t\t<>\n\t\t\t<Heading\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title\"\n\t\t\t\tsize=\"12\"\n\t\t\t\tupperCase={ true }\n\t\t\t>\n\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t</Heading>\n\t\t\t<TemplatePartNavigationMenuList menus={ menus } />\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js"],"names":["TemplatePartNavigationMenus","menus","length"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIe,SAASA,2BAAT,CAAsC;AAAEC,EAAAA;AAAF,CAAtC,EAAkD;AAChE,MAAK,CAAEA,KAAK,CAACC,MAAb,EAAsB,OAAO,IAAP,CAD0C,CAGhE;;AACA,MAAKD,KAAK,CAACC,MAAN,KAAiB,CAAtB,EAA0B;AACzB,WAAO,4BAAC,mCAAD;AAA4B,MAAA,EAAE,EAAGD,KAAK,CAAE,CAAF;AAAtC,MAAP;AACA,GAN+D,CAQhE;;;AACA,SACC,qDACC,4BAAC,iCAAD;AACC,IAAA,SAAS,EAAC,0EADX;AAEC,IAAA,IAAI,EAAC,IAFN;AAGC,IAAA,SAAS,EAAG,IAHb;AAIC,IAAA,MAAM,EAAG;AAJV,KAMG,cAAI,YAAJ,CANH,CADD,EASC,4BAAC,uCAAD;AAAgC,IAAA,KAAK,EAAGA;AAAxC,IATD,CADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n/**\n * Internal dependencies\n */\nimport TemplatePartNavigationMenu from './template-part-navigation-menu';\nimport TemplatePartNavigationMenuList from './template-part-navigation-menu-list';\n\nexport default function TemplatePartNavigationMenus( { menus } ) {\n\tif ( ! menus.length ) return null;\n\n\t// if there is a single menu then render TemplatePartNavigationMenu\n\tif ( menus.length === 1 ) {\n\t\treturn <TemplatePartNavigationMenu id={ menus[ 0 ] } />;\n\t}\n\n\t// if there are multiple menus then render TemplatePartNavigationMenuList\n\treturn (\n\t\t<>\n\t\t\t<Heading\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title\"\n\t\t\t\tsize=\"11\"\n\t\t\t\tupperCase={ true }\n\t\t\t\tweight={ 500 }\n\t\t\t>\n\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t</Heading>\n\t\t\t<TemplatePartNavigationMenuList menus={ menus } />\n\t\t</>\n\t);\n}\n"]}
@@ -9,10 +9,16 @@ exports.default = useNavigationMenuContent;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
+ var _blocks2 = require("@wordpress/blocks");
13
+
12
14
  var _templatePartNavigationMenus = _interopRequireDefault(require("./template-part-navigation-menus"));
13
15
 
14
16
  var _useEditedEntityRecord = _interopRequireDefault(require("../use-edited-entity-record"));
15
17
 
18
+ /**
19
+ * WordPress dependencies
20
+ */
21
+
16
22
  /**
17
23
  * Internal dependencies
18
24
  */
@@ -68,15 +74,24 @@ function useNavigationMenuContent(postType, postId) {
68
74
  return;
69
75
  }
70
76
 
71
- const navigationBlocks = getBlocksOfTypeFromBlocks('core/navigation', record?.blocks);
72
- const navigationMenuIds = navigationBlocks?.map(block => block.attributes.ref);
77
+ const blocks = record?.content && typeof record.content !== 'function' ? (0, _blocks2.parse)(record.content) : [];
78
+ const navigationBlocks = getBlocksOfTypeFromBlocks('core/navigation', blocks);
79
+
80
+ if (!navigationBlocks.length) {
81
+ return;
82
+ }
83
+
84
+ const navigationMenuIds = navigationBlocks?.map(block => block.attributes.ref); // Dedupe the Navigation blocks, as you can have multiple navigation blocks in the template.
85
+ // Also, filter out undefined values, as blocks don't have an id when initially added.
86
+
87
+ const uniqueNavigationMenuIds = [...new Set(navigationMenuIds)].filter(menuId => menuId);
73
88
 
74
- if (!navigationMenuIds?.length) {
89
+ if (!uniqueNavigationMenuIds?.length) {
75
90
  return;
76
91
  }
77
92
 
78
93
  return (0, _element.createElement)(_templatePartNavigationMenus.default, {
79
- menus: navigationMenuIds
94
+ menus: uniqueNavigationMenuIds
80
95
  });
81
96
  }
82
97
  //# sourceMappingURL=use-navigation-menu-content.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js"],"names":["getBlocksOfTypeFromBlocks","targetBlockType","blocks","length","findInBlocks","_blocks","navigationBlocks","block","name","push","innerBlocks","innerNavigationBlocks","useNavigationMenuContent","postType","postId","record","navigationMenuIds","map","attributes","ref"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,yBAAT,CAAoCC,eAApC,EAAqDC,MAArD,EAA8D;AAC7D,MAAK,CAAED,eAAF,IAAqB,CAAEC,MAAM,EAAEC,MAApC,EAA6C;AAC5C,WAAO,EAAP;AACA;;AAED,QAAMC,YAAY,GAAKC,OAAF,IAAe;AACnC,QAAK,CAAEA,OAAP,EAAiB;AAChB,aAAO,EAAP;AACA;;AAED,UAAMC,gBAAgB,GAAG,EAAzB;;AAEA,SAAM,MAAMC,KAAZ,IAAqBF,OAArB,EAA+B;AAC9B,UAAKE,KAAK,CAACC,IAAN,KAAeP,eAApB,EAAsC;AACrCK,QAAAA,gBAAgB,CAACG,IAAjB,CAAuBF,KAAvB;AACA;;AAED,UAAKA,KAAK,EAAEG,WAAZ,EAA0B;AACzB,cAAMC,qBAAqB,GAAGP,YAAY,CAAEG,KAAK,CAACG,WAAR,CAA1C;;AAEA,YAAKC,qBAAqB,CAACR,MAA3B,EAAoC;AACnCG,UAAAA,gBAAgB,CAACG,IAAjB,CAAuB,GAAGE,qBAA1B;AACA;AACD;AACD;;AAED,WAAOL,gBAAP;AACA,GAtBD;;AAwBA,SAAOF,YAAY,CAAEF,MAAF,CAAnB;AACA;;AAEc,SAASU,wBAAT,CAAmCC,QAAnC,EAA6CC,MAA7C,EAAsD;AACpE,QAAM;AAAEC,IAAAA;AAAF,MAAa,oCAAuBF,QAAvB,EAAiCC,MAAjC,CAAnB,CADoE,CAGpE;AACA;AACA;;AACA,MAAKD,QAAQ,KAAK,kBAAlB,EAAuC;AACtC;AACA;;AAED,QAAMP,gBAAgB,GAAGN,yBAAyB,CACjD,iBADiD,EAEjDe,MAAM,EAAEb,MAFyC,CAAlD;AAKA,QAAMc,iBAAiB,GAAGV,gBAAgB,EAAEW,GAAlB,CACvBV,KAAF,IAAaA,KAAK,CAACW,UAAN,CAAiBC,GADL,CAA1B;;AAIA,MAAK,CAAEH,iBAAiB,EAAEb,MAA1B,EAAmC;AAClC;AACA;;AAED,SAAO,4BAAC,oCAAD;AAA6B,IAAA,KAAK,EAAGa;AAArC,IAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport TemplatePartNavigationMenus from './template-part-navigation-menus';\nimport useEditedEntityRecord from '../use-edited-entity-record';\n\n/**\n * Retrieves a list of specific blocks from a given tree of blocks.\n *\n * @param {string} targetBlockType The name of the block type to find.\n * @param {Array} blocks A list of blocks from a template part entity.\n *\n * @return {Array} A list of any navigation blocks found in the blocks.\n */\nfunction getBlocksOfTypeFromBlocks( targetBlockType, blocks ) {\n\tif ( ! targetBlockType || ! blocks?.length ) {\n\t\treturn [];\n\t}\n\n\tconst findInBlocks = ( _blocks ) => {\n\t\tif ( ! _blocks ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst navigationBlocks = [];\n\n\t\tfor ( const block of _blocks ) {\n\t\t\tif ( block.name === targetBlockType ) {\n\t\t\t\tnavigationBlocks.push( block );\n\t\t\t}\n\n\t\t\tif ( block?.innerBlocks ) {\n\t\t\t\tconst innerNavigationBlocks = findInBlocks( block.innerBlocks );\n\n\t\t\t\tif ( innerNavigationBlocks.length ) {\n\t\t\t\t\tnavigationBlocks.push( ...innerNavigationBlocks );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn navigationBlocks;\n\t};\n\n\treturn findInBlocks( blocks );\n}\n\nexport default function useNavigationMenuContent( postType, postId ) {\n\tconst { record } = useEditedEntityRecord( postType, postId );\n\n\t// Only managing navigation menus in template parts is supported\n\t// to match previous behaviour. This could potentially be expanded\n\t// to patterns as well.\n\tif ( postType !== 'wp_template_part' ) {\n\t\treturn;\n\t}\n\n\tconst navigationBlocks = getBlocksOfTypeFromBlocks(\n\t\t'core/navigation',\n\t\trecord?.blocks\n\t);\n\n\tconst navigationMenuIds = navigationBlocks?.map(\n\t\t( block ) => block.attributes.ref\n\t);\n\n\tif ( ! navigationMenuIds?.length ) {\n\t\treturn;\n\t}\n\n\treturn <TemplatePartNavigationMenus menus={ navigationMenuIds } />;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js"],"names":["getBlocksOfTypeFromBlocks","targetBlockType","blocks","length","findInBlocks","_blocks","navigationBlocks","block","name","push","innerBlocks","innerNavigationBlocks","useNavigationMenuContent","postType","postId","record","content","navigationMenuIds","map","attributes","ref","uniqueNavigationMenuIds","Set","filter","menuId"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AAC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AxB,EAAiC;AAChC;AACA;;AAED,QAAMc,iBAAiB,GAAGX,gBAAgB,EAAEY,GAAlB,CACvBX,KAAF,IAAaA,KAAK,CAACY,UAAN,CAAiBC,GADL,CAA1B,CAxBoE,CA4BpE;AACA;;AACA,QAAMC,uBAAuB,GAAG,CAAE,GAAG,IAAIC,GAAJ,CAASL,iBAAT,CAAL,EAAoCM,MAApC,CAC7BC,MAAF,IAAcA,MADiB,CAAhC;;AAIA,MAAK,CAAEH,uBAAuB,EAAElB,MAAhC,EAAyC;AACxC;AACA;;AAED,SAAO,4BAAC,oCAAD;AAA6B,IAAA,KAAK,EAAGkB;AAArC,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { parse } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartNavigationMenus from './template-part-navigation-menus';\nimport useEditedEntityRecord from '../use-edited-entity-record';\n\n/**\n * Retrieves a list of specific blocks from a given tree of blocks.\n *\n * @param {string} targetBlockType The name of the block type to find.\n * @param {Array} blocks A list of blocks from a template part entity.\n *\n * @return {Array} A list of any navigation blocks found in the blocks.\n */\nfunction getBlocksOfTypeFromBlocks( targetBlockType, blocks ) {\n\tif ( ! targetBlockType || ! blocks?.length ) {\n\t\treturn [];\n\t}\n\n\tconst findInBlocks = ( _blocks ) => {\n\t\tif ( ! _blocks ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst navigationBlocks = [];\n\n\t\tfor ( const block of _blocks ) {\n\t\t\tif ( block.name === targetBlockType ) {\n\t\t\t\tnavigationBlocks.push( block );\n\t\t\t}\n\n\t\t\tif ( block?.innerBlocks ) {\n\t\t\t\tconst innerNavigationBlocks = findInBlocks( block.innerBlocks );\n\n\t\t\t\tif ( innerNavigationBlocks.length ) {\n\t\t\t\t\tnavigationBlocks.push( ...innerNavigationBlocks );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn navigationBlocks;\n\t};\n\n\treturn findInBlocks( blocks );\n}\n\nexport default function useNavigationMenuContent( postType, postId ) {\n\tconst { record } = useEditedEntityRecord( postType, postId );\n\n\t// Only managing navigation menus in template parts is supported\n\t// to match previous behaviour. This could potentially be expanded\n\t// to patterns as well.\n\tif ( postType !== 'wp_template_part' ) {\n\t\treturn;\n\t}\n\n\tconst blocks =\n\t\trecord?.content && typeof record.content !== 'function'\n\t\t\t? parse( record.content )\n\t\t\t: [];\n\n\tconst navigationBlocks = getBlocksOfTypeFromBlocks(\n\t\t'core/navigation',\n\t\tblocks\n\t);\n\n\tif ( ! navigationBlocks.length ) {\n\t\treturn;\n\t}\n\n\tconst navigationMenuIds = navigationBlocks?.map(\n\t\t( block ) => block.attributes.ref\n\t);\n\n\t// Dedupe the Navigation blocks, as you can have multiple navigation blocks in the template.\n\t// Also, filter out undefined values, as blocks don't have an id when initially added.\n\tconst uniqueNavigationMenuIds = [ ...new Set( navigationMenuIds ) ].filter(\n\t\t( menuId ) => menuId\n\t);\n\n\tif ( ! uniqueNavigationMenuIds?.length ) {\n\t\treturn;\n\t}\n\n\treturn <TemplatePartNavigationMenus menus={ uniqueNavigationMenuIds } />;\n}\n"]}
@@ -9,13 +9,15 @@ exports.default = usePatternDetails;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
+ var _changeCase = require("change-case");
13
+
12
14
  var _i18n = require("@wordpress/i18n");
13
15
 
14
16
  var _coreData = require("@wordpress/core-data");
15
17
 
16
- var _data = require("@wordpress/data");
18
+ var _editor = require("@wordpress/editor");
17
19
 
18
- var _components = require("@wordpress/components");
20
+ var _data = require("@wordpress/data");
19
21
 
20
22
  var _addedBy = require("../list/added-by");
21
23
 
@@ -27,6 +29,12 @@ var _sidebarNavigationScreenDetailsFooter = _interopRequireDefault(require("../s
27
29
 
28
30
  var _sidebarNavigationScreenDetailsPanel = require("../sidebar-navigation-screen-details-panel");
29
31
 
32
+ var _normalizeRecordKey = _interopRequireDefault(require("../../utils/normalize-record-key"));
33
+
34
+ /**
35
+ * External dependencies
36
+ */
37
+
30
38
  /**
31
39
  * WordPress dependencies
32
40
  */
@@ -35,56 +43,75 @@ var _sidebarNavigationScreenDetailsPanel = require("../sidebar-navigation-screen
35
43
  * Internal dependencies
36
44
  */
37
45
  function usePatternDetails(postType, postId) {
46
+ postId = (0, _normalizeRecordKey.default)(postId);
38
47
  const {
39
48
  getDescription,
40
49
  getTitle,
41
50
  record
42
51
  } = (0, _useEditedEntityRecord.default)(postType, postId);
52
+ const templatePartAreas = (0, _data.useSelect)(select => select(_editor.store).__experimentalGetDefaultTemplatePartAreas(), []);
43
53
  const currentTheme = (0, _data.useSelect)(select => select(_coreData.store).getCurrentTheme(), []);
44
54
  const addedBy = (0, _addedBy.useAddedBy)(postType, postId);
45
55
  const isAddedByActiveTheme = addedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;
46
56
  const title = getTitle();
47
- let descriptionText = getDescription();
57
+ let description = getDescription();
48
58
 
49
- if (!descriptionText && addedBy.text) {
50
- descriptionText = (0, _i18n.sprintf)( // translators: %s: pattern title e.g: "Header".
51
- (0, _i18n.__)('This is your %s pattern.'), getTitle());
59
+ if (!description && addedBy.text) {
60
+ description = (0, _i18n.sprintf)( // translators: %s: pattern title e.g: "Header".
61
+ (0, _i18n.__)('This is the %s pattern.'), getTitle());
52
62
  }
53
63
 
54
- if (!descriptionText && postType === 'wp_block' && record?.title) {
55
- descriptionText = (0, _i18n.sprintf)( // translators: %s: user created pattern title e.g. "Footer".
56
- (0, _i18n.__)('This is your %s pattern.'), record.title);
64
+ if (!description && postType === 'wp_block' && record?.title) {
65
+ description = (0, _i18n.sprintf)( // translators: %s: user created pattern title e.g. "Footer".
66
+ (0, _i18n.__)('This is the %s pattern.'), record.title);
57
67
  }
58
68
 
59
- const description = (0, _element.createElement)(_element.Fragment, null, descriptionText, addedBy.text && !isAddedByActiveTheme && (0, _element.createElement)("span", {
60
- className: "edit-site-sidebar-navigation-screen-pattern__added-by-description"
61
- }, (0, _element.createElement)("span", {
62
- className: "edit-site-sidebar-navigation-screen-pattern__added-by-description-author"
63
- }, (0, _element.createElement)("span", {
64
- className: "edit-site-sidebar-navigation-screen-pattern__added-by-description-author-icon"
65
- }, addedBy.imageUrl ? (0, _element.createElement)("img", {
66
- src: addedBy.imageUrl,
67
- alt: "",
68
- width: "24",
69
- height: "24"
70
- }) : (0, _element.createElement)(_components.Icon, {
71
- icon: addedBy.icon
72
- })), addedBy.text), addedBy.isCustomized && (0, _element.createElement)("span", {
73
- className: "edit-site-sidebar-navigation-screen-pattern__added-by-description-customized"
74
- }, (0, _i18n._x)('(Customized)', 'pattern'))));
75
69
  const footer = !!record?.modified ? (0, _element.createElement)(_sidebarNavigationScreenDetailsFooter.default, {
76
70
  lastModifiedDateTime: record.modified
77
71
  }) : null;
78
72
  const details = [];
79
73
 
80
- if (postType === 'wp_block') {
74
+ if (postType === 'wp_block' || 'wp_template_part') {
81
75
  details.push({
82
76
  label: (0, _i18n.__)('Syncing'),
83
77
  value: record.wp_pattern_sync_status === 'unsynced' ? (0, _i18n.__)('Not synced') : (0, _i18n.__)('Fully synced')
84
78
  });
85
79
  }
86
80
 
87
- const content = (0, _element.createElement)(_element.Fragment, null, !!details.length && (0, _element.createElement)(_sidebarNavigationScreenDetailsPanel.SidebarNavigationScreenDetailsPanel, {
81
+ if (postType === 'wp_template_part') {
82
+ const templatePartArea = templatePartAreas.find(area => area.area === record.area);
83
+ let areaDetailValue = templatePartArea?.label;
84
+
85
+ if (!areaDetailValue) {
86
+ areaDetailValue = record.area ? (0, _i18n.sprintf)( // translators: %s: Sentenced cased template part area e.g: "My custom area".
87
+ (0, _i18n.__)('%s (removed)'), (0, _changeCase.sentenceCase)(record.area)) : (0, _i18n.__)('None');
88
+ }
89
+
90
+ details.push({
91
+ label: (0, _i18n.__)('Area'),
92
+ value: areaDetailValue
93
+ });
94
+ }
95
+
96
+ if (postType === 'wp_template_part' && addedBy.text && !isAddedByActiveTheme) {
97
+ details.push({
98
+ label: (0, _i18n.__)('Added by'),
99
+ value: (0, _element.createElement)("span", {
100
+ className: "edit-site-sidebar-navigation-screen-pattern__added-by-description-author"
101
+ }, addedBy.text)
102
+ });
103
+ }
104
+
105
+ if (postType === 'wp_template_part' && addedBy.text && (record.origin === 'plugin' || record.has_theme_file === true)) {
106
+ details.push({
107
+ label: (0, _i18n.__)('Customized'),
108
+ value: (0, _element.createElement)("span", {
109
+ className: "edit-site-sidebar-navigation-screen-pattern__added-by-description-customized"
110
+ }, addedBy.isCustomized ? (0, _i18n.__)('Yes') : (0, _i18n.__)('No'))
111
+ });
112
+ }
113
+
114
+ const content = (0, _element.createElement)(_element.Fragment, null, (0, _useNavigationMenuContent.default)(postType, postId), !!details.length && (0, _element.createElement)(_sidebarNavigationScreenDetailsPanel.SidebarNavigationScreenDetailsPanel, {
88
115
  spacing: 5,
89
116
  title: (0, _i18n.__)('Details')
90
117
  }, details.map(({
@@ -92,7 +119,7 @@ function usePatternDetails(postType, postId) {
92
119
  value
93
120
  }) => (0, _element.createElement)(_sidebarNavigationScreenDetailsPanel.SidebarNavigationScreenDetailsPanelRow, {
94
121
  key: label
95
- }, (0, _element.createElement)(_sidebarNavigationScreenDetailsPanel.SidebarNavigationScreenDetailsPanelLabel, null, label), (0, _element.createElement)(_sidebarNavigationScreenDetailsPanel.SidebarNavigationScreenDetailsPanelValue, null, value)))), (0, _useNavigationMenuContent.default)(postType, postId));
122
+ }, (0, _element.createElement)(_sidebarNavigationScreenDetailsPanel.SidebarNavigationScreenDetailsPanelLabel, null, label), (0, _element.createElement)(_sidebarNavigationScreenDetailsPanel.SidebarNavigationScreenDetailsPanelValue, null, value)))));
96
123
  return {
97
124
  title,
98
125
  description,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"names":["usePatternDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","coreStore","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","description","imageUrl","icon","isCustomized","footer","modified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CC,MAApC,CAlBH,CADD;AAuBA,SAAO;AAAEa,IAAAA,KAAF;AAASG,IAAAA,WAAT;AAAsBW,IAAAA,OAAtB;AAA+BP,IAAAA;AAA/B,GAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { Icon } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from '../list/added-by';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport useNavigationMenuContent from './use-navigation-menu-content';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\n\nexport default function usePatternDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet descriptionText = getDescription();\n\n\tif ( ! descriptionText && addedBy.text ) {\n\t\tdescriptionText = sprintf(\n\t\t\t// translators: %s: pattern title e.g: \"Header\".\n\t\t\t__( 'This is your %s pattern.' ),\n\t\t\tgetTitle()\n\t\t);\n\t}\n\n\tif ( ! descriptionText && postType === 'wp_block' && record?.title ) {\n\t\tdescriptionText = sprintf(\n\t\t\t// translators: %s: user created pattern title e.g. \"Footer\".\n\t\t\t__( 'This is your %s pattern.' ),\n\t\t\trecord.title\n\t\t);\n\t}\n\n\tconst description = (\n\t\t<>\n\t\t\t{ descriptionText }\n\n\t\t\t{ addedBy.text && ! isAddedByActiveTheme && (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description\">\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author\">\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author-icon\">\n\t\t\t\t\t\t\t{ addedBy.imageUrl ? (\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tsrc={ addedBy.imageUrl }\n\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\twidth=\"24\"\n\t\t\t\t\t\t\t\t\theight=\"24\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Icon icon={ addedBy.icon } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ addedBy.text }\n\t\t\t\t\t</span>\n\n\t\t\t\t\t{ addedBy.isCustomized && (\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized\">\n\t\t\t\t\t\t\t{ _x( '(Customized)', 'pattern' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</>\n\t);\n\n\tconst footer = !! record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\tlastModifiedDateTime={ record.modified }\n\t\t/>\n\t) : null;\n\n\tconst details = [];\n\n\tif ( postType === 'wp_block' ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Syncing' ),\n\t\t\tvalue:\n\t\t\t\trecord.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t\t? __( 'Not synced' )\n\t\t\t\t\t: __( 'Fully synced' ),\n\t\t} );\n\t}\n\n\tconst content = (\n\t\t<>\n\t\t\t{ !! details.length && (\n\t\t\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\t\t\tspacing={ 5 }\n\t\t\t\t\ttitle={ __( 'Details' ) }\n\t\t\t\t>\n\t\t\t\t\t{ details.map( ( { label, value } ) => (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t\t\t{ value }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t\t\t) ) }\n\t\t\t\t</SidebarNavigationScreenDetailsPanel>\n\t\t\t) }\n\t\t\t{ useNavigationMenuContent( postType, postId ) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"names":["usePatternDetails","postType","postId","getDescription","getTitle","record","templatePartAreas","select","editorStore","__experimentalGetDefaultTemplatePartAreas","currentTheme","coreStore","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","description","text","footer","modified","details","push","label","value","wp_pattern_sync_status","templatePartArea","find","area","areaDetailValue","origin","has_theme_file","isCustomized","content","length","map"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAae,SAASA,iBAAT,CAA4BC,QAA5B,EAAsCC,MAAtC,EAA+C;AAC7DA,EAAAA,MAAM,GAAG,iCAAoBA,MAApB,CAAT;AAEA,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA;AAA5B,MAAuC,oCAC5CJ,QAD4C,EAE5CC,MAF4C,CAA7C;A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QA;;AAED,QAAMC,OAAO,GACZ,qDACG,uCAA0BlC,QAA1B,EAAoCC,MAApC,CADH,EAEG,CAAC,CAAEqB,OAAO,CAACa,MAAX,IACD,4BAAC,wEAAD;AACC,IAAA,OAAO,EAAG,CADX;AAEC,IAAA,KAAK,EAAG,cAAI,SAAJ;AAFT,KAIGb,OAAO,CAACc,GAAR,CAAa,CAAE;AAAEZ,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAF,KACd,4BAAC,2EAAD;AAAwC,IAAA,GAAG,EAAGD;AAA9C,KACC,4BAAC,6EAAD,QACGA,KADH,CADD,EAIC,4BAAC,6EAAD,QACGC,KADH,CAJD,CADC,CAJH,CAHF,CADD;AAuBA,SAAO;AAAER,IAAAA,KAAF;AAASC,IAAAA,WAAT;AAAsBgB,IAAAA,OAAtB;AAA+Bd,IAAAA;AAA/B,GAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { sentenceCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from '../list/added-by';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport useNavigationMenuContent from './use-navigation-menu-content';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\nimport normalizeRecordKey from '../../utils/normalize-record-key';\n\nexport default function usePatternDetails( postType, postId ) {\n\tpostId = normalizeRecordKey( postId );\n\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet description = getDescription();\n\n\tif ( ! description && addedBy.text ) {\n\t\tdescription = sprintf(\n\t\t\t// translators: %s: pattern title e.g: \"Header\".\n\t\t\t__( 'This is the %s pattern.' ),\n\t\t\tgetTitle()\n\t\t);\n\t}\n\n\tif ( ! description && postType === 'wp_block' && record?.title ) {\n\t\tdescription = sprintf(\n\t\t\t// translators: %s: user created pattern title e.g. \"Footer\".\n\t\t\t__( 'This is the %s pattern.' ),\n\t\t\trecord.title\n\t\t);\n\t}\n\n\tconst footer = !! record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\tlastModifiedDateTime={ record.modified }\n\t\t/>\n\t) : null;\n\n\tconst details = [];\n\n\tif ( postType === 'wp_block' || 'wp_template_part' ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Syncing' ),\n\t\t\tvalue:\n\t\t\t\trecord.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t\t? __( 'Not synced' )\n\t\t\t\t\t: __( 'Fully synced' ),\n\t\t} );\n\t}\n\n\tif ( postType === 'wp_template_part' ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === record.area\n\t\t);\n\n\t\tlet areaDetailValue = templatePartArea?.label;\n\n\t\tif ( ! areaDetailValue ) {\n\t\t\tareaDetailValue = record.area\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: Sentenced cased template part area e.g: \"My custom area\".\n\t\t\t\t\t\t__( '%s (removed)' ),\n\t\t\t\t\t\tsentenceCase( record.area )\n\t\t\t\t )\n\t\t\t\t: __( 'None' );\n\t\t}\n\n\t\tdetails.push( { label: __( 'Area' ), value: areaDetailValue } );\n\t}\n\n\tif (\n\t\tpostType === 'wp_template_part' &&\n\t\taddedBy.text &&\n\t\t! isAddedByActiveTheme\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Added by' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author\">\n\t\t\t\t\t{ addedBy.text }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tif (\n\t\tpostType === 'wp_template_part' &&\n\t\taddedBy.text &&\n\t\t( record.origin === 'plugin' || record.has_theme_file === true )\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Customized' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized\">\n\t\t\t\t\t{ addedBy.isCustomized ? __( 'Yes' ) : __( 'No' ) }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tconst content = (\n\t\t<>\n\t\t\t{ useNavigationMenuContent( postType, postId ) }\n\t\t\t{ !! details.length && (\n\t\t\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\t\t\tspacing={ 5 }\n\t\t\t\t\ttitle={ __( 'Details' ) }\n\t\t\t\t>\n\t\t\t\t\t{ details.map( ( { label, value } ) => (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t\t\t{ value }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t\t\t) ) }\n\t\t\t\t</SidebarNavigationScreenDetailsPanel>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n"]}
@@ -28,11 +28,6 @@ function CategoryItem({
28
28
  path: '/patterns',
29
29
  categoryType: type,
30
30
  categoryId: id
31
- }, {
32
- // Keep a record of where we came from in state so we can
33
- // use the browser's back button to go back to Patterns.
34
- // See the implementation of the back button in patterns-list.
35
- backPath: '/patterns'
36
31
  });
37
32
 
38
33
  if (!count) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/category-item.js"],"names":["CategoryItem","count","icon","id","isActive","label","type","linkInfo","path","categoryType","categoryId","backPath","undefined"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIe,SAASA,YAAT,CAAuB;AACrCC,EAAAA,KADqC;AAErCC,EAAAA,IAFqC;AAGrCC,EAAAA,EAHqC;AAIrCC,EAAAA,QAJqC;AAKrCC,EAAAA,KALqC;AAMrCC,EAAAA;AANqC,CAAvB,EAOX;AACH,QAAMC,QAAQ,GAAG,mBAChB;AACCC,IAAAA,IAAI,EAAE,WADP;AAECC,IAAAA,YAAY,EAAEH,IAFf;AAGCI,IAAAA,UAAU,EAAEP;AAHb,GADgB,EAMhB;AACC;AACA;AACA;AACAQ,IAAAA,QAAQ,EAAE;AAJX,GANgB,CAAjB;;AAcA,MAAK,CAAEV,KAAP,EAAe;AACd;AACA;;AAED,SACC,4BAAC,8BAAD,OACMM,QADN;AAEC,IAAA,IAAI,EAAGL,IAFR;AAGC,IAAA,MAAM,EAAG,0CAAQD,KAAR,CAHV;AAIC,oBAAeG,QAAQ,GAAG,MAAH,GAAYQ;AAJpC,KAMGP,KANH,CADD;AAUA","sourcesContent":["/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { useLink } from '../routes/link';\n\nexport default function CategoryItem( {\n\tcount,\n\ticon,\n\tid,\n\tisActive,\n\tlabel,\n\ttype,\n} ) {\n\tconst linkInfo = useLink(\n\t\t{\n\t\t\tpath: '/patterns',\n\t\t\tcategoryType: type,\n\t\t\tcategoryId: id,\n\t\t},\n\t\t{\n\t\t\t// Keep a record of where we came from in state so we can\n\t\t\t// use the browser's back button to go back to Patterns.\n\t\t\t// See the implementation of the back button in patterns-list.\n\t\t\tbackPath: '/patterns',\n\t\t}\n\t);\n\n\tif ( ! count ) {\n\t\treturn;\n\t}\n\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...linkInfo }\n\t\t\ticon={ icon }\n\t\t\tsuffix={ <span>{ count }</span> }\n\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t>\n\t\t\t{ label }\n\t\t</SidebarNavigationItem>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/category-item.js"],"names":["CategoryItem","count","icon","id","isActive","label","type","linkInfo","path","categoryType","categoryId","undefined"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIe,SAASA,YAAT,CAAuB;AACrCC,EAAAA,KADqC;AAErCC,EAAAA,IAFqC;AAGrCC,EAAAA,EAHqC;AAIrCC,EAAAA,QAJqC;AAKrCC,EAAAA,KALqC;AAMrCC,EAAAA;AANqC,CAAvB,EAOX;AACH,QAAMC,QAAQ,GAAG,mBAAS;AACzBC,IAAAA,IAAI,EAAE,WADmB;AAEzBC,IAAAA,YAAY,EAAEH,IAFW;AAGzBI,IAAAA,UAAU,EAAEP;AAHa,GAAT,CAAjB;;AAMA,MAAK,CAAEF,KAAP,EAAe;AACd;AACA;;AAED,SACC,4BAAC,8BAAD,OACMM,QADN;AAEC,IAAA,IAAI,EAAGL,IAFR;AAGC,IAAA,MAAM,EAAG,0CAAQD,KAAR,CAHV;AAIC,oBAAeG,QAAQ,GAAG,MAAH,GAAYO;AAJpC,KAMGN,KANH,CADD;AAUA","sourcesContent":["/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { useLink } from '../routes/link';\n\nexport default function CategoryItem( {\n\tcount,\n\ticon,\n\tid,\n\tisActive,\n\tlabel,\n\ttype,\n} ) {\n\tconst linkInfo = useLink( {\n\t\tpath: '/patterns',\n\t\tcategoryType: type,\n\t\tcategoryId: id,\n\t} );\n\n\tif ( ! count ) {\n\t\treturn;\n\t}\n\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...linkInfo }\n\t\t\ticon={ icon }\n\t\t\tsuffix={ <span>{ count }</span> }\n\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t>\n\t\t\t{ label }\n\t\t</SidebarNavigationItem>\n\t);\n}\n"]}