@wordpress/edit-site 5.13.0 → 5.15.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 (646) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-page/index.js +2 -13
  3. package/build/components/add-new-page/index.js.map +1 -1
  4. package/build/components/add-new-pattern/index.js +29 -15
  5. package/build/components/add-new-pattern/index.js.map +1 -1
  6. package/build/components/add-new-template/add-custom-generic-template-modal-content.js +2 -2
  7. package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  8. package/build/components/add-new-template/new-template.js +69 -14
  9. package/build/components/add-new-template/new-template.js.map +1 -1
  10. package/build/components/add-new-template/utils.js +10 -8
  11. package/build/components/add-new-template/utils.js.map +1 -1
  12. package/build/components/block-editor/constants.js +1 -1
  13. package/build/components/block-editor/constants.js.map +1 -1
  14. package/build/components/block-editor/editor-canvas.js +1 -1
  15. package/build/components/block-editor/editor-canvas.js.map +1 -1
  16. package/build/components/block-editor/index.js +0 -4
  17. package/build/components/block-editor/index.js.map +1 -1
  18. package/build/components/block-editor/inserter-media-categories.js +1 -22
  19. package/build/components/block-editor/inserter-media-categories.js.map +1 -1
  20. package/build/components/block-editor/site-editor-canvas.js +29 -32
  21. package/build/components/block-editor/site-editor-canvas.js.map +1 -1
  22. package/build/components/block-editor/use-site-editor-settings.js +90 -19
  23. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  24. package/build/components/canvas-spinner/index.js +1 -18
  25. package/build/components/canvas-spinner/index.js.map +1 -1
  26. package/build/components/code-editor/index.js +60 -28
  27. package/build/components/code-editor/index.js.map +1 -1
  28. package/build/components/create-pattern-modal/index.js +15 -11
  29. package/build/components/create-pattern-modal/index.js.map +1 -1
  30. package/build/components/create-template-part-modal/index.js +1 -1
  31. package/build/components/create-template-part-modal/index.js.map +1 -1
  32. package/build/components/editor/index.js +11 -1
  33. package/build/components/editor/index.js.map +1 -1
  34. package/build/components/global-styles/palette.js +1 -1
  35. package/build/components/global-styles/palette.js.map +1 -1
  36. package/build/components/global-styles/ui.js +7 -2
  37. package/build/components/global-styles/ui.js.map +1 -1
  38. package/build/components/header-edit-mode/document-actions/index.js +9 -1
  39. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  40. package/build/components/header-edit-mode/index.js +49 -14
  41. package/build/components/header-edit-mode/index.js.map +1 -1
  42. package/build/components/header-edit-mode/more-menu/index.js +47 -17
  43. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  44. package/build/components/keyboard-shortcut-help-modal/index.js +17 -4
  45. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  46. package/build/components/keyboard-shortcuts/edit-mode.js +32 -1
  47. package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  48. package/build/components/keyboard-shortcuts/register.js +9 -0
  49. package/build/components/keyboard-shortcuts/register.js.map +1 -1
  50. package/build/components/layout/index.js +110 -28
  51. package/build/components/layout/index.js.map +1 -1
  52. package/build/components/page/header.js +1 -1
  53. package/build/components/page/header.js.map +1 -1
  54. package/build/components/page/index.js +3 -1
  55. package/build/components/page/index.js.map +1 -1
  56. package/build/components/page-actions/index.js +2 -2
  57. package/build/components/page-actions/index.js.map +1 -1
  58. package/build/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -15
  59. package/build/components/page-actions/trash-page-menu-item.js.map +1 -0
  60. package/build/components/page-content-focus-manager/back-to-page-notification.js +9 -3
  61. package/build/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
  62. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -5
  63. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  64. package/build/components/page-main/index.js +8 -4
  65. package/build/components/page-main/index.js.map +1 -1
  66. package/build/components/page-patterns/duplicate-menu-item.js +163 -0
  67. package/build/components/page-patterns/duplicate-menu-item.js.map +1 -0
  68. package/build/components/page-patterns/grid-item.js +218 -0
  69. package/build/components/page-patterns/grid-item.js.map +1 -0
  70. package/build/components/{page-library → page-patterns}/grid.js +6 -19
  71. package/build/components/page-patterns/grid.js.map +1 -0
  72. package/build/components/page-patterns/header.js +69 -0
  73. package/build/components/page-patterns/header.js.map +1 -0
  74. package/build/components/{page-library → page-patterns}/index.js +9 -7
  75. package/build/components/page-patterns/index.js.map +1 -0
  76. package/build/components/{page-library → page-patterns}/no-patterns.js +1 -1
  77. package/build/components/page-patterns/no-patterns.js.map +1 -0
  78. package/build/components/page-patterns/pagination.js +63 -0
  79. package/build/components/page-patterns/pagination.js.map +1 -0
  80. package/build/components/page-patterns/patterns-list.js +175 -0
  81. package/build/components/page-patterns/patterns-list.js.map +1 -0
  82. package/build/components/page-patterns/rename-menu-item.js +109 -0
  83. package/build/components/page-patterns/rename-menu-item.js.map +1 -0
  84. package/build/components/page-patterns/search-items.js.map +1 -0
  85. package/build/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +3 -3
  86. package/build/components/page-patterns/use-pattern-settings.js.map +1 -0
  87. package/build/components/page-patterns/use-patterns.js +185 -0
  88. package/build/components/page-patterns/use-patterns.js.map +1 -0
  89. package/build/components/{page-library → page-patterns}/utils.js +3 -3
  90. package/build/components/page-patterns/utils.js.map +1 -0
  91. package/build/components/page-template-parts/add-new-template-part.js +74 -0
  92. package/build/components/page-template-parts/add-new-template-part.js.map +1 -0
  93. package/build/components/page-template-parts/index.js +82 -0
  94. package/build/components/page-template-parts/index.js.map +1 -0
  95. package/build/components/page-templates/index.js +1 -0
  96. package/build/components/page-templates/index.js.map +1 -1
  97. package/build/components/preferences-modal/enable-feature.js +5 -1
  98. package/build/components/preferences-modal/enable-feature.js.map +1 -1
  99. package/build/components/preferences-modal/index.js +43 -4
  100. package/build/components/preferences-modal/index.js.map +1 -1
  101. package/build/components/resizable-frame/index.js +78 -36
  102. package/build/components/resizable-frame/index.js.map +1 -1
  103. package/build/components/save-panel/index.js +5 -5
  104. package/build/components/save-panel/index.js.map +1 -1
  105. package/build/components/sidebar/index.js +6 -6
  106. package/build/components/sidebar/index.js.map +1 -1
  107. package/build/components/sidebar-edit-mode/index.js +4 -2
  108. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  109. package/build/components/sidebar-edit-mode/page-panels/page-content.js +4 -3
  110. package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  111. package/build/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
  112. package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
  113. package/build/components/sidebar-edit-mode/settings-header/index.js +7 -1
  114. package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  115. package/build/components/sidebar-navigation-screen/index.js +21 -11
  116. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  117. package/build/components/sidebar-navigation-screen-global-styles/index.js +69 -5
  118. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  119. package/build/components/sidebar-navigation-screen-main/index.js +5 -3
  120. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  121. package/build/components/sidebar-navigation-screen-main/template-part-hint.js +45 -0
  122. package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
  123. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +7 -16
  124. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
  125. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -11
  126. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
  127. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +10 -10
  128. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  129. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  130. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  131. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +10 -1
  132. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  133. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +9 -3
  134. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  135. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +9 -4
  136. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  137. package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +29 -0
  138. package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -0
  139. package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
  140. package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
  141. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +27 -4
  142. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  143. package/build/components/sidebar-navigation-screen-page/index.js +2 -3
  144. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
  145. package/build/components/sidebar-navigation-screen-page/page-details.js +11 -4
  146. package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
  147. package/build/components/sidebar-navigation-screen-page/status-label.js +2 -35
  148. package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  149. package/build/components/sidebar-navigation-screen-pages/index.js +33 -25
  150. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  151. package/build/components/sidebar-navigation-screen-pattern/index.js +20 -13
  152. package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  153. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +4 -3
  154. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  155. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
  156. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  157. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +11 -3
  158. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
  159. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +28 -2
  160. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  161. package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
  162. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
  163. package/build/components/sidebar-navigation-screen-patterns/index.js +173 -0
  164. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
  165. package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
  166. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +34 -0
  167. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
  168. package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +11 -19
  169. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
  170. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +52 -0
  171. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
  172. package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +2 -2
  173. package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
  174. package/build/components/sidebar-navigation-screen-templates/index.js +11 -63
  175. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  176. package/build/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
  177. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  178. package/build/components/site-hub/index.js +25 -12
  179. package/build/components/site-hub/index.js.map +1 -1
  180. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +10 -5
  181. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  182. package/build/components/sync-state-with-url/use-sync-path-with-url.js +16 -13
  183. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  184. package/build/components/template-actions/index.js +25 -7
  185. package/build/components/template-actions/index.js.map +1 -1
  186. package/build/components/template-actions/rename-menu-item.js +12 -8
  187. package/build/components/template-actions/rename-menu-item.js.map +1 -1
  188. package/build/components/use-edited-entity-record/index.js +6 -1
  189. package/build/components/use-edited-entity-record/index.js.map +1 -1
  190. package/build/components/welcome-guide/editor.js +1 -1
  191. package/build/components/welcome-guide/editor.js.map +1 -1
  192. package/build/components/welcome-guide/index.js +5 -1
  193. package/build/components/welcome-guide/index.js.map +1 -1
  194. package/build/components/welcome-guide/page.js +70 -0
  195. package/build/components/welcome-guide/page.js.map +1 -0
  196. package/build/components/welcome-guide/styles.js +1 -1
  197. package/build/components/welcome-guide/styles.js.map +1 -1
  198. package/build/components/welcome-guide/template.js +71 -0
  199. package/build/components/welcome-guide/template.js.map +1 -0
  200. package/build/hooks/commands/use-common-commands.js +115 -20
  201. package/build/hooks/commands/use-common-commands.js.map +1 -1
  202. package/build/hooks/commands/use-edit-mode-commands.js +195 -44
  203. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  204. package/build/hooks/push-changes-to-global-styles/index.js +56 -10
  205. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  206. package/build/index.js +9 -0
  207. package/build/index.js.map +1 -1
  208. package/build/store/actions.js +5 -2
  209. package/build/store/actions.js.map +1 -1
  210. package/build/store/private-actions.js +7 -1
  211. package/build/store/private-actions.js.map +1 -1
  212. package/build/store/selectors.js +2 -1
  213. package/build/store/selectors.js.map +1 -1
  214. package/build/utils/get-is-list-page.js +2 -2
  215. package/build/utils/get-is-list-page.js.map +1 -1
  216. package/build/utils/normalize-record-key.js +19 -0
  217. package/build/utils/normalize-record-key.js.map +1 -0
  218. package/build/utils/template-part-create.js +2 -2
  219. package/build/utils/template-part-create.js.map +1 -1
  220. package/build/utils/use-activate-theme.js +1 -1
  221. package/build/utils/use-activate-theme.js.map +1 -1
  222. package/build-module/components/add-new-page/index.js +2 -12
  223. package/build-module/components/add-new-page/index.js.map +1 -1
  224. package/build-module/components/add-new-pattern/index.js +28 -16
  225. package/build-module/components/add-new-pattern/index.js.map +1 -1
  226. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +1 -1
  227. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  228. package/build-module/components/add-new-template/new-template.js +72 -17
  229. package/build-module/components/add-new-template/new-template.js.map +1 -1
  230. package/build-module/components/add-new-template/utils.js +9 -6
  231. package/build-module/components/add-new-template/utils.js.map +1 -1
  232. package/build-module/components/block-editor/constants.js +1 -1
  233. package/build-module/components/block-editor/constants.js.map +1 -1
  234. package/build-module/components/block-editor/editor-canvas.js +1 -1
  235. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  236. package/build-module/components/block-editor/index.js +0 -4
  237. package/build-module/components/block-editor/index.js.map +1 -1
  238. package/build-module/components/block-editor/inserter-media-categories.js +1 -22
  239. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
  240. package/build-module/components/block-editor/site-editor-canvas.js +29 -32
  241. package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
  242. package/build-module/components/block-editor/use-site-editor-settings.js +92 -20
  243. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  244. package/build-module/components/canvas-spinner/index.js +1 -15
  245. package/build-module/components/canvas-spinner/index.js.map +1 -1
  246. package/build-module/components/code-editor/index.js +62 -30
  247. package/build-module/components/code-editor/index.js.map +1 -1
  248. package/build-module/components/create-pattern-modal/index.js +14 -11
  249. package/build-module/components/create-pattern-modal/index.js.map +1 -1
  250. package/build-module/components/create-template-part-modal/index.js +1 -1
  251. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  252. package/build-module/components/editor/index.js +11 -1
  253. package/build-module/components/editor/index.js.map +1 -1
  254. package/build-module/components/global-styles/palette.js +1 -1
  255. package/build-module/components/global-styles/palette.js.map +1 -1
  256. package/build-module/components/global-styles/ui.js +8 -3
  257. package/build-module/components/global-styles/ui.js.map +1 -1
  258. package/build-module/components/header-edit-mode/document-actions/index.js +10 -2
  259. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  260. package/build-module/components/header-edit-mode/index.js +51 -16
  261. package/build-module/components/header-edit-mode/index.js.map +1 -1
  262. package/build-module/components/header-edit-mode/more-menu/index.js +44 -20
  263. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  264. package/build-module/components/keyboard-shortcut-help-modal/index.js +15 -6
  265. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  266. package/build-module/components/keyboard-shortcuts/edit-mode.js +29 -1
  267. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  268. package/build-module/components/keyboard-shortcuts/register.js +9 -0
  269. package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
  270. package/build-module/components/layout/index.js +110 -28
  271. package/build-module/components/layout/index.js.map +1 -1
  272. package/build-module/components/page/header.js +1 -1
  273. package/build-module/components/page/header.js.map +1 -1
  274. package/build-module/components/page/index.js +2 -1
  275. package/build-module/components/page/index.js.map +1 -1
  276. package/build-module/components/page-actions/index.js +2 -2
  277. package/build-module/components/page-actions/index.js.map +1 -1
  278. package/build-module/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -16
  279. package/build-module/components/page-actions/trash-page-menu-item.js.map +1 -0
  280. package/build-module/components/page-content-focus-manager/back-to-page-notification.js +9 -3
  281. package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
  282. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -3
  283. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  284. package/build-module/components/page-main/index.js +6 -3
  285. package/build-module/components/page-main/index.js.map +1 -1
  286. package/build-module/components/page-patterns/duplicate-menu-item.js +147 -0
  287. package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -0
  288. package/build-module/components/page-patterns/grid-item.js +195 -0
  289. package/build-module/components/page-patterns/grid-item.js.map +1 -0
  290. package/build-module/components/page-patterns/grid.js +26 -0
  291. package/build-module/components/page-patterns/grid.js.map +1 -0
  292. package/build-module/components/page-patterns/header.js +54 -0
  293. package/build-module/components/page-patterns/header.js.map +1 -0
  294. package/build-module/components/{page-library → page-patterns}/index.js +8 -6
  295. package/build-module/components/page-patterns/index.js.map +1 -0
  296. package/build-module/components/{page-library → page-patterns}/no-patterns.js +1 -1
  297. package/build-module/components/page-patterns/no-patterns.js.map +1 -0
  298. package/build-module/components/page-patterns/pagination.js +54 -0
  299. package/build-module/components/page-patterns/pagination.js.map +1 -0
  300. package/build-module/components/page-patterns/patterns-list.js +152 -0
  301. package/build-module/components/page-patterns/patterns-list.js.map +1 -0
  302. package/build-module/components/page-patterns/rename-menu-item.js +97 -0
  303. package/build-module/components/page-patterns/rename-menu-item.js.map +1 -0
  304. package/build-module/components/page-patterns/search-items.js.map +1 -0
  305. package/build-module/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +2 -2
  306. package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -0
  307. package/build-module/components/page-patterns/use-patterns.js +167 -0
  308. package/build-module/components/page-patterns/use-patterns.js.map +1 -0
  309. package/build-module/components/{page-library → page-patterns}/utils.js +3 -3
  310. package/build-module/components/page-patterns/utils.js.map +1 -0
  311. package/build-module/components/page-template-parts/add-new-template-part.js +58 -0
  312. package/build-module/components/page-template-parts/add-new-template-part.js.map +1 -0
  313. package/build-module/components/page-template-parts/index.js +63 -0
  314. package/build-module/components/page-template-parts/index.js.map +1 -0
  315. package/build-module/components/page-templates/index.js +1 -0
  316. package/build-module/components/page-templates/index.js.map +1 -1
  317. package/build-module/components/preferences-modal/enable-feature.js +5 -1
  318. package/build-module/components/preferences-modal/enable-feature.js.map +1 -1
  319. package/build-module/components/preferences-modal/index.js +38 -5
  320. package/build-module/components/preferences-modal/index.js.map +1 -1
  321. package/build-module/components/resizable-frame/index.js +79 -39
  322. package/build-module/components/resizable-frame/index.js.map +1 -1
  323. package/build-module/components/save-panel/index.js +5 -5
  324. package/build-module/components/save-panel/index.js.map +1 -1
  325. package/build-module/components/sidebar/index.js +5 -5
  326. package/build-module/components/sidebar/index.js.map +1 -1
  327. package/build-module/components/sidebar-edit-mode/index.js +4 -2
  328. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  329. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +5 -2
  330. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  331. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
  332. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
  333. package/build-module/components/sidebar-edit-mode/settings-header/index.js +6 -1
  334. package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  335. package/build-module/components/sidebar-navigation-screen/index.js +22 -12
  336. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  337. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +67 -5
  338. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  339. package/build-module/components/sidebar-navigation-screen-main/index.js +5 -4
  340. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  341. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +33 -0
  342. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
  343. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +8 -17
  344. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
  345. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -9
  346. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
  347. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +9 -10
  348. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  349. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  350. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  351. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +11 -1
  352. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  353. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +8 -4
  354. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  355. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +9 -4
  356. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  357. package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +20 -0
  358. package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -0
  359. package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
  360. package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
  361. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +26 -6
  362. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  363. package/build-module/components/sidebar-navigation-screen-page/index.js +2 -3
  364. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
  365. package/build-module/components/sidebar-navigation-screen-page/page-details.js +11 -4
  366. package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
  367. package/build-module/components/sidebar-navigation-screen-page/status-label.js +2 -33
  368. package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  369. package/build-module/components/sidebar-navigation-screen-pages/index.js +34 -26
  370. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  371. package/build-module/components/sidebar-navigation-screen-pattern/index.js +18 -12
  372. package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  373. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +4 -3
  374. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  375. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
  376. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  377. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +11 -3
  378. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
  379. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +25 -2
  380. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  381. package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
  382. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
  383. package/build-module/components/sidebar-navigation-screen-patterns/index.js +148 -0
  384. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
  385. package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
  386. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +24 -0
  387. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
  388. package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +11 -17
  389. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
  390. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +43 -0
  391. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
  392. package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +2 -2
  393. package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
  394. package/build-module/components/sidebar-navigation-screen-templates/index.js +12 -62
  395. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  396. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
  397. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  398. package/build-module/components/site-hub/index.js +25 -12
  399. package/build-module/components/site-hub/index.js.map +1 -1
  400. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +7 -5
  401. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  402. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +17 -13
  403. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  404. package/build-module/components/template-actions/index.js +26 -8
  405. package/build-module/components/template-actions/index.js.map +1 -1
  406. package/build-module/components/template-actions/rename-menu-item.js +11 -8
  407. package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
  408. package/build-module/components/use-edited-entity-record/index.js +3 -1
  409. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  410. package/build-module/components/welcome-guide/editor.js +1 -1
  411. package/build-module/components/welcome-guide/editor.js.map +1 -1
  412. package/build-module/components/welcome-guide/index.js +3 -1
  413. package/build-module/components/welcome-guide/index.js.map +1 -1
  414. package/build-module/components/welcome-guide/page.js +59 -0
  415. package/build-module/components/welcome-guide/page.js.map +1 -0
  416. package/build-module/components/welcome-guide/styles.js +1 -1
  417. package/build-module/components/welcome-guide/styles.js.map +1 -1
  418. package/build-module/components/welcome-guide/template.js +60 -0
  419. package/build-module/components/welcome-guide/template.js.map +1 -0
  420. package/build-module/hooks/commands/use-common-commands.js +111 -21
  421. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  422. package/build-module/hooks/commands/use-edit-mode-commands.js +193 -46
  423. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  424. package/build-module/hooks/push-changes-to-global-styles/index.js +57 -10
  425. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  426. package/build-module/index.js +4 -0
  427. package/build-module/index.js.map +1 -1
  428. package/build-module/store/actions.js +5 -2
  429. package/build-module/store/actions.js.map +1 -1
  430. package/build-module/store/private-actions.js +7 -1
  431. package/build-module/store/private-actions.js.map +1 -1
  432. package/build-module/store/selectors.js +2 -1
  433. package/build-module/store/selectors.js.map +1 -1
  434. package/build-module/utils/get-is-list-page.js +2 -2
  435. package/build-module/utils/get-is-list-page.js.map +1 -1
  436. package/build-module/utils/normalize-record-key.js +12 -0
  437. package/build-module/utils/normalize-record-key.js.map +1 -0
  438. package/build-module/utils/template-part-create.js +1 -1
  439. package/build-module/utils/template-part-create.js.map +1 -1
  440. package/build-module/utils/use-activate-theme.js +1 -1
  441. package/build-module/utils/use-activate-theme.js.map +1 -1
  442. package/build-style/style-rtl.css +383 -109
  443. package/build-style/style.css +383 -109
  444. package/package.json +39 -40
  445. package/src/components/add-new-page/index.js +1 -9
  446. package/src/components/add-new-pattern/index.js +30 -21
  447. package/src/components/add-new-template/add-custom-generic-template-modal-content.js +1 -1
  448. package/src/components/add-new-template/new-template.js +120 -24
  449. package/src/components/add-new-template/style.scss +30 -2
  450. package/src/components/add-new-template/utils.js +9 -6
  451. package/src/components/block-editor/constants.js +5 -1
  452. package/src/components/block-editor/editor-canvas.js +3 -1
  453. package/src/components/block-editor/index.js +0 -4
  454. package/src/components/block-editor/inserter-media-categories.js +1 -21
  455. package/src/components/block-editor/site-editor-canvas.js +7 -1
  456. package/src/components/block-editor/use-site-editor-settings.js +100 -25
  457. package/src/components/canvas-spinner/index.js +1 -11
  458. package/src/components/canvas-spinner/style.scss +18 -0
  459. package/src/components/code-editor/index.js +51 -33
  460. package/src/components/create-pattern-modal/index.js +15 -13
  461. package/src/components/create-template-part-modal/index.js +1 -1
  462. package/src/components/editor/index.js +16 -1
  463. package/src/components/editor/style.scss +4 -0
  464. package/src/components/global-styles/palette.js +10 -9
  465. package/src/components/global-styles/stories/index.js +1 -0
  466. package/src/components/global-styles/ui.js +34 -24
  467. package/src/components/header-edit-mode/document-actions/index.js +9 -1
  468. package/src/components/header-edit-mode/document-actions/style.scss +12 -0
  469. package/src/components/header-edit-mode/index.js +136 -79
  470. package/src/components/header-edit-mode/more-menu/index.js +74 -30
  471. package/src/components/keyboard-shortcut-help-modal/index.js +21 -7
  472. package/src/components/keyboard-shortcuts/edit-mode.js +35 -2
  473. package/src/components/keyboard-shortcuts/register.js +10 -0
  474. package/src/components/layout/index.js +156 -78
  475. package/src/components/layout/style.scss +49 -2
  476. package/src/components/page/header.js +1 -1
  477. package/src/components/page/index.js +5 -1
  478. package/src/components/page-actions/index.js +2 -2
  479. package/src/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +9 -21
  480. package/src/components/page-content-focus-manager/back-to-page-notification.js +7 -2
  481. package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +12 -3
  482. package/src/components/page-main/index.js +6 -3
  483. package/src/components/page-patterns/duplicate-menu-item.js +196 -0
  484. package/src/components/page-patterns/grid-item.js +284 -0
  485. package/src/components/page-patterns/grid.js +22 -0
  486. package/src/components/page-patterns/header.js +69 -0
  487. package/src/components/{page-library → page-patterns}/index.js +11 -6
  488. package/src/components/{page-library → page-patterns}/no-patterns.js +1 -1
  489. package/src/components/page-patterns/pagination.js +80 -0
  490. package/src/components/page-patterns/patterns-list.js +206 -0
  491. package/src/components/page-patterns/rename-menu-item.js +115 -0
  492. package/src/components/page-patterns/style.scss +219 -0
  493. package/src/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +1 -1
  494. package/src/components/page-patterns/use-patterns.js +177 -0
  495. package/src/components/{page-library → page-patterns}/utils.js +3 -3
  496. package/src/components/page-template-parts/add-new-template-part.js +57 -0
  497. package/src/components/page-template-parts/index.js +86 -0
  498. package/src/components/page-templates/index.js +1 -1
  499. package/src/components/preferences-modal/enable-feature.js +5 -2
  500. package/src/components/preferences-modal/index.js +35 -4
  501. package/src/components/resizable-frame/index.js +102 -34
  502. package/src/components/resizable-frame/style.scss +9 -9
  503. package/src/components/save-panel/index.js +10 -4
  504. package/src/components/sidebar/index.js +6 -6
  505. package/src/components/sidebar-button/style.scss +1 -1
  506. package/src/components/sidebar-edit-mode/index.js +4 -2
  507. package/src/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
  508. package/src/components/sidebar-edit-mode/page-panels/page-status.js +2 -5
  509. package/src/components/sidebar-edit-mode/settings-header/index.js +7 -2
  510. package/src/components/sidebar-navigation-item/style.scss +7 -13
  511. package/src/components/sidebar-navigation-screen/index.js +18 -9
  512. package/src/components/sidebar-navigation-screen/style.scss +21 -2
  513. package/src/components/sidebar-navigation-screen-details-panel/style.scss +1 -1
  514. package/src/components/sidebar-navigation-screen-global-styles/index.js +57 -17
  515. package/src/components/sidebar-navigation-screen-main/index.js +44 -40
  516. package/src/components/sidebar-navigation-screen-main/template-part-hint.js +34 -0
  517. package/src/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +14 -35
  518. package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +8 -11
  519. package/src/components/sidebar-navigation-screen-navigation-menu/index.js +13 -11
  520. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  521. package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +12 -1
  522. package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +16 -7
  523. package/src/components/sidebar-navigation-screen-navigation-menu/style.scss +2 -7
  524. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +20 -6
  525. package/src/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +24 -0
  526. package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
  527. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +39 -8
  528. package/src/components/sidebar-navigation-screen-page/index.js +3 -3
  529. package/src/components/sidebar-navigation-screen-page/page-details.js +8 -3
  530. package/src/components/sidebar-navigation-screen-page/status-label.js +2 -36
  531. package/src/components/sidebar-navigation-screen-pages/index.js +40 -30
  532. package/src/components/sidebar-navigation-screen-pattern/index.js +18 -8
  533. package/src/components/sidebar-navigation-screen-pattern/style.scss +29 -0
  534. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
  535. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +2 -1
  536. package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +12 -2
  537. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +48 -3
  538. package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
  539. package/src/components/sidebar-navigation-screen-patterns/index.js +194 -0
  540. package/src/components/sidebar-navigation-screen-patterns/style.scss +23 -0
  541. package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +24 -0
  542. package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +9 -17
  543. package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +55 -0
  544. package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +3 -2
  545. package/src/components/sidebar-navigation-screen-template/style.scss +15 -15
  546. package/src/components/sidebar-navigation-screen-templates/index.js +15 -82
  547. package/src/components/sidebar-navigation-screen-templates-browse/index.js +2 -0
  548. package/src/components/site-hub/index.js +46 -29
  549. package/src/components/site-hub/style.scss +17 -3
  550. package/src/components/start-template-options/style.scss +0 -3
  551. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -2
  552. package/src/components/sync-state-with-url/use-sync-path-with-url.js +73 -66
  553. package/src/components/template-actions/index.js +40 -9
  554. package/src/components/template-actions/rename-menu-item.js +17 -10
  555. package/src/components/use-edited-entity-record/index.js +6 -1
  556. package/src/components/welcome-guide/editor.js +1 -1
  557. package/src/components/welcome-guide/index.js +4 -0
  558. package/src/components/welcome-guide/page.js +75 -0
  559. package/src/components/welcome-guide/style.scss +15 -1
  560. package/src/components/welcome-guide/styles.js +1 -1
  561. package/src/components/welcome-guide/template.js +82 -0
  562. package/src/hooks/commands/use-common-commands.js +88 -24
  563. package/src/hooks/commands/use-edit-mode-commands.js +182 -38
  564. package/src/hooks/push-changes-to-global-styles/index.js +63 -9
  565. package/src/index.js +4 -0
  566. package/src/store/actions.js +8 -1
  567. package/src/store/private-actions.js +5 -1
  568. package/src/store/selectors.js +5 -0
  569. package/src/store/test/selectors.js +2 -0
  570. package/src/style.scss +13 -14
  571. package/src/utils/get-is-list-page.js +4 -3
  572. package/src/utils/normalize-record-key.js +11 -0
  573. package/src/utils/template-part-create.js +1 -1
  574. package/src/utils/use-activate-theme.js +1 -1
  575. package/build/components/code-editor/code-editor-text-area.js +0 -96
  576. package/build/components/code-editor/code-editor-text-area.js.map +0 -1
  577. package/build/components/keyboard-shortcuts/index.js +0 -148
  578. package/build/components/keyboard-shortcuts/index.js.map +0 -1
  579. package/build/components/page-actions/delete-page-menu-item.js.map +0 -1
  580. package/build/components/page-content-focus-manager/constants.js +0 -9
  581. package/build/components/page-content-focus-manager/constants.js.map +0 -1
  582. package/build/components/page-library/grid-item.js +0 -165
  583. package/build/components/page-library/grid-item.js.map +0 -1
  584. package/build/components/page-library/grid.js.map +0 -1
  585. package/build/components/page-library/index.js.map +0 -1
  586. package/build/components/page-library/no-patterns.js.map +0 -1
  587. package/build/components/page-library/patterns-list.js +0 -108
  588. package/build/components/page-library/patterns-list.js.map +0 -1
  589. package/build/components/page-library/search-items.js.map +0 -1
  590. package/build/components/page-library/use-library-settings.js.map +0 -1
  591. package/build/components/page-library/use-patterns.js +0 -194
  592. package/build/components/page-library/use-patterns.js.map +0 -1
  593. package/build/components/page-library/utils.js.map +0 -1
  594. package/build/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
  595. package/build/components/sidebar-navigation-screen-library/index.js +0 -112
  596. package/build/components/sidebar-navigation-screen-library/index.js.map +0 -1
  597. package/build/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
  598. package/build/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
  599. package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -41
  600. package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
  601. package/build/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
  602. package/build-module/components/code-editor/code-editor-text-area.js +0 -84
  603. package/build-module/components/code-editor/code-editor-text-area.js.map +0 -1
  604. package/build-module/components/keyboard-shortcuts/index.js +0 -132
  605. package/build-module/components/keyboard-shortcuts/index.js.map +0 -1
  606. package/build-module/components/page-actions/delete-page-menu-item.js.map +0 -1
  607. package/build-module/components/page-content-focus-manager/constants.js +0 -2
  608. package/build-module/components/page-content-focus-manager/constants.js.map +0 -1
  609. package/build-module/components/page-library/grid-item.js +0 -145
  610. package/build-module/components/page-library/grid-item.js.map +0 -1
  611. package/build-module/components/page-library/grid.js +0 -38
  612. package/build-module/components/page-library/grid.js.map +0 -1
  613. package/build-module/components/page-library/index.js.map +0 -1
  614. package/build-module/components/page-library/no-patterns.js.map +0 -1
  615. package/build-module/components/page-library/patterns-list.js +0 -87
  616. package/build-module/components/page-library/patterns-list.js.map +0 -1
  617. package/build-module/components/page-library/search-items.js.map +0 -1
  618. package/build-module/components/page-library/use-library-settings.js.map +0 -1
  619. package/build-module/components/page-library/use-patterns.js +0 -176
  620. package/build-module/components/page-library/use-patterns.js.map +0 -1
  621. package/build-module/components/page-library/utils.js.map +0 -1
  622. package/build-module/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
  623. package/build-module/components/sidebar-navigation-screen-library/index.js +0 -87
  624. package/build-module/components/sidebar-navigation-screen-library/index.js.map +0 -1
  625. package/build-module/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
  626. package/build-module/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
  627. package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -34
  628. package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
  629. package/build-module/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
  630. package/src/components/code-editor/code-editor-text-area.js +0 -84
  631. package/src/components/keyboard-shortcuts/index.js +0 -137
  632. package/src/components/page-content-focus-manager/constants.js +0 -5
  633. package/src/components/page-library/grid-item.js +0 -179
  634. package/src/components/page-library/grid.js +0 -39
  635. package/src/components/page-library/patterns-list.js +0 -114
  636. package/src/components/page-library/style.scss +0 -105
  637. package/src/components/page-library/use-patterns.js +0 -238
  638. package/src/components/sidebar-navigation-screen-library/index.js +0 -136
  639. package/src/components/sidebar-navigation-screen-library/style.scss +0 -7
  640. package/src/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -33
  641. /package/build/components/{page-library → page-patterns}/search-items.js +0 -0
  642. /package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
  643. /package/build-module/components/{page-library → page-patterns}/search-items.js +0 -0
  644. /package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
  645. /package/src/components/{page-library → page-patterns}/search-items.js +0 -0
  646. /package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
