@wordpress/edit-site 5.8.0 → 5.10.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 (471) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/add-custom-template-modal.js +21 -6
  3. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  4. package/build/components/add-new-template/new-template-part.js +8 -2
  5. package/build/components/add-new-template/new-template-part.js.map +1 -1
  6. package/build/components/add-new-template/new-template.js +8 -4
  7. package/build/components/add-new-template/new-template.js.map +1 -1
  8. package/build/components/app/index.js +8 -2
  9. package/build/components/app/index.js.map +1 -1
  10. package/build/components/block-editor/back-button.js +10 -3
  11. package/build/components/block-editor/back-button.js.map +1 -1
  12. package/build/components/block-editor/editor-canvas.js +39 -6
  13. package/build/components/block-editor/editor-canvas.js.map +1 -1
  14. package/build/components/block-editor/index.js +7 -7
  15. package/build/components/block-editor/index.js.map +1 -1
  16. package/build/components/editor/index.js +43 -9
  17. package/build/components/editor/index.js.map +1 -1
  18. package/build/components/editor-canvas-container/index.js +131 -0
  19. package/build/components/editor-canvas-container/index.js.map +1 -0
  20. package/build/components/global-styles/block-preview-panel.js +1 -1
  21. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  22. package/build/components/global-styles/border-panel.js +53 -5
  23. package/build/components/global-styles/border-panel.js.map +1 -1
  24. package/build/components/global-styles/color-palette-panel.js +14 -3
  25. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  26. package/build/components/global-styles/dimensions-panel.js +17 -18
  27. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  28. package/build/components/global-styles/global-styles-provider.js +4 -18
  29. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  30. package/build/components/global-styles/gradients-palette-panel.js +14 -3
  31. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  32. package/build/components/global-styles/root-menu.js +61 -0
  33. package/build/components/global-styles/root-menu.js.map +1 -0
  34. package/build/components/global-styles/screen-block-list.js +3 -1
  35. package/build/components/global-styles/screen-block-list.js.map +1 -1
  36. package/build/components/global-styles/screen-block.js +158 -7
  37. package/build/components/global-styles/screen-block.js.map +1 -1
  38. package/build/components/global-styles/screen-colors.js +9 -26
  39. package/build/components/global-styles/screen-colors.js.map +1 -1
  40. package/build/components/global-styles/screen-css.js +20 -15
  41. package/build/components/global-styles/screen-css.js.map +1 -1
  42. package/build/components/global-styles/screen-layout.js +4 -17
  43. package/build/components/global-styles/screen-layout.js.map +1 -1
  44. package/build/components/global-styles/screen-revisions/index.js +148 -0
  45. package/build/components/global-styles/screen-revisions/index.js.map +1 -0
  46. package/build/components/global-styles/screen-revisions/revisions-buttons.js +132 -0
  47. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
  48. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +130 -0
  49. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
  50. package/build/components/global-styles/screen-root.js +2 -2
  51. package/build/components/global-styles/screen-root.js.map +1 -1
  52. package/build/components/global-styles/screen-typography-element.js +0 -3
  53. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  54. package/build/components/global-styles/screen-typography.js +11 -39
  55. package/build/components/global-styles/screen-typography.js.map +1 -1
  56. package/build/components/global-styles/style-variations-container.js +3 -8
  57. package/build/components/global-styles/style-variations-container.js.map +1 -1
  58. package/build/components/global-styles/typography-panel.js +7 -11
  59. package/build/components/global-styles/typography-panel.js.map +1 -1
  60. package/build/components/global-styles/ui.js +66 -120
  61. package/build/components/global-styles/ui.js.map +1 -1
  62. package/build/components/global-styles/variations-panel.js +4 -28
  63. package/build/components/global-styles/variations-panel.js.map +1 -1
  64. package/build/components/header-edit-mode/index.js +11 -7
  65. package/build/components/header-edit-mode/index.js.map +1 -1
  66. package/build/components/keyboard-shortcuts/register.js +1 -1
  67. package/build/components/keyboard-shortcuts/register.js.map +1 -1
  68. package/build/components/layout/index.js +22 -14
  69. package/build/components/layout/index.js.map +1 -1
  70. package/build/components/list/index.js +9 -3
  71. package/build/components/list/index.js.map +1 -1
  72. package/build/components/list/table.js +4 -4
  73. package/build/components/list/table.js.map +1 -1
  74. package/build/components/plugin-template-setting-panel/index.js +44 -0
  75. package/build/components/plugin-template-setting-panel/index.js.map +1 -0
  76. package/build/components/revisions/index.js +95 -0
  77. package/build/components/revisions/index.js.map +1 -0
  78. package/build/components/routes/link.js +17 -2
  79. package/build/components/routes/link.js.map +1 -1
  80. package/build/components/routes/use-title.js +8 -2
  81. package/build/components/routes/use-title.js.map +1 -1
  82. package/build/components/save-button/index.js +31 -6
  83. package/build/components/save-button/index.js.map +1 -1
  84. package/build/components/save-hub/index.js +14 -31
  85. package/build/components/save-hub/index.js.map +1 -1
  86. package/build/components/save-panel/index.js +20 -7
  87. package/build/components/save-panel/index.js.map +1 -1
  88. package/build/components/secondary-sidebar/list-view-sidebar.js +2 -7
  89. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  90. package/build/components/sidebar/index.js +16 -2
  91. package/build/components/sidebar/index.js.map +1 -1
  92. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +35 -14
  93. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  94. package/build/components/sidebar-edit-mode/index.js +9 -2
  95. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  96. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +40 -0
  97. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
  98. package/build/components/sidebar-edit-mode/template-card/index.js +1 -8
  99. package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  100. package/build/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +1 -1
  101. package/build/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
  102. package/build/components/sidebar-navigation-item/index.js +5 -7
  103. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  104. package/build/components/sidebar-navigation-screen/index.js +14 -4
  105. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  106. package/build/components/sidebar-navigation-screen-main/index.js +24 -7
  107. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  108. package/build/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
  109. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  110. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +17 -5
  111. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  112. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +3 -3
  113. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  114. package/build/components/sidebar-navigation-screen-page/index.js +67 -0
  115. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -0
  116. package/build/components/sidebar-navigation-screen-pages/index.js +74 -0
  117. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -0
  118. package/build/components/sidebar-navigation-screen-templates/index.js +5 -3
  119. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  120. package/build/components/sidebar-navigation-subtitle/index.js +18 -0
  121. package/build/components/sidebar-navigation-subtitle/index.js.map +1 -0
  122. package/build/components/site-hub/index.js +64 -12
  123. package/build/components/site-hub/index.js.map +1 -1
  124. package/build/components/site-icon/index.js +8 -7
  125. package/build/components/site-icon/index.js.map +1 -1
  126. package/build/components/start-template-options/index.js +21 -24
  127. package/build/components/start-template-options/index.js.map +1 -1
  128. package/build/components/style-book/index.js +9 -41
  129. package/build/components/style-book/index.js.map +1 -1
  130. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +13 -5
  131. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  132. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +9 -4
  133. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  134. package/build/components/sync-state-with-url/use-sync-path-with-url.js +17 -3
  135. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  136. package/build/components/template-details/index.js +3 -1
  137. package/build/components/template-details/index.js.map +1 -1
  138. package/build/components/template-details/template-areas.js +9 -3
  139. package/build/components/template-details/template-areas.js.map +1 -1
  140. package/build/hooks/template-part-edit.js +8 -2
  141. package/build/hooks/template-part-edit.js.map +1 -1
  142. package/build/index.js +8 -0
  143. package/build/index.js.map +1 -1
  144. package/build/store/private-actions.js +19 -1
  145. package/build/store/private-actions.js.map +1 -1
  146. package/build/store/private-selectors.js +13 -0
  147. package/build/store/private-selectors.js.map +1 -1
  148. package/build/store/reducer.js +23 -1
  149. package/build/store/reducer.js.map +1 -1
  150. package/build/utils/is-previewing-theme.js +27 -0
  151. package/build/utils/is-previewing-theme.js.map +1 -0
  152. package/build/utils/use-activate-theme.js +46 -0
  153. package/build/utils/use-activate-theme.js.map +1 -0
  154. package/build-module/components/add-new-template/add-custom-template-modal.js +21 -6
  155. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  156. package/build-module/components/add-new-template/new-template-part.js +5 -1
  157. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  158. package/build-module/components/add-new-template/new-template.js +7 -3
  159. package/build-module/components/add-new-template/new-template.js.map +1 -1
  160. package/build-module/components/app/index.js +6 -2
  161. package/build-module/components/app/index.js.map +1 -1
  162. package/build-module/components/block-editor/back-button.js +6 -1
  163. package/build-module/components/block-editor/back-button.js.map +1 -1
  164. package/build-module/components/block-editor/editor-canvas.js +37 -6
  165. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  166. package/build-module/components/block-editor/index.js +6 -6
  167. package/build-module/components/block-editor/index.js.map +1 -1
  168. package/build-module/components/editor/index.js +45 -11
  169. package/build-module/components/editor/index.js.map +1 -1
  170. package/build-module/components/editor-canvas-container/index.js +115 -0
  171. package/build-module/components/editor-canvas-container/index.js.map +1 -0
  172. package/build-module/components/global-styles/block-preview-panel.js +1 -1
  173. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  174. package/build-module/components/global-styles/border-panel.js +54 -5
  175. package/build-module/components/global-styles/border-panel.js.map +1 -1
  176. package/build-module/components/global-styles/color-palette-panel.js +13 -3
  177. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  178. package/build-module/components/global-styles/dimensions-panel.js +17 -18
  179. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  180. package/build-module/components/global-styles/global-styles-provider.js +5 -19
  181. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  182. package/build-module/components/global-styles/gradients-palette-panel.js +13 -3
  183. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  184. package/build-module/components/global-styles/root-menu.js +47 -0
  185. package/build-module/components/global-styles/root-menu.js.map +1 -0
  186. package/build-module/components/global-styles/screen-block-list.js +4 -2
  187. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  188. package/build-module/components/global-styles/screen-block.js +151 -7
  189. package/build-module/components/global-styles/screen-block.js.map +1 -1
  190. package/build-module/components/global-styles/screen-colors.js +9 -25
  191. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  192. package/build-module/components/global-styles/screen-css.js +20 -15
  193. package/build-module/components/global-styles/screen-css.js.map +1 -1
  194. package/build-module/components/global-styles/screen-layout.js +4 -16
  195. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  196. package/build-module/components/global-styles/screen-revisions/index.js +128 -0
  197. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -0
  198. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +121 -0
  199. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
  200. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +116 -0
  201. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
  202. package/build-module/components/global-styles/screen-root.js +2 -2
  203. package/build-module/components/global-styles/screen-root.js.map +1 -1
  204. package/build-module/components/global-styles/screen-typography-element.js +0 -3
  205. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  206. package/build-module/components/global-styles/screen-typography.js +11 -37
  207. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  208. package/build-module/components/global-styles/style-variations-container.js +3 -7
  209. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  210. package/build-module/components/global-styles/typography-panel.js +7 -11
  211. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  212. package/build-module/components/global-styles/ui.js +66 -118
  213. package/build-module/components/global-styles/ui.js.map +1 -1
  214. package/build-module/components/global-styles/variations-panel.js +3 -22
  215. package/build-module/components/global-styles/variations-panel.js.map +1 -1
  216. package/build-module/components/header-edit-mode/index.js +10 -7
  217. package/build-module/components/header-edit-mode/index.js.map +1 -1
  218. package/build-module/components/keyboard-shortcuts/register.js +1 -1
  219. package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
  220. package/build-module/components/layout/index.js +17 -10
  221. package/build-module/components/layout/index.js.map +1 -1
  222. package/build-module/components/list/index.js +5 -1
  223. package/build-module/components/list/index.js.map +1 -1
  224. package/build-module/components/list/table.js +4 -4
  225. package/build-module/components/list/table.js.map +1 -1
  226. package/build-module/components/plugin-template-setting-panel/index.js +35 -0
  227. package/build-module/components/plugin-template-setting-panel/index.js.map +1 -0
  228. package/build-module/components/revisions/index.js +77 -0
  229. package/build-module/components/revisions/index.js.map +1 -0
  230. package/build-module/components/routes/link.js +13 -1
  231. package/build-module/components/routes/link.js.map +1 -1
  232. package/build-module/components/routes/use-title.js +5 -1
  233. package/build-module/components/routes/use-title.js.map +1 -1
  234. package/build-module/components/save-button/index.js +28 -6
  235. package/build-module/components/save-button/index.js.map +1 -1
  236. package/build-module/components/save-hub/index.js +13 -32
  237. package/build-module/components/save-hub/index.js.map +1 -1
  238. package/build-module/components/save-panel/index.js +19 -7
  239. package/build-module/components/save-panel/index.js.map +1 -1
  240. package/build-module/components/secondary-sidebar/list-view-sidebar.js +3 -8
  241. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  242. package/build-module/components/sidebar/index.js +11 -1
  243. package/build-module/components/sidebar/index.js.map +1 -1
  244. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +35 -16
  245. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  246. package/build-module/components/sidebar-edit-mode/index.js +10 -5
  247. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  248. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +29 -0
  249. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
  250. package/build-module/components/sidebar-edit-mode/template-card/index.js +2 -7
  251. package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  252. package/build-module/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +1 -1
  253. package/build-module/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
  254. package/build-module/components/sidebar-navigation-item/index.js +6 -8
  255. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  256. package/build-module/components/sidebar-navigation-screen/index.js +13 -5
  257. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  258. package/build-module/components/sidebar-navigation-screen-main/index.js +25 -8
  259. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  260. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
  261. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  262. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +13 -3
  263. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  264. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +3 -3
  265. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  266. package/build-module/components/sidebar-navigation-screen-page/index.js +48 -0
  267. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -0
  268. package/build-module/components/sidebar-navigation-screen-pages/index.js +57 -0
  269. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -0
  270. package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -3
  271. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  272. package/build-module/components/sidebar-navigation-subtitle/index.js +10 -0
  273. package/build-module/components/sidebar-navigation-subtitle/index.js.map +1 -0
  274. package/build-module/components/site-hub/index.js +64 -14
  275. package/build-module/components/site-hub/index.js.map +1 -1
  276. package/build-module/components/site-icon/index.js +8 -7
  277. package/build-module/components/site-icon/index.js.map +1 -1
  278. package/build-module/components/start-template-options/index.js +22 -25
  279. package/build-module/components/start-template-options/index.js.map +1 -1
  280. package/build-module/components/style-book/index.js +10 -41
  281. package/build-module/components/style-book/index.js.map +1 -1
  282. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +10 -4
  283. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  284. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +5 -1
  285. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  286. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +13 -1
  287. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  288. package/build-module/components/template-details/index.js +3 -1
  289. package/build-module/components/template-details/index.js.map +1 -1
  290. package/build-module/components/template-details/template-areas.js +5 -1
  291. package/build-module/components/template-details/template-areas.js.map +1 -1
  292. package/build-module/hooks/template-part-edit.js +5 -1
  293. package/build-module/hooks/template-part-edit.js.map +1 -1
  294. package/build-module/index.js +1 -0
  295. package/build-module/index.js.map +1 -1
  296. package/build-module/store/private-actions.js +15 -0
  297. package/build-module/store/private-actions.js.map +1 -1
  298. package/build-module/store/private-selectors.js +11 -0
  299. package/build-module/store/private-selectors.js.map +1 -1
  300. package/build-module/store/reducer.js +23 -1
  301. package/build-module/store/reducer.js.map +1 -1
  302. package/build-module/utils/is-previewing-theme.js +17 -0
  303. package/build-module/utils/is-previewing-theme.js.map +1 -0
  304. package/build-module/utils/use-activate-theme.js +36 -0
  305. package/build-module/utils/use-activate-theme.js.map +1 -0
  306. package/build-style/style-rtl.css +310 -137
  307. package/build-style/style.css +310 -137
  308. package/package.json +37 -35
  309. package/src/components/add-new-template/add-custom-template-modal.js +31 -8
  310. package/src/components/add-new-template/new-template-part.js +4 -1
  311. package/src/components/add-new-template/new-template.js +6 -1
  312. package/src/components/add-new-template/style.scss +52 -48
  313. package/src/components/app/index.js +6 -3
  314. package/src/components/block-editor/back-button.js +4 -1
  315. package/src/components/block-editor/editor-canvas.js +36 -8
  316. package/src/components/block-editor/index.js +8 -8
  317. package/src/components/block-editor/style.scss +15 -8
  318. package/src/components/editor/index.js +48 -7
  319. package/src/components/editor-canvas-container/index.js +128 -0
  320. package/src/components/editor-canvas-container/style.scss +19 -0
  321. package/src/components/global-styles/block-preview-panel.js +1 -1
  322. package/src/components/global-styles/border-panel.js +46 -3
  323. package/src/components/global-styles/color-palette-panel.js +9 -0
  324. package/src/components/global-styles/dimensions-panel.js +15 -15
  325. package/src/components/global-styles/global-styles-provider.js +4 -18
  326. package/src/components/global-styles/gradients-palette-panel.js +8 -0
  327. package/src/components/global-styles/root-menu.js +66 -0
  328. package/src/components/global-styles/screen-block-list.js +2 -2
  329. package/src/components/global-styles/screen-block.js +184 -7
  330. package/src/components/global-styles/screen-colors.js +9 -16
  331. package/src/components/global-styles/screen-css.js +21 -21
  332. package/src/components/global-styles/screen-layout.js +5 -9
  333. package/src/components/global-styles/screen-revisions/index.js +177 -0
  334. package/src/components/global-styles/screen-revisions/revisions-buttons.js +131 -0
  335. package/src/components/global-styles/screen-revisions/style.scss +99 -0
  336. package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +125 -0
  337. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +103 -0
  338. package/src/components/global-styles/screen-root.js +2 -2
  339. package/src/components/global-styles/screen-typography-element.js +1 -3
  340. package/src/components/global-styles/screen-typography.js +44 -79
  341. package/src/components/global-styles/style-variations-container.js +4 -10
  342. package/src/components/global-styles/style.scss +1 -23
  343. package/src/components/global-styles/typography-panel.js +12 -13
  344. package/src/components/global-styles/ui.js +82 -107
  345. package/src/components/global-styles/variations-panel.js +3 -26
  346. package/src/components/header-edit-mode/index.js +17 -5
  347. package/src/components/keyboard-shortcuts/register.js +1 -1
  348. package/src/components/layout/index.js +16 -19
  349. package/src/components/layout/style.scss +32 -7
  350. package/src/components/list/index.js +4 -1
  351. package/src/components/list/style.scss +4 -0
  352. package/src/components/list/table.js +19 -3
  353. package/src/components/plugin-template-setting-panel/index.js +33 -0
  354. package/src/components/revisions/index.js +104 -0
  355. package/src/components/routes/link.js +16 -1
  356. package/src/components/routes/use-title.js +4 -1
  357. package/src/components/save-button/index.js +27 -6
  358. package/src/components/save-hub/index.js +17 -35
  359. package/src/components/save-panel/index.js +15 -3
  360. package/src/components/secondary-sidebar/list-view-sidebar.js +2 -6
  361. package/src/components/secondary-sidebar/style.scss +23 -5
  362. package/src/components/sidebar/index.js +12 -1
  363. package/src/components/sidebar/style.scss +2 -1
  364. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +39 -18
  365. package/src/components/sidebar-edit-mode/index.js +17 -6
  366. package/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js +26 -0
  367. package/src/components/sidebar-edit-mode/style.scss +10 -0
  368. package/src/components/sidebar-edit-mode/template-card/index.js +1 -9
  369. package/src/components/sidebar-navigation-item/index.js +13 -14
  370. package/src/components/sidebar-navigation-item/style.scss +8 -1
  371. package/src/components/sidebar-navigation-screen/index.js +26 -5
  372. package/src/components/sidebar-navigation-screen-main/index.js +43 -22
  373. package/src/components/sidebar-navigation-screen-navigation-item/index.js +3 -9
  374. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +13 -1
  375. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +3 -3
  376. package/src/components/sidebar-navigation-screen-page/index.js +59 -0
  377. package/src/components/sidebar-navigation-screen-pages/index.js +82 -0
  378. package/src/components/sidebar-navigation-screen-pages/style.scss +4 -0
  379. package/src/components/sidebar-navigation-screen-templates/index.js +5 -1
  380. package/src/components/sidebar-navigation-subtitle/index.js +5 -0
  381. package/src/components/sidebar-navigation-subtitle/style.scss +7 -0
  382. package/src/components/site-hub/index.js +92 -33
  383. package/src/components/site-hub/style.scss +8 -0
  384. package/src/components/site-icon/index.js +6 -11
  385. package/src/components/site-icon/style.scss +8 -3
  386. package/src/components/start-template-options/index.js +32 -39
  387. package/src/components/start-template-options/style.scss +36 -46
  388. package/src/components/style-book/index.js +7 -51
  389. package/src/components/style-book/style.scss +0 -18
  390. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -4
  391. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +3 -1
  392. package/src/components/sync-state-with-url/use-sync-path-with-url.js +14 -1
  393. package/src/components/template-details/index.js +1 -0
  394. package/src/components/template-details/template-areas.js +4 -1
  395. package/src/hooks/template-part-edit.js +4 -1
  396. package/src/index.js +1 -0
  397. package/src/store/private-actions.js +14 -0
  398. package/src/store/private-selectors.js +11 -0
  399. package/src/store/reducer.js +18 -0
  400. package/src/store/test/actions.js +6 -14
  401. package/src/style.scss +5 -1
  402. package/src/utils/is-previewing-theme.js +18 -0
  403. package/src/utils/use-activate-theme.js +38 -0
  404. package/build/components/global-styles/context-menu.js +0 -126
  405. package/build/components/global-styles/context-menu.js.map +0 -1
  406. package/build/components/global-styles/custom-css.js +0 -113
  407. package/build/components/global-styles/custom-css.js.map +0 -1
  408. package/build/components/global-styles/effects-panel.js +0 -53
  409. package/build/components/global-styles/effects-panel.js.map +0 -1
  410. package/build/components/global-styles/filters-panel.js +0 -45
  411. package/build/components/global-styles/filters-panel.js.map +0 -1
  412. package/build/components/global-styles/screen-border.js +0 -61
  413. package/build/components/global-styles/screen-border.js.map +0 -1
  414. package/build/components/global-styles/screen-effects.js +0 -61
  415. package/build/components/global-styles/screen-effects.js.map +0 -1
  416. package/build/components/global-styles/screen-filters.js +0 -46
  417. package/build/components/global-styles/screen-filters.js.map +0 -1
  418. package/build/components/global-styles/screen-variations.js +0 -71
  419. package/build/components/global-styles/screen-variations.js.map +0 -1
  420. package/build/components/routes/index.js +0 -60
  421. package/build/components/routes/index.js.map +0 -1
  422. package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
  423. package/build/hooks/commands/index.js +0 -19
  424. package/build/hooks/commands/index.js.map +0 -1
  425. package/build/hooks/commands/use-navigation-commands.js +0 -117
  426. package/build/hooks/commands/use-navigation-commands.js.map +0 -1
  427. package/build/hooks/commands/use-wp-admin-commands.js +0 -94
  428. package/build/hooks/commands/use-wp-admin-commands.js.map +0 -1
  429. package/build/utils/history.js +0 -41
  430. package/build/utils/history.js.map +0 -1
  431. package/build-module/components/global-styles/context-menu.js +0 -107
  432. package/build-module/components/global-styles/context-menu.js.map +0 -1
  433. package/build-module/components/global-styles/custom-css.js +0 -98
  434. package/build-module/components/global-styles/custom-css.js.map +0 -1
  435. package/build-module/components/global-styles/effects-panel.js +0 -43
  436. package/build-module/components/global-styles/effects-panel.js.map +0 -1
  437. package/build-module/components/global-styles/filters-panel.js +0 -35
  438. package/build-module/components/global-styles/filters-panel.js.map +0 -1
  439. package/build-module/components/global-styles/screen-border.js +0 -44
  440. package/build-module/components/global-styles/screen-border.js.map +0 -1
  441. package/build-module/components/global-styles/screen-effects.js +0 -44
  442. package/build-module/components/global-styles/screen-effects.js.map +0 -1
  443. package/build-module/components/global-styles/screen-filters.js +0 -33
  444. package/build-module/components/global-styles/screen-filters.js.map +0 -1
  445. package/build-module/components/global-styles/screen-variations.js +0 -54
  446. package/build-module/components/global-styles/screen-variations.js.map +0 -1
  447. package/build-module/components/routes/index.js +0 -47
  448. package/build-module/components/routes/index.js.map +0 -1
  449. package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
  450. package/build-module/hooks/commands/index.js +0 -10
  451. package/build-module/hooks/commands/index.js.map +0 -1
  452. package/build-module/hooks/commands/use-navigation-commands.js +0 -101
  453. package/build-module/hooks/commands/use-navigation-commands.js.map +0 -1
  454. package/build-module/hooks/commands/use-wp-admin-commands.js +0 -79
  455. package/build-module/hooks/commands/use-wp-admin-commands.js.map +0 -1
  456. package/build-module/utils/history.js +0 -31
  457. package/build-module/utils/history.js.map +0 -1
  458. package/src/components/global-styles/context-menu.js +0 -175
  459. package/src/components/global-styles/custom-css.js +0 -131
  460. package/src/components/global-styles/effects-panel.js +0 -40
  461. package/src/components/global-styles/filters-panel.js +0 -33
  462. package/src/components/global-styles/screen-border.js +0 -35
  463. package/src/components/global-styles/screen-effects.js +0 -35
  464. package/src/components/global-styles/screen-filters.js +0 -27
  465. package/src/components/global-styles/screen-variations.js +0 -46
  466. package/src/components/routes/index.js +0 -53
  467. package/src/hooks/commands/index.js +0 -10
  468. package/src/hooks/commands/use-navigation-commands.js +0 -103
  469. package/src/hooks/commands/use-wp-admin-commands.js +0 -77
  470. package/src/utils/history.js +0 -39
  471. /package/src/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +0 -0
