@wordpress/edit-site 5.16.0 → 5.17.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 (996) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-page/index.js +3 -13
  3. package/build/components/add-new-page/index.js.map +1 -1
  4. package/build/components/add-new-pattern/index.js +13 -26
  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 +1 -11
  7. package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  8. package/build/components/add-new-template/add-custom-template-modal-content.js +9 -28
  9. package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  10. package/build/components/add-new-template/index.js +3 -10
  11. package/build/components/add-new-template/index.js.map +1 -1
  12. package/build/components/add-new-template/new-template.js +19 -49
  13. package/build/components/add-new-template/new-template.js.map +1 -1
  14. package/build/components/add-new-template/template-actions-loading-screen.js +1 -3
  15. package/build/components/add-new-template/template-actions-loading-screen.js.map +1 -1
  16. package/build/components/add-new-template/utils.js +52 -102
  17. package/build/components/add-new-template/utils.js.map +1 -1
  18. package/build/components/app/index.js +2 -19
  19. package/build/components/app/index.js.map +1 -1
  20. package/build/components/block-editor/back-button.js +1 -11
  21. package/build/components/block-editor/back-button.js.map +1 -1
  22. package/build/components/block-editor/block-inspector-button.js +3 -14
  23. package/build/components/block-editor/block-inspector-button.js.map +1 -1
  24. package/build/components/block-editor/constants.js.map +1 -1
  25. package/build/components/block-editor/editor-canvas.js +5 -14
  26. package/build/components/block-editor/editor-canvas.js.map +1 -1
  27. package/build/components/block-editor/get-block-editor-provider.js +0 -7
  28. package/build/components/block-editor/get-block-editor-provider.js.map +1 -1
  29. package/build/components/block-editor/index.js +10 -15
  30. package/build/components/block-editor/index.js.map +1 -1
  31. package/build/components/block-editor/inserter-media-categories.js +30 -45
  32. package/build/components/block-editor/inserter-media-categories.js.map +1 -1
  33. package/build/components/block-editor/providers/default-block-editor-provider.js +1 -10
  34. package/build/components/block-editor/providers/default-block-editor-provider.js.map +1 -1
  35. package/build/components/block-editor/providers/navigation-block-editor-provider.js +10 -19
  36. package/build/components/block-editor/providers/navigation-block-editor-provider.js.map +1 -1
  37. package/build/components/block-editor/resizable-editor.js +3 -8
  38. package/build/components/block-editor/resizable-editor.js.map +1 -1
  39. package/build/components/block-editor/resize-handle.js +1 -7
  40. package/build/components/block-editor/resize-handle.js.map +1 -1
  41. package/build/components/block-editor/site-editor-canvas.js +6 -22
  42. package/build/components/block-editor/site-editor-canvas.js.map +1 -1
  43. package/build/components/block-editor/use-site-editor-settings.js +11 -29
  44. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  45. package/build/components/canvas-spinner/index.js +31 -5
  46. package/build/components/canvas-spinner/index.js.map +1 -1
  47. package/build/components/code-editor/index.js +3 -18
  48. package/build/components/code-editor/index.js.map +1 -1
  49. package/build/components/create-template-part-modal/index.js +4 -19
  50. package/build/components/create-template-part-modal/index.js.map +1 -1
  51. package/build/components/editor/index.js +30 -46
  52. package/build/components/editor/index.js.map +1 -1
  53. package/build/components/editor-canvas-container/index.js +2 -28
  54. package/build/components/editor-canvas-container/index.js.map +1 -1
  55. package/build/components/error-boundary/index.js +1 -12
  56. package/build/components/error-boundary/index.js.map +1 -1
  57. package/build/components/error-boundary/warning.js +1 -7
  58. package/build/components/error-boundary/warning.js.map +1 -1
  59. package/build/components/global-styles/block-preview-panel.js +22 -13
  60. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  61. package/build/components/global-styles/color-indicator-wrapper.js +1 -6
  62. package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
  63. package/build/components/global-styles/color-palette-panel.js +1 -8
  64. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  65. package/build/components/global-styles/dimensions-panel.js +14 -16
  66. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  67. package/build/components/global-styles/global-styles-provider.js +1 -22
  68. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  69. package/build/components/global-styles/gradients-palette-panel.js +1 -11
  70. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  71. package/build/components/global-styles/header.js +3 -7
  72. package/build/components/global-styles/header.js.map +1 -1
  73. package/build/components/global-styles/hooks.js +26 -15
  74. package/build/components/global-styles/hooks.js.map +1 -1
  75. package/build/components/global-styles/icon-with-current-color.js +1 -5
  76. package/build/components/global-styles/icon-with-current-color.js.map +1 -1
  77. package/build/components/global-styles/index.js +0 -2
  78. package/build/components/global-styles/index.js.map +1 -1
  79. package/build/components/global-styles/navigation-button.js +3 -7
  80. package/build/components/global-styles/navigation-button.js.map +1 -1
  81. package/build/components/global-styles/palette.js +3 -15
  82. package/build/components/global-styles/palette.js.map +1 -1
  83. package/build/components/global-styles/preview.js +7 -18
  84. package/build/components/global-styles/preview.js.map +1 -1
  85. package/build/components/global-styles/root-menu.js +1 -10
  86. package/build/components/global-styles/root-menu.js.map +1 -1
  87. package/build/components/global-styles/screen-block-list.js +10 -32
  88. package/build/components/global-styles/screen-block-list.js.map +1 -1
  89. package/build/components/global-styles/screen-block.js +28 -49
  90. package/build/components/global-styles/screen-block.js.map +1 -1
  91. package/build/components/global-styles/screen-color-palette.js +1 -9
  92. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  93. package/build/components/global-styles/screen-colors.js +2 -14
  94. package/build/components/global-styles/screen-colors.js.map +1 -1
  95. package/build/components/global-styles/screen-css.js +1 -10
  96. package/build/components/global-styles/screen-css.js.map +1 -1
  97. package/build/components/global-styles/screen-layout.js +2 -13
  98. package/build/components/global-styles/screen-layout.js.map +1 -1
  99. package/build/components/global-styles/screen-revisions/index.js +7 -25
  100. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  101. package/build/components/global-styles/screen-revisions/revisions-buttons.js +20 -24
  102. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  103. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +12 -22
  104. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  105. package/build/components/global-styles/screen-root.js +2 -20
  106. package/build/components/global-styles/screen-root.js.map +1 -1
  107. package/build/components/global-styles/screen-style-variations.js +6 -15
  108. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  109. package/build/components/global-styles/screen-typography-element.js +2 -12
  110. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  111. package/build/components/global-styles/screen-typography.js +4 -17
  112. package/build/components/global-styles/screen-typography.js.map +1 -1
  113. package/build/components/global-styles/style-variations-container.js +4 -25
  114. package/build/components/global-styles/style-variations-container.js.map +1 -1
  115. package/build/components/global-styles/subtitle.js +1 -4
  116. package/build/components/global-styles/subtitle.js.map +1 -1
  117. package/build/components/global-styles/typography-panel.js +1 -7
  118. package/build/components/global-styles/typography-panel.js.map +1 -1
  119. package/build/components/global-styles/typography-preview.js +1 -7
  120. package/build/components/global-styles/typography-preview.js.map +1 -1
  121. package/build/components/global-styles/ui.js +14 -62
  122. package/build/components/global-styles/ui.js.map +1 -1
  123. package/build/components/global-styles/utils.js +0 -2
  124. package/build/components/global-styles/utils.js.map +1 -1
  125. package/build/components/global-styles/variations-panel.js +1 -9
  126. package/build/components/global-styles/variations-panel.js.map +1 -1
  127. package/build/components/global-styles-renderer/index.js +3 -11
  128. package/build/components/global-styles-renderer/index.js.map +1 -1
  129. package/build/components/header-edit-mode/document-actions/index.js +10 -51
  130. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  131. package/build/components/header-edit-mode/index.js +8 -36
  132. package/build/components/header-edit-mode/index.js.map +1 -1
  133. package/build/components/header-edit-mode/mode-switcher/index.js +2 -11
  134. package/build/components/header-edit-mode/mode-switcher/index.js.map +1 -1
  135. package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js +1 -14
  136. package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +1 -1
  137. package/build/components/header-edit-mode/more-menu/index.js +2 -24
  138. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  139. package/build/components/header-edit-mode/more-menu/site-export.js +1 -14
  140. package/build/components/header-edit-mode/more-menu/site-export.js.map +1 -1
  141. package/build/components/header-edit-mode/more-menu/welcome-guide-menu-item.js +1 -6
  142. package/build/components/header-edit-mode/more-menu/welcome-guide-menu-item.js.map +1 -1
  143. package/build/components/header-edit-mode/plugin-more-menu-item/index.js +0 -8
  144. package/build/components/header-edit-mode/plugin-more-menu-item/index.js.map +1 -1
  145. package/build/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js +3 -4
  146. package/build/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js.map +1 -1
  147. package/build/components/header-edit-mode/tools-more-menu-group/index.js +1 -5
  148. package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -1
  149. package/build/components/header-edit-mode/undo-redo/redo.js +5 -12
  150. package/build/components/header-edit-mode/undo-redo/redo.js.map +1 -1
  151. package/build/components/header-edit-mode/undo-redo/undo.js +5 -12
  152. package/build/components/header-edit-mode/undo-redo/undo.js.map +1 -1
  153. package/build/components/keyboard-shortcut-help-modal/config.js +1 -2
  154. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  155. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -8
  156. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  157. package/build/components/keyboard-shortcut-help-modal/index.js +4 -24
  158. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  159. package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -5
  160. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  161. package/build/components/keyboard-shortcuts/edit-mode.js +3 -24
  162. package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  163. package/build/components/keyboard-shortcuts/global.js +1 -9
  164. package/build/components/keyboard-shortcuts/global.js.map +1 -1
  165. package/build/components/keyboard-shortcuts/register.js +1 -7
  166. package/build/components/keyboard-shortcuts/register.js.map +1 -1
  167. package/build/components/layout/hooks.js +2 -9
  168. package/build/components/layout/hooks.js.map +1 -1
  169. package/build/components/layout/index.js +17 -50
  170. package/build/components/layout/index.js.map +1 -1
  171. package/build/components/list/added-by.js +10 -23
  172. package/build/components/list/added-by.js.map +1 -1
  173. package/build/components/list/header.js +1 -10
  174. package/build/components/list/header.js.map +1 -1
  175. package/build/components/list/index.js +8 -20
  176. package/build/components/list/index.js.map +1 -1
  177. package/build/components/list/table.js +5 -16
  178. package/build/components/list/table.js.map +1 -1
  179. package/build/components/list/use-register-shortcuts.js +1 -5
  180. package/build/components/list/use-register-shortcuts.js.map +1 -1
  181. package/build/components/page/header.js +1 -3
  182. package/build/components/page/header.js.map +1 -1
  183. package/build/components/page/index.js +1 -7
  184. package/build/components/page/index.js.map +1 -1
  185. package/build/components/page-actions/index.js +1 -7
  186. package/build/components/page-actions/index.js.map +1 -1
  187. package/build/components/page-actions/trash-page-menu-item.js +4 -13
  188. package/build/components/page-actions/trash-page-menu-item.js.map +1 -1
  189. package/build/components/page-content-focus-manager/back-to-page-notification.js +1 -9
  190. package/build/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
  191. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +7 -17
  192. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  193. package/build/components/page-content-focus-manager/edit-template-notification.js +0 -16
  194. package/build/components/page-content-focus-manager/edit-template-notification.js.map +1 -1
  195. package/build/components/page-content-focus-manager/index.js +1 -8
  196. package/build/components/page-content-focus-manager/index.js.map +1 -1
  197. package/build/components/page-main/index.js +1 -11
  198. package/build/components/page-main/index.js.map +1 -1
  199. package/build/components/page-patterns/duplicate-menu-item.js +22 -49
  200. package/build/components/page-patterns/duplicate-menu-item.js.map +1 -1
  201. package/build/components/page-patterns/grid-item.js +12 -32
  202. package/build/components/page-patterns/grid-item.js.map +1 -1
  203. package/build/components/page-patterns/grid.js +1 -5
  204. package/build/components/page-patterns/grid.js.map +1 -1
  205. package/build/components/page-patterns/header.js +1 -11
  206. package/build/components/page-patterns/header.js.map +1 -1
  207. package/build/components/page-patterns/index.js +6 -15
  208. package/build/components/page-patterns/index.js.map +1 -1
  209. package/build/components/page-patterns/no-patterns.js +1 -3
  210. package/build/components/page-patterns/no-patterns.js.map +1 -1
  211. package/build/components/page-patterns/pagination.js +7 -7
  212. package/build/components/page-patterns/pagination.js.map +1 -1
  213. package/build/components/page-patterns/patterns-list.js +1 -23
  214. package/build/components/page-patterns/patterns-list.js.map +1 -1
  215. package/build/components/page-patterns/rename-menu-item.js +5 -14
  216. package/build/components/page-patterns/rename-menu-item.js.map +1 -1
  217. package/build/components/page-patterns/search-items.js +27 -38
  218. package/build/components/page-patterns/search-items.js.map +1 -1
  219. package/build/components/page-patterns/use-pattern-settings.js +5 -10
  220. package/build/components/page-patterns/use-pattern-settings.js.map +1 -1
  221. package/build/components/page-patterns/use-patterns.js +15 -34
  222. package/build/components/page-patterns/use-patterns.js.map +1 -1
  223. package/build/components/page-patterns/utils.js +0 -2
  224. package/build/components/page-patterns/utils.js.map +1 -1
  225. package/build/components/page-template-parts/add-new-template-part.js +1 -13
  226. package/build/components/page-template-parts/add-new-template-part.js.map +1 -1
  227. package/build/components/page-template-parts/index.js +1 -13
  228. package/build/components/page-template-parts/index.js.map +1 -1
  229. package/build/components/page-templates/index.js +1 -13
  230. package/build/components/page-templates/index.js.map +1 -1
  231. package/build/components/plugin-template-setting-panel/index.js +2 -3
  232. package/build/components/plugin-template-setting-panel/index.js.map +1 -1
  233. package/build/components/preferences-modal/enable-feature.js +1 -7
  234. package/build/components/preferences-modal/enable-feature.js.map +1 -1
  235. package/build/components/preferences-modal/index.js +1 -16
  236. package/build/components/preferences-modal/index.js.map +1 -1
  237. package/build/components/resizable-frame/index.js +24 -44
  238. package/build/components/resizable-frame/index.js.map +1 -1
  239. package/build/components/revisions/index.js +5 -17
  240. package/build/components/revisions/index.js.map +1 -1
  241. package/build/components/routes/link.js +3 -14
  242. package/build/components/routes/link.js.map +1 -1
  243. package/build/components/routes/use-title.js +5 -16
  244. package/build/components/routes/use-title.js.map +1 -1
  245. package/build/components/save-button/index.js +3 -20
  246. package/build/components/save-button/index.js.map +1 -1
  247. package/build/components/save-hub/index.js +7 -29
  248. package/build/components/save-hub/index.js.map +1 -1
  249. package/build/components/save-panel/index.js +6 -28
  250. package/build/components/save-panel/index.js.map +1 -1
  251. package/build/components/secondary-sidebar/inserter-sidebar.js +1 -9
  252. package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  253. package/build/components/secondary-sidebar/list-view-sidebar.js +21 -32
  254. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  255. package/build/components/sidebar/index.js +1 -25
  256. package/build/components/sidebar/index.js.map +1 -1
  257. package/build/components/sidebar-button/index.js +3 -6
  258. package/build/components/sidebar-button/index.js.map +1 -1
  259. package/build/components/sidebar-edit-mode/constants.js.map +1 -1
  260. package/build/components/sidebar-edit-mode/default-sidebar.js +2 -5
  261. package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
  262. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +1 -18
  263. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  264. package/build/components/sidebar-edit-mode/index.js +1 -24
  265. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  266. package/build/components/sidebar-edit-mode/page-panels/edit-template.js +11 -20
  267. package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
  268. package/build/components/sidebar-edit-mode/page-panels/index.js +3 -18
  269. package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  270. package/build/components/sidebar-edit-mode/page-panels/page-content.js +1 -6
  271. package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  272. package/build/components/sidebar-edit-mode/page-panels/page-status.js +3 -20
  273. package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
  274. package/build/components/sidebar-edit-mode/page-panels/page-summary.js +1 -6
  275. package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  276. package/build/components/sidebar-edit-mode/page-panels/publish-date.js +3 -15
  277. package/build/components/sidebar-edit-mode/page-panels/publish-date.js.map +1 -1
  278. package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +0 -5
  279. package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
  280. package/build/components/sidebar-edit-mode/settings-header/index.js +14 -25
  281. package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  282. package/build/components/sidebar-edit-mode/sidebar-card/index.js +1 -5
  283. package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -1
  284. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +1 -5
  285. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
  286. package/build/components/sidebar-edit-mode/template-panel/index.js +1 -21
  287. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  288. package/build/components/sidebar-edit-mode/template-panel/last-revision.js +2 -17
  289. package/build/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -1
  290. package/build/components/sidebar-edit-mode/template-panel/template-actions.js +1 -11
  291. package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -1
  292. package/build/components/sidebar-edit-mode/template-panel/template-areas.js +1 -15
  293. package/build/components/sidebar-edit-mode/template-panel/template-areas.js.map +1 -1
  294. package/build/components/sidebar-navigation-item/index.js +1 -7
  295. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  296. package/build/components/sidebar-navigation-screen/index.js +2 -19
  297. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  298. package/build/components/sidebar-navigation-screen-details-footer/index.js +2 -7
  299. package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  300. package/build/components/sidebar-navigation-screen-details-panel/index.js +1 -7
  301. package/build/components/sidebar-navigation-screen-details-panel/index.js.map +1 -1
  302. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +1 -3
  303. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +1 -1
  304. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +1 -5
  305. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
  306. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +1 -3
  307. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +1 -1
  308. package/build/components/sidebar-navigation-screen-global-styles/index.js +19 -48
  309. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  310. package/build/components/sidebar-navigation-screen-main/index.js +3 -14
  311. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  312. package/build/components/sidebar-navigation-screen-main/template-part-hint.js +1 -10
  313. package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -1
  314. package/build/components/sidebar-navigation-screen-navigation-item/index.js +1 -13
  315. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  316. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +3 -5
  317. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
  318. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +3 -8
  319. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
  320. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +5 -25
  321. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  322. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +5 -16
  323. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  324. package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -13
  325. package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
  326. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -8
  327. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  328. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +1 -10
  329. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  330. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +12 -33
  331. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  332. package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +3 -6
  333. package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -1
  334. package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
  335. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +14 -35
  336. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  337. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +5 -19
  338. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  339. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +6 -14
  340. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  341. package/build/components/sidebar-navigation-screen-page/index.js +6 -23
  342. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
  343. package/build/components/sidebar-navigation-screen-page/page-details.js +9 -32
  344. package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
  345. package/build/components/sidebar-navigation-screen-page/status-label.js +3 -17
  346. package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  347. package/build/components/sidebar-navigation-screen-pages/index.js +6 -31
  348. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  349. package/build/components/sidebar-navigation-screen-pattern/index.js +11 -25
  350. package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  351. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +1 -7
  352. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +1 -1
  353. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +1 -5
  354. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js.map +1 -1
  355. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -7
  356. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  357. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +5 -10
  358. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  359. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +5 -22
  360. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
  361. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +7 -29
  362. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  363. package/build/components/sidebar-navigation-screen-patterns/category-item.js +3 -8
  364. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  365. package/build/components/sidebar-navigation-screen-patterns/index.js +4 -22
  366. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  367. package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js +1 -6
  368. package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -1
  369. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +1 -5
  370. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
  371. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +11 -12
  372. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  373. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +6 -8
  374. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  375. package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -8
  376. package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
  377. package/build/components/sidebar-navigation-screen-template/home-template-details.js +7 -31
  378. package/build/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
  379. package/build/components/sidebar-navigation-screen-template/index.js +1 -20
  380. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  381. package/build/components/sidebar-navigation-screen-templates/index.js +4 -16
  382. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  383. package/build/components/sidebar-navigation-screen-templates-browse/index.js +1 -9
  384. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  385. package/build/components/site-hub/index.js +4 -21
  386. package/build/components/site-hub/index.js.map +1 -1
  387. package/build/components/site-icon/index.js +1 -12
  388. package/build/components/site-icon/index.js.map +1 -1
  389. package/build/components/start-template-options/index.js +3 -26
  390. package/build/components/start-template-options/index.js.map +1 -1
  391. package/build/components/style-book/index.js +23 -34
  392. package/build/components/style-book/index.js.map +1 -1
  393. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -25
  394. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  395. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +5 -13
  396. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  397. package/build/components/sync-state-with-url/use-sync-path-with-url.js +9 -19
  398. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  399. package/build/components/table/index.js +0 -2
  400. package/build/components/table/index.js.map +1 -1
  401. package/build/components/template-actions/index.js +2 -21
  402. package/build/components/template-actions/index.js.map +1 -1
  403. package/build/components/template-actions/rename-menu-item.js +7 -15
  404. package/build/components/template-actions/rename-menu-item.js.map +1 -1
  405. package/build/components/template-part-converter/convert-to-regular.js +1 -8
  406. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  407. package/build/components/template-part-converter/convert-to-template-part.js +4 -15
  408. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  409. package/build/components/template-part-converter/index.js +3 -10
  410. package/build/components/template-part-converter/index.js.map +1 -1
  411. package/build/components/use-edited-entity-record/index.js +2 -15
  412. package/build/components/use-edited-entity-record/index.js.map +1 -1
  413. package/build/components/welcome-guide/editor.js +1 -10
  414. package/build/components/welcome-guide/editor.js.map +1 -1
  415. package/build/components/welcome-guide/image.js +0 -2
  416. package/build/components/welcome-guide/image.js.map +1 -1
  417. package/build/components/welcome-guide/index.js +1 -7
  418. package/build/components/welcome-guide/index.js.map +1 -1
  419. package/build/components/welcome-guide/page.js +1 -9
  420. package/build/components/welcome-guide/page.js.map +1 -1
  421. package/build/components/welcome-guide/styles.js +1 -12
  422. package/build/components/welcome-guide/styles.js.map +1 -1
  423. package/build/components/welcome-guide/template.js +1 -9
  424. package/build/components/welcome-guide/template.js.map +1 -1
  425. package/build/hooks/commands/use-common-commands.js +132 -122
  426. package/build/hooks/commands/use-common-commands.js.map +1 -1
  427. package/build/hooks/commands/use-edit-mode-commands.js +68 -65
  428. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  429. package/build/hooks/components.js +1 -2
  430. package/build/hooks/components.js.map +1 -1
  431. package/build/hooks/index.js +0 -3
  432. package/build/hooks/index.js.map +1 -1
  433. package/build/hooks/navigation-menu-edit.js +11 -24
  434. package/build/hooks/navigation-menu-edit.js.map +1 -1
  435. package/build/hooks/push-changes-to-global-styles/index.js +161 -69
  436. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  437. package/build/hooks/template-part-edit.js +7 -19
  438. package/build/hooks/template-part-edit.js.map +1 -1
  439. package/build/index.js +8 -31
  440. package/build/index.js.map +1 -1
  441. package/build/lock-unlock.js +1 -2
  442. package/build/lock-unlock.js.map +1 -1
  443. package/build/store/actions.js +33 -98
  444. package/build/store/actions.js.map +1 -1
  445. package/build/store/constants.js +0 -1
  446. package/build/store/constants.js.map +1 -1
  447. package/build/store/index.js +1 -12
  448. package/build/store/index.js.map +1 -1
  449. package/build/store/private-actions.js +5 -13
  450. package/build/store/private-actions.js.map +1 -1
  451. package/build/store/private-selectors.js +1 -3
  452. package/build/store/private-selectors.js.map +1 -1
  453. package/build/store/reducer.js +12 -38
  454. package/build/store/reducer.js.map +1 -1
  455. package/build/store/selectors.js +23 -60
  456. package/build/store/selectors.js.map +1 -1
  457. package/build/store/utils.js +13 -16
  458. package/build/store/utils.js.map +1 -1
  459. package/build/utils/get-is-list-page.js +2 -2
  460. package/build/utils/get-is-list-page.js.map +1 -1
  461. package/build/utils/is-previewing-theme.js +1 -4
  462. package/build/utils/is-previewing-theme.js.map +1 -1
  463. package/build/utils/is-template-removable.js +0 -2
  464. package/build/utils/is-template-removable.js.map +1 -1
  465. package/build/utils/is-template-revertable.js +0 -3
  466. package/build/utils/is-template-revertable.js.map +1 -1
  467. package/build/utils/template-part-create.js +3 -15
  468. package/build/utils/template-part-create.js.map +1 -1
  469. package/build/utils/use-activate-theme.js +2 -5
  470. package/build/utils/use-activate-theme.js.map +1 -1
  471. package/build/utils/use-debounced-input.js +1 -3
  472. package/build/utils/use-debounced-input.js.map +1 -1
  473. package/build-module/components/add-new-page/index.js +2 -7
  474. package/build-module/components/add-new-page/index.js.map +1 -1
  475. package/build-module/components/add-new-pattern/index.js +12 -13
  476. package/build-module/components/add-new-pattern/index.js.map +1 -1
  477. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +1 -11
  478. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  479. package/build-module/components/add-new-template/add-custom-template-modal-content.js +9 -21
  480. package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  481. package/build-module/components/add-new-template/index.js +3 -6
  482. package/build-module/components/add-new-template/index.js.map +1 -1
  483. package/build-module/components/add-new-template/new-template.js +20 -34
  484. package/build-module/components/add-new-template/new-template.js.map +1 -1
  485. package/build-module/components/add-new-template/template-actions-loading-screen.js +0 -1
  486. package/build-module/components/add-new-template/template-actions-loading-screen.js.map +1 -1
  487. package/build-module/components/add-new-template/utils.js +52 -82
  488. package/build-module/components/add-new-template/utils.js.map +1 -1
  489. package/build-module/components/app/index.js +2 -6
  490. package/build-module/components/app/index.js.map +1 -1
  491. package/build-module/components/block-editor/back-button.js +1 -6
  492. package/build-module/components/block-editor/back-button.js.map +1 -1
  493. package/build-module/components/block-editor/block-inspector-button.js +3 -5
  494. package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
  495. package/build-module/components/block-editor/constants.js.map +1 -1
  496. package/build-module/components/block-editor/editor-canvas.js +6 -8
  497. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  498. package/build-module/components/block-editor/get-block-editor-provider.js +1 -4
  499. package/build-module/components/block-editor/get-block-editor-provider.js.map +1 -1
  500. package/build-module/components/block-editor/index.js +10 -6
  501. package/build-module/components/block-editor/index.js.map +1 -1
  502. package/build-module/components/block-editor/inserter-media-categories.js +31 -41
  503. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
  504. package/build-module/components/block-editor/providers/default-block-editor-provider.js +1 -2
  505. package/build-module/components/block-editor/providers/default-block-editor-provider.js.map +1 -1
  506. package/build-module/components/block-editor/providers/navigation-block-editor-provider.js +10 -11
  507. package/build-module/components/block-editor/providers/navigation-block-editor-provider.js.map +1 -1
  508. package/build-module/components/block-editor/resizable-editor.js +5 -6
  509. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  510. package/build-module/components/block-editor/resize-handle.js +0 -3
  511. package/build-module/components/block-editor/resize-handle.js.map +1 -1
  512. package/build-module/components/block-editor/site-editor-canvas.js +5 -8
  513. package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
  514. package/build-module/components/block-editor/use-site-editor-settings.js +10 -23
  515. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  516. package/build-module/components/canvas-spinner/index.js +31 -4
  517. package/build-module/components/canvas-spinner/index.js.map +1 -1
  518. package/build-module/components/code-editor/index.js +4 -9
  519. package/build-module/components/code-editor/index.js.map +1 -1
  520. package/build-module/components/create-template-part-modal/index.js +4 -8
  521. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  522. package/build-module/components/editor/index.js +31 -21
  523. package/build-module/components/editor/index.js.map +1 -1
  524. package/build-module/components/editor-canvas-container/index.js +4 -18
  525. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  526. package/build-module/components/error-boundary/index.js +1 -7
  527. package/build-module/components/error-boundary/index.js.map +1 -1
  528. package/build-module/components/error-boundary/warning.js +0 -3
  529. package/build-module/components/error-boundary/warning.js.map +1 -1
  530. package/build-module/components/global-styles/block-preview-panel.js +22 -10
  531. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  532. package/build-module/components/global-styles/color-indicator-wrapper.js +1 -4
  533. package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -1
  534. package/build-module/components/global-styles/color-palette-panel.js +1 -2
  535. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  536. package/build-module/components/global-styles/dimensions-panel.js +14 -13
  537. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  538. package/build-module/components/global-styles/global-styles-provider.js +2 -15
  539. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  540. package/build-module/components/global-styles/gradients-palette-panel.js +1 -4
  541. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  542. package/build-module/components/global-styles/header.js +2 -4
  543. package/build-module/components/global-styles/header.js.map +1 -1
  544. package/build-module/components/global-styles/hooks.js +26 -7
  545. package/build-module/components/global-styles/hooks.js.map +1 -1
  546. package/build-module/components/global-styles/icon-with-current-color.js +1 -2
  547. package/build-module/components/global-styles/icon-with-current-color.js.map +1 -1
  548. package/build-module/components/global-styles/index.js.map +1 -1
  549. package/build-module/components/global-styles/navigation-button.js +3 -7
  550. package/build-module/components/global-styles/navigation-button.js.map +1 -1
  551. package/build-module/components/global-styles/palette.js +3 -5
  552. package/build-module/components/global-styles/palette.js.map +1 -1
  553. package/build-module/components/global-styles/preview.js +7 -14
  554. package/build-module/components/global-styles/preview.js.map +1 -1
  555. package/build-module/components/global-styles/root-menu.js +1 -4
  556. package/build-module/components/global-styles/root-menu.js.map +1 -1
  557. package/build-module/components/global-styles/screen-block-list.js +10 -20
  558. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  559. package/build-module/components/global-styles/screen-block.js +28 -38
  560. package/build-module/components/global-styles/screen-block.js.map +1 -1
  561. package/build-module/components/global-styles/screen-color-palette.js +1 -4
  562. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  563. package/build-module/components/global-styles/screen-colors.js +2 -6
  564. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  565. package/build-module/components/global-styles/screen-css.js +1 -5
  566. package/build-module/components/global-styles/screen-css.js.map +1 -1
  567. package/build-module/components/global-styles/screen-layout.js +2 -6
  568. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  569. package/build-module/components/global-styles/screen-revisions/index.js +7 -13
  570. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  571. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +22 -22
  572. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  573. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +12 -16
  574. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  575. package/build-module/components/global-styles/screen-root.js +2 -9
  576. package/build-module/components/global-styles/screen-root.js.map +1 -1
  577. package/build-module/components/global-styles/screen-style-variations.js +6 -9
  578. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  579. package/build-module/components/global-styles/screen-typography-element.js +2 -6
  580. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  581. package/build-module/components/global-styles/screen-typography.js +4 -8
  582. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  583. package/build-module/components/global-styles/style-variations-container.js +5 -15
  584. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  585. package/build-module/components/global-styles/subtitle.js +0 -3
  586. package/build-module/components/global-styles/subtitle.js.map +1 -1
  587. package/build-module/components/global-styles/typography-panel.js +1 -4
  588. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  589. package/build-module/components/global-styles/typography-preview.js +1 -4
  590. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  591. package/build-module/components/global-styles/ui.js +15 -37
  592. package/build-module/components/global-styles/ui.js.map +1 -1
  593. package/build-module/components/global-styles/utils.js +0 -1
  594. package/build-module/components/global-styles/utils.js.map +1 -1
  595. package/build-module/components/global-styles/variations-panel.js +0 -4
  596. package/build-module/components/global-styles/variations-panel.js.map +1 -1
  597. package/build-module/components/global-styles-renderer/index.js +3 -6
  598. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  599. package/build-module/components/header-edit-mode/document-actions/index.js +12 -41
  600. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  601. package/build-module/components/header-edit-mode/index.js +9 -18
  602. package/build-module/components/header-edit-mode/index.js.map +1 -1
  603. package/build-module/components/header-edit-mode/mode-switcher/index.js +4 -7
  604. package/build-module/components/header-edit-mode/mode-switcher/index.js.map +1 -1
  605. package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js +1 -6
  606. package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +1 -1
  607. package/build-module/components/header-edit-mode/more-menu/index.js +2 -6
  608. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  609. package/build-module/components/header-edit-mode/more-menu/site-export.js +1 -6
  610. package/build-module/components/header-edit-mode/more-menu/site-export.js.map +1 -1
  611. package/build-module/components/header-edit-mode/more-menu/welcome-guide-menu-item.js +0 -1
  612. package/build-module/components/header-edit-mode/more-menu/welcome-guide-menu-item.js.map +1 -1
  613. package/build-module/components/header-edit-mode/plugin-more-menu-item/index.js +1 -2
  614. package/build-module/components/header-edit-mode/plugin-more-menu-item/index.js.map +1 -1
  615. package/build-module/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js +3 -2
  616. package/build-module/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js.map +1 -1
  617. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +0 -3
  618. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -1
  619. package/build-module/components/header-edit-mode/undo-redo/redo.js +4 -5
  620. package/build-module/components/header-edit-mode/undo-redo/redo.js.map +1 -1
  621. package/build-module/components/header-edit-mode/undo-redo/undo.js +4 -5
  622. package/build-module/components/header-edit-mode/undo-redo/undo.js.map +1 -1
  623. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  624. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -4
  625. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  626. package/build-module/components/keyboard-shortcut-help-modal/index.js +5 -15
  627. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  628. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -4
  629. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  630. package/build-module/components/keyboard-shortcuts/edit-mode.js +3 -13
  631. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  632. package/build-module/components/keyboard-shortcuts/global.js +1 -6
  633. package/build-module/components/keyboard-shortcuts/global.js.map +1 -1
  634. package/build-module/components/keyboard-shortcuts/register.js +0 -2
  635. package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
  636. package/build-module/components/layout/hooks.js +2 -4
  637. package/build-module/components/layout/hooks.js.map +1 -1
  638. package/build-module/components/layout/index.js +19 -20
  639. package/build-module/components/layout/index.js.map +1 -1
  640. package/build-module/components/list/added-by.js +12 -15
  641. package/build-module/components/list/added-by.js.map +1 -1
  642. package/build-module/components/list/header.js +1 -4
  643. package/build-module/components/list/header.js.map +1 -1
  644. package/build-module/components/list/index.js +8 -6
  645. package/build-module/components/list/index.js.map +1 -1
  646. package/build-module/components/list/table.js +5 -7
  647. package/build-module/components/list/table.js.map +1 -1
  648. package/build-module/components/list/use-register-shortcuts.js +1 -0
  649. package/build-module/components/list/use-register-shortcuts.js.map +1 -1
  650. package/build-module/components/page/header.js +1 -1
  651. package/build-module/components/page/header.js.map +1 -1
  652. package/build-module/components/page/index.js +2 -3
  653. package/build-module/components/page/index.js.map +1 -1
  654. package/build-module/components/page-actions/index.js +1 -2
  655. package/build-module/components/page-actions/index.js.map +1 -1
  656. package/build-module/components/page-actions/trash-page-menu-item.js +3 -6
  657. package/build-module/components/page-actions/trash-page-menu-item.js.map +1 -1
  658. package/build-module/components/page-content-focus-manager/back-to-page-notification.js +3 -4
  659. package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
  660. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +6 -9
  661. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  662. package/build-module/components/page-content-focus-manager/edit-template-notification.js +2 -12
  663. package/build-module/components/page-content-focus-manager/edit-template-notification.js.map +1 -1
  664. package/build-module/components/page-content-focus-manager/index.js +1 -2
  665. package/build-module/components/page-content-focus-manager/index.js.map +1 -1
  666. package/build-module/components/page-main/index.js +1 -4
  667. package/build-module/components/page-main/index.js.map +1 -1
  668. package/build-module/components/page-patterns/duplicate-menu-item.js +22 -40
  669. package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -1
  670. package/build-module/components/page-patterns/grid-item.js +13 -18
  671. package/build-module/components/page-patterns/grid-item.js.map +1 -1
  672. package/build-module/components/page-patterns/grid.js +0 -2
  673. package/build-module/components/page-patterns/grid.js.map +1 -1
  674. package/build-module/components/page-patterns/header.js +1 -4
  675. package/build-module/components/page-patterns/header.js.map +1 -1
  676. package/build-module/components/page-patterns/index.js +6 -5
  677. package/build-module/components/page-patterns/index.js.map +1 -1
  678. package/build-module/components/page-patterns/no-patterns.js +0 -1
  679. package/build-module/components/page-patterns/no-patterns.js.map +1 -1
  680. package/build-module/components/page-patterns/pagination.js +6 -4
  681. package/build-module/components/page-patterns/pagination.js.map +1 -1
  682. package/build-module/components/page-patterns/patterns-list.js +1 -7
  683. package/build-module/components/page-patterns/patterns-list.js.map +1 -1
  684. package/build-module/components/page-patterns/rename-menu-item.js +5 -8
  685. package/build-module/components/page-patterns/rename-menu-item.js.map +1 -1
  686. package/build-module/components/page-patterns/search-items.js +28 -32
  687. package/build-module/components/page-patterns/search-items.js.map +1 -1
  688. package/build-module/components/page-patterns/use-pattern-settings.js +5 -4
  689. package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -1
  690. package/build-module/components/page-patterns/use-patterns.js +15 -24
  691. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  692. package/build-module/components/page-patterns/utils.js.map +1 -1
  693. package/build-module/components/page-template-parts/add-new-template-part.js +1 -4
  694. package/build-module/components/page-template-parts/add-new-template-part.js.map +1 -1
  695. package/build-module/components/page-template-parts/index.js +1 -2
  696. package/build-module/components/page-template-parts/index.js.map +1 -1
  697. package/build-module/components/page-templates/index.js +1 -2
  698. package/build-module/components/page-templates/index.js.map +1 -1
  699. package/build-module/components/plugin-template-setting-panel/index.js +1 -1
  700. package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
  701. package/build-module/components/preferences-modal/enable-feature.js +0 -3
  702. package/build-module/components/preferences-modal/enable-feature.js.map +1 -1
  703. package/build-module/components/preferences-modal/index.js +1 -8
  704. package/build-module/components/preferences-modal/index.js.map +1 -1
  705. package/build-module/components/resizable-frame/index.js +27 -38
  706. package/build-module/components/resizable-frame/index.js.map +1 -1
  707. package/build-module/components/revisions/index.js +5 -7
  708. package/build-module/components/revisions/index.js.map +1 -1
  709. package/build-module/components/routes/link.js +3 -8
  710. package/build-module/components/routes/link.js.map +1 -1
  711. package/build-module/components/routes/use-title.js +5 -7
  712. package/build-module/components/routes/use-title.js.map +1 -1
  713. package/build-module/components/save-button/index.js +3 -13
  714. package/build-module/components/save-button/index.js.map +1 -1
  715. package/build-module/components/save-hub/index.js +7 -16
  716. package/build-module/components/save-hub/index.js.map +1 -1
  717. package/build-module/components/save-panel/index.js +7 -17
  718. package/build-module/components/save-panel/index.js.map +1 -1
  719. package/build-module/components/secondary-sidebar/inserter-sidebar.js +1 -2
  720. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  721. package/build-module/components/secondary-sidebar/list-view-sidebar.js +21 -19
  722. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  723. package/build-module/components/sidebar/index.js +1 -5
  724. package/build-module/components/sidebar/index.js.map +1 -1
  725. package/build-module/components/sidebar-button/index.js +3 -3
  726. package/build-module/components/sidebar-button/index.js.map +1 -1
  727. package/build-module/components/sidebar-edit-mode/constants.js.map +1 -1
  728. package/build-module/components/sidebar-edit-mode/default-sidebar.js +2 -2
  729. package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
  730. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +1 -6
  731. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  732. package/build-module/components/sidebar-edit-mode/index.js +1 -7
  733. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  734. package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +11 -13
  735. package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
  736. package/build-module/components/sidebar-edit-mode/page-panels/index.js +3 -5
  737. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  738. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +1 -2
  739. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  740. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +2 -11
  741. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
  742. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +0 -2
  743. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  744. package/build-module/components/sidebar-edit-mode/page-panels/publish-date.js +2 -7
  745. package/build-module/components/sidebar-edit-mode/page-panels/publish-date.js.map +1 -1
  746. package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +2 -3
  747. package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
  748. package/build-module/components/sidebar-edit-mode/settings-header/index.js +15 -17
  749. package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  750. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +1 -2
  751. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -1
  752. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +1 -2
  753. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
  754. package/build-module/components/sidebar-edit-mode/template-panel/index.js +1 -7
  755. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  756. package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js +2 -11
  757. package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -1
  758. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js +1 -4
  759. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -1
  760. package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js +1 -10
  761. package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js.map +1 -1
  762. package/build-module/components/sidebar-navigation-item/index.js +1 -2
  763. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  764. package/build-module/components/sidebar-navigation-screen/index.js +3 -7
  765. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  766. package/build-module/components/sidebar-navigation-screen-details-footer/index.js +2 -4
  767. package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  768. package/build-module/components/sidebar-navigation-screen-details-panel/index.js +1 -4
  769. package/build-module/components/sidebar-navigation-screen-details-panel/index.js.map +1 -1
  770. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -1
  771. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +1 -1
  772. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +1 -2
  773. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
  774. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -1
  775. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +1 -1
  776. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +19 -30
  777. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  778. package/build-module/components/sidebar-navigation-screen-main/index.js +3 -3
  779. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  780. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +0 -4
  781. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -1
  782. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +1 -2
  783. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  784. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +2 -2
  785. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
  786. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +2 -3
  787. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
  788. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +5 -13
  789. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  790. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +5 -9
  791. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  792. package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -7
  793. package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
  794. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -6
  795. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  796. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -2
  797. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  798. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +11 -28
  799. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  800. package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +4 -4
  801. package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -1
  802. package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
  803. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +16 -20
  804. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  805. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +5 -9
  806. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  807. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +6 -6
  808. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  809. package/build-module/components/sidebar-navigation-screen-page/index.js +6 -6
  810. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
  811. package/build-module/components/sidebar-navigation-screen-page/page-details.js +11 -22
  812. package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
  813. package/build-module/components/sidebar-navigation-screen-page/status-label.js +3 -13
  814. package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  815. package/build-module/components/sidebar-navigation-screen-pages/index.js +6 -17
  816. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  817. package/build-module/components/sidebar-navigation-screen-pattern/index.js +11 -12
  818. package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  819. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +1 -2
  820. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +1 -1
  821. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +0 -2
  822. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js.map +1 -1
  823. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -2
  824. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  825. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +4 -5
  826. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  827. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +7 -19
  828. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
  829. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +8 -18
  830. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  831. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +2 -4
  832. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  833. package/build-module/components/sidebar-navigation-screen-patterns/index.js +4 -7
  834. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  835. package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js +1 -2
  836. package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -1
  837. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +0 -1
  838. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
  839. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +11 -7
  840. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  841. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +5 -5
  842. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  843. package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -2
  844. package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
  845. package/build-module/components/sidebar-navigation-screen-template/home-template-details.js +7 -18
  846. package/build-module/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
  847. package/build-module/components/sidebar-navigation-screen-template/index.js +0 -6
  848. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  849. package/build-module/components/sidebar-navigation-screen-templates/index.js +4 -6
  850. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  851. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +1 -2
  852. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  853. package/build-module/components/site-hub/index.js +5 -7
  854. package/build-module/components/site-hub/index.js.map +1 -1
  855. package/build-module/components/site-icon/index.js +1 -6
  856. package/build-module/components/site-icon/index.js.map +1 -1
  857. package/build-module/components/start-template-options/index.js +3 -14
  858. package/build-module/components/start-template-options/index.js.map +1 -1
  859. package/build-module/components/style-book/index.js +24 -24
  860. package/build-module/components/style-book/index.js.map +1 -1
  861. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -15
  862. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  863. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +5 -7
  864. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  865. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +9 -14
  866. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  867. package/build-module/components/table/index.js.map +1 -1
  868. package/build-module/components/template-actions/index.js +2 -9
  869. package/build-module/components/template-actions/index.js.map +1 -1
  870. package/build-module/components/template-actions/rename-menu-item.js +6 -8
  871. package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
  872. package/build-module/components/template-part-converter/convert-to-regular.js +0 -3
  873. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  874. package/build-module/components/template-part-converter/convert-to-template-part.js +4 -5
  875. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  876. package/build-module/components/template-part-converter/index.js +3 -5
  877. package/build-module/components/template-part-converter/index.js.map +1 -1
  878. package/build-module/components/use-edited-entity-record/index.js +2 -7
  879. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  880. package/build-module/components/welcome-guide/editor.js +1 -4
  881. package/build-module/components/welcome-guide/editor.js.map +1 -1
  882. package/build-module/components/welcome-guide/image.js.map +1 -1
  883. package/build-module/components/welcome-guide/index.js +0 -1
  884. package/build-module/components/welcome-guide/index.js.map +1 -1
  885. package/build-module/components/welcome-guide/page.js +1 -5
  886. package/build-module/components/welcome-guide/page.js.map +1 -1
  887. package/build-module/components/welcome-guide/styles.js +1 -5
  888. package/build-module/components/welcome-guide/styles.js.map +1 -1
  889. package/build-module/components/welcome-guide/template.js +1 -5
  890. package/build-module/components/welcome-guide/template.js.map +1 -1
  891. package/build-module/hooks/commands/use-common-commands.js +133 -108
  892. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  893. package/build-module/hooks/commands/use-edit-mode-commands.js +69 -49
  894. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  895. package/build-module/hooks/components.js.map +1 -1
  896. package/build-module/hooks/index.js.map +1 -1
  897. package/build-module/hooks/navigation-menu-edit.js +11 -14
  898. package/build-module/hooks/navigation-menu-edit.js.map +1 -1
  899. package/build-module/hooks/push-changes-to-global-styles/index.js +162 -61
  900. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  901. package/build-module/hooks/template-part-edit.js +7 -9
  902. package/build-module/hooks/template-part-edit.js.map +1 -1
  903. package/build-module/index.js +10 -15
  904. package/build-module/index.js.map +1 -1
  905. package/build-module/lock-unlock.js.map +1 -1
  906. package/build-module/store/actions.js +35 -53
  907. package/build-module/store/actions.js.map +1 -1
  908. package/build-module/store/constants.js.map +1 -1
  909. package/build-module/store/index.js +1 -1
  910. package/build-module/store/index.js.map +1 -1
  911. package/build-module/store/private-actions.js +6 -8
  912. package/build-module/store/private-actions.js.map +1 -1
  913. package/build-module/store/private-selectors.js +1 -1
  914. package/build-module/store/private-selectors.js.map +1 -1
  915. package/build-module/store/reducer.js +13 -29
  916. package/build-module/store/reducer.js.map +1 -1
  917. package/build-module/store/selectors.js +26 -31
  918. package/build-module/store/selectors.js.map +1 -1
  919. package/build-module/store/utils.js +13 -13
  920. package/build-module/store/utils.js.map +1 -1
  921. package/build-module/utils/get-is-list-page.js +2 -1
  922. package/build-module/utils/get-is-list-page.js.map +1 -1
  923. package/build-module/utils/is-previewing-theme.js +0 -1
  924. package/build-module/utils/is-previewing-theme.js.map +1 -1
  925. package/build-module/utils/is-template-removable.js +0 -1
  926. package/build-module/utils/is-template-removable.js.map +1 -1
  927. package/build-module/utils/is-template-revertable.js +0 -2
  928. package/build-module/utils/is-template-revertable.js.map +1 -1
  929. package/build-module/utils/template-part-create.js +3 -7
  930. package/build-module/utils/template-part-create.js.map +1 -1
  931. package/build-module/utils/use-activate-theme.js +2 -2
  932. package/build-module/utils/use-activate-theme.js.map +1 -1
  933. package/build-module/utils/use-debounced-input.js.map +1 -1
  934. package/build-style/style-rtl.css +37 -27
  935. package/build-style/style.css +37 -27
  936. package/package.json +41 -40
  937. package/src/components/add-new-pattern/index.js +4 -3
  938. package/src/components/block-editor/index.js +4 -3
  939. package/src/components/block-editor/providers/navigation-block-editor-provider.js +2 -3
  940. package/src/components/canvas-spinner/index.js +21 -3
  941. package/src/components/canvas-spinner/style.scss +5 -2
  942. package/src/components/editor/index.js +15 -1
  943. package/src/components/global-styles/block-preview-panel.js +26 -15
  944. package/src/components/global-styles/hooks.js +27 -1
  945. package/src/components/global-styles/preview.js +3 -13
  946. package/src/components/global-styles/screen-colors.js +0 -4
  947. package/src/components/global-styles/screen-layout.js +0 -2
  948. package/src/components/global-styles/screen-revisions/index.js +6 -4
  949. package/src/components/global-styles/screen-revisions/revisions-buttons.js +46 -21
  950. package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +10 -0
  951. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +6 -0
  952. package/src/components/global-styles/screen-typography.js +0 -4
  953. package/src/components/global-styles/ui.js +1 -1
  954. package/src/components/header-edit-mode/document-actions/index.js +13 -26
  955. package/src/components/header-edit-mode/document-actions/style.scss +17 -4
  956. package/src/components/header-edit-mode/index.js +1 -1
  957. package/src/components/header-edit-mode/style.scss +0 -9
  958. package/src/components/layout/index.js +5 -2
  959. package/src/components/page-actions/trash-page-menu-item.js +5 -1
  960. package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +1 -4
  961. package/src/components/page-patterns/duplicate-menu-item.js +18 -39
  962. package/src/components/page-patterns/use-patterns.js +9 -3
  963. package/src/components/sidebar-edit-mode/default-sidebar.js +1 -0
  964. package/src/components/sidebar-edit-mode/page-panels/edit-template.js +13 -5
  965. package/src/components/sidebar-navigation-screen-global-styles/index.js +1 -1
  966. package/src/components/sidebar-navigation-screen-navigation-menu/index.js +3 -4
  967. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -1
  968. package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +11 -10
  969. package/src/components/sidebar-navigation-screen-page/index.js +3 -3
  970. package/src/components/sidebar-navigation-screen-pages/index.js +1 -1
  971. package/src/components/sidebar-navigation-screen-pattern/index.js +2 -5
  972. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +0 -3
  973. package/src/components/sidebar-navigation-screen-patterns/index.js +1 -1
  974. package/src/components/sidebar-navigation-screen-template/home-template-details.js +4 -2
  975. package/src/components/sidebar-navigation-screen-templates/index.js +1 -1
  976. package/src/components/site-hub/index.js +1 -1
  977. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -8
  978. package/src/components/template-actions/index.js +1 -5
  979. package/src/components/use-edited-entity-record/index.js +1 -6
  980. package/src/hooks/commands/use-common-commands.js +153 -72
  981. package/src/hooks/commands/use-edit-mode-commands.js +61 -19
  982. package/src/hooks/navigation-menu-edit.js +1 -5
  983. package/src/hooks/push-changes-to-global-styles/index.js +163 -28
  984. package/src/style.scss +0 -1
  985. package/build/components/create-pattern-modal/index.js +0 -129
  986. package/build/components/create-pattern-modal/index.js.map +0 -1
  987. package/build/utils/normalize-record-key.js +0 -19
  988. package/build/utils/normalize-record-key.js.map +0 -1
  989. package/build-module/components/create-pattern-modal/index.js +0 -116
  990. package/build-module/components/create-pattern-modal/index.js.map +0 -1
  991. package/build-module/utils/normalize-record-key.js +0 -12
  992. package/build-module/utils/normalize-record-key.js.map +0 -1
  993. package/src/components/create-pattern-modal/index.js +0 -136
  994. package/src/components/create-pattern-modal/style.scss +0 -3
  995. package/src/utils/normalize-record-key.js +0 -11
  996. /package/src/components/global-styles/stories/{index.js → index.story.js} +0 -0
