@wordpress/edit-site 5.9.0 → 5.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (545) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +7 -22
  3. package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
  4. package/build/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +32 -27
  5. package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
  6. package/build/components/add-new-template/new-template-part.js +8 -2
  7. package/build/components/add-new-template/new-template-part.js.map +1 -1
  8. package/build/components/add-new-template/new-template.js +104 -68
  9. package/build/components/add-new-template/new-template.js.map +1 -1
  10. package/build/components/app/index.js +8 -2
  11. package/build/components/app/index.js.map +1 -1
  12. package/build/components/block-editor/back-button.js +10 -3
  13. package/build/components/block-editor/back-button.js.map +1 -1
  14. package/build/components/block-editor/editor-canvas.js +39 -6
  15. package/build/components/block-editor/editor-canvas.js.map +1 -1
  16. package/build/components/block-editor/index.js +1 -3
  17. package/build/components/block-editor/index.js.map +1 -1
  18. package/build/components/create-template-part-modal/index.js +6 -7
  19. package/build/components/create-template-part-modal/index.js.map +1 -1
  20. package/build/components/editor/index.js +20 -11
  21. package/build/components/editor/index.js.map +1 -1
  22. package/build/components/editor-canvas-container/index.js +27 -6
  23. package/build/components/editor-canvas-container/index.js.map +1 -1
  24. package/build/components/global-styles/block-preview-panel.js +1 -1
  25. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  26. package/build/components/global-styles/color-palette-panel.js +14 -3
  27. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  28. package/build/components/global-styles/dimensions-panel.js +17 -18
  29. package/build/components/global-styles/dimensions-panel.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 +235 -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 +141 -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 +130 -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 +121 -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 +6 -6
  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 +9 -18
  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 +70 -117
  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/document-actions/index.js +28 -103
  65. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  66. package/build/components/header-edit-mode/index.js +15 -2
  67. package/build/components/header-edit-mode/index.js.map +1 -1
  68. package/build/components/keyboard-shortcuts/register.js +1 -1
  69. package/build/components/keyboard-shortcuts/register.js.map +1 -1
  70. package/build/components/layout/hooks.js +54 -0
  71. package/build/components/layout/hooks.js.map +1 -0
  72. package/build/components/layout/index.js +57 -104
  73. package/build/components/layout/index.js.map +1 -1
  74. package/build/components/list/actions/index.js +5 -2
  75. package/build/components/list/actions/index.js.map +1 -1
  76. package/build/components/list/index.js +9 -3
  77. package/build/components/list/index.js.map +1 -1
  78. package/build/components/list/table.js +1 -1
  79. package/build/components/list/table.js.map +1 -1
  80. package/build/components/plugin-template-setting-panel/index.js +44 -0
  81. package/build/components/plugin-template-setting-panel/index.js.map +1 -0
  82. package/build/components/resizable-frame/index.js +242 -0
  83. package/build/components/resizable-frame/index.js.map +1 -0
  84. package/build/components/revisions/index.js +96 -0
  85. package/build/components/revisions/index.js.map +1 -0
  86. package/build/components/routes/link.js +17 -2
  87. package/build/components/routes/link.js.map +1 -1
  88. package/build/components/routes/use-title.js +8 -2
  89. package/build/components/routes/use-title.js.map +1 -1
  90. package/build/components/save-button/index.js +31 -6
  91. package/build/components/save-button/index.js.map +1 -1
  92. package/build/components/save-hub/index.js +14 -31
  93. package/build/components/save-hub/index.js.map +1 -1
  94. package/build/components/save-panel/index.js +20 -7
  95. package/build/components/save-panel/index.js.map +1 -1
  96. package/build/components/secondary-sidebar/list-view-sidebar.js +6 -10
  97. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  98. package/build/components/sidebar/index.js +19 -5
  99. package/build/components/sidebar/index.js.map +1 -1
  100. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +9 -3
  101. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  102. package/build/components/sidebar-edit-mode/index.js +9 -2
  103. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  104. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +40 -0
  105. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
  106. package/build/components/sidebar-edit-mode/template-card/index.js +1 -8
  107. package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  108. package/build/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +2 -2
  109. package/build/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
  110. package/build/components/sidebar-navigation-item/index.js +5 -7
  111. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  112. package/build/components/sidebar-navigation-screen/index.js +14 -4
  113. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  114. package/build/components/sidebar-navigation-screen-global-styles/index.js +75 -11
  115. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  116. package/build/components/sidebar-navigation-screen-main/index.js +31 -23
  117. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  118. package/build/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
  119. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  120. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +162 -0
  121. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
  122. package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +17 -0
  123. package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
  124. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +55 -93
  125. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  126. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +87 -0
  127. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
  128. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +14 -71
  129. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  130. package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +53 -0
  131. package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
  132. package/build/components/sidebar-navigation-screen-page/index.js +67 -0
  133. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -0
  134. package/build/components/sidebar-navigation-screen-pages/index.js +74 -0
  135. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -0
  136. package/build/components/sidebar-navigation-screen-templates/index.js +39 -12
  137. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  138. package/build/components/sidebar-navigation-subtitle/index.js +18 -0
  139. package/build/components/sidebar-navigation-subtitle/index.js.map +1 -0
  140. package/build/components/site-hub/index.js +34 -6
  141. package/build/components/site-hub/index.js.map +1 -1
  142. package/build/components/start-template-options/index.js +12 -16
  143. package/build/components/start-template-options/index.js.map +1 -1
  144. package/build/components/style-book/index.js +93 -19
  145. package/build/components/style-book/index.js.map +1 -1
  146. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -2
  147. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  148. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +9 -4
  149. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  150. package/build/components/sync-state-with-url/use-sync-path-with-url.js +17 -3
  151. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  152. package/build/components/use-edited-entity-record/index.js +8 -4
  153. package/build/components/use-edited-entity-record/index.js.map +1 -1
  154. package/build/hooks/commands/use-edit-mode-commands.js +105 -0
  155. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -0
  156. package/build/hooks/template-part-edit.js +8 -2
  157. package/build/hooks/template-part-edit.js.map +1 -1
  158. package/build/index.js +8 -0
  159. package/build/index.js.map +1 -1
  160. package/build/store/actions.js +5 -3
  161. package/build/store/actions.js.map +1 -1
  162. package/build/utils/is-previewing-theme.js +27 -0
  163. package/build/utils/is-previewing-theme.js.map +1 -0
  164. package/build/utils/use-activate-theme.js +46 -0
  165. package/build/utils/use-activate-theme.js.map +1 -0
  166. package/build-module/components/add-new-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +8 -20
  167. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
  168. package/build-module/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +34 -28
  169. package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
  170. package/build-module/components/add-new-template/new-template-part.js +5 -1
  171. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  172. package/build-module/components/add-new-template/new-template.js +102 -68
  173. package/build-module/components/add-new-template/new-template.js.map +1 -1
  174. package/build-module/components/app/index.js +6 -2
  175. package/build-module/components/app/index.js.map +1 -1
  176. package/build-module/components/block-editor/back-button.js +6 -1
  177. package/build-module/components/block-editor/back-button.js.map +1 -1
  178. package/build-module/components/block-editor/editor-canvas.js +37 -6
  179. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  180. package/build-module/components/block-editor/index.js +1 -3
  181. package/build-module/components/block-editor/index.js.map +1 -1
  182. package/build-module/components/create-template-part-modal/index.js +7 -8
  183. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  184. package/build-module/components/editor/index.js +18 -11
  185. package/build-module/components/editor/index.js.map +1 -1
  186. package/build-module/components/editor-canvas-container/index.js +27 -8
  187. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  188. package/build-module/components/global-styles/block-preview-panel.js +1 -1
  189. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  190. package/build-module/components/global-styles/color-palette-panel.js +13 -3
  191. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  192. package/build-module/components/global-styles/dimensions-panel.js +17 -18
  193. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  194. package/build-module/components/global-styles/gradients-palette-panel.js +13 -3
  195. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  196. package/build-module/components/global-styles/root-menu.js +47 -0
  197. package/build-module/components/global-styles/root-menu.js.map +1 -0
  198. package/build-module/components/global-styles/screen-block-list.js +4 -2
  199. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  200. package/build-module/components/global-styles/screen-block.js +229 -7
  201. package/build-module/components/global-styles/screen-block.js.map +1 -1
  202. package/build-module/components/global-styles/screen-colors.js +9 -25
  203. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  204. package/build-module/components/global-styles/screen-css.js +20 -15
  205. package/build-module/components/global-styles/screen-css.js.map +1 -1
  206. package/build-module/components/global-styles/screen-layout.js +4 -16
  207. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  208. package/build-module/components/global-styles/screen-revisions/index.js +121 -0
  209. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -0
  210. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +118 -0
  211. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
  212. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +107 -0
  213. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
  214. package/build-module/components/global-styles/screen-root.js +6 -6
  215. package/build-module/components/global-styles/screen-root.js.map +1 -1
  216. package/build-module/components/global-styles/screen-typography-element.js +0 -3
  217. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  218. package/build-module/components/global-styles/screen-typography.js +11 -37
  219. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  220. package/build-module/components/global-styles/style-variations-container.js +10 -18
  221. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  222. package/build-module/components/global-styles/typography-panel.js +7 -11
  223. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  224. package/build-module/components/global-styles/ui.js +71 -115
  225. package/build-module/components/global-styles/ui.js.map +1 -1
  226. package/build-module/components/global-styles/variations-panel.js +3 -22
  227. package/build-module/components/global-styles/variations-panel.js.map +1 -1
  228. package/build-module/components/header-edit-mode/document-actions/index.js +31 -107
  229. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  230. package/build-module/components/header-edit-mode/index.js +16 -4
  231. package/build-module/components/header-edit-mode/index.js.map +1 -1
  232. package/build-module/components/keyboard-shortcuts/register.js +1 -1
  233. package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
  234. package/build-module/components/layout/hooks.js +41 -0
  235. package/build-module/components/layout/hooks.js.map +1 -0
  236. package/build-module/components/layout/index.js +53 -102
  237. package/build-module/components/layout/index.js.map +1 -1
  238. package/build-module/components/list/actions/index.js +6 -3
  239. package/build-module/components/list/actions/index.js.map +1 -1
  240. package/build-module/components/list/index.js +5 -1
  241. package/build-module/components/list/index.js.map +1 -1
  242. package/build-module/components/list/table.js +1 -1
  243. package/build-module/components/list/table.js.map +1 -1
  244. package/build-module/components/plugin-template-setting-panel/index.js +35 -0
  245. package/build-module/components/plugin-template-setting-panel/index.js.map +1 -0
  246. package/build-module/components/resizable-frame/index.js +228 -0
  247. package/build-module/components/resizable-frame/index.js.map +1 -0
  248. package/build-module/components/revisions/index.js +78 -0
  249. package/build-module/components/revisions/index.js.map +1 -0
  250. package/build-module/components/routes/link.js +13 -1
  251. package/build-module/components/routes/link.js.map +1 -1
  252. package/build-module/components/routes/use-title.js +5 -1
  253. package/build-module/components/routes/use-title.js.map +1 -1
  254. package/build-module/components/save-button/index.js +28 -6
  255. package/build-module/components/save-button/index.js.map +1 -1
  256. package/build-module/components/save-hub/index.js +13 -32
  257. package/build-module/components/save-hub/index.js.map +1 -1
  258. package/build-module/components/save-panel/index.js +19 -7
  259. package/build-module/components/save-panel/index.js.map +1 -1
  260. package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -11
  261. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  262. package/build-module/components/sidebar/index.js +14 -4
  263. package/build-module/components/sidebar/index.js.map +1 -1
  264. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +9 -3
  265. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  266. package/build-module/components/sidebar-edit-mode/index.js +10 -5
  267. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  268. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +29 -0
  269. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
  270. package/build-module/components/sidebar-edit-mode/template-card/index.js +2 -7
  271. package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  272. package/build-module/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +2 -2
  273. package/build-module/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
  274. package/build-module/components/sidebar-navigation-item/index.js +6 -8
  275. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  276. package/build-module/components/sidebar-navigation-screen/index.js +13 -5
  277. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  278. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +70 -14
  279. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  280. package/build-module/components/sidebar-navigation-screen-main/index.js +30 -24
  281. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  282. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
  283. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  284. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +141 -0
  285. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
  286. package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +10 -0
  287. package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
  288. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +52 -93
  289. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  290. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +71 -0
  291. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
  292. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +13 -72
  293. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  294. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +40 -0
  295. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
  296. package/build-module/components/sidebar-navigation-screen-page/index.js +48 -0
  297. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -0
  298. package/build-module/components/sidebar-navigation-screen-pages/index.js +57 -0
  299. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -0
  300. package/build-module/components/sidebar-navigation-screen-templates/index.js +38 -12
  301. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  302. package/build-module/components/sidebar-navigation-subtitle/index.js +10 -0
  303. package/build-module/components/sidebar-navigation-subtitle/index.js.map +1 -0
  304. package/build-module/components/site-hub/index.js +32 -6
  305. package/build-module/components/site-hub/index.js.map +1 -1
  306. package/build-module/components/start-template-options/index.js +13 -17
  307. package/build-module/components/start-template-options/index.js.map +1 -1
  308. package/build-module/components/style-book/index.js +93 -20
  309. package/build-module/components/style-book/index.js.map +1 -1
  310. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -1
  311. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  312. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +5 -1
  313. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  314. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +13 -1
  315. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  316. package/build-module/components/use-edited-entity-record/index.js +8 -4
  317. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  318. package/build-module/hooks/commands/use-edit-mode-commands.js +86 -0
  319. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -0
  320. package/build-module/hooks/template-part-edit.js +5 -1
  321. package/build-module/hooks/template-part-edit.js.map +1 -1
  322. package/build-module/index.js +1 -0
  323. package/build-module/index.js.map +1 -1
  324. package/build-module/store/actions.js +5 -3
  325. package/build-module/store/actions.js.map +1 -1
  326. package/build-module/utils/is-previewing-theme.js +17 -0
  327. package/build-module/utils/is-previewing-theme.js.map +1 -0
  328. package/build-module/utils/use-activate-theme.js +36 -0
  329. package/build-module/utils/use-activate-theme.js.map +1 -0
  330. package/build-style/style-rtl.css +409 -265
  331. package/build-style/style.css +410 -265
  332. package/package.json +37 -35
  333. package/src/components/add-new-template/add-custom-generic-template-modal-content.js +82 -0
  334. package/src/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +44 -34
  335. package/src/components/add-new-template/new-template-part.js +4 -1
  336. package/src/components/add-new-template/new-template.js +142 -154
  337. package/src/components/add-new-template/style.scss +120 -103
  338. package/src/components/app/index.js +6 -3
  339. package/src/components/block-editor/back-button.js +4 -1
  340. package/src/components/block-editor/editor-canvas.js +36 -8
  341. package/src/components/block-editor/index.js +2 -3
  342. package/src/components/block-editor/style.scss +15 -8
  343. package/src/components/create-template-part-modal/index.js +19 -25
  344. package/src/components/editor/index.js +20 -8
  345. package/src/components/editor/style.scss +21 -6
  346. package/src/components/editor-canvas-container/index.js +43 -21
  347. package/src/components/global-styles/block-preview-panel.js +1 -1
  348. package/src/components/global-styles/color-palette-panel.js +9 -0
  349. package/src/components/global-styles/dimensions-panel.js +15 -15
  350. package/src/components/global-styles/gradients-palette-panel.js +8 -0
  351. package/src/components/global-styles/root-menu.js +66 -0
  352. package/src/components/global-styles/screen-block-list.js +2 -2
  353. package/src/components/global-styles/screen-block.js +255 -7
  354. package/src/components/global-styles/screen-colors.js +9 -16
  355. package/src/components/global-styles/screen-css.js +21 -21
  356. package/src/components/global-styles/screen-layout.js +5 -9
  357. package/src/components/global-styles/screen-revisions/index.js +169 -0
  358. package/src/components/global-styles/screen-revisions/revisions-buttons.js +139 -0
  359. package/src/components/global-styles/screen-revisions/style.scss +100 -0
  360. package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +138 -0
  361. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +99 -0
  362. package/src/components/global-styles/screen-root.js +7 -5
  363. package/src/components/global-styles/screen-typography-element.js +1 -3
  364. package/src/components/global-styles/screen-typography.js +44 -79
  365. package/src/components/global-styles/style-variations-container.js +17 -28
  366. package/src/components/global-styles/style.scss +4 -23
  367. package/src/components/global-styles/typography-panel.js +12 -13
  368. package/src/components/global-styles/ui.js +83 -110
  369. package/src/components/global-styles/variations-panel.js +3 -26
  370. package/src/components/header-edit-mode/document-actions/index.js +26 -129
  371. package/src/components/header-edit-mode/document-actions/style.scss +28 -59
  372. package/src/components/header-edit-mode/index.js +23 -2
  373. package/src/components/header-edit-mode/style.scss +1 -0
  374. package/src/components/keyboard-shortcuts/register.js +1 -1
  375. package/src/components/layout/hooks.js +46 -0
  376. package/src/components/layout/index.js +60 -125
  377. package/src/components/layout/style.scss +9 -5
  378. package/src/components/list/actions/index.js +12 -5
  379. package/src/components/list/index.js +4 -1
  380. package/src/components/list/style.scss +5 -0
  381. package/src/components/list/table.js +3 -1
  382. package/src/components/plugin-template-setting-panel/index.js +33 -0
  383. package/src/components/resizable-frame/index.js +253 -0
  384. package/src/components/resizable-frame/style.scss +69 -0
  385. package/src/components/revisions/index.js +105 -0
  386. package/src/components/routes/link.js +16 -1
  387. package/src/components/routes/use-title.js +4 -1
  388. package/src/components/save-button/index.js +27 -6
  389. package/src/components/save-hub/index.js +17 -35
  390. package/src/components/save-panel/index.js +15 -3
  391. package/src/components/secondary-sidebar/list-view-sidebar.js +4 -7
  392. package/src/components/sidebar/index.js +15 -4
  393. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +9 -7
  394. package/src/components/sidebar-edit-mode/index.js +17 -6
  395. package/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js +26 -0
  396. package/src/components/sidebar-edit-mode/style.scss +10 -0
  397. package/src/components/sidebar-edit-mode/template-card/index.js +1 -9
  398. package/src/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +1 -2
  399. package/src/components/sidebar-navigation-item/index.js +13 -14
  400. package/src/components/sidebar-navigation-item/style.scss +17 -1
  401. package/src/components/sidebar-navigation-screen/index.js +26 -5
  402. package/src/components/sidebar-navigation-screen/style.scss +1 -2
  403. package/src/components/sidebar-navigation-screen-global-styles/index.js +106 -21
  404. package/src/components/sidebar-navigation-screen-main/index.js +39 -35
  405. package/src/components/sidebar-navigation-screen-navigation-item/index.js +3 -9
  406. package/src/components/sidebar-navigation-screen-navigation-menu/index.js +157 -0
  407. package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +9 -0
  408. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +63 -105
  409. package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +83 -0
  410. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +8 -74
  411. package/src/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +47 -0
  412. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +6 -20
  413. package/src/components/sidebar-navigation-screen-page/index.js +59 -0
  414. package/src/components/sidebar-navigation-screen-pages/index.js +82 -0
  415. package/src/components/sidebar-navigation-screen-pages/style.scss +4 -0
  416. package/src/components/sidebar-navigation-screen-templates/index.js +57 -14
  417. package/src/components/sidebar-navigation-subtitle/index.js +5 -0
  418. package/src/components/sidebar-navigation-subtitle/style.scss +7 -0
  419. package/src/components/site-hub/index.js +88 -58
  420. package/src/components/site-hub/style.scss +8 -0
  421. package/src/components/start-template-options/index.js +19 -27
  422. package/src/components/start-template-options/style.scss +28 -21
  423. package/src/components/style-book/index.js +132 -43
  424. package/src/components/style-book/style.scss +19 -0
  425. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +4 -1
  426. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +3 -1
  427. package/src/components/sync-state-with-url/use-sync-path-with-url.js +14 -1
  428. package/src/components/use-edited-entity-record/index.js +12 -3
  429. package/src/hooks/commands/use-edit-mode-commands.js +79 -0
  430. package/src/hooks/template-part-edit.js +4 -1
  431. package/src/index.js +1 -0
  432. package/src/store/actions.js +4 -5
  433. package/src/store/test/actions.js +6 -14
  434. package/src/store/test/utils.js +15 -5
  435. package/src/style.scss +5 -2
  436. package/src/utils/is-previewing-theme.js +18 -0
  437. package/src/utils/use-activate-theme.js +38 -0
  438. package/build/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
  439. package/build/components/add-new-template/add-custom-template-modal.js.map +0 -1
  440. package/build/components/global-styles/border-panel.js +0 -133
  441. package/build/components/global-styles/border-panel.js.map +0 -1
  442. package/build/components/global-styles/context-menu.js +0 -126
  443. package/build/components/global-styles/context-menu.js.map +0 -1
  444. package/build/components/global-styles/custom-css.js +0 -113
  445. package/build/components/global-styles/custom-css.js.map +0 -1
  446. package/build/components/global-styles/effects-panel.js +0 -53
  447. package/build/components/global-styles/effects-panel.js.map +0 -1
  448. package/build/components/global-styles/filters-panel.js +0 -50
  449. package/build/components/global-styles/filters-panel.js.map +0 -1
  450. package/build/components/global-styles/screen-border.js +0 -61
  451. package/build/components/global-styles/screen-border.js.map +0 -1
  452. package/build/components/global-styles/screen-effects.js +0 -61
  453. package/build/components/global-styles/screen-effects.js.map +0 -1
  454. package/build/components/global-styles/screen-filters.js +0 -46
  455. package/build/components/global-styles/screen-filters.js.map +0 -1
  456. package/build/components/global-styles/screen-variations.js +0 -71
  457. package/build/components/global-styles/screen-variations.js.map +0 -1
  458. package/build/components/navigate-to-link/index.js +0 -51
  459. package/build/components/navigate-to-link/index.js.map +0 -1
  460. package/build/components/routes/index.js +0 -60
  461. package/build/components/routes/index.js.map +0 -1
  462. package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
  463. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -19
  464. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
  465. package/build/components/template-details/edit-template-title.js +0 -42
  466. package/build/components/template-details/edit-template-title.js.map +0 -1
  467. package/build/components/template-details/index.js +0 -103
  468. package/build/components/template-details/index.js.map +0 -1
  469. package/build/components/template-details/template-areas.js +0 -160
  470. package/build/components/template-details/template-areas.js.map +0 -1
  471. package/build/components/template-details/template-part-area-selector.js +0 -48
  472. package/build/components/template-details/template-part-area-selector.js.map +0 -1
  473. package/build/hooks/commands/index.js +0 -19
  474. package/build/hooks/commands/index.js.map +0 -1
  475. package/build/hooks/commands/use-navigation-commands.js +0 -126
  476. package/build/hooks/commands/use-navigation-commands.js.map +0 -1
  477. package/build/hooks/commands/use-wp-admin-commands.js +0 -97
  478. package/build/hooks/commands/use-wp-admin-commands.js.map +0 -1
  479. package/build/utils/history.js +0 -41
  480. package/build/utils/history.js.map +0 -1
  481. package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
  482. package/build-module/components/add-new-template/add-custom-template-modal.js.map +0 -1
  483. package/build-module/components/global-styles/border-panel.js +0 -123
  484. package/build-module/components/global-styles/border-panel.js.map +0 -1
  485. package/build-module/components/global-styles/context-menu.js +0 -107
  486. package/build-module/components/global-styles/context-menu.js.map +0 -1
  487. package/build-module/components/global-styles/custom-css.js +0 -98
  488. package/build-module/components/global-styles/custom-css.js.map +0 -1
  489. package/build-module/components/global-styles/effects-panel.js +0 -43
  490. package/build-module/components/global-styles/effects-panel.js.map +0 -1
  491. package/build-module/components/global-styles/filters-panel.js +0 -40
  492. package/build-module/components/global-styles/filters-panel.js.map +0 -1
  493. package/build-module/components/global-styles/screen-border.js +0 -44
  494. package/build-module/components/global-styles/screen-border.js.map +0 -1
  495. package/build-module/components/global-styles/screen-effects.js +0 -44
  496. package/build-module/components/global-styles/screen-effects.js.map +0 -1
  497. package/build-module/components/global-styles/screen-filters.js +0 -33
  498. package/build-module/components/global-styles/screen-filters.js.map +0 -1
  499. package/build-module/components/global-styles/screen-variations.js +0 -54
  500. package/build-module/components/global-styles/screen-variations.js.map +0 -1
  501. package/build-module/components/navigate-to-link/index.js +0 -39
  502. package/build-module/components/navigate-to-link/index.js.map +0 -1
  503. package/build-module/components/routes/index.js +0 -47
  504. package/build-module/components/routes/index.js.map +0 -1
  505. package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
  506. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -11
  507. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
  508. package/build-module/components/template-details/edit-template-title.js +0 -33
  509. package/build-module/components/template-details/edit-template-title.js.map +0 -1
  510. package/build-module/components/template-details/index.js +0 -83
  511. package/build-module/components/template-details/index.js.map +0 -1
  512. package/build-module/components/template-details/template-areas.js +0 -141
  513. package/build-module/components/template-details/template-areas.js.map +0 -1
  514. package/build-module/components/template-details/template-part-area-selector.js +0 -36
  515. package/build-module/components/template-details/template-part-area-selector.js.map +0 -1
  516. package/build-module/hooks/commands/index.js +0 -10
  517. package/build-module/hooks/commands/index.js.map +0 -1
  518. package/build-module/hooks/commands/use-navigation-commands.js +0 -109
  519. package/build-module/hooks/commands/use-navigation-commands.js.map +0 -1
  520. package/build-module/hooks/commands/use-wp-admin-commands.js +0 -81
  521. package/build-module/hooks/commands/use-wp-admin-commands.js.map +0 -1
  522. package/build-module/utils/history.js +0 -31
  523. package/build-module/utils/history.js.map +0 -1
  524. package/src/components/add-new-template/add-custom-generic-template-modal.js +0 -101
  525. package/src/components/global-styles/border-panel.js +0 -112
  526. package/src/components/global-styles/context-menu.js +0 -175
  527. package/src/components/global-styles/custom-css.js +0 -131
  528. package/src/components/global-styles/effects-panel.js +0 -40
  529. package/src/components/global-styles/filters-panel.js +0 -39
  530. package/src/components/global-styles/screen-border.js +0 -35
  531. package/src/components/global-styles/screen-effects.js +0 -35
  532. package/src/components/global-styles/screen-filters.js +0 -27
  533. package/src/components/global-styles/screen-variations.js +0 -46
  534. package/src/components/navigate-to-link/index.js +0 -46
  535. package/src/components/routes/index.js +0 -53
  536. package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -9
  537. package/src/components/template-details/edit-template-title.js +0 -41
  538. package/src/components/template-details/index.js +0 -113
  539. package/src/components/template-details/style.scss +0 -72
  540. package/src/components/template-details/template-areas.js +0 -164
  541. package/src/components/template-details/template-part-area-selector.js +0 -39
  542. package/src/hooks/commands/index.js +0 -10
  543. package/src/hooks/commands/use-navigation-commands.js +0 -112
  544. package/src/hooks/commands/use-wp-admin-commands.js +0 -79
  545. package/src/utils/history.js +0 -39
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/use-edit-mode-commands.js"],"names":["useHistory","routerPrivateApis","useEditModeCommandLoader","removeTemplate","revertTemplate","editSiteStore","history","isLoaded","record","template","isRemovable","isRevertable","commands","label","type","push","name","icon","trash","context","callback","close","path","backup","isLoading","useEditModeCommands","hook"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAOA;AACA;AACA;AAOA,MAAM;AAAEA,EAAAA;AAAF,IAAiB,yBAAQC,mBAAR,CAAvB;;AAEA,SAASC,wBAAT,GAAoC;AACnC,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAqC,uBAAaC,YAAb,CAA3C;AACA,QAAMC,OAAO,GAAGN,UAAU,EAA1B;AACA,QAAM;AAAEO,IAAAA,QAAF;AAAYC,IAAAA,MAAM,EAAEC;AAApB,MAAiC,qCAAvC;AACA,QAAMC,WAAW,GAChBH,QAAQ,IAAI,CAAC,CAAEE,QAAf,IAA2B,kCAAqBA,QAArB,CAD5B;AAEA,QAAME,YAAY,GACjBJ,QAAQ,IAAI,CAAC,CAAEE,QAAf,IAA2B,mCAAsBA,QAAtB,CAD5B;AAGA,QAAMG,QAAQ,GAAG,EAAjB;;AACA,MAAKF,WAAL,EAAmB;AAClB,UAAMG,KAAK,GACVJ,QAAQ,CAACK,IAAT,KAAkB,aAAlB,GACG,cAAI,iBAAJ,CADH,GAEG,cAAI,sBAAJ,CAHJ;AAIAF,IAAAA,QAAQ,CAACG,IAAT,CAAe;AACdC,MAAAA,IAAI,EAAE,sBADQ;AAEdH,MAAAA,KAFc;AAGdI,MAAAA,IAAI,EAAEC,YAHQ;AAIdC,MAAAA,OAAO,EAAE,kBAJK;AAKdC,MAAAA,QAAQ,EAAE,QAAiB;AAAA,YAAf;AAAEC,UAAAA;AAAF,SAAe;AAC1BlB,QAAAA,cAAc,CAAEM,QAAF,CAAd,CAD0B,CAE1B;;AACAH,QAAAA,OAAO,CAACS,IAAR,CAAc;AACbO,UAAAA,IAAI,EAAE,MAAMb,QAAQ,CAACK;AADR,SAAd;AAGAO,QAAAA,KAAK;AACL;AAZa,KAAf;AAcA;;AACD,MAAKV,YAAL,EAAoB;AACnB,UAAME,KAAK,GACVJ,QAAQ,CAACK,IAAT,KAAkB,aAAlB,GACG,cAAI,gBAAJ,CADH,GAEG,cAAI,qBAAJ,CAHJ;AAIAF,IAAAA,QAAQ,CAACG,IAAT,CAAe;AACdC,MAAAA,IAAI,EAAE,qBADQ;AAEdH,MAAAA,KAFc;AAGdI,MAAAA,IAAI,EAAEM,aAHQ;AAIdH,MAAAA,QAAQ,EAAE,SAAiB;AAAA,YAAf;AAAEC,UAAAA;AAAF,SAAe;AAC1BjB,QAAAA,cAAc,CAAEK,QAAF,CAAd;AACAY,QAAAA,KAAK;AACL;AAPa,KAAf;AASA;;AAED,SAAO;AACNG,IAAAA,SAAS,EAAE,CAAEjB,QADP;AAENK,IAAAA;AAFM,GAAP;AAIA;;AAEM,SAASa,mBAAT,GAA+B;AACrC,kCAAkB;AACjBT,IAAAA,IAAI,EAAE,oCADW;AAEjBU,IAAAA,IAAI,EAAExB,wBAFW;AAGjBiB,IAAAA,OAAO,EAAE;AAHQ,GAAlB;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { trash, backup } from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport useEditedEntityRecord from '../../components/use-edited-entity-record';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { unlock } from '../../private-apis';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction useEditModeCommandLoader() {\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst history = useHistory();\n\tconst { isLoaded, record: template } = useEditedEntityRecord();\n\tconst isRemovable =\n\t\tisLoaded && !! template && isTemplateRemovable( template );\n\tconst isRevertable =\n\t\tisLoaded && !! template && isTemplateRevertable( template );\n\n\tconst commands = [];\n\tif ( isRemovable ) {\n\t\tconst label =\n\t\t\ttemplate.type === 'wp_template'\n\t\t\t\t? __( 'Delete template' )\n\t\t\t\t: __( 'Delete template part' );\n\t\tcommands.push( {\n\t\t\tname: 'core/remove-template',\n\t\t\tlabel,\n\t\t\ticon: trash,\n\t\t\tcontext: 'site-editor-edit',\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tremoveTemplate( template );\n\t\t\t\t// Navigate to the template list\n\t\t\t\thistory.push( {\n\t\t\t\t\tpath: '/' + template.type,\n\t\t\t\t} );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\tif ( isRevertable ) {\n\t\tconst label =\n\t\t\ttemplate.type === 'wp_template'\n\t\t\t\t? __( 'Reset template' )\n\t\t\t\t: __( 'Reset template part' );\n\t\tcommands.push( {\n\t\t\tname: 'core/reset-template',\n\t\t\tlabel,\n\t\t\ticon: backup,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\trevertTemplate( template );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: ! isLoaded,\n\t\tcommands,\n\t};\n}\n\nexport function useEditModeCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/manipulate-document',\n\t\thook: useEditModeCommandLoader,\n\t\tcontext: 'site-editor-edit',\n\t} );\n}\n"]}
@@ -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;;AACA;;AACA;;AAQA;;AACA;;AACA;;AA2EA;;AACA;;AACA;;AA1GA;AACA;AACA;;AAsBA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CAA2BC,EAA3B,EAA+BC,QAA/B,EAA0C;AAChD,QAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAT,CAAyBJ,EAAzB,CAAf;AACA,QAAMK,IAAI,GAAG,yBAAYH,MAAZ,CAAb;;AAEAD,EAAAA,QAAQ,CAACK,kCAAT,GAA8C,CAAEC,MAAF,EAAUC,aAAV,KAC7C,kDAAsBD,MAAtB,EAA8BC,aAA9B,EAA6CP,QAA7C,CADD;;AAEAA,EAAAA,QAAQ,CAACQ,8BAAT,GAA0CC,oCAA1C;;AAEA,sBAAUC,aAAV,EAAwBC,qCAAxB;;AACA,QAAMC,UAAU,GAAG,iDAA8BC,MAA9B,CAClB;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAAgBA,IAAI,KAAK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,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;;AACA;;AACA;;AA3GA;AACA;AACA;;AAsBA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CAA2BC,EAA3B,EAA+BC,QAA/B,EAA0C;AAChD,QAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAT,CAAyBJ,EAAzB,CAAf;AACA,QAAMK,IAAI,GAAG,yBAAYH,MAAZ,CAAb;;AAEAD,EAAAA,QAAQ,CAACK,kCAAT,GAA8C,CAAEC,MAAF,EAAUC,aAAV,KAC7C,kDAAsBD,MAAtB,EAA8BC,aAA9B,EAA6CP,QAA7C,CADD;;AAEAA,EAAAA,QAAQ,CAACQ,8BAAT,GAA0CC,oCAA1C;;AAEA,sBAAUC,aAAV,EAAwBC,qCAAxB;;AACA,QAAMC,UAAU,GAAG,iDAA8BC,MAA9B,CAClB;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAAgBA,IAAI,KAAK,eAAzB;AAAA,GADkB,CAAnB;AAGA,wCAA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AAL,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"]}
@@ -181,7 +181,8 @@ const removeTemplate = template => async _ref4 => {
181
181
  registry.dispatch(_notices.store).createSuccessNotice((0, _i18n.sprintf)(
182
182
  /* translators: The template/part's name. */
183
183
  (0, _i18n.__)('"%s" deleted.'), template.title.rendered), {
184
- type: 'snackbar'
184
+ type: 'snackbar',
185
+ id: 'site-editor-template-deleted-success'
185
186
  });
186
187
  } catch (error) {
187
188
  const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('An error occurred while deleting the template.');
@@ -414,6 +415,8 @@ const revertTemplate = function (template) {
414
415
  let {
415
416
  registry
416
417
  } = _ref6;
418
+ const noticeId = 'edit-site-template-reverted';
419
+ registry.dispatch(_notices.store).removeNotice(noticeId);
417
420
 
418
421
  if (!(0, _isTemplateRevertable.default)(template)) {
419
422
  registry.dispatch(_notices.store).createErrorNotice((0, _i18n.__)('This template is not revertable.'), {
@@ -488,13 +491,12 @@ const revertTemplate = function (template) {
488
491
 
489
492
  registry.dispatch(_notices.store).createSuccessNotice((0, _i18n.__)('Template reverted.'), {
490
493
  type: 'snackbar',
494
+ id: noticeId,
491
495
  actions: [{
492
496
  label: (0, _i18n.__)('Undo'),
493
497
  onClick: undoRevert
494
498
  }]
495
499
  });
496
- } else {
497
- registry.dispatch(_notices.store).createSuccessNotice((0, _i18n.__)('Template reverted.'));
498
500
  }
499
501
  } catch (error) {
500
502
  const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('Template revert failed. Please reload.');
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["toggleFeature","featureName","registry","since","alternative","dispatch","preferencesStore","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","templateId","templateSlug","template","resolveSelect","coreStore","getEntityRecord","slug","error","postType","id","context","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","blocks","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","noticesStore","createSuccessNotice","title","rendered","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setHomeTemplateId","version","setEditedPostContext","setPage","page","path","postId","entity","link","__experimentalGetTemplateForLink","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","isOpen","setIsSaveViewOpened","revertTemplate","allowUndo","templateEntityConfig","getEntityConfig","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","getEditedEntityRecord","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","interfaceStore","enableComplementaryArea","editSiteStoreName","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","blockEditorStore","clearSelectedBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAaA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CAAwBC,WAAxB,EAAsC;AAC5C,SAAO,gBAA0B;AAAA,QAAf;AAAEC,MAAAA;AAAF,KAAe;AAChC,6BAAY,yDAAZ,EAAuE;AACtEC,MAAAA,KAAK,EAAE,KAD+D;AAEtEC,MAAAA,WAAW,EACV;AAHqE,KAAvE;AAMAF,IAAAA,QAAQ,CACNG,QADF,CACYC,kBADZ,EAEEC,MAFF,CAEU,gBAFV,EAE4BN,WAF5B;AAGA,GAVD;AAWA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASO,kCAAT,CAA6CC,UAA7C,EAA0D;AAChE,SAAO;AACNC,IAAAA,IAAI,EAAE,yBADA;AAEND,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,WAAW,GACvB,CAAEC,UAAF,EAAcC,YAAd,KACA,eAAoC;AAAA,MAA5B;AAAER,IAAAA,QAAF;AAAYH,I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AA,MAAlB;AAAElF,IAAAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CACNG,QADF,CACYgF,gBADZ,EAEEC,uBAFF,CAE2BC,qBAF3B,EAE8CH,IAF9C;AAGA,CANK;AAQP;AACA;AACA;;;;;AACO,MAAMI,mBAAmB,GAC/B,MACA,SAAoB;AAAA,MAAlB;AAAEtF,IAAAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CACNG,QADF,CACYgF,gBADZ,EAEEI,wBAFF,CAE4BF,qBAF5B;AAGA,CANK;;;;AAQA,MAAMG,gBAAgB,GAC1BC,IAAF,IACA,UAAoB;AAAA,MAAlB;AAAEzF,IAAAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CACNG,QADF,CACY,kBADZ,EAEEuF,GAFF,CAEO,gBAFP,EAEyB,YAFzB,EAEuCD,IAFvC,EADmB,CAKnB;;AACA,MAAKA,IAAI,KAAK,QAAd,EAAyB;AACxBzF,IAAAA,QAAQ,CAACG,QAAT,CAAmBwF,kBAAnB,EAAsCC,kBAAtC;AACA;;AAED,MAAKH,IAAI,KAAK,QAAd,EAAyB;AACxB,qBAAO,cAAI,wBAAJ,CAAP,EAAuC,WAAvC;AACA,GAFD,MAEO,IAAKA,IAAI,KAAK,MAAd,EAAuB;AAC7B,qBAAO,cAAI,sBAAJ,CAAP,EAAqC,WAArC;AACA;AACD,CAjBK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs, getPathAndQueryString } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( \"select( 'core/edit-site' ).toggleFeature( featureName )\", {\n\t\t\tsince: '6.0',\n\t\t\talternative:\n\t\t\t\t\"select( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t} );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport const setTemplate =\n\t( templateId, templateSlug ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! templateSlug ) {\n\t\t\ttry {\n\t\t\t\tconst template = await registry\n\t\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t\t.getEntityRecord( 'postType', 'wp_template', templateId );\n\t\t\t\ttemplateSlug = template?.slug;\n\t\t\t} catch ( error ) {}\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: templateId,\n\t\t\tcontext: { templateSlug },\n\t\t} );\n\t};\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\n\t\tif ( template.content ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template',\n\t\t\t\t\tnewTemplate.id,\n\t\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t);\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: newTemplate.id,\n\t\t\tcontext: { templateSlug: newTemplate.slug },\n\t\t} );\n\t};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate =\n\t( template ) =>\n\tasync ( { registry } ) => {\n\t\ttry {\n\t\t\tawait registry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.deleteEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\t\tforce: true,\n\t\t\t\t} );\n\n\t\t\tconst lastError = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getLastEntityDeleteError(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\tif ( lastError ) {\n\t\t\t\tthrow lastError;\n\t\t\t}\n\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\ttemplate.title.rendered\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the template.' );\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: 'wp_template_part',\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * @deprecated\n */\nexport function setHomeTemplateId() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Set's the current block editor context.\n *\n * @param {Object} context The context object.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function setEditedPostContext( context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST_CONTEXT',\n\t\tcontext,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport const setPage =\n\t( page ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! page.path && page.context?.postId ) {\n\t\t\tconst entity = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpage.context.postType || 'post',\n\t\t\t\t\tpage.context.postId\n\t\t\t\t);\n\t\t\t// If the entity is undefined for some reason, path will resolve to \"/\"\n\t\t\tpage.path = getPathAndQueryString( entity?.link );\n\t\t}\n\n\t\tconst template = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.__experimentalGetTemplateForLink( page.path );\n\n\t\tif ( ! template ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: template.id,\n\t\t\tcontext: {\n\t\t\t\t...page.context,\n\t\t\t\ttemplateSlug: template.slug,\n\t\t\t},\n\t\t} );\n\n\t\treturn template.id;\n\t};\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @deprecated\n */\nexport function openNavigationPanelToMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).openNavigationPanelToMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @deprecated\n */\nexport function setIsNavigationPanelOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setIsNavigationPanelOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens or closes the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, { allowUndo = true } = {} ) =>\n\tasync ( { registry } ) => {\n\t\tif ( ! isTemplateRevertable( template ) ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templateEntityConfig = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\t\tif ( ! templateEntityConfig ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t\t{ context: 'edit', source: 'theme' }\n\t\t\t);\n\n\t\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\t\tif ( ! fileTemplate ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst serializeBlocks = ( {\n\t\t\t\tblocks: blocksForSerialization = [],\n\t\t\t} ) => __unstableSerializeAndClean( blocksForSerialization );\n\n\t\t\tconst edited = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t\t// the revert in the header toolbar correctly.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks,\n\t\t\t\t\tsource: 'theme',\n\t\t\t\t} );\n\n\t\t\tif ( allowUndo ) {\n\t\t\t\tconst undoRevert = () => {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\tedited.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: undoRevert,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ) );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editSiteStoreName, name );\n\t};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editSiteStoreName );\n\t};\n\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( 'core/preferences' )\n\t\t\t.set( 'core/edit-site', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to a non visual mode.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif ( mode === 'visual' ) {\n\t\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t\t} else if ( mode === 'text' ) {\n\t\t\tspeak( __( 'Code editor selected' ), 'assertive' );\n\t\t}\n\t};\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["toggleFeature","featureName","registry","since","alternative","dispatch","preferencesStore","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","templateId","templateSlug","template","resolveSelect","coreStore","getEntityRecord","slug","error","postType","id","context","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","blocks","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","noticesStore","createSuccessNotice","title","rendered","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setHomeTemplateId","version","setEditedPostContext","setPage","page","path","postId","entity","link","__experimentalGetTemplateForLink","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","isOpen","setIsSaveViewOpened","revertTemplate","allowUndo","noticeId","removeNotice","templateEntityConfig","getEntityConfig","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","getEditedEntityRecord","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","interfaceStore","enableComplementaryArea","editSiteStoreName","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","blockEditorStore","clearSelectedBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAaA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT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AAd,EAAyB;AACxB3F,IAAAA,QAAQ,CAACG,QAAT,CAAmB0F,kBAAnB,EAAsCC,kBAAtC;AACA;;AAED,MAAKH,IAAI,KAAK,QAAd,EAAyB;AACxB,qBAAO,cAAI,wBAAJ,CAAP,EAAuC,WAAvC;AACA,GAFD,MAEO,IAAKA,IAAI,KAAK,MAAd,EAAuB;AAC7B,qBAAO,cAAI,sBAAJ,CAAP,EAAqC,WAArC;AACA;AACD,CAjBK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs, getPathAndQueryString } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( \"select( 'core/edit-site' ).toggleFeature( featureName )\", {\n\t\t\tsince: '6.0',\n\t\t\talternative:\n\t\t\t\t\"select( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t} );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport const setTemplate =\n\t( templateId, templateSlug ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! templateSlug ) {\n\t\t\ttry {\n\t\t\t\tconst template = await registry\n\t\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t\t.getEntityRecord( 'postType', 'wp_template', templateId );\n\t\t\t\ttemplateSlug = template?.slug;\n\t\t\t} catch ( error ) {}\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: templateId,\n\t\t\tcontext: { templateSlug },\n\t\t} );\n\t};\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\n\t\tif ( template.content ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template',\n\t\t\t\t\tnewTemplate.id,\n\t\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t);\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: newTemplate.id,\n\t\t\tcontext: { templateSlug: newTemplate.slug },\n\t\t} );\n\t};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate =\n\t( template ) =>\n\tasync ( { registry } ) => {\n\t\ttry {\n\t\t\tawait registry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.deleteEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\t\tforce: true,\n\t\t\t\t} );\n\n\t\t\tconst lastError = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getLastEntityDeleteError(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\tif ( lastError ) {\n\t\t\t\tthrow lastError;\n\t\t\t}\n\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\ttemplate.title.rendered\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'site-editor-template-deleted-success' }\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the template.' );\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: 'wp_template_part',\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * @deprecated\n */\nexport function setHomeTemplateId() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Set's the current block editor context.\n *\n * @param {Object} context The context object.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function setEditedPostContext( context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST_CONTEXT',\n\t\tcontext,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport const setPage =\n\t( page ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! page.path && page.context?.postId ) {\n\t\t\tconst entity = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpage.context.postType || 'post',\n\t\t\t\t\tpage.context.postId\n\t\t\t\t);\n\t\t\t// If the entity is undefined for some reason, path will resolve to \"/\"\n\t\t\tpage.path = getPathAndQueryString( entity?.link );\n\t\t}\n\n\t\tconst template = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.__experimentalGetTemplateForLink( page.path );\n\n\t\tif ( ! template ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: template.id,\n\t\t\tcontext: {\n\t\t\t\t...page.context,\n\t\t\t\ttemplateSlug: template.slug,\n\t\t\t},\n\t\t} );\n\n\t\treturn template.id;\n\t};\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @deprecated\n */\nexport function openNavigationPanelToMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).openNavigationPanelToMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @deprecated\n */\nexport function setIsNavigationPanelOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setIsNavigationPanelOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens or closes the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, { allowUndo = true } = {} ) =>\n\tasync ( { registry } ) => {\n\t\tconst noticeId = 'edit-site-template-reverted';\n\t\tregistry.dispatch( noticesStore ).removeNotice( noticeId );\n\t\tif ( ! isTemplateRevertable( template ) ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templateEntityConfig = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\t\tif ( ! templateEntityConfig ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t\t{ context: 'edit', source: 'theme' }\n\t\t\t);\n\n\t\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\t\tif ( ! fileTemplate ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst serializeBlocks = ( {\n\t\t\t\tblocks: blocksForSerialization = [],\n\t\t\t} ) => __unstableSerializeAndClean( blocksForSerialization );\n\n\t\t\tconst edited = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t\t// the revert in the header toolbar correctly.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks,\n\t\t\t\t\tsource: 'theme',\n\t\t\t\t} );\n\n\t\t\tif ( allowUndo ) {\n\t\t\t\tconst undoRevert = () => {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\tedited.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: noticeId,\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: undoRevert,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t} );\n\t\t\t}\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: __( 'Template revert failed. Please reload.' );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editSiteStoreName, name );\n\t};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editSiteStoreName );\n\t};\n\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( 'core/preferences' )\n\t\t\t.set( 'core/edit-site', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to a non visual mode.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif ( mode === 'visual' ) {\n\t\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t\t} else if ( mode === 'text' ) {\n\t\t\tspeak( __( 'Code editor selected' ), 'assertive' );\n\t\t}\n\t};\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"]}
@@ -10,18 +10,12 @@ import { kebabCase } from 'lodash';
10
10
 
11
11
  import { useState } from '@wordpress/element';
12
12
  import { __ } from '@wordpress/i18n';
13
- import { Button, Modal, TextControl, __experimentalHStack as HStack, __experimentalVStack as VStack } from '@wordpress/components';
14
- /**
15
- * Internal dependencies
16
- */
13
+ import { Button, TextControl, __experimentalHStack as HStack, __experimentalVStack as VStack } from '@wordpress/components';
17
14
 
18
- import TemplateActionsLoadingScreen from './template-actions-loading-screen';
19
-
20
- function AddCustomGenericTemplateModal(_ref) {
15
+ function AddCustomGenericTemplateModalContent(_ref) {
21
16
  let {
22
17
  onClose,
23
- createTemplate,
24
- isCreatingTemplate
18
+ createTemplate
25
19
  } = _ref;
26
20
  const [title, setTitle] = useState('');
27
21
 
@@ -48,13 +42,7 @@ function AddCustomGenericTemplateModal(_ref) {
48
42
  }
49
43
  }
50
44
 
51
- return createElement(Modal, {
52
- title: __('Create custom template'),
53
- onRequestClose: () => {
54
- onClose();
55
- },
56
- overlayClassName: "edit-site-custom-generic-template__modal"
57
- }, isCreatingTemplate && createElement(TemplateActionsLoadingScreen, null), createElement("form", {
45
+ return createElement("form", {
58
46
  onSubmit: onCreateTemplate
59
47
  }, createElement(VStack, {
60
48
  spacing: 6
@@ -65,7 +53,7 @@ function AddCustomGenericTemplateModal(_ref) {
65
53
  onChange: setTitle,
66
54
  placeholder: defaultTitle,
67
55
  disabled: isBusy,
68
- help: __('Describe the template, e.g. "Post with sidebar".')
56
+ help: __('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')
69
57
  }), createElement(HStack, {
70
58
  className: "edit-site-custom-generic-template__modal-actions",
71
59
  justify: "right"
@@ -79,8 +67,8 @@ function AddCustomGenericTemplateModal(_ref) {
79
67
  type: "submit",
80
68
  isBusy: isBusy,
81
69
  "aria-disabled": isBusy
82
- }, __('Create'))))));
70
+ }, __('Create')))));
83
71
  }
84
72
 
85
- export default AddCustomGenericTemplateModal;
86
- //# sourceMappingURL=add-custom-generic-template-modal.js.map
73
+ export default AddCustomGenericTemplateModalContent;
74
+ //# sourceMappingURL=add-custom-generic-template-modal-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/add-custom-generic-template-modal-content.js"],"names":["kebabCase","useState","__","Button","TextControl","__experimentalHStack","HStack","__experimentalVStack","VStack","AddCustomGenericTemplateModalContent","onClose","createTemplate","title","setTitle","defaultTitle","isBusy","setIsBusy","onCreateTemplate","event","preventDefault","slug"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAC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AAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAG,MAAM;AACfQ,MAAAA,OAAO;AACP;AAJF,KAMGR,EAAE,CAAE,QAAF,CANL,CAJD,EAYC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,MAAM,EAAGa,MAHV;AAIC,qBAAgBA;AAJjB,KAMGb,EAAE,CAAE,QAAF,CANL,CAZD,CAZD,CADD,CADD;AAsCA;;AAED,eAAeO,oCAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\nfunction AddCustomGenericTemplateModalContent( { onClose, createTemplate } ) {\n\tconst [ title, setTitle ] = useState( '' );\n\tconst defaultTitle = __( 'Custom Template' );\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\tasync function onCreateTemplate( event ) {\n\t\tevent.preventDefault();\n\t\tif ( isBusy ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsBusy( true );\n\t\ttry {\n\t\t\tawait createTemplate(\n\t\t\t\t{\n\t\t\t\t\tslug:\n\t\t\t\t\t\t'wp-custom-template-' +\n\t\t\t\t\t\tkebabCase( title || defaultTitle ),\n\t\t\t\t\ttitle: title || defaultTitle,\n\t\t\t\t},\n\t\t\t\tfalse\n\t\t\t);\n\t\t} finally {\n\t\t\tsetIsBusy( false );\n\t\t}\n\t}\n\treturn (\n\t\t<form onSubmit={ onCreateTemplate }>\n\t\t\t<VStack spacing={ 6 }>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\tplaceholder={ defaultTitle }\n\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'Describe the template, e.g. \"Post with sidebar\". A custom template can be manually applied to any post or page.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<HStack\n\t\t\t\t\tclassName=\"edit-site-custom-generic-template__modal-actions\"\n\t\t\t\t\tjustify=\"right\"\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\taria-disabled={ isBusy }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n\nexport default AddCustomGenericTemplateModalContent;\n"]}
@@ -5,8 +5,8 @@ import { createElement, Fragment } from "@wordpress/element";
5
5
  * WordPress dependencies
6
6
  */
7
7
  import { useState, useMemo, useEffect } from '@wordpress/element';
8
- import { __, sprintf } from '@wordpress/i18n';
9
- import { Button, Flex, FlexItem, Modal, SearchControl, TextHighlight, __experimentalText as Text, __experimentalVStack as VStack, __unstableComposite as Composite, __unstableUseCompositeState as useCompositeState, __unstableCompositeItem as CompositeItem } from '@wordpress/components';
8
+ import { __ } from '@wordpress/i18n';
9
+ import { Button, Flex, FlexItem, SearchControl, TextHighlight, __experimentalText as Text, __experimentalVStack as VStack, __unstableComposite as Composite, __unstableUseCompositeState as useCompositeState, __unstableCompositeItem as CompositeItem } from '@wordpress/components';
10
10
  import { useDebounce } from '@wordpress/compose';
11
11
  import { useEntityRecords } from '@wordpress/core-data';
12
12
  import { decodeEntities } from '@wordpress/html-entities';
@@ -14,7 +14,6 @@ import { decodeEntities } from '@wordpress/html-entities';
14
14
  * Internal dependencies
15
15
  */
16
16
 
17
- import TemplateActionsLoadingScreen from './template-actions-loading-screen';
18
17
  import { mapToIHasNameAndId } from './utils';
19
18
  const EMPTY_ARRAY = [];
20
19
 
@@ -33,12 +32,19 @@ function SuggestionListItem(_ref) {
33
32
  }, composite, {
34
33
  className: baseCssClass,
35
34
  onClick: () => onSelect(entityForSuggestions.config.getSpecificTemplate(suggestion))
36
- }), createElement("span", {
35
+ }), createElement(Text, {
36
+ size: "body",
37
+ lineHeight: 1.53846153846 // 20px
38
+ ,
39
+ weight: 500,
37
40
  className: `${baseCssClass}__title`
38
41
  }, createElement(TextHighlight, {
39
42
  text: decodeEntities(suggestion.name),
40
43
  highlight: search
41
- })), suggestion.link && createElement("span", {
44
+ })), suggestion.link && createElement(Text, {
45
+ size: "body",
46
+ lineHeight: 1.53846153846 // 20px
47
+ ,
42
48
  className: `${baseCssClass}__info`
43
49
  }, suggestion.link));