@@ -4,7 +4,8 @@ import { createElement } from "@wordpress/element";
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { __, sprintf } from '@wordpress/i18n';
7
- import { useEntityRecords } from '@wordpress/core-data';
7
+ import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
8
+ import { useSelect } from '@wordpress/data';
8
9
  import { decodeEntities } from '@wordpress/html-entities';
9
10
  import { __experimentalItemGroup as ItemGroup, Spinner } from '@wordpress/components';
10
11
  import { navigation } from '@wordpress/icons';
@@ -17,7 +18,8 @@ import SidebarNavigationItem from '../sidebar-navigation-item';
17
18
  import { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';
18
19
  import { useLink } from '../routes/link';
19
20
  import SingleNavigationMenu from '../sidebar-navigation-screen-navigation-menu/single-navigation-menu';
20
- import useNavigationMenuHandlers from '../sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers'; // Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.
21
+ import useNavigationMenuHandlers from '../sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers';
22
+ import { unlock } from '../../lock-unlock'; // Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.
21
23
 
22
24
  function buildMenuLabel(title, id, status) {
23
25
  if (!title?.rendered) {
@@ -31,14 +33,32 @@ function buildMenuLabel(title, id, status) {
31
33
 
32
34
  return sprintf( // translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).
33
35
  __('%1$s (%2$s)'), decodeEntities(title?.rendered), status);
34
- }
36
+ } // Save a boolean to prevent us creating a fallback more than once per session.
37
+
35
38
 
39
+ let hasCreatedFallback = false;
36
40
  export default function SidebarNavigationScreenNavigationMenus() {
37
41
  const {
38
42
  records: navigationMenus,
39
- isResolving: isLoading
43
+ isResolving: isResolvingNavigationMenus,
44
+ hasResolved: hasResolvedNavigationMenus
40
45
  } = useEntityRecords('postType', `wp_navigation`, PRELOADED_NAVIGATION_MENUS_QUERY);
41
- const firstNavigationMenu = navigationMenus?.[0];
46
+ const isLoading = isResolvingNavigationMenus && !hasResolvedNavigationMenus;
47
+ const {
48
+ getNavigationFallbackId
49
+ } = unlock(useSelect(coreStore));
50
+ const firstNavigationMenu = navigationMenus?.[0]; // Save a boolean to prevent us creating a fallback more than once per session.
51
+
52
+ if (firstNavigationMenu) {
53
+ hasCreatedFallback = true;
54
+ } // If there is no navigation menu found
55
+ // then trigger fallback algorithm to create one.
56
+
57
+
58
+ if (!firstNavigationMenu && !isResolvingNavigationMenus && hasResolvedNavigationMenus && !hasCreatedFallback) {
59
+ getNavigationFallbackId();
60
+ }
61
+
42
62
  const {
43
63
  handleSave,
44
64
  handleDelete,
@@ -64,7 +84,7 @@ export default function SidebarNavigationScreenNavigationMenus() {
64
84
  navigationMenu: firstNavigationMenu,
65
85
  handleDelete: () => handleDelete(firstNavigationMenu),
66
86
  handleDuplicate: () => handleDuplicate(firstNavigationMenu),
67
- handleSave: () => handleSave(firstNavigationMenu)
87
+ handleSave: edits => handleSave(firstNavigationMenu, edits)
68
88
  });
69
89
  }
70
90
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","sprintf","useEntityRecords","decodeEntities","__experimentalItemGroup","ItemGroup","Spinner","navigation","SidebarNavigationScreen","SidebarNavigationItem","PRELOADED_NAVIGATION_MENUS_QUERY","useLink","SingleNavigationMenu","useNavigationMenuHandlers","buildMenuLabel","title","id","status","rendered","SidebarNavigationScreenNavigationMenus","records","navigationMenus","isResolving","isLoading","firstNavigationMenu","handleSave","handleDelete","handleDuplicate","hasNavigationMenus","length","map","index","SidebarNavigationScreenWrapper","children","actions","description","NavMenuItem","postId","props","linkInfo","postType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,gBAAT,QAAiC,sBAAjC;AAEA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SACCC,uBAAuB,IAAIC,SAD5B,EAECC,OAFD,QAGO,uBAHP;AAIA,SAASC,UAAT,QAA2B,kBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,SAASC,gCAAT,QAAiD,aAAjD;AACA,SAASC,OAAT,QAAwB,gBAAxB;AACA,OAAOC,oBAAP,MAAiC,qEAAjC;AACA,OAAOC,yBAAP,MAAsC,2EAAtC,C,CAEA;;AACA,SAASC,cAAT,CAAyBC,KAAzB,EAAgCC,EAAhC,EAAoCC,MAApC,EAA6C;AAC5C,MAAK,CAAEF,KAAK,EAAEG,QAAd,EAAyB;AACxB;AACA,WAAOjB,OAAO,CAAED,EAAE,CAAE,eAAF,CAAJ,EAAyBgB,EAAzB,CAAd;AACA;;AAED,MAAKC,MAAM,KAAK,SAAhB,EAA4B;AAC3B,WAAOd,cAAc,CAAEY,KAAK,EAAEG,QAAT,CAArB;AACA;;AAED,SAAOjB,OAAO,EACb;AACAD,EAAAA,EAAE,CAAE,aAAF,CAFW,EAGbG,cAAc,CAAEY,KAAK,EAAEG,QAAT,CAHD,EAIbD,MAJa,CAAd;AAMA;;AAED,eAAe,SAASE,sCAAT,GAAkD;AAChE,QAA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AAEC,KAAF,EAASgB,KAAK,GAAG,CAAjB,EAAoBd,MAApB,CANjB,CADC,CADH,CADD,CADD;AAgBA;AAED,OAAO,SAASe,8BAAT,CAAyC;AAC/CC,EAAAA,QAD+C;AAE/CC,EAAAA,OAF+C;AAG/CnB,EAAAA,KAH+C;AAI/CoB,EAAAA;AAJ+C,CAAzC,EAKH;AACH,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGpB,KAAK,IAAIf,EAAE,CAAE,YAAF,CADpB;AAEC,IAAA,OAAO,EAAGkC,OAFX;AAGC,IAAA,WAAW,EAAGC,WAAW,IAAInC,EAAE,CAAE,+BAAF,CAHhC;AAIC,IAAA,OAAO,EAAGiC;AAJX,IADD;AAQA;;AAED,MAAMG,WAAW,GAAG,CAAE;AAAEC,EAAAA,MAAF;AAAU,KAAGC;AAAb,CAAF,KAA4B;AAC/C,QAAMC,QAAQ,GAAG5B,OAAO,CAAE;AACzB0B,IAAAA,MADyB;AAEzBG,IAAAA,QAAQ,EAAE;AAFe,GAAF,CAAxB;AAIA,SAAO,cAAC,qBAAD,OAA4BD,QAA5B;AAAA,OAA4CD;AAA5C,IAAP;AACA,CAND","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\n\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\tSpinner,\n} from '@wordpress/components';\nimport { navigation } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';\nimport { useLink } from '../routes/link';\nimport SingleNavigationMenu from '../sidebar-navigation-screen-navigation-menu/single-navigation-menu';\nimport useNavigationMenuHandlers from '../sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers';\n\n// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.\nfunction buildMenuLabel( title, id, status ) {\n\tif ( ! title?.rendered ) {\n\t\t/* translators: %s is the index of the menu in the list of menus. */\n\t\treturn sprintf( __( '(no title %s)' ), id );\n\t}\n\n\tif ( status === 'publish' ) {\n\t\treturn decodeEntities( title?.rendered );\n\t}\n\n\treturn sprintf(\n\t\t// translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).\n\t\t__( '%1$s (%2$s)' ),\n\t\tdecodeEntities( title?.rendered ),\n\t\tstatus\n\t);\n}\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst { records: navigationMenus, isResolving: isLoading } =\n\t\tuseEntityRecords(\n\t\t\t'postType',\n\t\t\t`wp_navigation`,\n\t\t\tPRELOADED_NAVIGATION_MENUS_QUERY\n\t\t);\n\n\tconst firstNavigationMenu = navigationMenus?.[ 0 ];\n\n\tconst { handleSave, handleDelete, handleDuplicate } =\n\t\tuseNavigationMenuHandlers();\n\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t<Spinner className=\"edit-site-sidebar-navigation-screen-navigation-menus__loading\" />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! isLoading && ! hasNavigationMenus ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __( 'No Navigation Menus found.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\t// if single menu then render it\n\tif ( navigationMenus?.length === 1 ) {\n\t\treturn (\n\t\t\t<SingleNavigationMenu\n\t\t\t\tnavigationMenu={ firstNavigationMenu }\n\t\t\t\thandleDelete={ () => handleDelete( firstNavigationMenu ) }\n\t\t\t\thandleDuplicate={ () => handleDuplicate( firstNavigationMenu ) }\n\t\t\t\thandleSave={ () => handleSave( firstNavigationMenu ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper>\n\t\t\t<ItemGroup>\n\t\t\t\t{ navigationMenus?.map( ( { id, title, status }, index ) => (\n\t\t\t\t\t<NavMenuItem\n\t\t\t\t\t\tpostId={ id }\n\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ buildMenuLabel( title, index + 1, status ) }\n\t\t\t\t\t</NavMenuItem>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n\nexport function SidebarNavigationScreenWrapper( {\n\tchildren,\n\tactions,\n\ttitle,\n\tdescription,\n} ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title || __( 'Navigation' ) }\n\t\t\tactions={ actions }\n\t\t\tdescription={ description || __( 'Manage your Navigation menus.' ) }\n\t\t\tcontent={ children }\n\t\t/>\n\t);\n}\n\nconst NavMenuItem = ( { postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostId,\n\t\tpostType: 'wp_navigation',\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","sprintf","useEntityRecords","store","coreStore","useSelect","decodeEntities","__experimentalItemGroup","ItemGroup","Spinner","navigation","SidebarNavigationScreen","SidebarNavigationItem","PRELOADED_NAVIGATION_MENUS_QUERY","useLink","SingleNavigationMenu","useNavigationMenuHandlers","unlock","buildMenuLabel","title","id","status","rendered","hasCreatedFallback","SidebarNavigationScreenNavigationMenus","records","navigationMenus","isResolving","isResolvingNavigationMenus","hasResolved","hasResolvedNavigationMenus","isLoading","getNavigationFallbackId","firstNavigationMenu","handleSave","handleDelete","handleDuplicate","hasNavigationMenus","length","edits","map","index","SidebarNavigationScreenWrapper","children","actions","description","NavMenuItem","postId","props","linkInfo","postType"],"mappings":";;AAA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AAsB,CAAE;AAAEpB,IAAAA,EAAF;AAAMD,IAAAA,KAAN;AAAaE,IAAAA;AAAb,GAAF,EAAyBoB,KAAzB,KACvB,cAAC,WAAD;AACC,IAAA,MAAM,EAAGrB,EADV;AAEC,IAAA,GAAG,EAAGA,EAFP;AAGC,IAAA,WAAW,MAHZ;AAIC,IAAA,IAAI,EAAGV;AAJR,KAMGQ,cAAc,CAAEC,KAAF,EAASsB,KAAK,GAAG,CAAjB,EAAoBpB,MAApB,CANjB,CADC,CADH,CADD,CADD;AAgBA;AAED,OAAO,SAASqB,8BAAT,CAAyC;AAC/CC,EAAAA,QAD+C;AAE/CC,EAAAA,OAF+C;AAG/CzB,EAAAA,KAH+C;AAI/C0B,EAAAA;AAJ+C,CAAzC,EAKH;AACH,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAG1B,KAAK,IAAInB,EAAE,CAAE,YAAF,CADpB;AAEC,IAAA,OAAO,EAAG4C,OAFX;AAGC,IAAA,WAAW,EAAGC,WAAW,IAAI7C,EAAE,CAAE,+BAAF,CAHhC;AAIC,IAAA,OAAO,EAAG2C;AAJX,IADD;AAQA;;AAED,MAAMG,WAAW,GAAG,CAAE;AAAEC,EAAAA,MAAF;AAAU,KAAGC;AAAb,CAAF,KAA4B;AAC/C,QAAMC,QAAQ,GAAGnC,OAAO,CAAE;AACzBiC,IAAAA,MADyB;AAEzBG,IAAAA,QAAQ,EAAE;AAFe,GAAF,CAAxB;AAIA,SAAO,cAAC,qBAAD,OAA4BD,QAA5B;AAAA,OAA4CD;AAA5C,IAAP;AACA,CAND","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\tSpinner,\n} from '@wordpress/components';\nimport { navigation } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';\nimport { useLink } from '../routes/link';\nimport SingleNavigationMenu from '../sidebar-navigation-screen-navigation-menu/single-navigation-menu';\nimport useNavigationMenuHandlers from '../sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers';\nimport { unlock } from '../../lock-unlock';\n\n// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.\nfunction buildMenuLabel( title, id, status ) {\n\tif ( ! title?.rendered ) {\n\t\t/* translators: %s is the index of the menu in the list of menus. */\n\t\treturn sprintf( __( '(no title %s)' ), id );\n\t}\n\n\tif ( status === 'publish' ) {\n\t\treturn decodeEntities( title?.rendered );\n\t}\n\n\treturn sprintf(\n\t\t// translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).\n\t\t__( '%1$s (%2$s)' ),\n\t\tdecodeEntities( title?.rendered ),\n\t\tstatus\n\t);\n}\n\n// Save a boolean to prevent us creating a fallback more than once per session.\nlet hasCreatedFallback = false;\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst {\n\t\trecords: navigationMenus,\n\t\tisResolving: isResolvingNavigationMenus,\n\t\thasResolved: hasResolvedNavigationMenus,\n\t} = useEntityRecords(\n\t\t'postType',\n\t\t`wp_navigation`,\n\t\tPRELOADED_NAVIGATION_MENUS_QUERY\n\t);\n\n\tconst isLoading =\n\t\tisResolvingNavigationMenus && ! hasResolvedNavigationMenus;\n\n\tconst { getNavigationFallbackId } = unlock( useSelect( coreStore ) );\n\n\tconst firstNavigationMenu = navigationMenus?.[ 0 ];\n\n\t// Save a boolean to prevent us creating a fallback more than once per session.\n\tif ( firstNavigationMenu ) {\n\t\thasCreatedFallback = true;\n\t}\n\n\t// If there is no navigation menu found\n\t// then trigger fallback algorithm to create one.\n\tif (\n\t\t! firstNavigationMenu &&\n\t\t! isResolvingNavigationMenus &&\n\t\thasResolvedNavigationMenus &&\n\t\t! hasCreatedFallback\n\t) {\n\t\tgetNavigationFallbackId();\n\t}\n\n\tconst { handleSave, handleDelete, handleDuplicate } =\n\t\tuseNavigationMenuHandlers();\n\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t<Spinner className=\"edit-site-sidebar-navigation-screen-navigation-menus__loading\" />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! isLoading && ! hasNavigationMenus ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __( 'No Navigation Menus found.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\t// if single menu then render it\n\tif ( navigationMenus?.length === 1 ) {\n\t\treturn (\n\t\t\t<SingleNavigationMenu\n\t\t\t\tnavigationMenu={ firstNavigationMenu }\n\t\t\t\thandleDelete={ () => handleDelete( firstNavigationMenu ) }\n\t\t\t\thandleDuplicate={ () => handleDuplicate( firstNavigationMenu ) }\n\t\t\t\thandleSave={ ( edits ) =>\n\t\t\t\t\thandleSave( firstNavigationMenu, edits )\n\t\t\t\t}\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper>\n\t\t\t<ItemGroup>\n\t\t\t\t{ navigationMenus?.map( ( { id, title, status }, index ) => (\n\t\t\t\t\t<NavMenuItem\n\t\t\t\t\t\tpostId={ id }\n\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ buildMenuLabel( title, index + 1, status ) }\n\t\t\t\t\t</NavMenuItem>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n\nexport function SidebarNavigationScreenWrapper( {\n\tchildren,\n\tactions,\n\ttitle,\n\tdescription,\n} ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title || __( 'Navigation' ) }\n\t\t\tactions={ actions }\n\t\t\tdescription={ description || __( 'Manage your Navigation menus.' ) }\n\t\t\tcontent={ children }\n\t\t/>\n\t);\n}\n\nconst NavMenuItem = ( { postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostId,\n\t\tpostType: 'wp_navigation',\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n"]}
@@ -29,10 +29,9 @@ export default function SidebarNavigationScreenPage() {
29
29
  setCanvasMode
30
30
  } = unlock(useDispatch(editSiteStore));
31
31
  const {
32
- params: {
33
- postId
34
- }
32
+ params
35
33
  } = useNavigator();
34
+ const postId = Number(params?.postId);
36
35
  const {
37
36
  record
38
37
  } = useEntityRecord('postType', 'page', postId);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/index.js"],"names":["__","useDispatch","useSelect","__experimentalUseNavigator","useNavigator","__experimentalVStack","VStack","ExternalLink","__experimentalTruncate","Truncate","store","coreStore","useEntityRecord","decodeEntities","pencil","__unstableStripHTML","stripHTML","escapeAttribute","safeDecodeURIComponent","filterURLForDisplay","SidebarNavigationScreen","unlock","editSiteStore","SidebarButton","PageDetails","PageActions","SidebarNavigationScreenDetailsFooter","SidebarNavigationScreenPage","navigator","setCanvasMode","params","postId","record","featuredMediaAltText","featuredMediaSourceUrl","select","getEntityRecord","attachedMedia","featured_media","media_details","sizes","medium","source_url","alt_text","description","raw","featureImageAltText","title","rendered","as","goTo","link","excerpt","modified"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SACCC,0BAA0B,IAAIC,YAD/B,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,YAHD,EAICC,sBAAsB,IAAIC,QAJ3B,QAKO,uBALP;AAMA,SAASC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S,EAAC,kEADX;AAEC,MAAA,SAAS,EAAC,MAFX;AAGC,MAAA,OAAO,EAAG;AAHX,OAKC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC;AACC,MAAA,GAAG,EAAGY,mBADP;AAEC,MAAA,GAAG,EAAGZ;AAFP,MADD,CALD,CAFF,EAeG,CAAC,CAAEF,MAAM,EAAEoB,OAAR,EAAiBJ,QAApB,IACD,cAAC,QAAD;AACC,MAAA,SAAS,EAAC,mDADX;AAEC,MAAA,aAAa,EAAG;AAFjB,OAIGhC,SAAS,CAAEgB,MAAM,CAACoB,OAAP,CAAeJ,QAAjB,CAJZ,CAhBF,EAuBC,cAAC,WAAD;AAAa,MAAA,EAAE,EAAGjB;AAAlB,MAvBD,CA/BF;AAyDC,IAAA,MAAM,EACL,cAAC,oCAAD;AACC,MAAA,oBAAoB,EAAGC,MAAM,EAAEqB;AADhC;AA1DF,IADY,GAgET,IAhEJ;AAiEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\t__experimentalVStack as VStack,\n\tExternalLink,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { pencil } from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { escapeAttribute } from '@wordpress/escape-html';\nimport { safeDecodeURIComponent, filterURLForDisplay } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport PageDetails from './page-details';\nimport PageActions from '../page-actions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nexport default function SidebarNavigationScreenPage() {\n\tconst navigator = useNavigator();\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst {\n\t\tparams: { postId },\n\t} = useNavigator();\n\tconst { record } = useEntityRecord( 'postType', 'page', postId );\n\n\tconst { featuredMediaAltText, featuredMediaSourceUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\t// Featured image.\n\t\t\tconst attachedMedia = record?.featured_media\n\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\trecord?.featured_media\n\t\t\t\t )\n\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\tfeaturedMediaSourceUrl:\n\t\t\t\t\tattachedMedia?.media_details.sizes?.medium?.source_url ||\n\t\t\t\t\tattachedMedia?.source_url,\n\t\t\t\tfeaturedMediaAltText: escapeAttribute(\n\t\t\t\t\tattachedMedia?.alt_text ||\n\t\t\t\t\t\tattachedMedia?.description?.raw ||\n\t\t\t\t\t\t''\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ record ]\n\t);\n\n\tconst featureImageAltText = featuredMediaAltText\n\t\t? decodeEntities( featuredMediaAltText )\n\t\t: decodeEntities( record?.title?.rendered || __( 'Featured image' ) );\n\n\treturn record ? (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ decodeEntities(\n\t\t\t\trecord?.title?.rendered || __( '(no title)' )\n\t\t\t) }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<PageActions\n\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\ttoggleProps={ { as: SidebarButton } }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\tnavigator.goTo( '/page' );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tmeta={\n\t\t\t\t<ExternalLink\n\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__page-link\"\n\t\t\t\t\thref={ record.link }\n\t\t\t\t>\n\t\t\t\t\t{ filterURLForDisplay(\n\t\t\t\t\t\tsafeDecodeURIComponent( record.link )\n\t\t\t\t\t) }\n\t\t\t\t</ExternalLink>\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ !! featuredMediaSourceUrl && (\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-page__featured-image-wrapper\"\n\t\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-page__featured-image has-image\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\talt={ featureImageAltText }\n\t\t\t\t\t\t\t\t\tsrc={ featuredMediaSourceUrl }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! record?.excerpt?.rendered && (\n\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-page__excerpt\"\n\t\t\t\t\t\t\tnumberOfLines={ 3 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ stripHTML( record.excerpt.rendered ) }\n\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t) }\n\t\t\t\t\t<PageDetails id={ postId } />\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\t\t\tlastModifiedDateTime={ record?.modified }\n\t\t\t\t/>\n\t\t\t}\n\t\t/>\n\t) : null;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/index.js"],"names":["__","useDispatch","useSelect","__experimentalUseNavigator","useNavigator","__experimentalVStack","VStack","ExternalLink","__experimentalTruncate","Truncate","store","coreStore","useEntityRecord","decodeEntities","pencil","__unstableStripHTML","stripHTML","escapeAttribute","safeDecodeURIComponent","filterURLForDisplay","SidebarNavigationScreen","unlock","editSiteStore","SidebarButton","PageDetails","PageActions","SidebarNavigationScreenDetailsFooter","SidebarNavigationScreenPage","navigator","setCanvasMode","params","postId","Number","record","featuredMediaAltText","featuredMediaSourceUrl","select","getEntityRecord","attachedMedia","featured_media","media_details","sizes","medium","source_url","alt_text","description","raw","featureImageAltText","title","rendered","as","goTo","link","excerpt","modified"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SACCC,0BAA0B,IAAIC,YAD/B,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,YAHD,EAICC,sBAAsB,IAAIC,QAJ3B,QAKO,uBALP;AAMA,SAASC,KAAK,IAAIC,SAAlB,EAA6BC,eAA7B,QAAoD,sBAApD;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,MAAT,QAAuB,kBAAvB;AACA,SAASC,mBAAmB,IAAIC,SAAhC,QAAiD,gBAAjD;AACA,SAASC,eAAT,QAAgC,wBAAhC;AACA,SAASC,sBAAT,EAAiCC,mBAAjC,QAA4D,gBAA5D;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AACA,SAASX,KAAK,IAAIY,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,oCAAP,MAAiD,6CAAjD;AAEA,eAAe,SAASC,2BAAT,GAAuC;AACrD,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AoB,EAAGE,MAAM,EAAEqB;AADhC;AA1DF,IADY,GAgET,IAhEJ;AAiEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\t__experimentalVStack as VStack,\n\tExternalLink,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { pencil } from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { escapeAttribute } from '@wordpress/escape-html';\nimport { safeDecodeURIComponent, filterURLForDisplay } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport PageDetails from './page-details';\nimport PageActions from '../page-actions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nexport default function SidebarNavigationScreenPage() {\n\tconst navigator = useNavigator();\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { params } = useNavigator();\n\n\tconst postId = Number( params?.postId );\n\tconst { record } = useEntityRecord( 'postType', 'page', postId );\n\n\tconst { featuredMediaAltText, featuredMediaSourceUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\t// Featured image.\n\t\t\tconst attachedMedia = record?.featured_media\n\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\trecord?.featured_media\n\t\t\t\t )\n\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\tfeaturedMediaSourceUrl:\n\t\t\t\t\tattachedMedia?.media_details.sizes?.medium?.source_url ||\n\t\t\t\t\tattachedMedia?.source_url,\n\t\t\t\tfeaturedMediaAltText: escapeAttribute(\n\t\t\t\t\tattachedMedia?.alt_text ||\n\t\t\t\t\t\tattachedMedia?.description?.raw ||\n\t\t\t\t\t\t''\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ record ]\n\t);\n\n\tconst featureImageAltText = featuredMediaAltText\n\t\t? decodeEntities( featuredMediaAltText )\n\t\t: decodeEntities( record?.title?.rendered || __( 'Featured image' ) );\n\n\treturn record ? (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ decodeEntities(\n\t\t\t\trecord?.title?.rendered || __( '(no title)' )\n\t\t\t) }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<PageActions\n\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\ttoggleProps={ { as: SidebarButton } }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\tnavigator.goTo( '/page' );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tmeta={\n\t\t\t\t<ExternalLink\n\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__page-link\"\n\t\t\t\t\thref={ record.link }\n\t\t\t\t>\n\t\t\t\t\t{ filterURLForDisplay(\n\t\t\t\t\t\tsafeDecodeURIComponent( record.link )\n\t\t\t\t\t) }\n\t\t\t\t</ExternalLink>\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ !! featuredMediaSourceUrl && (\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-page__featured-image-wrapper\"\n\t\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-page__featured-image has-image\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\talt={ featureImageAltText }\n\t\t\t\t\t\t\t\t\tsrc={ featuredMediaSourceUrl }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! record?.excerpt?.rendered && (\n\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-page__excerpt\"\n\t\t\t\t\t\t\tnumberOfLines={ 3 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ stripHTML( record.excerpt.rendered ) }\n\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t) }\n\t\t\t\t\t<PageDetails id={ postId } />\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\t\t\tlastModifiedDateTime={ record?.modified }\n\t\t\t\t/>\n\t\t\t}\n\t\t/>\n\t) : null;\n}\n"]}
@@ -65,7 +65,7 @@ function getPageDetails(page) {
65
65
  const wordsCounted = page?.content?.rendered ? wordCount(page.content.rendered, wordCountType) : 0;
66
66
  const readingTime = Math.round(wordsCounted / AVERAGE_READING_RATE);
67
67
 
68
- if (wordsCounted) {
68
+ if (wordsCounted && !page?.isPostsPage) {
69
69
  details.push({
70
70
  label: __('Words'),
71
71
  value: wordsCounted.toLocaleString() || __('Unknown')
@@ -88,7 +88,8 @@ export default function PageDetails({
88
88
  } = useEntityRecord('postType', 'page', id);
89
89
  const {
90
90
  parentTitle,
91
- templateTitle
91
+ templateTitle,
92
+ isPostsPage
92
93
  } = useSelect(select => {
93
94
  const {
94
95
  getEditedPostContext
@@ -109,17 +110,23 @@ export default function PageDetails({
109
110
  _fields: ['title']
110
111
  })?.title?.rendered : null;
111
112
 
113
+ const {
114
+ getEntityRecord
115
+ } = select(coreStore);
116
+ const siteSettings = getEntityRecord('root', 'site');
112
117
  return {
113
118
  parentTitle: _parentTitle,
114
- templateTitle: _templateTitle
119
+ templateTitle: _templateTitle,
120
+ isPostsPage: record?.id === siteSettings?.page_for_posts
115
121
  };
116
- }, [record?.parent]);
122
+ }, [record?.parent, record?.id]);
117
123
  return createElement(SidebarNavigationScreenDetailsPanel, {
118
124
  spacing: 5,
119
125
  title: __('Details')
120
126
  }, getPageDetails({
121
127
  parentTitle,
122
128
  templateTitle,
129
+ isPostsPage,
123
130
  ...record
124
131
  }).map(({
125
132
  label,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/page-details.js"],"names":["__","_x","sprintf","__experimentalTruncate","Truncate","count","wordCount","useSelect","decodeEntities","store","coreStore","useEntityRecord","safeDecodeURIComponent","StatusLabel","unlock","editSiteStore","SidebarNavigationScreenDetailsPanel","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","AVERAGE_READING_RATE","getPageDetails","page","details","label","value","password","status","date","slug","templateTitle","push","parentTitle","wordCountType","wordsCounted","content","rendered","readingTime","Math","round","toLocaleString","PageDetails","id","record","select","getEditedPostContext","postContext","templates","getEntityRecords","per_page","templateSlug","postType","_templateTitle","find","template","title","_parentTitle","parent","getEntityRecord","_fields","map"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,sBAAsB,IAAIC,QAAnC,QAAmD,uBAAnD;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,KAAK,IAAIC,SAAlB,EAA6BC,eAA7B,QAAoD,sBAApD;AACA,SAASC,sBAAT,QAAuC,gBAAvC;AAEA;AACA;AACA;;AACA,OAAOC,W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ependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { __experimentalTruncate as Truncate } from '@wordpress/components';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { safeDecodeURIComponent } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport StatusLabel from './status-label';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\n\n// Taken from packages/editor/src/components/time-to-read/index.js.\nconst AVERAGE_READING_RATE = 189;\n\nfunction getPageDetails( page ) {\n\tif ( ! page ) {\n\t\treturn [];\n\t}\n\n\tconst details = [\n\t\t{\n\t\t\tlabel: __( 'Status' ),\n\t\t\tvalue: (\n\t\t\t\t<StatusLabel\n\t\t\t\t\tstatus={ page?.password ? 'protected' : page.status }\n\t\t\t\t\tdate={ page?.date }\n\t\t\t\t\tshort\n\t\t\t\t/>\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Slug' ),\n\t\t\tvalue: (\n\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t{ safeDecodeURIComponent( page.slug ) }\n\t\t\t\t</Truncate>\n\t\t\t),\n\t\t},\n\t];\n\n\tif ( page?.templateTitle ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Template' ),\n\t\t\tvalue: decodeEntities( page.templateTitle ),\n\t\t} );\n\t}\n\n\tif ( page?.parentTitle ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Parent' ),\n\t\t\tvalue: decodeEntities( page.parentTitle || __( '(no title)' ) ),\n\t\t} );\n\t}\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst wordsCounted = page?.content?.rendered\n\t\t? wordCount( page.content.rendered, wordCountType )\n\t\t: 0;\n\tconst readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );\n\n\tif ( wordsCounted ) {\n\t\tdetails.push(\n\t\t\t{\n\t\t\t\tlabel: __( 'Words' ),\n\t\t\t\tvalue: wordsCounted.toLocaleString() || __( 'Unknown' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Time to read' ),\n\t\t\t\tvalue:\n\t\t\t\t\treadingTime > 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: is the number of minutes. */\n\t\t\t\t\t\t\t\t__( '%s mins' ),\n\t\t\t\t\t\t\t\treadingTime.toLocaleString()\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( '< 1 min' ),\n\t\t\t}\n\t\t);\n\t}\n\treturn details;\n}\n\nexport default function PageDetails( { id } ) {\n\tconst { record } = useEntityRecord( 'postType', 'page', id );\n\tconst { parentTitle, templateTitle } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostContext } = unlock( select( editSiteStore ) );\n\t\t\tconst postContext = getEditedPostContext();\n\t\t\tconst templates = select( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{ per_page: -1 }\n\t\t\t);\n\t\t\t// Template title.\n\t\t\tconst templateSlug =\n\t\t\t\t// Checks that the post type matches the current theme's post type, otherwise\n\t\t\t\t// the templateSlug returns 'home'.\n\t\t\t\tpostContext?.postType === 'page'\n\t\t\t\t\t? postContext?.templateSlug\n\t\t\t\t\t: null;\n\t\t\tconst _templateTitle =\n\t\t\t\ttemplates && templateSlug\n\t\t\t\t\t? templates.find(\n\t\t\t\t\t\t\t( template ) => template.slug === templateSlug\n\t\t\t\t\t )?.title?.rendered\n\t\t\t\t\t: null;\n\n\t\t\t// Parent page title.\n\t\t\tconst _parentTitle = record?.parent\n\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'page',\n\t\t\t\t\t\trecord.parent,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t_fields: [ 'title' ],\n\t\t\t\t\t\t}\n\t\t\t\t )?.title?.rendered\n\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\tparentTitle: _parentTitle,\n\t\t\t\ttemplateTitle: _templateTitle,\n\t\t\t};\n\t\t},\n\t\t[ record?.parent ]\n\t);\n\treturn (\n\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\tspacing={ 5 }\n\t\t\ttitle={ __( 'Details' ) }\n\t\t>\n\t\t\t{ getPageDetails( {\n\t\t\t\tparentTitle,\n\t\t\t\ttemplateTitle,\n\t\t\t\t...record,\n\t\t\t} ).map( ( { label, value } ) => (\n\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t{ value }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t) ) }\n\t\t</SidebarNavigationScreenDetailsPanel>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/page-details.js"],"names":["__","_x","sprintf","__experimentalTruncate","Truncate","count","wordCount","useSelect","decodeEntities","store","coreStore","useEntityRecord","safeDecodeURIComponent","StatusLabel","unlock","editSiteStore","SidebarNavigationScreenDetailsPanel","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","AVERAGE_READING_RATE","getPageDetails","page","details","label","value","password","status","date","slug","templateTitle","push","parentTitle","wordCountType","wordsCounted","content","rendered","readingTime","Math","round","isPostsPage","toLocaleString","PageDetails","id","record","select","getEditedPostContext","postContext","templates","getEntityRecords","per_page","templateSlug","postType","_templateTitle","find","template","title","_parentTitle","parent","getEntityRecord","_fields","siteSettings","page_for_posts","map"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,sBAAsB,IAAIC,QAAnC,QAAmD,uBAAnD;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,KAAK,IAAIC,SAAlB,EAA6BC,eAA7B,QAAoD,sBAApD;AACA,SAASC,sBAAT,QAAuC,gBAAvC;AAEA;AACA;AACA;;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,SAASC,MAAT,QAAuB,mBAAvB;AACA,SAASL,KAAK,IAAIM,aAAlB,QAAuC,aAAvC;AACA,SACCC,mCADD,EAECC,sCAFD,EAGCC,wCAHD,EAICC,wCAJD,QAKO,4CALP,C,CAOA;;AACA,MAAMC,oBAAoB,GAAG,GAA7B;;AAEA,SAASC,cAAT,CAAyBC,IAAzB,EAAgC;AAC/B,MAAK,CAAEA,IAAP,EAAc;AACb,WAAO,EAAP;AACA;;AAED,QAAMC,OAAO,GAAG,CACf;AACCC,IAAAA,KAAK,EAAExB,EAAE,CAAE,QAAF,CADV;AAECyB,IAAAA,KAAK,EACJ,cAAC,WAAD;AACC,MAAA,MAAM,EAAGH,IAAI,EAAEI,QAAN,GAAiB,WAAjB,GAA+BJ,IAAI,CAACK,MAD9C;AAEC,MAAA,IAAI,EAAGL,IAAI,EAAEM,IAFd;AAGC,MAAA,KAAK;AAHN;AAHF,GADe,EAWf;AAC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AACc,MAHP,EAIA;AACCE,MAAAA,OAAO,EAAE,CAAE,OAAF;AADV,KAJA,GAOGJ,KAPH,EAOUpB,QARQ,GASlB,IATH;;AAWA,UAAM;AAAEuB,MAAAA;AAAF,QAAsBd,MAAM,CAAEnC,SAAF,CAAlC;AACA,UAAMmD,YAAY,GAAGF,eAAe,CAAE,MAAF,EAAU,MAAV,CAApC;AAEA,WAAO;AACN3B,MAAAA,WAAW,EAAEyB,YADP;AAEN3B,MAAAA,aAAa,EAAEuB,cAFT;AAGNb,MAAAA,WAAW,EAAEI,MAAM,EAAED,EAAR,KAAekB,YAAY,EAAEC;AAHpC,KAAP;AAKA,GA3C2D,EA4C5D,CAAElB,MAAM,EAAEc,MAAV,EAAkBd,MAAM,EAAED,EAA1B,CA5C4D,CAA7D;AA8CA,SACC,cAAC,mCAAD;AACC,IAAA,OAAO,EAAG,CADX;AAEC,IAAA,KAAK,EAAG3C,EAAE,CAAE,SAAF;AAFX,KAIGqB,cAAc,CAAE;AACjBW,IAAAA,WADiB;AAEjBF,IAAAA,aAFiB;AAGjBU,IAAAA,WAHiB;AAIjB,OAAGI;AAJc,GAAF,CAAd,CAKEmB,GALF,CAKO,CAAE;AAAEvC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAF,KACR,cAAC,sCAAD;AAAwC,IAAA,GAAG,EAAGD;AAA9C,KACC,cAAC,wCAAD,QACGA,KADH,CADD,EAIC,cAAC,wCAAD,QACGC,KADH,CAJD,CANC,CAJH,CADD;AAsBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { __experimentalTruncate as Truncate } from '@wordpress/components';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { safeDecodeURIComponent } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport StatusLabel from './status-label';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\n\n// Taken from packages/editor/src/components/time-to-read/index.js.\nconst AVERAGE_READING_RATE = 189;\n\nfunction getPageDetails( page ) {\n\tif ( ! page ) {\n\t\treturn [];\n\t}\n\n\tconst details = [\n\t\t{\n\t\t\tlabel: __( 'Status' ),\n\t\t\tvalue: (\n\t\t\t\t<StatusLabel\n\t\t\t\t\tstatus={ page?.password ? 'protected' : page.status }\n\t\t\t\t\tdate={ page?.date }\n\t\t\t\t\tshort\n\t\t\t\t/>\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Slug' ),\n\t\t\tvalue: (\n\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t{ safeDecodeURIComponent( page.slug ) }\n\t\t\t\t</Truncate>\n\t\t\t),\n\t\t},\n\t];\n\n\tif ( page?.templateTitle ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Template' ),\n\t\t\tvalue: decodeEntities( page.templateTitle ),\n\t\t} );\n\t}\n\n\tif ( page?.parentTitle ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Parent' ),\n\t\t\tvalue: decodeEntities( page.parentTitle || __( '(no title)' ) ),\n\t\t} );\n\t}\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst wordsCounted = page?.content?.rendered\n\t\t? wordCount( page.content.rendered, wordCountType )\n\t\t: 0;\n\tconst readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );\n\n\tif ( wordsCounted && ! page?.isPostsPage ) {\n\t\tdetails.push(\n\t\t\t{\n\t\t\t\tlabel: __( 'Words' ),\n\t\t\t\tvalue: wordsCounted.toLocaleString() || __( 'Unknown' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Time to read' ),\n\t\t\t\tvalue:\n\t\t\t\t\treadingTime > 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: is the number of minutes. */\n\t\t\t\t\t\t\t\t__( '%s mins' ),\n\t\t\t\t\t\t\t\treadingTime.toLocaleString()\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( '< 1 min' ),\n\t\t\t}\n\t\t);\n\t}\n\treturn details;\n}\n\nexport default function PageDetails( { id } ) {\n\tconst { record } = useEntityRecord( 'postType', 'page', id );\n\tconst { parentTitle, templateTitle, isPostsPage } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostContext } = unlock( select( editSiteStore ) );\n\t\t\tconst postContext = getEditedPostContext();\n\t\t\tconst templates = select( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{ per_page: -1 }\n\t\t\t);\n\t\t\t// Template title.\n\t\t\tconst templateSlug =\n\t\t\t\t// Checks that the post type matches the current theme's post type, otherwise\n\t\t\t\t// the templateSlug returns 'home'.\n\t\t\t\tpostContext?.postType === 'page'\n\t\t\t\t\t? postContext?.templateSlug\n\t\t\t\t\t: null;\n\t\t\tconst _templateTitle =\n\t\t\t\ttemplates && templateSlug\n\t\t\t\t\t? templates.find(\n\t\t\t\t\t\t\t( template ) => template.slug === templateSlug\n\t\t\t\t\t )?.title?.rendered\n\t\t\t\t\t: null;\n\n\t\t\t// Parent page title.\n\t\t\tconst _parentTitle = record?.parent\n\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'page',\n\t\t\t\t\t\trecord.parent,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t_fields: [ 'title' ],\n\t\t\t\t\t\t}\n\t\t\t\t )?.title?.rendered\n\t\t\t\t: null;\n\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\n\t\t\treturn {\n\t\t\t\tparentTitle: _parentTitle,\n\t\t\t\ttemplateTitle: _templateTitle,\n\t\t\t\tisPostsPage: record?.id === siteSettings?.page_for_posts,\n\t\t\t};\n\t\t},\n\t\t[ record?.parent, record?.id ]\n\t);\n\treturn (\n\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\tspacing={ 5 }\n\t\t\ttitle={ __( 'Details' ) }\n\t\t>\n\t\t\t{ getPageDetails( {\n\t\t\t\tparentTitle,\n\t\t\t\ttemplateTitle,\n\t\t\t\tisPostsPage,\n\t\t\t\t...record,\n\t\t\t} ).map( ( { label, value } ) => (\n\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t{ value }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t) ) }\n\t\t</SidebarNavigationScreenDetailsPanel>\n\t);\n}\n"]}
@@ -11,42 +11,13 @@ import classnames from 'classnames';
11
11
  import { __, sprintf } from '@wordpress/i18n';
12
12
  import { dateI18n, getDate, humanTimeDiff } from '@wordpress/date';
13
13
  import { createInterpolateElement } from '@wordpress/element';
14
- import { Path, SVG } from '@wordpress/primitives';
15
- const publishedIcon = createElement(SVG, {
16
- fill: "none",
17
- xmlns: "http://www.w3.org/2000/svg",
18
- viewBox: "0 0 16 16"
19
- }, createElement(Path, {
20
- fillRule: "evenodd",
21
- clipRule: "evenodd",
22
- d: "M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16Zm-1.067-5.6 4.2-5.667.8.6-4.8 6.467-3-2.267.6-.8 2.2 1.667Z"
23
- }));
24
- const draftIcon = createElement(SVG, {
25
- fill: "none",
26
- xmlns: "http://www.w3.org/2000/svg",
27
- viewBox: "0 0 16 16"
28
- }, createElement(Path, {
29
- fillRule: "evenodd",
30
- clipRule: "evenodd",
31
- d: "M14.5 8a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0ZM16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0Zm-8 4a4 4 0 0 0 0-8v8Z"
32
- }));
33
- const pendingIcon = createElement(SVG, {
34
- fill: "none",
35
- xmlns: "http://www.w3.org/2000/svg",
36
- viewBox: "0 0 16 16"
37
- }, createElement(Path, {
38
- fillRule: "evenodd",
39
- clipRule: "evenodd",
40
- d: "M14.5 8a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0ZM16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0ZM8 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z"
41
- }));
42
14
  export default function StatusLabel({
43
15
  status,
44
16
  date,
45
17
  short
46
18
  }) {
47
19
  const relateToNow = humanTimeDiff(date);
48
- let statusLabel = '';
49
- let statusIcon = pendingIcon;
20
+ let statusLabel = status;
50
21
 
51
22
  switch (status) {
52
23
  case 'publish':
@@ -57,7 +28,6 @@ export default function StatusLabel({
57
28
  dateTime: date
58
29
  })
59
30
  }) : __('Published');
60
- statusIcon = publishedIcon;
61
31
  break;
62
32
 
63
33
  case 'future':
@@ -73,7 +43,6 @@ export default function StatusLabel({
73
43
 
74
44
  case 'draft':
75
45
  statusLabel = __('Draft');
76
- statusIcon = draftIcon;
77
46
  break;
78
47
 
79
48
  case 'pending':
@@ -93,6 +62,6 @@ export default function StatusLabel({
93
62
  className: classnames('edit-site-sidebar-navigation-screen-page__status', {
94
63
  [`has-status has-${status}-status`]: !!status
95
64
  })
96
- }, statusIcon, " ", statusLabel);
65
+ }, statusLabel);
97
66
  }
98
67
  //# sourceMappingURL=status-label.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/status-label.js"],"names":["classnames","__","sprintf","dateI18n","getDate","humanTimeDiff","createInterpolateElement","Path","SVG","publishedIcon","draftIcon","pendingIcon","StatusLabel","status","date","short","relateToNow","statusLabel","statusIcon","time","formattedDate"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,QAAT,EAAmBC,OAAnB,EAA4BC,aAA5B,QAAiD,iBAAjD;AACA,SAASC,wBAAT,QAAyC,oBAAzC;AACA,SAASC,IAAT,EAAeC,GAAf,QAA0B,uBAA1B;AAEA,MAAMC,aAAa,GAClB,cAAC,GAAD;AAAK,EAAA,IAAI,EAAC,MAAV;AAAiB,EAAA,KAAK,EAAC,4BAAvB;AAAoD,EAAA,OAAO,EAAC;AAA5D,GACC,cAAC,IAAD;AACC,EAAA,QAAQ,EAAC,SADV;AAEC,EAAA,QAAQ,EAAC,SAFV;AAGC,EAAA,CAAC,EAAC;AAHH,EADD,CADD;AAUA,MAAMC,SAAS,GACd,cAAC,GAAD;AAAK,EAAA,IAAI,EAAC,MAAV;AAAiB,EAAA,KAAK,EAAC,4BAAvB;AAAoD,EAAA,OAAO,EAAC;AAA5D,GACC,cAAC,IAAD;AACC,EAAA,QAAQ,EAAC,SADV;AAEC,EAAA,QAAQ,EAAC,SAFV;AAGC,EAAA,CAAC,EAAC;AAHH,EADD,CADD;AAUA,MAAMC,WAAW,GAChB,cAAC,GAAD;AAAK,EAAA,IAAI,EAAC,MAAV;AAAiB,EAAA,KAAK,EAAC,4BAAvB;AAAoD,EAAA,OAAO,EAAC;AAA5D,GACC,cAAC,IAAD;AACC,EAAA,QAAQ,EAAC,SADV;AAEC,EAAA,QAAQ,EAAC,SAFV;AAGC,EAAA,CAAC,EAAC;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AAGhB,EAAE,CAAE,oBAAF,CAAhB;AACA;AA1CF;;AA6CA,SACC;AACC,IAAA,SAAS,EAAGD,UAAU,CACrB,kDADqB,EAErB;AACC,OAAG,kBAAkBa,MAAQ,SAA7B,GAAyC,CAAC,CAAEA;AAD7C,KAFqB;AADvB,KAQGK,UARH,OAQkBD,WARlB,CADD;AAYA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { dateI18n, getDate, humanTimeDiff } from '@wordpress/date';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { Path, SVG } from '@wordpress/primitives';\n\nconst publishedIcon = (\n\t<SVG fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n\t\t<Path\n\t\t\tfillRule=\"evenodd\"\n\t\t\tclipRule=\"evenodd\"\n\t\t\td=\"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16Zm-1.067-5.6 4.2-5.667.8.6-4.8 6.467-3-2.267.6-.8 2.2 1.667Z\"\n\t\t/>\n\t</SVG>\n);\n\nconst draftIcon = (\n\t<SVG fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n\t\t<Path\n\t\t\tfillRule=\"evenodd\"\n\t\t\tclipRule=\"evenodd\"\n\t\t\td=\"M14.5 8a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0ZM16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0Zm-8 4a4 4 0 0 0 0-8v8Z\"\n\t\t/>\n\t</SVG>\n);\n\nconst pendingIcon = (\n\t<SVG fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n\t\t<Path\n\t\t\tfillRule=\"evenodd\"\n\t\t\tclipRule=\"evenodd\"\n\t\t\td=\"M14.5 8a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0ZM16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0ZM8 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z\"\n\t\t/>\n\t</SVG>\n);\n\nexport default function StatusLabel( { status, date, short } ) {\n\tconst relateToNow = humanTimeDiff( date );\n\tlet statusLabel = '';\n\tlet statusIcon = pendingIcon;\n\tswitch ( status ) {\n\t\tcase 'publish':\n\t\t\tstatusLabel = date\n\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %s: is the relative time when the post was published. */\n\t\t\t\t\t\t\t__( 'Published <time>%s</time>' ),\n\t\t\t\t\t\t\trelateToNow\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ time: <time dateTime={ date } /> }\n\t\t\t\t )\n\t\t\t\t: __( 'Published' );\n\t\t\tstatusIcon = publishedIcon;\n\t\t\tbreak;\n\t\tcase 'future':\n\t\t\tconst formattedDate = dateI18n(\n\t\t\t\tshort ? 'M j' : 'F j',\n\t\t\t\tgetDate( date )\n\t\t\t);\n\t\t\tstatusLabel = date\n\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %s: is the formatted date and time on which the post is scheduled to be published. */\n\t\t\t\t\t\t\t__( 'Scheduled: <time>%s</time>' ),\n\t\t\t\t\t\t\tformattedDate\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ time: <time dateTime={ date } /> }\n\t\t\t\t )\n\t\t\t\t: __( 'Scheduled' );\n\t\t\tbreak;\n\t\tcase 'draft':\n\t\t\tstatusLabel = __( 'Draft' );\n\t\t\tstatusIcon = draftIcon;\n\t\t\tbreak;\n\t\tcase 'pending':\n\t\t\tstatusLabel = __( 'Pending' );\n\t\t\tbreak;\n\t\tcase 'private':\n\t\t\tstatusLabel = __( 'Private' );\n\t\t\tbreak;\n\t\tcase 'protected':\n\t\t\tstatusLabel = __( 'Password protected' );\n\t\t\tbreak;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames(\n\t\t\t\t'edit-site-sidebar-navigation-screen-page__status',\n\t\t\t\t{\n\t\t\t\t\t[ `has-status has-${ status }-status` ]: !! status,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t{ statusIcon } { statusLabel }\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/status-label.js"],"names":["classnames","__","sprintf","dateI18n","getDate","humanTimeDiff","createInterpolateElement","StatusLabel","status","date","short","relateToNow","statusLabel","time","formattedDate"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,QAAT,EAAmBC,OAAnB,EAA4BC,aAA5B,QAAiD,iBAAjD;AACA,SAASC,wBAAT,QAAyC,oBAAzC;AAEA,eAAe,SAASC,WAAT,CAAsB;AAAEC,EAAAA,MAAF;AAAUC,EAAAA,IAAV;AAAgBC,EAAAA;AAAhB,CAAtB,EAAgD;AAC9D,QAAMC,WAAW,GAAGN,aAAa,CAAEI,IAAF,CAAjC;AACA,MAAIG,WAAW,GAAGJ,MAAlB;;AACA,UAASA,MAAT;AACC,SAAK,SAAL;AACCI,MAAAA,WAAW,GAAGH,IAAI,GACfH,wBAAwB,CACxBJ,OAAO;AACN;AACAD,MAAAA,EAAE,CAAE,2BAAF,CAFI,EAGNU,WAHM,CADiB,EAMxB;AAAEE,QAAAA,IAAI,EAAE;AAAM,UAAA,QAAQ,EAAGJ;AAAjB;AAAR,OANwB,CADT,GASfR,EAAE,CAAE,WAAF,CATL;AAUA;;AACD,SAAK,QAAL;AACC,YAAMa,aAAa,GAAGX,QAAQ,CAC7BO,KAAK,GAAG,KAAH,GAAW,KADa,EAE7BN,OAAO,CAAEK,IAAF,CAFsB,CAA9B;AAIAG,MAAAA,WAAW,GAAGH,IAAI,GACfH,wBAAwB,CACxBJ,OAAO;AACN;AACAD,MAAAA,EAAE,CAAE,4BAAF,CAFI,EAGNa,aAHM,CADiB,EAMxB;AAAED,QAAAA,IAAI,EAAE;AAAM,UAAA,QAAQ,EAAGJ;AAAjB;AAAR,OANwB,CADT,GASfR,EAAE,CAAE,WAAF,CATL;AAUA;;AACD,SAAK,OAAL;AACCW,MAAAA,WAAW,GAAGX,EAAE,CAAE,OAAF,CAAhB;AACA;;AACD,SAAK,SAAL;AACCW,MAAAA,WAAW,GAAGX,EAAE,CAAE,SAAF,CAAhB;AACA;;AACD,SAAK,SAAL;AACCW,MAAAA,WAAW,GAAGX,EAAE,CAAE,SAAF,CAAhB;AACA;;AACD,SAAK,WAAL;AACCW,MAAAA,WAAW,GAAGX,EAAE,CAAE,oBAAF,CAAhB;AACA;AAxCF;;AA2CA,SACC;AACC,IAAA,SAAS,EAAGD,UAAU,CACrB,kDADqB,EAErB;AACC,OAAG,kBAAkBQ,MAAQ,SAA7B,GAAyC,CAAC,CAAEA;AAD7C,KAFqB;AADvB,KAQGI,WARH,CADD;AAYA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { dateI18n, getDate, humanTimeDiff } from '@wordpress/date';\nimport { createInterpolateElement } from '@wordpress/element';\n\nexport default function StatusLabel( { status, date, short } ) {\n\tconst relateToNow = humanTimeDiff( date );\n\tlet statusLabel = status;\n\tswitch ( status ) {\n\t\tcase 'publish':\n\t\t\tstatusLabel = date\n\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %s: is the relative time when the post was published. */\n\t\t\t\t\t\t\t__( 'Published <time>%s</time>' ),\n\t\t\t\t\t\t\trelateToNow\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ time: <time dateTime={ date } /> }\n\t\t\t\t )\n\t\t\t\t: __( 'Published' );\n\t\t\tbreak;\n\t\tcase 'future':\n\t\t\tconst formattedDate = dateI18n(\n\t\t\t\tshort ? 'M j' : 'F j',\n\t\t\t\tgetDate( date )\n\t\t\t);\n\t\t\tstatusLabel = date\n\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %s: is the formatted date and time on which the post is scheduled to be published. */\n\t\t\t\t\t\t\t__( 'Scheduled: <time>%s</time>' ),\n\t\t\t\t\t\t\tformattedDate\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ time: <time dateTime={ date } /> }\n\t\t\t\t )\n\t\t\t\t: __( 'Scheduled' );\n\t\t\tbreak;\n\t\tcase 'draft':\n\t\t\tstatusLabel = __( 'Draft' );\n\t\t\tbreak;\n\t\tcase 'pending':\n\t\t\tstatusLabel = __( 'Pending' );\n\t\t\tbreak;\n\t\tcase 'private':\n\t\t\tstatusLabel = __( 'Private' );\n\t\t\tbreak;\n\t\tcase 'protected':\n\t\t\tstatusLabel = __( 'Password protected' );\n\t\t\tbreak;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames(\n\t\t\t\t'edit-site-sidebar-navigation-screen-page__status',\n\t\t\t\t{\n\t\t\t\t\t[ `has-status has-${ status }-status` ]: !! status,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t{ statusLabel }\n\t\t</div>\n\t);\n}\n"]}
@@ -9,7 +9,7 @@ import { __ } from '@wordpress/i18n';
9
9
  import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
10
10
  import { decodeEntities } from '@wordpress/html-entities';
11
11
  import { privateApis as routerPrivateApis } from '@wordpress/router';
12
- import { layout, page, home, loop, plus } from '@wordpress/icons';
12
+ import { layout, page, home, verse, plus } from '@wordpress/icons';
13
13
  import { useSelect } from '@wordpress/data';
14
14
  /**
15
15
  * Internal dependencies
@@ -57,6 +57,9 @@ export default function SidebarNavigationScreenPages() {
57
57
  slug
58
58
  }) => ['404', 'search'].includes(slug));
59
59
  const homeTemplate = templates?.find(template => template.slug === 'front-page') || templates?.find(template => template.slug === 'home') || templates?.find(template => template.slug === 'index');
60
+
61
+ const getPostsPageTemplate = () => templates?.find(template => template.slug === 'home') || templates?.find(template => template.slug === 'index');
62
+
60
63
  const pagesAndTemplates = pages?.concat(dynamicPageTemplates, [homeTemplate]);
61
64
  const {
62
65
  frontPage,
@@ -99,6 +102,27 @@ export default function SidebarNavigationScreenPages() {
99
102
  setShowAddPage(false);
100
103
  };
101
104
 
105
+ const getPageProps = id => {
106
+ let itemIcon = page;
107
+ const postsPageTemplateId = postsPage && postsPage === id ? getPostsPageTemplate()?.id : null;
108
+
109
+ switch (id) {
110
+ case frontPage:
111
+ itemIcon = home;
112
+ break;
113
+
114
+ case postsPage:
115
+ itemIcon = verse;
116
+ break;
117
+ }
118
+
119
+ return {
120
+ icon: itemIcon,
121
+ postType: postsPageTemplateId ? 'wp_template' : 'page',
122
+ postId: postsPageTemplateId || id
123
+ };
124
+ };
125
+
102
126
  return createElement(Fragment, null, showAddPage && createElement(AddNewPageModal, {
103
127
  onSave: handleNewPage,
104
128
  onClose: () => setShowAddPage(false)
@@ -118,31 +142,15 @@ export default function SidebarNavigationScreenPages() {
118
142
  withChevron: true
119
143
  }, createElement(Truncate, {
120
144
  numberOfLines: 1
121
- }, decodeEntities(homeTemplate.title?.rendered || __('(no title)')))), reorderedPages?.map(item => {
122
- let itemIcon;
123
-
124
- switch (item.id) {
125
- case frontPage:
126
- itemIcon = home;
127
- break;
128
-
129
- case postsPage:
130
- itemIcon = loop;
131
- break;
132
-
133
- default:
134
- itemIcon = page;
135
- }
136
-
137
- return createElement(PageItem, {
138
- postId: item.id,
139
- key: item.id,
140
- icon: itemIcon,
141
- withChevron: true
142
- }, createElement(Truncate, {
143
- numberOfLines: 1
144
- }, decodeEntities(item?.title?.rendered || __('(no title)'))));
145
- }))),
145
+ }, decodeEntities(homeTemplate.title?.rendered || __('(no title)')))), reorderedPages?.map(({
146
+ id,
147
+ title
148
+ }) => createElement(PageItem, { ...getPageProps(id),
149
+ key: id,
150
+ withChevron: true
151
+ }, createElement(Truncate, {
152
+ numberOfLines: 1
153
+ }, decodeEntities(title?.rendered || __('(no title)'))))))),
146
154
  footer: createElement(VStack, {
147
155
  spacing: 0
148
156
  }, dynamicPageTemplates?.map(item => createElement(PageItem, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pages/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalTruncate","Truncate","__experimentalVStack","VStack","useState","__","useEntityRecords","store","coreStore","decodeEntities","privateApis","routerPrivateApis","layout","page","home","loop","plus","useSelect","SidebarNavigationScreen","useLink","SidebarNavigationItem","SidebarButton","AddNewPageModal","unlock","useHistory","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","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","title","rendered","map","itemIcon","document","location"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,kBAAkB,IAAIC,IAFvB,EAGCC,sBAAsB,IAAIC,QAH3B,EAICC,oBAAoB,IAAIC,MAJzB,QAKO,uBALP;AAMA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,gBAAT,EAA2BC,KAAK,IAAIC,SAApC,QAAqD,sBAArD;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,WAAW,IAAIC,iBAAxB,QAAiD,mBAAjD;AACA,SAASC,MAAT,EAAiBC,IAAjB,EAAuBC,IAAvB,EAA6BC,IAA7B,EAAmCC,IAAnC,QAA+C,kBAA/C;AACA,SAASC,SAAT,Q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,EAAC,aADV;AAEC,MAAA,MAAM,EAAGA,IAAI,CAACC,EAFf;AAGC,MAAA,GAAG,EAAGD,IAAI,CAACC,EAHZ;AAIC,MAAA,IAAI,EAAGjD,MAJR;AAKC,MAAA,WAAW;AALZ,OAOC,cAAC,QAAD;AAAU,MAAA,aAAa,EAAG;AAA1B,OACGH,cAAc,CACfmD,IAAI,CAACa,KAAL,EAAYC,QAAZ,IACCrE,EAAE,CAAE,YAAF,CAFY,CADjB,CAPD,CADC,CADH,EAiBC,cAAC,qBAAD;AACC,MAAA,SAAS,EAAC,oDADX;AAEC,MAAA,IAAI,EAAC,yBAFN;AAGC,MAAA,OAAO,EAAG,MAAM;AACfwE,QAAAA,QAAQ,CAACC,QAAT,GAAoB,yBAApB;AACA;AALF,OAOGzE,EAAE,CAAE,kBAAF,CAPL,CAjBD;AAvEF,IAPD,CADD;AA8GA","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, loop, 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 = loop;\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":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalTruncate","Truncate","__experimentalVStack","VStack","useState","__","useEntityRecords","store","coreStore","decodeEntities","privateApis","routerPrivateApis","layout","page","home","verse","plus","useSelect","SidebarNavigationScreen","useLink","SidebarNavigationItem","SidebarButton","AddNewPageModal","unlock","useHistory","PageItem","postType","postId","props","linkInfo","SidebarNavigationScreenPages","records","pages","isResolving","isLoadingPages","status","per_page","templates","isLoadingTemplates","dynamicPageTemplates","filter","slug","includes","homeTemplate","find","template","getPostsPageTemplate","pagesAndTemplates","concat","frontPage","postsPage","select","getEntityRecord","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","postsPageTemplateId","icon","title","rendered","map","document","location"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,kBAAkB,IAAIC,IAFvB,EAGCC,sBAAsB,IAAIC,QAH3B,EAICC,oBAAoB,IAAIC,MAJzB,QAKO,uBALP;AAMA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,gBAAT,EAA2BC,KAAK,IAAIC,SAApC,QAAqD,sBAArD;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,WAAW,IAAIC,iBAAxB,QAAiD,mBAAjD;AACA,SAASC,MAAT,EAAiBC,IAAjB,EAAuBC,IAAvB,EAA6BC,KAA7B,EAAoCC,IAApC,QAAgD,kBAAhD;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,OAAT,QAAwB,gBAAxB;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,eAAP,MAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAiBD,MA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CADC,CApBH,CAPF,CAXF;AAwDC,IAAA,MAAM,EACL,cAAC,MAAD;AAAQ,MAAA,OAAO,EAAG;AAAlB,OACGkC,oBAAoB,EAAEyC,GAAtB,CAA6BnB,IAAF,IAC5B,cAAC,QAAD;AACC,MAAA,QAAQ,EAAC,aADV;AAEC,MAAA,MAAM,EAAGA,IAAI,CAACC,EAFf;AAGC,MAAA,GAAG,EAAGD,IAAI,CAACC,EAHZ;AAIC,MAAA,IAAI,EAAGlD,MAJR;AAKC,MAAA,WAAW;AALZ,OAOC,cAAC,QAAD;AAAU,MAAA,aAAa,EAAG;AAA1B,OACGH,cAAc,CACfoD,IAAI,CAACiB,KAAL,EAAYC,QAAZ,IACC1E,EAAE,CAAE,YAAF,CAFY,CADjB,CAPD,CADC,CADH,EAiBC,cAAC,qBAAD;AACC,MAAA,SAAS,EAAC,oDADX;AAEC,MAAA,IAAI,EAAC,yBAFN;AAGC,MAAA,OAAO,EAAG,MAAM;AACf4E,QAAAA,QAAQ,CAACC,QAAT,GAAoB,yBAApB;AACA;AALF,OAOG7E,EAAE,CAAE,kBAAF,CAPL,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\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 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"]}
@@ -3,10 +3,11 @@ import { createElement } from "@wordpress/element";
3
3
  /**
4
4
  * WordPress dependencies
5
5
  */
6
- import { __ } from '@wordpress/i18n';
6
+ import { __experimentalUseNavigator as useNavigator } from '@wordpress/components';
7
7
  import { useDispatch } from '@wordpress/data';
8
+ import { __ } from '@wordpress/i18n';
8
9
  import { pencil } from '@wordpress/icons';
9
- import { __experimentalUseNavigator as useNavigator } from '@wordpress/components';
10
+ import { getQueryArgs } from '@wordpress/url';
10
11
  /**
11
12
  * Internal dependencies
12
13
  */
@@ -15,31 +16,36 @@ import SidebarButton from '../sidebar-button';
15
16
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
16
17
  import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';
17
18
  import usePatternDetails from './use-pattern-details';
18
- import useNavigationMenuContent from './use-navigation-menu-content';
19
19
  import { store as editSiteStore } from '../../store';
20
20
  import { unlock } from '../../lock-unlock';
21
+ import normalizeRecordKey from '../../utils/normalize-record-key';
21
22
  export default function SidebarNavigationScreenPattern() {
23
+ const {
24
+ categoryType
25
+ } = getQueryArgs(window.location.href);
26
+ const {
27
+ setCanvasMode
28
+ } = unlock(useDispatch(editSiteStore));
22
29
  const {
23
30
  params
24
31
  } = useNavigator();
25
32
  const {
26
- postType,
27
- postId
33
+ postType
28
34
  } = params;
29
- const {
30
- setCanvasMode
31
- } = unlock(useDispatch(editSiteStore));
35
+ const postId = normalizeRecordKey(params?.postId);
32
36
  useInitEditedEntityFromURL();
33
- const patternDetails = usePatternDetails(postType, postId);
34
- const content = useNavigationMenuContent(postType, postId);
37
+ const patternDetails = usePatternDetails(postType, postId); // The absence of a category type in the query params for template parts
38
+ // indicates the user has arrived at the template part via the "manage all"
39
+ // page and the back button should return them to that list page.
40
+
41
+ const backPath = !categoryType && postType === 'wp_template_part' ? '/wp_template_part/all' : '/patterns';
35
42
  return createElement(SidebarNavigationScreen, {
36
43
  actions: createElement(SidebarButton, {
37
44
  onClick: () => setCanvasMode('edit'),
38
45
  label: __('Edit'),
39
46
  icon: pencil
40
47
  }),
41
- backPath: '/library',
42
- content: content,
48
+ backPath: backPath,
43
49
  ...patternDetails
44
50
  });
45
51
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/index.js"],"names":["__","useDispatch","pencil","__experimentalUseNavigator","useNavigator","SidebarButton","SidebarNavigationScreen","useInitEditedEntityFromURL","usePatternDetails","useNavigationMenuContent","store","editSiteStore","unlock","SidebarNavigationScreenPattern","params","postType","postId","setCanvasMode","patternDetails","content"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,kBAAvB;AACA,SAASC,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,0BAAP,MAAuC,wDAAvC;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,OAAOC,wBAAP,MAAqC,+BAArC;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,eAAe,SAASC,8BAAT,GAA0C;AACxD,QAAM;AAAEC,IAAAA;AAAF,MAAaV,YAAY,EAA/B;AACA,QAAM;AAAEW,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAuBF,MAA7B;AACA,QAAM;AAAEG,IAAAA;AAAF,MAAoBL,MAAM,CAAEX,WAAW,CAAEU,aAAF,CAAb,CAAhC;AAEAJ,EAAAA,0BAA0B;AAE1B,QAAMW,cAAc,GAAGV,iBAAiB,CAAEO,QAAF,EAAYC,MAAZ,CAAxC;AACA,QAAMG,OAAO,GAAGV,wBAAwB,CAAEM,QAAF,EAAYC,MAAZ,CAAxC;AAEA,SACC,cAAC,uBAAD;AACC,IAAA,OAAO,EACN,cAAC,aAAD;AACC,MAAA,OAAO,EAAG,MAAMC,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAGjB,EAAE,CAAE,MAAF,CAFX;AAGC,MAAA,IAAI,EAAGE;AAHR,MAFF;AAQC,IAAA,QAAQ,EAAG,UARZ;AASC,IAAA,OAAO,EAAGiB,OATX;AAAA,OAUMD;AAVN,IADD;AAcA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\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 useNavigationMenuContent from './use-navigation-menu-content';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function SidebarNavigationScreenPattern() {\n\tconst { params } = useNavigator();\n\tconst { postType, postId } = params;\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tuseInitEditedEntityFromURL();\n\n\tconst patternDetails = usePatternDetails( postType, postId );\n\tconst content = useNavigationMenuContent( postType, postId );\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={ '/library' }\n\t\t\tcontent={ content }\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":["__experimentalUseNavigator","useNavigator","useDispatch","__","pencil","getQueryArgs","SidebarButton","SidebarNavigationScreen","useInitEditedEntityFromURL","usePatternDetails","store","editSiteStore","unlock","normalizeRecordKey","SidebarNavigationScreenPattern","categoryType","window","location","href","setCanvasMode","params","postType","postId","patternDetails","backPath"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,kBAAvB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,0BAAP,MAAuC,wDAAvC;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AACA,OAAOC,kBAAP,MAA+B,kCAA/B;AAEA,eAAe,SAASC,8BAAT,GAA0C;AACxD,QAAM;AAAEC,IAAAA;AAAF,MAAmBV,YAAY,CAAEW,MAAM,CAACC,QAAP,CAAgBC,IAAlB,CAArC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAoBP,MAAM,CAAEV,WAAW,CAAES,aAAF,CAAb,CAAhC;AAEA,QAAM;AAAES,IAAAA;AAAF,MAAanB,YAAY,EAA/B;AACA,QAAM;AAAEoB,IAAAA;AAAF,MAAeD,MAArB;AACA,QAAME,MAAM,GAAGT,kBAAkB,CAAEO,MAAM,EAAEE,MAAV,CAAjC;AAEAd,EAAAA,0BAA0B;AAE1B,QAAMe,cAAc,GAAGd,iBAAiB,CAAEY,QAAF,EAAYC,MAAZ,CAAxC,CAVwD,CAYxD;AACA;AACA;;AACA,QAAME,QAAQ,GACb,CAAET,YAAF,IAAkBM,QAAQ,KAAK,kBAA/B,GACG,uBADH,GAEG,WAHJ;AAKA,SACC,cAAC,uBAAD;AACC,IAAA,OAAO,EACN,cAAC,aAAD;AACC,MAAA,OAAO,EAAG,MAAMF,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAGhB,EAAE,CAAE,MAAF,CAFX;AAGC,MAAA,IAAI,EAAGC;AAHR,MAFF;AAQC,IAAA,QAAQ,EAAGoB,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"]}