@wordpress/edit-site 4.19.0 → 5.1.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 (382) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/build/components/add-new-template/add-custom-template-modal.js +1 -0
  3. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  4. package/build/components/add-new-template/index.js +8 -5
  5. package/build/components/add-new-template/index.js.map +1 -1
  6. package/build/components/add-new-template/new-template-part.js +21 -6
  7. package/build/components/add-new-template/new-template-part.js.map +1 -1
  8. package/build/components/add-new-template/new-template.js +12 -8
  9. package/build/components/add-new-template/new-template.js.map +1 -1
  10. package/build/components/app/index.js +15 -30
  11. package/build/components/app/index.js.map +1 -1
  12. package/build/components/block-editor/editor-canvas.js +64 -0
  13. package/build/components/block-editor/editor-canvas.js.map +1 -0
  14. package/build/components/block-editor/index.js +62 -59
  15. package/build/components/block-editor/index.js.map +1 -1
  16. package/build/components/block-editor/resizable-editor.js +10 -44
  17. package/build/components/block-editor/resizable-editor.js.map +1 -1
  18. package/build/components/editor/index.js +76 -135
  19. package/build/components/editor/index.js.map +1 -1
  20. package/build/components/global-styles/block-preview-panel.js +57 -0
  21. package/build/components/global-styles/block-preview-panel.js.map +1 -0
  22. package/build/components/global-styles/border-panel.js +0 -1
  23. package/build/components/global-styles/border-panel.js.map +1 -1
  24. package/build/components/global-styles/context-menu.js +6 -2
  25. package/build/components/global-styles/context-menu.js.map +1 -1
  26. package/build/components/global-styles/custom-css.js +62 -0
  27. package/build/components/global-styles/custom-css.js.map +1 -0
  28. package/build/components/global-styles/dimensions-panel.js +2 -6
  29. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  30. package/build/components/global-styles/global-styles-provider.js +18 -4
  31. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  32. package/build/components/global-styles/hooks.js +5 -2
  33. package/build/components/global-styles/hooks.js.map +1 -1
  34. package/build/components/global-styles/palette.js +1 -1
  35. package/build/components/global-styles/palette.js.map +1 -1
  36. package/build/components/global-styles/screen-background-color.js +0 -1
  37. package/build/components/global-styles/screen-background-color.js.map +1 -1
  38. package/build/components/global-styles/screen-block-list.js +2 -1
  39. package/build/components/global-styles/screen-block-list.js.map +1 -1
  40. package/build/components/global-styles/screen-block.js +5 -1
  41. package/build/components/global-styles/screen-block.js.map +1 -1
  42. package/build/components/global-styles/screen-border.js +47 -0
  43. package/build/components/global-styles/screen-border.js.map +1 -0
  44. package/build/components/global-styles/screen-button-color.js +0 -2
  45. package/build/components/global-styles/screen-button-color.js.map +1 -1
  46. package/build/components/global-styles/screen-colors.js +5 -1
  47. package/build/components/global-styles/screen-colors.js.map +1 -1
  48. package/build/components/global-styles/screen-css.js +42 -0
  49. package/build/components/global-styles/screen-css.js.map +1 -0
  50. package/build/components/global-styles/screen-heading-color.js +1 -3
  51. package/build/components/global-styles/screen-heading-color.js.map +1 -1
  52. package/build/components/global-styles/screen-layout.js +4 -5
  53. package/build/components/global-styles/screen-layout.js.map +1 -1
  54. package/build/components/global-styles/screen-link-color.js +0 -1
  55. package/build/components/global-styles/screen-link-color.js.map +1 -1
  56. package/build/components/global-styles/screen-root.js +20 -2
  57. package/build/components/global-styles/screen-root.js.map +1 -1
  58. package/build/components/global-styles/screen-style-variations.js +3 -3
  59. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  60. package/build/components/global-styles/screen-text-color.js +0 -1
  61. package/build/components/global-styles/screen-text-color.js.map +1 -1
  62. package/build/components/global-styles/screen-typography.js +4 -0
  63. package/build/components/global-styles/screen-typography.js.map +1 -1
  64. package/build/components/global-styles/typography-utils.js +17 -5
  65. package/build/components/global-styles/typography-utils.js.map +1 -1
  66. package/build/components/global-styles/ui.js +50 -4
  67. package/build/components/global-styles/ui.js.map +1 -1
  68. package/build/components/global-styles/use-global-styles-output.js +5 -1
  69. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  70. package/build/components/global-styles/utils.js +14 -4
  71. package/build/components/global-styles/utils.js.map +1 -1
  72. package/build/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +4 -8
  73. package/build/components/global-styles-renderer/index.js.map +1 -0
  74. package/build/components/header-edit-mode/document-actions/index.js +21 -45
  75. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  76. package/build/components/header-edit-mode/index.js +19 -12
  77. package/build/components/header-edit-mode/index.js.map +1 -1
  78. package/build/components/keyboard-shortcuts/index.js +11 -1
  79. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  80. package/build/components/layout/index.js +200 -0
  81. package/build/components/layout/index.js.map +1 -0
  82. package/build/components/list/header.js +5 -1
  83. package/build/components/list/header.js.map +1 -1
  84. package/build/components/list/index.js +4 -22
  85. package/build/components/list/index.js.map +1 -1
  86. package/build/components/navigate-to-link/index.js +1 -3
  87. package/build/components/navigate-to-link/index.js.map +1 -1
  88. package/build/components/routes/index.js +1 -1
  89. package/build/components/routes/index.js.map +1 -1
  90. package/build/components/sidebar/index.js +46 -0
  91. package/build/components/sidebar/index.js.map +1 -0
  92. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +24 -4
  93. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  94. package/build/components/sidebar-edit-mode/index.js +4 -2
  95. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  96. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
  97. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
  98. package/build/components/sidebar-navigation-item/index.js +53 -0
  99. package/build/components/sidebar-navigation-item/index.js.map +1 -0
  100. package/build/components/sidebar-navigation-screen/index.js +49 -0
  101. package/build/components/sidebar-navigation-screen/index.js.map +1 -0
  102. package/build/components/sidebar-navigation-screen-main/index.js +46 -0
  103. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -0
  104. package/build/components/sidebar-navigation-screen-templates/index.js +169 -0
  105. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -0
  106. package/build/components/site-hub/index.js +149 -0
  107. package/build/components/site-hub/index.js.map +1 -0
  108. package/build/components/site-icon/index.js +70 -0
  109. package/build/components/site-icon/index.js.map +1 -0
  110. package/build/components/style-book/index.js +173 -0
  111. package/build/components/style-book/index.js.map +1 -0
  112. package/build/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +5 -4
  113. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -0
  114. package/build/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +53 -0
  115. package/build/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +1 -0
  116. package/build/components/use-edited-entity-record/index.js +60 -0
  117. package/build/components/use-edited-entity-record/index.js.map +1 -0
  118. package/build/hooks/index.js +2 -0
  119. package/build/hooks/index.js.map +1 -1
  120. package/build/hooks/push-changes-to-global-styles/index.js +144 -0
  121. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -0
  122. package/build/index.js +7 -45
  123. package/build/index.js.map +1 -1
  124. package/build/store/actions.js +93 -43
  125. package/build/store/actions.js.map +1 -1
  126. package/build/store/reducer.js +35 -107
  127. package/build/store/reducer.js.map +1 -1
  128. package/build/store/selectors.js +69 -78
  129. package/build/store/selectors.js.map +1 -1
  130. package/build-module/components/add-new-template/add-custom-template-modal.js +1 -0
  131. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  132. package/build-module/components/add-new-template/index.js +7 -5
  133. package/build-module/components/add-new-template/index.js.map +1 -1
  134. package/build-module/components/add-new-template/new-template-part.js +18 -6
  135. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  136. package/build-module/components/add-new-template/new-template.js +13 -9
  137. package/build-module/components/add-new-template/new-template.js.map +1 -1
  138. package/build-module/components/app/index.js +15 -28
  139. package/build-module/components/app/index.js.map +1 -1
  140. package/build-module/components/block-editor/editor-canvas.js +51 -0
  141. package/build-module/components/block-editor/editor-canvas.js.map +1 -0
  142. package/build-module/components/block-editor/index.js +62 -60
  143. package/build-module/components/block-editor/index.js.map +1 -1
  144. package/build-module/components/block-editor/resizable-editor.js +11 -40
  145. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  146. package/build-module/components/editor/index.js +75 -129
  147. package/build-module/components/editor/index.js.map +1 -1
  148. package/build-module/components/global-styles/block-preview-panel.js +46 -0
  149. package/build-module/components/global-styles/block-preview-panel.js.map +1 -0
  150. package/build-module/components/global-styles/border-panel.js +0 -1
  151. package/build-module/components/global-styles/border-panel.js.map +1 -1
  152. package/build-module/components/global-styles/context-menu.js +7 -3
  153. package/build-module/components/global-styles/context-menu.js.map +1 -1
  154. package/build-module/components/global-styles/custom-css.js +52 -0
  155. package/build-module/components/global-styles/custom-css.js.map +1 -0
  156. package/build-module/components/global-styles/dimensions-panel.js +3 -7
  157. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  158. package/build-module/components/global-styles/global-styles-provider.js +18 -4
  159. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  160. package/build-module/components/global-styles/hooks.js +5 -3
  161. package/build-module/components/global-styles/hooks.js.map +1 -1
  162. package/build-module/components/global-styles/palette.js +1 -1
  163. package/build-module/components/global-styles/palette.js.map +1 -1
  164. package/build-module/components/global-styles/screen-background-color.js +0 -1
  165. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  166. package/build-module/components/global-styles/screen-block-list.js +2 -1
  167. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  168. package/build-module/components/global-styles/screen-block.js +4 -1
  169. package/build-module/components/global-styles/screen-block.js.map +1 -1
  170. package/build-module/components/global-styles/screen-border.js +30 -0
  171. package/build-module/components/global-styles/screen-border.js.map +1 -0
  172. package/build-module/components/global-styles/screen-button-color.js +0 -2
  173. package/build-module/components/global-styles/screen-button-color.js.map +1 -1
  174. package/build-module/components/global-styles/screen-colors.js +4 -1
  175. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  176. package/build-module/components/global-styles/screen-css.js +28 -0
  177. package/build-module/components/global-styles/screen-css.js.map +1 -0
  178. package/build-module/components/global-styles/screen-heading-color.js +1 -3
  179. package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
  180. package/build-module/components/global-styles/screen-layout.js +3 -4
  181. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  182. package/build-module/components/global-styles/screen-link-color.js +0 -1
  183. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  184. package/build-module/components/global-styles/screen-root.js +21 -3
  185. package/build-module/components/global-styles/screen-root.js.map +1 -1
  186. package/build-module/components/global-styles/screen-style-variations.js +2 -2
  187. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  188. package/build-module/components/global-styles/screen-text-color.js +0 -1
  189. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  190. package/build-module/components/global-styles/screen-typography.js +3 -0
  191. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  192. package/build-module/components/global-styles/typography-utils.js +17 -5
  193. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  194. package/build-module/components/global-styles/ui.js +48 -5
  195. package/build-module/components/global-styles/ui.js.map +1 -1
  196. package/build-module/components/global-styles/use-global-styles-output.js +5 -1
  197. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  198. package/build-module/components/global-styles/utils.js +13 -5
  199. package/build-module/components/global-styles/utils.js.map +1 -1
  200. package/build-module/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +4 -7
  201. package/build-module/components/global-styles-renderer/index.js.map +1 -0
  202. package/build-module/components/header-edit-mode/document-actions/index.js +22 -43
  203. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  204. package/build-module/components/header-edit-mode/index.js +16 -11
  205. package/build-module/components/header-edit-mode/index.js.map +1 -1
  206. package/build-module/components/keyboard-shortcuts/index.js +10 -1
  207. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  208. package/build-module/components/layout/index.js +173 -0
  209. package/build-module/components/layout/index.js.map +1 -0
  210. package/build-module/components/list/header.js +5 -1
  211. package/build-module/components/list/header.js.map +1 -1
  212. package/build-module/components/list/index.js +4 -19
  213. package/build-module/components/list/index.js.map +1 -1
  214. package/build-module/components/navigate-to-link/index.js +1 -3
  215. package/build-module/components/navigate-to-link/index.js.map +1 -1
  216. package/build-module/components/routes/index.js +1 -1
  217. package/build-module/components/routes/index.js.map +1 -1
  218. package/build-module/components/sidebar/index.js +33 -0
  219. package/build-module/components/sidebar/index.js.map +1 -0
  220. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +27 -7
  221. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  222. package/build-module/components/sidebar-edit-mode/index.js +6 -4
  223. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  224. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +11 -1
  225. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
  226. package/build-module/components/sidebar-navigation-item/index.js +40 -0
  227. package/build-module/components/sidebar-navigation-item/index.js.map +1 -0
  228. package/build-module/components/sidebar-navigation-screen/index.js +39 -0
  229. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -0
  230. package/build-module/components/sidebar-navigation-screen-main/index.js +32 -0
  231. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -0
  232. package/build-module/components/sidebar-navigation-screen-templates/index.js +147 -0
  233. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -0
  234. package/build-module/components/site-hub/index.js +126 -0
  235. package/build-module/components/site-hub/index.js.map +1 -0
  236. package/build-module/components/site-icon/index.js +55 -0
  237. package/build-module/components/site-icon/index.js.map +1 -0
  238. package/build-module/components/style-book/index.js +156 -0
  239. package/build-module/components/style-book/index.js.map +1 -0
  240. package/build-module/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +4 -3
  241. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -0
  242. package/build-module/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +43 -0
  243. package/build-module/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +1 -0
  244. package/build-module/components/use-edited-entity-record/index.js +48 -0
  245. package/build-module/components/use-edited-entity-record/index.js.map +1 -0
  246. package/build-module/hooks/index.js +1 -0
  247. package/build-module/hooks/index.js.map +1 -1
  248. package/build-module/hooks/push-changes-to-global-styles/index.js +132 -0
  249. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -0
  250. package/build-module/index.js +9 -36
  251. package/build-module/index.js.map +1 -1
  252. package/build-module/store/actions.js +87 -42
  253. package/build-module/store/actions.js.map +1 -1
  254. package/build-module/store/reducer.js +35 -102
  255. package/build-module/store/reducer.js.map +1 -1
  256. package/build-module/store/selectors.js +60 -72
  257. package/build-module/store/selectors.js.map +1 -1
  258. package/build-style/style-rtl.css +549 -352
  259. package/build-style/style.css +549 -352
  260. package/package.json +33 -31
  261. package/src/components/add-new-template/add-custom-template-modal.js +1 -0
  262. package/src/components/add-new-template/index.js +6 -3
  263. package/src/components/add-new-template/new-template-part.js +15 -3
  264. package/src/components/add-new-template/new-template.js +14 -7
  265. package/src/components/add-new-template/style.scss +0 -4
  266. package/src/components/app/index.js +14 -43
  267. package/src/components/block-editor/editor-canvas.js +69 -0
  268. package/src/components/block-editor/index.js +100 -87
  269. package/src/components/block-editor/resizable-editor.js +9 -64
  270. package/src/components/block-editor/style.scss +25 -1
  271. package/src/components/code-editor/style.scss +1 -1
  272. package/src/components/editor/index.js +157 -238
  273. package/src/components/editor/style.scss +0 -22
  274. package/src/components/global-styles/block-preview-panel.js +44 -0
  275. package/src/components/global-styles/border-panel.js +0 -1
  276. package/src/components/global-styles/context-menu.js +11 -2
  277. package/src/components/global-styles/custom-css.js +74 -0
  278. package/src/components/global-styles/dimensions-panel.js +2 -5
  279. package/src/components/global-styles/global-styles-provider.js +50 -22
  280. package/src/components/global-styles/hooks.js +8 -3
  281. package/src/components/global-styles/palette.js +1 -1
  282. package/src/components/global-styles/screen-background-color.js +0 -1
  283. package/src/components/global-styles/screen-block-list.js +2 -1
  284. package/src/components/global-styles/screen-block.js +6 -1
  285. package/src/components/global-styles/screen-border.js +25 -0
  286. package/src/components/global-styles/screen-button-color.js +0 -2
  287. package/src/components/global-styles/screen-colors.js +5 -1
  288. package/src/components/global-styles/screen-css.js +33 -0
  289. package/src/components/global-styles/screen-heading-color.js +1 -3
  290. package/src/components/global-styles/screen-layout.js +2 -3
  291. package/src/components/global-styles/screen-link-color.js +0 -1
  292. package/src/components/global-styles/screen-root.js +37 -1
  293. package/src/components/global-styles/screen-style-variations.js +5 -2
  294. package/src/components/global-styles/screen-text-color.js +0 -1
  295. package/src/components/global-styles/screen-typography.js +3 -0
  296. package/src/components/global-styles/style.scss +31 -2
  297. package/src/components/global-styles/test/typography-utils.js +72 -23
  298. package/src/components/global-styles/typography-utils.js +24 -4
  299. package/src/components/global-styles/ui.js +47 -4
  300. package/src/components/global-styles/use-global-styles-output.js +5 -0
  301. package/src/components/global-styles/utils.js +18 -6
  302. package/src/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +3 -9
  303. package/src/components/header-edit-mode/document-actions/index.js +31 -45
  304. package/src/components/header-edit-mode/document-actions/style.scss +8 -1
  305. package/src/components/header-edit-mode/index.js +96 -78
  306. package/src/components/header-edit-mode/style.scss +6 -33
  307. package/src/components/keyboard-shortcuts/index.js +13 -0
  308. package/src/components/layout/index.js +235 -0
  309. package/src/components/layout/style.scss +183 -0
  310. package/src/components/list/header.js +5 -1
  311. package/src/components/list/index.js +12 -31
  312. package/src/components/list/style.scss +3 -4
  313. package/src/components/navigate-to-link/index.js +2 -8
  314. package/src/components/routes/index.js +1 -1
  315. package/src/components/sidebar/index.js +37 -0
  316. package/src/components/sidebar/style.scss +8 -0
  317. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +42 -7
  318. package/src/components/sidebar-edit-mode/index.js +4 -4
  319. package/src/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
  320. package/src/components/sidebar-edit-mode/navigation-menu-sidebar/style.scss +21 -3
  321. package/src/components/sidebar-edit-mode/settings-header/style.scss +47 -34
  322. package/src/components/sidebar-edit-mode/style.scss +0 -13
  323. package/src/components/sidebar-navigation-item/index.js +51 -0
  324. package/src/components/sidebar-navigation-item/style.scss +17 -0
  325. package/src/components/sidebar-navigation-screen/index.js +55 -0
  326. package/src/components/sidebar-navigation-screen/style.scss +39 -0
  327. package/src/components/sidebar-navigation-screen-main/index.js +44 -0
  328. package/src/components/sidebar-navigation-screen-templates/index.js +163 -0
  329. package/src/components/sidebar-navigation-screen-templates/style.scss +9 -0
  330. package/src/components/site-hub/index.js +150 -0
  331. package/src/components/site-hub/style.scss +31 -0
  332. package/src/components/site-icon/index.js +56 -0
  333. package/src/components/site-icon/style.scss +10 -0
  334. package/src/components/style-book/index.js +193 -0
  335. package/src/components/style-book/style.scss +78 -0
  336. package/src/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +3 -3
  337. package/src/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +36 -0
  338. package/src/components/template-details/style.scss +4 -0
  339. package/src/components/use-edited-entity-record/index.js +37 -0
  340. package/src/hooks/index.js +1 -0
  341. package/src/hooks/push-changes-to-global-styles/index.js +162 -0
  342. package/src/hooks/push-changes-to-global-styles/style.scss +4 -0
  343. package/src/index.js +5 -53
  344. package/src/store/actions.js +93 -48
  345. package/src/store/reducer.js +29 -91
  346. package/src/store/selectors.js +61 -101
  347. package/src/store/test/actions.js +3 -15
  348. package/src/store/test/reducer.js +8 -192
  349. package/src/store/test/selectors.js +3 -42
  350. package/src/style.scss +21 -3
  351. package/build/components/editor/global-styles-renderer.js.map +0 -1
  352. package/build/components/navigation-sidebar/index.js +0 -62
  353. package/build/components/navigation-sidebar/index.js.map +0 -1
  354. package/build/components/navigation-sidebar/navigation-panel/constants.js +0 -77
  355. package/build/components/navigation-sidebar/navigation-panel/constants.js.map +0 -1
  356. package/build/components/navigation-sidebar/navigation-panel/index.js +0 -152
  357. package/build/components/navigation-sidebar/navigation-panel/index.js.map +0 -1
  358. package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -81
  359. package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +0 -1
  360. package/build/components/navigation-sidebar/navigation-toggle/index.js +0 -124
  361. package/build/components/navigation-sidebar/navigation-toggle/index.js.map +0 -1
  362. package/build/components/url-query-controller/index.js.map +0 -1
  363. package/build-module/components/editor/global-styles-renderer.js.map +0 -1
  364. package/build-module/components/navigation-sidebar/index.js +0 -45
  365. package/build-module/components/navigation-sidebar/index.js.map +0 -1
  366. package/build-module/components/navigation-sidebar/navigation-panel/constants.js +0 -49
  367. package/build-module/components/navigation-sidebar/navigation-panel/constants.js.map +0 -1
  368. package/build-module/components/navigation-sidebar/navigation-panel/index.js +0 -131
  369. package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +0 -1
  370. package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -66
  371. package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +0 -1
  372. package/build-module/components/navigation-sidebar/navigation-toggle/index.js +0 -108
  373. package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +0 -1
  374. package/build-module/components/url-query-controller/index.js.map +0 -1
  375. package/src/components/navigation-sidebar/index.js +0 -46
  376. package/src/components/navigation-sidebar/navigation-panel/constants.js +0 -94
  377. package/src/components/navigation-sidebar/navigation-panel/index.js +0 -142
  378. package/src/components/navigation-sidebar/navigation-panel/style.scss +0 -152
  379. package/src/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -81
  380. package/src/components/navigation-sidebar/navigation-toggle/index.js +0 -114
  381. package/src/components/navigation-sidebar/navigation-toggle/style.scss +0 -71
  382. package/src/components/navigation-sidebar/navigation-toggle/test/index.js +0 -65
