@wordpress/edit-site 6.10.0 → 6.11.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 (439) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-post/index.js +1 -1
  3. package/build/components/add-new-post/index.js.map +1 -1
  4. package/build/components/add-new-template/index.js +1 -1
  5. package/build/components/add-new-template/index.js.map +1 -1
  6. package/build/components/add-new-template/utils.js +8 -8
  7. package/build/components/add-new-template/utils.js.map +1 -1
  8. package/build/components/app/index.js +2 -0
  9. package/build/components/app/index.js.map +1 -1
  10. package/build/components/block-editor/use-editor-iframe-props.js +29 -20
  11. package/build/components/block-editor/use-editor-iframe-props.js.map +1 -1
  12. package/build/components/block-editor/use-site-editor-settings.js +10 -8
  13. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  14. package/build/components/editor/index.js +23 -10
  15. package/build/components/editor/index.js.map +1 -1
  16. package/build/components/editor/use-adapt-editor-to-canvas.js +49 -0
  17. package/build/components/editor/use-adapt-editor-to-canvas.js.map +1 -0
  18. package/build/components/editor/use-editor-title.js +2 -2
  19. package/build/components/editor/use-editor-title.js.map +1 -1
  20. package/build/components/global-styles/font-sizes/font-size.js +6 -6
  21. package/build/components/global-styles/font-sizes/font-size.js.map +1 -1
  22. package/build/components/global-styles/font-sizes/font-sizes-count.js +0 -1
  23. package/build/components/global-styles/font-sizes/font-sizes-count.js.map +1 -1
  24. package/build/components/global-styles/font-sizes/font-sizes.js +4 -4
  25. package/build/components/global-styles/font-sizes/font-sizes.js.map +1 -1
  26. package/build/components/global-styles/palette.js +16 -13
  27. package/build/components/global-styles/palette.js.map +1 -1
  28. package/build/components/global-styles/root-menu.js +0 -4
  29. package/build/components/global-styles/root-menu.js.map +1 -1
  30. package/build/components/global-styles/screen-block-list.js +0 -4
  31. package/build/components/global-styles/screen-block-list.js.map +1 -1
  32. package/build/components/global-styles/screen-css.js +1 -1
  33. package/build/components/global-styles/screen-css.js.map +1 -1
  34. package/build/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
  35. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  36. package/build/components/global-styles/screen-root.js +0 -3
  37. package/build/components/global-styles/screen-root.js.map +1 -1
  38. package/build/components/global-styles/screen-style-variations.js +5 -1
  39. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  40. package/build/components/global-styles/shadows-edit-panel.js +9 -10
  41. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  42. package/build/components/global-styles/shadows-panel.js +0 -3
  43. package/build/components/global-styles/shadows-panel.js.map +1 -1
  44. package/build/components/global-styles/typography-elements.js +1 -4
  45. package/build/components/global-styles/typography-elements.js.map +1 -1
  46. package/build/components/global-styles/ui.js +7 -0
  47. package/build/components/global-styles/ui.js.map +1 -1
  48. package/build/components/global-styles/variations/variation.js +2 -2
  49. package/build/components/global-styles/variations/variation.js.map +1 -1
  50. package/build/components/global-styles/variations/variations-panel.js +0 -1
  51. package/build/components/global-styles/variations/variations-panel.js.map +1 -1
  52. package/build/components/global-styles-sidebar/default-sidebar.js +0 -1
  53. package/build/components/global-styles-sidebar/default-sidebar.js.map +1 -1
  54. package/build/components/global-styles-sidebar/index.js +43 -30
  55. package/build/components/global-styles-sidebar/index.js.map +1 -1
  56. package/build/components/layout/animation.js +1 -3
  57. package/build/components/layout/animation.js.map +1 -1
  58. package/build/components/layout/index.js +22 -35
  59. package/build/components/layout/index.js.map +1 -1
  60. package/build/components/layout/router.js +17 -140
  61. package/build/components/layout/router.js.map +1 -1
  62. package/build/components/page-patterns/delete-category-menu-item.js +3 -3
  63. package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
  64. package/build/components/page-patterns/use-pattern-settings.js +1 -1
  65. package/build/components/page-patterns/use-pattern-settings.js.map +1 -1
  66. package/build/components/page-templates/index.js +1 -2
  67. package/build/components/page-templates/index.js.map +1 -1
  68. package/build/components/pagination/index.js +1 -1
  69. package/build/components/pagination/index.js.map +1 -1
  70. package/build/components/post-edit/index.js +8 -4
  71. package/build/components/post-edit/index.js.map +1 -1
  72. package/build/components/post-fields/index.js +6 -52
  73. package/build/components/post-fields/index.js.map +1 -1
  74. package/build/components/post-list/index.js +1 -1
  75. package/build/components/post-list/index.js.map +1 -1
  76. package/build/components/posts-app/index.js.map +1 -1
  77. package/build/components/posts-app/router.js +4 -4
  78. package/build/components/posts-app/router.js.map +1 -1
  79. package/build/components/resizable-frame/index.js +21 -9
  80. package/build/components/resizable-frame/index.js.map +1 -1
  81. package/build/components/revisions/index.js +1 -1
  82. package/build/components/revisions/index.js.map +1 -1
  83. package/build/components/save-keyboard-shortcut/index.js +78 -0
  84. package/build/components/save-keyboard-shortcut/index.js.map +1 -0
  85. package/build/components/save-panel/index.js +17 -6
  86. package/build/components/save-panel/index.js.map +1 -1
  87. package/build/components/sidebar-dataviews/default-views.js +2 -5
  88. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  89. package/build/components/sidebar-navigation-screen/index.js +2 -1
  90. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  91. package/build/components/sidebar-navigation-screen-global-styles/index.js +30 -10
  92. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  93. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  94. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  95. package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +3 -3
  96. package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -1
  97. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +7 -12
  98. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  99. package/build/components/site-editor-routes/home-edit.js +26 -0
  100. package/build/components/site-editor-routes/home-edit.js.map +1 -0
  101. package/build/components/site-editor-routes/home-view.js +25 -0
  102. package/build/components/site-editor-routes/home-view.js.map +1 -0
  103. package/build/components/site-editor-routes/index.js +49 -0
  104. package/build/components/site-editor-routes/index.js.map +1 -0
  105. package/build/components/site-editor-routes/navigation-edit.js +29 -0
  106. package/build/components/site-editor-routes/navigation-edit.js.map +1 -0
  107. package/build/components/site-editor-routes/navigation-item-edit.js +31 -0
  108. package/build/components/site-editor-routes/navigation-item-edit.js.map +1 -0
  109. package/build/components/site-editor-routes/navigation-item-view.js +30 -0
  110. package/build/components/site-editor-routes/navigation-item-view.js.map +1 -0
  111. package/build/components/site-editor-routes/navigation-view.js +28 -0
  112. package/build/components/site-editor-routes/navigation-view.js.map +1 -0
  113. package/build/components/site-editor-routes/pages-edit.js +43 -0
  114. package/build/components/site-editor-routes/pages-edit.js.map +1 -0
  115. package/build/components/site-editor-routes/pages-list-view-quick-edit.js +64 -0
  116. package/build/components/site-editor-routes/pages-list-view-quick-edit.js.map +1 -0
  117. package/build/components/site-editor-routes/pages-list-view.js +47 -0
  118. package/build/components/site-editor-routes/pages-list-view.js.map +1 -0
  119. package/build/components/site-editor-routes/pages-view-quick-edit.js +61 -0
  120. package/build/components/site-editor-routes/pages-view-quick-edit.js.map +1 -0
  121. package/build/components/site-editor-routes/pages-view.js +42 -0
  122. package/build/components/site-editor-routes/pages-view.js.map +1 -0
  123. package/build/components/site-editor-routes/patterns-edit.js +31 -0
  124. package/build/components/site-editor-routes/patterns-edit.js.map +1 -0
  125. package/build/components/site-editor-routes/patterns-view.js +29 -0
  126. package/build/components/site-editor-routes/patterns-view.js.map +1 -0
  127. package/build/components/site-editor-routes/styles-edit.js +28 -0
  128. package/build/components/site-editor-routes/styles-edit.js.map +1 -0
  129. package/build/components/site-editor-routes/styles-view.js +27 -0
  130. package/build/components/site-editor-routes/styles-view.js.map +1 -0
  131. package/build/components/site-editor-routes/templates-edit.js +31 -0
  132. package/build/components/site-editor-routes/templates-edit.js.map +1 -0
  133. package/build/components/site-editor-routes/templates-list-view.js +34 -0
  134. package/build/components/site-editor-routes/templates-list-view.js.map +1 -0
  135. package/build/components/site-editor-routes/templates-view.js +29 -0
  136. package/build/components/site-editor-routes/templates-view.js.map +1 -0
  137. package/build/components/site-hub/index.js +3 -2
  138. package/build/components/site-hub/index.js.map +1 -1
  139. package/build/components/style-book/color-examples.js +46 -0
  140. package/build/components/style-book/color-examples.js.map +1 -0
  141. package/build/components/style-book/constants.js +75 -10
  142. package/build/components/style-book/constants.js.map +1 -1
  143. package/build/components/style-book/duotone-examples.js +55 -0
  144. package/build/components/style-book/duotone-examples.js.map +1 -0
  145. package/build/components/style-book/examples.js +46 -3
  146. package/build/components/style-book/examples.js.map +1 -1
  147. package/build/components/style-book/index.js +92 -36
  148. package/build/components/style-book/index.js.map +1 -1
  149. package/build/components/style-book/types.js.map +1 -1
  150. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +6 -1
  151. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  152. package/build/hooks/commands/use-common-commands.js +46 -30
  153. package/build/hooks/commands/use-common-commands.js.map +1 -1
  154. package/build/hooks/commands/use-edit-mode-commands.js +10 -6
  155. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  156. package/build/hooks/commands/use-set-command-context.js +12 -15
  157. package/build/hooks/commands/use-set-command-context.js.map +1 -1
  158. package/build/store/private-actions.js +8 -60
  159. package/build/store/private-actions.js.map +1 -1
  160. package/build/store/private-selectors.js +4 -12
  161. package/build/store/private-selectors.js.map +1 -1
  162. package/build/store/reducer.js +9 -18
  163. package/build/store/reducer.js.map +1 -1
  164. package/build-module/components/add-new-post/index.js +1 -1
  165. package/build-module/components/add-new-post/index.js.map +1 -1
  166. package/build-module/components/add-new-template/index.js +1 -1
  167. package/build-module/components/add-new-template/index.js.map +1 -1
  168. package/build-module/components/add-new-template/utils.js +9 -9
  169. package/build-module/components/add-new-template/utils.js.map +1 -1
  170. package/build-module/components/app/index.js +4 -2
  171. package/build-module/components/app/index.js.map +1 -1
  172. package/build-module/components/block-editor/use-editor-iframe-props.js +30 -21
  173. package/build-module/components/block-editor/use-editor-iframe-props.js.map +1 -1
  174. package/build-module/components/block-editor/use-site-editor-settings.js +10 -8
  175. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  176. package/build-module/components/editor/index.js +23 -10
  177. package/build-module/components/editor/index.js.map +1 -1
  178. package/build-module/components/editor/use-adapt-editor-to-canvas.js +42 -0
  179. package/build-module/components/editor/use-adapt-editor-to-canvas.js.map +1 -0
  180. package/build-module/components/editor/use-editor-title.js +3 -3
  181. package/build-module/components/editor/use-editor-title.js.map +1 -1
  182. package/build-module/components/global-styles/font-sizes/font-size.js +6 -6
  183. package/build-module/components/global-styles/font-sizes/font-size.js.map +1 -1
  184. package/build-module/components/global-styles/font-sizes/font-sizes-count.js +0 -1
  185. package/build-module/components/global-styles/font-sizes/font-sizes-count.js.map +1 -1
  186. package/build-module/components/global-styles/font-sizes/font-sizes.js +4 -4
  187. package/build-module/components/global-styles/font-sizes/font-sizes.js.map +1 -1
  188. package/build-module/components/global-styles/palette.js +17 -14
  189. package/build-module/components/global-styles/palette.js.map +1 -1
  190. package/build-module/components/global-styles/root-menu.js +0 -4
  191. package/build-module/components/global-styles/root-menu.js.map +1 -1
  192. package/build-module/components/global-styles/screen-block-list.js +0 -4
  193. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  194. package/build-module/components/global-styles/screen-css.js +1 -1
  195. package/build-module/components/global-styles/screen-css.js.map +1 -1
  196. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
  197. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  198. package/build-module/components/global-styles/screen-root.js +0 -3
  199. package/build-module/components/global-styles/screen-root.js.map +1 -1
  200. package/build-module/components/global-styles/screen-style-variations.js +5 -1
  201. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  202. package/build-module/components/global-styles/shadows-edit-panel.js +9 -10
  203. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  204. package/build-module/components/global-styles/shadows-panel.js +0 -3
  205. package/build-module/components/global-styles/shadows-panel.js.map +1 -1
  206. package/build-module/components/global-styles/typography-elements.js +2 -5
  207. package/build-module/components/global-styles/typography-elements.js.map +1 -1
  208. package/build-module/components/global-styles/ui.js +7 -0
  209. package/build-module/components/global-styles/ui.js.map +1 -1
  210. package/build-module/components/global-styles/variations/variation.js +3 -3
  211. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  212. package/build-module/components/global-styles/variations/variations-panel.js +0 -1
  213. package/build-module/components/global-styles/variations/variations-panel.js.map +1 -1
  214. package/build-module/components/global-styles-sidebar/default-sidebar.js +0 -1
  215. package/build-module/components/global-styles-sidebar/default-sidebar.js.map +1 -1
  216. package/build-module/components/global-styles-sidebar/index.js +44 -31
  217. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  218. package/build-module/components/layout/animation.js +1 -3
  219. package/build-module/components/layout/animation.js.map +1 -1
  220. package/build-module/components/layout/index.js +22 -35
  221. package/build-module/components/layout/index.js.map +1 -1
  222. package/build-module/components/layout/router.js +17 -139
  223. package/build-module/components/layout/router.js.map +1 -1
  224. package/build-module/components/page-patterns/delete-category-menu-item.js +4 -4
  225. package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
  226. package/build-module/components/page-patterns/use-pattern-settings.js +1 -1
  227. package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -1
  228. package/build-module/components/page-templates/index.js +1 -2
  229. package/build-module/components/page-templates/index.js.map +1 -1
  230. package/build-module/components/pagination/index.js +1 -1
  231. package/build-module/components/pagination/index.js.map +1 -1
  232. package/build-module/components/post-edit/index.js +8 -4
  233. package/build-module/components/post-edit/index.js.map +1 -1
  234. package/build-module/components/post-fields/index.js +7 -51
  235. package/build-module/components/post-fields/index.js.map +1 -1
  236. package/build-module/components/post-list/index.js +1 -1
  237. package/build-module/components/post-list/index.js.map +1 -1
  238. package/build-module/components/posts-app/index.js +2 -2
  239. package/build-module/components/posts-app/index.js.map +1 -1
  240. package/build-module/components/posts-app/router.js +3 -3
  241. package/build-module/components/posts-app/router.js.map +1 -1
  242. package/build-module/components/resizable-frame/index.js +21 -10
  243. package/build-module/components/resizable-frame/index.js.map +1 -1
  244. package/build-module/components/revisions/index.js +1 -1
  245. package/build-module/components/revisions/index.js.map +1 -1
  246. package/build-module/components/save-keyboard-shortcut/index.js +71 -0
  247. package/build-module/components/save-keyboard-shortcut/index.js.map +1 -0
  248. package/build-module/components/save-panel/index.js +17 -6
  249. package/build-module/components/save-panel/index.js.map +1 -1
  250. package/build-module/components/sidebar-dataviews/default-views.js +2 -5
  251. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  252. package/build-module/components/sidebar-navigation-screen/index.js +2 -1
  253. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  254. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +30 -10
  255. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  256. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -2
  257. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  258. package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +4 -4
  259. package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -1
  260. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +8 -13
  261. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  262. package/build-module/components/site-editor-routes/home-edit.js +18 -0
  263. package/build-module/components/site-editor-routes/home-edit.js.map +1 -0
  264. package/build-module/components/site-editor-routes/home-view.js +17 -0
  265. package/build-module/components/site-editor-routes/home-view.js.map +1 -0
  266. package/build-module/components/site-editor-routes/index.js +42 -0
  267. package/build-module/components/site-editor-routes/index.js.map +1 -0
  268. package/build-module/components/site-editor-routes/navigation-edit.js +21 -0
  269. package/build-module/components/site-editor-routes/navigation-edit.js.map +1 -0
  270. package/build-module/components/site-editor-routes/navigation-item-edit.js +23 -0
  271. package/build-module/components/site-editor-routes/navigation-item-edit.js.map +1 -0
  272. package/build-module/components/site-editor-routes/navigation-item-view.js +22 -0
  273. package/build-module/components/site-editor-routes/navigation-item-view.js.map +1 -0
  274. package/build-module/components/site-editor-routes/navigation-view.js +20 -0
  275. package/build-module/components/site-editor-routes/navigation-view.js.map +1 -0
  276. package/build-module/components/site-editor-routes/pages-edit.js +35 -0
  277. package/build-module/components/site-editor-routes/pages-edit.js.map +1 -0
  278. package/build-module/components/site-editor-routes/pages-list-view-quick-edit.js +56 -0
  279. package/build-module/components/site-editor-routes/pages-list-view-quick-edit.js.map +1 -0
  280. package/build-module/components/site-editor-routes/pages-list-view.js +39 -0
  281. package/build-module/components/site-editor-routes/pages-list-view.js.map +1 -0
  282. package/build-module/components/site-editor-routes/pages-view-quick-edit.js +53 -0
  283. package/build-module/components/site-editor-routes/pages-view-quick-edit.js.map +1 -0
  284. package/build-module/components/site-editor-routes/pages-view.js +34 -0
  285. package/build-module/components/site-editor-routes/pages-view.js.map +1 -0
  286. package/build-module/components/site-editor-routes/patterns-edit.js +23 -0
  287. package/build-module/components/site-editor-routes/patterns-edit.js.map +1 -0
  288. package/build-module/components/site-editor-routes/patterns-view.js +21 -0
  289. package/build-module/components/site-editor-routes/patterns-view.js.map +1 -0
  290. package/build-module/components/site-editor-routes/styles-edit.js +20 -0
  291. package/build-module/components/site-editor-routes/styles-edit.js.map +1 -0
  292. package/build-module/components/site-editor-routes/styles-view.js +19 -0
  293. package/build-module/components/site-editor-routes/styles-view.js.map +1 -0
  294. package/build-module/components/site-editor-routes/templates-edit.js +23 -0
  295. package/build-module/components/site-editor-routes/templates-edit.js.map +1 -0
  296. package/build-module/components/site-editor-routes/templates-list-view.js +26 -0
  297. package/build-module/components/site-editor-routes/templates-list-view.js.map +1 -0
  298. package/build-module/components/site-editor-routes/templates-view.js +21 -0
  299. package/build-module/components/site-editor-routes/templates-view.js.map +1 -0
  300. package/build-module/components/site-hub/index.js +3 -2
  301. package/build-module/components/site-hub/index.js.map +1 -1
  302. package/build-module/components/style-book/color-examples.js +38 -0
  303. package/build-module/components/style-book/color-examples.js.map +1 -0
  304. package/build-module/components/style-book/constants.js +74 -9
  305. package/build-module/components/style-book/constants.js.map +1 -1
  306. package/build-module/components/style-book/duotone-examples.js +48 -0
  307. package/build-module/components/style-book/duotone-examples.js.map +1 -0
  308. package/build-module/components/style-book/examples.js +47 -3
  309. package/build-module/components/style-book/examples.js.map +1 -1
  310. package/build-module/components/style-book/index.js +94 -38
  311. package/build-module/components/style-book/index.js.map +1 -1
  312. package/build-module/components/style-book/types.js.map +1 -1
  313. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +6 -1
  314. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  315. package/build-module/hooks/commands/use-common-commands.js +46 -30
  316. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  317. package/build-module/hooks/commands/use-edit-mode-commands.js +10 -6
  318. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  319. package/build-module/hooks/commands/use-set-command-context.js +12 -15
  320. package/build-module/hooks/commands/use-set-command-context.js.map +1 -1
  321. package/build-module/store/private-actions.js +6 -58
  322. package/build-module/store/private-actions.js.map +1 -1
  323. package/build-module/store/private-selectors.js +3 -11
  324. package/build-module/store/private-selectors.js.map +1 -1
  325. package/build-module/store/reducer.js +9 -18
  326. package/build-module/store/reducer.js.map +1 -1
  327. package/build-style/posts-rtl.css +10 -13
  328. package/build-style/posts.css +10 -13
  329. package/build-style/style-rtl.css +127 -26
  330. package/build-style/style.css +127 -26
  331. package/package.json +43 -41
  332. package/src/components/add-new-post/index.js +1 -1
  333. package/src/components/add-new-template/index.js +1 -1
  334. package/src/components/add-new-template/utils.js +12 -9
  335. package/src/components/app/index.js +4 -2
  336. package/src/components/block-editor/use-editor-iframe-props.js +22 -18
  337. package/src/components/block-editor/use-site-editor-settings.js +12 -10
  338. package/src/components/editor/index.js +34 -13
  339. package/src/components/editor/use-adapt-editor-to-canvas.js +53 -0
  340. package/src/components/editor/use-editor-title.js +3 -3
  341. package/src/components/global-styles/font-sizes/font-size.js +11 -15
  342. package/src/components/global-styles/font-sizes/font-sizes-count.js +1 -4
  343. package/src/components/global-styles/font-sizes/font-sizes.js +7 -9
  344. package/src/components/global-styles/palette.js +21 -18
  345. package/src/components/global-styles/root-menu.js +3 -16
  346. package/src/components/global-styles/screen-block-list.js +0 -7
  347. package/src/components/global-styles/screen-css.js +1 -0
  348. package/src/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
  349. package/src/components/global-styles/screen-root.js +3 -12
  350. package/src/components/global-styles/screen-style-variations.js +4 -1
  351. package/src/components/global-styles/shadows-edit-panel.js +12 -13
  352. package/src/components/global-styles/shadows-panel.js +0 -4
  353. package/src/components/global-styles/typography-elements.js +3 -11
  354. package/src/components/global-styles/ui.js +11 -0
  355. package/src/components/global-styles/variations/variation.js +3 -3
  356. package/src/components/global-styles/variations/variations-panel.js +0 -1
  357. package/src/components/global-styles-sidebar/default-sidebar.js +0 -1
  358. package/src/components/global-styles-sidebar/index.js +86 -65
  359. package/src/components/global-styles-sidebar/style.scss +6 -0
  360. package/src/components/layout/animation.js +0 -1
  361. package/src/components/layout/index.js +16 -34
  362. package/src/components/layout/router.js +18 -133
  363. package/src/components/layout/style.scss +2 -2
  364. package/src/components/page-patterns/delete-category-menu-item.js +4 -4
  365. package/src/components/page-patterns/use-pattern-settings.js +1 -1
  366. package/src/components/page-templates/index.js +0 -1
  367. package/src/components/pagination/index.js +1 -1
  368. package/src/components/post-edit/index.js +35 -4
  369. package/src/components/post-fields/index.js +7 -54
  370. package/src/components/post-fields/style.scss +3 -0
  371. package/src/components/post-list/index.js +1 -1
  372. package/src/components/post-list/style.scss +1 -1
  373. package/src/components/posts-app/index.js +2 -2
  374. package/src/components/posts-app/router.js +3 -3
  375. package/src/components/resizable-frame/index.js +19 -10
  376. package/src/components/revisions/index.js +4 -1
  377. package/src/components/save-keyboard-shortcut/index.js +69 -0
  378. package/src/components/save-panel/index.js +30 -32
  379. package/src/components/sidebar-dataviews/default-views.js +2 -5
  380. package/src/components/sidebar-navigation-screen/index.js +2 -1
  381. package/src/components/sidebar-navigation-screen-global-styles/index.js +47 -29
  382. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -2
  383. package/src/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +4 -4
  384. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +11 -13
  385. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +1 -1
  386. package/src/components/site-editor-routes/README.md +20 -0
  387. package/src/components/site-editor-routes/home-edit.js +17 -0
  388. package/src/components/site-editor-routes/home-view.js +16 -0
  389. package/src/components/site-editor-routes/index.js +60 -0
  390. package/src/components/site-editor-routes/navigation-edit.js +22 -0
  391. package/src/components/site-editor-routes/navigation-item-edit.js +26 -0
  392. package/src/components/site-editor-routes/navigation-item-view.js +25 -0
  393. package/src/components/site-editor-routes/navigation-view.js +21 -0
  394. package/src/components/site-editor-routes/pages-edit.js +35 -0
  395. package/src/components/site-editor-routes/pages-list-view-quick-edit.js +56 -0
  396. package/src/components/site-editor-routes/pages-list-view.js +44 -0
  397. package/src/components/site-editor-routes/pages-view-quick-edit.js +53 -0
  398. package/src/components/site-editor-routes/pages-view.js +39 -0
  399. package/src/components/site-editor-routes/patterns-edit.js +24 -0
  400. package/src/components/site-editor-routes/patterns-view.js +22 -0
  401. package/src/components/site-editor-routes/styles-edit.js +17 -0
  402. package/src/components/site-editor-routes/styles-view.js +16 -0
  403. package/src/components/site-editor-routes/templates-edit.js +22 -0
  404. package/src/components/site-editor-routes/templates-list-view.js +28 -0
  405. package/src/components/site-editor-routes/templates-view.js +22 -0
  406. package/src/components/site-hub/index.js +2 -2
  407. package/src/components/site-hub/style.scss +4 -0
  408. package/src/components/style-book/color-examples.tsx +44 -0
  409. package/src/components/style-book/constants.ts +83 -10
  410. package/src/components/style-book/duotone-examples.tsx +53 -0
  411. package/src/components/style-book/examples.tsx +113 -0
  412. package/src/components/style-book/index.js +149 -52
  413. package/src/components/style-book/style.scss +12 -14
  414. package/src/components/style-book/test/categories.js +0 -5
  415. package/src/components/style-book/types.ts +34 -1
  416. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +11 -1
  417. package/src/hooks/commands/use-common-commands.js +60 -40
  418. package/src/hooks/commands/use-edit-mode-commands.js +14 -18
  419. package/src/hooks/commands/use-set-command-context.js +7 -9
  420. package/src/store/private-actions.js +7 -79
  421. package/src/store/private-selectors.js +4 -11
  422. package/src/store/reducer.js +10 -18
  423. package/src/style.scss +3 -0
  424. package/build/components/keyboard-shortcuts/global.js +0 -53
  425. package/build/components/keyboard-shortcuts/global.js.map +0 -1
  426. package/build/components/keyboard-shortcuts/register.js +0 -34
  427. package/build/components/keyboard-shortcuts/register.js.map +0 -1
  428. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +0 -69
  429. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +0 -1
  430. package/build-module/components/keyboard-shortcuts/global.js +0 -46
  431. package/build-module/components/keyboard-shortcuts/global.js.map +0 -1
  432. package/build-module/components/keyboard-shortcuts/register.js +0 -27
  433. package/build-module/components/keyboard-shortcuts/register.js.map +0 -1
  434. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +0 -62
  435. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +0 -1
  436. package/src/components/keyboard-shortcuts/global.js +0 -47
  437. package/src/components/keyboard-shortcuts/register.js +0 -27
  438. package/src/components/style-book/examples.ts +0 -63
  439. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +0 -73
