@wordpress/edit-site 5.21.1-next.f8d8eceb.0 → 5.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/actions/index.js +86 -4
  3. package/build/components/actions/index.js.map +1 -1
  4. package/build/components/add-new-template/new-template.js +0 -7
  5. package/build/components/add-new-template/new-template.js.map +1 -1
  6. package/build/components/block-editor/use-site-editor-settings.js +54 -63
  7. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  8. package/build/components/dataviews/add-filter.js +90 -0
  9. package/build/components/dataviews/add-filter.js.map +1 -0
  10. package/build/components/dataviews/dataviews.js +23 -4
  11. package/build/components/dataviews/dataviews.js.map +1 -1
  12. package/build/components/dataviews/filters.js +36 -32
  13. package/build/components/dataviews/filters.js.map +1 -1
  14. package/build/components/dataviews/in-filter.js +22 -20
  15. package/build/components/dataviews/in-filter.js.map +1 -1
  16. package/build/components/dataviews/index.js +9 -2
  17. package/build/components/dataviews/index.js.map +1 -1
  18. package/build/components/dataviews/item-actions.js +81 -13
  19. package/build/components/dataviews/item-actions.js.map +1 -1
  20. package/build/components/dataviews/pagination.js +3 -2
  21. package/build/components/dataviews/pagination.js.map +1 -1
  22. package/build/components/dataviews/reset-filters.js +33 -0
  23. package/build/components/dataviews/reset-filters.js.map +1 -0
  24. package/build/components/dataviews/search.js +1 -0
  25. package/build/components/dataviews/search.js.map +1 -1
  26. package/build/components/dataviews/view-actions.js +27 -10
  27. package/build/components/dataviews/view-actions.js.map +1 -1
  28. package/build/components/dataviews/view-list.js +126 -5
  29. package/build/components/dataviews/view-list.js.map +1 -1
  30. package/build/components/dataviews/view-side-by-side.js +20 -0
  31. package/build/components/dataviews/view-side-by-side.js.map +1 -0
  32. package/build/components/editor/index.js +53 -53
  33. package/build/components/editor/index.js.map +1 -1
  34. package/build/components/global-styles/screen-revisions/index.js +42 -21
  35. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  36. package/build/components/global-styles/screen-root.js +3 -3
  37. package/build/components/global-styles/screen-root.js.map +1 -1
  38. package/build/components/global-styles/ui.js +3 -3
  39. package/build/components/global-styles/ui.js.map +1 -1
  40. package/build/components/global-styles-renderer/index.js +1 -1
  41. package/build/components/global-styles-renderer/index.js.map +1 -1
  42. package/build/components/header-edit-mode/document-tools/index.js +160 -0
  43. package/build/components/header-edit-mode/document-tools/index.js.map +1 -0
  44. package/build/components/header-edit-mode/index.js +48 -116
  45. package/build/components/header-edit-mode/index.js.map +1 -1
  46. package/build/components/header-edit-mode/more-menu/site-export.js +2 -6
  47. package/build/components/header-edit-mode/more-menu/site-export.js.map +1 -1
  48. package/build/components/layout/index.js +4 -19
  49. package/build/components/layout/index.js.map +1 -1
  50. package/build/components/list/added-by.js +1 -0
  51. package/build/components/list/added-by.js.map +1 -1
  52. package/build/components/page-content-focus-manager/back-to-page-notification.js +5 -10
  53. package/build/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
  54. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +36 -23
  55. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  56. package/build/components/page-main/index.js +2 -1
  57. package/build/components/page-main/index.js.map +1 -1
  58. package/build/components/page-pages/index.js +133 -78
  59. package/build/components/page-pages/index.js.map +1 -1
  60. package/build/components/page-pages/side-editor.js +25 -0
  61. package/build/components/page-pages/side-editor.js.map +1 -0
  62. package/build/components/page-patterns/grid-item.js +2 -2
  63. package/build/components/page-patterns/grid-item.js.map +1 -1
  64. package/build/components/page-patterns/patterns-list.js +3 -3
  65. package/build/components/page-patterns/patterns-list.js.map +1 -1
  66. package/build/components/page-patterns/rename-category-menu-item.js +27 -9
  67. package/build/components/page-patterns/rename-category-menu-item.js.map +1 -1
  68. package/build/components/page-patterns/use-patterns.js +1 -1
  69. package/build/components/page-patterns/use-patterns.js.map +1 -1
  70. package/build/components/page-templates/dataviews-templates.js +201 -0
  71. package/build/components/page-templates/dataviews-templates.js.map +1 -0
  72. package/build/components/page-templates/template-actions.js +168 -0
  73. package/build/components/page-templates/template-actions.js.map +1 -0
  74. package/build/components/save-button/index.js +4 -2
  75. package/build/components/save-button/index.js.map +1 -1
  76. package/build/components/sidebar/index.js +1 -2
  77. package/build/components/sidebar/index.js.map +1 -1
  78. package/build/components/sidebar-dataviews/add-new-view.js +124 -0
  79. package/build/components/sidebar-dataviews/add-new-view.js.map +1 -0
  80. package/build/components/sidebar-dataviews/custom-dataviews-list.js +189 -0
  81. package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -0
  82. package/build/components/sidebar-dataviews/dataview-item.js +71 -0
  83. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -0
  84. package/build/components/sidebar-dataviews/default-views.js +60 -0
  85. package/build/components/sidebar-dataviews/default-views.js.map +1 -0
  86. package/build/components/sidebar-dataviews/index.js +22 -37
  87. package/build/components/sidebar-dataviews/index.js.map +1 -1
  88. package/build/components/sidebar-edit-mode/default-sidebar.js +2 -6
  89. package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
  90. package/build/components/sidebar-edit-mode/page-panels/edit-template.js +11 -11
  91. package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
  92. package/build/components/sidebar-edit-mode/page-panels/page-summary.js +2 -1
  93. package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  94. package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js +4 -12
  95. package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -1
  96. package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js +4 -12
  97. package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +1 -1
  98. package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +2 -6
  99. package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
  100. package/build/components/sidebar-edit-mode/template-panel/hooks.js +3 -3
  101. package/build/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
  102. package/build/components/sidebar-navigation-screen-global-styles/index.js +1 -1
  103. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  104. package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -1
  105. package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
  106. package/build/components/sidebar-navigation-screen-page/page-details.js +4 -12
  107. package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
  108. package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
  109. package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
  110. package/build/components/site-hub/index.js +18 -6
  111. package/build/components/site-hub/index.js.map +1 -1
  112. package/build/components/start-template-options/index.js +12 -16
  113. package/build/components/start-template-options/index.js.map +1 -1
  114. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +112 -49
  115. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  116. package/build/components/template-part-converter/convert-to-regular.js +1 -1
  117. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  118. package/build/hooks/push-changes-to-global-styles/index.js +3 -1
  119. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  120. package/build/hooks/template-part-edit.js +6 -2
  121. package/build/hooks/template-part-edit.js.map +1 -1
  122. package/build/index.js +0 -3
  123. package/build/index.js.map +1 -1
  124. package/build/store/actions.js +35 -82
  125. package/build/store/actions.js.map +1 -1
  126. package/build/store/selectors.js +25 -63
  127. package/build/store/selectors.js.map +1 -1
  128. package/build/utils/constants.js +3 -3
  129. package/build/utils/constants.js.map +1 -1
  130. package/build/utils/use-activate-theme.js +8 -0
  131. package/build/utils/use-activate-theme.js.map +1 -1
  132. package/build-module/components/actions/index.js +85 -5
  133. package/build-module/components/actions/index.js.map +1 -1
  134. package/build-module/components/add-new-template/new-template.js +0 -7
  135. package/build-module/components/add-new-template/new-template.js.map +1 -1
  136. package/build-module/components/block-editor/use-site-editor-settings.js +54 -62
  137. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  138. package/build-module/components/dataviews/add-filter.js +83 -0
  139. package/build-module/components/dataviews/add-filter.js.map +1 -0
  140. package/build-module/components/dataviews/dataviews.js +22 -4
  141. package/build-module/components/dataviews/dataviews.js.map +1 -1
  142. package/build-module/components/dataviews/filters.js +34 -32
  143. package/build-module/components/dataviews/filters.js.map +1 -1
  144. package/build-module/components/dataviews/in-filter.js +20 -19
  145. package/build-module/components/dataviews/in-filter.js.map +1 -1
  146. package/build-module/components/dataviews/index.js +1 -1
  147. package/build-module/components/dataviews/index.js.map +1 -1
  148. package/build-module/components/dataviews/item-actions.js +84 -16
  149. package/build-module/components/dataviews/item-actions.js.map +1 -1
  150. package/build-module/components/dataviews/pagination.js +3 -2
  151. package/build-module/components/dataviews/pagination.js.map +1 -1
  152. package/build-module/components/dataviews/reset-filters.js +26 -0
  153. package/build-module/components/dataviews/reset-filters.js.map +1 -0
  154. package/build-module/components/dataviews/search.js +1 -0
  155. package/build-module/components/dataviews/search.js.map +1 -1
  156. package/build-module/components/dataviews/view-actions.js +28 -11
  157. package/build-module/components/dataviews/view-actions.js.map +1 -1
  158. package/build-module/components/dataviews/view-list.js +128 -7
  159. package/build-module/components/dataviews/view-list.js.map +1 -1
  160. package/build-module/components/dataviews/view-side-by-side.js +12 -0
  161. package/build-module/components/dataviews/view-side-by-side.js.map +1 -0
  162. package/build-module/components/editor/index.js +57 -57
  163. package/build-module/components/editor/index.js.map +1 -1
  164. package/build-module/components/global-styles/screen-revisions/index.js +42 -21
  165. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  166. package/build-module/components/global-styles/screen-root.js +3 -3
  167. package/build-module/components/global-styles/screen-root.js.map +1 -1
  168. package/build-module/components/global-styles/ui.js +3 -3
  169. package/build-module/components/global-styles/ui.js.map +1 -1
  170. package/build-module/components/global-styles-renderer/index.js +1 -1
  171. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  172. package/build-module/components/header-edit-mode/document-tools/index.js +152 -0
  173. package/build-module/components/header-edit-mode/document-tools/index.js.map +1 -0
  174. package/build-module/components/header-edit-mode/index.js +52 -120
  175. package/build-module/components/header-edit-mode/index.js.map +1 -1
  176. package/build-module/components/header-edit-mode/more-menu/site-export.js +2 -6
  177. package/build-module/components/header-edit-mode/more-menu/site-export.js.map +1 -1
  178. package/build-module/components/layout/index.js +5 -20
  179. package/build-module/components/layout/index.js.map +1 -1
  180. package/build-module/components/list/added-by.js +1 -1
  181. package/build-module/components/list/added-by.js.map +1 -1
  182. package/build-module/components/page-content-focus-manager/back-to-page-notification.js +5 -10
  183. package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
  184. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +36 -23
  185. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  186. package/build-module/components/page-main/index.js +2 -1
  187. package/build-module/components/page-main/index.js.map +1 -1
  188. package/build-module/components/page-pages/index.js +137 -80
  189. package/build-module/components/page-pages/index.js.map +1 -1
  190. package/build-module/components/page-pages/side-editor.js +17 -0
  191. package/build-module/components/page-pages/side-editor.js.map +1 -0
  192. package/build-module/components/page-patterns/grid-item.js +2 -2
  193. package/build-module/components/page-patterns/grid-item.js.map +1 -1
  194. package/build-module/components/page-patterns/patterns-list.js +4 -4
  195. package/build-module/components/page-patterns/patterns-list.js.map +1 -1
  196. package/build-module/components/page-patterns/rename-category-menu-item.js +25 -9
  197. package/build-module/components/page-patterns/rename-category-menu-item.js.map +1 -1
  198. package/build-module/components/page-patterns/use-patterns.js +2 -2
  199. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  200. package/build-module/components/page-templates/dataviews-templates.js +193 -0
  201. package/build-module/components/page-templates/dataviews-templates.js.map +1 -0
  202. package/build-module/components/page-templates/template-actions.js +157 -0
  203. package/build-module/components/page-templates/template-actions.js.map +1 -0
  204. package/build-module/components/save-button/index.js +4 -2
  205. package/build-module/components/save-button/index.js.map +1 -1
  206. package/build-module/components/sidebar/index.js +1 -2
  207. package/build-module/components/sidebar/index.js.map +1 -1
  208. package/build-module/components/sidebar-dataviews/add-new-view.js +116 -0
  209. package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -0
  210. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +180 -0
  211. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -0
  212. package/build-module/components/sidebar-dataviews/dataview-item.js +63 -0
  213. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -0
  214. package/build-module/components/sidebar-dataviews/default-views.js +52 -0
  215. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -0
  216. package/build-module/components/sidebar-dataviews/index.js +23 -38
  217. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  218. package/build-module/components/sidebar-edit-mode/default-sidebar.js +2 -6
  219. package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
  220. package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +12 -12
  221. package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
  222. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +3 -1
  223. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  224. package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js +5 -13
  225. package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -1
  226. package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js +5 -13
  227. package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +1 -1
  228. package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +2 -6
  229. package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
  230. package/build-module/components/sidebar-edit-mode/template-panel/hooks.js +4 -4
  231. package/build-module/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
  232. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +1 -1
  233. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  234. package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -1
  235. package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
  236. package/build-module/components/sidebar-navigation-screen-page/page-details.js +4 -12
  237. package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
  238. package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -2
  239. package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
  240. package/build-module/components/site-hub/index.js +19 -7
  241. package/build-module/components/site-hub/index.js.map +1 -1
  242. package/build-module/components/start-template-options/index.js +13 -16
  243. package/build-module/components/start-template-options/index.js.map +1 -1
  244. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +112 -50
  245. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  246. package/build-module/components/template-part-converter/convert-to-regular.js +1 -1
  247. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  248. package/build-module/hooks/push-changes-to-global-styles/index.js +4 -2
  249. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  250. package/build-module/hooks/template-part-edit.js +6 -2
  251. package/build-module/hooks/template-part-edit.js.map +1 -1
  252. package/build-module/index.js +0 -3
  253. package/build-module/index.js.map +1 -1
  254. package/build-module/store/actions.js +33 -79
  255. package/build-module/store/actions.js.map +1 -1
  256. package/build-module/store/selectors.js +19 -58
  257. package/build-module/store/selectors.js.map +1 -1
  258. package/build-module/utils/constants.js +1 -1
  259. package/build-module/utils/constants.js.map +1 -1
  260. package/build-module/utils/use-activate-theme.js +8 -0
  261. package/build-module/utils/use-activate-theme.js.map +1 -1
  262. package/build-style/style-rtl.css +69 -119
  263. package/build-style/style.css +69 -119
  264. package/package.json +41 -41
  265. package/src/components/actions/index.js +113 -5
  266. package/src/components/add-new-template/new-template.js +0 -5
  267. package/src/components/block-editor/style.scss +0 -87
  268. package/src/components/block-editor/use-site-editor-settings.js +68 -89
  269. package/src/components/dataviews/README.md +77 -83
  270. package/src/components/dataviews/add-filter.js +111 -0
  271. package/src/components/dataviews/dataviews.js +20 -2
  272. package/src/components/dataviews/filters.js +56 -49
  273. package/src/components/dataviews/in-filter.js +35 -17
  274. package/src/components/dataviews/index.js +1 -1
  275. package/src/components/dataviews/item-actions.js +95 -20
  276. package/src/components/dataviews/pagination.js +5 -4
  277. package/src/components/dataviews/reset-filters.js +26 -0
  278. package/src/components/dataviews/search.js +1 -0
  279. package/src/components/dataviews/style.scss +5 -1
  280. package/src/components/dataviews/view-actions.js +39 -9
  281. package/src/components/dataviews/view-list.js +174 -3
  282. package/src/components/dataviews/view-side-by-side.js +9 -0
  283. package/src/components/editor/index.js +149 -121
  284. package/src/components/global-styles/screen-revisions/index.js +52 -25
  285. package/src/components/global-styles/screen-root.js +2 -1
  286. package/src/components/global-styles/ui.js +1 -1
  287. package/src/components/global-styles-renderer/index.js +1 -1
  288. package/src/components/header-edit-mode/document-tools/index.js +201 -0
  289. package/src/components/header-edit-mode/index.js +86 -184
  290. package/src/components/header-edit-mode/more-menu/site-export.js +2 -6
  291. package/src/components/header-edit-mode/style.scss +35 -2
  292. package/src/components/layout/index.js +4 -11
  293. package/src/components/layout/style.scss +6 -18
  294. package/src/components/list/added-by.js +1 -1
  295. package/src/components/page-content-focus-manager/back-to-page-notification.js +4 -15
  296. package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +38 -33
  297. package/src/components/page-main/index.js +6 -1
  298. package/src/components/page-pages/index.js +162 -81
  299. package/src/components/page-pages/side-editor.js +14 -0
  300. package/src/components/page-patterns/grid-item.js +3 -3
  301. package/src/components/page-patterns/patterns-list.js +10 -4
  302. package/src/components/page-patterns/rename-category-menu-item.js +29 -12
  303. package/src/components/page-patterns/use-patterns.js +3 -2
  304. package/src/components/page-templates/dataviews-templates.js +224 -0
  305. package/src/components/page-templates/template-actions.js +209 -0
  306. package/src/components/save-button/index.js +10 -5
  307. package/src/components/sidebar/index.js +1 -2
  308. package/src/components/sidebar-dataviews/add-new-view.js +141 -0
  309. package/src/components/sidebar-dataviews/custom-dataviews-list.js +227 -0
  310. package/src/components/sidebar-dataviews/dataview-item.js +67 -0
  311. package/src/components/sidebar-dataviews/default-views.js +54 -0
  312. package/src/components/sidebar-dataviews/index.js +36 -44
  313. package/src/components/sidebar-dataviews/style.scss +22 -0
  314. package/src/components/sidebar-edit-mode/default-sidebar.js +6 -6
  315. package/src/components/sidebar-edit-mode/page-panels/edit-template.js +14 -21
  316. package/src/components/sidebar-edit-mode/page-panels/page-summary.js +3 -0
  317. package/src/components/sidebar-edit-mode/page-panels/reset-default-template.js +10 -9
  318. package/src/components/sidebar-edit-mode/page-panels/style.scss +5 -0
  319. package/src/components/sidebar-edit-mode/page-panels/swap-template-button.js +10 -9
  320. package/src/components/sidebar-edit-mode/plugin-sidebar/index.js +6 -6
  321. package/src/components/sidebar-edit-mode/template-panel/hooks.js +11 -7
  322. package/src/components/sidebar-navigation-screen-global-styles/index.js +1 -1
  323. package/src/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -1
  324. package/src/components/sidebar-navigation-screen-page/page-details.js +7 -18
  325. package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -2
  326. package/src/components/site-hub/index.js +9 -8
  327. package/src/components/start-template-options/index.js +14 -12
  328. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +117 -50
  329. package/src/components/template-part-converter/convert-to-regular.js +1 -1
  330. package/src/hooks/push-changes-to-global-styles/index.js +13 -6
  331. package/src/hooks/template-part-edit.js +4 -2
  332. package/src/index.js +0 -8
  333. package/src/store/actions.js +37 -95
  334. package/src/store/selectors.js +31 -91
  335. package/src/store/test/actions.js +11 -137
  336. package/src/store/test/selectors.js +0 -82
  337. package/src/style.scss +1 -0
  338. package/src/utils/constants.js +1 -1
  339. package/src/utils/use-activate-theme.js +5 -0
  340. package/build/components/block-editor/block-editor-provider/default-block-editor-provider.js +0 -77
  341. package/build/components/block-editor/block-editor-provider/default-block-editor-provider.js.map +0 -1
  342. package/build/components/block-editor/block-editor-provider/index.js +0 -31
  343. package/build/components/block-editor/block-editor-provider/index.js.map +0 -1
  344. package/build/components/block-editor/block-editor-provider/navigation-block-editor-provider.js +0 -110
  345. package/build/components/block-editor/block-editor-provider/navigation-block-editor-provider.js.map +0 -1
  346. package/build/components/block-editor/block-editor-provider/use-page-content-blocks.js +0 -84
  347. package/build/components/block-editor/block-editor-provider/use-page-content-blocks.js.map +0 -1
  348. package/build/components/block-editor/index.js +0 -30
  349. package/build/components/block-editor/index.js.map +0 -1
  350. package/build/components/dataviews/context.js +0 -15
  351. package/build/components/dataviews/context.js.map +0 -1
  352. package/build/components/page-pages/default-views.js +0 -60
  353. package/build/components/page-pages/default-views.js.map +0 -1
  354. package/build-module/components/block-editor/block-editor-provider/default-block-editor-provider.js +0 -69
  355. package/build-module/components/block-editor/block-editor-provider/default-block-editor-provider.js.map +0 -1
  356. package/build-module/components/block-editor/block-editor-provider/index.js +0 -23
  357. package/build-module/components/block-editor/block-editor-provider/index.js.map +0 -1
  358. package/build-module/components/block-editor/block-editor-provider/navigation-block-editor-provider.js +0 -102
  359. package/build-module/components/block-editor/block-editor-provider/navigation-block-editor-provider.js.map +0 -1
  360. package/build-module/components/block-editor/block-editor-provider/use-page-content-blocks.js +0 -78
  361. package/build-module/components/block-editor/block-editor-provider/use-page-content-blocks.js.map +0 -1
  362. package/build-module/components/block-editor/index.js +0 -22
  363. package/build-module/components/block-editor/index.js.map +0 -1
  364. package/build-module/components/dataviews/context.js +0 -7
  365. package/build-module/components/dataviews/context.js.map +0 -1
  366. package/build-module/components/page-pages/default-views.js +0 -53
  367. package/build-module/components/page-pages/default-views.js.map +0 -1
  368. package/src/components/block-editor/block-editor-provider/default-block-editor-provider.js +0 -75
  369. package/src/components/block-editor/block-editor-provider/index.js +0 -29
  370. package/src/components/block-editor/block-editor-provider/navigation-block-editor-provider.js +0 -114
  371. package/src/components/block-editor/block-editor-provider/test/use-page-content-blocks.js +0 -116
  372. package/src/components/block-editor/block-editor-provider/use-page-content-blocks.js +0 -90
  373. package/src/components/block-editor/index.js +0 -28
  374. package/src/components/dataviews/context.js +0 -7
  375. package/src/components/page-pages/default-views.js +0 -58