@@ -6,9 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.__experimentalSetPreviewDeviceType = __experimentalSetPreviewDeviceType;
9
- exports.openGeneralSidebar = exports.closeGeneralSidebar = exports.addTemplate = void 0;
9
+ exports.openGeneralSidebar = exports.closeGeneralSidebar = exports.addTemplate = exports.__unstableSetCanvasMode = void 0;
10
10
  exports.openNavigationPanelToMenu = openNavigationPanelToMenu;
11
11
  exports.revertTemplate = exports.removeTemplate = void 0;
12
+ exports.setEditedPostContext = setEditedPostContext;
12
13
  exports.setHomeTemplateId = setHomeTemplateId;
13
14
  exports.setIsInserterOpened = setIsInserterOpened;
14
15
  exports.setIsListViewOpened = setIsListViewOpened;
@@ -103,17 +104,18 @@ const setTemplate = (templateId, templateSlug) => async _ref2 => {
103
104
  } = _ref2;
104
105
 
105
106
  if (!templateSlug) {
106
- const template = await registry.resolveSelect(_coreData.store).getEntityRecord('postType', 'wp_template', templateId);
107
- templateSlug = template === null || template === void 0 ? void 0 : template.slug;
107
+ try {
108
+ const template = await registry.resolveSelect(_coreData.store).getEntityRecord('postType', 'wp_template', templateId);
109
+ templateSlug = template === null || template === void 0 ? void 0 : template.slug;
110
+ } catch (error) {}
108
111
  }