44
50
  }
@@ -132,26 +138,20 @@ function SuggestionList(_ref2) {
132
138
  }, labels.not_found));
133
139
  }
134
140
 
135
- function AddCustomTemplateModal(_ref3) {
141
+ function AddCustomTemplateModalContent(_ref3) {
136
142
  let {
137
- onClose,
138
143
  onSelect,
139
- entityForSuggestions,
140
- isCreatingTemplate
144
+ entityForSuggestions
141
145
  } = _ref3;
142
146
  const [showSearchEntities, setShowSearchEntities] = useState(entityForSuggestions.hasGeneralTemplate);
143
- const baseCssClass = 'edit-site-custom-template-modal';
144
- return createElement(Modal, {
145
- title: sprintf( // translators: %s: Name of the post type e.g: "Post".
146
- __('Add template: %s'), entityForSuggestions.labels.singular_name),
147
- className: baseCssClass,
148
- onRequestClose: onClose
149
- }, isCreatingTemplate && createElement(TemplateActionsLoadingScreen, null), !showSearchEntities && createElement(VStack, {
150
- spacing: 4
151
- }, createElement(Text, {
147
+ return createElement(VStack, {
148
+ spacing: 4,
149
+ className: "edit-site-custom-template-modal__contents-wrapper",
150
+ alignment: "left"
151
+ }, !showSearchEntities && createElement(Fragment, null, createElement(Text, {
152
152
  as: "p"
153
153
  }, __('Select whether to create a single template for all items or a specific one.')), createElement(Flex, {
154
- className: `${baseCssClass}__contents`,
154
+ className: "edit-site-custom-template-modal__contents",
155
155
  gap: "4",
156
156
  align: "initial"
157
157
  }, createElement(FlexItem, {
@@ -173,9 +173,13 @@ function AddCustomTemplateModal(_ref3) {
173
173
  }
174
174
  }, createElement(Text, {
175
175
  as: "span",
176
- weight: 600
176
+ weight: 500,
177
+ lineHeight: 1.53846153846 // 20px
178
+
177
179
  }, entityForSuggestions.labels.all_items), createElement(Text, {
178
- as: "span"
180
+ as: "span",
181
+ lineHeight: 1.53846153846 // 20px
182
+
179
183
  }, // 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
184
  __('For all items'))), createElement(FlexItem, {
181
185
  isBlock: true,
@@ -185,13 +189,15 @@ function AddCustomTemplateModal(_ref3) {
185
189
  }
186
190
  }, createElement(Text, {
187
191
  as: "span",
188
- weight: 600
192
+ weight: 500,
193
+ lineHeight: 1.53846153846 // 20px
194
+
189
195
  }, entityForSuggestions.labels.singular_name), createElement(Text, {
190
- as: "span"
196
+ as: "span",
197
+ lineHeight: 1.53846153846 // 20px
198
+
191
199
  }, // 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
- __('For a specific item'))))), showSearchEntities && createElement(VStack, {
193
- spacing: 4
194
- }, createElement(Text, {
200
+ __('For a specific item'))))), showSearchEntities && createElement(Fragment, null, createElement(Text, {
195
201
  as: "p"
196
202
  }, __('This template will be used only for the specific item chosen.')), createElement(SuggestionList, {
197
203
  entityForSuggestions: entityForSuggestions,
@@ -199,5 +205,5 @@ function AddCustomTemplateModal(_ref3) {
199
205
  })));
200
206
  }
201
207
 
202
- export default AddCustomTemplateModal;
203
- //# sourceMappingURL=add-custom-template-modal.js.map
208
+ export default AddCustomTemplateModalContent;
209
+ //# sourceMappingURL=add-custom-template-modal-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/add-custom-template-modal-content.js"],"names":["useState","useMemo","useEffect","__","Button","Flex","FlexItem","SearchControl","TextHighlight","__experimentalText","Text","__experimentalVStack","VStack","__unstableComposite","Composite","__unstableUseCompositeState","useCompositeState","__unstableCompositeItem","CompositeItem","useDebounce","useEntityRecords","decodeEntities","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","AddCustomTemplateModalContent","showSearchEntities","setShowSearchEntities","hasGeneralTemplate","title","description","templatePrefix","template","all_items","singular_name"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,OAAnB,EAA4BC,SAA5B,QAA6C,oBAA7C;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,MADD,EAECC,IAFD,EAGCC,QAHD,EAICC,aAJD,EAKCC,aALD,EAMCC,kBAAkB,IAAIC,IANvB,EAOCC,oBAAoB,IAAIC,MAPzB,EAQCC,mBAAmB,IAAIC,SARxB,EASCC,2BAA2B,IAAIC,iBAThC,EAUCC,uBAAuB,IAAIC,aAV5B,QAWO,uBAXP;AAYA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,gBAAT,QAAiC,sBAAjC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,SAASC,kBAAT,QAAmC,SAAnC;AAEA,MAAMC,WAAW,GAAG,EAApB;;AAEA,SAASC,kBAAT,OA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AA;AAJS,OAAF,CAAR;AAMA;AAhBF,KAkBC,cAAC,IAAD;AACC,IAAA,EAAE,EAAC,MADJ;AAEC,IAAA,MAAM,EAAG,GAFV;AAGC,IAAA,UAAU,EAAG,aAHd,CAG8B;;AAH9B,KAKG9C,oBAAoB,CAACkC,MAArB,CAA4Bc,SAL/B,CAlBD,EAyBC,cAAC,IAAD;AACC,IAAA,EAAE,EAAC,MADJ;AAEC,IAAA,UAAU,EAAG,aAFd,CAE8B;;AAF9B,KAKE;AACAzE,EAAAA,EAAE,CAAE,eAAF,CANJ,CAzBD,CALD,EAwCC,cAAC,QAAD;AACC,IAAA,OAAO,MADR;AAEC,IAAA,EAAE,EAAGC,MAFN;AAGC,IAAA,OAAO,EAAG,MAAM;AACfkE,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,KAKG1C,oBAAoB,CAACkC,MAArB,CAA4Be,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,CANF,EA+EGkE,kBAAkB,IACnB,8BACC,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC;AAAT,KACGlE,EAAE,CACH,+DADG,CADL,CADD,EAMC,cAAC,cAAD;AACC,IAAA,oBAAoB,EAAGyB,oBADxB;AAEC,IAAA,QAAQ,EAAGD;AAFZ,IAND,CAhFF,CADD;AA+FA;;AAED,eAAeyC,6BAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tFlex,\n\tFlexItem,\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 { 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 AddCustomTemplateModalContent( { onSelect, entityForSuggestions } ) {\n\tconst [ showSearchEntities, setShowSearchEntities ] = useState(\n\t\tentityForSuggestions.hasGeneralTemplate\n\t);\n\treturn (\n\t\t<VStack\n\t\t\tspacing={ 4 }\n\t\t\tclassName=\"edit-site-custom-template-modal__contents-wrapper\"\n\t\t\talignment=\"left\"\n\t\t>\n\t\t\t{ ! showSearchEntities && (\n\t\t\t\t<>\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=\"edit-site-custom-template-modal__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</>\n\t\t\t) }\n\t\t\t{ showSearchEntities && (\n\t\t\t\t<>\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</>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport default AddCustomTemplateModalContent;\n"]}