@@ -8,6 +8,7 @@ import { decodeEntities } from '@wordpress/html-entities';
8
8
  import { useMemo, useCallback } from '@wordpress/element';
9
9
  import { __, sprintf } from '@wordpress/i18n';
10
10
  import { blockMeta, post, archive } from '@wordpress/icons';
11
+
11
12
  /**
12
13
  * @typedef IHasNameAndId
13
14
  * @property {string|number} id The entity's id.
@@ -21,6 +22,7 @@ const getValueFromObjectPath = (object, path) => {
21
22
  });
22
23
  return value;
23
24
  };
25
+
24
26
  /**
25
27
  * Helper util to map records to add a `name` prop from a
26
28
  * provided path, in order to handle all entities in the same
@@ -30,13 +32,13 @@ const getValueFromObjectPath = (object, path) => {
30
32
  * @param {string} path The path to map a `name` property from the entity.
31
33
  * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.
32
34
  */
33
-
34
-
35
35
  export const mapToIHasNameAndId = (entities, path) => {
36
- return (entities || []).map(entity => ({ ...entity,
36
+ return (entities || []).map(entity => ({
37
+ ...entity,
37
38
  name: decodeEntities(getValueFromObjectPath(entity, path))
38
39
  }));
39
40
  };
41
+
40
42
  /**
41
43
  * @typedef {Object} EntitiesInfo
42
44
  * @property {boolean} hasEntities If an entity has available records(posts, terms, etc..).
@@ -51,7 +53,6 @@ export const useExistingTemplates = () => {
51
53
  export const useDefaultTemplateTypes = () => {
52
54
  return useSelect(select => select(editorStore).__experimentalGetDefaultTemplateTypes(), []);
53
55
  };
54
-
55
56
  const usePublicPostTypes = () => {
56
57
  const postTypes = useSelect(select => select(coreStore).getPostTypes({
57
58
  per_page: -1
@@ -64,7 +65,6 @@ const usePublicPostTypes = () => {
64
65
  }) => viewable && !excludedPostTypes.includes(slug));
65
66
  }, [postTypes]);
66
67
  };
67
-
68
68
  const usePublicTaxonomies = () => {
69
69
  const taxonomies = useSelect(select => select(coreStore).getTaxonomies({
70
70
  per_page: -1
@@ -75,7 +75,6 @@ const usePublicTaxonomies = () => {
75
75
  }) => visibility?.publicly_queryable);
76
76
  }, [taxonomies]);
77
77
  };
78
-
79
78
  function usePostTypeNeedsUniqueIdentifier(publicPostTypes) {
80
79
  const postTypeLabels = useMemo(() => publicPostTypes?.reduce((accumulator, {
81
80
  labels
@@ -92,7 +91,6 @@ function usePostTypeNeedsUniqueIdentifier(publicPostTypes) {
92
91
  return postTypeLabels[singularName] > 1 && singularName !== slug;
93
92
  }, [postTypeLabels]);
94
93
  }
95
-
96
94
  export function usePostTypeArchiveMenuItems() {
97
95
  const publicPostTypes = usePublicPostTypes();
98
96
  const postTypesWithArchives = useMemo(() => publicPostTypes?.filter(postType => postType.has_archive), [publicPostTypes]);
@@ -100,18 +98,19 @@ export function usePostTypeArchiveMenuItems() {
100
98
  const needsUniqueIdentifier = usePostTypeNeedsUniqueIdentifier(postTypesWithArchives);
101
99
  return useMemo(() => postTypesWithArchives?.filter(postType => !(existingTemplates || []).some(existingTemplate => existingTemplate.slug === 'archive-' + postType.slug)).map(postType => {
102
100
  let title;
103
-
104
101
  if (needsUniqueIdentifier(postType)) {
105
- title = sprintf( // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book".
102
+ title = sprintf(
103
+ // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book".
106
104
  __('Archive: %1$s (%2$s)'), postType.labels.singular_name, postType.slug);
107
105
  } else {
108
- title = sprintf( // translators: %s: Name of the post type e.g: "Post".
106
+ title = sprintf(
107
+ // translators: %s: Name of the post type e.g: "Post".
109
108
  __('Archive: %s'), postType.labels.singular_name);
110
109
  }
111
-
112
110
  return {
113
111
  slug: 'archive-' + postType.slug,
114
- description: sprintf( // translators: %s: Name of the post type e.g: "Post".
112
+ description: sprintf(
113
+ // translators: %s: Name of the post type e.g: "Post".
115
114
  __('Displays an archive with the latest posts of type: %s.'), postType.labels.singular_name),
116
115
  title,
117
116
  // `icon` is the `menu_icon` property of a post type. We
@@ -126,17 +125,15 @@ export const usePostTypeMenuItems = onClickMenuItem => {
126
125
  const publicPostTypes = usePublicPostTypes();
127
126
  const existingTemplates = useExistingTemplates();
128
127
  const defaultTemplateTypes = useDefaultTemplateTypes();
129
- const needsUniqueIdentifier = usePostTypeNeedsUniqueIdentifier(publicPostTypes); // `page`is a special case in template hierarchy.
130
-
128
+ const needsUniqueIdentifier = usePostTypeNeedsUniqueIdentifier(publicPostTypes);
129
+ // `page`is a special case in template hierarchy.
131
130
  const templatePrefixes = useMemo(() => publicPostTypes?.reduce((accumulator, {
132
131
  slug
133
132
  }) => {
134
133
  let suffix = slug;
135
-
136
134
  if (slug !== 'page') {
137
135
  suffix = `single-${suffix}`;
138
136
  }
139
-
140
137
  accumulator[slug] = suffix;
141
138
  return accumulator;
142
139
  }, {}), [publicPostTypes]);
@@ -149,32 +146,32 @@ export const usePostTypeMenuItems = onClickMenuItem => {
149
146
  slug,
150
147
  labels,
151
148
  icon
152
- } = postType; // We need to check if the general template is part of the
149
+ } = postType;
150
+ // We need to check if the general template is part of the
153
151
  // defaultTemplateTypes. If it is, just use that info and
154
152
  // augment it with the specific template functionality.
155
-
156
153
  const generalTemplateSlug = templatePrefixes[slug];
157
154
  const defaultTemplateType = defaultTemplateTypes?.find(({
158
155
  slug: _slug
159
156
  }) => _slug === generalTemplateSlug);
160
157
  const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug);
161
-
162
158
  const _needsUniqueIdentifier = needsUniqueIdentifier(postType);
163
-
164
- let menuItemTitle = sprintf( // translators: %s: Name of the post type e.g: "Post".
159
+ let menuItemTitle = sprintf(
160
+ // translators: %s: Name of the post type e.g: "Post".
165
161
  __('Single item: %s'), labels.singular_name);
166
-
167
162
  if (_needsUniqueIdentifier) {
168
- menuItemTitle = sprintf( // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book".
163
+ menuItemTitle = sprintf(
164
+ // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book".
169
165
  __('Single item: %1$s (%2$s)'), labels.singular_name, slug);
170
166
  }
171
-
172
- const menuItem = defaultTemplateType ? { ...defaultTemplateType,
167
+ const menuItem = defaultTemplateType ? {
168
+ ...defaultTemplateType,
173
169
  templatePrefix: templatePrefixes[slug]
174
170
  } : {
175
171
  slug: generalTemplateSlug,
176
172
  title: menuItemTitle,
177
- description: sprintf( // translators: %s: Name of the post type e.g: "Post".
173
+ description: sprintf(
174
+ // translators: %s: Name of the post type e.g: "Post".
178
175
  __('Displays a single item: %s.'), labels.singular_name),
179
176
  // `icon` is the `menu_icon` property of a post type. We
180
177
  // only handle `dashicons` for now, even if the `menu_icon`
@@ -182,8 +179,8 @@ export const usePostTypeMenuItems = onClickMenuItem => {
182
179
  icon: icon?.startsWith('dashicons-') ? icon.slice(10) : post,
183
180
  templatePrefix: templatePrefixes[slug]
184
181
  };
185
- const hasEntities = postTypesInfo?.[slug]?.hasEntities; // We have a different template creation flow only if they have entities.
186
-
182
+ const hasEntities = postTypesInfo?.[slug]?.hasEntities;
183
+ // We have a different template creation flow only if they have entities.
187
184
  if (hasEntities) {
188
185
  menuItem.onClick = template => {
189
186
  onClickMenuItem({
@@ -214,28 +211,24 @@ export const usePostTypeMenuItems = onClickMenuItem => {
214
211
  template
215
212
  });
216
213
  };
217
- } // We don't need to add the menu item if there are no
214
+ }
215
+ // We don't need to add the menu item if there are no
218
216
  // entities and the general template exists.
219
-
220
-
221
217
  if (!hasGeneralTemplate || hasEntities) {
222
218
  accumulator.push(menuItem);
223
219
  }
224
-
225
220
  return accumulator;
226
- }, []); // Split menu items into two groups: one for the default post types
221
+ }, []);
222
+ // Split menu items into two groups: one for the default post types
227
223
  // and one for the rest.
228
-
229
224
  const postTypesMenuItems = useMemo(() => menuItems.reduce((accumulator, postType) => {
230
225
  const {
231
226
  slug
232
227
  } = postType;
233
228
  let key = 'postTypesMenuItems';
234
-
235
229
  if (slug === 'page') {
236
230
  key = 'defaultPostTypesMenuItems';
237
231
  }
238
-
239
232
  accumulator[key].push(postType);
240
233
  return accumulator;
241
234
  }, {
@@ -247,26 +240,23 @@ export const usePostTypeMenuItems = onClickMenuItem => {
247
240
  export const useTaxonomiesMenuItems = onClickMenuItem => {
248
241
  const publicTaxonomies = usePublicTaxonomies();
249
242
  const existingTemplates = useExistingTemplates();
250
- const defaultTemplateTypes = useDefaultTemplateTypes(); // `category` and `post_tag` are special cases in template hierarchy.
251
-
243
+ const defaultTemplateTypes = useDefaultTemplateTypes();
244
+ // `category` and `post_tag` are special cases in template hierarchy.
252
245
  const templatePrefixes = useMemo(() => publicTaxonomies?.reduce((accumulator, {
253
246
  slug
254
247
  }) => {
255
248
  let suffix = slug;
256
-
257
249
  if (!['category', 'post_tag'].includes(slug)) {
258
250
  suffix = `taxonomy-${suffix}`;
259
251
  }
260
-
261
252
  if (slug === 'post_tag') {
262
253
  suffix = `tag`;
263
254
  }
264
-
265
255
  accumulator[slug] = suffix;
266
256
  return accumulator;
267
- }, {}), [publicTaxonomies]); // We need to keep track of naming conflicts. If a conflict
257
+ }, {}), [publicTaxonomies]);
258
+ // We need to keep track of naming conflicts. If a conflict
268
259
  // occurs, we need to add slug.
269
-
270
260
  const taxonomyLabels = publicTaxonomies?.reduce((accumulator, {
271
261
  labels
272
262
  }) => {
@@ -274,16 +264,13 @@ export const useTaxonomiesMenuItems = onClickMenuItem => {
274
264
  accumulator[singularName] = (accumulator[singularName] || 0) + 1;
275
265
  return accumulator;
276
266
  }, {});
277
-
278
267
  const needsUniqueIdentifier = (labels, slug) => {
279
268
  if (['category', 'post_tag'].includes(slug)) {
280
269
  return false;
281
270
  }
282
-
283
271
  const singularName = labels.singular_name.toLowerCase();
284
272
  return taxonomyLabels[singularName] > 1 && singularName !== slug;
285
273
  };
286
-
287
274
  const taxonomiesInfo = useEntitiesInfo('taxonomy', templatePrefixes);
288
275
  const existingTemplateSlugs = (existingTemplates || []).map(({
289
276
  slug
@@ -292,37 +279,36 @@ export const useTaxonomiesMenuItems = onClickMenuItem => {
292
279
  const {
293
280
  slug,
294
281
  labels
295
- } = taxonomy; // We need to check if the general template is part of the
282
+ } = taxonomy;
283
+ // We need to check if the general template is part of the
296
284
  // defaultTemplateTypes. If it is, just use that info and
297
285
  // augment it with the specific template functionality.
298
-
299
286
  const generalTemplateSlug = templatePrefixes[slug];
300
287
  const defaultTemplateType = defaultTemplateTypes?.find(({
301
288
  slug: _slug
302
289
  }) => _slug === generalTemplateSlug);
303
290
  const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug);
304
-
305
291
  const _needsUniqueIdentifier = needsUniqueIdentifier(labels, slug);
306
-
307
292
  let menuItemTitle = labels.singular_name;
308
-
309
293
  if (_needsUniqueIdentifier) {
310
- menuItemTitle = sprintf( // translators: %1s: Name of the taxonomy e.g: "Category"; %2s: Slug of the taxonomy e.g: "product_cat".
294
+ menuItemTitle = sprintf(
295
+ // translators: %1s: Name of the taxonomy e.g: "Category"; %2s: Slug of the taxonomy e.g: "product_cat".
311
296
  __('%1$s (%2$s)'), labels.singular_name, slug);
312
297
  }
313
-
314
- const menuItem = defaultTemplateType ? { ...defaultTemplateType,
298
+ const menuItem = defaultTemplateType ? {
299
+ ...defaultTemplateType,
315
300
  templatePrefix: templatePrefixes[slug]
316
301
  } : {
317
302
  slug: generalTemplateSlug,
318
303
  title: menuItemTitle,
319
- description: sprintf( // translators: %s: Name of the taxonomy e.g: "Product Categories".
304
+ description: sprintf(
305
+ // translators: %s: Name of the taxonomy e.g: "Product Categories".
320
306
  __('Displays taxonomy: %s.'), labels.singular_name),
321
307
  icon: blockMeta,
322
308
  templatePrefix: templatePrefixes[slug]
323
309
  };
324
- const hasEntities = taxonomiesInfo?.[slug]?.hasEntities; // We have a different template creation flow only if they have entities.
325
-
310
+ const hasEntities = taxonomiesInfo?.[slug]?.hasEntities;
311
+ // We have a different template creation flow only if they have entities.
326
312
  if (hasEntities) {
327
313
  menuItem.onClick = template => {
328
314
  onClickMenuItem({
@@ -352,28 +338,24 @@ export const useTaxonomiesMenuItems = onClickMenuItem => {
352
338
  template
353
339
  });
354
340
  };
355
- } // We don't need to add the menu item if there are no
341
+ }
342
+ // We don't need to add the menu item if there are no
356
343
  // entities and the general template exists.
357
-
358
-
359
344
  if (!hasGeneralTemplate || hasEntities) {
360
345
  accumulator.push(menuItem);
361
346
  }
362
-
363
347
  return accumulator;
364
- }, []); // Split menu items into two groups: one for the default taxonomies
348
+ }, []);
349
+ // Split menu items into two groups: one for the default taxonomies
365
350
  // and one for the rest.
366
-
367
351
  const taxonomiesMenuItems = useMemo(() => menuItems.reduce((accumulator, taxonomy) => {
368
352
  const {
369
353
  slug
370
354
  } = taxonomy;
371
355
  let key = 'taxonomiesMenuItems';
372
-
373
356
  if (['category', 'tag'].includes(slug)) {
374
357
  key = 'defaultTaxonomiesMenuItems';
375
358
  }
376
-
377
359
  accumulator[key].push(taxonomy);
378
360
  return accumulator;
379
361
  }, {
@@ -397,7 +379,6 @@ export function useAuthorMenuItem(onClickMenuItem) {
397
379
  let authorMenuItem = defaultTemplateTypes?.find(({
398
380
  slug
399
381
  }) => slug === 'author');
400
-
401
382
  if (!authorMenuItem) {
402
383
  authorMenuItem = {
403
384
  description: __('Displays latest posts written by a single author.'),
@@ -405,16 +386,14 @@ export function useAuthorMenuItem(onClickMenuItem) {
405
386
  title: 'Author'
406
387
  };
407
388
  }
408
-
409
389
  const hasGeneralTemplate = !!existingTemplates?.find(({
410
390
  slug
411
391
  }) => slug === 'author');
412
-
413
392
  if (authorInfo.user?.hasEntities) {
414
- authorMenuItem = { ...authorMenuItem,
393
+ authorMenuItem = {
394
+ ...authorMenuItem,
415
395
  templatePrefix: 'author'
416
396
  };
417
-
418
397
  authorMenuItem.onClick = template => {
419
398
  onClickMenuItem({
420
399
  type: 'root',
@@ -450,11 +429,11 @@ export function useAuthorMenuItem(onClickMenuItem) {
450
429
  });
451
430
  };
452
431
  }
453
-
454
432
  if (!hasGeneralTemplate || authorInfo.user?.hasEntities) {
455
433
  return authorMenuItem;
456
434
  }
457
435
  }
436
+
458
437
  /**
459
438
  * Helper hook that filters all the existing templates by the given
460
439
  * object with the entity's slug as key and the template prefix as value.
@@ -469,30 +448,26 @@ export function useAuthorMenuItem(onClickMenuItem) {
469
448
  * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.
470
449
  * @return {Record<string,string[]>} An object with the entity's slug as key and an array with the existing template slugs as value.
471
450
  */
472
-
473
451
  const useExistingTemplateSlugs = templatePrefixes => {
474
452
  const existingTemplates = useExistingTemplates();
475
453
  const existingSlugs = useMemo(() => {
476
454
  return Object.entries(templatePrefixes || {}).reduce((accumulator, [slug, prefix]) => {
477
455
  const slugsWithTemplates = (existingTemplates || []).reduce((_accumulator, existingTemplate) => {
478
456
  const _prefix = `${prefix}-`;
479
-
480
457
  if (existingTemplate.slug.startsWith(_prefix)) {
481
458
  _accumulator.push(existingTemplate.slug.substring(_prefix.length));
482
459
  }
483
-
484
460
  return _accumulator;
485
461
  }, []);
486
-
487
462
  if (slugsWithTemplates.length) {
488
463
  accumulator[slug] = slugsWithTemplates;
489
464
  }
490
-
491
465
  return accumulator;
492
466
  }, {});
493
467
  }, [templatePrefixes, existingTemplates]);
494
468
  return existingSlugs;
495
469
  };
470
+
496
471
  /**
497
472
  * Helper hook that finds the existing records with an associated template,
498
473
  * as they need to be excluded from the template suggestions.
@@ -502,8 +477,6 @@ const useExistingTemplateSlugs = templatePrefixes => {
502
477
  * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.
503
478
  * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the existing records as value.
504
479
  */
505
-
506
-
507
480
  const useTemplatesToExclude = (entityName, templatePrefixes, additionalQueryParameters = {}) => {
508
481
  const slugsToExcludePerEntity = useExistingTemplateSlugs(templatePrefixes);
509
482
  const recordsToExcludePerEntity = useSelect(select => {
@@ -514,16 +487,15 @@ const useTemplatesToExclude = (entityName, templatePrefixes, additionalQueryPara
514
487
  slug: slugsWithTemplates,
515
488
  ...additionalQueryParameters[slug]
516
489
  });
517
-
518
490
  if (entitiesWithTemplates?.length) {
519
491
  accumulator[slug] = entitiesWithTemplates;
520
492
  }
521
-
522
493
  return accumulator;
523
494
  }, {});
524
495
  }, [slugsToExcludePerEntity]);
525
496
  return recordsToExcludePerEntity;
526
497
  };