109
112
 
110
113
  dispatch({
111
- type: 'SET_TEMPLATE',
112
- templateId,
113
- page: {
114
- context: {
115
- templateSlug
116
- }
114
+ type: 'SET_EDITED_POST',
115
+ postType: 'wp_template',
116
+ id: templateId,
117
+ context: {
118
+ templateSlug
117
119
  }
118
120
  });
119
121
  };
@@ -144,12 +146,11 @@ const addTemplate = template => async _ref3 => {
144
146
  }
145
147
 
146
148
  dispatch({
147
- type: 'SET_TEMPLATE',
148
- templateId: newTemplate.id,
149
- page: {
150
- context: {
151
- templateSlug: newTemplate.slug
152
- }
149
+ type: 'SET_EDITED_POST',
150
+ postType: 'wp_template',
151
+ id: newTemplate.id,
152
+ context: {
153
+ templateSlug: newTemplate.slug
153
154
  }
154
155
  });
155
156
  };
@@ -202,22 +203,38 @@ exports.removeTemplate = removeTemplate;
202
203
 
203
204
  function setTemplatePart(templatePartId) {
204
205
  return {
205
- type: 'SET_TEMPLATE_PART',
206
- templatePartId
206
+ type: 'SET_EDITED_POST',
207
+ postType: 'wp_template_part',
208
+ id: templatePartId
209
+ };
210
+ }
211
+ /**
212
+ * @deprecated
213
+ */
214
+
215
+
216
+ function setHomeTemplateId() {
217
+ (0, _deprecated.default)("dispatch( 'core/edit-site' ).setHomeTemplateId", {
218
+ since: '6.2',
219
+ version: '6.4'
220
+ });
221
+ return {
222
+ type: 'NOTHING'
207
223
  };
208
224
  }