@@ -25,10 +25,12 @@ var _hooks = require("@wordpress/hooks");
25
25
 
26
26
  var _compose = require("@wordpress/compose");
27
27
 
28
- var _routes = require("../components/routes");
28
+ var _router = require("@wordpress/router");
29
29
 
30
30
  var _link = require("../components/routes/link");
31
31
 
32
+ var _privateApis = require("../private-apis");
33
+
32
34
  /**
33
35
  * WordPress dependencies
34
36
  */
@@ -36,6 +38,10 @@ var _link = require("../components/routes/link");
36
38
  /**
37
39
  * Internal dependencies
38
40
  */
41
+ const {
42
+ useLocation
43
+ } = (0, _privateApis.unlock)(_router.privateApis);
44
+
39
45
  function EditTemplatePartMenuItem(_ref) {
40
46
  let {
41
47
  attributes
@@ -46,7 +52,7 @@ function EditTemplatePartMenuItem(_ref) {
46
52
  } = attributes;
47
53
  const {
48
54
  params
49
- } = (0, _routes.useLocation)();
55
+ } = useLocation();
50
56
  const templatePart = (0, _data.useSelect)(select => {
51
57
  return select(_coreData.store).getEntityRecord('postType', 'wp_template_part', // Ideally this should be an official public API.
52
58
  `${theme}//${slug}`);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/hooks/template-part-edit.js"],"names":["EditTemplatePartMenuItem","attributes","theme","slug","params","templatePart","select","coreStore","getEntityRecord","linkProps","postId","id","postType","type","canvas","fromTemplateId","event","onClick","withEditBlockControls","BlockEdit","props","name","isDisplayed"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AASA;AACA;AACA;AAIA,SAASA,wBAAT,OAAoD;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AACnD,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAkBF,UAAxB;AACA,QAAM;AAAEG,IAAAA;AAAF,MAAa,0BAAnB;AACA,QAAMC,YAAY,GAAG,qBAClBC,MAAF,IAAc;AACb,WAAOA,MAAM,CAAEC,eAAF,CAAN,CAAoBC,eAApB,CACN,UADM,EAEN,kBAFM,EAGN;AACC,OAAGN,KAAO,KAAKC,IAAM,EAJhB,CAAP;AAMA,GARmB,EASpB,CAAED,KAAF,EAASC,IAAT,CAToB,CAArB;AAYA,QAAMM,SAAS,GAAG,mBACjB;AACCC,IAAAA,MAAM,EAAEL,YAAF,aAAEA,YAAF,uBAAEA,YAAY,CAAEM,EADvB;AAECC,IAAAA,QAAQ,EAAEP,YAAF,aAAEA,YAAF,uBAAEA,YAAY,CAAEQ,IAFzB;AAGCC,IAAAA,MAAM,EAAE;AAHT,GADiB,EAMjB;AACCC,IAAAA,cAAc,EAAEX,MAAM,CAACM;AADxB,GANiB,CAAlB;;AAWA,MAAK,CAAEL,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,0BAAD;AAAe,IAAA,KAAK,EAAC;AAArB,KACC,4BAAC,yBAAD,6BACMI,SADN;AAEC,IAAA,OAAO,EAAKO,KAAF,IAAa;AACtBP,MAAAA,SAAS,CAACQ,OAAV,CAAmBD,KAAnB;AACA;AAJF,MAMG,cAAI,MAAJ,CANH,CADD,CADD;AAYA;;AAEM,MAAME,qBAAqB,GAAG,yCAClCC,SAAF,IAAmBC,KAAF,IAAa;AAC7B,QAAM;AAAEnB,IAAAA,UAAF;AAAcoB,IAAAA;AAAd,MAAuBD,KAA7B;AACA,QAAME,WAAW,GAAGD,IAAI,KAAK,oBAAT,IAAiCpB,UAAU,CAACE,IAAhE;AAEA,SACC,qDACC,4BAAC,SAAD,EAAgBiB,KAAhB,CADD,EAEGE,WAAW,IACZ,4BAAC,wBAAD;AAA0B,IAAA,UAAU,EAAGrB;AAAvC,IAHF,CADD;AAQA,CAbmC,EAcpC,uBAdoC,CAA9B;;AAiBP,sBACC,kBADD,EAEC,0CAFD,EAGCiB,qBAHD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { BlockControls } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ToolbarButton } from '@wordpress/components';\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useLocation } from '../components/routes';\nimport { useLink } from '../components/routes/link';\n\nfunction EditTemplatePartMenuItem( { attributes } ) {\n\tconst { theme, slug } = attributes;\n\tconst { params } = useLocation();\n\tconst templatePart = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t// Ideally this should be an official public API.\n\t\t\t\t`${ theme }//${ slug }`\n\t\t\t);\n\t\t},\n\t\t[ theme, slug ]\n\t);\n\n\tconst linkProps = useLink(\n\t\t{\n\t\t\tpostId: templatePart?.id,\n\t\t\tpostType: templatePart?.type,\n\t\t\tcanvas: 'edit',\n\t\t},\n\t\t{\n\t\t\tfromTemplateId: params.postId,\n\t\t}\n\t);\n\n\tif ( ! templatePart ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarButton\n\t\t\t\t{ ...linkProps }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tlinkProps.onClick( event );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Edit' ) }\n\t\t\t</ToolbarButton>\n\t\t</BlockControls>\n\t);\n}\n\nexport const withEditBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { attributes, name } = props;\n\t\tconst isDisplayed = name === 'core/template-part' && attributes.slug;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ isDisplayed && (\n\t\t\t\t\t<EditTemplatePartMenuItem attributes={ attributes } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withEditBlockControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/template-part-edit-button',\n\twithEditBlockControls\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/hooks/template-part-edit.js"],"names":["useLocation","routerPrivateApis","EditTemplatePartMenuItem","attributes","theme","slug","params","templatePart","select","coreStore","getEntityRecord","linkProps","postId","id","postType","type","canvas","fromTemplateId","event","onClick","withEditBlockControls","BlockEdit","props","name","isDisplayed"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAUA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAAkB,yBAAQC,mBAAR,CAAxB;;AAEA,SAASC,wBAAT,OAAoD;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AACnD,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAkBF,UAAxB;AACA,QAAM;AAAEG,IAAAA;AAAF,MAAaN,WAAW,EAA9B;AACA,QAAMO,YAAY,GAAG,qBAClBC,MAAF,IAAc;AACb,WAAOA,MAAM,CAAEC,eAAF,CAAN,CAAoBC,eAApB,CACN,UADM,EAEN,kBAFM,EAGN;AACC,OAAGN,KAAO,KAAKC,IAAM,EAJhB,CAAP;AAMA,GARmB,EASpB,CAAED,KAAF,EAASC,IAAT,CAToB,CAArB;AAYA,QAAMM,SAAS,GAAG,mBACjB;AACCC,IAAAA,MAAM,EAAEL,YAAF,aAAEA,YAAF,uBAAEA,YAAY,CAAEM,EADvB;AAECC,IAAAA,QAAQ,EAAEP,YAAF,aAAEA,YAAF,uBAAEA,YAAY,CAAEQ,IAFzB;AAGCC,IAAAA,MAAM,EAAE;AAHT,GADiB,EAMjB;AACCC,IAAAA,cAAc,EAAEX,MAAM,CAACM;AADxB,GANiB,CAAlB;;AAWA,MAAK,CAAEL,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,0BAAD;AAAe,IAAA,KAAK,EAAC;AAArB,KACC,4BAAC,yBAAD,6BACMI,SADN;AAEC,IAAA,OAAO,EAAKO,KAAF,IAAa;AACtBP,MAAAA,SAAS,CAACQ,OAAV,CAAmBD,KAAnB;AACA;AAJF,MAMG,cAAI,MAAJ,CANH,CADD,CADD;AAYA;;AAEM,MAAME,qBAAqB,GAAG,yCAClCC,SAAF,IAAmBC,KAAF,IAAa;AAC7B,QAAM;AAAEnB,IAAAA,UAAF;AAAcoB,IAAAA;AAAd,MAAuBD,KAA7B;AACA,QAAME,WAAW,GAAGD,IAAI,KAAK,oBAAT,IAAiCpB,UAAU,CAACE,IAAhE;AAEA,SACC,qDACC,4BAAC,SAAD,EAAgBiB,KAAhB,CADD,EAEGE,WAAW,IACZ,4BAAC,wBAAD;AAA0B,IAAA,UAAU,EAAGrB;AAAvC,IAHF,CADD;AAQA,CAbmC,EAcpC,uBAdoC,CAA9B;;AAiBP,sBACC,kBADD,EAEC,0CAFD,EAGCiB,qBAHD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { BlockControls } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ToolbarButton } from '@wordpress/components';\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { useLink } from '../components/routes/link';\nimport { unlock } from '../private-apis';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction EditTemplatePartMenuItem( { attributes } ) {\n\tconst { theme, slug } = attributes;\n\tconst { params } = useLocation();\n\tconst templatePart = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t// Ideally this should be an official public API.\n\t\t\t\t`${ theme }//${ slug }`\n\t\t\t);\n\t\t},\n\t\t[ theme, slug ]\n\t);\n\n\tconst linkProps = useLink(\n\t\t{\n\t\t\tpostId: templatePart?.id,\n\t\t\tpostType: templatePart?.type,\n\t\t\tcanvas: 'edit',\n\t\t},\n\t\t{\n\t\t\tfromTemplateId: params.postId,\n\t\t}\n\t);\n\n\tif ( ! templatePart ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarButton\n\t\t\t\t{ ...linkProps }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tlinkProps.onClick( event );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Edit' ) }\n\t\t\t</ToolbarButton>\n\t\t</BlockControls>\n\t);\n}\n\nexport const withEditBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { attributes, name } = props;\n\t\tconst isDisplayed = name === 'core/template-part' && attributes.slug;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ isDisplayed && (\n\t\t\t\t\t<EditTemplatePartMenuItem attributes={ attributes } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withEditBlockControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/template-part-edit-button',\n\twithEditBlockControls\n);\n"]}
package/build/index.js CHANGED
@@ -23,6 +23,12 @@ Object.defineProperty(exports, "PluginSidebarMoreMenuItem", {
23
23
  return _pluginSidebarMoreMenuItem.default;
24
24
  }
25
25
  });
26
+ Object.defineProperty(exports, "PluginTemplateSettingPanel", {
27
+ enumerable: true,
28
+ get: function () {
29
+ return _pluginTemplateSettingPanel.default;
30
+ }
31
+ });
26
32
  exports.initializeEditor = initializeEditor;
27
33
  exports.reinitializeEditor = reinitializeEditor;
28
34
 
@@ -58,6 +64,8 @@ var _pluginSidebarMoreMenuItem = _interopRequireDefault(require("./components/he
58
64
 
59
65
  var _pluginMoreMenuItem = _interopRequireDefault(require("./components/header-edit-mode/plugin-more-menu-item"));
60
66
 
67
+ var _pluginTemplateSettingPanel = _interopRequireDefault(require("./components/plugin-template-setting-panel"));
68
+
61
69
  /**
62
70
  * WordPress dependencies
63
71
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["initializeEditor","id","settings","target","document","getElementById","root","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","blocksStore","__experimentalReapplyBlockTypeFilters","coreBlocks","filter","name","setFreeformFallbackBlockName","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","preferencesStore","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","showBlockBreadcrumbs","interfaceStore","setDefaultComplementaryArea","editSiteStore","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","reinitializeEditor","since","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA;;AARA;;AACA;;AAKA;;AACA;;AAEA;;AAIA;;AACA;;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,EAAE,IANuC;AAO3DC,IAAAA,qBAAqB,EAAE,KAPoC;AAQ3DC,IAAAA,oBAAoB,EAAE;AARqC,GAA5D;AAWA,sBAAUC,gBAAV,EAA2BC,2BAA3B,CACC,gBADD,EAEC,oBAFD;AAKA,sBAAUC,YAAV,EAA0BC,cAA1B,CAA0ClC,QAA1C,EAxCgD,CA0ChD;AACA;AACA;AACA;;AACA,sBAAUmC,aAAV,EAAwBC,oBAAxB,CAA8C;AAC7CC,IAAAA,oBAAoB,EAAErC,QAAQ,CAACqC,oBADc;AAE7CC,IAAAA,wBAAwB,EAAEtC,QAAQ,CAACsC;AAFU,GAA9C,EA9CgD,CAmDhD;;AACAC,EAAAA,MAAM,CAACC,gBAAP,CAAyB,UAAzB,EAAuCC,CAAF,IAASA,CAAC,CAACC,cAAF,EAA9C,EAAkE,KAAlE;AACAH,EAAAA,MAAM,CAACC,gBAAP,CAAyB,MAAzB,EAAmCC,CAAF,IAASA,CAAC,CAACC,cAAF,EAA1C,EAA8D,KAA9D;AAEAtC,EAAAA,IAAI,CAACuC,MAAL,CAAa,4BAAC,YAAD,OAAb;AAEA,SAAOvC,IAAP;AACA;;AAEM,SAASwC,kBAAT,GAA8B;AACpC,2BAAY,gCAAZ,EAA8C;AAC7CC,IAAAA,KAAK,EAAE,KADsC;AAE7CC,IAAAA,OAAO,EAAE;AAFoC,GAA9C;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport App from './components/app';\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tkeepCaretInsideBlock: false,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\tshowListViewByDefault: false,\n\t\tshowBlockBreadcrumbs: true,\n\t} );\n\n\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t'core/edit-site',\n\t\t'edit-site/template'\n\t);\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render( <App /> );\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginSidebar } from './components/sidebar-edit-mode/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header-edit-mode/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header-edit-mode/plugin-more-menu-item';\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["initializeEditor","id","settings","target","document","getElementById","root","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","blocksStore","__experimentalReapplyBlockTypeFilters","coreBlocks","filter","name","setFreeformFallbackBlockName","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","preferencesStore","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","showBlockBreadcrumbs","interfaceStore","setDefaultComplementaryArea","editSiteStore","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","reinitializeEditor","since","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA;;AARA;;AACA;;AAKA;;AACA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AA2EA;;AACA;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AAE,KAPoC;AAQ3DC,IAAAA,oBAAoB,EAAE;AARqC,GAA5D;AAWA,sBAAUC,gBAAV,EAA2BC,2BAA3B,CACC,gBADD,EAEC,oBAFD;AAKA,sBAAUC,YAAV,EAA0BC,cAA1B,CAA0ClC,QAA1C,EAxCgD,CA0ChD;AACA;AACA;AACA;;AACA,sBAAUmC,aAAV,EAAwBC,oBAAxB,CAA8C;AAC7CC,IAAAA,oBAAoB,EAAErC,QAAQ,CAACqC,oBADc;AAE7CC,IAAAA,wBAAwB,EAAEtC,QAAQ,CAACsC;AAFU,GAA9C,EA9CgD,CAmDhD;;AACAC,EAAAA,MAAM,CAACC,gBAAP,CAAyB,UAAzB,EAAuCC,CAAF,IAASA,CAAC,CAACC,cAAF,EAA9C,EAAkE,KAAlE;AACAH,EAAAA,MAAM,CAACC,gBAAP,CAAyB,MAAzB,EAAmCC,CAAF,IAASA,CAAC,CAACC,cAAF,EAA1C,EAA8D,KAA9D;AAEAtC,EAAAA,IAAI,CAACuC,MAAL,CAAa,4BAAC,YAAD,OAAb;AAEA,SAAOvC,IAAP;AACA;;AAEM,SAASwC,kBAAT,GAA8B;AACpC,2BAAY,gCAAZ,EAA8C;AAC7CC,IAAAA,KAAK,EAAE,KADsC;AAE7CC,IAAAA,OAAO,EAAE;AAFoC,GAA9C;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport App from './components/app';\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tkeepCaretInsideBlock: false,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\tshowListViewByDefault: false,\n\t\tshowBlockBreadcrumbs: true,\n\t} );\n\n\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t'core/edit-site',\n\t\t'edit-site/template'\n\t);\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render( <App /> );\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginSidebar } from './components/sidebar-edit-mode/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header-edit-mode/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header-edit-mode/plugin-more-menu-item';\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\n"]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setCanvasMode = void 0;
6
+ exports.setEditorCanvasContainerView = exports.setCanvasMode = void 0;
7
7
 
8
8
  var _blockEditor = require("@wordpress/block-editor");
9
9
 
@@ -35,6 +35,24 @@ const setCanvasMode = mode => _ref => {
35
35
  dispatch.setIsListViewOpened(true);
36
36
  }
37
37
  };
38
+ /**
39
+ * Action that switches the editor canvas container view.
40
+ *
41
+ * @param {?string} view Editor canvas container view.
42
+ */
43
+
38
44
 
39
45
  exports.setCanvasMode = setCanvasMode;
46
+
47
+ const setEditorCanvasContainerView = view => _ref2 => {
48
+ let {
49
+ dispatch
50
+ } = _ref2;
51
+ dispatch({
52
+ type: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',
53
+ view
54
+ });
55
+ };
56
+
57
+ exports.setEditorCanvasContainerView = setEditorCanvasContainerView;
40
58
  //# sourceMappingURL=private-actions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/private-actions.js"],"names":["setCanvasMode","mode","registry","dispatch","blockEditorStore","__unstableSetEditorMode","type","select","preferencesStore","get","setIsListViewOpened"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,GACvBC,IAAF,IACA,QAA8B;AAAA,MAA5B;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAA4B;;AAC7BD,EAAAA,QAAQ,CAACC,QAAT,CAAmBC,kBAAnB,EAAsCC,uBAAtC,CAA+D,MAA/D;;AACAF,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,iBADG;AAETL,IAAAA;AAFS,GAAF,CAAR,CAF6B,CAM7B;;AACA,MACCA,IAAI,KAAK,MAAT,IACAC,QAAQ,CACNK,MADF,CACUC,kBADV,EAEEC,GAFF,CAEO,gBAFP,EAEyB,uBAFzB,CAFD,EAKE;AACDN,IAAAA,QAAQ,CAACO,mBAAT,CAA8B,IAA9B;AACA;AACD,CAjBK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\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\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'showListViewByDefault' )\n\t\t) {\n\t\t\tdispatch.setIsListViewOpened( true );\n\t\t}\n\t};\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/private-actions.js"],"names":["setCanvasMode","mode","registry","dispatch","blockEditorStore","__unstableSetEditorMode","type","select","preferencesStore","get","setIsListViewOpened","setEditorCanvasContainerView","view"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,GACvBC,IAAF,IACA,QAA8B;AAAA,MAA5B;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAA4B;;AAC7BD,EAAAA,QAAQ,CAACC,QAAT,CAAmBC,kBAAnB,EAAsCC,uBAAtC,CAA+D,MAA/D;;AACAF,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,iBADG;AAETL,IAAAA;AAFS,GAAF,CAAR,CAF6B,CAM7B;;AACA,MACCA,IAAI,KAAK,MAAT,IACAC,QAAQ,CACNK,MADF,CACUC,kBADV,EAEEC,GAFF,CAEO,gBAFP,EAEyB,uBAFzB,CAFD,EAKE;AACDN,IAAAA,QAAQ,CAACO,mBAAT,CAA8B,IAA9B;AACA;AACD,CAjBK;AAmBP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,4BAA4B,GACtCC,IAAF,IACA,SAAoB;AAAA,MAAlB;AAAET,IAAAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,kCADG;AAETM,IAAAA;AAFS,GAAF,CAAR;AAIA,CAPK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\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\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'showListViewByDefault' )\n\t\t) {\n\t\t\tdispatch.setIsListViewOpened( true );\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"]}
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getCanvasMode = getCanvasMode;
7
+ exports.getEditorCanvasContainerView = getEditorCanvasContainerView;
7
8
 
8
9
  /**
9
10
  * Returns the current canvas mode.
@@ -15,4 +16,16 @@ exports.getCanvasMode = getCanvasMode;
15
16
  function getCanvasMode(state) {
16
17
  return state.canvasMode;
17
18
  }
19
+ /**
20
+ * Returns the editor canvas container view.
21
+ *
22
+ * @param {Object} state Global application state.
23
+ *
24
+ * @return {string} Editor canvas container view.
25
+ */
26
+
27
+
28
+ function getEditorCanvasContainerView(state) {
29
+ return state.editorCanvasContainerView;
30
+ }
18
31
  //# sourceMappingURL=private-selectors.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/private-selectors.js"],"names":["getCanvasMode","state","canvasMode"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CAAwBC,KAAxB,EAAgC;AACtC,SAAOA,KAAK,CAACC,UAAb;AACA","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"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/private-selectors.js"],"names":["getCanvasMode","state","canvasMode","getEditorCanvasContainerView","editorCanvasContainerView"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CAAwBC,KAAxB,EAAgC;AACtC,SAAOA,KAAK,CAACC,UAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,4BAAT,CAAuCF,KAAvC,EAA+C;AACrD,SAAOA,KAAK,CAACG,yBAAb;AACA","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"]}
@@ -187,6 +187,27 @@ function canvasMode() {
187
187
 
188
188
  return state;
189
189
  }
190
+ /**
191
+ * Reducer used to track the site editor canvas container view.
192
+ * Default is `undefined`, denoting the default, visual block editor.
193
+ * This could be, for example, `'style-book'` (the style book).
194
+ *
195
+ * @param {string|undefined} state Current state.
196
+ * @param {Object} action Dispatched action.
197
+ */
198
+
199
+
200
+ function editorCanvasContainerView() {
201
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
202
+ let action = arguments.length > 1 ? arguments[1] : undefined;
203
+
204
+ switch (action.type) {
205
+ case 'SET_EDITOR_CANVAS_CONTAINER_VIEW':
206
+ return action.view;
207
+ }
208
+
209
+ return state;
210
+ }
190
211
 
191
212
  var _default = (0, _data.combineReducers)({
192
213
  deviceType,
@@ -195,7 +216,8 @@ var _default = (0, _data.combineReducers)({
195
216
  blockInserterPanel,
196
217
  listViewPanel,
197
218
  saveViewPanel,
198
- canvasMode
219
+ canvasMode,
220
+ editorCanvasContainerView
199
221
  });
200
222
 
201
223
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/reducer.js"],"names":["deviceType","state","action","type","settings","editedPost","postType","id","context","blockInserterPanel","isOpen","value","listViewPanel","saveViewPanel","canvasMode","mode"],"mappings":";;;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAT,GAAiD;AAAA,MAA5BC,KAA4B,uEAApB,SAAoB;AAAA,MAATC,MAAS;;AACvD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,yBAAL;AACC,aAAOD,MAAM,CAACF,UAAd;AAFF;;AAKA,SAAOC,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASG,QAAT,GAAwC;AAAA,MAArBH,KAAqB,uEAAb,EAAa;AAAA,MAATC,MAAS;;AAC9C,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,iBAAL;AACC,aAAO,EACN,GAAGF,KADG;AAEN,WAAGC,MAAM,CAACE;AAFJ,OAAP;AAFF;;AAQA,SAAOH,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,UAAT,GAA0C;AAAA,MAArBJ,KAAqB,uEAAb,EAAa;AAAA,MAATC,MAAS;;AAChD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,iBAAL;AACC,aAAO;AACNG,QAAAA,QAAQ,EAAEJ,MAAM,CAACI,QADX;AAENC,QAAAA,EAAE,EAAEL,MAAM,CAACK,EAFL;AAGNC,QAAAA,OAAO,EAAEN,MAAM,CAACM;AAHV,OAAP;;AAKD,SAAK,yBAAL;AACC,aAAO,EACN,GAAGP,KADG;AAENO,QAAAA,OAAO,EAAEN,MAAM,CAACM;AAFV,OAAP;AARF;;AAcA,SAAOP,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASQ,kBAAT,GAAqD;AAAA,MAAxBR,KAAwB,uEAAhB,KAAgB;AAAA,MAATC,MAAS;;AAC3D,UAASA,MA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C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\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 block inserter panel open or closed.\n *\n * Note: this reducer interacts with the navigation and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {boolean|Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn false;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the navigation and inserter panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_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 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\nexport default combineReducers( {\n\tdeviceType,\n\tsettings,\n\teditedPost,\n\tblockInserterPanel,\n\tlistViewPanel,\n\tsaveViewPanel,\n\tcanvasMode,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/reducer.js"],"names":["deviceType","state","action","type","settings","editedPost","postType","id","context","blockInserterPanel","isOpen","value","listViewPanel","saveViewPanel","canvasMode","mode","editorCanvasContainerView","undefined","view"],"mappings":";;;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAT,GAAiD;AAAA,MAA5BC,KAA4B,uEAApB,SA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AAQ/BE,EAAAA;AAR+B,CAAjB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\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 block inserter panel open or closed.\n *\n * Note: this reducer interacts with the navigation and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {boolean|Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn false;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the navigation and inserter panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_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 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\tdeviceType,\n\tsettings,\n\teditedPost,\n\tblockInserterPanel,\n\tlistViewPanel,\n\tsaveViewPanel,\n\tcanvasMode,\n\teditorCanvasContainerView,\n} );\n"]}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.currentlyPreviewingTheme = currentlyPreviewingTheme;
7
+ exports.isPreviewingTheme = isPreviewingTheme;
8
+
9
+ var _url = require("@wordpress/url");
10
+
11
+ /**
12
+ * WordPress dependencies
13
+ */
14
+ function isPreviewingTheme() {
15
+ var _window;
16
+
17
+ return ((_window = window) === null || _window === void 0 ? void 0 : _window.__experimentalEnableThemePreviews) && (0, _url.getQueryArg)(window.location.href, 'theme_preview') !== undefined;
18
+ }
19
+
20
+ function currentlyPreviewingTheme() {
21
+ if (isPreviewingTheme()) {
22
+ return (0, _url.getQueryArg)(window.location.href, 'theme_preview');
23
+ }
24
+
25
+ return null;
26
+ }
27
+ //# sourceMappingURL=is-previewing-theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/utils/is-previewing-theme.js"],"names":["isPreviewingTheme","window","__experimentalEnableThemePreviews","location","href","undefined","currentlyPreviewingTheme"],"mappings":";;;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,SAASA,iBAAT,GAA6B;AAAA;;AACnC,SACC,YAAAC,MAAM,UAAN,0CAAQC,iCAAR,KACA,sBAAaD,MAAM,CAACE,QAAP,CAAgBC,IAA7B,EAAmC,eAAnC,MAAyDC,SAF1D;AAIA;;AAEM,SAASC,wBAAT,GAAoC;AAC1C,MAAKN,iBAAiB,EAAtB,EAA2B;AAC1B,WAAO,sBAAaC,MAAM,CAACE,QAAP,CAAgBC,IAA7B,EAAmC,eAAnC,CAAP;AACA;;AACD,SAAO,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getQueryArg } from '@wordpress/url';\n\nexport function isPreviewingTheme() {\n\treturn (\n\t\twindow?.__experimentalEnableThemePreviews &&\n\t\tgetQueryArg( window.location.href, 'theme_preview' ) !== undefined\n\t);\n}\n\nexport function currentlyPreviewingTheme() {\n\tif ( isPreviewingTheme() ) {\n\t\treturn getQueryArg( window.location.href, 'theme_preview' );\n\t}\n\treturn null;\n}\n"]}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useActivateTheme = useActivateTheme;
7
+
8
+ var _router = require("@wordpress/router");
9
+
10
+ var _privateApis = require("../private-apis");
11
+
12
+ var _isPreviewingTheme = require("./is-previewing-theme");
13
+
14
+ /**
15
+ * WordPress dependencies
16
+ */
17
+
18
+ /**
19
+ * Internal dependencies
20
+ */
21
+ const {
22
+ useHistory,
23
+ useLocation
24
+ } = (0, _privateApis.unlock)(_router.privateApis);
25
+ /**
26
+ * This should be refactored to use the REST API, once the REST API can activate themes.
27
+ *
28
+ * @return {Function} A function that activates the theme.
29
+ */
30
+
31
+ function useActivateTheme() {
32
+ const history = useHistory();
33
+ const location = useLocation();
34
+ return async () => {
35
+ if ((0, _isPreviewingTheme.isPreviewingTheme)()) {
36
+ const activationURL = 'themes.php?action=activate&stylesheet=' + (0, _isPreviewingTheme.currentlyPreviewingTheme)() + '&_wpnonce=' + window.BLOCK_THEME_ACTIVATE_NONCE;
37
+ await window.fetch(activationURL);
38
+ const {
39
+ theme_preview: themePreview,
40
+ ...params
41
+ } = location.params;
42
+ history.replace(params);
43
+ }
44
+ };
45
+ }
46
+ //# sourceMappingURL=use-activate-theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/utils/use-activate-theme.js"],"names":["useHistory","useLocation","routerPrivateApis","useActivateTheme","history","location","activationURL","window","BLOCK_THEME_ACTIVATE_NONCE","fetch","theme_preview","themePreview","params","replace"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAOA,MAAM;AAAEA,EAAAA,UAAF;AAAcC,EAAAA;AAAd,IAA8B,yBAAQC,mBAAR,CAApC;AAEA;AACA;AACA;AACA;AACA;;AACO,SAASC,gBAAT,GAA4B;AAClC,QAAMC,OAAO,GAAGJ,UAAU,EAA1B;AACA,QAAMK,QAAQ,GAAGJ,WAAW,EAA5B;AAEA,SAAO,YAAY;AAClB,QAAK,2CAAL,EAA2B;AAC1B,YAAMK,aAAa,GAClB,2CACA,kDADA,GAEA,YAFA,GAGAC,MAAM,CAACC,0BAJR;AAKA,YAAMD,MAAM,CAACE,KAAP,CAAcH,aAAd,CAAN;AACA,YAAM;AAAEI,QAAAA,aAAa,EAAEC,YAAjB;AAA+B,WAAGC;AAAlC,UAA6CP,QAAQ,CAACO,MAA5D;AACAR,MAAAA,OAAO,CAACS,OAAR,CAAiBD,MAAjB;AACA;AACD,GAXD;AAYA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../private-apis';\nimport {\n\tisPreviewingTheme,\n\tcurrentlyPreviewingTheme,\n} from './is-previewing-theme';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\n/**\n * This should be refactored to use the REST API, once the REST API can activate themes.\n *\n * @return {Function} A function that activates the theme.\n */\nexport function useActivateTheme() {\n\tconst history = useHistory();\n\tconst location = useLocation();\n\n\treturn async () => {\n\t\tif ( isPreviewingTheme() ) {\n\t\t\tconst activationURL =\n\t\t\t\t'themes.php?action=activate&stylesheet=' +\n\t\t\t\tcurrentlyPreviewingTheme() +\n\t\t\t\t'&_wpnonce=' +\n\t\t\t\twindow.BLOCK_THEME_ACTIVATE_NONCE;\n\t\t\tawait window.fetch( activationURL );\n\t\t\tconst { theme_preview: themePreview, ...params } = location.params;\n\t\t\thistory.replace( params );\n\t\t}\n\t};\n}\n"]}
@@ -33,12 +33,19 @@ function SuggestionListItem(_ref) {
33
33
  }, composite, {
34
34
  className: baseCssClass,
35
35
  onClick: () => onSelect(entityForSuggestions.config.getSpecificTemplate(suggestion))
36
- }), createElement("span", {
36
+ }), createElement(Text, {
37
+ size: "body",
38
+ lineHeight: 1.53846153846 // 20px
39
+ ,
40
+ weight: 500,
37
41
  className: `${baseCssClass}__title`
38
42
  }, createElement(TextHighlight, {
39
43
  text: decodeEntities(suggestion.name),
40
44
  highlight: search
41
- })), suggestion.link && createElement("span", {
45
+ })), suggestion.link && createElement(Text, {
46
+ size: "body",
47
+ lineHeight: 1.53846153846 // 20px
48
+ ,
42
49
  className: `${baseCssClass}__info`
43
50
  }, suggestion.link));
44
51
  }
@@ -173,9 +180,13 @@ function AddCustomTemplateModal(_ref3) {
173
180
  }
174
181
  }, createElement(Text, {
175
182
  as: "span",
176
- weight: 600
183
+ weight: 500,
184
+ lineHeight: 1.53846153846 // 20px
185
+
177
186
  }, entityForSuggestions.labels.all_items), createElement(Text, {
178
- as: "span"
187
+ as: "span",
188
+ lineHeight: 1.53846153846 // 20px
189
+
179
190
  }, // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.
180
191
  __('For all items'))), createElement(FlexItem, {
181
192
  isBlock: true,
@@ -185,9 +196,13 @@ function AddCustomTemplateModal(_ref3) {
185
196
  }
186
197
  }, createElement(Text, {
187
198
  as: "span",
188
- weight: 600
199
+ weight: 500,
200
+ lineHeight: 1.53846153846 // 20px
201
+
189
202
  }, entityForSuggestions.labels.singular_name), createElement(Text, {
190
- as: "span"
203
+ as: "span",
204
+ lineHeight: 1.53846153846 // 20px
205
+
191
206
  }, // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.
192
207
  __('For a specific item'))))), showSearchEntities && createElement(VStack, {
193
208
  spacing: 4
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/add-custom-template-modal.js"],"names":["useState","useMemo","useEffect","__","sprintf","Button","Flex","FlexItem","Modal","SearchControl","TextHighlight","__experimentalText","Text","__experimentalVStack","VStack","__unstableComposite","Composite","__unstableUseCompositeState","useCompositeState","__unstableCompositeItem","CompositeItem","useDebounce","useEntityRecords","decodeEntities","TemplateActionsLoadingScreen","mapToIHasNameAndId","EMPTY_ARRAY","SuggestionListItem","suggestion","search","onSelect","entityForSuggestions","composite","baseCssClass","config","getSpecificTemplate","name","link","useDebouncedInput","input","setInput","debounced","setter","setDebounced","useSearchSuggestions","query","order","context","per_page","queryArgs","records","searchResults","hasResolved","searchHasResolved","type","slug","suggestions","setSuggestions","newSuggestions","length","recordNamePath","SuggestionList","orientation","setSearch","debouncedSearch","labels","showSearchControl","setShowSearchControl","search_items","map","not_found","AddCustomTemplateModal","onClose","isCreatingTemplate","showSearchEntities","setShowSearchEntities","hasGeneralTemplate","singular_name","title","description","templatePrefix","template","all_items"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,OAAnB,EAA4BC,SAA5B,QAA6C,oBAA7C;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,MADD,EAECC,IAFD,EAGCC,QAHD,EAICC,KAJD,EAKCC,aALD,EAMCC,aAND,EAOCC,kBAAkB,IAAIC,IAPvB,EAQCC,oBAAoB,IAAIC,MARzB,EASCC,mBAAmB,IAAIC,SATxB,EAUCC,2BAA2B,IAAIC,iBAVhC,EAWCC,uBAAuB,IAAIC,aAX5B,QAYO,uBAZP;AAaA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,gBAAT,QAAiC,sBAAjC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,OAAOC,4BAAP,MAAyC,mCAAzC;AACA,SAASC,kBAAT,QAAmC,SAAnC;AAEA,MAAMC,WAAW,GAAG,EAApB;;AAEA,SAASC,kBAAT,OAMI;AAAA,MANyB;AAC5BC,IAAAA,UAD4B;AAE5BC,IAAAA,MAF4B;AAG5BC,IAAAA,QAH4B;AAI5BC,IAAAA,oBAJ4B;AAK5BC,IAAAA;AAL4B,GAMzB;AACH,QAAMC,YAAY,GACjB,8DADD;AAEA,SACC,cAAC,aAAD;AACC,IAAA,IAAI,EAAC,QADN;AAEC,IAA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AD/B,CAlBD,EAqBC,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC;AAAT,KAEE;AACA/E,EAAAA,EAAE,CAAE,eAAF,CAHJ,CArBD,CALD,EAiCC,cAAC,QAAD;AACC,IAAA,OAAO,MADR;AAEC,IAAA,EAAE,EAAGE,MAFN;AAGC,IAAA,OAAO,EAAG,MAAM;AACfsE,MAAAA,qBAAqB,CAAE,IAAF,CAArB;AACA;AALF,KAOC,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC,MAAT;AAAgB,IAAA,MAAM,EAAG;AAAzB,KACG5C,oBAAoB,CAACkC,MAArB,CAA4BY,aAD/B,CAPD,EAUC,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC;AAAT,KAEE;AACA1E,EAAAA,EAAE,CAAE,qBAAF,CAHJ,CAVD,CAjCD,CAND,CAXF,EAsEGuE,kBAAkB,IACnB,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC;AAAT,KACGvE,EAAE,CACH,+DADG,CADL,CADD,EAMC,cAAC,cAAD;AACC,IAAA,oBAAoB,EAAG4B,oBADxB;AAEC,IAAA,QAAQ,EAAGD;AAFZ,IAND,CAvEF,CADD;AAsFA;;AAED,eAAeyC,sBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tFlex,\n\tFlexItem,\n\tModal,\n\tSearchControl,\n\tTextHighlight,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n\t__unstableCompositeItem as CompositeItem,\n} from '@wordpress/components';\nimport { useDebounce } from '@wordpress/compose';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport TemplateActionsLoadingScreen from './template-actions-loading-screen';\nimport { mapToIHasNameAndId } from './utils';\n\nconst EMPTY_ARRAY = [];\n\nfunction SuggestionListItem( {\n\tsuggestion,\n\tsearch,\n\tonSelect,\n\tentityForSuggestions,\n\tcomposite,\n} ) {\n\tconst baseCssClass =\n\t\t'edit-site-custom-template-modal__suggestions_list__list-item';\n\treturn (\n\t\t<CompositeItem\n\t\t\trole=\"option\"\n\t\t\tas={ Button }\n\t\t\t{ ...composite }\n\t\t\tclassName={ baseCssClass }\n\t\t\tonClick={ () =>\n\t\t\t\tonSelect(\n\t\t\t\t\tentityForSuggestions.config.getSpecificTemplate(\n\t\t\t\t\t\tsuggestion\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t<span className={ `${ baseCssClass }__title` }>\n\t\t\t\t<TextHighlight\n\t\t\t\t\ttext={ decodeEntities( suggestion.name ) }\n\t\t\t\t\thighlight={ search }\n\t\t\t\t/>\n\t\t\t</span>\n\t\t\t{ suggestion.link && (\n\t\t\t\t<span className={ `${ baseCssClass }__info` }>\n\t\t\t\t\t{ suggestion.link }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</CompositeItem>\n\t);\n}\n\nfunction useDebouncedInput() {\n\tconst [ input, setInput ] = useState( '' );\n\tconst [ debounced, setter ] = useState( '' );\n\tconst setDebounced = useDebounce( setter, 250 );\n\tuseEffect( () => {\n\t\tif ( debounced !== input ) {\n\t\t\tsetDebounced( input );\n\t\t}\n\t}, [ debounced, input ] );\n\treturn [ input, setInput, debounced ];\n}\n\nfunction useSearchSuggestions( entityForSuggestions, search ) {\n\tconst { config } = entityForSuggestions;\n\tconst query = useMemo(\n\t\t() => ( {\n\t\t\torder: 'asc',\n\t\t\tcontext: 'view',\n\t\t\tsearch,\n\t\t\tper_page: search ? 20 : 10,\n\t\t\t...config.queryArgs( search ),\n\t\t} ),\n\t\t[ search, config ]\n\t);\n\tconst { records: searchResults, hasResolved: searchHasResolved } =\n\t\tuseEntityRecords(\n\t\t\tentityForSuggestions.type,\n\t\t\tentityForSuggestions.slug,\n\t\t\tquery\n\t\t);\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) return;\n\t\tlet newSuggestions = EMPTY_ARRAY;\n\t\tif ( searchResults?.length ) {\n\t\t\tnewSuggestions = searchResults;\n\t\t\tif ( config.recordNamePath ) {\n\t\t\t\tnewSuggestions = mapToIHasNameAndId(\n\t\t\t\t\tnewSuggestions,\n\t\t\t\t\tconfig.recordNamePath\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t// Update suggestions only when the query has resolved, so as to keep\n\t\t// the previous results in the UI.\n\t\tsetSuggestions( newSuggestions );\n\t}, [ searchResults, searchHasResolved ] );\n\treturn suggestions;\n}\n\nfunction SuggestionList( { entityForSuggestions, onSelect } ) {\n\tconst composite = useCompositeState( { orientation: 'vertical' } );\n\tconst [ search, setSearch, debouncedSearch ] = useDebouncedInput();\n\tconst suggestions = useSearchSuggestions(\n\t\tentityForSuggestions,\n\t\tdebouncedSearch\n\t);\n\tconst { labels } = entityForSuggestions;\n\tconst [ showSearchControl, setShowSearchControl ] = useState( false );\n\tif ( ! showSearchControl && suggestions?.length > 9 ) {\n\t\tsetShowSearchControl( true );\n\t}\n\treturn (\n\t\t<>\n\t\t\t{ showSearchControl && (\n\t\t\t\t<SearchControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tonChange={ setSearch }\n\t\t\t\t\tvalue={ search }\n\t\t\t\t\tlabel={ labels.search_items }\n\t\t\t\t\tplaceholder={ labels.search_items }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! suggestions?.length && (\n\t\t\t\t<Composite\n\t\t\t\t\t{ ...composite }\n\t\t\t\t\trole=\"listbox\"\n\t\t\t\t\tclassName=\"edit-site-custom-template-modal__suggestions_list\"\n\t\t\t\t\taria-label={ __( 'Suggestions list' ) }\n\t\t\t\t>\n\t\t\t\t\t{ suggestions.map( ( suggestion ) => (\n\t\t\t\t\t\t<SuggestionListItem\n\t\t\t\t\t\t\tkey={ suggestion.slug }\n\t\t\t\t\t\t\tsuggestion={ suggestion }\n\t\t\t\t\t\t\tsearch={ debouncedSearch }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\t\t\tcomposite={ composite }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t</Composite>\n\t\t\t) }\n\t\t\t{ debouncedSearch && ! suggestions?.length && (\n\t\t\t\t<Text\n\t\t\t\t\tas=\"p\"\n\t\t\t\t\tclassName=\"edit-site-custom-template-modal__no-results\"\n\t\t\t\t>\n\t\t\t\t\t{ labels.not_found }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction AddCustomTemplateModal( {\n\tonClose,\n\tonSelect,\n\tentityForSuggestions,\n\tisCreatingTemplate,\n} ) {\n\tconst [ showSearchEntities, setShowSearchEntities ] = useState(\n\t\tentityForSuggestions.hasGeneralTemplate\n\t);\n\tconst baseCssClass = 'edit-site-custom-template-modal';\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ sprintf(\n\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t__( 'Add template: %s' ),\n\t\t\t\tentityForSuggestions.labels.singular_name\n\t\t\t) }\n\t\t\tclassName={ baseCssClass }\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t{ isCreatingTemplate && <TemplateActionsLoadingScreen /> }\n\t\t\t{ ! showSearchEntities && (\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<Text as=\"p\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select whether to create a single template for all items or a specific one.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<Flex\n\t\t\t\t\t\tclassName={ `${ baseCssClass }__contents` }\n\t\t\t\t\t\tgap=\"4\"\n\t\t\t\t\t\talign=\"initial\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexItem\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\t\tslug,\n\t\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t\ttemplatePrefix,\n\t\t\t\t\t\t\t\t} = entityForSuggestions.template;\n\t\t\t\t\t\t\t\tonSelect( {\n\t\t\t\t\t\t\t\t\tslug,\n\t\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t\ttemplatePrefix,\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\t\t<Text as=\"span\" weight={ 600 }>\n\t\t\t\t\t\t\t\t{ entityForSuggestions.labels.all_items }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t<Text as=\"span\">\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.\n\t\t\t\t\t\t\t\t\t__( 'For all items' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t<FlexItem\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetShowSearchEntities( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Text as=\"span\" weight={ 600 }>\n\t\t\t\t\t\t\t\t{ entityForSuggestions.labels.singular_name }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t<Text as=\"span\">\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.\n\t\t\t\t\t\t\t\t\t__( 'For a specific item' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t</Flex>\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t\t{ showSearchEntities && (\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<Text as=\"p\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'This template will be used only for the specific item chosen.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<SuggestionList\n\t\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t/>\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t</Modal>\n\t);\n}\n\nexport default AddCustomTemplateModal;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/add-custom-template-modal.js"],"names":["useState","useMemo","useEffect","__","sprintf","Button","Flex","FlexItem","Modal","SearchControl","TextHighlight","__experimentalText","Text","__experimentalVStack","VStack","__unstableComposite","Composite","__unstableUseCompositeState","useCompositeState","__unstableCompositeItem","CompositeItem","useDebounce","useEntityRecords","decodeEntities","TemplateActionsLoadingScreen","mapToIHasNameAndId","EMPTY_ARRAY","SuggestionListItem","suggestion","search","onSelect","entityForSuggestions","composite","baseCssClass","config","getSpecificTemplate","name","link","useDebouncedInput","input","setInput","debounced","setter","setDebounced","useSearchSuggestions","query","order","context","per_page","queryArgs","records","searchResults","hasResolved","searchHasResolved","type","slug","suggestions","setSuggestions","newSuggestions","length","recordNamePath","SuggestionList","orientation","setSearch","debouncedSearch","labels","showSearchControl","setShowSearchControl","search_items","map","not_found","AddCustomTemplateModal","onClose","isCreatingTemplate","showSearchEntities","setShowSearchEntities","hasGeneralTemplate","singular_name","title","description","templatePrefix","template","all_items"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AAF,CANJ,CAzBD,CALD,EAwCC,cAAC,QAAD;AACC,IAAA,OAAO,MADR;AAEC,IAAA,EAAE,EAAGE,MAFN;AAGC,IAAA,OAAO,EAAG,MAAM;AACfsE,MAAAA,qBAAqB,CAAE,IAAF,CAArB;AACA;AALF,KAOC,cAAC,IAAD;AACC,IAAA,EAAE,EAAC,MADJ;AAEC,IAAA,MAAM,EAAG,GAFV;AAGC,IAAA,UAAU,EAAG,aAHd,CAG8B;;AAH9B,KAKG5C,oBAAoB,CAACkC,MAArB,CAA4BY,aAL/B,CAPD,EAcC,cAAC,IAAD;AACC,IAAA,EAAE,EAAC,MADJ;AAEC,IAAA,UAAU,EAAG,aAFd,CAE8B;;AAF9B,KAKE;AACA1E,EAAAA,EAAE,CAAE,qBAAF,CANJ,CAdD,CAxCD,CAND,CAXF,EAoFGuE,kBAAkB,IACnB,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC;AAAT,KACGvE,EAAE,CACH,+DADG,CADL,CADD,EAMC,cAAC,cAAD;AACC,IAAA,oBAAoB,EAAG4B,oBADxB;AAEC,IAAA,QAAQ,EAAGD;AAFZ,IAND,CArFF,CADD;AAoGA;;AAED,eAAeyC,sBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tFlex,\n\tFlexItem,\n\tModal,\n\tSearchControl,\n\tTextHighlight,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n\t__unstableCompositeItem as CompositeItem,\n} from '@wordpress/components';\nimport { useDebounce } from '@wordpress/compose';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport TemplateActionsLoadingScreen from './template-actions-loading-screen';\nimport { mapToIHasNameAndId } from './utils';\n\nconst EMPTY_ARRAY = [];\n\nfunction SuggestionListItem( {\n\tsuggestion,\n\tsearch,\n\tonSelect,\n\tentityForSuggestions,\n\tcomposite,\n} ) {\n\tconst baseCssClass =\n\t\t'edit-site-custom-template-modal__suggestions_list__list-item';\n\treturn (\n\t\t<CompositeItem\n\t\t\trole=\"option\"\n\t\t\tas={ Button }\n\t\t\t{ ...composite }\n\t\t\tclassName={ baseCssClass }\n\t\t\tonClick={ () =>\n\t\t\t\tonSelect(\n\t\t\t\t\tentityForSuggestions.config.getSpecificTemplate(\n\t\t\t\t\t\tsuggestion\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t<Text\n\t\t\t\tsize=\"body\"\n\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\tweight={ 500 }\n\t\t\t\tclassName={ `${ baseCssClass }__title` }\n\t\t\t>\n\t\t\t\t<TextHighlight\n\t\t\t\t\ttext={ decodeEntities( suggestion.name ) }\n\t\t\t\t\thighlight={ search }\n\t\t\t\t/>\n\t\t\t</Text>\n\t\t\t{ suggestion.link && (\n\t\t\t\t<Text\n\t\t\t\t\tsize=\"body\"\n\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\tclassName={ `${ baseCssClass }__info` }\n\t\t\t\t>\n\t\t\t\t\t{ suggestion.link }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</CompositeItem>\n\t);\n}\n\nfunction useDebouncedInput() {\n\tconst [ input, setInput ] = useState( '' );\n\tconst [ debounced, setter ] = useState( '' );\n\tconst setDebounced = useDebounce( setter, 250 );\n\tuseEffect( () => {\n\t\tif ( debounced !== input ) {\n\t\t\tsetDebounced( input );\n\t\t}\n\t}, [ debounced, input ] );\n\treturn [ input, setInput, debounced ];\n}\n\nfunction useSearchSuggestions( entityForSuggestions, search ) {\n\tconst { config } = entityForSuggestions;\n\tconst query = useMemo(\n\t\t() => ( {\n\t\t\torder: 'asc',\n\t\t\tcontext: 'view',\n\t\t\tsearch,\n\t\t\tper_page: search ? 20 : 10,\n\t\t\t...config.queryArgs( search ),\n\t\t} ),\n\t\t[ search, config ]\n\t);\n\tconst { records: searchResults, hasResolved: searchHasResolved } =\n\t\tuseEntityRecords(\n\t\t\tentityForSuggestions.type,\n\t\t\tentityForSuggestions.slug,\n\t\t\tquery\n\t\t);\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) return;\n\t\tlet newSuggestions = EMPTY_ARRAY;\n\t\tif ( searchResults?.length ) {\n\t\t\tnewSuggestions = searchResults;\n\t\t\tif ( config.recordNamePath ) {\n\t\t\t\tnewSuggestions = mapToIHasNameAndId(\n\t\t\t\t\tnewSuggestions,\n\t\t\t\t\tconfig.recordNamePath\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t// Update suggestions only when the query has resolved, so as to keep\n\t\t// the previous results in the UI.\n\t\tsetSuggestions( newSuggestions );\n\t}, [ searchResults, searchHasResolved ] );\n\treturn suggestions;\n}\n\nfunction SuggestionList( { entityForSuggestions, onSelect } ) {\n\tconst composite = useCompositeState( { orientation: 'vertical' } );\n\tconst [ search, setSearch, debouncedSearch ] = useDebouncedInput();\n\tconst suggestions = useSearchSuggestions(\n\t\tentityForSuggestions,\n\t\tdebouncedSearch\n\t);\n\tconst { labels } = entityForSuggestions;\n\tconst [ showSearchControl, setShowSearchControl ] = useState( false );\n\tif ( ! showSearchControl && suggestions?.length > 9 ) {\n\t\tsetShowSearchControl( true );\n\t}\n\treturn (\n\t\t<>\n\t\t\t{ showSearchControl && (\n\t\t\t\t<SearchControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tonChange={ setSearch }\n\t\t\t\t\tvalue={ search }\n\t\t\t\t\tlabel={ labels.search_items }\n\t\t\t\t\tplaceholder={ labels.search_items }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! suggestions?.length && (\n\t\t\t\t<Composite\n\t\t\t\t\t{ ...composite }\n\t\t\t\t\trole=\"listbox\"\n\t\t\t\t\tclassName=\"edit-site-custom-template-modal__suggestions_list\"\n\t\t\t\t\taria-label={ __( 'Suggestions list' ) }\n\t\t\t\t>\n\t\t\t\t\t{ suggestions.map( ( suggestion ) => (\n\t\t\t\t\t\t<SuggestionListItem\n\t\t\t\t\t\t\tkey={ suggestion.slug }\n\t\t\t\t\t\t\tsuggestion={ suggestion }\n\t\t\t\t\t\t\tsearch={ debouncedSearch }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\t\t\tcomposite={ composite }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t</Composite>\n\t\t\t) }\n\t\t\t{ debouncedSearch && ! suggestions?.length && (\n\t\t\t\t<Text\n\t\t\t\t\tas=\"p\"\n\t\t\t\t\tclassName=\"edit-site-custom-template-modal__no-results\"\n\t\t\t\t>\n\t\t\t\t\t{ labels.not_found }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction AddCustomTemplateModal( {\n\tonClose,\n\tonSelect,\n\tentityForSuggestions,\n\tisCreatingTemplate,\n} ) {\n\tconst [ showSearchEntities, setShowSearchEntities ] = useState(\n\t\tentityForSuggestions.hasGeneralTemplate\n\t);\n\tconst baseCssClass = 'edit-site-custom-template-modal';\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ sprintf(\n\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t__( 'Add template: %s' ),\n\t\t\t\tentityForSuggestions.labels.singular_name\n\t\t\t) }\n\t\t\tclassName={ baseCssClass }\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t{ isCreatingTemplate && <TemplateActionsLoadingScreen /> }\n\t\t\t{ ! showSearchEntities && (\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<Text as=\"p\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select whether to create a single template for all items or a specific one.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<Flex\n\t\t\t\t\t\tclassName={ `${ baseCssClass }__contents` }\n\t\t\t\t\t\tgap=\"4\"\n\t\t\t\t\t\talign=\"initial\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexItem\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\t\tslug,\n\t\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t\ttemplatePrefix,\n\t\t\t\t\t\t\t\t} = entityForSuggestions.template;\n\t\t\t\t\t\t\t\tonSelect( {\n\t\t\t\t\t\t\t\t\tslug,\n\t\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t\ttemplatePrefix,\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\t\t<Text\n\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\tweight={ 500 }\n\t\t\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ entityForSuggestions.labels.all_items }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.\n\t\t\t\t\t\t\t\t\t__( 'For all items' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t<FlexItem\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetShowSearchEntities( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\tweight={ 500 }\n\t\t\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ entityForSuggestions.labels.singular_name }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.\n\t\t\t\t\t\t\t\t\t__( 'For a specific item' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t</Flex>\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t\t{ showSearchEntities && (\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<Text as=\"p\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'This template will be used only for the specific item chosen.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<SuggestionList\n\t\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t/>\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t</Modal>\n\t);\n}\n\nexport default AddCustomTemplateModal;\n"]}
@@ -11,13 +11,17 @@ import { __ } from '@wordpress/i18n';
11
11
  import { store as noticesStore } from '@wordpress/notices';
12
12
  import { store as coreStore } from '@wordpress/core-data';
13
13
  import { plus } from '@wordpress/icons';
14
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
14
15
  /**
15
16
  * Internal dependencies
16
17
  */
17
18
 
18
- import { useHistory } from '../routes';
19
19
  import CreateTemplatePartModal from '../create-template-part-modal';
20
20
  import { useExistingTemplateParts, getUniqueTemplatePartTitle, getCleanTemplatePartSlug } from '../../utils/template-part-create';
21
+ import { unlock } from '../../private-apis';
22
+ const {
23
+ useHistory
24
+ } = unlock(routerPrivateApis);
21
25
  export default function NewTemplatePart(_ref) {
22
26
  let {
23
27
  postType,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template-part.js"],"names":["useState","useDispatch","Button","__","store","noticesStore","coreStore","plus","useHistory","CreateTemplatePartModal","useExistingTemplateParts","getUniqueTemplatePartTitle","getCleanTemplatePartSlug","NewTemplatePart","postType","showIcon","toggleProps","history","isModalOpen","setIsModalOpen","createErrorNotice","saveEntityRecord","existingTemplateParts","createTemplatePart","title","area","type","uniqueTitle","cleanSlug","templatePart","slug","content","throwOnError","push","postId","id","canvas","error","errorMessage","message","code","as","Toggle","restToggleProps","labels","add_new"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASC,IAAT,QAAqB,kBAArB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,WAA3B;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AACA,SACCC,wBADD,EAECC,0BAFD,EAGCC,wBAHD,QAIO,kCAJP;AAMA,eAAe,SAASC,eAAT,OAIX;AAAA,MAJqC;A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AAd,EAtBG,CA4BH;AACA,KA7BD,CA6BE,OAAQC,KAAR,EAAgB;AACjB,YAAMC,YAAY,GACjBD,KAAK,CAACE,OAAN,IAAiBF,KAAK,CAACG,IAAN,KAAe,eAAhC,GACGH,KAAK,CAACE,OADT,GAEGpC,EAAE,CACF,qDADE,CAHN;AAOAiB,MAAAA,iBAAiB,CAAEkB,YAAF,EAAgB;AAAEZ,QAAAA,IAAI,EAAE;AAAR,OAAhB,CAAjB;AAEAP,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA;AACD;;AACD,QAAM;AAAEsB,IAAAA,EAAE,EAAEC,MAAM,GAAGxC,MAAf;AAAuB,OAAGyC;AAA1B,MAA8C3B,WAA9C,aAA8CA,WAA9C,cAA8CA,WAA9C,GAA6D,EAAnE;AAEA,SACC,8BACC,cAAC,MAAD,eACM2B,eADN;AAEC,IAAA,OAAO,EAAG,MAAM;AACfxB,MAAAA,cAAc,CAAE,IAAF,CAAd;AACA,KAJF;AAKC,IAAA,IAAI,EAAGJ,QAAQ,GAAGR,IAAH,GAAU,IAL1B;AAMC,IAAA,KAAK,EAAGO,QAAQ,CAAC8B,MAAT,CAAgBC;AANzB,MAQG9B,QAAQ,GAAG,IAAH,GAAUD,QAAQ,CAAC8B,MAAT,CAAgBC,OARrC,CADD,EAWG3B,WAAW,IACZ,cAAC,uBAAD;AACC,IAAA,UAAU,EAAG,MAAMC,cAAc,CAAE,KAAF,CADlC;AAEC,IAAA,QAAQ,EAAGI;AAFZ,IAZF,CADD;AAoBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { plus } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { useHistory } from '../routes';\nimport CreateTemplatePartModal from '../create-template-part-modal';\nimport {\n\tuseExistingTemplateParts,\n\tgetUniqueTemplatePartTitle,\n\tgetCleanTemplatePartSlug,\n} from '../../utils/template-part-create';\n\nexport default function NewTemplatePart( {\n\tpostType,\n\tshowIcon = true,\n\ttoggleProps,\n} ) {\n\tconst history = useHistory();\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst existingTemplateParts = useExistingTemplateParts();\n\n\tasync function createTemplatePart( { title, area } ) {\n\t\tif ( ! title ) {\n\t\t\tcreateErrorNotice( __( 'Title is not defined.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst uniqueTitle = getUniqueTemplatePartTitle(\n\t\t\t\ttitle,\n\t\t\t\texistingTemplateParts\n\t\t\t);\n\t\t\tconst cleanSlug = getCleanTemplatePartSlug( uniqueTitle );\n\n\t\t\tconst templatePart = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t{\n\t\t\t\t\tslug: cleanSlug,\n\t\t\t\t\ttitle: uniqueTitle,\n\t\t\t\t\tcontent: '',\n\t\t\t\t\tarea,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tsetIsModalOpen( false );\n\n\t\t\t// Navigate to the created template part editor.\n\t\t\thistory.push( {\n\t\t\t\tpostId: templatePart.id,\n\t\t\t\tpostType: 'wp_template_part',\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\n\t\t\t// TODO: Add a success notice?\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: __(\n\t\t\t\t\t\t\t'An error occurred while creating the template part.'\n\t\t\t\t\t );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\n\t\t\tsetIsModalOpen( false );\n\t\t}\n\t}\n\tconst { as: Toggle = Button, ...restToggleProps } = toggleProps ?? {};\n\n\treturn (\n\t\t<>\n\t\t\t<Toggle\n\t\t\t\t{ ...restToggleProps }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t} }\n\t\t\t\ticon={ showIcon ? plus : null }\n\t\t\t\tlabel={ postType.labels.add_new }\n\t\t\t>\n\t\t\t\t{ showIcon ? null : postType.labels.add_new }\n\t\t\t</Toggle>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setIsModalOpen( false ) }\n\t\t\t\t\tonCreate={ createTemplatePart }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template-part.js"],"names":["useState","useDispatch","Button","__","store","noticesStore","coreStore","plus","privateApis","routerPrivateApis","CreateTemplatePartModal","useExistingTemplateParts","getUniqueTemplatePartTitle","getCleanTemplatePartSlug","unlock","useHistory","NewTemplatePart","postType","showIcon","toggleProps","history","isModalOpen","setIsModalOpen","createErrorNotice","saveEntityRecord","existingTemplateParts","createTemplatePart","title","area","type","uniqueTitle","cleanSlug","templatePart","slug","content","throwOnError","push","postId","id","canvas","error","errorMessage","message","code","as","Toggle","restToggleProps","labels","add_new"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASC,IAAT,QAAqB,kBAArB;AACA,SAASC,WAAW,IAAIC,iBAAxB,QAAiD,mBAAjD;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC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AA3C;AAYAb,MAAAA,cAAc,CAAE,KAAF,CAAd,CAnBG,CAqBH;;AACAF,MAAAA,OAAO,CAACgB,IAAR,CAAc;AACbC,QAAAA,MAAM,EAAEL,YAAY,CAACM,EADR;AAEbrB,QAAAA,QAAQ,EAAE,kBAFG;AAGbsB,QAAAA,MAAM,EAAE;AAHK,OAAd,EAtBG,CA4BH;AACA,KA7BD,CA6BE,OAAQC,KAAR,EAAgB;AACjB,YAAMC,YAAY,GACjBD,KAAK,CAACE,OAAN,IAAiBF,KAAK,CAACG,IAAN,KAAe,eAAhC,GACGH,KAAK,CAACE,OADT,GAEGvC,EAAE,CACF,qDADE,CAHN;AAOAoB,MAAAA,iBAAiB,CAAEkB,YAAF,EAAgB;AAAEZ,QAAAA,IAAI,EAAE;AAAR,OAAhB,CAAjB;AAEAP,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA;AACD;;AACD,QAAM;AAAEsB,IAAAA,EAAE,EAAEC,MAAM,GAAG3C,MAAf;AAAuB,OAAG4C;AAA1B,MAA8C3B,WAA9C,aAA8CA,WAA9C,cAA8CA,WAA9C,GAA6D,EAAnE;AAEA,SACC,8BACC,cAAC,MAAD,eACM2B,eADN;AAEC,IAAA,OAAO,EAAG,MAAM;AACfxB,MAAAA,cAAc,CAAE,IAAF,CAAd;AACA,KAJF;AAKC,IAAA,IAAI,EAAGJ,QAAQ,GAAGX,IAAH,GAAU,IAL1B;AAMC,IAAA,KAAK,EAAGU,QAAQ,CAAC8B,MAAT,CAAgBC;AANzB,MAQG9B,QAAQ,GAAG,IAAH,GAAUD,QAAQ,CAAC8B,MAAT,CAAgBC,OARrC,CADD,EAWG3B,WAAW,IACZ,cAAC,uBAAD;AACC,IAAA,UAAU,EAAG,MAAMC,cAAc,CAAE,KAAF,CADlC;AAEC,IAAA,QAAQ,EAAGI;AAFZ,IAZF,CADD;AAoBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { plus } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\nimport {\n\tuseExistingTemplateParts,\n\tgetUniqueTemplatePartTitle,\n\tgetCleanTemplatePartSlug,\n} from '../../utils/template-part-create';\nimport { unlock } from '../../private-apis';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport default function NewTemplatePart( {\n\tpostType,\n\tshowIcon = true,\n\ttoggleProps,\n} ) {\n\tconst history = useHistory();\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst existingTemplateParts = useExistingTemplateParts();\n\n\tasync function createTemplatePart( { title, area } ) {\n\t\tif ( ! title ) {\n\t\t\tcreateErrorNotice( __( 'Title is not defined.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst uniqueTitle = getUniqueTemplatePartTitle(\n\t\t\t\ttitle,\n\t\t\t\texistingTemplateParts\n\t\t\t);\n\t\t\tconst cleanSlug = getCleanTemplatePartSlug( uniqueTitle );\n\n\t\t\tconst templatePart = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t{\n\t\t\t\t\tslug: cleanSlug,\n\t\t\t\t\ttitle: uniqueTitle,\n\t\t\t\t\tcontent: '',\n\t\t\t\t\tarea,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tsetIsModalOpen( false );\n\n\t\t\t// Navigate to the created template part editor.\n\t\t\thistory.push( {\n\t\t\t\tpostId: templatePart.id,\n\t\t\t\tpostType: 'wp_template_part',\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\n\t\t\t// TODO: Add a success notice?\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: __(\n\t\t\t\t\t\t\t'An error occurred while creating the template part.'\n\t\t\t\t\t );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\n\t\t\tsetIsModalOpen( false );\n\t\t}\n\t}\n\tconst { as: Toggle = Button, ...restToggleProps } = toggleProps ?? {};\n\n\treturn (\n\t\t<>\n\t\t\t<Toggle\n\t\t\t\t{ ...restToggleProps }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t} }\n\t\t\t\ticon={ showIcon ? plus : null }\n\t\t\t\tlabel={ postType.labels.add_new }\n\t\t\t>\n\t\t\t\t{ showIcon ? null : postType.labels.add_new }\n\t\t\t</Toggle>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setIsModalOpen( false ) }\n\t\t\t\t\tonCreate={ createTemplatePart }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
@@ -7,9 +7,10 @@ import { DropdownMenu, MenuGroup, MenuItem, Tooltip, VisuallyHidden } from '@wor
7
7
  import { useState } from '@wordpress/element';
8
8
  import { useDispatch } from '@wordpress/data';
9
9
  import { store as coreStore } from '@wordpress/core-data';
10
- import { archive, blockMeta, category, home, list, media, notFound, page, plus, post, postAuthor, postDate, search, tag, layout as customGenericTemplateIcon } from '@wordpress/icons';
10
+ import { archive, blockMeta, category, home, list, media, notFound, page, plus, post, postAuthor, postDate, postList, search, tag, layout as customGenericTemplateIcon } from '@wordpress/icons';
11
11
  import { __, sprintf } from '@wordpress/i18n';
12
12
  import { store as noticesStore } from '@wordpress/notices';
13
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
13
14
  /**
14
15
  * Internal dependencies
15
16
  */
@@ -18,12 +19,15 @@ import AddCustomTemplateModal from './add-custom-template-modal';
18
19
  import { useExistingTemplates, useDefaultTemplateTypes, useTaxonomiesMenuItems, usePostTypeMenuItems, useAuthorMenuItem, usePostTypeArchiveMenuItems } from './utils';
19
20
  import AddCustomGenericTemplateModal from './add-custom-generic-template-modal';
20
21
  import TemplateActionsLoadingScreen from './template-actions-loading-screen';
21
- import { useHistory } from '../routes';
22
22
  import { store as editSiteStore } from '../../store';
23
23
  import { unlock } from '../../private-apis';
24
- const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'single', 'page', 'index', 'archive', 'author', 'category', 'date', 'tag', 'taxonomy', 'search', '404'];
24
+ const {
25
+ useHistory
26
+ } = unlock(routerPrivateApis);
27
+ const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'home', 'single', 'page', 'index', 'archive', 'author', 'category', 'date', 'tag', 'taxonomy', 'search', '404'];
25
28
  const TEMPLATE_ICONS = {
26
29
  'front-page': home,
30
+ home: postList,
27
31
  single: post,
28
32
  page,
29
33
  archive,