498
+
527
499
  /**
528
500
  * Helper hook that returns information about an entity having
529
501
  * records that we can create a specific template for.
@@ -539,8 +511,6 @@ const useTemplatesToExclude = (entityName, templatePrefixes, additionalQueryPara
539
511
  * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.
540
512
  * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the EntitiesInfo as value.
541
513
  */
542
-
543
-
544
514
  const useEntitiesInfo = (entityName, templatePrefixes, additionalQueryParameters = {}) => {
545
515
  const recordsToExcludePerEntity = useTemplatesToExclude(entityName, templatePrefixes, additionalQueryParameters);
546
516
  const entitiesInfo = useSelect(select => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/utils.js"],"names":["useSelect","store","coreStore","editorStore","decodeEntities","useMemo","useCallback","__","sprintf","blockMeta","post","archive","getValueFromObjectPath","object","path","value","split","forEach","fieldName","mapToIHasNameAndId","entities","map","entity","name","useExistingTemplates","select","getEntityRecords","per_page","useDefaultTemplateTypes","__experimentalGetDefaultTemplateTypes","usePublicPostTypes","postTypes","getPostTypes","excludedPostTypes","filter","viewable","slug","includes","usePublicTaxonomies","taxonomies","getTaxonomies","visibility","publicly_queryable","usePostTypeNeedsUniqueIdentifier","publicPostTypes","postTypeLabels","reduce","accumulator","labels","singularName","singular_name","toLowerCase","usePostTypeArchiveMenuItems","postTypesWithArchives","postType","has_archive","existingTemplates","needsUniqueIdentifier","some","existingTemplate","title","description","icon","startsWith","slice","templatePrefix","usePostTypeMenuItems","onClickMenuItem","defaultTemplateTypes","templatePrefixes","suffix","postTypesInfo","useEntitiesInfo","existingTemplateSlugs","menuItems","generalTemplateSlug","defaultTemplateType","find","_slug","hasGeneralTemplate","_needsUniqueIdentifier","menuItemTitle","menuItem","hasEntities","onClick","template","type","config","recordNamePath","queryArgs","search","_fields","orderBy","exclude","existingEntitiesIds","getSpecificTemplate","suggestion","templateSlug","push","postTypesMenuItems","key","defaultPostTypesMenuItems","useTaxonomiesMenuItems","publicTaxonomies","taxonomyLabels","taxonomiesInfo","taxonomy","taxonomiesMenuItems","defaultTaxonomiesMenuItems","USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX","user","USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS","who","useAuthorMenuItem","authorInfo","authorMenuItem","search_items","not_found","all_items","useExistingTemplateSlugs","existingSlugs","Object","entries","prefix","slugsWithTemplates","_accumulator","_prefix","substring","length","useTemplatesToExclude","entityName","additionalQueryParameters","slugsToExcludePerEntity","recordsToExcludePerEntity","entitiesWithTemplates","context","entitiesInfo","keys","id"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,mBAArC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,OAAT,EAAkBC,WAAlB,QAAqC,oBAArC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,SAAT,EAAoBC,I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AAM0D,mBAAmB,GACxBuC,yBAAyB,GAAIjG,IAAJ,CAAzB,EAAqCf,GAArC,CACC,CAAE;AAAEqH,QAAAA;AAAF,OAAF,KAAcA,EADf,KAEK,EAHN;AAIA3F,MAAAA,WAAW,CAAEX,IAAF,CAAX,GAAsB;AACrB+C,QAAAA,WAAW,EAAE,CAAC,CAAE1D,MAAM,CAAEvB,SAAF,CAAN,CAAoBwB,gBAApB,CACfwG,UADe,EAEf9F,IAFe,EAGf;AACCT,UAAAA,QAAQ,EAAE,CADX;AAECgE,UAAAA,OAAO,EAAE,IAFV;AAGC4C,UAAAA,OAAO,EAAE,MAHV;AAIC1C,UAAAA,OAAO,EAAEC,mBAJV;AAKC,aAAGqC,yBAAyB,CAAE/F,IAAF;AAL7B,SAHe,GAUb4F,MAXkB;AAYrBlC,QAAAA;AAZqB,OAAtB;AAcA,aAAO/C,WAAP;AACA,KArBK,EAsBN,EAtBM,CAAP;AAwBA,GA1B4B,EA2B7B,CAAEsB,gBAAF,EAAoBgE,yBAApB,CA3B6B,CAA9B;AA6BA,SAAOG,YAAP;AACA,CAxCD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { blockMeta, post, archive } from '@wordpress/icons';\n\n/**\n * @typedef IHasNameAndId\n * @property {string|number} id The entity's id.\n * @property {string} name The entity's name.\n */\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.split( '.' ).forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\n/**\n * Helper util to map records to add a `name` prop from a\n * provided path, in order to handle all entities in the same\n * fashion(implementing`IHasNameAndId` interface).\n *\n * @param {Object[]} entities The array of entities.\n * @param {string} path The path to map a `name` property from the entity.\n * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.\n */\nexport const mapToIHasNameAndId = ( entities, path ) => {\n\treturn ( entities || [] ).map( ( entity ) => ( {\n\t\t...entity,\n\t\tname: decodeEntities( getValueFromObjectPath( entity, path ) ),\n\t} ) );\n};\n\n/**\n * @typedef {Object} EntitiesInfo\n * @property {boolean} hasEntities If an entity has available records(posts, terms, etc..).\n * @property {number[]} existingEntitiesIds An array of the existing entities ids.\n */\n\nexport const useExistingTemplates = () => {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\tper_page: -1,\n\t\t\t} ),\n\t\t[]\n\t);\n};\n\nexport const useDefaultTemplateTypes = () => {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplateTypes(),\n\t\t[]\n\t);\n};\n\nconst usePublicPostTypes = () => {\n\tconst postTypes = useSelect(\n\t\t( select ) => select( coreStore ).getPostTypes( { per_page: -1 } ),\n\t\t[]\n\t);\n\treturn useMemo( () => {\n\t\tconst excludedPostTypes = [ 'attachment' ];\n\t\treturn postTypes?.filter(\n\t\t\t( { viewable, slug } ) =>\n\t\t\t\tviewable && ! excludedPostTypes.includes( slug )\n\t\t);\n\t}, [ postTypes ] );\n};\n\nconst usePublicTaxonomies = () => {\n\tconst taxonomies = useSelect(\n\t\t( select ) => select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t[]\n\t);\n\treturn useMemo( () => {\n\t\treturn taxonomies?.filter(\n\t\t\t( { visibility } ) => visibility?.publicly_queryable\n\t\t);\n\t}, [ taxonomies ] );\n};\n\nfunction usePostTypeNeedsUniqueIdentifier( publicPostTypes ) {\n\tconst postTypeLabels = useMemo( () =>\n\t\tpublicPostTypes?.reduce( ( accumulator, { labels } ) => {\n\t\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\t\taccumulator[ singularName ] =\n\t\t\t\t( accumulator[ singularName ] || 0 ) + 1;\n\t\t\treturn accumulator;\n\t\t}, {} )\n\t);\n\treturn useCallback(\n\t\t( { labels, slug } ) => {\n\t\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\t\treturn postTypeLabels[ singularName ] > 1 && singularName !== slug;\n\t\t},\n\t\t[ postTypeLabels ]\n\t);\n}\n\nexport function usePostTypeArchiveMenuItems() {\n\tconst publicPostTypes = usePublicPostTypes();\n\tconst postTypesWithArchives = useMemo(\n\t\t() => publicPostTypes?.filter( ( postType ) => postType.has_archive ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst existingTemplates = useExistingTemplates();\n\tconst needsUniqueIdentifier = usePostTypeNeedsUniqueIdentifier(\n\t\tpostTypesWithArchives\n\t);\n\treturn useMemo(\n\t\t() =>\n\t\t\tpostTypesWithArchives\n\t\t\t\t?.filter(\n\t\t\t\t\t( postType ) =>\n\t\t\t\t\t\t! ( existingTemplates || [] ).some(\n\t\t\t\t\t\t\t( existingTemplate ) =>\n\t\t\t\t\t\t\t\texistingTemplate.slug ===\n\t\t\t\t\t\t\t\t'archive-' + postType.slug\n\t\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.map( ( postType ) => {\n\t\t\t\t\tlet title;\n\t\t\t\t\tif ( needsUniqueIdentifier( postType ) ) {\n\t\t\t\t\t\ttitle = sprintf(\n\t\t\t\t\t\t\t// translators: %1s: Name of the post type e.g: \"Post\"; %2s: Slug of the post type e.g: \"book\".\n\t\t\t\t\t\t\t__( 'Archive: %1$s (%2$s)' ),\n\t\t\t\t\t\t\tpostType.labels.singular_name,\n\t\t\t\t\t\t\tpostType.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttitle = sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__( 'Archive: %s' ),\n\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tslug: 'archive-' + postType.slug,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Displays an archive with the latest posts of type: %s.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t\t\t\t// also supports urls and svg as values.\n\t\t\t\t\t\ticon: postType.icon?.startsWith( 'dashicons-' )\n\t\t\t\t\t\t\t? postType.icon.slice( 10 )\n\t\t\t\t\t\t\t: archive,\n\t\t\t\t\t\ttemplatePrefix: 'archive',\n\t\t\t\t\t};\n\t\t\t\t} ) || [],\n\t\t[ postTypesWithArchives, existingTemplates, needsUniqueIdentifier ]\n\t);\n}\n\nexport const usePostTypeMenuItems = ( onClickMenuItem ) => {\n\tconst publicPostTypes = usePublicPostTypes();\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst needsUniqueIdentifier =\n\t\tusePostTypeNeedsUniqueIdentifier( publicPostTypes );\n\t// `page`is a special case in template hierarchy.\n\tconst templatePrefixes = useMemo(\n\t\t() =>\n\t\t\tpublicPostTypes?.reduce( ( accumulator, { slug } ) => {\n\t\t\t\tlet suffix = slug;\n\t\t\t\tif ( slug !== 'page' ) {\n\t\t\t\t\tsuffix = `single-${ suffix }`;\n\t\t\t\t}\n\t\t\t\taccumulator[ slug ] = suffix;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst postTypesInfo = useEntitiesInfo( 'postType', templatePrefixes );\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst menuItems = ( publicPostTypes || [] ).reduce(\n\t\t( accumulator, postType ) => {\n\t\t\tconst { slug, labels, icon } = postType;\n\t\t\t// We need to check if the general template is part of the\n\t\t\t// defaultTemplateTypes. If it is, just use that info and\n\t\t\t// augment it with the specific template functionality.\n\t\t\tconst generalTemplateSlug = templatePrefixes[ slug ];\n\t\t\tconst defaultTemplateType = defaultTemplateTypes?.find(\n\t\t\t\t( { slug: _slug } ) => _slug === generalTemplateSlug\n\t\t\t);\n\t\t\tconst hasGeneralTemplate =\n\t\t\t\texistingTemplateSlugs?.includes( generalTemplateSlug );\n\t\t\tconst _needsUniqueIdentifier = needsUniqueIdentifier( postType );\n\t\t\tlet menuItemTitle = sprintf(\n\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t__( 'Single item: %s' ),\n\t\t\t\tlabels.singular_name\n\t\t\t);\n\t\t\tif ( _needsUniqueIdentifier ) {\n\t\t\t\tmenuItemTitle = sprintf(\n\t\t\t\t\t// translators: %1s: Name of the post type e.g: \"Post\"; %2s: Slug of the post type e.g: \"book\".\n\t\t\t\t\t__( 'Single item: %1$s (%2$s)' ),\n\t\t\t\t\tlabels.singular_name,\n\t\t\t\t\tslug\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst menuItem = defaultTemplateType\n\t\t\t\t? {\n\t\t\t\t\t\t...defaultTemplateType,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tslug: generalTemplateSlug,\n\t\t\t\t\t\ttitle: menuItemTitle,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__( 'Displays a single item: %s.' ),\n\t\t\t\t\t\t\tlabels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t\t\t\t// also supports urls and svg as values.\n\t\t\t\t\t\ticon: icon?.startsWith( 'dashicons-' )\n\t\t\t\t\t\t\t? icon.slice( 10 )\n\t\t\t\t\t\t\t: post,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t };\n\t\t\tconst hasEntities = postTypesInfo?.[ slug ]?.hasEntities;\n\t\t\t// We have a different template creation flow only if they have entities.\n\t\t\tif ( hasEntities ) {\n\t\t\t\tmenuItem.onClick = ( template ) => {\n\t\t\t\t\tonClickMenuItem( {\n\t\t\t\t\t\ttype: 'postType',\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\trecordNamePath: 'title.rendered',\n\t\t\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t_fields: 'id,title,slug,link',\n\t\t\t\t\t\t\t\t\torderBy: search ? 'relevance' : 'modified',\n\t\t\t\t\t\t\t\t\texclude:\n\t\t\t\t\t\t\t\t\t\tpostTypesInfo[ slug ]\n\t\t\t\t\t\t\t\t\t\t\t.existingEntitiesIds,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\t\t\tconst templateSlug = `${ templatePrefixes[ slug ] }-${ suggestion.slug }`;\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlabels,\n\t\t\t\t\t\thasGeneralTemplate,\n\t\t\t\t\t\ttemplate,\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t}\n\t\t\t// We don't need to add the menu item if there are no\n\t\t\t// entities and the general template exists.\n\t\t\tif ( ! hasGeneralTemplate || hasEntities ) {\n\t\t\t\taccumulator.push( menuItem );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\t// Split menu items into two groups: one for the default post types\n\t// and one for the rest.\n\tconst postTypesMenuItems = useMemo(\n\t\t() =>\n\t\t\tmenuItems.reduce(\n\t\t\t\t( accumulator, postType ) => {\n\t\t\t\t\tconst { slug } = postType;\n\t\t\t\t\tlet key = 'postTypesMenuItems';\n\t\t\t\t\tif ( slug === 'page' ) {\n\t\t\t\t\t\tkey = 'defaultPostTypesMenuItems';\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ key ].push( postType );\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ defaultPostTypesMenuItems: [], postTypesMenuItems: [] }\n\t\t\t),\n\t\t[ menuItems ]\n\t);\n\treturn postTypesMenuItems;\n};\n\nexport const useTaxonomiesMenuItems = ( onClickMenuItem ) => {\n\tconst publicTaxonomies = usePublicTaxonomies();\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\t// `category` and `post_tag` are special cases in template hierarchy.\n\tconst templatePrefixes = useMemo(\n\t\t() =>\n\t\t\tpublicTaxonomies?.reduce( ( accumulator, { slug } ) => {\n\t\t\t\tlet suffix = slug;\n\t\t\t\tif ( ! [ 'category', 'post_tag' ].includes( slug ) ) {\n\t\t\t\t\tsuffix = `taxonomy-${ suffix }`;\n\t\t\t\t}\n\t\t\t\tif ( slug === 'post_tag' ) {\n\t\t\t\t\tsuffix = `tag`;\n\t\t\t\t}\n\t\t\t\taccumulator[ slug ] = suffix;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicTaxonomies ]\n\t);\n\t// We need to keep track of naming conflicts. If a conflict\n\t// occurs, we need to add slug.\n\tconst taxonomyLabels = publicTaxonomies?.reduce(\n\t\t( accumulator, { labels } ) => {\n\t\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\t\taccumulator[ singularName ] =\n\t\t\t\t( accumulator[ singularName ] || 0 ) + 1;\n\t\t\treturn accumulator;\n\t\t},\n\t\t{}\n\t);\n\tconst needsUniqueIdentifier = ( labels, slug ) => {\n\t\tif ( [ 'category', 'post_tag' ].includes( slug ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\treturn taxonomyLabels[ singularName ] > 1 && singularName !== slug;\n\t};\n\tconst taxonomiesInfo = useEntitiesInfo( 'taxonomy', templatePrefixes );\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst menuItems = ( publicTaxonomies || [] ).reduce(\n\t\t( accumulator, taxonomy ) => {\n\t\t\tconst { slug, labels } = taxonomy;\n\t\t\t// We need to check if the general template is part of the\n\t\t\t// defaultTemplateTypes. If it is, just use that info and\n\t\t\t// augment it with the specific template functionality.\n\t\t\tconst generalTemplateSlug = templatePrefixes[ slug ];\n\t\t\tconst defaultTemplateType = defaultTemplateTypes?.find(\n\t\t\t\t( { slug: _slug } ) => _slug === generalTemplateSlug\n\t\t\t);\n\t\t\tconst hasGeneralTemplate =\n\t\t\t\texistingTemplateSlugs?.includes( generalTemplateSlug );\n\t\t\tconst _needsUniqueIdentifier = needsUniqueIdentifier(\n\t\t\t\tlabels,\n\t\t\t\tslug\n\t\t\t);\n\t\t\tlet menuItemTitle = labels.singular_name;\n\t\t\tif ( _needsUniqueIdentifier ) {\n\t\t\t\tmenuItemTitle = sprintf(\n\t\t\t\t\t// translators: %1s: Name of the taxonomy e.g: \"Category\"; %2s: Slug of the taxonomy e.g: \"product_cat\".\n\t\t\t\t\t__( '%1$s (%2$s)' ),\n\t\t\t\t\tlabels.singular_name,\n\t\t\t\t\tslug\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst menuItem = defaultTemplateType\n\t\t\t\t? {\n\t\t\t\t\t\t...defaultTemplateType,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tslug: generalTemplateSlug,\n\t\t\t\t\t\ttitle: menuItemTitle,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the taxonomy e.g: \"Product Categories\".\n\t\t\t\t\t\t\t__( 'Displays taxonomy: %s.' ),\n\t\t\t\t\t\t\tlabels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\ticon: blockMeta,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t };\n\t\t\tconst hasEntities = taxonomiesInfo?.[ slug ]?.hasEntities;\n\t\t\t// We have a different template creation flow only if they have entities.\n\t\t\tif ( hasEntities ) {\n\t\t\t\tmenuItem.onClick = ( template ) => {\n\t\t\t\t\tonClickMenuItem( {\n\t\t\t\t\t\ttype: 'taxonomy',\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t_fields: 'id,name,slug,link',\n\t\t\t\t\t\t\t\t\torderBy: search ? 'name' : 'count',\n\t\t\t\t\t\t\t\t\texclude:\n\t\t\t\t\t\t\t\t\t\ttaxonomiesInfo[ slug ]\n\t\t\t\t\t\t\t\t\t\t\t.existingEntitiesIds,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\t\t\tconst templateSlug = `${ templatePrefixes[ slug ] }-${ suggestion.slug }`;\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlabels,\n\t\t\t\t\t\thasGeneralTemplate,\n\t\t\t\t\t\ttemplate,\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t}\n\t\t\t// We don't need to add the menu item if there are no\n\t\t\t// entities and the general template exists.\n\t\t\tif ( ! hasGeneralTemplate || hasEntities ) {\n\t\t\t\taccumulator.push( menuItem );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\t// Split menu items into two groups: one for the default taxonomies\n\t// and one for the rest.\n\tconst taxonomiesMenuItems = useMemo(\n\t\t() =>\n\t\t\tmenuItems.reduce(\n\t\t\t\t( accumulator, taxonomy ) => {\n\t\t\t\t\tconst { slug } = taxonomy;\n\t\t\t\t\tlet key = 'taxonomiesMenuItems';\n\t\t\t\t\tif ( [ 'category', 'tag' ].includes( slug ) ) {\n\t\t\t\t\t\tkey = 'defaultTaxonomiesMenuItems';\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ key ].push( taxonomy );\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ defaultTaxonomiesMenuItems: [], taxonomiesMenuItems: [] }\n\t\t\t),\n\t\t[ menuItems ]\n\t);\n\treturn taxonomiesMenuItems;\n};\n\nconst USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { user: 'author' };\nconst USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { user: { who: 'authors' } };\nexport function useAuthorMenuItem( onClickMenuItem ) {\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst authorInfo = useEntitiesInfo(\n\t\t'root',\n\t\tUSE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX,\n\t\tUSE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS\n\t);\n\tlet authorMenuItem = defaultTemplateTypes?.find(\n\t\t( { slug } ) => slug === 'author'\n\t);\n\tif ( ! authorMenuItem ) {\n\t\tauthorMenuItem = {\n\t\t\tdescription: __(\n\t\t\t\t'Displays latest posts written by a single author.'\n\t\t\t),\n\t\t\tslug: 'author',\n\t\t\ttitle: 'Author',\n\t\t};\n\t}\n\tconst hasGeneralTemplate = !! existingTemplates?.find(\n\t\t( { slug } ) => slug === 'author'\n\t);\n\tif ( authorInfo.user?.hasEntities ) {\n\t\tauthorMenuItem = { ...authorMenuItem, templatePrefix: 'author' };\n\t\tauthorMenuItem.onClick = ( template ) => {\n\t\t\tonClickMenuItem( {\n\t\t\t\ttype: 'root',\n\t\t\t\tslug: 'user',\n\t\t\t\tconfig: {\n\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t_fields: 'id,name,slug,link',\n\t\t\t\t\t\t\torderBy: search ? 'name' : 'registered_date',\n\t\t\t\t\t\t\texclude: authorInfo.user.existingEntitiesIds,\n\t\t\t\t\t\t\twho: 'authors',\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\tconst templateSlug = `author-${ suggestion.slug }`;\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\ttemplatePrefix: 'author',\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tlabels: {\n\t\t\t\t\tsingular_name: __( 'Author' ),\n\t\t\t\t\tsearch_items: __( 'Search Authors' ),\n\t\t\t\t\tnot_found: __( 'No authors found.' ),\n\t\t\t\t\tall_items: __( 'All Authors' ),\n\t\t\t\t},\n\t\t\t\thasGeneralTemplate,\n\t\t\t\ttemplate,\n\t\t\t} );\n\t\t};\n\t}\n\tif ( ! hasGeneralTemplate || authorInfo.user?.hasEntities ) {\n\t\treturn authorMenuItem;\n\t}\n}\n\n/**\n * Helper hook that filters all the existing templates by the given\n * object with the entity's slug as key and the template prefix as value.\n *\n * Example:\n * `existingTemplates` is: [ { slug: 'tag-apple' }, { slug: 'page-about' }, { slug: 'tag' } ]\n * `templatePrefixes` is: { post_tag: 'tag' }\n * It will return: { post_tag: ['apple'] }\n *\n * Note: We append the `-` to the given template prefix in this function for our checks.\n *\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @return {Record<string,string[]>} An object with the entity's slug as key and an array with the existing template slugs as value.\n */\nconst useExistingTemplateSlugs = ( templatePrefixes ) => {\n\tconst existingTemplates = useExistingTemplates();\n\tconst existingSlugs = useMemo( () => {\n\t\treturn Object.entries( templatePrefixes || {} ).reduce(\n\t\t\t( accumulator, [ slug, prefix ] ) => {\n\t\t\t\tconst slugsWithTemplates = ( existingTemplates || [] ).reduce(\n\t\t\t\t\t( _accumulator, existingTemplate ) => {\n\t\t\t\t\t\tconst _prefix = `${ prefix }-`;\n\t\t\t\t\t\tif ( existingTemplate.slug.startsWith( _prefix ) ) {\n\t\t\t\t\t\t\t_accumulator.push(\n\t\t\t\t\t\t\t\texistingTemplate.slug.substring(\n\t\t\t\t\t\t\t\t\t_prefix.length\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn _accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tif ( slugsWithTemplates.length ) {\n\t\t\t\t\taccumulator[ slug ] = slugsWithTemplates;\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t}, [ templatePrefixes, existingTemplates ] );\n\treturn existingSlugs;\n};\n\n/**\n * Helper hook that finds the existing records with an associated template,\n * as they need to be excluded from the template suggestions.\n *\n * @param {string} entityName The entity's name.\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.\n * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the existing records as value.\n */\nconst useTemplatesToExclude = (\n\tentityName,\n\ttemplatePrefixes,\n\tadditionalQueryParameters = {}\n) => {\n\tconst slugsToExcludePerEntity =\n\t\tuseExistingTemplateSlugs( templatePrefixes );\n\tconst recordsToExcludePerEntity = useSelect(\n\t\t( select ) => {\n\t\t\treturn Object.entries( slugsToExcludePerEntity || {} ).reduce(\n\t\t\t\t( accumulator, [ slug, slugsWithTemplates ] ) => {\n\t\t\t\t\tconst entitiesWithTemplates = select(\n\t\t\t\t\t\tcoreStore\n\t\t\t\t\t).getEntityRecords( entityName, slug, {\n\t\t\t\t\t\t_fields: 'id',\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t\tslug: slugsWithTemplates,\n\t\t\t\t\t\t...additionalQueryParameters[ slug ],\n\t\t\t\t\t} );\n\t\t\t\t\tif ( entitiesWithTemplates?.length ) {\n\t\t\t\t\t\taccumulator[ slug ] = entitiesWithTemplates;\n\t\t\t\t\t}\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\t\t},\n\t\t[ slugsToExcludePerEntity ]\n\t);\n\treturn recordsToExcludePerEntity;\n};\n\n/**\n * Helper hook that returns information about an entity having\n * records that we can create a specific template for.\n *\n * For example we can search for `terms` in `taxonomy` entity or\n * `posts` in `postType` entity.\n *\n * First we need to find the existing records with an associated template,\n * to query afterwards for any remaining record, by excluding them.\n *\n * @param {string} entityName The entity's name.\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.\n * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the EntitiesInfo as value.\n */\nconst useEntitiesInfo = (\n\tentityName,\n\ttemplatePrefixes,\n\tadditionalQueryParameters = {}\n) => {\n\tconst recordsToExcludePerEntity = useTemplatesToExclude(\n\t\tentityName,\n\t\ttemplatePrefixes,\n\t\tadditionalQueryParameters\n\t);\n\tconst entitiesInfo = useSelect(\n\t\t( select ) => {\n\t\t\treturn Object.keys( templatePrefixes || {} ).reduce(\n\t\t\t\t( accumulator, slug ) => {\n\t\t\t\t\tconst existingEntitiesIds =\n\t\t\t\t\t\trecordsToExcludePerEntity?.[ slug ]?.map(\n\t\t\t\t\t\t\t( { id } ) => id\n\t\t\t\t\t\t) || [];\n\t\t\t\t\taccumulator[ slug ] = {\n\t\t\t\t\t\thasEntities: !! select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t\tentityName,\n\t\t\t\t\t\t\tslug,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tper_page: 1,\n\t\t\t\t\t\t\t\t_fields: 'id',\n\t\t\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t\t\t\texclude: existingEntitiesIds,\n\t\t\t\t\t\t\t\t...additionalQueryParameters[ slug ],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)?.length,\n\t\t\t\t\t\texistingEntitiesIds,\n\t\t\t\t\t};\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\t\t},\n\t\t[ templatePrefixes, recordsToExcludePerEntity ]\n\t);\n\treturn entitiesInfo;\n};\n"]}