209
225
  /**
210
- * Action that sets the home template ID to the template ID of the page resolved
211
- * from a given path.
226
+ * Set's the current block editor context.
227
+ *
228
+ * @param {Object} context The context object.
212
229
  *
213
- * @param {number} homeTemplateId The template ID for the homepage.
230
+ * @return {number} The resolved template ID for the page route.
214
231
  */
215
232
 
216
233
 
217
- function setHomeTemplateId(homeTemplateId) {
234
+ function setEditedPostContext(context) {
218
235
  return {
219
- type: 'SET_HOME_TEMPLATE',
220
- homeTemplateId
236
+ type: 'SET_EDITED_POST_CONTEXT',
237
+ context
221
238
  };
222
239
  }
223
240
  /**
@@ -255,20 +272,19 @@ const setPage = page => async _ref5 => {
255
272
  }
256
273
 
257
274
  dispatch({
258
- type: 'SET_PAGE',
259
- page: template.slug ? { ...page,
260
- context: { ...page.context,
261
- templateSlug: template.slug
262
- }
263
- } : page,
264
- templateId: template.id
275
+ type: 'SET_EDITED_POST',
276
+ postType: 'wp_template',
277
+ id: template.id,
278
+ context: { ...page.context,
279
+ templateSlug: template.slug
280
+ }
265
281
  });
266
282
  return template.id;
267
283
  };
268
284
  /**
269
285
  * Action that sets the active navigation panel menu.
270
286
  *
271
- * @param {string} menu Menu prop of active menu.
287
+ * @deprecated
272
288
  *
273
289
  * @return {Object} Action object.
274
290
  */
@@ -276,37 +292,45 @@ const setPage = page => async _ref5 => {
276
292
 
277
293
  exports.setPage = setPage;
278
294
 
279
- function setNavigationPanelActiveMenu(menu) {
295
+ function setNavigationPanelActiveMenu() {
296
+ (0, _deprecated.default)("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu", {
297
+ since: '6.2',
298
+ version: '6.4'
299
+ });
280
300
  return {
281
- type: 'SET_NAVIGATION_PANEL_ACTIVE_MENU',
282
- menu
301
+ type: 'NOTHING'
283
302
  };
284
303
  }
285
304
  /**
286
305
  * Opens the navigation panel and sets its active menu at the same time.
287
306
  *
288
- * @param {string} menu Identifies the menu to open.
307
+ * @deprecated
289
308
  */
290
309
 
291
310
 
292
- function openNavigationPanelToMenu(menu) {
311
+ function openNavigationPanelToMenu() {
312
+ (0, _deprecated.default)("dispatch( 'core/edit-site' ).openNavigationPanelToMenu", {
313
+ since: '6.2',
314
+ version: '6.4'
315
+ });
293
316
  return {
294
- type: 'OPEN_NAVIGATION_PANEL_TO_MENU',
295
- menu
317
+ type: 'NOTHING'
296
318
  };
297
319
  }
298
320
  /**
299
321
  * Sets whether the navigation panel should be open.
300
322
  *
301
- * @param {boolean} isOpen If true, opens the nav panel. If false, closes it. It
302
- * does not toggle the state, but sets it directly.
323
+ * @deprecated
303
324
  */
304
325
 
305
326
 
306
- function setIsNavigationPanelOpened(isOpen) {
327
+ function setIsNavigationPanelOpened() {
328
+ (0, _deprecated.default)("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened", {
329
+ since: '6.2',
330
+ version: '6.4'
331
+ });
307
332
  return {
308
- type: 'SET_IS_NAVIGATION_PANEL_OPENED',
309
- isOpen
333
+ type: 'NOTHING'
310
334
  };
311
335
  }
312
336
  /**
@@ -527,6 +551,32 @@ const switchEditorMode = mode => _ref10 => {
527
551
  (0, _a11y.speak)((0, _i18n.__)('Mosaic view selected'), 'assertive');
528
552
  }
529
553
  };
554
+ /**
555
+ * Action that switches the canvas mode.
556
+ *
557
+ * @param {?string} mode Canvas mode.
558
+ */
559
+
530
560
 
531
561
  exports.switchEditorMode = switchEditorMode;
562
+
563
+ const __unstableSetCanvasMode = mode => _ref11 => {
564
+ let {
565
+ registry,
566
+ dispatch
567
+ } = _ref11;
568
+
569
+ registry.dispatch(_blockEditor.store).__unstableSetEditorMode('edit');
570
+
571
+ dispatch({
572
+ type: 'SET_CANVAS_MODE',
573
+ mode
574
+ }); // Check if the block list view should be open by default.
575
+
576
+ if (mode === 'edit' && registry.select(_preferences.store).get('core/edit-site', 'showListViewByDefault')) {
577
+ dispatch.setIsListViewOpened(true);
578
+ }
579
+ };
580
+
581
+ exports.__unstableSetCanvasMode = __unstableSetCanvasMode;
532
582
  //# sourceMappingURL=actions.js.map
@@ -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","page","context","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","id","blocks","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","noticesStore","createSuccessNotice","title","rendered","error","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setHomeTemplateId","homeTemplateId","setPage","path","postId","entity","postType","link","__experimentalGetTemplateForLink","setNavigationPanelActiveMenu","menu","openNavigationPanelToMenu","setIsNavigationPanelOpened","isOpen","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","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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;;;;;AACO,MAAMyE,kBAAkB,GAC5BC,IAAF,IACA,SAAoB;AAAA,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,QAAd,EAAyB;AAC/B,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\tconst template = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getEntityRecord( 'postType', 'wp_template', templateId );\n\t\t\ttemplateSlug = template?.slug;\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_TEMPLATE',\n\t\t\ttemplateId,\n\t\t\tpage: { context: { 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_TEMPLATE',\n\t\t\ttemplateId: newTemplate.id,\n\t\t\tpage: { context: { 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_TEMPLATE_PART',\n\t\ttemplatePartId,\n\t};\n}\n\n/**\n * Action that sets the home template ID to the template ID of the page resolved\n * from a given path.\n *\n * @param {number} homeTemplateId The template ID for the homepage.\n */\nexport function setHomeTemplateId( homeTemplateId ) {\n\treturn {\n\t\ttype: 'SET_HOME_TEMPLATE',\n\t\thomeTemplateId,\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_PAGE',\n\t\t\tpage: template.slug\n\t\t\t\t? {\n\t\t\t\t\t\t...page,\n\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t...page.context,\n\t\t\t\t\t\t\ttemplateSlug: template.slug,\n\t\t\t\t\t\t},\n\t\t\t\t }\n\t\t\t\t: page,\n\t\t\ttemplateId: template.id,\n\t\t} );\n\n\t\treturn template.id;\n\t};\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @param {string} menu Menu prop of active menu.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu( menu ) {\n\treturn {\n\t\ttype: 'SET_NAVIGATION_PANEL_ACTIVE_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @param {string} menu Identifies the menu to open.\n */\nexport function openNavigationPanelToMenu( menu ) {\n\treturn {\n\t\ttype: 'OPEN_NAVIGATION_PANEL_TO_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @param {boolean} isOpen If true, opens the nav panel. If false, closes it. It\n * does not toggle the state, but sets it directly.\n */\nexport function setIsNavigationPanelOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_NAVIGATION_PANEL_OPENED',\n\t\tisOpen,\n\t};\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 === 'mosaic' ) {\n\t\t\tspeak( __( 'Mosaic view 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","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","__unstableSetCanvasMode","__unstableSetEditorMode","get"],"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,MA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I,KAAK,QAAd,EAAyB;AAC/B,qBAAO,cAAI,sBAAJ,CAAP,EAAqC,WAArC;AACA;AACD,CAjBK;AAmBP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMI,uBAAuB,GACjCJ,IAAF,IACA,UAA8B;AAAA,MAA5B;AAAEzF,IAAAA,QAAF;AAAYG,IAAAA;AAAZ,GAA4B;;AAC7BH,EAAAA,QAAQ,CAACG,QAAT,CAAmBwF,kBAAnB,EAAsCG,uBAAtC,CAA+D,MAA/D;;AACA3F,EAAAA,QAAQ,CAAE;AACTK,IAAAA,IAAI,EAAE,iBADG;AAETiF,IAAAA;AAFS,GAAF,CAAR,CAF6B,CAM7B;;AACA,MACCA,IAAI,KAAK,MAAT,IACAzF,QAAQ,CACNgC,MADF,CACU5B,kBADV,EAEE2F,GAFF,CAEO,gBAFP,EAEyB,uBAFzB,CAFD,EAKE;AACD5F,IAAAA,QAAQ,CAAC0D,mBAAT,CAA8B,IAA9B;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 === 'mosaic' ) {\n\t\t\tspeak( __( 'Mosaic view selected' ), 'assertive' );\n\t\t}\n\t};\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const __unstableSetCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'showListViewByDefault' )\n\t\t) {\n\t\t\tdispatch.setIsListViewOpened( true );\n\t\t}\n\t};\n"]}
@@ -7,24 +7,16 @@ exports.blockInserterPanel = blockInserterPanel;
7
7
  exports.default = void 0;