@@ -7,7 +7,7 @@ exports.default = useSetCommandContext;
7
7
  var _data = require("@wordpress/data");
8
8
  var _commands = require("@wordpress/commands");
9
9
  var _blockEditor = require("@wordpress/block-editor");
10
- var _store = require("../../store");
10
+ var _router = require("@wordpress/router");
11
11
  var _lockUnlock = require("../../lock-unlock");
12
12
  var _editorCanvasContainer = require("../../components/editor-canvas-container");
13
13
  /**
@@ -21,31 +21,28 @@ var _editorCanvasContainer = require("../../components/editor-canvas-container")
21
21
  const {
22
22
  useCommandContext
23
23
  } = (0, _lockUnlock.unlock)(_commands.privateApis);
24
+ const {
25
+ useLocation
26
+ } = (0, _lockUnlock.unlock)(_router.privateApis);
24
27
 
25
28
  /**
26
29
  * React hook used to set the correct command context based on the current state.
27
30
  */
28
31
  function useSetCommandContext() {
29
32
  const {
30
- hasBlockSelected,
31
- canvasMode
32
- } = (0, _data.useSelect)(select => {
33
- const {
34
- getCanvasMode
35
- } = (0, _lockUnlock.unlock)(select(_store.store));
36
- const {
37
- getBlockSelectionStart
38
- } = select(_blockEditor.store);
39
- return {
40
- canvasMode: getCanvasMode(),
41
- hasBlockSelected: getBlockSelectionStart()
42
- };
33
+ params
34
+ } = useLocation();
35
+ const {
36
+ canvas = 'view'
37
+ } = params;
38
+ const hasBlockSelected = (0, _data.useSelect)(select => {
39
+ return select(_blockEditor.store).getBlockSelectionStart();
43
40
  }, []);
44
41
  const hasEditorCanvasContainer = (0, _editorCanvasContainer.useHasEditorCanvasContainer)();
45
42
 
46
43
  // Sets the right context for the command palette
47
44
  let commandContext = 'site-editor';
48
- if (canvasMode === 'edit') {
45
+ if (canvas === 'edit') {
49
46
  commandContext = 'entity-edit';
50
47
  }
51
48
  if (hasBlockSelected) {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_commands","_blockEditor","_store","_lockUnlock","_editorCanvasContainer","useCommandContext","unlock","commandsPrivateApis","useSetCommandContext","hasBlockSelected","canvasMode","useSelect","select","getCanvasMode","editSiteStore","getBlockSelectionStart","blockEditorStore","hasEditorCanvasContainer","useHasEditorCanvasContainer","commandContext"],"sources":["@wordpress/edit-site/src/hooks/commands/use-set-command-context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { privateApis as commandsPrivateApis } from '@wordpress/commands';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useHasEditorCanvasContainer } from '../../components/editor-canvas-container';\n\nconst { useCommandContext } = unlock( commandsPrivateApis );\n\n/**\n * React hook used to set the correct command context based on the current state.\n */\nexport default function useSetCommandContext() {\n\tconst { hasBlockSelected, canvasMode } = useSelect( ( select ) => {\n\t\tconst { getCanvasMode } = unlock( select( editSiteStore ) );\n\t\tconst { getBlockSelectionStart } = select( blockEditorStore );\n\t\treturn {\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\thasBlockSelected: getBlockSelectionStart(),\n\t\t};\n\t}, [] );\n\n\tconst hasEditorCanvasContainer = useHasEditorCanvasContainer();\n\n\t// Sets the right context for the command palette\n\tlet commandContext = 'site-editor';\n\tif ( canvasMode === 'edit' ) {\n\t\tcommandContext = 'entity-edit';\n\t}\n\tif ( hasBlockSelected ) {\n\t\tcommandContext = 'block-selection-edit';\n\t}\n\tif ( hasEditorCanvasContainer ) {\n\t\t/*\n\t\t * The editor canvas overlay will likely be deprecated in the future, so for now we clear the command context\n\t\t * to remove the suggested commands that may not make sense with Style Book or Style Revisions open.\n\t\t * See https://github.com/WordPress/gutenberg/issues/62216.\n\t\t */\n\t\tcommandContext = '';\n\t}\n\tuseCommandContext( commandContext );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,sBAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAKA;AACA;AACA;;AAKA,MAAM;EAAEM;AAAkB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,qBAAoB,CAAC;;AAE3D;AACA;AACA;AACe,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,MAAM;IAAEC,gBAAgB;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACjE,MAAM;MAAEC;IAAc,CAAC,GAAG,IAAAP,kBAAM,EAAEM,MAAM,CAAEE,YAAc,CAAE,CAAC;IAC3D,MAAM;MAAEC;IAAuB,CAAC,GAAGH,MAAM,CAAEI,kBAAiB,CAAC;IAC7D,OAAO;MACNN,UAAU,EAAEG,aAAa,CAAC,CAAC;MAC3BJ,gBAAgB,EAAEM,sBAAsB,CAAC;IAC1C,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAME,wBAAwB,GAAG,IAAAC,kDAA2B,EAAC,CAAC;;EAE9D;EACA,IAAIC,cAAc,GAAG,aAAa;EAClC,IAAKT,UAAU,KAAK,MAAM,EAAG;IAC5BS,cAAc,GAAG,aAAa;EAC/B;EACA,IAAKV,gBAAgB,EAAG;IACvBU,cAAc,GAAG,sBAAsB;EACxC;EACA,IAAKF,wBAAwB,EAAG;IAC/B;AACF;AACA;AACA;AACA;IACEE,cAAc,GAAG,EAAE;EACpB;EACAd,iBAAiB,CAAEc,cAAe,CAAC;AACpC","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_commands","_blockEditor","_router","_lockUnlock","_editorCanvasContainer","useCommandContext","unlock","commandsPrivateApis","useLocation","routerPrivateApis","useSetCommandContext","params","canvas","hasBlockSelected","useSelect","select","blockEditorStore","getBlockSelectionStart","hasEditorCanvasContainer","useHasEditorCanvasContainer","commandContext"],"sources":["@wordpress/edit-site/src/hooks/commands/use-set-command-context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { privateApis as commandsPrivateApis } from '@wordpress/commands';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { useHasEditorCanvasContainer } from '../../components/editor-canvas-container';\n\nconst { useCommandContext } = unlock( commandsPrivateApis );\nconst { useLocation } = unlock( routerPrivateApis );\n\n/**\n * React hook used to set the correct command context based on the current state.\n */\nexport default function useSetCommandContext() {\n\tconst { params } = useLocation();\n\tconst { canvas = 'view' } = params;\n\tconst hasBlockSelected = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).getBlockSelectionStart();\n\t}, [] );\n\n\tconst hasEditorCanvasContainer = useHasEditorCanvasContainer();\n\n\t// Sets the right context for the command palette\n\tlet commandContext = 'site-editor';\n\tif ( canvas === 'edit' ) {\n\t\tcommandContext = 'entity-edit';\n\t}\n\tif ( hasBlockSelected ) {\n\t\tcommandContext = 'block-selection-edit';\n\t}\n\tif ( hasEditorCanvasContainer ) {\n\t\t/*\n\t\t * The editor canvas overlay will likely be deprecated in the future, so for now we clear the command context\n\t\t * to remove the suggested commands that may not make sense with Style Book or Style Revisions open.\n\t\t * See https://github.com/WordPress/gutenberg/issues/62216.\n\t\t */\n\t\tcommandContext = '';\n\t}\n\tuseCommandContext( commandContext );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,sBAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAMA;AACA;AACA;;AAIA,MAAM;EAAEM;AAAkB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,qBAAoB,CAAC;AAC3D,MAAM;EAAEC;AAAY,CAAC,GAAG,IAAAF,kBAAM,EAAEG,mBAAkB,CAAC;;AAEnD;AACA;AACA;AACe,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,MAAM;IAAEC;EAAO,CAAC,GAAGH,WAAW,CAAC,CAAC;EAChC,MAAM;IAAEI,MAAM,GAAG;EAAO,CAAC,GAAGD,MAAM;EAClC,MAAME,gBAAgB,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACjD,OAAOA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,sBAAsB,CAAC,CAAC;EAC3D,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,wBAAwB,GAAG,IAAAC,kDAA2B,EAAC,CAAC;;EAE9D;EACA,IAAIC,cAAc,GAAG,aAAa;EAClC,IAAKR,MAAM,KAAK,MAAM,EAAG;IACxBQ,cAAc,GAAG,aAAa;EAC/B;EACA,IAAKP,gBAAgB,EAAG;IACvBO,cAAc,GAAG,sBAAsB;EACxC;EACA,IAAKF,wBAAwB,EAAG;IAC/B;AACF;AACA;AACA;AACA;IACEE,cAAc,GAAG,EAAE;EACpB;EACAf,iBAAiB,CAAEe,cAAe,CAAC;AACpC","ignoreList":[]}
@@ -3,71 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setEditorCanvasContainerView = exports.setCanvasMode = void 0;
7
- var _blockEditor = require("@wordpress/block-editor");
8
- var _preferences = require("@wordpress/preferences");
9
- var _editor = require("@wordpress/editor");
10
- /**
11
- * WordPress dependencies
12
- */
13
-
14
- /**
15
- * Action that switches the canvas mode.
16
- *
17
- * @param {?string} mode Canvas mode.
18
- */
19
- const setCanvasMode = mode => ({
20
- registry,
21
- dispatch
22
- }) => {
23
- const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
24
- const switchCanvasMode = () => {
25
- registry.batch(() => {
26
- registry.dispatch(_blockEditor.store).clearSelectedBlock();
27
- registry.dispatch(_editor.store).setDeviceType('Desktop');
28
- const isPublishSidebarOpened = registry.select(_editor.store).isPublishSidebarOpened();
29
- dispatch({
30
- type: 'SET_CANVAS_MODE',
31
- mode
32
- });
33
- const isEditMode = mode === 'edit';
34
- if (isPublishSidebarOpened && !isEditMode) {
35
- registry.dispatch(_editor.store).closePublishSidebar();
36
- }
37
-
38
- // Check if the block list view should be open by default.
39
- // If `distractionFree` mode is enabled, the block list view should not be open.
40
- // This behavior is disabled for small viewports.
41
- if (isMediumOrBigger && isEditMode && registry.select(_preferences.store).get('core', 'showListViewByDefault') && !registry.select(_preferences.store).get('core', 'distractionFree')) {
42
- registry.dispatch(_editor.store).setIsListViewOpened(true);
43
- } else {
44
- registry.dispatch(_editor.store).setIsListViewOpened(false);
45
- }
46
- registry.dispatch(_editor.store).setIsInserterOpened(false);
47
- });
48
- };
49
-
50
- /*
51
- * Skip transition in mobile, otherwise it crashes the browser.
52
- * See: https://github.com/WordPress/gutenberg/pull/63002.
53
- */
54
- if (!isMediumOrBigger || !document.startViewTransition) {
55
- switchCanvasMode();
56
- } else {
57
- document.documentElement.classList.add(`canvas-mode-${mode}-transition`);
58
- const transition = document.startViewTransition(() => switchCanvasMode());
59
- transition.finished.finally(() => {
60
- document.documentElement.classList.remove(`canvas-mode-${mode}-transition`);
61
- });
62
- }
63
- };
64
-
6
+ exports.registerRoute = registerRoute;
7
+ exports.setEditorCanvasContainerView = void 0;
65
8
  /**
66
9
  * Action that switches the editor canvas container view.
67
10
  *
68
11
  * @param {?string} view Editor canvas container view.
69
12
  */
70
- exports.setCanvasMode = setCanvasMode;
71
13
  const setEditorCanvasContainerView = view => ({
72
14
  dispatch
73
15
  }) => {
@@ -77,4 +19,10 @@ const setEditorCanvasContainerView = view => ({
77
19
  });
78
20
  };
79
21
  exports.setEditorCanvasContainerView = setEditorCanvasContainerView;
22
+ function registerRoute(route) {
23
+ return {
24
+ type: 'REGISTER_ROUTE',
25
+ route
26
+ };
27
+ }
80
28
  //# sourceMappingURL=private-actions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_preferences","_editor","setCanvasMode","mode","registry","dispatch","isMediumOrBigger","window","matchMedia","matches","switchCanvasMode","batch","blockEditorStore","clearSelectedBlock","editorStore","setDeviceType","isPublishSidebarOpened","select","type","isEditMode","closePublishSidebar","preferencesStore","get","setIsListViewOpened","setIsInserterOpened","document","startViewTransition","documentElement","classList","add","transition","finished","finally","remove","exports","setEditorCanvasContainerView","view"],"sources":["@wordpress/edit-site/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tconst isMediumOrBigger =\n\t\t\twindow.matchMedia( '(min-width: 782px)' ).matches;\n\t\tconst switchCanvasMode = () => {\n\t\t\tregistry.batch( () => {\n\t\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t\t\tregistry.dispatch( editorStore ).setDeviceType( 'Desktop' );\n\t\t\t\tconst isPublishSidebarOpened = registry\n\t\t\t\t\t.select( editorStore )\n\t\t\t\t\t.isPublishSidebarOpened();\n\t\t\t\tdispatch( {\n\t\t\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\t\t\tmode,\n\t\t\t\t} );\n\t\t\t\tconst isEditMode = mode === 'edit';\n\t\t\t\tif ( isPublishSidebarOpened && ! isEditMode ) {\n\t\t\t\t\tregistry.dispatch( editorStore ).closePublishSidebar();\n\t\t\t\t}\n\n\t\t\t\t// Check if the block list view should be open by default.\n\t\t\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\t\t\t// This behavior is disabled for small viewports.\n\t\t\t\tif (\n\t\t\t\t\tisMediumOrBigger &&\n\t\t\t\t\tisEditMode &&\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'showListViewByDefault' ) &&\n\t\t\t\t\t! registry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'distractionFree' )\n\t\t\t\t) {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( true );\n\t\t\t\t} else {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( false );\n\t\t\t\t}\n\t\t\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t\t\t} );\n\t\t};\n\n\t\t/*\n\t\t * Skip transition in mobile, otherwise it crashes the browser.\n\t\t * See: https://github.com/WordPress/gutenberg/pull/63002.\n\t\t */\n\t\tif ( ! isMediumOrBigger || ! document.startViewTransition ) {\n\t\t\tswitchCanvasMode();\n\t\t} else {\n\t\t\tdocument.documentElement.classList.add(\n\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t);\n\t\t\tconst transition = document.startViewTransition( () =>\n\t\t\t\tswitchCanvasMode()\n\t\t\t);\n\t\t\ttransition.finished.finally( () => {\n\t\t\t\tdocument.documentElement.classList.remove(\n\t\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACO,MAAMG,aAAa,GACvBC,IAAI,IACN,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC7B,MAAMC,gBAAgB,GACrBC,MAAM,CAACC,UAAU,CAAE,oBAAqB,CAAC,CAACC,OAAO;EAClD,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;IAC9BN,QAAQ,CAACO,KAAK,CAAE,MAAM;MACrBP,QAAQ,CAACC,QAAQ,CAAEO,kBAAiB,CAAC,CAACC,kBAAkB,CAAC,CAAC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mB,CAAE,MAChDhB,gBAAgB,CAAC,CAClB,CAAC;IACDoB,UAAU,CAACC,QAAQ,CAACC,OAAO,CAAE,MAAM;MAClCP,QAAQ,CAACE,eAAe,CAACC,SAAS,CAACK,MAAM,CACxC,eAAgB9B,IAAI,aACrB,CAAC;IACF,CAAE,CAAC;EACJ;AACD,CAAC;;AAEF;AACA;AACA;AACA;AACA;AAJA+B,OAAA,CAAAhC,aAAA,GAAAA,aAAA;AAKO,MAAMiC,4BAA4B,GACtCC,IAAI,IACN,CAAE;EAAE/B;AAAS,CAAC,KAAM;EACnBA,QAAQ,CAAE;IACTa,IAAI,EAAE,kCAAkC;IACxCkB;EACD,CAAE,CAAC;AACJ,CAAC;AAACF,OAAA,CAAAC,4BAAA,GAAAA,4BAAA","ignoreList":[]}
1
+ {"version":3,"names":["setEditorCanvasContainerView","view","dispatch","type","exports","registerRoute","route"],"sources":["@wordpress/edit-site/src/store/private-actions.js"],"sourcesContent":["/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n\nexport function registerRoute( route ) {\n\treturn {\n\t\ttype: 'REGISTER_ROUTE',\n\t\troute,\n\t};\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACO,MAAMA,4BAA4B,GACtCC,IAAI,IACN,CAAE;EAAEC;AAAS,CAAC,KAAM;EACnBA,QAAQ,CAAE;IACTC,IAAI,EAAE,kCAAkC;IACxCF;EACD,CAAE,CAAC;AACJ,CAAC;AAACG,OAAA,CAAAJ,4BAAA,GAAAA,4BAAA;AAEI,SAASK,aAAaA,CAAEC,KAAK,EAAG;EACtC,OAAO;IACNH,IAAI,EAAE,gBAAgB;IACtBG;EACD,CAAC;AACF","ignoreList":[]}
@@ -3,19 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getCanvasMode = getCanvasMode;
7
6
  exports.getEditorCanvasContainerView = getEditorCanvasContainerView;
8
- /**
9
- * Returns the current canvas mode.
10
- *
11
- * @param {Object} state Global application state.
12
- *
13
- * @return {string} Canvas mode.
14
- */
15
- function getCanvasMode(state) {
16
- return state.canvasMode;
17
- }
18
-
7
+ exports.getRoutes = getRoutes;
19
8
  /**
20
9
  * Returns the editor canvas container view.
21
10
  *
@@ -26,4 +15,7 @@ function getCanvasMode(state) {
26
15
  function getEditorCanvasContainerView(state) {
27
16
  return state.editorCanvasContainerView;
28
17
  }
18
+ function getRoutes(state) {
19
+ return state.routes;
20
+ }
29
21
  //# sourceMappingURL=private-selectors.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getCanvasMode","state","canvasMode","getEditorCanvasContainerView","editorCanvasContainerView"],"sources":["@wordpress/edit-site/src/store/private-selectors.js"],"sourcesContent":["/**\n * Returns the current canvas mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Canvas mode.\n */\nexport function getCanvasMode( state ) {\n\treturn state.canvasMode;\n}\n\n/**\n * Returns the editor canvas container view.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editor canvas container view.\n */\nexport function getEditorCanvasContainerView( state ) {\n\treturn state.editorCanvasContainerView;\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAaA,CAAEC,KAAK,EAAG;EACtC,OAAOA,KAAK,CAACC,UAAU;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,4BAA4BA,CAAEF,KAAK,EAAG;EACrD,OAAOA,KAAK,CAACG,yBAAyB;AACvC","ignoreList":[]}
1
+ {"version":3,"names":["getEditorCanvasContainerView","state","editorCanvasContainerView","getRoutes","routes"],"sources":["@wordpress/edit-site/src/store/private-selectors.js"],"sourcesContent":["/**\n * Returns the editor canvas container view.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editor canvas container view.\n */\nexport function getEditorCanvasContainerView( state ) {\n\treturn state.editorCanvasContainerView;\n}\n\nexport function getRoutes( state ) {\n\treturn state.routes;\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,4BAA4BA,CAAEC,KAAK,EAAG;EACrD,OAAOA,KAAK,CAACC,yBAAyB;AACvC;AAEO,SAASC,SAASA,CAAEF,KAAK,EAAG;EAClC,OAAOA,KAAK,CAACG,MAAM;AACpB","ignoreList":[]}
@@ -67,22 +67,6 @@ function saveViewPanel(state = false, action) {
67
67
  switch (action.type) {
68
68
  case 'SET_IS_SAVE_VIEW_OPENED':
69
69
  return action.isOpen;
70
- case 'SET_CANVAS_MODE':
71
- return false;
72
- }
73
- return state;
74
- }
75
-
76
- /**
77
- * Reducer used to track the site editor canvas mode (edit or view).
78
- *
79
- * @param {Object} state Current state.
80
- * @param {Object} action Dispatched action.
81
- */
82
- function canvasMode(state = 'init', action) {
83
- switch (action.type) {
84
- case 'SET_CANVAS_MODE':
85
- return action.mode;
86
70
  }
87
71
  return state;
88
72
  }
@@ -102,11 +86,18 @@ function editorCanvasContainerView(state = undefined, action) {
102
86
  }
103
87
  return state;
104
88
  }
89
+ function routes(state = [], action) {
90
+ switch (action.type) {
91
+ case 'REGISTER_ROUTE':
92
+ return [...state, action.route];
93
+ }
94
+ return state;
95
+ }
105
96
  var _default = exports.default = (0, _data.combineReducers)({
106
97
  settings,
107
98
  editedPost,
108
99
  saveViewPanel,
109
- canvasMode,
110
- editorCanvasContainerView
100
+ editorCanvasContainerView,
101
+ routes
111
102
  });
112
103
  //# sourceMappingURL=reducer.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","settings","state","action","type","editedPost","postType","id","context","saveViewPanel","isOpen","canvasMode","mode","editorCanvasContainerView","undefined","view","_default","exports","default","combineReducers"],"sources":["@wordpress/edit-site/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning the settings.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function settings( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the currently edited Post Type,\n * Post Id and the context provided to fill the content of the block editor.\n *\n * @param {Object} state Current edited post.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function editedPost( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITED_POST':\n\t\t\treturn {\n\t\t\t\tpostType: action.postType,\n\t\t\t\tid: action.id,\n\t\t\t\tcontext: action.context,\n\t\t\t};\n\t\tcase 'SET_EDITED_POST_CONTEXT':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tcontext: action.context,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer to set the save view panel open or closed.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function saveViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_SAVE_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn false;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer used to track the site editor canvas mode (edit or view).\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nfunction canvasMode( state = 'init', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn action.mode;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer used to track the site editor canvas container view.\n * Default is `undefined`, denoting the default, visual block editor.\n * This could be, for example, `'style-book'` (the style book).\n *\n * @param {string|undefined} state Current state.\n * @param {Object} action Dispatched action.\n */\nfunction editorCanvasContainerView( state = undefined, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITOR_CANVAS_CONTAINER_VIEW':\n\t\t\treturn action.view;\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tsettings,\n\teditedPost,\n\tsaveViewPanel,\n\tcanvasMode,\n\teditorCanvasContainerView,\n} );\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAC9C,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,iBAAiB;MACrB,OAAO;QACN,GAAGF,KAAK;QACR,GAAGC,MAAM,CAACF;MACX,CAAC;EACH;EAEA,OAAOC,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,UAAUA,CAAEH,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAChD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,iBAAiB;MACrB,OAAO;QACNE,QAAQ,EAAEH,MAAM,CAACG,QAAQ;QACzBC,EAAE,EAAEJ,MAAM,CAACI,EAAE;QACbC,OAAO,EAAEL,MAAM,CAACK;MACjB,CAAC;IACF,KAAK,yBAAyB;MAC7B,OAAO;QACN,GAAGN,KAAK;QACRM,OAAO,EAAEL,MAAM,CAACK;MACjB,CAAC;EACH;EAEA,OAAON,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,aAAaA,CAAEP,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EACtD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,yBAAyB;MAC7B,OAAOD,MAAM,CAACO,MAAM;IACrB,KAAK,iBAAiB;MACrB,OAAO,KAAK;EACd;EACA,OAAOR,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASS,UAAUA,CAAET,KAAK,GAAG,MAAM,EAAEC,MAAM,EAAG;EAC7C,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,iBAAiB;MACrB,OAAOD,MAAM,CAACS,IAAI;EACpB;EAEA,OAAOV,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASW,yBAAyBA,CAAEX,KAAK,GAAGY,SAAS,EAAEX,MAAM,EAAG;EAC/D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,kCAAkC;MACtC,OAAOD,MAAM,CAACY,IAAI;EACpB;EAEA,OAAOb,KAAK;AACb;AAAC,IAAAc,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,qBAAe,EAAE;EAC/BlB,QAAQ;EACRI,UAAU;EACVI,aAAa;EACbE,UAAU;EACVE;AACD,CAAE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","settings","state","action","type","editedPost","postType","id","context","saveViewPanel","isOpen","editorCanvasContainerView","undefined","view","routes","route","_default","exports","default","combineReducers"],"sources":["@wordpress/edit-site/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning the settings.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function settings( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the currently edited Post Type,\n * Post Id and the context provided to fill the content of the block editor.\n *\n * @param {Object} state Current edited post.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function editedPost( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITED_POST':\n\t\t\treturn {\n\t\t\t\tpostType: action.postType,\n\t\t\t\tid: action.id,\n\t\t\t\tcontext: action.context,\n\t\t\t};\n\t\tcase 'SET_EDITED_POST_CONTEXT':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tcontext: action.context,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer to set the save view panel open or closed.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function saveViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_SAVE_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer used to track the site editor canvas container view.\n * Default is `undefined`, denoting the default, visual block editor.\n * This could be, for example, `'style-book'` (the style book).\n *\n * @param {string|undefined} state Current state.\n * @param {Object} action Dispatched action.\n */\nfunction editorCanvasContainerView( state = undefined, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITOR_CANVAS_CONTAINER_VIEW':\n\t\t\treturn action.view;\n\t}\n\n\treturn state;\n}\n\nfunction routes( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_ROUTE':\n\t\t\treturn [ ...state, action.route ];\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tsettings,\n\teditedPost,\n\tsaveViewPanel,\n\teditorCanvasContainerView,\n\troutes,\n} );\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAC9C,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,iBAAiB;MACrB,OAAO;QACN,GAAGF,KAAK;QACR,GAAGC,MAAM,CAACF;MACX,CAAC;EACH;EAEA,OAAOC,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,UAAUA,CAAEH,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAChD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,iBAAiB;MACrB,OAAO;QACNE,QAAQ,EAAEH,MAAM,CAACG,QAAQ;QACzBC,EAAE,EAAEJ,MAAM,CAACI,EAAE;QACbC,OAAO,EAAEL,MAAM,CAACK;MACjB,CAAC;IACF,KAAK,yBAAyB;MAC7B,OAAO;QACN,GAAGN,KAAK;QACRM,OAAO,EAAEL,MAAM,CAACK;MACjB,CAAC;EACH;EAEA,OAAON,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,aAAaA,CAAEP,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EACtD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,yBAAyB;MAC7B,OAAOD,MAAM,CAACO,MAAM;EACtB;EACA,OAAOR,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASS,yBAAyBA,CAAET,KAAK,GAAGU,SAAS,EAAET,MAAM,EAAG;EAC/D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,kCAAkC;MACtC,OAAOD,MAAM,CAACU,IAAI;EACpB;EAEA,OAAOX,KAAK;AACb;AAEA,SAASY,MAAMA,CAAEZ,KAAK,GAAG,EAAE,EAAEC,MAAM,EAAG;EACrC,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,gBAAgB;MACpB,OAAO,CAAE,GAAGF,KAAK,EAAEC,MAAM,CAACY,KAAK,CAAE;EACnC;EAEA,OAAOb,KAAK;AACb;AAAC,IAAAc,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,qBAAe,EAAE;EAC/BlB,QAAQ;EACRI,UAAU;EACVI,aAAa;EACbE,yBAAyB;EACzBG;AACD,CAAE,CAAC","ignoreList":[]}
@@ -46,7 +46,7 @@ export default function AddNewPostModal({
46
46
  });
47
47
  onSave(newPage);
48
48
  createSuccessNotice(sprintf(
49
- // translators: %s: Title of the created post e.g: "Hello world".
49
+ // translators: %s: Title of the created post or template, e.g: "Hello world".
50
50
  __('"%s" successfully created.'), decodeEntities(newPage.title?.rendered || title)), {
51
51
  type: 'snackbar'
52
52
  });
@@ -1 +1 @@
1
- {"version":3,"names":["Button","Modal","__experimentalHStack","HStack","__experimentalVStack","VStack","TextControl","__","sprintf","useDispatch","useRegistry","useSelect","useState","store","coreStore","noticesStore","decodeEntities","serialize","synchronizeBlocksWithTemplate","jsx","_jsx","jsxs","_jsxs","AddNewPostModal","postType","onSave","onClose","labels","select","getPostType","isCreatingPost","setIsCreatingPost","title","setTitle","saveEntityRecord","createErrorNotice","createSuccessNotice","resolveSelect","createPost","event","preventDefault","postTypeObject","newPage","status","slug","content","template","length","undefined","throwOnError","rendered","type","error","errorMessage","message","code","singular_name","onRequestClose","focusOnMount","size","children","onSubmit","spacing","__next40pxDefaultSize","__nextHasNoMarginBottom","label","onChange","placeholder","value","justify","variant","onClick","isBusy"],"sources":["@wordpress/edit-site/src/components/add-new-post/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tTextControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { serialize, synchronizeBlocksWithTemplate } from '@wordpress/blocks';\n\nexport default function AddNewPostModal( { postType, onSave, onClose } ) {\n\tconst labels = useSelect(\n\t\t( select ) => select( coreStore ).getPostType( postType )?.labels,\n\t\t[ postType ]\n\t);\n\tconst [ isCreatingPost, setIsCreatingPost ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { resolveSelect } = useRegistry();\n\n\tasync function createPost( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isCreatingPost ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingPost( true );\n\t\ttry {\n\t\t\tconst postTypeObject =\n\t\t\t\tawait resolveSelect( coreStore ).getPostType( postType );\n\t\t\tconst newPage = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\ttitle,\n\t\t\t\t\tslug: title || __( 'No title' ),\n\t\t\t\t\tcontent:\n\t\t\t\t\t\t!! postTypeObject.template &&\n\t\t\t\t\t\tpostTypeObject.template.length\n\t\t\t\t\t\t\t? serialize(\n\t\t\t\t\t\t\t\t\tsynchronizeBlocksWithTemplate(\n\t\t\t\t\t\t\t\t\t\t[],\n\t\t\t\t\t\t\t\t\t\tpostTypeObject.template\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tonSave( newPage );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created post e.g: \"Hello world\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newPage.title?.rendered || title )\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the item.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsCreatingPost( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={\n\t\t\t\t// translators: %s: post type singular_name label e.g: \"Page\".\n\t\t\t\tsprintf( __( 'Draft new: %s' ), labels?.singular_name )\n\t\t\t}\n\t\t\tonRequestClose={ onClose }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form onSubmit={ createPost }>\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isCreatingPost }\n\t\t\t\t\t\t\taria-disabled={ isCreatingPost }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create draft' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,MAAM,EACNC,KAAK,EACLC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,WAAW,QACL,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC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,EAAG,CAAG;QAAAF,QAAA,gBACpBxC,IAAA,CAACd,WAAW;UACXyD,qBAAqB;UACrBC,uBAAuB;UACvBC,KAAK,EAAG1D,EAAE,CAAE,OAAQ,CAAG;UACvB2D,QAAQ,EAAGjC,QAAU;UACrBkC,WAAW,EAAG5D,EAAE,CAAE,UAAW,CAAG;UAChC6D,KAAK,EAAGpC;QAAO,CACf,CAAC,eACFV,KAAA,CAACnB,MAAM;UAAC2D,OAAO,EAAG,CAAG;UAACO,OAAO,EAAC,KAAK;UAAAT,QAAA,gBAClCxC,IAAA,CAACpB,MAAM;YACN+D,qBAAqB;YACrBO,OAAO,EAAC,UAAU;YAClBC,OAAO,EAAG7C,OAAS;YAAAkC,QAAA,EAEjBrD,EAAE,CAAE,QAAS;UAAC,CACT,CAAC,eACTa,IAAA,CAACpB,MAAM;YACN+D,qBAAqB;YACrBO,OAAO,EAAC,SAAS;YACjBnB,IAAI,EAAC,QAAQ;YACbqB,MAAM,EAAG1C,cAAgB;YACzB,iBAAgBA,cAAgB;YAAA8B,QAAA,EAE9BrD,EAAE,CAAE,cAAe;UAAC,CACf,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
1
+ {"version":3,"names":["Button","Modal","__experimentalHStack","HStack","__experimentalVStack","VStack","TextControl","__","sprintf","useDispatch","useRegistry","useSelect","useState","store","coreStore","noticesStore","decodeEntities","serialize","synchronizeBlocksWithTemplate","jsx","_jsx","jsxs","_jsxs","AddNewPostModal","postType","onSave","onClose","labels","select","getPostType","isCreatingPost","setIsCreatingPost","title","setTitle","saveEntityRecord","createErrorNotice","createSuccessNotice","resolveSelect","createPost","event","preventDefault","postTypeObject","newPage","status","slug","content","template","length","undefined","throwOnError","rendered","type","error","errorMessage","message","code","singular_name","onRequestClose","focusOnMount","size","children","onSubmit","spacing","__next40pxDefaultSize","__nextHasNoMarginBottom","label","onChange","placeholder","value","justify","variant","onClick","isBusy"],"sources":["@wordpress/edit-site/src/components/add-new-post/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tTextControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { serialize, synchronizeBlocksWithTemplate } from '@wordpress/blocks';\n\nexport default function AddNewPostModal( { postType, onSave, onClose } ) {\n\tconst labels = useSelect(\n\t\t( select ) => select( coreStore ).getPostType( postType )?.labels,\n\t\t[ postType ]\n\t);\n\tconst [ isCreatingPost, setIsCreatingPost ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { resolveSelect } = useRegistry();\n\n\tasync function createPost( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isCreatingPost ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingPost( true );\n\t\ttry {\n\t\t\tconst postTypeObject =\n\t\t\t\tawait resolveSelect( coreStore ).getPostType( postType );\n\t\t\tconst newPage = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\ttitle,\n\t\t\t\t\tslug: title || __( 'No title' ),\n\t\t\t\t\tcontent:\n\t\t\t\t\t\t!! postTypeObject.template &&\n\t\t\t\t\t\tpostTypeObject.template.length\n\t\t\t\t\t\t\t? serialize(\n\t\t\t\t\t\t\t\t\tsynchronizeBlocksWithTemplate(\n\t\t\t\t\t\t\t\t\t\t[],\n\t\t\t\t\t\t\t\t\t\tpostTypeObject.template\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tonSave( newPage );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newPage.title?.rendered || title )\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the item.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsCreatingPost( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={\n\t\t\t\t// translators: %s: post type singular_name label e.g: \"Page\".\n\t\t\t\tsprintf( __( 'Draft new: %s' ), labels?.singular_name )\n\t\t\t}\n\t\t\tonRequestClose={ onClose }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form onSubmit={ createPost }>\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isCreatingPost }\n\t\t\t\t\t\t\taria-disabled={ isCreatingPost }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create draft' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,MAAM,EACNC,KAAK,EACLC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,WAAW,QACL,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,WAAW,EAAEC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACrE,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,SAAS,EAAEC,6BAA6B,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE7E,eAAe,SAASC,eAAeA,CAAE;EAAEC,QAAQ;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAG;EACxE,MAAMC,MAAM,GAAGhB,SAAS,CACrBiB,MAAM,IAAMA,MAAM,CAAEd,SAAU,CAAC,CAACe,WAAW,CAAEL,QAAS,CAAC,EAAEG,MAAM,EACjE,CAAEH,QAAQ,CACX,CAAC;EACD,MAAM,CAAEM,cAAc,EAAEC,iBAAiB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AG1C,cAAgB;YACzB,iBAAgBA,cAAgB;YAAA8B,QAAA,EAE9BrD,EAAE,CAAE,cAAe;UAAC,CACf,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
@@ -155,7 +155,7 @@ function NewTemplateModal({
155
155
  canvas: 'edit'
156
156
  });
157
157
  createSuccessNotice(sprintf(
158
- // translators: %s: Title of the created template e.g: "Category".
158
+ // translators: %s: Title of the created post or template, e.g: "Hello world".
159
159
  __('"%s" successfully created.'), decodeEntities(newTemplate.title?.rendered || title)), {
160
160
  type: 'snackbar'
161
161
  });
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","Button","Modal","__experimentalGrid","Grid","__experimentalText","Text","__experimentalVStack","VStack","Flex","Icon","decodeEntities","useState","memo","useSelect","useDispatch","store","coreStore","useViewportMatch","archive","blockMeta","calendar","category","commentAuthorAvatar","edit","home","layout","list","media","notFound","page","pin","verse","search","tag","__","sprintf","noticesStore","privateApis","routerPrivateApis","TEMPLATE_POST_TYPE","AddCustomTemplateModalContent","useExistingTemplates","useDefaultTemplateTypes","useTaxonomiesMenuItems","usePostTypeMenuItems","useAuthorMenuItem","usePostTypeArchiveMenuItems","AddCustomGenericTemplateModalContent","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useHistory","DEFAULT_TEMPLATE_SLUGS","TEMPLATE_ICONS","single","index","author","taxonomy","date","attachment","TemplateListItem","title","direction","className","description","icon","onClick","children","__next40pxDefaultSize","label","showTooltip","as","spacing","align","justify","style","width","alignment","weight","lineHeight","modalContentMap","templatesList","customTemplate","customGenericTemplate","NewTemplateModal","onClose","modalContent","setModalContent","entityForSuggestions","setEntityForSuggestions","isSubmitting","setIsSubmitting","missingTemplates","useMissingTemplates","history","saveEntityRecord","createErrorNotice","createSuccessNotice","isMobile","homeUrl","select","getEntityRecord","TEMPLATE_SHORT_DESCRIPTIONS","Date","getFullYear","createTemplate","template","isWPSuggestion","slug","newTemplate","toString","status","is_wp_suggestion","throwOnError","push","postId","id","postType","canvas","rendered","type","error","errorMessage","message","code","onModalClose","modalTitle","labels","singular_name","onRequestClose","overlayClassName","undefined","columns","gap","map","onSelect","NewTemplate","showModal","setShowModal","getPostType","variant","add_new_item","existingTemplates","defaultTemplateTypes","existingTemplateSlugs","missingDefaultTemplates","filter","includes","onClickMenuItem","_entityForSuggestions","enhancedMissingDefaultTemplateTypes","defaultTaxonomiesMenuItems","taxonomiesMenuItems","defaultPostTypesMenuItems","postTypesMenuItems","authorMenuItem","forEach","menuItem","matchIndex","findIndex","sort","template1","template2","indexOf"],"sources":["@wordpress/edit-site/src/components/add-new-template/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalGrid as Grid,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\tFlex,\n\tIcon,\n} from '@wordpress/components';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState, memo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tarchive,\n\tblockMeta,\n\tcalendar,\n\tcategory,\n\tcommentAuthorAvatar,\n\tedit,\n\thome,\n\tlayout,\n\tlist,\n\tmedia,\n\tnotFound,\n\tpage,\n\tpin,\n\tverse,\n\tsearch,\n\ttag,\n} from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\n/**\n * Internal dependencies\n */\nimport AddCustomTemplateModalContent from './add-custom-template-modal-content';\nimport {\n\tuseExistingTemplates,\n\tuseDefaultTemplateTypes,\n\tuseTaxonomiesMenuItems,\n\tusePostTypeMenuItems,\n\tuseAuthorMenuItem,\n\tusePostTypeArchiveMenuItems,\n} from './utils';\nimport AddCustomGenericTemplateModalContent from './add-custom-generic-template-modal-content';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst DEFAULT_TEMPLATE_SLUGS = [\n\t'front-page',\n\t'home',\n\t'single',\n\t'page',\n\t'index',\n\t'archive',\n\t'author',\n\t'category',\n\t'date',\n\t'tag',\n\t'search',\n\t'404',\n];\n\nconst TEMPLATE_ICONS = {\n\t'front-page': home,\n\thome: verse,\n\tsingle: pin,\n\tpage,\n\tarchive,\n\tsearch,\n\t404: notFound,\n\tindex: list,\n\tcategory,\n\tauthor: commentAuthorAvatar,\n\ttaxonomy: blockMeta,\n\tdate: calendar,\n\ttag,\n\tattachment: media,\n};\n\nfunction TemplateListItem( {\n\ttitle,\n\tdirection,\n\tclassName,\n\tdescription,\n\ticon,\n\tonClick,\n\tchildren,\n} ) {\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName={ className }\n\t\t\tonClick={ onClick }\n\t\t\tlabel={ description }\n\t\t\tshowTooltip={ !! description }\n\t\t>\n\t\t\t<Flex\n\t\t\t\tas=\"span\"\n\t\t\t\tspacing={ 2 }\n\t\t\t\talign=\"center\"\n\t\t\t\tjustify=\"center\"\n\t\t\t\tstyle={ { width: '100%' } }\n\t\t\t\tdirection={ direction }\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-add-new-template__template-icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t\t<VStack\n\t\t\t\t\tclassName=\"edit-site-add-new-template__template-name\"\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tspacing={ 0 }\n\t\t\t\t>\n\t\t\t\t\t<Text\n\t\t\t\t\t\talign=\"center\"\n\t\t\t\t\t\tweight={ 500 }\n\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Text>\n\t\t\t\t\t{ children }\n\t\t\t\t</VStack>\n\t\t\t</Flex>\n\t\t</Button>\n\t);\n}\n\nconst modalContentMap = {\n\ttemplatesList: 1,\n\tcustomTemplate: 2,\n\tcustomGenericTemplate: 3,\n};\n\nfunction NewTemplateModal( { onClose } ) {\n\tconst [ modalContent, setModalContent ] = useState(\n\t\tmodalContentMap.templatesList\n\t);\n\tconst [ entityForSuggestions, setEntityForSuggestions ] = useState( {} );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst missingTemplates = useMissingTemplates( setEntityForSuggestions, () =>\n\t\tsetModalContent( modalContentMap.customTemplate )\n\t);\n\tconst history = useHistory();\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\n\tconst homeUrl = useSelect( ( select ) => {\n\t\t// Site index.\n\t\treturn select( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t?.home;\n\t}, [] );\n\n\tconst TEMPLATE_SHORT_DESCRIPTIONS = {\n\t\t'front-page': homeUrl,\n\t\tdate: sprintf(\n\t\t\t// translators: %s: The homepage url.\n\t\t\t__( 'E.g. %s' ),\n\t\t\thomeUrl + '/' + new Date().getFullYear()\n\t\t),\n\t};\n\n\tasync function createTemplate( template, isWPSuggestion = true ) {\n\t\tif ( isSubmitting ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsSubmitting( true );\n\t\ttry {\n\t\t\tconst { title, description, slug } = template;\n\t\t\tconst newTemplate = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tdescription,\n\t\t\t\t\t// Slugs need to be strings, so this is for template `404`\n\t\t\t\t\tslug: slug.toString(),\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\ttitle,\n\t\t\t\t\t// This adds a post meta field in template that is part of `is_custom` value calculation.\n\t\t\t\t\tis_wp_suggestion: isWPSuggestion,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// Navigate to the created template editor.\n\t\t\thistory.push( {\n\t\t\t\tpostId: newTemplate.id,\n\t\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newTemplate.title?.rendered || title )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsSubmitting( false );\n\t\t}\n\t}\n\tconst onModalClose = () => {\n\t\tonClose();\n\t\tsetModalContent( modalContentMap.templatesList );\n\t};\n\n\tlet modalTitle = __( 'Add template' );\n\tif ( modalContent === modalContentMap.customTemplate ) {\n\t\tmodalTitle = sprintf(\n\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t__( 'Add template: %s' ),\n\t\t\tentityForSuggestions.labels.singular_name\n\t\t);\n\t} else if ( modalContent === modalContentMap.customGenericTemplate ) {\n\t\tmodalTitle = __( 'Create custom template' );\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ modalTitle }\n\t\t\tclassName={ clsx( 'edit-site-add-new-template__modal', {\n\t\t\t\t'edit-site-add-new-template__modal_template_list':\n\t\t\t\t\tmodalContent === modalContentMap.templatesList,\n\t\t\t\t'edit-site-custom-template-modal':\n\t\t\t\t\tmodalContent === modalContentMap.customTemplate,\n\t\t\t} ) }\n\t\t\tonRequestClose={ onModalClose }\n\t\t\toverlayClassName={\n\t\t\t\tmodalContent === modalContentMap.customGenericTemplate\n\t\t\t\t\t? 'edit-site-custom-generic-template__modal'\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t>\n\t\t\t{ modalContent === modalContentMap.templatesList && (\n\t\t\t\t<Grid\n\t\t\t\t\tcolumns={ isMobile ? 2 : 3 }\n\t\t\t\t\tgap={ 4 }\n\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\tclassName=\"edit-site-add-new-template__template-list__contents\"\n\t\t\t\t>\n\t\t\t\t\t<Flex className=\"edit-site-add-new-template__template-list__prompt\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select what the new template should apply to:'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Flex>\n\t\t\t\t\t{ missingTemplates.map( ( template ) => {\n\t\t\t\t\t\tconst { title, slug, onClick } = template;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<TemplateListItem\n\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\tclassName=\"edit-site-add-new-template__template-button\"\n\t\t\t\t\t\t\t\tdescription={\n\t\t\t\t\t\t\t\t\tTEMPLATE_SHORT_DESCRIPTIONS[ slug ]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ticon={ TEMPLATE_ICONS[ slug ] || layout }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tonClick\n\t\t\t\t\t\t\t\t\t\t? onClick( template )\n\t\t\t\t\t\t\t\t\t\t: createTemplate( template )\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} ) }\n\t\t\t\t\t<TemplateListItem\n\t\t\t\t\t\ttitle={ __( 'Custom template' ) }\n\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\tclassName=\"edit-site-add-new-template__custom-template-button\"\n\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetModalContent(\n\t\t\t\t\t\t\t\tmodalContentMap.customGenericTemplate\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</TemplateListItem>\n\t\t\t\t</Grid>\n\t\t\t) }\n\t\t\t{ modalContent === modalContentMap.customTemplate && (\n\t\t\t\t<AddCustomTemplateModalContent\n\t\t\t\t\tonSelect={ createTemplate }\n\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ modalContent === modalContentMap.customGenericTemplate && (\n\t\t\t\t<AddCustomGenericTemplateModalContent\n\t\t\t\t\tonClose={ onModalClose }\n\t\t\t\t\tcreateTemplate={ createTemplate }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Modal>\n\t);\n}\n\nfunction NewTemplate() {\n\tconst [ showModal, setShowModal ] = useState( false );\n\n\tconst { postType } = useSelect( ( select ) => {\n\t\tconst { getPostType } = select( coreStore );\n\n\t\treturn {\n\t\t\tpostType: getPostType( TEMPLATE_POST_TYPE ),\n\t\t};\n\t}, [] );\n\n\tif ( ! postType ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () => setShowModal( true ) }\n\t\t\t\tlabel={ postType.labels.add_new_item }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t>\n\t\t\t\t{ postType.labels.add_new_item }\n\t\t\t</Button>\n\t\t\t{ showModal && (\n\t\t\t\t<NewTemplateModal onClose={ () => setShowModal( false ) } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction useMissingTemplates( setEntityForSuggestions, onClick ) {\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst missingDefaultTemplates = ( defaultTemplateTypes || [] ).filter(\n\t\t( template ) =>\n\t\t\tDEFAULT_TEMPLATE_SLUGS.includes( template.slug ) &&\n\t\t\t! existingTemplateSlugs.includes( template.slug )\n\t);\n\tconst onClickMenuItem = ( _entityForSuggestions ) => {\n\t\tonClick?.();\n\t\tsetEntityForSuggestions( _entityForSuggestions );\n\t};\n\t// We need to replace existing default template types with\n\t// the create specific template functionality. The original\n\t// info (title, description, etc.) is preserved in the\n\t// used hooks.\n\tconst enhancedMissingDefaultTemplateTypes = [ ...missingDefaultTemplates ];\n\tconst { defaultTaxonomiesMenuItems, taxonomiesMenuItems } =\n\t\tuseTaxonomiesMenuItems( onClickMenuItem );\n\tconst { defaultPostTypesMenuItems, postTypesMenuItems } =\n\t\tusePostTypeMenuItems( onClickMenuItem );\n\n\tconst authorMenuItem = useAuthorMenuItem( onClickMenuItem );\n\t[\n\t\t...defaultTaxonomiesMenuItems,\n\t\t...defaultPostTypesMenuItems,\n\t\tauthorMenuItem,\n\t].forEach( ( menuItem ) => {\n\t\tif ( ! menuItem ) {\n\t\t\treturn;\n\t\t}\n\t\tconst matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(\n\t\t\t( template ) => template.slug === menuItem.slug\n\t\t);\n\t\t// Some default template types might have been filtered above from\n\t\t// `missingDefaultTemplates` because they only check for the general\n\t\t// template. So here we either replace or append the item, augmented\n\t\t// with the check if it has available specific item to create a\n\t\t// template for.\n\t\tif ( matchIndex > -1 ) {\n\t\t\tenhancedMissingDefaultTemplateTypes[ matchIndex ] = menuItem;\n\t\t} else {\n\t\t\tenhancedMissingDefaultTemplateTypes.push( menuItem );\n\t\t}\n\t} );\n\t// Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.\n\tenhancedMissingDefaultTemplateTypes?.sort( ( template1, template2 ) => {\n\t\treturn (\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template1.slug ) -\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template2.slug )\n\t\t);\n\t} );\n\tconst missingTemplates = [\n\t\t...enhancedMissingDefaultTemplateTypes,\n\t\t...usePostTypeArchiveMenuItems(),\n\t\t...postTypesMenuItems,\n\t\t...taxonomiesMenuItems,\n\t];\n\treturn missingTemplates;\n}\n\nexport default memo( NewTemplate );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,MAAM,EACNC,KAAK,EACLC,kBAAkB,IAAIC,IAAI,EAC1BC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,EAC9BC,IAAI,EACJC,IAAI,QACE,uBAAuB;AAC9B,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,QAAQ,EAAEC,IAAI,QAAQ,oBAAoB;AACnD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SACCC,OAAO,EACPC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,mBAAmB,EACnBC,IAAI,EACJC,IAAI,EACJC,MAAM,EACNC,IAAI,EACJC,KAAK,EACLC,QAAQ,EACRC,IAAI,EACJC,GAAG,EACHC,KAAK,EACLC,MAAM,EACNC,GAAG,QACG,kBAAkB;AACzB,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB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CACd,CAACC,OAAO,CAAIC,QAAQ,IAAM;IAC1B,IAAK,CAAEA,QAAQ,EAAG;MACjB;IACD;IACA,MAAMC,UAAU,GAAGR,mCAAmC,CAACS,SAAS,CAC7DrD,QAAQ,IAAMA,QAAQ,CAACE,IAAI,KAAKiD,QAAQ,CAACjD,IAC5C,CAAC;IACD;IACA;IACA;IACA;IACA;IACA,IAAKkD,UAAU,GAAG,CAAC,CAAC,EAAG;MACtBR,mCAAmC,CAAEQ,UAAU,CAAE,GAAGD,QAAQ;IAC7D,CAAC,MAAM;MACNP,mCAAmC,CAACpC,IAAI,CAAE2C,QAAS,CAAC;IACrD;EACD,CAAE,CAAC;EACH;EACAP,mCAAmC,EAAEU,IAAI,CAAE,CAAEC,SAAS,EAAEC,SAAS,KAAM;IACtE,OACC9G,sBAAsB,CAAC+G,OAAO,CAAEF,SAAS,CAACrD,IAAK,CAAC,GAChDxD,sBAAsB,CAAC+G,OAAO,CAAED,SAAS,CAACtD,IAAK,CAAC;EAElD,CAAE,CAAC;EACH,MAAMhB,gBAAgB,GAAG,CACxB,GAAG0D,mCAAmC,EACtC,GAAG5G,2BAA2B,CAAC,CAAC,EAChC,GAAGgH,kBAAkB,EACrB,GAAGF,mBAAmB,CACtB;EACD,OAAO5D,gBAAgB;AACxB;AAEA,eAAepF,IAAI,CAAEgI,WAAY,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["clsx","Button","Modal","__experimentalGrid","Grid","__experimentalText","Text","__experimentalVStack","VStack","Flex","Icon","decodeEntities","useState","memo","useSelect","useDispatch","store","coreStore","useViewportMatch","archive","blockMeta","calendar","category","commentAuthorAvatar","edit","home","layout","list","media","notFound","page","pin","verse","search","tag","__","sprintf","noticesStore","privateApis","routerPrivateApis","TEMPLATE_POST_TYPE","AddCustomTemplateModalContent","useExistingTemplates","useDefaultTemplateTypes","useTaxonomiesMenuItems","usePostTypeMenuItems","useAuthorMenuItem","usePostTypeArchiveMenuItems","AddCustomGenericTemplateModalContent","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useHistory","DEFAULT_TEMPLATE_SLUGS","TEMPLATE_ICONS","single","index","author","taxonomy","date","attachment","TemplateListItem","title","direction","className","description","icon","onClick","children","__next40pxDefaultSize","label","showTooltip","as","spacing","align","justify","style","width","alignment","weight","lineHeight","modalContentMap","templatesList","customTemplate","customGenericTemplate","NewTemplateModal","onClose","modalContent","setModalContent","entityForSuggestions","setEntityForSuggestions","isSubmitting","setIsSubmitting","missingTemplates","useMissingTemplates","history","saveEntityRecord","createErrorNotice","createSuccessNotice","isMobile","homeUrl","select","getEntityRecord","TEMPLATE_SHORT_DESCRIPTIONS","Date","getFullYear","createTemplate","template","isWPSuggestion","slug","newTemplate","toString","status","is_wp_suggestion","throwOnError","push","postId","id","postType","canvas","rendered","type","error","errorMessage","message","code","onModalClose","modalTitle","labels","singular_name","onRequestClose","overlayClassName","undefined","columns","gap","map","onSelect","NewTemplate","showModal","setShowModal","getPostType","variant","add_new_item","existingTemplates","defaultTemplateTypes","existingTemplateSlugs","missingDefaultTemplates","filter","includes","onClickMenuItem","_entityForSuggestions","enhancedMissingDefaultTemplateTypes","defaultTaxonomiesMenuItems","taxonomiesMenuItems","defaultPostTypesMenuItems","postTypesMenuItems","authorMenuItem","forEach","menuItem","matchIndex","findIndex","sort","template1","template2","indexOf"],"sources":["@wordpress/edit-site/src/components/add-new-template/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalGrid as Grid,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\tFlex,\n\tIcon,\n} from '@wordpress/components';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState, memo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tarchive,\n\tblockMeta,\n\tcalendar,\n\tcategory,\n\tcommentAuthorAvatar,\n\tedit,\n\thome,\n\tlayout,\n\tlist,\n\tmedia,\n\tnotFound,\n\tpage,\n\tpin,\n\tverse,\n\tsearch,\n\ttag,\n} from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\n/**\n * Internal dependencies\n */\nimport AddCustomTemplateModalContent from './add-custom-template-modal-content';\nimport {\n\tuseExistingTemplates,\n\tuseDefaultTemplateTypes,\n\tuseTaxonomiesMenuItems,\n\tusePostTypeMenuItems,\n\tuseAuthorMenuItem,\n\tusePostTypeArchiveMenuItems,\n} from './utils';\nimport AddCustomGenericTemplateModalContent from './add-custom-generic-template-modal-content';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst DEFAULT_TEMPLATE_SLUGS = [\n\t'front-page',\n\t'home',\n\t'single',\n\t'page',\n\t'index',\n\t'archive',\n\t'author',\n\t'category',\n\t'date',\n\t'tag',\n\t'search',\n\t'404',\n];\n\nconst TEMPLATE_ICONS = {\n\t'front-page': home,\n\thome: verse,\n\tsingle: pin,\n\tpage,\n\tarchive,\n\tsearch,\n\t404: notFound,\n\tindex: list,\n\tcategory,\n\tauthor: commentAuthorAvatar,\n\ttaxonomy: blockMeta,\n\tdate: calendar,\n\ttag,\n\tattachment: media,\n};\n\nfunction TemplateListItem( {\n\ttitle,\n\tdirection,\n\tclassName,\n\tdescription,\n\ticon,\n\tonClick,\n\tchildren,\n} ) {\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName={ className }\n\t\t\tonClick={ onClick }\n\t\t\tlabel={ description }\n\t\t\tshowTooltip={ !! description }\n\t\t>\n\t\t\t<Flex\n\t\t\t\tas=\"span\"\n\t\t\t\tspacing={ 2 }\n\t\t\t\talign=\"center\"\n\t\t\t\tjustify=\"center\"\n\t\t\t\tstyle={ { width: '100%' } }\n\t\t\t\tdirection={ direction }\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-add-new-template__template-icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t\t<VStack\n\t\t\t\t\tclassName=\"edit-site-add-new-template__template-name\"\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tspacing={ 0 }\n\t\t\t\t>\n\t\t\t\t\t<Text\n\t\t\t\t\t\talign=\"center\"\n\t\t\t\t\t\tweight={ 500 }\n\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Text>\n\t\t\t\t\t{ children }\n\t\t\t\t</VStack>\n\t\t\t</Flex>\n\t\t</Button>\n\t);\n}\n\nconst modalContentMap = {\n\ttemplatesList: 1,\n\tcustomTemplate: 2,\n\tcustomGenericTemplate: 3,\n};\n\nfunction NewTemplateModal( { onClose } ) {\n\tconst [ modalContent, setModalContent ] = useState(\n\t\tmodalContentMap.templatesList\n\t);\n\tconst [ entityForSuggestions, setEntityForSuggestions ] = useState( {} );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst missingTemplates = useMissingTemplates( setEntityForSuggestions, () =>\n\t\tsetModalContent( modalContentMap.customTemplate )\n\t);\n\tconst history = useHistory();\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\n\tconst homeUrl = useSelect( ( select ) => {\n\t\t// Site index.\n\t\treturn select( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t?.home;\n\t}, [] );\n\n\tconst TEMPLATE_SHORT_DESCRIPTIONS = {\n\t\t'front-page': homeUrl,\n\t\tdate: sprintf(\n\t\t\t// translators: %s: The homepage url.\n\t\t\t__( 'E.g. %s' ),\n\t\t\thomeUrl + '/' + new Date().getFullYear()\n\t\t),\n\t};\n\n\tasync function createTemplate( template, isWPSuggestion = true ) {\n\t\tif ( isSubmitting ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsSubmitting( true );\n\t\ttry {\n\t\t\tconst { title, description, slug } = template;\n\t\t\tconst newTemplate = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tdescription,\n\t\t\t\t\t// Slugs need to be strings, so this is for template `404`\n\t\t\t\t\tslug: slug.toString(),\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\ttitle,\n\t\t\t\t\t// This adds a post meta field in template that is part of `is_custom` value calculation.\n\t\t\t\t\tis_wp_suggestion: isWPSuggestion,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// Navigate to the created template editor.\n\t\t\thistory.push( {\n\t\t\t\tpostId: newTemplate.id,\n\t\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newTemplate.title?.rendered || title )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsSubmitting( false );\n\t\t}\n\t}\n\tconst onModalClose = () => {\n\t\tonClose();\n\t\tsetModalContent( modalContentMap.templatesList );\n\t};\n\n\tlet modalTitle = __( 'Add template' );\n\tif ( modalContent === modalContentMap.customTemplate ) {\n\t\tmodalTitle = sprintf(\n\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t__( 'Add template: %s' ),\n\t\t\tentityForSuggestions.labels.singular_name\n\t\t);\n\t} else if ( modalContent === modalContentMap.customGenericTemplate ) {\n\t\tmodalTitle = __( 'Create custom template' );\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ modalTitle }\n\t\t\tclassName={ clsx( 'edit-site-add-new-template__modal', {\n\t\t\t\t'edit-site-add-new-template__modal_template_list':\n\t\t\t\t\tmodalContent === modalContentMap.templatesList,\n\t\t\t\t'edit-site-custom-template-modal':\n\t\t\t\t\tmodalContent === modalContentMap.customTemplate,\n\t\t\t} ) }\n\t\t\tonRequestClose={ onModalClose }\n\t\t\toverlayClassName={\n\t\t\t\tmodalContent === modalContentMap.customGenericTemplate\n\t\t\t\t\t? 'edit-site-custom-generic-template__modal'\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t>\n\t\t\t{ modalContent === modalContentMap.templatesList && (\n\t\t\t\t<Grid\n\t\t\t\t\tcolumns={ isMobile ? 2 : 3 }\n\t\t\t\t\tgap={ 4 }\n\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\tclassName=\"edit-site-add-new-template__template-list__contents\"\n\t\t\t\t>\n\t\t\t\t\t<Flex className=\"edit-site-add-new-template__template-list__prompt\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select what the new template should apply to:'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Flex>\n\t\t\t\t\t{ missingTemplates.map( ( template ) => {\n\t\t\t\t\t\tconst { title, slug, onClick } = template;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<TemplateListItem\n\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\tclassName=\"edit-site-add-new-template__template-button\"\n\t\t\t\t\t\t\t\tdescription={\n\t\t\t\t\t\t\t\t\tTEMPLATE_SHORT_DESCRIPTIONS[ slug ]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ticon={ TEMPLATE_ICONS[ slug ] || layout }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tonClick\n\t\t\t\t\t\t\t\t\t\t? onClick( template )\n\t\t\t\t\t\t\t\t\t\t: createTemplate( template )\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} ) }\n\t\t\t\t\t<TemplateListItem\n\t\t\t\t\t\ttitle={ __( 'Custom template' ) }\n\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\tclassName=\"edit-site-add-new-template__custom-template-button\"\n\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetModalContent(\n\t\t\t\t\t\t\t\tmodalContentMap.customGenericTemplate\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</TemplateListItem>\n\t\t\t\t</Grid>\n\t\t\t) }\n\t\t\t{ modalContent === modalContentMap.customTemplate && (\n\t\t\t\t<AddCustomTemplateModalContent\n\t\t\t\t\tonSelect={ createTemplate }\n\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ modalContent === modalContentMap.customGenericTemplate && (\n\t\t\t\t<AddCustomGenericTemplateModalContent\n\t\t\t\t\tonClose={ onModalClose }\n\t\t\t\t\tcreateTemplate={ createTemplate }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Modal>\n\t);\n}\n\nfunction NewTemplate() {\n\tconst [ showModal, setShowModal ] = useState( false );\n\n\tconst { postType } = useSelect( ( select ) => {\n\t\tconst { getPostType } = select( coreStore );\n\n\t\treturn {\n\t\t\tpostType: getPostType( TEMPLATE_POST_TYPE ),\n\t\t};\n\t}, [] );\n\n\tif ( ! postType ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () => setShowModal( true ) }\n\t\t\t\tlabel={ postType.labels.add_new_item }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t>\n\t\t\t\t{ postType.labels.add_new_item }\n\t\t\t</Button>\n\t\t\t{ showModal && (\n\t\t\t\t<NewTemplateModal onClose={ () => setShowModal( false ) } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction useMissingTemplates( setEntityForSuggestions, onClick ) {\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst missingDefaultTemplates = ( defaultTemplateTypes || [] ).filter(\n\t\t( template ) =>\n\t\t\tDEFAULT_TEMPLATE_SLUGS.includes( template.slug ) &&\n\t\t\t! existingTemplateSlugs.includes( template.slug )\n\t);\n\tconst onClickMenuItem = ( _entityForSuggestions ) => {\n\t\tonClick?.();\n\t\tsetEntityForSuggestions( _entityForSuggestions );\n\t};\n\t// We need to replace existing default template types with\n\t// the create specific template functionality. The original\n\t// info (title, description, etc.) is preserved in the\n\t// used hooks.\n\tconst enhancedMissingDefaultTemplateTypes = [ ...missingDefaultTemplates ];\n\tconst { defaultTaxonomiesMenuItems, taxonomiesMenuItems } =\n\t\tuseTaxonomiesMenuItems( onClickMenuItem );\n\tconst { defaultPostTypesMenuItems, postTypesMenuItems } =\n\t\tusePostTypeMenuItems( onClickMenuItem );\n\n\tconst authorMenuItem = useAuthorMenuItem( onClickMenuItem );\n\t[\n\t\t...defaultTaxonomiesMenuItems,\n\t\t...defaultPostTypesMenuItems,\n\t\tauthorMenuItem,\n\t].forEach( ( menuItem ) => {\n\t\tif ( ! menuItem ) {\n\t\t\treturn;\n\t\t}\n\t\tconst matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(\n\t\t\t( template ) => template.slug === menuItem.slug\n\t\t);\n\t\t// Some default template types might have been filtered above from\n\t\t// `missingDefaultTemplates` because they only check for the general\n\t\t// template. So here we either replace or append the item, augmented\n\t\t// with the check if it has available specific item to create a\n\t\t// template for.\n\t\tif ( matchIndex > -1 ) {\n\t\t\tenhancedMissingDefaultTemplateTypes[ matchIndex ] = menuItem;\n\t\t} else {\n\t\t\tenhancedMissingDefaultTemplateTypes.push( menuItem );\n\t\t}\n\t} );\n\t// Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.\n\tenhancedMissingDefaultTemplateTypes?.sort( ( template1, template2 ) => {\n\t\treturn (\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template1.slug ) -\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template2.slug )\n\t\t);\n\t} );\n\tconst missingTemplates = [\n\t\t...enhancedMissingDefaultTemplateTypes,\n\t\t...usePostTypeArchiveMenuItems(),\n\t\t...postTypesMenuItems,\n\t\t...taxonomiesMenuItems,\n\t];\n\treturn missingTemplates;\n}\n\nexport default memo( NewTemplate );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,MAAM,EACNC,KAAK,EACLC,kBAAkB,IAAIC,IAAI,EAC1BC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,EAC9BC,IAAI,EACJC,IAAI,QACE,uBAAuB;AAC9B,SAASC,cAAc,QAAQ,0BAA0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AAgB;AACxB;AAEA,eAAepF,IAAI,CAAEgI,WAAY,CAAC","ignoreList":[]}
@@ -6,7 +6,7 @@ import { store as coreStore } from '@wordpress/core-data';
6
6
  import { store as editorStore } from '@wordpress/editor';
7
7
  import { decodeEntities } from '@wordpress/html-entities';
8
8
  import { useMemo, useCallback } from '@wordpress/element';
9
- import { __, sprintf } from '@wordpress/i18n';
9
+ import { __, _x, sprintf } from '@wordpress/i18n';
10
10
  import { blockMeta, post, archive } from '@wordpress/icons';
11
11
 
12
12
  /**
@@ -182,10 +182,10 @@ export const usePostTypeMenuItems = onClickMenuItem => {
182
182
  __('Single item: %s'), labels.singular_name);
183
183
  if (_needsUniqueIdentifier) {
184
184
  menuItemTitle = labels.template_name ? sprintf(
185
- // translators: %1s: Name of the template e.g: "Single Item: Post"; %2s: Slug of the post type e.g: "book".
186
- __('%1$s (%2$s)'), labels.template_name, slug) : sprintf(
187
- // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book".
188
- __('Single item: %1$s (%2$s)'), labels.singular_name, slug);
185
+ // translators: 1: Name of the template e.g: "Single Item: Post". 2: Slug of the post type e.g: "book".
186
+ _x('%1$s (%2$s)', 'post type menu label'), labels.template_name, slug) : sprintf(
187
+ // translators: 1: Name of the post type e.g: "Post". 2: Slug of the post type e.g: "book".
188
+ _x('Single item: %1$s (%2$s)', 'post type menu label'), labels.singular_name, slug);
189
189
  }
190
190
  const menuItem = defaultTemplateType ? {
191
191
  ...defaultTemplateType,
@@ -315,10 +315,10 @@ export const useTaxonomiesMenuItems = onClickMenuItem => {
315
315
  let menuItemTitle = labels.template_name || labels.singular_name;
316
316
  if (_needsUniqueIdentifier) {
317
317
  menuItemTitle = labels.template_name ? sprintf(
318
- // translators: %1s: Name of the template e.g: "Products by Category"; %2s: Slug of the taxonomy e.g: "product_cat".
319
- __('%1$s (%2$s)'), labels.template_name, slug) : sprintf(
320
- // translators: %1s: Name of the taxonomy e.g: "Category"; %2s: Slug of the taxonomy e.g: "product_cat".
321
- __('%1$s (%2$s)'), labels.singular_name, slug);
318
+ // translators: 1: Name of the template e.g: "Products by Category". 2s: Slug of the taxonomy e.g: "product_cat".
319
+ _x('%1$s (%2$s)', 'taxonomy template menu label'), labels.template_name, slug) : sprintf(
320
+ // translators: 1: Name of the taxonomy e.g: "Category". 2: Slug of the taxonomy e.g: "product_cat".
321
+ _x('%1$s (%2$s)', 'taxonomy menu label'), labels.singular_name, slug);
322
322
  }
323
323
  const menuItem = defaultTemplateType ? {
324
324
  ...defaultTemplateType,