1
+ {"version":3,"names":["useSelect","store","coreStore","editorStore","decodeEntities","useMemo","useCallback","__","sprintf","blockMeta","post","archive","getValueFromObjectPath","object","path","value","split","forEach","fieldName","mapToIHasNameAndId","entities","map","entity","name","useExistingTemplates","select","getEntityRecords","per_page","useDefaultTemplateTypes","__experimentalGetDefaultTemplateTypes","usePublicPostTypes","postTypes","getPostTypes","excludedPostTypes","filter","viewable","slug","includes","usePublicTaxonomies","taxonomies","getTaxonomies","visibility","publicly_queryable","usePostTypeNeedsUniqueIdentifier","publicPostTypes","postTypeLabels","reduce","accumulator","labels","singularName","singular_name","toLowerCase","usePostTypeArchiveMenuItems","postTypesWithArchives","postType","has_archive","existingTemplates","needsUniqueIdentifier","some","existingTemplate","title","description","icon","startsWith","slice","templatePrefix","usePostTypeMenuItems","onClickMenuItem","defaultTemplateTypes","templatePrefixes","suffix","postTypesInfo","useEntitiesInfo","existingTemplateSlugs","menuItems","generalTemplateSlug","defaultTemplateType","find","_slug","hasGeneralTemplate","_needsUniqueIdentifier","menuItemTitle","menuItem","hasEntities","onClick","template","type","config","recordNamePath","queryArgs","search","_fields","orderBy","exclude","existingEntitiesIds","getSpecificTemplate","suggestion","templateSlug","push","postTypesMenuItems","key","defaultPostTypesMenuItems","useTaxonomiesMenuItems","publicTaxonomies","taxonomyLabels","taxonomiesInfo","taxonomy","taxonomiesMenuItems","defaultTaxonomiesMenuItems","USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX","user","USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS","who","useAuthorMenuItem","authorInfo","authorMenuItem","search_items","not_found","all_items","useExistingTemplateSlugs","existingSlugs","Object","entries","prefix","slugsWithTemplates","_accumulator","_prefix","substring","length","useTemplatesToExclude","entityName","additionalQueryParameters","slugsToExcludePerEntity","recordsToExcludePerEntity","entitiesWithTemplates","context","entitiesInfo","keys","id"],"sources":["@wordpress/edit-site/src/components/add-new-template/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { blockMeta, post, archive } from '@wordpress/icons';\n\n/**\n * @typedef IHasNameAndId\n * @property {string|number} id The entity's id.\n * @property {string} name The entity's name.\n */\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.split( '.' ).forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\n/**\n * Helper util to map records to add a `name` prop from a\n * provided path, in order to handle all entities in the same\n * fashion(implementing`IHasNameAndId` interface).\n *\n * @param {Object[]} entities The array of entities.\n * @param {string} path The path to map a `name` property from the entity.\n * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.\n */\nexport const mapToIHasNameAndId = ( entities, path ) => {\n\treturn ( entities || [] ).map( ( entity ) => ( {\n\t\t...entity,\n\t\tname: decodeEntities( getValueFromObjectPath( entity, path ) ),\n\t} ) );\n};\n\n/**\n * @typedef {Object} EntitiesInfo\n * @property {boolean} hasEntities If an entity has available records(posts, terms, etc..).\n * @property {number[]} existingEntitiesIds An array of the existing entities ids.\n */\n\nexport const useExistingTemplates = () => {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\tper_page: -1,\n\t\t\t} ),\n\t\t[]\n\t);\n};\n\nexport const useDefaultTemplateTypes = () => {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplateTypes(),\n\t\t[]\n\t);\n};\n\nconst usePublicPostTypes = () => {\n\tconst postTypes = useSelect(\n\t\t( select ) => select( coreStore ).getPostTypes( { per_page: -1 } ),\n\t\t[]\n\t);\n\treturn useMemo( () => {\n\t\tconst excludedPostTypes = [ 'attachment' ];\n\t\treturn postTypes?.filter(\n\t\t\t( { viewable, slug } ) =>\n\t\t\t\tviewable && ! excludedPostTypes.includes( slug )\n\t\t);\n\t}, [ postTypes ] );\n};\n\nconst usePublicTaxonomies = () => {\n\tconst taxonomies = useSelect(\n\t\t( select ) => select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t[]\n\t);\n\treturn useMemo( () => {\n\t\treturn taxonomies?.filter(\n\t\t\t( { visibility } ) => visibility?.publicly_queryable\n\t\t);\n\t}, [ taxonomies ] );\n};\n\nfunction usePostTypeNeedsUniqueIdentifier( publicPostTypes ) {\n\tconst postTypeLabels = useMemo( () =>\n\t\tpublicPostTypes?.reduce( ( accumulator, { labels } ) => {\n\t\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\t\taccumulator[ singularName ] =\n\t\t\t\t( accumulator[ singularName ] || 0 ) + 1;\n\t\t\treturn accumulator;\n\t\t}, {} )\n\t);\n\treturn useCallback(\n\t\t( { labels, slug } ) => {\n\t\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\t\treturn postTypeLabels[ singularName ] > 1 && singularName !== slug;\n\t\t},\n\t\t[ postTypeLabels ]\n\t);\n}\n\nexport function usePostTypeArchiveMenuItems() {\n\tconst publicPostTypes = usePublicPostTypes();\n\tconst postTypesWithArchives = useMemo(\n\t\t() => publicPostTypes?.filter( ( postType ) => postType.has_archive ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst existingTemplates = useExistingTemplates();\n\tconst needsUniqueIdentifier = usePostTypeNeedsUniqueIdentifier(\n\t\tpostTypesWithArchives\n\t);\n\treturn useMemo(\n\t\t() =>\n\t\t\tpostTypesWithArchives\n\t\t\t\t?.filter(\n\t\t\t\t\t( postType ) =>\n\t\t\t\t\t\t! ( existingTemplates || [] ).some(\n\t\t\t\t\t\t\t( existingTemplate ) =>\n\t\t\t\t\t\t\t\texistingTemplate.slug ===\n\t\t\t\t\t\t\t\t'archive-' + postType.slug\n\t\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.map( ( postType ) => {\n\t\t\t\t\tlet title;\n\t\t\t\t\tif ( needsUniqueIdentifier( postType ) ) {\n\t\t\t\t\t\ttitle = sprintf(\n\t\t\t\t\t\t\t// translators: %1s: Name of the post type e.g: \"Post\"; %2s: Slug of the post type e.g: \"book\".\n\t\t\t\t\t\t\t__( 'Archive: %1$s (%2$s)' ),\n\t\t\t\t\t\t\tpostType.labels.singular_name,\n\t\t\t\t\t\t\tpostType.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttitle = sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__( 'Archive: %s' ),\n\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tslug: 'archive-' + postType.slug,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Displays an archive with the latest posts of type: %s.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t\t\t\t// also supports urls and svg as values.\n\t\t\t\t\t\ticon: postType.icon?.startsWith( 'dashicons-' )\n\t\t\t\t\t\t\t? postType.icon.slice( 10 )\n\t\t\t\t\t\t\t: archive,\n\t\t\t\t\t\ttemplatePrefix: 'archive',\n\t\t\t\t\t};\n\t\t\t\t} ) || [],\n\t\t[ postTypesWithArchives, existingTemplates, needsUniqueIdentifier ]\n\t);\n}\n\nexport const usePostTypeMenuItems = ( onClickMenuItem ) => {\n\tconst publicPostTypes = usePublicPostTypes();\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst needsUniqueIdentifier =\n\t\tusePostTypeNeedsUniqueIdentifier( publicPostTypes );\n\t// `page`is a special case in template hierarchy.\n\tconst templatePrefixes = useMemo(\n\t\t() =>\n\t\t\tpublicPostTypes?.reduce( ( accumulator, { slug } ) => {\n\t\t\t\tlet suffix = slug;\n\t\t\t\tif ( slug !== 'page' ) {\n\t\t\t\t\tsuffix = `single-${ suffix }`;\n\t\t\t\t}\n\t\t\t\taccumulator[ slug ] = suffix;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst postTypesInfo = useEntitiesInfo( 'postType', templatePrefixes );\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst menuItems = ( publicPostTypes || [] ).reduce(\n\t\t( accumulator, postType ) => {\n\t\t\tconst { slug, labels, icon } = postType;\n\t\t\t// We need to check if the general template is part of the\n\t\t\t// defaultTemplateTypes. If it is, just use that info and\n\t\t\t// augment it with the specific template functionality.\n\t\t\tconst generalTemplateSlug = templatePrefixes[ slug ];\n\t\t\tconst defaultTemplateType = defaultTemplateTypes?.find(\n\t\t\t\t( { slug: _slug } ) => _slug === generalTemplateSlug\n\t\t\t);\n\t\t\tconst hasGeneralTemplate =\n\t\t\t\texistingTemplateSlugs?.includes( generalTemplateSlug );\n\t\t\tconst _needsUniqueIdentifier = needsUniqueIdentifier( postType );\n\t\t\tlet menuItemTitle = sprintf(\n\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t__( 'Single item: %s' ),\n\t\t\t\tlabels.singular_name\n\t\t\t);\n\t\t\tif ( _needsUniqueIdentifier ) {\n\t\t\t\tmenuItemTitle = sprintf(\n\t\t\t\t\t// translators: %1s: Name of the post type e.g: \"Post\"; %2s: Slug of the post type e.g: \"book\".\n\t\t\t\t\t__( 'Single item: %1$s (%2$s)' ),\n\t\t\t\t\tlabels.singular_name,\n\t\t\t\t\tslug\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst menuItem = defaultTemplateType\n\t\t\t\t? {\n\t\t\t\t\t\t...defaultTemplateType,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tslug: generalTemplateSlug,\n\t\t\t\t\t\ttitle: menuItemTitle,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__( 'Displays a single item: %s.' ),\n\t\t\t\t\t\t\tlabels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t\t\t\t// also supports urls and svg as values.\n\t\t\t\t\t\ticon: icon?.startsWith( 'dashicons-' )\n\t\t\t\t\t\t\t? icon.slice( 10 )\n\t\t\t\t\t\t\t: post,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t };\n\t\t\tconst hasEntities = postTypesInfo?.[ slug ]?.hasEntities;\n\t\t\t// We have a different template creation flow only if they have entities.\n\t\t\tif ( hasEntities ) {\n\t\t\t\tmenuItem.onClick = ( template ) => {\n\t\t\t\t\tonClickMenuItem( {\n\t\t\t\t\t\ttype: 'postType',\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\trecordNamePath: 'title.rendered',\n\t\t\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t_fields: 'id,title,slug,link',\n\t\t\t\t\t\t\t\t\torderBy: search ? 'relevance' : 'modified',\n\t\t\t\t\t\t\t\t\texclude:\n\t\t\t\t\t\t\t\t\t\tpostTypesInfo[ slug ]\n\t\t\t\t\t\t\t\t\t\t\t.existingEntitiesIds,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\t\t\tconst templateSlug = `${ templatePrefixes[ slug ] }-${ suggestion.slug }`;\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlabels,\n\t\t\t\t\t\thasGeneralTemplate,\n\t\t\t\t\t\ttemplate,\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t}\n\t\t\t// We don't need to add the menu item if there are no\n\t\t\t// entities and the general template exists.\n\t\t\tif ( ! hasGeneralTemplate || hasEntities ) {\n\t\t\t\taccumulator.push( menuItem );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\t// Split menu items into two groups: one for the default post types\n\t// and one for the rest.\n\tconst postTypesMenuItems = useMemo(\n\t\t() =>\n\t\t\tmenuItems.reduce(\n\t\t\t\t( accumulator, postType ) => {\n\t\t\t\t\tconst { slug } = postType;\n\t\t\t\t\tlet key = 'postTypesMenuItems';\n\t\t\t\t\tif ( slug === 'page' ) {\n\t\t\t\t\t\tkey = 'defaultPostTypesMenuItems';\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ key ].push( postType );\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ defaultPostTypesMenuItems: [], postTypesMenuItems: [] }\n\t\t\t),\n\t\t[ menuItems ]\n\t);\n\treturn postTypesMenuItems;\n};\n\nexport const useTaxonomiesMenuItems = ( onClickMenuItem ) => {\n\tconst publicTaxonomies = usePublicTaxonomies();\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\t// `category` and `post_tag` are special cases in template hierarchy.\n\tconst templatePrefixes = useMemo(\n\t\t() =>\n\t\t\tpublicTaxonomies?.reduce( ( accumulator, { slug } ) => {\n\t\t\t\tlet suffix = slug;\n\t\t\t\tif ( ! [ 'category', 'post_tag' ].includes( slug ) ) {\n\t\t\t\t\tsuffix = `taxonomy-${ suffix }`;\n\t\t\t\t}\n\t\t\t\tif ( slug === 'post_tag' ) {\n\t\t\t\t\tsuffix = `tag`;\n\t\t\t\t}\n\t\t\t\taccumulator[ slug ] = suffix;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicTaxonomies ]\n\t);\n\t// We need to keep track of naming conflicts. If a conflict\n\t// occurs, we need to add slug.\n\tconst taxonomyLabels = publicTaxonomies?.reduce(\n\t\t( accumulator, { labels } ) => {\n\t\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\t\taccumulator[ singularName ] =\n\t\t\t\t( accumulator[ singularName ] || 0 ) + 1;\n\t\t\treturn accumulator;\n\t\t},\n\t\t{}\n\t);\n\tconst needsUniqueIdentifier = ( labels, slug ) => {\n\t\tif ( [ 'category', 'post_tag' ].includes( slug ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\treturn taxonomyLabels[ singularName ] > 1 && singularName !== slug;\n\t};\n\tconst taxonomiesInfo = useEntitiesInfo( 'taxonomy', templatePrefixes );\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst menuItems = ( publicTaxonomies || [] ).reduce(\n\t\t( accumulator, taxonomy ) => {\n\t\t\tconst { slug, labels } = taxonomy;\n\t\t\t// We need to check if the general template is part of the\n\t\t\t// defaultTemplateTypes. If it is, just use that info and\n\t\t\t// augment it with the specific template functionality.\n\t\t\tconst generalTemplateSlug = templatePrefixes[ slug ];\n\t\t\tconst defaultTemplateType = defaultTemplateTypes?.find(\n\t\t\t\t( { slug: _slug } ) => _slug === generalTemplateSlug\n\t\t\t);\n\t\t\tconst hasGeneralTemplate =\n\t\t\t\texistingTemplateSlugs?.includes( generalTemplateSlug );\n\t\t\tconst _needsUniqueIdentifier = needsUniqueIdentifier(\n\t\t\t\tlabels,\n\t\t\t\tslug\n\t\t\t);\n\t\t\tlet menuItemTitle = labels.singular_name;\n\t\t\tif ( _needsUniqueIdentifier ) {\n\t\t\t\tmenuItemTitle = sprintf(\n\t\t\t\t\t// translators: %1s: Name of the taxonomy e.g: \"Category\"; %2s: Slug of the taxonomy e.g: \"product_cat\".\n\t\t\t\t\t__( '%1$s (%2$s)' ),\n\t\t\t\t\tlabels.singular_name,\n\t\t\t\t\tslug\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst menuItem = defaultTemplateType\n\t\t\t\t? {\n\t\t\t\t\t\t...defaultTemplateType,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tslug: generalTemplateSlug,\n\t\t\t\t\t\ttitle: menuItemTitle,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the taxonomy e.g: \"Product Categories\".\n\t\t\t\t\t\t\t__( 'Displays taxonomy: %s.' ),\n\t\t\t\t\t\t\tlabels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\ticon: blockMeta,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t };\n\t\t\tconst hasEntities = taxonomiesInfo?.[ slug ]?.hasEntities;\n\t\t\t// We have a different template creation flow only if they have entities.\n\t\t\tif ( hasEntities ) {\n\t\t\t\tmenuItem.onClick = ( template ) => {\n\t\t\t\t\tonClickMenuItem( {\n\t\t\t\t\t\ttype: 'taxonomy',\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t_fields: 'id,name,slug,link',\n\t\t\t\t\t\t\t\t\torderBy: search ? 'name' : 'count',\n\t\t\t\t\t\t\t\t\texclude:\n\t\t\t\t\t\t\t\t\t\ttaxonomiesInfo[ slug ]\n\t\t\t\t\t\t\t\t\t\t\t.existingEntitiesIds,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\t\t\tconst templateSlug = `${ templatePrefixes[ slug ] }-${ suggestion.slug }`;\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlabels,\n\t\t\t\t\t\thasGeneralTemplate,\n\t\t\t\t\t\ttemplate,\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t}\n\t\t\t// We don't need to add the menu item if there are no\n\t\t\t// entities and the general template exists.\n\t\t\tif ( ! hasGeneralTemplate || hasEntities ) {\n\t\t\t\taccumulator.push( menuItem );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\t// Split menu items into two groups: one for the default taxonomies\n\t// and one for the rest.\n\tconst taxonomiesMenuItems = useMemo(\n\t\t() =>\n\t\t\tmenuItems.reduce(\n\t\t\t\t( accumulator, taxonomy ) => {\n\t\t\t\t\tconst { slug } = taxonomy;\n\t\t\t\t\tlet key = 'taxonomiesMenuItems';\n\t\t\t\t\tif ( [ 'category', 'tag' ].includes( slug ) ) {\n\t\t\t\t\t\tkey = 'defaultTaxonomiesMenuItems';\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ key ].push( taxonomy );\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ defaultTaxonomiesMenuItems: [], taxonomiesMenuItems: [] }\n\t\t\t),\n\t\t[ menuItems ]\n\t);\n\treturn taxonomiesMenuItems;\n};\n\nconst USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { user: 'author' };\nconst USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { user: { who: 'authors' } };\nexport function useAuthorMenuItem( onClickMenuItem ) {\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst authorInfo = useEntitiesInfo(\n\t\t'root',\n\t\tUSE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX,\n\t\tUSE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS\n\t);\n\tlet authorMenuItem = defaultTemplateTypes?.find(\n\t\t( { slug } ) => slug === 'author'\n\t);\n\tif ( ! authorMenuItem ) {\n\t\tauthorMenuItem = {\n\t\t\tdescription: __(\n\t\t\t\t'Displays latest posts written by a single author.'\n\t\t\t),\n\t\t\tslug: 'author',\n\t\t\ttitle: 'Author',\n\t\t};\n\t}\n\tconst hasGeneralTemplate = !! existingTemplates?.find(\n\t\t( { slug } ) => slug === 'author'\n\t);\n\tif ( authorInfo.user?.hasEntities ) {\n\t\tauthorMenuItem = { ...authorMenuItem, templatePrefix: 'author' };\n\t\tauthorMenuItem.onClick = ( template ) => {\n\t\t\tonClickMenuItem( {\n\t\t\t\ttype: 'root',\n\t\t\t\tslug: 'user',\n\t\t\t\tconfig: {\n\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t_fields: 'id,name,slug,link',\n\t\t\t\t\t\t\torderBy: search ? 'name' : 'registered_date',\n\t\t\t\t\t\t\texclude: authorInfo.user.existingEntitiesIds,\n\t\t\t\t\t\t\twho: 'authors',\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\tconst templateSlug = `author-${ suggestion.slug }`;\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\ttemplatePrefix: 'author',\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tlabels: {\n\t\t\t\t\tsingular_name: __( 'Author' ),\n\t\t\t\t\tsearch_items: __( 'Search Authors' ),\n\t\t\t\t\tnot_found: __( 'No authors found.' ),\n\t\t\t\t\tall_items: __( 'All Authors' ),\n\t\t\t\t},\n\t\t\t\thasGeneralTemplate,\n\t\t\t\ttemplate,\n\t\t\t} );\n\t\t};\n\t}\n\tif ( ! hasGeneralTemplate || authorInfo.user?.hasEntities ) {\n\t\treturn authorMenuItem;\n\t}\n}\n\n/**\n * Helper hook that filters all the existing templates by the given\n * object with the entity's slug as key and the template prefix as value.\n *\n * Example:\n * `existingTemplates` is: [ { slug: 'tag-apple' }, { slug: 'page-about' }, { slug: 'tag' } ]\n * `templatePrefixes` is: { post_tag: 'tag' }\n * It will return: { post_tag: ['apple'] }\n *\n * Note: We append the `-` to the given template prefix in this function for our checks.\n *\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @return {Record<string,string[]>} An object with the entity's slug as key and an array with the existing template slugs as value.\n */\nconst useExistingTemplateSlugs = ( templatePrefixes ) => {\n\tconst existingTemplates = useExistingTemplates();\n\tconst existingSlugs = useMemo( () => {\n\t\treturn Object.entries( templatePrefixes || {} ).reduce(\n\t\t\t( accumulator, [ slug, prefix ] ) => {\n\t\t\t\tconst slugsWithTemplates = ( existingTemplates || [] ).reduce(\n\t\t\t\t\t( _accumulator, existingTemplate ) => {\n\t\t\t\t\t\tconst _prefix = `${ prefix }-`;\n\t\t\t\t\t\tif ( existingTemplate.slug.startsWith( _prefix ) ) {\n\t\t\t\t\t\t\t_accumulator.push(\n\t\t\t\t\t\t\t\texistingTemplate.slug.substring(\n\t\t\t\t\t\t\t\t\t_prefix.length\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn _accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tif ( slugsWithTemplates.length ) {\n\t\t\t\t\taccumulator[ slug ] = slugsWithTemplates;\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t}, [ templatePrefixes, existingTemplates ] );\n\treturn existingSlugs;\n};\n\n/**\n * Helper hook that finds the existing records with an associated template,\n * as they need to be excluded from the template suggestions.\n *\n * @param {string} entityName The entity's name.\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.\n * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the existing records as value.\n */\nconst useTemplatesToExclude = (\n\tentityName,\n\ttemplatePrefixes,\n\tadditionalQueryParameters = {}\n) => {\n\tconst slugsToExcludePerEntity =\n\t\tuseExistingTemplateSlugs( templatePrefixes );\n\tconst recordsToExcludePerEntity = useSelect(\n\t\t( select ) => {\n\t\t\treturn Object.entries( slugsToExcludePerEntity || {} ).reduce(\n\t\t\t\t( accumulator, [ slug, slugsWithTemplates ] ) => {\n\t\t\t\t\tconst entitiesWithTemplates = select(\n\t\t\t\t\t\tcoreStore\n\t\t\t\t\t).getEntityRecords( entityName, slug, {\n\t\t\t\t\t\t_fields: 'id',\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t\tslug: slugsWithTemplates,\n\t\t\t\t\t\t...additionalQueryParameters[ slug ],\n\t\t\t\t\t} );\n\t\t\t\t\tif ( entitiesWithTemplates?.length ) {\n\t\t\t\t\t\taccumulator[ slug ] = entitiesWithTemplates;\n\t\t\t\t\t}\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\t\t},\n\t\t[ slugsToExcludePerEntity ]\n\t);\n\treturn recordsToExcludePerEntity;\n};\n\n/**\n * Helper hook that returns information about an entity having\n * records that we can create a specific template for.\n *\n * For example we can search for `terms` in `taxonomy` entity or\n * `posts` in `postType` entity.\n *\n * First we need to find the existing records with an associated template,\n * to query afterwards for any remaining record, by excluding them.\n *\n * @param {string} entityName The entity's name.\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.\n * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the EntitiesInfo as value.\n */\nconst useEntitiesInfo = (\n\tentityName,\n\ttemplatePrefixes,\n\tadditionalQueryParameters = {}\n) => {\n\tconst recordsToExcludePerEntity = useTemplatesToExclude(\n\t\tentityName,\n\t\ttemplatePrefixes,\n\t\tadditionalQueryParameters\n\t);\n\tconst entitiesInfo = useSelect(\n\t\t( select ) => {\n\t\t\treturn Object.keys( templatePrefixes || {} ).reduce(\n\t\t\t\t( accumulator, slug ) => {\n\t\t\t\t\tconst existingEntitiesIds =\n\t\t\t\t\t\trecordsToExcludePerEntity?.[ slug ]?.map(\n\t\t\t\t\t\t\t( { id } ) => id\n\t\t\t\t\t\t) || [];\n\t\t\t\t\taccumulator[ slug ] = {\n\t\t\t\t\t\thasEntities: !! select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t\tentityName,\n\t\t\t\t\t\t\tslug,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tper_page: 1,\n\t\t\t\t\t\t\t\t_fields: 'id',\n\t\t\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t\t\t\texclude: existingEntitiesIds,\n\t\t\t\t\t\t\t\t...additionalQueryParameters[ slug ],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)?.length,\n\t\t\t\t\t\texistingEntitiesIds,\n\t\t\t\t\t};\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\t\t},\n\t\t[ templatePrefixes, recordsToExcludePerEntity ]\n\t);\n\treturn entitiesInfo;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;AACxD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACzD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,EAAEC,IAAI,EAAEC,OAAO,QAAQ,kBAAkB;;AAE3D;AACA;AACA;AACA;AACA;;AAEA,MAAMC,sBAAsB,GAAGA,CAAEC,MAAM,EAAEC,IAAI,KAAM;EAClD,IAAIC,KAAK,GAAGF,MAAM;EAClBC,IAAI,C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