@wordpress/edit-site 5.2.0 → 5.3.1

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 (409) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/add-new-template/add-custom-generic-template-modal.js +8 -10
  3. package/build/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
  4. package/build/components/add-new-template/add-custom-template-modal.js +0 -1
  5. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  6. package/build/components/add-new-template/new-template-part.js +9 -32
  7. package/build/components/add-new-template/new-template-part.js.map +1 -1
  8. package/build/components/add-new-template/new-template.js +5 -4
  9. package/build/components/add-new-template/new-template.js.map +1 -1
  10. package/build/components/add-new-template/utils.js +1 -9
  11. package/build/components/add-new-template/utils.js.map +1 -1
  12. package/build/components/app/index.js +2 -7
  13. package/build/components/app/index.js.map +1 -1
  14. package/build/components/block-editor/editor-canvas.js +13 -2
  15. package/build/components/block-editor/editor-canvas.js.map +1 -1
  16. package/build/components/block-editor/index.js +16 -14
  17. package/build/components/block-editor/index.js.map +1 -1
  18. package/build/components/block-editor/inserter-media-categories.js +237 -0
  19. package/build/components/block-editor/inserter-media-categories.js.map +1 -0
  20. package/build/components/canvas-spinner/index.js +20 -0
  21. package/build/components/canvas-spinner/index.js.map +1 -0
  22. package/build/components/create-template-part-modal/index.js +4 -2
  23. package/build/components/create-template-part-modal/index.js.map +1 -1
  24. package/build/components/editor/index.js +9 -5
  25. package/build/components/editor/index.js.map +1 -1
  26. package/build/components/error-boundary/index.js +2 -12
  27. package/build/components/error-boundary/index.js.map +1 -1
  28. package/build/components/error-boundary/warning.js +5 -28
  29. package/build/components/error-boundary/warning.js.map +1 -1
  30. package/build/components/global-styles/block-preview-panel.js +2 -2
  31. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  32. package/build/components/global-styles/border-panel.js +17 -9
  33. package/build/components/global-styles/border-panel.js.map +1 -1
  34. package/build/components/global-styles/color-palette-panel.js +13 -7
  35. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  36. package/build/components/global-styles/context-menu.js +39 -4
  37. package/build/components/global-styles/context-menu.js.map +1 -1
  38. package/build/components/global-styles/custom-css.js +65 -14
  39. package/build/components/global-styles/custom-css.js.map +1 -1
  40. package/build/components/global-styles/dimensions-panel.js +49 -31
  41. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  42. package/build/components/global-styles/global-styles-provider.js +13 -3
  43. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  44. package/build/components/global-styles/gradients-palette-panel.js +17 -11
  45. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  46. package/build/components/global-styles/hooks.js +21 -142
  47. package/build/components/global-styles/hooks.js.map +1 -1
  48. package/build/components/global-styles/index.js +0 -28
  49. package/build/components/global-styles/index.js.map +1 -1
  50. package/build/components/global-styles/palette.js +11 -4
  51. package/build/components/global-styles/palette.js.map +1 -1
  52. package/build/components/global-styles/preview.js +18 -15
  53. package/build/components/global-styles/preview.js.map +1 -1
  54. package/build/components/global-styles/screen-background-color.js +27 -13
  55. package/build/components/global-styles/screen-background-color.js.map +1 -1
  56. package/build/components/global-styles/screen-border.js +10 -4
  57. package/build/components/global-styles/screen-border.js.map +1 -1
  58. package/build/components/global-styles/screen-button-color.js +16 -9
  59. package/build/components/global-styles/screen-button-color.js.map +1 -1
  60. package/build/components/global-styles/screen-colors.js +43 -34
  61. package/build/components/global-styles/screen-colors.js.map +1 -1
  62. package/build/components/global-styles/screen-css.js +20 -8
  63. package/build/components/global-styles/screen-css.js.map +1 -1
  64. package/build/components/global-styles/screen-heading-color.js +23 -16
  65. package/build/components/global-styles/screen-heading-color.js.map +1 -1
  66. package/build/components/global-styles/screen-layout.js +3 -3
  67. package/build/components/global-styles/screen-layout.js.map +1 -1
  68. package/build/components/global-styles/screen-link-color.js +18 -11
  69. package/build/components/global-styles/screen-link-color.js.map +1 -1
  70. package/build/components/global-styles/screen-root.js +25 -9
  71. package/build/components/global-styles/screen-root.js.map +1 -1
  72. package/build/components/global-styles/screen-style-variations.js +8 -4
  73. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  74. package/build/components/global-styles/screen-text-color.js +14 -7
  75. package/build/components/global-styles/screen-text-color.js.map +1 -1
  76. package/build/components/global-styles/screen-typography.js +18 -12
  77. package/build/components/global-styles/screen-typography.js.map +1 -1
  78. package/build/components/global-styles/shadow-panel.js +196 -0
  79. package/build/components/global-styles/shadow-panel.js.map +1 -0
  80. package/build/components/global-styles/typography-panel.js +43 -29
  81. package/build/components/global-styles/typography-panel.js.map +1 -1
  82. package/build/components/global-styles/typography-preview.js +19 -9
  83. package/build/components/global-styles/typography-preview.js.map +1 -1
  84. package/build/components/global-styles/ui.js +104 -34
  85. package/build/components/global-styles/ui.js.map +1 -1
  86. package/build/components/global-styles/utils.js +5 -334
  87. package/build/components/global-styles/utils.js.map +1 -1
  88. package/build/components/global-styles-renderer/index.js +7 -5
  89. package/build/components/global-styles-renderer/index.js.map +1 -1
  90. package/build/components/header-edit-mode/document-actions/index.js +2 -2
  91. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  92. package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
  93. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  94. package/build/components/layout/index.js +11 -11
  95. package/build/components/layout/index.js.map +1 -1
  96. package/build/components/list/actions/rename-menu-item.js +8 -11
  97. package/build/components/list/actions/rename-menu-item.js.map +1 -1
  98. package/build/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +9 -6
  99. package/build/components/navigation-inspector/index.js.map +1 -0
  100. package/build/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +14 -14
  101. package/build/components/navigation-inspector/navigation-menu.js.map +1 -0
  102. package/build/components/sidebar/index.js +3 -1
  103. package/build/components/sidebar/index.js.map +1 -1
  104. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +3 -18
  105. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  106. package/build/components/sidebar-edit-mode/index.js +1 -14
  107. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  108. package/build/components/sidebar-navigation-screen/index.js +3 -2
  109. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  110. package/build/components/sidebar-navigation-screen-main/index.js +23 -1
  111. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  112. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +52 -0
  113. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
  114. package/build/components/sidebar-navigation-screen-templates/index.js +3 -8
  115. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  116. package/build/components/site-hub/index.js +11 -10
  117. package/build/components/site-hub/index.js.map +1 -1
  118. package/build/components/site-icon/index.js +1 -1
  119. package/build/components/site-icon/index.js.map +1 -1
  120. package/build/components/style-book/index.js +7 -4
  121. package/build/components/style-book/index.js.map +1 -1
  122. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +6 -4
  123. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  124. package/build/components/template-part-converter/convert-to-template-part.js +5 -9
  125. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  126. package/build/experiments.js +19 -0
  127. package/build/experiments.js.map +1 -0
  128. package/build/hooks/push-changes-to-global-styles/index.js +65 -6
  129. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  130. package/build/index.js +53 -60
  131. package/build/index.js.map +1 -1
  132. package/build/store/actions.js +1 -27
  133. package/build/store/actions.js.map +1 -1
  134. package/build/store/index.js +8 -0
  135. package/build/store/index.js.map +1 -1
  136. package/build/store/private-actions.js +40 -0
  137. package/build/store/private-actions.js.map +1 -0
  138. package/build/store/private-selectors.js +18 -0
  139. package/build/store/private-selectors.js.map +1 -0
  140. package/build/store/selectors.js +7 -40
  141. package/build/store/selectors.js.map +1 -1
  142. package/build/store/utils.js +77 -0
  143. package/build/store/utils.js.map +1 -0
  144. package/build/utils/template-part-create.js +71 -0
  145. package/build/utils/template-part-create.js.map +1 -0
  146. package/build-module/components/add-new-template/add-custom-generic-template-modal.js +9 -11
  147. package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
  148. package/build-module/components/add-new-template/add-custom-template-modal.js +0 -1
  149. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  150. package/build-module/components/add-new-template/new-template-part.js +8 -31
  151. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  152. package/build-module/components/add-new-template/new-template.js +4 -4
  153. package/build-module/components/add-new-template/new-template.js.map +1 -1
  154. package/build-module/components/add-new-template/utils.js +0 -5
  155. package/build-module/components/add-new-template/utils.js.map +1 -1
  156. package/build-module/components/app/index.js +2 -7
  157. package/build-module/components/app/index.js.map +1 -1
  158. package/build-module/components/block-editor/editor-canvas.js +13 -3
  159. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  160. package/build-module/components/block-editor/index.js +17 -15
  161. package/build-module/components/block-editor/index.js.map +1 -1
  162. package/build-module/components/block-editor/inserter-media-categories.js +225 -0
  163. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -0
  164. package/build-module/components/canvas-spinner/index.js +12 -0
  165. package/build-module/components/canvas-spinner/index.js.map +1 -0
  166. package/build-module/components/create-template-part-modal/index.js +5 -3
  167. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  168. package/build-module/components/editor/index.js +7 -5
  169. package/build-module/components/editor/index.js.map +1 -1
  170. package/build-module/components/error-boundary/index.js +2 -12
  171. package/build-module/components/error-boundary/index.js.map +1 -1
  172. package/build-module/components/error-boundary/warning.js +5 -28
  173. package/build-module/components/error-boundary/warning.js.map +1 -1
  174. package/build-module/components/global-styles/block-preview-panel.js +2 -2
  175. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  176. package/build-module/components/global-styles/border-panel.js +17 -11
  177. package/build-module/components/global-styles/border-panel.js.map +1 -1
  178. package/build-module/components/global-styles/color-palette-panel.js +11 -7
  179. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  180. package/build-module/components/global-styles/context-menu.js +40 -8
  181. package/build-module/components/global-styles/context-menu.js.map +1 -1
  182. package/build-module/components/global-styles/custom-css.js +61 -15
  183. package/build-module/components/global-styles/custom-css.js.map +1 -1
  184. package/build-module/components/global-styles/dimensions-panel.js +49 -32
  185. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  186. package/build-module/components/global-styles/global-styles-provider.js +7 -2
  187. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  188. package/build-module/components/global-styles/gradients-palette-panel.js +15 -11
  189. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  190. package/build-module/components/global-styles/hooks.js +23 -134
  191. package/build-module/components/global-styles/hooks.js.map +1 -1
  192. package/build-module/components/global-styles/index.js +0 -2
  193. package/build-module/components/global-styles/index.js.map +1 -1
  194. package/build-module/components/global-styles/palette.js +10 -5
  195. package/build-module/components/global-styles/palette.js.map +1 -1
  196. package/build-module/components/global-styles/preview.js +18 -14
  197. package/build-module/components/global-styles/preview.js.map +1 -1
  198. package/build-module/components/global-styles/screen-background-color.js +26 -15
  199. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  200. package/build-module/components/global-styles/screen-border.js +10 -5
  201. package/build-module/components/global-styles/screen-border.js.map +1 -1
  202. package/build-module/components/global-styles/screen-button-color.js +16 -11
  203. package/build-module/components/global-styles/screen-button-color.js.map +1 -1
  204. package/build-module/components/global-styles/screen-colors.js +43 -37
  205. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  206. package/build-module/components/global-styles/screen-css.js +21 -9
  207. package/build-module/components/global-styles/screen-css.js.map +1 -1
  208. package/build-module/components/global-styles/screen-heading-color.js +23 -18
  209. package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
  210. package/build-module/components/global-styles/screen-layout.js +4 -4
  211. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  212. package/build-module/components/global-styles/screen-link-color.js +18 -13
  213. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  214. package/build-module/components/global-styles/screen-root.js +23 -9
  215. package/build-module/components/global-styles/screen-root.js.map +1 -1
  216. package/build-module/components/global-styles/screen-style-variations.js +5 -2
  217. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  218. package/build-module/components/global-styles/screen-text-color.js +14 -9
  219. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  220. package/build-module/components/global-styles/screen-typography.js +16 -12
  221. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  222. package/build-module/components/global-styles/shadow-panel.js +177 -0
  223. package/build-module/components/global-styles/shadow-panel.js.map +1 -0
  224. package/build-module/components/global-styles/typography-panel.js +43 -31
  225. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  226. package/build-module/components/global-styles/typography-preview.js +17 -9
  227. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  228. package/build-module/components/global-styles/ui.js +98 -35
  229. package/build-module/components/global-styles/ui.js.map +1 -1
  230. package/build-module/components/global-styles/utils.js +4 -319
  231. package/build-module/components/global-styles/utils.js.map +1 -1
  232. package/build-module/components/global-styles-renderer/index.js +5 -5
  233. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  234. package/build-module/components/header-edit-mode/document-actions/index.js +2 -2
  235. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  236. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
  237. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  238. package/build-module/components/layout/index.js +10 -11
  239. package/build-module/components/layout/index.js.map +1 -1
  240. package/build-module/components/list/actions/rename-menu-item.js +9 -12
  241. package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
  242. package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +9 -6
  243. package/build-module/components/navigation-inspector/index.js.map +1 -0
  244. package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +14 -15
  245. package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -0
  246. package/build-module/components/sidebar/index.js +2 -1
  247. package/build-module/components/sidebar/index.js.map +1 -1
  248. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +6 -21
  249. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  250. package/build-module/components/sidebar-edit-mode/index.js +1 -13
  251. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  252. package/build-module/components/sidebar-navigation-screen/index.js +3 -2
  253. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  254. package/build-module/components/sidebar-navigation-screen-main/index.js +22 -2
  255. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  256. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +40 -0
  257. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
  258. package/build-module/components/sidebar-navigation-screen-templates/index.js +4 -9
  259. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  260. package/build-module/components/site-hub/index.js +10 -10
  261. package/build-module/components/site-hub/index.js.map +1 -1
  262. package/build-module/components/site-icon/index.js +1 -1
  263. package/build-module/components/site-icon/index.js.map +1 -1
  264. package/build-module/components/style-book/index.js +8 -5
  265. package/build-module/components/style-book/index.js.map +1 -1
  266. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +5 -4
  267. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  268. package/build-module/components/template-part-converter/convert-to-template-part.js +5 -9
  269. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  270. package/build-module/experiments.js +9 -0
  271. package/build-module/experiments.js.map +1 -0
  272. package/build-module/hooks/push-changes-to-global-styles/index.js +62 -3
  273. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  274. package/build-module/index.js +52 -60
  275. package/build-module/index.js.map +1 -1
  276. package/build-module/store/actions.js +0 -23
  277. package/build-module/store/actions.js.map +1 -1
  278. package/build-module/store/index.js +5 -0
  279. package/build-module/store/index.js.map +1 -1
  280. package/build-module/store/private-actions.js +29 -0
  281. package/build-module/store/private-actions.js.map +1 -0
  282. package/build-module/store/private-selectors.js +11 -0
  283. package/build-module/store/private-selectors.js.map +1 -0
  284. package/build-module/store/selectors.js +6 -37
  285. package/build-module/store/selectors.js.map +1 -1
  286. package/build-module/store/utils.js +66 -0
  287. package/build-module/store/utils.js.map +1 -0
  288. package/build-module/utils/template-part-create.js +53 -0
  289. package/build-module/utils/template-part-create.js.map +1 -0
  290. package/build-style/style-rtl.css +314 -216
  291. package/build-style/style.css +314 -216
  292. package/package.json +32 -30
  293. package/src/components/add-new-template/add-custom-generic-template-modal.js +20 -28
  294. package/src/components/add-new-template/add-custom-template-modal.js +0 -1
  295. package/src/components/add-new-template/new-template-part.js +14 -34
  296. package/src/components/add-new-template/new-template.js +5 -3
  297. package/src/components/add-new-template/style.scss +0 -4
  298. package/src/components/add-new-template/utils.js +0 -14
  299. package/src/components/app/index.js +2 -2
  300. package/src/components/block-editor/editor-canvas.js +12 -2
  301. package/src/components/block-editor/index.js +16 -28
  302. package/src/components/block-editor/inserter-media-categories.js +247 -0
  303. package/src/components/block-editor/style.scss +20 -7
  304. package/src/components/canvas-spinner/index.js +12 -0
  305. package/src/components/canvas-spinner/style.scss +7 -0
  306. package/src/components/create-template-part-modal/index.js +75 -67
  307. package/src/components/create-template-part-modal/style.scss +0 -10
  308. package/src/components/editor/index.js +8 -5
  309. package/src/components/error-boundary/index.js +2 -10
  310. package/src/components/error-boundary/warning.js +6 -35
  311. package/src/components/global-styles/README.md +1 -75
  312. package/src/components/global-styles/block-preview-panel.js +2 -2
  313. package/src/components/global-styles/border-panel.js +19 -17
  314. package/src/components/global-styles/color-palette-panel.js +10 -7
  315. package/src/components/global-styles/context-menu.js +114 -44
  316. package/src/components/global-styles/custom-css.js +76 -19
  317. package/src/components/global-styles/dimensions-panel.js +46 -36
  318. package/src/components/global-styles/global-styles-provider.js +6 -2
  319. package/src/components/global-styles/gradients-palette-panel.js +17 -11
  320. package/src/components/global-styles/hooks.js +31 -155
  321. package/src/components/global-styles/index.js +0 -2
  322. package/src/components/global-styles/palette.js +9 -5
  323. package/src/components/global-styles/preview.js +19 -13
  324. package/src/components/global-styles/screen-background-color.js +37 -21
  325. package/src/components/global-styles/screen-border.js +10 -5
  326. package/src/components/global-styles/screen-button-color.js +21 -19
  327. package/src/components/global-styles/screen-colors.js +48 -65
  328. package/src/components/global-styles/screen-css.js +30 -14
  329. package/src/components/global-styles/screen-heading-color.js +32 -27
  330. package/src/components/global-styles/screen-layout.js +4 -7
  331. package/src/components/global-styles/screen-link-color.js +26 -26
  332. package/src/components/global-styles/screen-root.js +24 -9
  333. package/src/components/global-styles/screen-style-variations.js +7 -2
  334. package/src/components/global-styles/screen-text-color.js +15 -19
  335. package/src/components/global-styles/screen-typography.js +27 -12
  336. package/src/components/global-styles/shadow-panel.js +174 -0
  337. package/src/components/global-styles/style.scss +85 -1
  338. package/src/components/global-styles/typography-panel.js +60 -48
  339. package/src/components/global-styles/typography-preview.js +28 -9
  340. package/src/components/global-styles/ui.js +97 -53
  341. package/src/components/global-styles/utils.js +4 -371
  342. package/src/components/global-styles-renderer/index.js +3 -4
  343. package/src/components/header-edit-mode/document-actions/index.js +1 -1
  344. package/src/components/keyboard-shortcut-help-modal/index.js +0 -1
  345. package/src/components/layout/index.js +12 -4
  346. package/src/components/layout/style.scss +4 -5
  347. package/src/components/list/actions/rename-menu-item.js +14 -23
  348. package/src/components/list/style.scss +0 -4
  349. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +2 -2
  350. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +10 -12
  351. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/style.scss +0 -17
  352. package/src/components/sidebar/index.js +2 -0
  353. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +8 -32
  354. package/src/components/sidebar-edit-mode/index.js +0 -11
  355. package/src/components/sidebar-edit-mode/settings-header/style.scss +8 -0
  356. package/src/components/sidebar-navigation-item/style.scss +28 -3
  357. package/src/components/sidebar-navigation-screen/index.js +4 -3
  358. package/src/components/sidebar-navigation-screen/style.scss +2 -0
  359. package/src/components/sidebar-navigation-screen-main/index.js +23 -1
  360. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +45 -0
  361. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +12 -0
  362. package/src/components/sidebar-navigation-screen-templates/index.js +12 -19
  363. package/src/components/site-hub/index.js +8 -10
  364. package/src/components/site-hub/style.scss +7 -1
  365. package/src/components/site-icon/index.js +1 -1
  366. package/src/components/site-icon/style.scss +2 -2
  367. package/src/components/style-book/index.js +10 -5
  368. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +4 -3
  369. package/src/components/template-part-converter/convert-to-template-part.js +12 -10
  370. package/src/experiments.js +10 -0
  371. package/src/hooks/push-changes-to-global-styles/index.js +63 -5
  372. package/src/index.js +51 -59
  373. package/src/store/actions.js +0 -24
  374. package/src/store/index.js +5 -0
  375. package/src/store/private-actions.js +29 -0
  376. package/src/store/private-selectors.js +10 -0
  377. package/src/store/selectors.js +6 -37
  378. package/src/store/test/utils.js +181 -0
  379. package/src/store/utils.js +69 -0
  380. package/src/style.scss +4 -2
  381. package/src/utils/template-part-create.js +62 -0
  382. package/src/utils/test/template-part-create.js +63 -0
  383. package/build/components/global-styles/context.js +0 -22
  384. package/build/components/global-styles/context.js.map +0 -1
  385. package/build/components/global-styles/typography-utils.js +0 -92
  386. package/build/components/global-styles/typography-utils.js.map +0 -1
  387. package/build/components/global-styles/use-global-styles-output.js +0 -943
  388. package/build/components/global-styles/use-global-styles-output.js.map +0 -1
  389. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -42
  390. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
  391. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
  392. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
  393. package/build-module/components/global-styles/context.js +0 -12
  394. package/build-module/components/global-styles/context.js.map +0 -1
  395. package/build-module/components/global-styles/typography-utils.js +0 -84
  396. package/build-module/components/global-styles/typography-utils.js.map +0 -1
  397. package/build-module/components/global-styles/use-global-styles-output.js +0 -901
  398. package/build-module/components/global-styles/use-global-styles-output.js.map +0 -1
  399. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -28
  400. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
  401. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
  402. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
  403. package/src/components/global-styles/context.js +0 -15
  404. package/src/components/global-styles/test/typography-utils.js +0 -393
  405. package/src/components/global-styles/test/use-global-styles-output.js +0 -814
  406. package/src/components/global-styles/test/utils.js +0 -206
  407. package/src/components/global-styles/typography-utils.js +0 -87
  408. package/src/components/global-styles/use-global-styles-output.js +0 -1059
  409. package/src/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -37