8
8
  exports.deviceType = deviceType;
9
9
  exports.editedPost = editedPost;
10
- exports.homeTemplateId = homeTemplateId;
11
10
  exports.listViewPanel = listViewPanel;
12
- exports.navigationPanel = navigationPanel;
13
11
  exports.saveViewPanel = saveViewPanel;
14
12
  exports.settings = settings;
15
13
 
16
14
  var _data = require("@wordpress/data");
17
15
 
18
- var _constants = require("../components/navigation-sidebar/navigation-panel/constants");
19
-
20
16
  /**
21
17
  * WordPress dependencies
22
18
  */
23
19
 
24
- /**
25
- * Internal dependencies
26
- */
27
-
28
20
  /**
29
21
  * Reducer returning the editing canvas device type.
30
22
  *
@@ -83,91 +75,16 @@ function editedPost() {
83
75
  let action = arguments.length > 1 ? arguments[1] : undefined;
84
76
 
85
77
  switch (action.type) {
86
- case 'SET_TEMPLATE':
87
- case 'SET_PAGE':
88
- return {
89
- type: 'wp_template',
90
- id: action.templateId,
91
- page: action.page
92
- };
93
-
94
- case 'SET_TEMPLATE_PART':
78
+ case 'SET_EDITED_POST':
95
79
  return {
96
- type: 'wp_template_part',
97
- id: action.templatePartId
98
- };
99
- }
100
-
101
- return state;
102
- }
103
- /**
104
- * Reducer for information about the site's homepage.
105
- *
106
- * @param {Object} state Current state.
107
- * @param {Object} action Dispatched action.
108
- *
109
- * @return {Object} Updated state.
110
- */
111
-
112
-
113
- function homeTemplateId(state, action) {
114
- switch (action.type) {
115
- case 'SET_HOME_TEMPLATE':
116
- return action.homeTemplateId;
117
- }
118
-
119
- return state;
120
- }
121
- /**
122
- * Reducer for information about the navigation panel, such as its active menu
123
- * and whether it should be opened or closed.
124
- *
125
- * Note: this reducer interacts with the inserter and list view panels reducers
126
- * to make sure that only one of the three panels is open at the same time.
127
- *
128
- * @param {Object} state Current state.
129
- * @param {Object} action Dispatched action.
130
- */
131
-
132
-
133
- function navigationPanel() {
134
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
135
- menu: _constants.MENU_ROOT,
136
- isOpen: false
137
- };
138
- let action = arguments.length > 1 ? arguments[1] : undefined;
139
-
140
- switch (action.type) {
141
- case 'SET_NAVIGATION_PANEL_ACTIVE_MENU':
142
- return { ...state,
143
- menu: action.menu
80
+ postType: action.postType,
81
+ id: action.id,
82
+ context: action.context
144
83
  };
145
84
 
146
- case 'OPEN_NAVIGATION_PANEL_TO_MENU':
85
+ case 'SET_EDITED_POST_CONTEXT':
147
86
  return { ...state,
148
- isOpen: true,
149
- menu: action.menu
150
- };
151
-
152
- case 'SET_IS_NAVIGATION_PANEL_OPENED':
153
- return { ...state,
154
- menu: !action.isOpen ? _constants.MENU_ROOT : state.menu,
155
- // Set menu to root when closing panel.
156
- isOpen: action.isOpen
157
- };
158
-
159
- case 'SET_IS_LIST_VIEW_OPENED':
160
- return { ...state,
161
- menu: state.isOpen && action.isOpen ? _constants.MENU_ROOT : state.menu,
162
- // Set menu to root when closing panel.
163
- isOpen: action.isOpen ? false : state.isOpen
164
- };
165
-
166
- case 'SET_IS_INSERTER_OPENED':
167
- return { ...state,
168
- menu: state.isOpen && action.value ? _constants.MENU_ROOT : state.menu,
169
- // Set menu to root when closing panel.
170
- isOpen: action.value ? false : state.isOpen
87
+ context: action.context
171
88
  };
172
89
  }