@@ -29,9 +29,9 @@ export function toggleFeature(featureName) {
29
29
  return function ({
30
30
  registry
31
31
  }) {
32
- deprecated("select( 'core/edit-site' ).toggleFeature( featureName )", {
32
+ deprecated("dispatch( 'core/edit-site' ).toggleFeature( featureName )", {
33
33
  since: '6.0',
34
- alternative: "select( 'core/preferences').toggle( 'core/edit-site', featureName )"
34
+ alternative: "dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )"
35
35
  });
36
36
  registry.dispatch(preferencesStore).toggle('core/edit-site', featureName);
37
37
  };
@@ -54,41 +54,37 @@ export function __experimentalSetPreviewDeviceType(deviceType) {
54
54
  /**
55
55
  * Action that sets a template, optionally fetching it from REST API.
56
56
  *
57
- * @param {number} templateId The template ID.
58
- * @param {string} templateSlug The template slug.
59
57
  * @return {Object} Action object.
60
58
  */
61
- export const setTemplate = (templateId, templateSlug) => async ({
62
- dispatch,
63
- registry
64
- }) => {
65
- if (!templateSlug) {
66
- try {
67
- const template = await registry.resolveSelect(coreStore).getEntityRecord('postType', TEMPLATE_POST_TYPE, templateId);
68
- templateSlug = template?.slug;
69
- } catch (error) {}
70
- }
71
- dispatch({
72
- type: 'SET_EDITED_POST',
73
- postType: TEMPLATE_POST_TYPE,
74
- id: templateId,
75
- context: {
76
- templateSlug
77
- }
59
+ export function setTemplate() {
60
+ deprecated("dispatch( 'core/edit-site' ).setTemplate", {
61
+ since: '6.5',
62
+ version: '6.8',
63
+ hint: 'The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically.'
78
64
  });
79
- };
65
+ return {
66
+ type: 'NOTHING'
67
+ };
68
+ }
80
69
 
81
70
  /**
82
71
  * Action that adds a new template and sets it as the current template.
83
72
  *
84
73
  * @param {Object} template The template.
85
74
  *
75
+ * @deprecated
76
+ *
86
77
  * @return {Object} Action object used to set the current template.
87
78
  */
88
79
  export const addTemplate = template => async ({
89
80
  dispatch,
90
81
  registry
91
82
  }) => {
83
+ deprecated("dispatch( 'core/edit-site' ).addTemplate", {
84
+ since: '6.5',
85
+ version: '6.8',
86
+ hint: 'use saveEntityRecord directly'
87
+ });
92
88
  const newTemplate = await registry.dispatch(coreStore).saveEntityRecord('postType', TEMPLATE_POST_TYPE, template);
93
89
  if (template.content) {
94
90
  registry.dispatch(coreStore).editEntityRecord('postType', TEMPLATE_POST_TYPE, newTemplate.id, {
@@ -100,10 +96,7 @@ export const addTemplate = template => async ({
100
96
  dispatch({
101
97
  type: 'SET_EDITED_POST',
102
98
  postType: TEMPLATE_POST_TYPE,
103
- id: newTemplate.id,
104
- context: {
105
- templateSlug: newTemplate.slug
106
- }
99
+ id: newTemplate.id
107
100
  });
108
101
  };
109
102
 
@@ -175,14 +168,16 @@ export function setNavigationMenu(navigationMenuId) {
175
168
  *
176
169
  * @param {string} postType The entity's post type.
177
170
  * @param {string} postId The entity's ID.
171
+ * @param {Object} context The entity's context.
178
172
  *
179
173
  * @return {Object} Action object.
180
174
  */
181
- export function setEditedEntity(postType, postId) {
175
+ export function setEditedEntity(postType, postId, context) {
182
176
  return {
183
177
  type: 'SET_EDITED_POST',
184
178
  postType,
185
- id: postId
179
+ id: postId,
180
+ context
186
181
  };
187
182
  }
188
183
 
@@ -217,61 +212,20 @@ export function setEditedPostContext(context) {
217
212
  * Resolves the template for a page and displays both. If no path is given, attempts
218
213
  * to use the postId to generate a path like `?p=${ postId }`.
219
214
  *
220
- * @param {Object} page The page object.
221
- * @param {string} page.type The page type.
222
- * @param {string} page.slug The page slug.
223
- * @param {string} page.path The page path.
224
- * @param {Object} page.context The page context.
215
+ * @deprecated
225
216
  *
226
217
  * @return {number} The resolved template ID for the page route.
227
218
  */
228
- export const setPage = page => async ({
229
- dispatch,
230
- registry
231
- }) => {
232
- let template;
233
- const getDefaultTemplate = async slug => apiFetch({
234
- path: addQueryArgs('/wp/v2/templates/lookup', {
235
- slug: `page-${slug}`
236
- })
237
- });
238
- if (page.path) {
239
- template = await registry.resolveSelect(coreStore).__experimentalGetTemplateForLink(page.path);
240
- } else {
241
- const editedEntity = await registry.resolveSelect(coreStore).getEditedEntityRecord('postType', page.context?.postType || 'post', page.context?.postId);
242
- const currentTemplateSlug = editedEntity?.template;
243
- if (currentTemplateSlug) {
244
- const currentTemplate = (await registry.resolveSelect(coreStore).getEntityRecords('postType', TEMPLATE_POST_TYPE, {
245
- per_page: -1
246
- }))?.find(({
247
- slug
248
- }) => slug === currentTemplateSlug);
249
- if (currentTemplate) {
250
- template = currentTemplate;
251
- } else {
252
- // If a page has a `template` set and is not included in the list
253
- // of the current theme's templates, query for current theme's default template.
254
- template = await getDefaultTemplate(editedEntity?.slug);
255
- }
256
- } else {
257
- // Page's `template` is empty, that indicates we need to use the default template for the page.
258
- template = await getDefaultTemplate(editedEntity?.slug);
259
- }
260
- }
261
- if (!template) {
262
- return;
263
- }
264
- dispatch({
265
- type: 'SET_EDITED_POST',
266
- postType: TEMPLATE_POST_TYPE,
267
- id: template.id,
268
- context: {
269
- ...page.context,
270
- templateSlug: template.slug
271
- }
219
+ export function setPage() {
220
+ deprecated("dispatch( 'core/edit-site' ).setPage", {
221
+ since: '6.5',
222
+ version: '6.8',
223
+ hint: 'The setPage is not needed anymore, the correct entity is resolved from the URL automatically.'
272
224
  });
273
- return template.id;
274
- };
225
+ return {
226
+ type: 'NOTHING'
227
+ };
228
+ }
275
229
 
276
230
  /**
277
231
  * Action that sets the active navigation panel menu.
@@ -1 +1 @@
1
- {"version":3,"names":["apiFetch","parse","__unstableSerializeAndClean","deprecated","addQueryArgs","__","sprintf","store","noticesStore","coreStore","interfaceStore","blockEditorStore","speak","preferencesStore","decodeEntities","STORE_NAME","editSiteStoreName","isTemplateRevertable","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","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","templateTitle","title","rendered","createSuccessNotice","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setNavigationMenu","navigationMenuId","setEditedEntity","postId","setHomeTemplateId","version","setEditedPostContext","setPage","page","getDefaultTemplate","path","__experimentalGetTemplateForLink","editedEntity","getEditedEntityRecord","currentTemplateSlug","currentTemplate","getEntityRecords","per_page","find","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","isOpen","isDistractionFree","get","toggleDistractionFree","setIsSaveViewOpened","revertTemplate","allowUndo","noticeId","removeNotice","templateEntityConfig","getEntityConfig","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","clearSelectedBlock","setHasPageContentFocus","hasPageContentFocus","batch","createInfoNotice"],"sources":["@wordpress/edit-site/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs } 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';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../utils/constants';\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(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\t\ttemplateId\n\t\t\t\t\t);\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: TEMPLATE_POST_TYPE,\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', TEMPLATE_POST_TYPE, 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\tTEMPLATE_POST_TYPE,\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: TEMPLATE_POST_TYPE,\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\t// Depending on how the entity was retrieved it's title might be\n\t\t\t// an object or simple string.\n\t\t\tconst templateTitle =\n\t\t\t\ttypeof template.title === 'string'\n\t\t\t\t\t? template.title\n\t\t\t\t\t: template.title?.rendered;\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\tdecodeEntities( templateTitle )\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'site-editor-template-deleted-success' }\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the template.' );\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * Action that sets a navigation menu.\n *\n * @param {string} navigationMenuId The Navigation Menu Post ID.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationMenu( navigationMenuId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: NAVIGATION_POST_TYPE,\n\t\tid: navigationMenuId,\n\t};\n}\n\n/**\n * Action that sets an edited entity.\n *\n * @param {string} postType The entity's post type.\n * @param {string} postId The entity's ID.\n *\n * @return {Object} Action object.\n */\nexport function setEditedEntity( postType, postId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType,\n\t\tid: postId,\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 {Object} Action object.\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\tlet template;\n\t\tconst getDefaultTemplate = async ( slug ) =>\n\t\t\tapiFetch( {\n\t\t\t\tpath: addQueryArgs( '/wp/v2/templates/lookup', {\n\t\t\t\t\tslug: `page-${ slug }`,\n\t\t\t\t} ),\n\t\t\t} );\n\n\t\tif ( page.path ) {\n\t\t\ttemplate = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.__experimentalGetTemplateForLink( page.path );\n\t\t} else {\n\t\t\tconst editedEntity = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getEditedEntityRecord(\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\tconst currentTemplateSlug = editedEntity?.template;\n\t\t\tif ( currentTemplateSlug ) {\n\t\t\t\tconst currentTemplate = (\n\t\t\t\t\tawait registry\n\t\t\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t\t\t.getEntityRecords( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t\t} )\n\t\t\t\t)?.find( ( { slug } ) => slug === currentTemplateSlug );\n\t\t\t\tif ( currentTemplate ) {\n\t\t\t\t\ttemplate = currentTemplate;\n\t\t\t\t} else {\n\t\t\t\t\t// If a page has a `template` set and is not included in the list\n\t\t\t\t\t// of the current theme's templates, query for current theme's default template.\n\t\t\t\t\ttemplate = await getDefaultTemplate( editedEntity?.slug );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Page's `template` is empty, that indicates we need to use the default template for the page.\n\t\t\t\ttemplate = await getDefaultTemplate( editedEntity?.slug );\n\t\t\t}\n\t\t}\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: TEMPLATE_POST_TYPE,\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 const setIsListViewOpened =\n\t( isOpen ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( isDistractionFree && isOpen ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\t\tisOpen,\n\t\t} );\n\t};\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, { allowUndo = true } = {} ) =>\n\tasync ( { registry } ) => {\n\t\tconst noticeId = 'edit-site-template-reverted';\n\t\tregistry.dispatch( noticesStore ).removeNotice( noticeId );\n\t\tif ( ! isTemplateRevertable( template ) ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templateEntityConfig = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\t\tif ( ! templateEntityConfig ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t\t{ context: 'edit', source: 'theme' }\n\t\t\t);\n\n\t\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\t\tif ( ! fileTemplate ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst serializeBlocks = ( {\n\t\t\t\tblocks: blocksForSerialization = [],\n\t\t\t} ) => __unstableSerializeAndClean( blocksForSerialization );\n\n\t\t\tconst edited = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t\t// the revert in the header toolbar correctly.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks,\n\t\t\t\t\tsource: 'theme',\n\t\t\t\t} );\n\n\t\t\tif ( allowUndo ) {\n\t\t\t\tconst undoRevert = () => {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\tedited.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: noticeId,\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: undoRevert,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t} );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( isDistractionFree ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\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( { dispatch, registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( 'core/preferences' )\n\t\t\t.set( 'core/edit-site', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to a non visual mode.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif ( mode === 'visual' ) {\n\t\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t\t} else if ( mode === 'text' ) {\n\t\t\tconst isDistractionFree = registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\tdispatch.toggleDistractionFree();\n\t\t\t}\n\t\t\tspeak( __( 'Code editor selected' ), 'assertive' );\n\t\t}\n\t};\n\n/**\n * Sets whether or not the editor allows only page content to be edited.\n *\n * @param {boolean} hasPageContentFocus True to allow only page content to be\n * edited, false to allow template to be\n * edited.\n */\nexport const setHasPageContentFocus =\n\t( hasPageContentFocus ) =>\n\t( { dispatch, registry } ) => {\n\t\tif ( hasPageContentFocus ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_HAS_PAGE_CONTENT_FOCUS',\n\t\t\thasPageContentFocus,\n\t\t} );\n\t};\n\n/**\n * Action that toggles Distraction free mode.\n * Distraction free mode expects there are no sidebars, as due to the\n * z-index values set, you can't close sidebars.\n */\nexport const toggleDistractionFree =\n\t() =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( ! isDistractionFree ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t\t.set( 'core/edit-site', 'fixedToolbar', false );\n\t\t\t\tdispatch.setIsInserterOpened( false );\n\t\t\t\tdispatch.setIsListViewOpened( false );\n\t\t\t\tdispatch.closeGeneralSidebar();\n\t\t\t} );\n\t\t}\n\t\tregistry.batch( () => {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set(\n\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t'distractionFree',\n\t\t\t\t\t! isDistractionFree\n\t\t\t\t);\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createInfoNotice(\n\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t? __( 'Distraction free off.' )\n\t\t\t\t\t\t: __( 'Distraction free on.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/edit-site/distraction-free-mode/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t} );\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAQ,MAAM,sBAAsB;AAC3C,SAASC,KAAK,EAAEC,2BAA2B,QAAQ,mBAAmB;AACtE,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,YAAY,QAAQ,gBAA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iFetch","parse","__unstableSerializeAndClean","deprecated","addQueryArgs","__","sprintf","store","noticesStore","coreStore","interfaceStore","blockEditorStore","speak","preferencesStore","decodeEntities","STORE_NAME","editSiteStoreName","isTemplateRevertable","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","toggleFeature","featureName","registry","since","alternative","dispatch","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","version","hint","addTemplate","template","newTemplate","saveEntityRecord","content","editEntityRecord","id","blocks","undoIgnore","postType","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","templateTitle","title","rendered","createSuccessNotice","error","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setNavigationMenu","navigationMenuId","setEditedEntity","postId","context","setHomeTemplateId","setEditedPostContext","setPage","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","isOpen","isDistractionFree","get","toggleDistractionFree","setIsSaveViewOpened","revertTemplate","allowUndo","noticeId","removeNotice","templateEntityConfig","getEntityConfig","fileTemplatePath","baseURL","source","fileTemplate","path","serializeBlocks","blocksForSerialization","edited","getEditedEntityRecord","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","clearSelectedBlock","setHasPageContentFocus","hasPageContentFocus","batch","createInfoNotice"],"sources":["@wordpress/edit-site/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs } 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';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../utils/constants';\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(\n\t\t\t\"dispatch( 'core/edit-site' ).toggleFeature( featureName )\",\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\talternative:\n\t\t\t\t\t\"dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t\t}\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 * @return {Object} Action object.\n */\nexport function setTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setTemplate\", {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\thint: 'The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically.',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\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 * @deprecated\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\tdeprecated( \"dispatch( 'core/edit-site' ).addTemplate\", {\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t\thint: 'use saveEntityRecord directly',\n\t\t} );\n\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', TEMPLATE_POST_TYPE, 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\tTEMPLATE_POST_TYPE,\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: TEMPLATE_POST_TYPE,\n\t\t\tid: newTemplate.id,\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\t// Depending on how the entity was retrieved it's title might be\n\t\t\t// an object or simple string.\n\t\t\tconst templateTitle =\n\t\t\t\ttypeof template.title === 'string'\n\t\t\t\t\t? template.title\n\t\t\t\t\t: template.title?.rendered;\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\tdecodeEntities( templateTitle )\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'site-editor-template-deleted-success' }\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the template.' );\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * Action that sets a navigation menu.\n *\n * @param {string} navigationMenuId The Navigation Menu Post ID.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationMenu( navigationMenuId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: NAVIGATION_POST_TYPE,\n\t\tid: navigationMenuId,\n\t};\n}\n\n/**\n * Action that sets an edited entity.\n *\n * @param {string} postType The entity's post type.\n * @param {string} postId The entity's ID.\n * @param {Object} context The entity's context.\n *\n * @return {Object} Action object.\n */\nexport function setEditedEntity( postType, postId, context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType,\n\t\tid: postId,\n\t\tcontext,\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 {Object} Action object.\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 * @deprecated\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function setPage() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setPage\", {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\thint: 'The setPage is not needed anymore, the correct entity is resolved from the URL automatically.',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\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 const setIsListViewOpened =\n\t( isOpen ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( isDistractionFree && isOpen ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\t\tisOpen,\n\t\t} );\n\t};\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, { allowUndo = true } = {} ) =>\n\tasync ( { registry } ) => {\n\t\tconst noticeId = 'edit-site-template-reverted';\n\t\tregistry.dispatch( noticesStore ).removeNotice( noticeId );\n\t\tif ( ! isTemplateRevertable( template ) ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templateEntityConfig = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\t\tif ( ! templateEntityConfig ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t\t{ context: 'edit', source: 'theme' }\n\t\t\t);\n\n\t\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\t\tif ( ! fileTemplate ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst serializeBlocks = ( {\n\t\t\t\tblocks: blocksForSerialization = [],\n\t\t\t} ) => __unstableSerializeAndClean( blocksForSerialization );\n\n\t\t\tconst edited = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t\t// the revert in the header toolbar correctly.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks,\n\t\t\t\t\tsource: 'theme',\n\t\t\t\t} );\n\n\t\t\tif ( allowUndo ) {\n\t\t\t\tconst undoRevert = () => {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\tedited.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: noticeId,\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: undoRevert,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t} );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( isDistractionFree ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\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( { dispatch, registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( 'core/preferences' )\n\t\t\t.set( 'core/edit-site', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to a non visual mode.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif ( mode === 'visual' ) {\n\t\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t\t} else if ( mode === 'text' ) {\n\t\t\tconst isDistractionFree = registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\tdispatch.toggleDistractionFree();\n\t\t\t}\n\t\t\tspeak( __( 'Code editor selected' ), 'assertive' );\n\t\t}\n\t};\n\n/**\n * Sets whether or not the editor allows only page content to be edited.\n *\n * @param {boolean} hasPageContentFocus True to allow only page content to be\n * edited, false to allow template to be\n * edited.\n */\nexport const setHasPageContentFocus =\n\t( hasPageContentFocus ) =>\n\t( { dispatch, registry } ) => {\n\t\tif ( hasPageContentFocus ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_HAS_PAGE_CONTENT_FOCUS',\n\t\t\thasPageContentFocus,\n\t\t} );\n\t};\n\n/**\n * Action that toggles Distraction free mode.\n * Distraction free mode expects there are no sidebars, as due to the\n * z-index values set, you can't close sidebars.\n */\nexport const toggleDistractionFree =\n\t() =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( ! isDistractionFree ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t\t.set( 'core/edit-site', 'fixedToolbar', false );\n\t\t\t\tdispatch.setIsInserterOpened( false );\n\t\t\t\tdispatch.setIsListViewOpened( false );\n\t\t\t\tdispatch.closeGeneralSidebar();\n\t\t\t} );\n\t\t}\n\t\tregistry.batch( () => {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set(\n\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t'distractionFree',\n\t\t\t\t\t! isDistractionFree\n\t\t\t\t);\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createInfoNotice(\n\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t? __( 'Distraction free off.' )\n\t\t\t\t\t\t: __( 'Distraction free on.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/edit-site/distraction-free-mode/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t} );\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAQ,MAAM,sBAAsB;AAC3C,SAASC,KAAK,EAAEC,2BAA2B,QAAQ,mBAAmB;AACtE,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,KAAK,IAAI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AAE,MAAM;MACrB1F,QAAQ,CACNG,QAAQ,CAAEb,gBAAiB,CAAC,CAC5BgG,GAAG,CAAE,gBAAgB,EAAE,cAAc,EAAE,KAAM,CAAC;MAChDnF,QAAQ,CAAC8C,mBAAmB,CAAE,KAAM,CAAC;MACrC9C,QAAQ,CAACkD,mBAAmB,CAAE,KAAM,CAAC;MACrClD,QAAQ,CAAC+E,mBAAmB,CAAC,CAAC;IAC/B,CAAE,CAAC;EACJ;EACAlF,QAAQ,CAAC0F,KAAK,CAAE,MAAM;IACrB1F,QAAQ,CACNG,QAAQ,CAAEb,gBAAiB,CAAC,CAC5BgG,GAAG,CACH,gBAAgB,EAChB,iBAAiB,EACjB,CAAE/B,iBACH,CAAC;IACFvD,QAAQ,CACNG,QAAQ,CAAElB,YAAa,CAAC,CACxB0G,gBAAgB,CAChBpC,iBAAiB,GACdzE,EAAE,CAAE,uBAAwB,CAAC,GAC7BA,EAAE,CAAE,sBAAuB,CAAC,EAC/B;MACCmC,EAAE,EAAE,6CAA6C;MACjDV,IAAI,EAAE;IACP,CACD,CAAC;EACH,CAAE,CAAC;AACJ,CAAC"}
@@ -1,15 +1,9 @@
1
- /**
2
- * External dependencies
3
- */
4
- import createSelector from 'rememo';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
9
4
  import { store as coreDataStore } from '@wordpress/core-data';
10
5
  import { createRegistrySelector } from '@wordpress/data';
11
6
  import deprecated from '@wordpress/deprecated';
12
- import { uploadMedia } from '@wordpress/media-utils';
13
7
  import { Platform } from '@wordpress/element';
14
8
  import { store as preferencesStore } from '@wordpress/preferences';
15
9
  import { store as blockEditorStore } from '@wordpress/block-editor';
@@ -18,22 +12,11 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
18
12
  * Internal dependencies
19
13
  */
20
14
  import { getFilteredTemplatePartBlocks } from './utils';
21
- import { TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE } from '../utils/constants';
15
+ import { TEMPLATE_PART_POST_TYPE } from '../utils/constants';
22
16
  /**
23
17
  * @typedef {'template'|'template_type'} TemplateType Template type.
24
18
  */
25
19
 
26
- /**
27
- * Helper for getting a preference from the preferences store.
28
- *
29
- * This is only present so that `getSettings` doesn't need to be made a
30
- * registry selector.
31
- *
32
- * It's unstable because the selector needs to be exported and so part of the
33
- * public API to work.
34
- */
35
- export const __unstableGetPreference = createRegistrySelector(select => (state, name) => select(preferencesStore).get('core/edit-site', name));
36
-
37
20
  /**
38
21
  * Returns whether the given feature is enabled or not.
39
22
  *
@@ -43,13 +26,13 @@ export const __unstableGetPreference = createRegistrySelector(select => (state,
43
26
  *
44
27
  * @return {boolean} Is active.
45
28
  */
46
- export function isFeatureActive(state, featureName) {
29
+ export const isFeatureActive = createRegistrySelector(select => (_, featureName) => {
47
30
  deprecated(`select( 'core/edit-site' ).isFeatureActive`, {
48
31
  since: '6.0',
49
32
  alternative: `select( 'core/preferences' ).get`
50
33
  });
51
- return !!__unstableGetPreference(state, featureName);
52
- }
34
+ return !!select(preferencesStore).get('core/edit-site', featureName);
35
+ });
53
36
 
54
37
  /**
55
38
  * Returns the current editing canvas device type.
@@ -79,6 +62,10 @@ export const getCanUserCreateMedia = createRegistrySelector(select => () => sele
79
62
  * @return {Array} The available reusable blocks.
80
63
  */
81
64
  export const getReusableBlocks = createRegistrySelector(select => () => {
65
+ deprecated("select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )", {
66
+ since: '6.5',
67
+ version: '6.8'
68
+ });
82
69
  const isWeb = Platform.OS === 'web';
83
70
  return isWeb ? select(coreDataStore).getEntityRecords('postType', 'wp_block', {
84
71
  per_page: -1
@@ -86,44 +73,18 @@ export const getReusableBlocks = createRegistrySelector(select => () => {
86
73
  });
87
74
 
88
75
  /**
89
- * Returns the settings, taking into account active features and permissions.
76
+ * Returns the site editor settings.
90
77
  *
91
- * @param {Object} state Global application state.
92
- * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.
78
+ * @param {Object} state Global application state.
93
79
  *
94
80
  * @return {Object} Settings.
95
81
  */
96
- export const getSettings = createSelector((state, setIsInserterOpen) => {
97
- const settings = {
98
- ...state.settings,
99
- outlineMode: true,
100
- focusMode: !!__unstableGetPreference(state, 'focusMode'),
101
- isDistractionFree: !!__unstableGetPreference(state, 'distractionFree'),
102
- hasFixedToolbar: !!__unstableGetPreference(state, 'fixedToolbar'),
103
- keepCaretInsideBlock: !!__unstableGetPreference(state, 'keepCaretInsideBlock'),
104
- showIconLabels: !!__unstableGetPreference(state, 'showIconLabels'),
105
- __experimentalSetIsInserterOpened: setIsInserterOpen,
106
- __experimentalReusableBlocks: getReusableBlocks(state),
107
- __experimentalPreferPatternsOnRoot: TEMPLATE_POST_TYPE === getEditedPostType(state)
108
- };
109
- const canUserCreateMedia = getCanUserCreateMedia(state);
110
- if (!canUserCreateMedia) {
111
- return settings;
112
- }
113
- settings.mediaUpload = ({
114
- onError,
115
- ...rest
116
- }) => {
117
- uploadMedia({
118
- wpAllowedMimeTypes: state.settings.allowedMimeTypes,
119
- onError: ({
120
- message
121
- }) => onError(message),
122
- ...rest
123
- });
124
- };
125
- return settings;
126
- }, state => [getCanUserCreateMedia(state), state.settings, __unstableGetPreference(state, 'focusMode'), __unstableGetPreference(state, 'distractionFree'), __unstableGetPreference(state, 'fixedToolbar'), __unstableGetPreference(state, 'keepCaretInsideBlock'), __unstableGetPreference(state, 'showIconLabels'), getReusableBlocks(state), getEditedPostType(state)]);
82
+ export function getSettings(state) {
83
+ // It is important that we don't inject anything into these settings locally.
84
+ // The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.
85
+ // If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.
86
+ return state.settings;
87
+ }
127
88
 
128
89
  /**
129
90
  * @deprecated
@@ -275,9 +236,9 @@ export const getCurrentTemplateTemplateParts = createRegistrySelector(select =>
275
236
  *
276
237
  * @return {string} Editing mode.
277
238
  */
278
- export function getEditorMode(state) {
279
- return __unstableGetPreference(state, 'editorMode');
280
- }
239
+ export const getEditorMode = createRegistrySelector(select => () => {
240
+ return select(preferencesStore).get('core/edit-site', 'editorMode');
241
+ });
281
242
 
282
243
  /**
283
244
  * @deprecated
@@ -1 +1 @@
1
- {"version":3,"names":["createSelector","store","coreDataStore","createRegistrySelector","deprecated","uploadMedia","Platform","preferencesStore","blockEditorStore","getFilteredTemplatePartBlocks","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","__unstableGetPreference","select","state","name","get","isFeatureActive","featureName","since","alternative","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","canUser","getReusableBlocks","isWeb","OS","getEntityRecords","per_page","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","isDistractionFree","hasFixedToolbar","keepCaretInsideBlock","showIconLabels","__experimentalSetIsInserterOpened","__experimentalReusableBlocks","__experimentalPreferPatternsOnRoot","getEditedPostType","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","version","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","hasPageContentFocus","postContentClientId","__experimentalGetGlobalBlocksByName","undefined","isListViewOpened","listViewPanel","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateParts","clientIds","blocks","getBlocksByClientId","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","isPage","postId"],"sources":["@wordpress/edit-site/src/store/selectors.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../utils/constants';\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Helper for getting a preference from the preferences store.\n *\n * This is only present so that `getSettings` doesn't need to be made a\n * registry selector.\n *\n * It's unstable because the selector needs to be exported and so part of the\n * public API to work.\n */\nexport const __unstableGetPreference = createRegistrySelector(\n\t( select ) => ( state, name ) =>\n\t\tselect( preferencesStore ).get( 'core/edit-site', name )\n);\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, featureName ) {\n\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\treturn !! __unstableGetPreference( state, featureName );\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: !! __unstableGetPreference( state, 'focusMode' ),\n\t\t\tisDistractionFree: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'distractionFree'\n\t\t\t),\n\t\t\thasFixedToolbar: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tshowIconLabels: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t\t__experimentalReusableBlocks: getReusableBlocks( state ),\n\t\t\t__experimentalPreferPatternsOnRoot:\n\t\t\t\tTEMPLATE_POST_TYPE === getEditedPostType( state ),\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\t__unstableGetPreference( state, 'focusMode' ),\n\t\t__unstableGetPreference( state, 'distractionFree' ),\n\t\t__unstableGetPreference( state, 'fixedToolbar' ),\n\t\t__unstableGetPreference( state, 'keepCaretInsideBlock' ),\n\t\t__unstableGetPreference( state, 'showIconLabels' ),\n\t\tgetReusableBlocks( state ),\n\t\tgetEditedPostType( state ),\n\t]\n);\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tif ( typeof state.blockInserterPanel === 'object' ) {\n\t\t\tconst { rootClientId, insertionIndex, filterValue } =\n\t\t\t\tstate.blockInserterPanel;\n\t\t\treturn { rootClientId, insertionIndex, filterValue };\n\t\t}\n\n\t\tif ( hasPageContentFocus( state ) ) {\n\t\t\tconst [ postContentClientId ] =\n\t\t\t\tselect( blockEditorStore ).__experimentalGetGlobalBlocksByName(\n\t\t\t\t\t'core/post-content'\n\t\t\t\t);\n\t\t\tif ( postContentClientId ) {\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: postContentClientId,\n\t\t\t\t\tinsertionIndex: undefined,\n\t\t\t\t\tfilterValue: undefined,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\trootClientId: undefined,\n\t\t\tinsertionIndex: undefined,\n\t\t\tfilterValue: undefined,\n\t\t};\n\t}\n);\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t{ per_page: -1 }\n\t\t);\n\n\t\tconst clientIds =\n\t\t\tselect( blockEditorStore ).__experimentalGetGlobalBlocksByName(\n\t\t\t\t'core/template-part'\n\t\t\t);\n\t\tconst blocks =\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds );\n\n\t\treturn getFilteredTemplatePartBlocks( blocks, templateParts );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn __unstableGetPreference( state, 'editorMode' );\n}\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus( state ) {\n\treturn isPage( state ) ? state.hasPageContentFocus : false;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAc,MAAM,QAAQ;;AAEnC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,aAAa,QAAQ,sBAAsB;AAC7D,SAASC,sBAAsB,QAAQ,iBAAiB;AACxD,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASL,KAAK,IAAIM,gBAAgB,QAAQ,wBAAwB;AAClE,SAASN,KAAK,IAAIO,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA,SAASC,6BAA6B,QAAQ,SAAS;AACvD,SACCC,kBAAkB,EAClBC,uBAAuB,QACjB,oBAAoB;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAGT,sBAAsB,CAC1DU,MAAM,IAAM,CAAEC,KAAK,EAAEC,IAAI,KAC1BF,MAAM,CAAEN,gBAAiB,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;AACA;AACA,OAAO,SAASI,aAAaA,CAAEhE,KAAK,EAAG;EACtC,OAAOF,uBAAuB,CAAEE,KAAK,EAAE,YAAa,CAAC;AACtD;;AAEA;AACA;AACA;AACA,OAAO,SAASiE,wCAAwCA,CAAA,EAAG;EAC1D3E,UAAU,CACT,uEAAuE,EACvE;IACCe,KAAK,EAAE,KAAK;IACZgC,OAAO,EAAE;EACV,CACD,CAAC;AACF;;AAEA;AACA;AACA;AACA,OAAO,SAAS6B,4BAA4BA,CAAA,EAAG;EAC9C5E,UAAU,CAAE,2DAA2D,EAAE;IACxEe,KAAK,EAAE,KAAK;IACZgC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA,OAAO,SAAS8B,kBAAkBA,CAAA,EAAG;EACpC7E,UAAU,CAAE,iDAAiD,EAAE;IAC9De,KAAK,EAAE,KAAK;IACZgC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS+B,MAAMA,CAAEpE,KAAK,EAAG;EAC/B,OAAO,CAAC,CAAEA,KAAK,CAACsC,UAAU,CAACK,OAAO,EAAE0B,MAAM;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASlB,mBAAmBA,CAAEnD,KAAK,EAAG;EAC5C,OAAOoE,MAAM,CAAEpE,KAAM,CAAC,GAAGA,KAAK,CAACmD,mBAAmB,GAAG,KAAK;AAC3D"}
1
+ {"version":3,"names":["store","coreDataStore","createRegistrySelector","deprecated","Platform","preferencesStore","blockEditorStore","getFilteredTemplatePartBlocks","TEMPLATE_PART_POST_TYPE","isFeatureActive","select","_","featureName","since","alternative","get","__experimentalGetPreviewDeviceType","state","deviceType","getCanUserCreateMedia","canUser","getReusableBlocks","version","isWeb","OS","getEntityRecords","per_page","getSettings","settings","getHomeTemplateId","getEditedPostType","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","hasPageContentFocus","postContentClientId","__experimentalGetGlobalBlocksByName","undefined","isListViewOpened","listViewPanel","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateParts","clientIds","blocks","getBlocksByClientId","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","isPage","postId"],"sources":["@wordpress/edit-site/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\nimport { TEMPLATE_PART_POST_TYPE } from '../utils/constants';\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( _, featureName ) => {\n\t\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `select( 'core/preferences' ).get`,\n\t\t} );\n\n\t\treturn !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\tfeatureName\n\t\t);\n\t}\n);\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tdeprecated(\n\t\t\"select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )\",\n\t\t{\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t}\n\t);\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the site editor settings.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Settings.\n */\nexport function getSettings( state ) {\n\t// It is important that we don't inject anything into these settings locally.\n\t// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.\n\t// If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.\n\treturn state.settings;\n}\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tif ( typeof state.blockInserterPanel === 'object' ) {\n\t\t\tconst { rootClientId, insertionIndex, filterValue } =\n\t\t\t\tstate.blockInserterPanel;\n\t\t\treturn { rootClientId, insertionIndex, filterValue };\n\t\t}\n\n\t\tif ( hasPageContentFocus( state ) ) {\n\t\t\tconst [ postContentClientId ] =\n\t\t\t\tselect( blockEditorStore ).__experimentalGetGlobalBlocksByName(\n\t\t\t\t\t'core/post-content'\n\t\t\t\t);\n\t\t\tif ( postContentClientId ) {\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: postContentClientId,\n\t\t\t\t\tinsertionIndex: undefined,\n\t\t\t\t\tfilterValue: undefined,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\trootClientId: undefined,\n\t\t\tinsertionIndex: undefined,\n\t\t\tfilterValue: undefined,\n\t\t};\n\t}\n);\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t{ per_page: -1 }\n\t\t);\n\n\t\tconst clientIds =\n\t\t\tselect( blockEditorStore ).__experimentalGetGlobalBlocksByName(\n\t\t\t\t'core/template-part'\n\t\t\t);\n\t\tconst blocks =\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds );\n\n\t\treturn getFilteredTemplatePartBlocks( blocks, templateParts );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () => {\n\treturn select( preferencesStore ).get( 'core/edit-site', 'editorMode' );\n} );\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus( state ) {\n\treturn isPage( state ) ? state.hasPageContentFocus : false;\n}\n"],"mappings":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KAAK;AAC3D"}
@@ -27,7 +27,7 @@ export const {
27
27
  PATTERN_TYPES,
28
28
  PATTERN_DEFAULT_CATEGORY,
29
29
  PATTERN_USER_CATEGORY,
30
- PATTERN_CORE_SOURCES,
30
+ EXCLUDED_PATTERN_SOURCES,
31
31
  PATTERN_SYNC_TYPES
32
32
  } = unlock(patternPrivateApis);
33
33
 
@@ -1 +1 @@
1
- {"version":3,"names":["__","privateApis","patternPrivateApis","unlock","NAVIGATION_POST_TYPE","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_ORIGINS","custom","theme","plugin","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","PATTERN_USER_CATEGORY","PATTERN_CORE_SOURCES","PATTERN_SYNC_TYPES","FOCUSABLE_ENTITIES","user","PAGE_CONTENT_BLOCK_TYPES","POST_TYPE_LABELS"],"sources":["@wordpress/edit-site/src/utils/constants.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as patternPrivateApis } from '@wordpress/patterns';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n// Navigation\nexport const NAVIGATION_POST_TYPE = 'wp_navigation';\n\n// Templates.\nexport const TEMPLATE_POST_TYPE = 'wp_template';\nexport const TEMPLATE_PART_POST_TYPE = 'wp_template_part';\nexport const TEMPLATE_ORIGINS = {\n\tcustom: 'custom',\n\ttheme: 'theme',\n\tplugin: 'plugin',\n};\nexport const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';\n\n// Patterns.\nexport const {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tPATTERN_CORE_SOURCES,\n\tPATTERN_SYNC_TYPES,\n} = unlock( patternPrivateApis );\n\n// Entities that are editable in focus mode.\nexport const FOCUSABLE_ENTITIES = [\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\n/**\n * Block types that are considered to be page content. These are the only blocks\n * editable when hasPageContentFocus() is true.\n */\nexport const PAGE_CONTENT_BLOCK_TYPES = {\n\t'core/post-title': true,\n\t'core/post-featured-image': true,\n\t'core/post-content': true,\n};\n\nexport const POST_TYPE_LABELS = {\n\t[ TEMPLATE_POST_TYPE ]: __( 'Template' ),\n\t[ TEMPLATE_PART_POST_TYPE ]: __( 'Template part' ),\n\t[ PATTERN_TYPES.user ]: __( 'Pattern' ),\n\t[ NAVIGATION_POST_TYPE ]: __( 'Navigation' ),\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,kBAAkB,QAAQ,qBAAqB;;AAEvE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,gBAAgB;;AAEvC;AACA,OAAO,MAAMC,oBAAoB,GAAG,eAAe;;AAEnD;AACA,OAAO,MAAMC,kBAAkB,GAAG,aAAa;AAC/C,OAAO,MAAMC,uBAAuB,GAAG,kBAAkB;AACzD,OAAO,MAAMC,gBAAgB,GAAG;EAC/BC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE;AACT,CAAC;AACD,OAAO,MAAMC,mCAAmC,GAAG,eAAe;;AAElE;AACA,OAAO,MAAM;EACZC,aAAa;EACbC,wBAAwB;EACxBC,qBAAqB;EACrBC,oBAAoB;EACpBC;AACD,CAAC,GAAGb,MAAM,CAAED,kBAAmB,CAAC;;AAEhC;AACA,OAAO,MAAMe,kBAAkB,GAAG,CACjCX,uBAAuB,EACvBF,oBAAoB,EACpBQ,aAAa,CAACM,IAAI,CAClB;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMC,wBAAwB,GAAG;EACvC,iBAAiB,EAAE,IAAI;EACvB,0BAA0B,EAAE,IAAI;EAChC,mBAAmB,EAAE;AACtB,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAG;EAC/B,CAAEf,kBAAkB,GAAIL,EAAE,CAAE,UAAW,CAAC;EACxC,CAAEM,uBAAuB,GAAIN,EAAE,CAAE,eAAgB,CAAC;EAClD,CAAEY,aAAa,CAACM,IAAI,GAAIlB,EAAE,CAAE,SAAU,CAAC;EACvC,CAAEI,oBAAoB,GAAIJ,EAAE,CAAE,YAAa;AAC5C,CAAC"}
1
+ {"version":3,"names":["__","privateApis","patternPrivateApis","unlock","NAVIGATION_POST_TYPE","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_ORIGINS","custom","theme","plugin","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","PATTERN_USER_CATEGORY","EXCLUDED_PATTERN_SOURCES","PATTERN_SYNC_TYPES","FOCUSABLE_ENTITIES","user","PAGE_CONTENT_BLOCK_TYPES","POST_TYPE_LABELS"],"sources":["@wordpress/edit-site/src/utils/constants.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as patternPrivateApis } from '@wordpress/patterns';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n// Navigation\nexport const NAVIGATION_POST_TYPE = 'wp_navigation';\n\n// Templates.\nexport const TEMPLATE_POST_TYPE = 'wp_template';\nexport const TEMPLATE_PART_POST_TYPE = 'wp_template_part';\nexport const TEMPLATE_ORIGINS = {\n\tcustom: 'custom',\n\ttheme: 'theme',\n\tplugin: 'plugin',\n};\nexport const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';\n\n// Patterns.\nexport const {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tEXCLUDED_PATTERN_SOURCES,\n\tPATTERN_SYNC_TYPES,\n} = unlock( patternPrivateApis );\n\n// Entities that are editable in focus mode.\nexport const FOCUSABLE_ENTITIES = [\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\n/**\n * Block types that are considered to be page content. These are the only blocks\n * editable when hasPageContentFocus() is true.\n */\nexport const PAGE_CONTENT_BLOCK_TYPES = {\n\t'core/post-title': true,\n\t'core/post-featured-image': true,\n\t'core/post-content': true,\n};\n\nexport const POST_TYPE_LABELS = {\n\t[ TEMPLATE_POST_TYPE ]: __( 'Template' ),\n\t[ TEMPLATE_PART_POST_TYPE ]: __( 'Template part' ),\n\t[ PATTERN_TYPES.user ]: __( 'Pattern' ),\n\t[ NAVIGATION_POST_TYPE ]: __( 'Navigation' ),\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,kBAAkB,QAAQ,qBAAqB;;AAEvE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,gBAAgB;;AAEvC;AACA,OAAO,MAAMC,oBAAoB,GAAG,eAAe;;AAEnD;AACA,OAAO,MAAMC,kBAAkB,GAAG,aAAa;AAC/C,OAAO,MAAMC,uBAAuB,GAAG,kBAAkB;AACzD,OAAO,MAAMC,gBAAgB,GAAG;EAC/BC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE;AACT,CAAC;AACD,OAAO,MAAMC,mCAAmC,GAAG,eAAe;;AAElE;AACA,OAAO,MAAM;EACZC,aAAa;EACbC,wBAAwB;EACxBC,qBAAqB;EACrBC,wBAAwB;EACxBC;AACD,CAAC,GAAGb,MAAM,CAAED,kBAAmB,CAAC;;AAEhC;AACA,OAAO,MAAMe,kBAAkB,GAAG,CACjCX,uBAAuB,EACvBF,oBAAoB,EACpBQ,aAAa,CAACM,IAAI,CAClB;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMC,wBAAwB,GAAG;EACvC,iBAAiB,EAAE,IAAI;EACvB,0BAA0B,EAAE,IAAI;EAChC,mBAAmB,EAAE;AACtB,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAG;EAC/B,CAAEf,kBAAkB,GAAIL,EAAE,CAAE,UAAW,CAAC;EACxC,CAAEM,uBAAuB,GAAIN,EAAE,CAAE,eAAgB,CAAC;EAClD,CAAEY,aAAa,CAACM,IAAI,GAAIlB,EAAE,CAAE,SAAU,CAAC;EACvC,CAAEI,oBAAoB,GAAIJ,EAAE,CAAE,YAAa;AAC5C,CAAC"}
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
+ import { store as coreStore } from '@wordpress/core-data';
5
+ import { useDispatch } from '@wordpress/data';
4
6
  import { privateApis as routerPrivateApis } from '@wordpress/router';
5
7
 
6
8
  /**
@@ -21,10 +23,16 @@ const {
21
23
  export function useActivateTheme() {
22
24
  const history = useHistory();
23
25
  const location = useLocation();
26
+ const {
27
+ startResolution,
28
+ finishResolution
29
+ } = useDispatch(coreStore);
24
30
  return async () => {
25
31
  if (isPreviewingTheme()) {
26
32
  const activationURL = 'themes.php?action=activate&stylesheet=' + currentlyPreviewingTheme() + '&_wpnonce=' + window.WP_BLOCK_THEME_ACTIVATE_NONCE;
33
+ startResolution('activateTheme');
27
34
  await window.fetch(activationURL);
35
+ finishResolution('activateTheme');
28
36
  const {
29
37
  wp_theme_preview: themePreview,
30
38
  ...params
@@ -1 +1 @@
1
- {"version":3,"names":["privateApis","routerPrivateApis","unlock","isPreviewingTheme","currentlyPreviewingTheme","useHistory","useLocation","useActivateTheme","history","location","activationURL","window","WP_BLOCK_THEME_ACTIVATE_NONCE","fetch","wp_theme_preview","themePreview","params","replace"],"sources":["@wordpress/edit-site/src/utils/use-activate-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport {\n\tisPreviewingTheme,\n\tcurrentlyPreviewingTheme,\n} from './is-previewing-theme';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\n/**\n * This should be refactored to use the REST API, once the REST API can activate themes.\n *\n * @return {Function} A function that activates the theme.\n */\nexport function useActivateTheme() {\n\tconst history = useHistory();\n\tconst location = useLocation();\n\n\treturn async () => {\n\t\tif ( isPreviewingTheme() ) {\n\t\t\tconst activationURL =\n\t\t\t\t'themes.php?action=activate&stylesheet=' +\n\t\t\t\tcurrentlyPreviewingTheme() +\n\t\t\t\t'&_wpnonce=' +\n\t\t\t\twindow.WP_BLOCK_THEME_ACTIVATE_NONCE;\n\t\t\tawait window.fetch( activationURL );\n\t\t\tconst { wp_theme_preview: themePreview, ...params } =\n\t\t\t\tlocation.params;\n\t\t\thistory.replace( params );\n\t\t}\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,gBAAgB;AACvC,SACCC,iBAAiB,EACjBC,wBAAwB,QAClB,uBAAuB;AAE9B,MAAM;EAAEC,UAAU;EAAEC;AAAY,CAAC,GAAGJ,MAAM,CAAED,iBAAkB,CAAC;;AAE/D;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,gBAAgBA,CAAA,EAAG;EAClC,MAAMC,OAAO,GAAGH,UAAU,CAAC,CAAC;EAC5B,MAAMI,QAAQ,GAAGH,WAAW,CAAC,CAAC;EAE9B,OAAO,YAAY;IAClB,IAAKH,iBAAiB,CAAC,CAAC,EAAG;MAC1B,MAAMO,aAAa,GAClB,wCAAwC,GACxCN,wBAAwB,CAAC,CAAC,GAC1B,YAAY,GACZO,MAAM,CAACC,6BAA6B;MACrC,MAAMD,MAAM,CAACE,KAAK,CAAEH,aAAc,CAAC;MACnC,MAAM;QAAEI,gBAAgB,EAAEC,YAAY;QAAE,GAAGC;MAAO,CAAC,GAClDP,QAAQ,CAACO,MAAM;MAChBR,OAAO,CAACS,OAAO,CAAED,MAAO,CAAC;IAC1B;EACD,CAAC;AACF"}
1
+ {"version":3,"names":["store","coreStore","useDispatch","privateApis","routerPrivateApis","unlock","isPreviewingTheme","currentlyPreviewingTheme","useHistory","useLocation","useActivateTheme","history","location","startResolution","finishResolution","activationURL","window","WP_BLOCK_THEME_ACTIVATE_NONCE","fetch","wp_theme_preview","themePreview","params","replace"],"sources":["@wordpress/edit-site/src/utils/use-activate-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport {\n\tisPreviewingTheme,\n\tcurrentlyPreviewingTheme,\n} from './is-previewing-theme';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\n/**\n * This should be refactored to use the REST API, once the REST API can activate themes.\n *\n * @return {Function} A function that activates the theme.\n */\nexport function useActivateTheme() {\n\tconst history = useHistory();\n\tconst location = useLocation();\n\tconst { startResolution, finishResolution } = useDispatch( coreStore );\n\n\treturn async () => {\n\t\tif ( isPreviewingTheme() ) {\n\t\t\tconst activationURL =\n\t\t\t\t'themes.php?action=activate&stylesheet=' +\n\t\t\t\tcurrentlyPreviewingTheme() +\n\t\t\t\t'&_wpnonce=' +\n\t\t\t\twindow.WP_BLOCK_THEME_ACTIVATE_NONCE;\n\t\t\tstartResolution( 'activateTheme' );\n\t\t\tawait window.fetch( activationURL );\n\t\t\tfinishResolution( 'activateTheme' );\n\t\t\tconst { wp_theme_preview: themePreview, ...params } =\n\t\t\t\tlocation.params;\n\t\t\thistory.replace( params );\n\t\t}\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,gBAAgB;AACvC,SACCC,iBAAiB,EACjBC,wBAAwB,QAClB,uBAAuB;AAE9B,MAAM;EAAEC,UAAU;EAAEC;AAAY,CAAC,GAAGJ,MAAM,CAAED,iBAAkB,CAAC;;AAE/D;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,gBAAgBA,CAAA,EAAG;EAClC,MAAMC,OAAO,GAAGH,UAAU,CAAC,CAAC;EAC5B,MAAMI,QAAQ,GAAGH,WAAW,CAAC,CAAC;EAC9B,MAAM;IAAEI,eAAe;IAAEC;EAAiB,CAAC,GAAGZ,WAAW,CAAED,SAAU,CAAC;EAEtE,OAAO,YAAY;IAClB,IAAKK,iBAAiB,CAAC,CAAC,EAAG;MAC1B,MAAMS,aAAa,GAClB,wCAAwC,GACxCR,wBAAwB,CAAC,CAAC,GAC1B,YAAY,GACZS,MAAM,CAACC,6BAA6B;MACrCJ,eAAe,CAAE,eAAgB,CAAC;MAClC,MAAMG,MAAM,CAACE,KAAK,CAAEH,aAAc,CAAC;MACnCD,gBAAgB,CAAE,eAAgB,CAAC;MACnC,MAAM;QAAEK,gBAAgB,EAAEC,YAAY;QAAE,GAAGC;MAAO,CAAC,GAClDT,QAAQ,CAACS,MAAM;MAChBV,OAAO,CAACW,OAAO,CAAED,MAAO,CAAC;IAC1B;EACD,CAAC;AACF"}