@@ -10,7 +10,7 @@ import { get, set } from 'lodash';
10
10
 
11
11
  import { addFilter } from '@wordpress/hooks';
12
12
  import { createHigherOrderComponent } from '@wordpress/compose';
13
- import { InspectorAdvancedControls, store as blockEditorStore } from '@wordpress/block-editor';
13
+ import { InspectorAdvancedControls, store as blockEditorStore, experiments as blockEditorExperiments } from '@wordpress/block-editor';
14
14
  import { BaseControl, Button } from '@wordpress/components';
15
15
  import { __, sprintf } from '@wordpress/i18n';
16
16
  import { __EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY, getBlockType } from '@wordpress/blocks';
@@ -22,8 +22,67 @@ import { store as noticesStore } from '@wordpress/notices';
22
22
  */
23
23
 
24
24
  import { getSupportedGlobalStylesPanels } from '../../components/global-styles/hooks';
25
- import { GlobalStylesContext } from '../../components/global-styles/context';
26
- import { STYLE_PATH_TO_CSS_VAR_INFIX, STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE } from '../../components/global-styles/utils';
25
+ import { unlock } from '../../experiments';
26
+ const {
27
+ GlobalStylesContext
28
+ } = unlock(blockEditorExperiments); // TODO: Temporary duplication of constant in @wordpress/block-editor. Can be
29
+ // removed by moving PushChangesToGlobalStylesControl to
30
+ // @wordpress/block-editor.
31
+
32
+ const STYLE_PATH_TO_CSS_VAR_INFIX = {
33
+ 'color.background': 'color',
34
+ 'color.text': 'color',
35
+ 'elements.link.color.text': 'color',
36
+ 'elements.link.:hover.color.text': 'color',
37
+ 'elements.link.typography.fontFamily': 'font-family',
38
+ 'elements.link.typography.fontSize': 'font-size',
39
+ 'elements.button.color.text': 'color',
40
+ 'elements.button.color.background': 'color',
41
+ 'elements.button.typography.fontFamily': 'font-family',
42
+ 'elements.button.typography.fontSize': 'font-size',
43
+ 'elements.heading.color': 'color',
44
+ 'elements.heading.color.background': 'color',
45
+ 'elements.heading.typography.fontFamily': 'font-family',
46
+ 'elements.heading.gradient': 'gradient',
47
+ 'elements.heading.color.gradient': 'gradient',
48
+ 'elements.h1.color': 'color',
49
+ 'elements.h1.color.background': 'color',
50
+ 'elements.h1.typography.fontFamily': 'font-family',
51
+ 'elements.h1.color.gradient': 'gradient',
52
+ 'elements.h2.color': 'color',
53
+ 'elements.h2.color.background': 'color',
54
+ 'elements.h2.typography.fontFamily': 'font-family',
55
+ 'elements.h2.color.gradient': 'gradient',
56
+ 'elements.h3.color': 'color',
57
+ 'elements.h3.color.background': 'color',
58
+ 'elements.h3.typography.fontFamily': 'font-family',
59
+ 'elements.h3.color.gradient': 'gradient',
60
+ 'elements.h4.color': 'color',
61
+ 'elements.h4.color.background': 'color',
62
+ 'elements.h4.typography.fontFamily': 'font-family',
63
+ 'elements.h4.color.gradient': 'gradient',
64
+ 'elements.h5.color': 'color',
65
+ 'elements.h5.color.background': 'color',
66
+ 'elements.h5.typography.fontFamily': 'font-family',
67
+ 'elements.h5.color.gradient': 'gradient',
68
+ 'elements.h6.color': 'color',
69
+ 'elements.h6.color.background': 'color',
70
+ 'elements.h6.typography.fontFamily': 'font-family',
71
+ 'elements.h6.color.gradient': 'gradient',
72
+ 'color.gradient': 'gradient',
73
+ 'typography.fontSize': 'font-size',
74
+ 'typography.fontFamily': 'font-family'
75
+ }; // TODO: Temporary duplication of constant in @wordpress/block-editor. Can be
76
+ // removed by moving PushChangesToGlobalStylesControl to
77
+ // @wordpress/block-editor.
78
+
79
+ const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
80
+ 'color.background': 'backgroundColor',
81
+ 'color.text': 'textColor',
82
+ 'color.gradient': 'gradient',
83
+ 'typography.fontSize': 'fontSize',
84
+ 'typography.fontFamily': 'fontFamily'
85
+ };
27
86
 