173
90
 
@@ -189,15 +106,14 @@ function blockInserterPanel() {
189
106
  let action = arguments.length > 1 ? arguments[1] : undefined;
190
107
 
191
108
  switch (action.type) {
192
- case 'OPEN_NAVIGATION_PANEL_TO_MENU':
193
- return false;
194
-
195
- case 'SET_IS_NAVIGATION_PANEL_OPENED':
196
109
  case 'SET_IS_LIST_VIEW_OPENED':
197
110
  return action.isOpen ? false : state;
198
111
 
199
112
  case 'SET_IS_INSERTER_OPENED':
200
113
  return action.value;
114
+
115
+ case 'SET_CANVAS_MODE':
116
+ return false;
201
117
  }
202
118
 
203
119
  return state;
@@ -218,17 +134,14 @@ function listViewPanel() {
218
134
  let action = arguments.length > 1 ? arguments[1] : undefined;
219
135
 
220
136
  switch (action.type) {
221
- case 'OPEN_NAVIGATION_PANEL_TO_MENU':
222
- return false;
223
-
224
- case 'SET_IS_NAVIGATION_PANEL_OPENED':
225
- return action.isOpen ? false : state;
226
-
227
137
  case 'SET_IS_INSERTER_OPENED':
228
138
  return action.value ? false : state;
229
139
 
230
140
  case 'SET_IS_LIST_VIEW_OPENED':
231
141
  return action.isOpen;
142
+
143
+ case 'SET_CANVAS_MODE':
144
+ return false;
232
145
  }
233
146
 
234
147
  return state;
@@ -246,14 +159,30 @@ function saveViewPanel() {
246
159
  let action = arguments.length > 1 ? arguments[1] : undefined;
247
160
 
248
161
  switch (action.type) {
249
- case 'OPEN_NAVIGATION_PANEL_TO_MENU':
162
+ case 'SET_IS_SAVE_VIEW_OPENED':
163
+ return action.isOpen;
164
+
165
+ case 'SET_CANVAS_MODE':
250
166
  return false;
167
+ }
251
168
 
252
- case 'SET_IS_NAVIGATION_PANEL_OPENED':
253
- return action.isOpen ? false : state;
169
+ return state;
170
+ }
171
+ /**
172
+ * Reducer used to track the site editor canvas mode (edit or view).
173
+ *
174
+ * @param {Object} state Current state.
175
+ * @param {Object} action Dispatched action.
176
+ */
254
177
 
255
- case 'SET_IS_SAVE_VIEW_OPENED':
256
- return action.isOpen;
178
+
179
+ function canvasMode() {
180
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'view';
181
+ let action = arguments.length > 1 ? arguments[1] : undefined;
182
+
183
+ switch (action.type) {
184
+ case 'SET_CANVAS_MODE':
185
+ return action.mode;
257
186
  }
258
187
 
259
188
  return state;
@@ -263,11 +192,10 @@ var _default = (0, _data.combineReducers)({
263
192
  deviceType,
264
193
  settings,
265
194
  editedPost,
266
- homeTemplateId,
267
- navigationPanel,
268
195
  blockInserterPanel,
269
196
  listViewPanel,
270
- saveViewPanel
197
+ saveViewPanel,
198
+ canvasMode
271
199
  });
272
200
 
273
201
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/reducer.js"],"names":["deviceType","state","action","type","settings","editedPost","id","templateId","page","templatePartId","homeTemplateId","navigationPanel","menu","MENU_ROOT","isOpen","value","blockInserterPanel","listViewPanel","saveViewPanel"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAT,GAAiD;AAAA,MAA5BC,KAA4B,uEAApB,SAAoB;AAAA,MAATC,MAAS;;AACvD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,yBAAL;AACC,aAAOD,MAAM,CAACF,UAAd;AAFF;;AAKA,SAAOC,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASG,QAAT,GAAwC;AAAA,MAArBH,KAAqB,uEAAb,EAAa;AAAA,MAATC,MAAS;;AAC9C,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,iBAAL;AACC,aAAO,EACN,GAAGF,KADG;AAEN,WAAGC,MAAM,CAACE;AAFJ,OAAP;AAFF;;AAQA,SAAOH,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,UAAT,GAA0C;AAA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B,GAAwBb,KAA/B;;AACD,SAAK,wBAAL;AACC,aAAOC,MAAM,CAACa,KAAP,GAAe,KAAf,GAAuBd,KAA9B;;AACD,SAAK,yBAAL;AACC,aAAOC,MAAM,CAACY,MAAd;AARF;;AAUA,SAAOb,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASiB,aAAT,GAAgD;AAAA,MAAxBjB,KAAwB,uEAAhB,KAAgB;AAAA,MAATC,MAAS;;AACtD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,+BAAL;AACC,aAAO,KAAP;;AACD,SAAK,gCAAL;AACC,aAAOD,MAAM,CAACY,MAAP,GAAgB,KAAhB,GAAwBb,KAA/B;;AACD,SAAK,yBAAL;AACC,aAAOC,MAAM,CAACY,MAAd;AANF;;AAQA,SAAOb,KAAP;AACA;;eAEc,2BAAiB;AAC/BD,EAAAA,UAD+B;AAE/BI,EAAAA,QAF+B;AAG/BC,EAAAA,UAH+B;AAI/BK,EAAAA,cAJ+B;AAK/BC,EAAAA,eAL+B;AAM/BK,EAAAA,kBAN+B;AAO/BC,EAAAA,aAP+B;AAQ/BC,EAAAA;AAR+B,CAAjB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { MENU_ROOT } from '../components/navigation-sidebar/navigation-panel/constants';\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the settings.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function settings( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the currently edited Post Type,\n * Post Id and the context provided to fill the content of the block editor.\n *\n * @param {Object} state Current edited post.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function editedPost( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_TEMPLATE':\n\t\tcase 'SET_PAGE':\n\t\t\treturn {\n\t\t\t\ttype: 'wp_template',\n\t\t\t\tid: action.templateId,\n\t\t\t\tpage: action.page,\n\t\t\t};\n\t\tcase 'SET_TEMPLATE_PART':\n\t\t\treturn {\n\t\t\t\ttype: 'wp_template_part',\n\t\t\t\tid: action.templatePartId,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for information about the site's homepage.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function homeTemplateId( state, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_HOME_TEMPLATE':\n\t\t\treturn action.homeTemplateId;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for information about the navigation panel, such as its active menu\n * and whether it should be opened or closed.\n *\n * Note: this reducer interacts with the inserter and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function navigationPanel(\n\tstate = { menu: MENU_ROOT, isOpen: false },\n\taction\n) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_NAVIGATION_PANEL_ACTIVE_MENU':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: action.menu,\n\t\t\t};\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisOpen: true,\n\t\t\t\tmenu: action.menu,\n\t\t\t};\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: ! action.isOpen ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.isOpen,\n\t\t\t};\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: state.isOpen && action.isOpen ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.isOpen ? false : state.isOpen,\n\t\t\t};\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: state.isOpen && action.value ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.value ? false : state.isOpen,\n\t\t\t};\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the navigation and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {boolean|Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn false;\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the navigation and inserter panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn false;\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the save view panel open or closed.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function saveViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn false;\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_SAVE_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tdeviceType,\n\tsettings,\n\teditedPost,\n\thomeTemplateId,\n\tnavigationPanel,\n\tblockInserterPanel,\n\tlistViewPanel,\n\tsaveViewPanel,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/reducer.js"],"names":["deviceType","state","action","type","settings","editedPost","postType","id","context","blockInserterPanel","isOpen","value","listViewPanel","saveViewPanel","canvasMode","mode"],"mappings":";;;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAT,GAAiD;AAAA,MAA5BC,KAA4B,uEAApB,SAAoB;AAAA,MAATC,MAAS;;AACvD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,yBAAL;AACC,aAAOD,MAAM,CAACF,UAAd;AAFF;;AAKA,SAAOC,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASG,QAAT,GAAwC;AAAA,MAArBH,KAAqB,uEAAb,EAAa;AAAA,MAATC,MAAS;;AAC9C,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,iBAAL;AACC,aAAO,EACN,GAAGF,KADG;AAEN,WAAGC,MAAM,CAACE;AAFJ,OAAP;AAFF;;AAQA,SAAOH,KAAP;AACA;A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AAwB,uEAAhB,KAAgB;AAAA,MAATC,MAAS;;AACtD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,yBAAL;AACC,aAAOD,MAAM,CAACQ,MAAd;;AACD,SAAK,iBAAL;AACC,aAAO,KAAP;AAJF;;AAMA,SAAOT,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASa,UAAT,GAA8C;AAAA,MAAzBb,KAAyB,uEAAjB,MAAiB;AAAA,MAATC,MAAS;;AAC7C,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,iBAAL;AACC,aAAOD,MAAM,CAACa,IAAd;AAFF;;AAKA,SAAOd,KAAP;AACA;;eAEc,2BAAiB;AAC/BD,EAAAA,UAD+B;AAE/BI,EAAAA,QAF+B;AAG/BC,EAAAA,UAH+B;AAI/BI,EAAAA,kBAJ+B;AAK/BG,EAAAA,aAL+B;AAM/BC,EAAAA,aAN+B;AAO/BC,EAAAA;AAP+B,CAAjB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the settings.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function settings( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the currently edited Post Type,\n * Post Id and the context provided to fill the content of the block editor.\n *\n * @param {Object} state Current edited post.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function editedPost( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITED_POST':\n\t\t\treturn {\n\t\t\t\tpostType: action.postType,\n\t\t\t\tid: action.id,\n\t\t\t\tcontext: action.context,\n\t\t\t};\n\t\tcase 'SET_EDITED_POST_CONTEXT':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tcontext: action.context,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the navigation and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {boolean|Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn false;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the navigation and inserter panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn false;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the save view panel open or closed.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function saveViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_SAVE_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn false;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer used to track the site editor canvas mode (edit or view).\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nfunction canvasMode( state = 'view', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn action.mode;\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tdeviceType,\n\tsettings,\n\teditedPost,\n\tblockInserterPanel,\n\tlistViewPanel,\n\tsaveViewPanel,\n\tcanvasMode,\n} );\n"]}