28
87
  function getChangesToPush(name, attributes) {
29
88
  return getSupportedGlobalStylesPanels(name).flatMap(key => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"names":["get","set","addFilter","createHigherOrderComponent","InspectorAdvancedControls","store","blockEditorStore","BaseControl","Button","__","sprintf","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","getBlockType","useContext","useMemo","useCallback","useDispatch","noticesStore","getSupportedGlobalStylesPanels","GlobalStylesContext","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","getChangesToPush","name","attributes","flatMap","key","value","path","presetAttributeKey","join","presetAttributeValue","style","cloneDeep","object","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","changes","user","userConfig","setUserConfig","__unstableMarkNextChangeAsNotPersistent","createSuccessNotice","pushChanges","length","blockStyles","newBlockStyles","newUserConfig","undefined","undoIgnore","title","type","actions","label","onClick","withPushChangesToGlobalSt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D;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,QAAQ,EAAGgC,OAAO,CAACO,MAAR,KAAmB,CAF/B;AAGC,IAAA,OAAO,EAAGD;AAHX,KAKGtC,EAAE,CAAE,gBAAF,CALL,CAbD,CADD;AAuBA;;AAED,MAAMkD,6BAA6B,GAAGxD,0BAA0B,CAC7DyD,SAAF,IAAmBC,KAAF,IAEf,8BACC,cAAC,SAAD,EAAgBA,KAAhB,CADD,EAEC,cAAC,yBAAD,QACC,cAAC,gCAAD,EAAuCA,KAAvC,CADD,CAFD,CAH6D,CAAhE;AAYA3D,SAAS,CACR,kBADQ,EAER,8CAFQ,EAGRyD,6BAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport { get, set } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { getSupportedGlobalStylesPanels } from '../../components/global-styles/hooks';\nimport { GlobalStylesContext } from '../../components/global-styles/context';\nimport {\n\tSTYLE_PATH_TO_CSS_VAR_INFIX,\n\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE,\n} from '../../components/global-styles/utils';\n\nfunction getChangesToPush( name, attributes ) {\n\treturn getSupportedGlobalStylesPanels( name ).flatMap( ( key ) => {\n\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\tconst presetAttributeKey = path.join( '.' );\n\t\tconst presetAttributeValue =\n\t\t\tattributes[\n\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t];\n\t\tconst value = presetAttributeValue\n\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t: get( attributes.style, path );\n\t\treturn value ? [ { path, value } ] : [];\n\t} );\n}\n\nfunction cloneDeep( object ) {\n\treturn ! object ? {} : JSON.parse( JSON.stringify( object ) );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst changes = useMemo(\n\t\t() => getChangesToPush( name, attributes ),\n\t\t[ name, attributes ]\n\t);\n\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { style: blockStyles } = attributes;\n\n\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\tfor ( const { path, value } of changes ) {\n\t\t\tset( newBlockStyles, path, undefined );\n\t\t\tset( newUserConfig, [ 'styles', 'blocks', name, ...path ], value );\n\t\t}\n\n\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t// tracking and implement our own Undo button in the snackbar\n\t\t// notification.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { style: newBlockStyles } );\n\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tsetAttributes( { style: blockStyles } );\n\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [ changes, attributes, userConfig, name ] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) =>\n\t\t(\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t<InspectorAdvancedControls>\n\t\t\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t\t\t</InspectorAdvancedControls>\n\t\t\t</>\n\t\t)\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"names":["get","set","addFilter","createHigherOrderComponent","InspectorAdvancedControls","store","blockEditorStore","experiments","blockEditorExperiments","BaseControl","Button","__","sprintf","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","getBlockType","useContext","useMemo","useCallback","useDispatch","noticesStore","getSupportedGlobalStylesPanels","unlock","GlobalStylesContext","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","getChangesToPush","name","attributes","flatMap","key","value","path","presetAttributeKey","join","presetAttributeValue","style","cloneDeep","object","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","changes","user","userConfig","setUserConfig","__unstableMarkNextChangeAsNotPersistent","createSuccessNotice","pushChanges","length","blockStyles","newBlockStyles","newUserConfig","undefined","undoIgnore","title","type","actions","label","onClick","withPushChangesToGlobalStyles","BlockEdit","props"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,GAAd,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,EAGCC,WAAW,IAAIC,sBAHhB,QAIO,yBAJP;AAKA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,uBAApC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,6BAA6B,IAAIC,cADlC,EAECC,YAFD,QAGO,mBAHP;AAIA,SAASC,UAAT,EAAqBC,OAArB,EAA8BC,WAA9B,QAAiD,oBAAjD;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASd,KAAK,IAAIe,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,SAASC,8BAAT,QAA+C,sCA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AAEjD,EAAE,CAAE,MAAF,CADV;;AAECkD,QAAAA,OAAO,GAAG;AACTb,UAAAA,uCAAuC;;AACvCL,UAAAA,aAAa,CAAE;AAAEP,YAAAA,KAAK,EAAEgB;AAAT,WAAF,CAAb;AACAL,UAAAA,aAAa,CAAE,MAAMD,UAAR,EAAoB;AAChCU,YAAAA,UAAU,EAAE;AADoB,WAApB,CAAb;AAGA;;AARF,OADQ;AAFV,KANkB,CAAnB;AAsBA,GA7C8B,EA6C5B,CAAEZ,OAAF,EAAWhB,UAAX,EAAuBkB,UAAvB,EAAmCnB,IAAnC,CA7C4B,CAA/B;AA+CA,SACC,cAAC,WAAD;AACC,IAAA,SAAS,EAAC,iDADX;AAEC,IAAA,IAAI,EAAGf,OAAO,EACb;AACAD,IAAAA,EAAE,CACD,wFADC,CAFW,EAKbI,YAAY,CAAEY,IAAF,CAAZ,CAAqB8B,KALR;AAFf,KAUC,cAAC,WAAD,CAAa,WAAb,QACG9C,EAAE,CAAE,QAAF,CADL,CAVD,EAaC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,QAAQ,EAAGiC,OAAO,CAACO,MAAR,KAAmB,CAF/B;AAGC,IAAA,OAAO,EAAGD;AAHX,KAKGvC,EAAE,CAAE,gBAAF,CALL,CAbD,CADD;AAuBA;;AAED,MAAMmD,6BAA6B,GAAG3D,0BAA0B,CAC7D4D,SAAF,IAAmBC,KAAF,IAEf,8BACC,cAAC,SAAD,EAAgBA,KAAhB,CADD,EAEC,cAAC,yBAAD,QACC,cAAC,gCAAD,EAAuCA,KAAvC,CADD,CAFD,CAH6D,CAAhE;AAYA9D,SAAS,CACR,kBADQ,EAER,8CAFQ,EAGR4D,6BAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport { get, set } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\texperiments as blockEditorExperiments,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { getSupportedGlobalStylesPanels } from '../../components/global-styles/hooks';\nimport { unlock } from '../../experiments';\n\nconst { GlobalStylesContext } = unlock( blockEditorExperiments );\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nfunction getChangesToPush( name, attributes ) {\n\treturn getSupportedGlobalStylesPanels( name ).flatMap( ( key ) => {\n\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\tconst presetAttributeKey = path.join( '.' );\n\t\tconst presetAttributeValue =\n\t\t\tattributes[\n\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t];\n\t\tconst value = presetAttributeValue\n\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t: get( attributes.style, path );\n\t\treturn value ? [ { path, value } ] : [];\n\t} );\n}\n\nfunction cloneDeep( object ) {\n\treturn ! object ? {} : JSON.parse( JSON.stringify( object ) );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst changes = useMemo(\n\t\t() => getChangesToPush( name, attributes ),\n\t\t[ name, attributes ]\n\t);\n\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { style: blockStyles } = attributes;\n\n\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\tfor ( const { path, value } of changes ) {\n\t\t\tset( newBlockStyles, path, undefined );\n\t\t\tset( newUserConfig, [ 'styles', 'blocks', name, ...path ], value );\n\t\t}\n\n\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t// tracking and implement our own Undo button in the snackbar\n\t\t// notification.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { style: newBlockStyles } );\n\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tsetAttributes( { style: blockStyles } );\n\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [ changes, attributes, userConfig, name ] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) =>\n\t\t(\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t<InspectorAdvancedControls>\n\t\t\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t\t\t</InspectorAdvancedControls>\n\t\t\t</>\n\t\t)\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"]}
@@ -6,7 +6,8 @@ import { createElement } from "@wordpress/element";
6
6
  import { store as blocksStore } from '@wordpress/blocks';
7
7
  import { registerCoreBlocks, __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';
8
8
  import { dispatch } from '@wordpress/data';
9
- import { render, unmountComponentAtNode } from '@wordpress/element';
9
+ import deprecated from '@wordpress/deprecated';
10
+ import { createRoot } from '@wordpress/element';
10
11
  import { __experimentalFetchLinkSuggestions as fetchLinkSuggestions, __experimentalFetchUrlData as fetchUrlData } from '@wordpress/core-data';
11
12
  import { store as editorStore } from '@wordpress/editor';
12
13
  import { store as interfaceStore } from '@wordpress/interface';
@@ -21,15 +22,32 @@ import './hooks';
21
22
  import { store as editSiteStore } from './store';
22
23
  import App from './components/app';
23
24
  /**
24
- * Reinitializes the editor after the user chooses to reboot the editor after
25
- * an unhandled error occurs, replacing previously mounted editor element using
26
- * an initial state from prior to the crash.
25
+ * Initializes the site editor screen.
27
26
  *
28
- * @param {Element} target DOM node in which editor is rendered.
29
- * @param {?Object} settings Editor settings object.
27
+ * @param {string} id ID of the root element to render the screen in.
28
+ * @param {Object} settings Editor settings.
30
29
  */
31
30
 
32
- export function reinitializeEditor(target, settings) {
31
+ export function initializeEditor(id, settings) {
32
+ const target = document.getElementById(id);
33
+ const root = createRoot(target);
34
+
35
+ settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => fetchLinkSuggestions(search, searchOptions, settings);
36
+
37
+ settings.__experimentalFetchRichUrlData = fetchUrlData;
38
+
39
+ dispatch(blocksStore).__experimentalReapplyBlockTypeFilters();
40
+
41
+ registerCoreBlocks();
42
+ registerLegacyWidgetBlock({
43
+ inserter: false
44
+ });
45
+
46
+ if (process.env.IS_GUTENBERG_PLUGIN) {
47
+ __experimentalRegisterExperimentalCoreBlocks({
48
+ enableFSEBlocks: true
49
+ });
50
+ }
33
51
  /*
34
52
  * Prevent adding the Clasic block in the site editor.
35
53
  * Only add the filter when the site editor is initialized, not imported.
@@ -39,73 +57,47 @@ export function reinitializeEditor(target, settings) {
39
57
  * This usage here is inspired by previous usage of the filter in the post editor:
40
58
  * https://github.com/WordPress/gutenberg/pull/37157
41
59
  */
60
+
61
+
42
62
  addFilter('blockEditor.__unstableCanInsertBlockType', 'removeClassicBlockFromInserter', (canInsert, blockType) => {
43
63
  if (blockType.name === 'core/freeform') {
44
64
  return false;
45
65
  }
46
66
 
47
67
  return canInsert;
48
- }); // This will be a no-op if the target doesn't have any React nodes.
49
-
50
- unmountComponentAtNode(target);
51
- const reboot = reinitializeEditor.bind(null, target, settings); // We dispatch actions and update the store synchronously before rendering
68
+ }); // We dispatch actions and update the store synchronously before rendering
52
69
  // so that we won't trigger unnecessary re-renders with useEffect.
53
70
 
54
- {
55
- dispatch(preferencesStore).setDefaults('core/edit-site', {
56
- editorMode: 'visual',
57
- fixedToolbar: false,
58
- focusMode: false,
59
- keepCaretInsideBlock: false,
60
- welcomeGuide: true,
61
- welcomeGuideStyles: true,
62
- showListViewByDefault: false
63
- });
64
- dispatch(interfaceStore).setDefaultComplementaryArea('core/edit-site', 'edit-site/template');
65
- dispatch(editSiteStore).updateSettings(settings); // Keep the defaultTemplateTypes in the core/editor settings too,
66
- // so that they can be selected with core/editor selectors in any editor.
67
- // This is needed because edit-site doesn't initialize with EditorProvider,
68
- // which internally uses updateEditorSettings as well.
71
+ dispatch(preferencesStore).setDefaults('core/edit-site', {
72
+ editorMode: 'visual',
73
+ fixedToolbar: false,
74
+ focusMode: false,
75
+ keepCaretInsideBlock: false,
76
+ welcomeGuide: true,
77
+ welcomeGuideStyles: true,
78
+ showListViewByDefault: false
79
+ });
80
+ dispatch(interfaceStore).setDefaultComplementaryArea('core/edit-site', 'edit-site/template');
81
+ dispatch(editSiteStore).updateSettings(settings); // Keep the defaultTemplateTypes in the core/editor settings too,
82
+ // so that they can be selected with core/editor selectors in any editor.
83
+ // This is needed because edit-site doesn't initialize with EditorProvider,
84
+ // which internally uses updateEditorSettings as well.
69
85
 
70
- dispatch(editorStore).updateEditorSettings({
71
- defaultTemplateTypes: settings.defaultTemplateTypes,
72
- defaultTemplatePartAreas: settings.defaultTemplatePartAreas
73
- });
74
- } // Prevent the default browser action for files dropped outside of dropzones.
86
+ dispatch(editorStore).updateEditorSettings({
87
+ defaultTemplateTypes: settings.defaultTemplateTypes,
88
+ defaultTemplatePartAreas: settings.defaultTemplatePartAreas
89
+ }); // Prevent the default browser action for files dropped outside of dropzones.
75
90
 
76
91
  window.addEventListener('dragover', e => e.preventDefault(), false);
77
92
  window.addEventListener('drop', e => e.preventDefault(), false);
78
- render(createElement(App, {
79
- reboot: reboot
80
- }), target);
93
+ root.render(createElement(App, null));
94
+ return root;
81
95
  }
82
- /**
83
- * Initializes the site editor screen.
84
- *
85
- * @param {string} id ID of the root element to render the screen in.
86
- * @param {Object} settings Editor settings.
87
- */
88
-
89
- export function initializeEditor(id, settings) {
90
- settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => fetchLinkSuggestions(search, searchOptions, settings);
91
-
92
- settings.__experimentalFetchRichUrlData = fetchUrlData;
93
- const target = document.getElementById(id);
94
-
95
- dispatch(blocksStore).__experimentalReapplyBlockTypeFilters();
96
-
97
- registerCoreBlocks();
98
- registerLegacyWidgetBlock({
99
- inserter: false
96
+ export function reinitializeEditor() {
97
+ deprecated('wp.editSite.reinitializeEditor', {
98
+ since: '6.2',
99
+ version: '6.3'
100
100
  });
101
-
102
- if (process.env.IS_GUTENBERG_PLUGIN) {
103
- __experimentalRegisterExperimentalCoreBlocks({
104
- enableFSEBlocks: true
105
- });
106
- }
107
-
108
- reinitializeEditor(target, settings);
109
101
  }
110
102
  export { default as PluginSidebar } from './components/sidebar-edit-mode/plugin-sidebar';
111
103
  export { default as PluginSidebarMoreMenuItem } from './components/header-edit-mode/plugin-sidebar-more-menu-item';
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","render","unmountComponentAtNode","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","interfaceStore","preferencesStore","addFilter","registerLegacyWidgetBlock","editSiteStore","App","reinitializeEditor","target","settings","canInsert","blockType","name","reboot","bind","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","setDefaultComplementaryArea","updateSettings","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","initializeEditor","id","search","searchOptions","__experimentalFetchRichUrlData","document","getElementById","__experimentalReapplyBlockTypeFilters","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","default","PluginSidebar","PluginSidebarMoreMenuItem","PluginMoreMenuItem"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SACCC,kBADD,EAECC,4CAFD,QAGO,0BAHP;AAIA,SAASC,QAAT,QAAyB,iBAAzB;AACA,SAASC,MAAT,EAAiBC,sBAAjB,QAA+C,oBAA/C;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,0BAA0B,IAAIC,YAF/B,QAGO,sBAHP;AAIA,SAASV,KAAK,IAAIW,WAAlB,QAAqC,mBAArC;AACA,SAASX,KAAK,IAAIY,cAAlB,QAAwC,sBAAxC;AACA,SAASZ,KAAK,IAAIa,gBAAlB,QAA0C,wBAA1C;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,yBAAT,QAA0C,oBAA1C;AAEA;AACA;AACA;;AACA,OAAO,SAAP;AACA,SAASf,KAAK,IAAIgB,aAAlB,QAAuC,SAAvC;AACA,OAAOC,GAAP,MAAgB,kBAAhB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CAA6BC,MAA7B,EAAqCC,QAArC,EAAgD;AACtD;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACCN,EAAAA,SAAS,CACR,0CADQ,EAER,gCAFQ,EAGR,CAAEO,SAAF,EAAaC,SAAb,KAA4B;AAC3B,QAAKA,SAAS,CAACC,IAAV,KAAmB,eAAxB,EAA0C;AACzC,aAAO,KAAP;AACA;;AACD,WAAOF,SAAP;AACA,GARO,CAAT,CAVsD,CAqBtD;;AACAf,EAAAA,sBAAsB,CAAEa,MAAF,CAAtB;AACA,QAAMK,MAAM,GAAGN,kBAAkB,CAACO,IAAnB,CAAyB,IAAzB,EAA+BN,MAA/B,EAAuCC,QAAvC,CAAf,CAvBsD,CAyBtD;AACA;;AACA;AACChB,IAAAA,QAAQ,CAAES,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AyB1B,QAAzB,CADrB;;AAEAA,EAAAA,QAAQ,CAAC2B,8BAAT,GAA0CrC,YAA1C;AAEA,QAAMS,MAAM,GAAG6B,QAAQ,CAACC,cAAT,CAAyBL,EAAzB,CAAf;;AAEAxC,EAAAA,QAAQ,CAAEH,WAAF,CAAR,CAAwBiD,qCAAxB;;AACAhD,EAAAA,kBAAkB;AAClBa,EAAAA,yBAAyB,CAAE;AAAEoC,IAAAA,QAAQ,EAAE;AAAZ,GAAF,CAAzB;;AACA,MAAKC,OAAO,CAACC,GAAR,CAAYC,mBAAjB,EAAuC;AACtCnD,IAAAA,4CAA4C,CAAE;AAC7CoD,MAAAA,eAAe,EAAE;AAD4B,KAAF,CAA5C;AAGA;;AAEDrC,EAAAA,kBAAkB,CAAEC,MAAF,EAAUC,QAAV,CAAlB;AACA;AAED,SAASoC,OAAO,IAAIC,aAApB,QAAyC,+CAAzC;AACA,SAASD,OAAO,IAAIE,yBAApB,QAAqD,6DAArD;AACA,SAASF,OAAO,IAAIG,kBAApB,QAA8C,qDAA9C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport { render, unmountComponentAtNode } 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 { addFilter } from '@wordpress/hooks';\nimport { registerLegacyWidgetBlock } 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 * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\t/*\n\t * Prevent adding the Clasic block in the site editor.\n\t * Only add the filter when the site editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t *\n\t * This usage here is inspired by previous usage of the filter in the post editor:\n\t * https://github.com/WordPress/gutenberg/pull/37157\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeClassicBlockFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif ( blockType.name === 'core/freeform' ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t// This will be a no-op if the target doesn't have any React nodes.\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\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\t{\n\t\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\t\teditorMode: 'visual',\n\t\t\tfixedToolbar: false,\n\t\t\tfocusMode: false,\n\t\t\tkeepCaretInsideBlock: false,\n\t\t\twelcomeGuide: true,\n\t\t\twelcomeGuideStyles: true,\n\t\t\tshowListViewByDefault: false,\n\t\t} );\n\n\t\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t\t'core/edit-site',\n\t\t\t'edit-site/template'\n\t\t);\n\n\t\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t\t// so that they can be selected with core/editor selectors in any editor.\n\t\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t\t// which internally uses updateEditorSettings as well.\n\t\tdispatch( editorStore ).updateEditorSettings( {\n\t\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t\t} );\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\trender( <App reboot={ reboot } />, target );\n}\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\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\n\tconst target = document.getElementById( id );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tregisterLegacyWidgetBlock( { 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\treinitializeEditor( target, settings );\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":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","deprecated","createRoot","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","interfaceStore","preferencesStore","addFilter","registerLegacyWidgetBlock","editSiteStore","App","initializeEditor","id","settings","target","document","getElementById","root","search","searchOptions","__experimentalFetchRichUrlData","__experimentalReapplyBlockTypeFilters","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","canInsert","blockType","name","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","setDefaultComplementaryArea","updateSettings","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","reinitializeEditor","since","version","default","PluginSidebar","PluginSidebarMoreMenuItem","PluginMoreMenuItem"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SACCC,kBADD,EAECC,4CAFD,QAGO,0BAHP;AAIA,SAASC,QAAT,QAAyB,iBAAzB;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,0BAA0B,IAAIC,YAF/B,QAGO,sBAHP;AAIA,SAASV,KAAK,IAAIW,WAAlB,QAAqC,mBAArC;AACA,SAASX,KAAK,IAAIY,cAAlB,QAAwC,sBAAxC;AACA,SAASZ,KAAK,IAAIa,gBAAlB,QAA0C,wBAA1C;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,yBAAT,QAA0C,oBAA1C;AAEA;AACA;AACA;;AACA,OAAO,SAAP;AACA,SAASf,KAAK,IAAIgB,aAAlB,QAAuC,SAAvC;AACA,OAAOC,GAAP,MAAgB,kBAAhB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,gBAAT,CAA2BC,EAA3B,EAA+BC,QAA/B,EAA0C;AAChD,QAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAT,CAAyBJ,EAAzB,CAAf;AACA,QAAMK,IAAI,GAAGlB,UAAU,CAAEe,MAAF,CAAvB;;AAEAD,EAAAA,QAAQ,CAACb,kCAAT,GAA8C,CAAEkB,MAAF,EAAUC,aAAV,KAC7ClB,oBAAoB,CAAEiB,MAAF,EAAUC,aAAV,EAAyBN,QAAzB,CADrB;;AAEAA,EAAAA,QAAQ,CAACO,8BAAT,GAA0CjB,YAA1C;;AAEAN,EAAAA,QAAQ,CAAEH,WAAF,CAAR,CAAwB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A3DgD,CAgEhD;;AACAC,EAAAA,MAAM,CAACC,gBAAP,CAAyB,UAAzB,EAAuCC,CAAF,IAASA,CAAC,CAACC,cAAF,EAA9C,EAAkE,KAAlE;AACAH,EAAAA,MAAM,CAACC,gBAAP,CAAyB,MAAzB,EAAmCC,CAAF,IAASA,CAAC,CAACC,cAAF,EAA1C,EAA8D,KAA9D;AAEA7B,EAAAA,IAAI,CAAC8B,MAAL,CAAa,cAAC,GAAD,OAAb;AAEA,SAAO9B,IAAP;AACA;AAED,OAAO,SAAS+B,kBAAT,GAA8B;AACpClD,EAAAA,UAAU,CAAE,gCAAF,EAAoC;AAC7CmD,IAAAA,KAAK,EAAE,KADsC;AAE7CC,IAAAA,OAAO,EAAE;AAFoC,GAApC,CAAV;AAIA;AAED,SAASC,OAAO,IAAIC,aAApB,QAAyC,+CAAzC;AACA,SAASD,OAAO,IAAIE,yBAApB,QAAqD,6DAArD;AACA,SAASF,OAAO,IAAIG,kBAApB,QAA8C,qDAA9C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\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 { addFilter } from '@wordpress/hooks';\nimport { registerLegacyWidgetBlock } 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\tregisterCoreBlocks();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\t/*\n\t * Prevent adding the Clasic block in the site editor.\n\t * Only add the filter when the site editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t *\n\t * This usage here is inspired by previous usage of the filter in the post editor:\n\t * https://github.com/WordPress/gutenberg/pull/37157\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeClassicBlockFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif ( blockType.name === 'core/freeform' ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\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} );\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"]}
@@ -481,27 +481,4 @@ export const switchEditorMode = mode => _ref10 => {
481
481
  speak(__('Mosaic view selected'), 'assertive');
482
482
  }
483
483
  };
484
- /**
485
- * Action that switches the canvas mode.
486
- *
487
- * @param {?string} mode Canvas mode.
488
- */
489
-
490
- export const __unstableSetCanvasMode = mode => _ref11 => {
491
- let {
492
- registry,
493
- dispatch
494
- } = _ref11;
495
-
496
- registry.dispatch(blockEditorStore).__unstableSetEditorMode('edit');
497
-
498
- dispatch({
499
- type: 'SET_CANVAS_MODE',
500
- mode
501
- }); // Check if the block list view should be open by default.
502
-
503
- if (mode === 'edit' && registry.select(preferencesStore).get('core/edit-site', 'showListViewByDefault')) {
504
- dispatch.setIsListViewOpened(true);
505
- }
506
- };
507
484
  //# sourceMappingURL=actions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["apiFetch","parse","__unstableSerializeAndClean","deprecated","addQueryArgs","getPathAndQueryString","__","sprintf","store","noticesStore","coreStore","interfaceStore","blockEditorStore","speak","preferencesStore","STORE_NAME","editSiteStoreName","isTemplateRevertable","toggleFeature","featureName","registry","since","alternative","dispatch","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","templateId","templateSlug","template","resolveSelect","getEntityRecord","slug","error","postType","id","context","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","blocks","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","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","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","clearSelectedBlock","__unstableSetCanvasMode","__unstableSetEditorMode","get"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,SAASC,KAAT,EAAgBC,2BAAhB,QAAmD,mBAAnD;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,YAAT,EAAuBC,qBAAvB,QAAoD,gBAApD;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASF,KAAK,IAAIG,cAAlB,QAAwC,sBAAxC;AACA,SAASH,KAAK,IAAII,gBAAlB,QAA0C,yBAA1C;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASL,KAAK,IAAIM,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,SAASC,UAAU,IAAI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["/**\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"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["apiFetch","parse","__unstableSerializeAndClean","deprecated","addQueryArgs","getPathAndQueryString","__","sprintf","store","noticesStore","coreStore","interfaceStore","blockEditorStore","speak","preferencesStore","STORE_NAME","editSiteStoreName","isTemplateRevertable","toggleFeature","featureName","registry","since","alternative","dispatch","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","templateId","templateSlug","template","resolveSelect","getEntityRecord","slug","error","postType","id","context","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","blocks","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","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","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","clearSelectedBlock"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,SAASC,KAAT,EAAgBC,2BAAhB,QAAmD,mBAAnD;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,YAAT,EAAuBC,qBAAvB,QAAoD,gBAApD;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASF,KAAK,IAAIG,cAAlB,QAAwC,sBAAxC;AACA,SAASH,KAAK,IAAII,gBAAlB,QAA0C,yBAA1C;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASL,KAAK,IAAIM,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,SAASC,UAAU,IAAIC,iBAAvB,QAAgD,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kB;AACnBA,EAAAA,QAAQ,CACNG,QADF,CACYZ,cADZ,EAEE2F,wBAFF,CAE4BtF,iBAF5B;AAGA,CANK;AAQP,OAAO,MAAMuF,gBAAgB,GAC1BC,IAAF,IACA,UAAoB;AAAA,MAAlB;AAAEpF,IAAAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CACNG,QADF,CACY,kBADZ,EAEEkF,GAFF,CAEO,gBAFP,EAEyB,YAFzB,EAEuCD,IAFvC,EADmB,CAKnB;;AACA,MAAKA,IAAI,KAAK,QAAd,EAAyB;AACxBpF,IAAAA,QAAQ,CAACG,QAAT,CAAmBX,gBAAnB,EAAsC8F,kBAAtC;AACA;;AAED,MAAKF,IAAI,KAAK,QAAd,EAAyB;AACxB3F,IAAAA,KAAK,CAAEP,EAAE,CAAE,wBAAF,CAAJ,EAAkC,WAAlC,CAAL;AACA,GAFD,MAEO,IAAKkG,IAAI,KAAK,QAAd,EAAyB;AAC/B3F,IAAAA,KAAK,CAAEP,EAAE,CAAE,sBAAF,CAAJ,EAAgC,WAAhC,CAAL;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"]}
@@ -8,8 +8,11 @@ import { createReduxStore, register } from '@wordpress/data';
8
8
 
9
9
  import reducer from './reducer';
10
10
  import * as actions from './actions';
11
+ import * as privateActions from './private-actions';
11
12
  import * as selectors from './selectors';
13
+ import * as privateSelectors from './private-selectors';
12
14
  import { STORE_NAME } from './constants';
15
+ import { unlock } from '../experiments';
13
16
  export const storeConfig = {
14
17
  reducer,
15
18
  actions,
@@ -17,4 +20,6 @@ export const storeConfig = {
17
20
  };
18
21
  export const store = createReduxStore(STORE_NAME, storeConfig);
19
22
  register(store);
23
+ unlock(store).registerPrivateSelectors(privateSelectors);
24
+ unlock(store).registerPrivateActions(privateActions);
20
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/index.js"],"names":["createReduxStore","register","reducer","actions","selectors","STORE_NAME","storeConfig","store"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,QAA3B,QAA2C,iBAA3C;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAO,KAAKC,OAAZ,MAAyB,WAAzB;AACA,OAAO,KAAKC,SAAZ,MAA2B,aAA3B;AACA,SAASC,UAAT,QAA2B,aAA3B;AAEA,OAAO,MAAMC,WAAW,GAAG;AAC1BJ,EAAAA,OAD0B;AAE1BC,EAAAA,OAF0B;AAG1BC,EAAAA;AAH0B,CAApB;AAMP,OAAO,MAAMG,KAAK,GAAGP,gBAAgB,CAAEK,UAAF,EAAcC,WAAd,CAA9B;AACPL,QAAQ,CAAEM,KAAF,CAAR","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\n\nexport const storeConfig = {\n\treducer,\n\tactions,\n\tselectors,\n};\n\nexport const store = createReduxStore( STORE_NAME, storeConfig );\nregister( store );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/index.js"],"names":["createReduxStore","register","reducer","actions","privateActions","selectors","privateSelectors","STORE_NAME","unlock","storeConfig","store","registerPrivateSelectors","registerPrivateActions"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,QAA3B,QAA2C,iBAA3C;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAO,KAAKC,OAAZ,MAAyB,WAAzB;AACA,OAAO,KAAKC,cAAZ,MAAgC,mBAAhC;AACA,OAAO,KAAKC,SAAZ,MAA2B,aAA3B;AACA,OAAO,KAAKC,gBAAZ,MAAkC,qBAAlC;AACA,SAASC,UAAT,QAA2B,aAA3B;AACA,SAASC,MAAT,QAAuB,gBAAvB;AAEA,OAAO,MAAMC,WAAW,GAAG;AAC1BP,EAAAA,OAD0B;AAE1BC,EAAAA,OAF0B;AAG1BE,EAAAA;AAH0B,CAApB;AAMP,OAAO,MAAMK,KAAK,GAAGV,gBAAgB,CAAEO,UAAF,EAAcE,WAAd,CAA9B;AACPR,QAAQ,CAAES,KAAF,CAAR;AACAF,MAAM,CAAEE,KAAF,CAAN,CAAgBC,wBAAhB,CAA0CL,gBAA1C;AACAE,MAAM,CAAEE,KAAF,CAAN,CAAgBE,sBAAhB,CAAwCR,cAAxC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as privateActions from './private-actions';\nimport * as selectors from './selectors';\nimport * as privateSelectors from './private-selectors';\nimport { STORE_NAME } from './constants';\nimport { unlock } from '../experiments';\n\nexport const storeConfig = {\n\treducer,\n\tactions,\n\tselectors,\n};\n\nexport const store = createReduxStore( STORE_NAME, storeConfig );\nregister( store );\nunlock( store ).registerPrivateSelectors( privateSelectors );\nunlock( store ).registerPrivateActions( privateActions );\n"]}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { store as blockEditorStore } from '@wordpress/block-editor';
5
+ import { store as preferencesStore } from '@wordpress/preferences';
6
+ /**
7
+ * Action that switches the canvas mode.
8
+ *
9
+ * @param {?string} mode Canvas mode.
10
+ */
11
+
12
+ export const setCanvasMode = mode => _ref => {
13
+ let {
14
+ registry,
15
+ dispatch
16
+ } = _ref;
17
+
18
+ registry.dispatch(blockEditorStore).__unstableSetEditorMode('edit');
19
+
20
+ dispatch({
21
+ type: 'SET_CANVAS_MODE',
22
+ mode
23
+ }); // Check if the block list view should be open by default.
24
+
25
+ if (mode === 'edit' && registry.select(preferencesStore).get('core/edit-site', 'showListViewByDefault')) {
26
+ dispatch.setIsListViewOpened(true);
27
+ }
28
+ };
29
+ //# sourceMappingURL=private-actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/private-actions.js"],"names":["store","blockEditorStore","preferencesStore","setCanvasMode","mode","registry","dispatch","__unstableSetEditorMode","type","select","get","setIsListViewOpened"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GACvBC,IAAF,IACA,QAA8B;AAAA,MAA5B;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAA4B;;AAC7BD,EAAAA,QAAQ,CAACC,QAAT,CAAmBL,gBAAnB,EAAsCM,uBAAtC,CAA+D,MAA/D;;AACAD,EAAAA,QAAQ,CAAE;AACTE,IAAAA,IAAI,EAAE,iBADG;AAETJ,IAAAA;AAFS,GAAF,CAAR,CAF6B,CAM7B;;AACA,MACCA,IAAI,KAAK,MAAT,IACAC,QAAQ,CACNI,MADF,CACUP,gBADV,EAEEQ,GAFF,CAEO,gBAFP,EAEyB,uBAFzB,CAFD,EAKE;AACDJ,IAAAA,QAAQ,CAACK,mBAAT,CAA8B,IAA9B;AACA;AACD,CAjBK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'showListViewByDefault' )\n\t\t) {\n\t\t\tdispatch.setIsListViewOpened( true );\n\t\t}\n\t};\n"]}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Returns the current canvas mode.
3
+ *
4
+ * @param {Object} state Global application state.
5
+ *
6
+ * @return {string} Canvas mode.
7
+ */
8
+ export function getCanvasMode(state) {
9
+ return state.canvasMode;
10
+ }
11
+ //# sourceMappingURL=private-selectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/private-selectors.js"],"names":["getCanvasMode","state","canvasMode"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,aAAT,CAAwBC,KAAxB,EAAgC;AACtC,SAAOA,KAAK,CAACC,UAAb;AACA","sourcesContent":["/**\n * Returns the current canvas mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Canvas mode.\n */\nexport function getCanvasMode( state ) {\n\treturn state.canvasMode;\n}\n"]}