@wordpress/edit-site 5.31.0 → 5.32.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 (280) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-editor/editor-canvas.js +8 -1
  3. package/build/components/block-editor/editor-canvas.js.map +1 -1
  4. package/build/components/block-editor/site-editor-canvas.js +15 -4
  5. package/build/components/block-editor/site-editor-canvas.js.map +1 -1
  6. package/build/components/editor/index.js +12 -3
  7. package/build/components/editor/index.js.map +1 -1
  8. package/build/components/editor-canvas-container/index.js +1 -2
  9. package/build/components/editor-canvas-container/index.js.map +1 -1
  10. package/build/components/global-styles/background-panel.js +38 -0
  11. package/build/components/global-styles/background-panel.js.map +1 -0
  12. package/build/components/global-styles/font-families.js +1 -1
  13. package/build/components/global-styles/font-families.js.map +1 -1
  14. package/build/components/global-styles/font-library-modal/context.js +38 -9
  15. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  16. package/build/components/global-styles/font-library-modal/utils/index.js +20 -2
  17. package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  18. package/build/components/global-styles/palette.js +3 -1
  19. package/build/components/global-styles/palette.js.map +1 -1
  20. package/build/components/global-styles/preview-colors.js +2 -2
  21. package/build/components/global-styles/preview-colors.js.map +1 -1
  22. package/build/components/global-styles/root-menu.js +8 -2
  23. package/build/components/global-styles/root-menu.js.map +1 -1
  24. package/build/components/global-styles/screen-background.js +34 -0
  25. package/build/components/global-styles/screen-background.js.map +1 -0
  26. package/build/components/global-styles/screen-color-palette.js +2 -2
  27. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  28. package/build/components/global-styles/screen-colors.js +6 -4
  29. package/build/components/global-styles/screen-colors.js.map +1 -1
  30. package/build/components/global-styles/screen-style-variations.js +3 -37
  31. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  32. package/build/components/global-styles/screen-typography.js +6 -6
  33. package/build/components/global-styles/screen-typography.js.map +1 -1
  34. package/build/components/global-styles/style-variations-container.js +5 -2
  35. package/build/components/global-styles/style-variations-container.js.map +1 -1
  36. package/build/components/global-styles/ui.js +4 -1
  37. package/build/components/global-styles/ui.js.map +1 -1
  38. package/build/components/global-styles/variations/variations-color.js +10 -3
  39. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  40. package/build/components/global-styles/variations/variations-typography.js +9 -2
  41. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  42. package/build/components/keyboard-shortcut-help-modal/index.js +3 -0
  43. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  44. package/build/components/layout/animation.js +129 -0
  45. package/build/components/layout/animation.js.map +1 -0
  46. package/build/components/layout/index.js +9 -17
  47. package/build/components/layout/index.js.map +1 -1
  48. package/build/components/layout/router.js +21 -18
  49. package/build/components/layout/router.js.map +1 -1
  50. package/build/components/page-pages/index.js +19 -17
  51. package/build/components/page-pages/index.js.map +1 -1
  52. package/build/components/page-patterns/index.js +18 -28
  53. package/build/components/page-patterns/index.js.map +1 -1
  54. package/build/components/page-patterns/search-items.js +16 -58
  55. package/build/components/page-patterns/search-items.js.map +1 -1
  56. package/build/components/page-templates-template-parts/actions.js +54 -41
  57. package/build/components/page-templates-template-parts/actions.js.map +1 -1
  58. package/build/components/page-templates-template-parts/index.js +26 -59
  59. package/build/components/page-templates-template-parts/index.js.map +1 -1
  60. package/build/components/plugin-template-setting-panel/index.js +12 -1
  61. package/build/components/plugin-template-setting-panel/index.js.map +1 -1
  62. package/build/components/save-button/index.js +45 -16
  63. package/build/components/save-button/index.js.map +1 -1
  64. package/build/components/save-hub/index.js +8 -112
  65. package/build/components/save-hub/index.js.map +1 -1
  66. package/build/components/sidebar/index.js +1 -5
  67. package/build/components/sidebar/index.js.map +1 -1
  68. package/build/components/sidebar-dataviews/default-views.js +1 -1
  69. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  70. package/build/components/sidebar-dataviews/index.js +1 -1
  71. package/build/components/sidebar-dataviews/index.js.map +1 -1
  72. package/build/components/sidebar-edit-mode/index.js +1 -2
  73. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  74. package/build/components/sidebar-edit-mode/page-panels/index.js +5 -15
  75. package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  76. package/build/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
  77. package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  78. package/build/components/sidebar-edit-mode/template-panel/index.js +10 -16
  79. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  80. package/build/components/sidebar-navigation-screen-details-footer/index.js +5 -1
  81. package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  82. package/build/components/sidebar-navigation-screen-global-styles/index.js +10 -5
  83. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  84. package/build/components/sidebar-navigation-screen-patterns/index.js +1 -5
  85. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  86. package/build/components/style-book/index.js +1 -1
  87. package/build/components/style-book/index.js.map +1 -1
  88. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
  89. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  90. package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
  91. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  92. package/build/hooks/index.js +0 -1
  93. package/build/hooks/index.js.map +1 -1
  94. package/build/store/selectors.js +1 -9
  95. package/build/store/selectors.js.map +1 -1
  96. package/build-module/components/block-editor/editor-canvas.js +8 -1
  97. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  98. package/build-module/components/block-editor/site-editor-canvas.js +15 -4
  99. package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
  100. package/build-module/components/editor/index.js +13 -4
  101. package/build-module/components/editor/index.js.map +1 -1
  102. package/build-module/components/editor-canvas-container/index.js +1 -2
  103. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  104. package/build-module/components/global-styles/background-panel.js +31 -0
  105. package/build-module/components/global-styles/background-panel.js.map +1 -0
  106. package/build-module/components/global-styles/font-families.js +1 -1
  107. package/build-module/components/global-styles/font-families.js.map +1 -1
  108. package/build-module/components/global-styles/font-library-modal/context.js +38 -9
  109. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  110. package/build-module/components/global-styles/font-library-modal/utils/index.js +20 -2
  111. package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  112. package/build-module/components/global-styles/palette.js +3 -1
  113. package/build-module/components/global-styles/palette.js.map +1 -1
  114. package/build-module/components/global-styles/preview-colors.js +2 -2
  115. package/build-module/components/global-styles/preview-colors.js.map +1 -1
  116. package/build-module/components/global-styles/root-menu.js +9 -3
  117. package/build-module/components/global-styles/root-menu.js.map +1 -1
  118. package/build-module/components/global-styles/screen-background.js +26 -0
  119. package/build-module/components/global-styles/screen-background.js.map +1 -0
  120. package/build-module/components/global-styles/screen-color-palette.js +2 -2
  121. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  122. package/build-module/components/global-styles/screen-colors.js +6 -4
  123. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  124. package/build-module/components/global-styles/screen-style-variations.js +4 -38
  125. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  126. package/build-module/components/global-styles/screen-typography.js +6 -6
  127. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  128. package/build-module/components/global-styles/style-variations-container.js +5 -2
  129. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  130. package/build-module/components/global-styles/ui.js +4 -1
  131. package/build-module/components/global-styles/ui.js.map +1 -1
  132. package/build-module/components/global-styles/variations/variations-color.js +10 -3
  133. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  134. package/build-module/components/global-styles/variations/variations-typography.js +9 -2
  135. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  136. package/build-module/components/keyboard-shortcut-help-modal/index.js +3 -0
  137. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  138. package/build-module/components/layout/animation.js +122 -0
  139. package/build-module/components/layout/animation.js.map +1 -0
  140. package/build-module/components/layout/index.js +9 -17
  141. package/build-module/components/layout/index.js.map +1 -1
  142. package/build-module/components/layout/router.js +21 -18
  143. package/build-module/components/layout/router.js.map +1 -1
  144. package/build-module/components/page-pages/index.js +19 -17
  145. package/build-module/components/page-pages/index.js.map +1 -1
  146. package/build-module/components/page-patterns/index.js +20 -30
  147. package/build-module/components/page-patterns/index.js.map +1 -1
  148. package/build-module/components/page-patterns/search-items.js +14 -55
  149. package/build-module/components/page-patterns/search-items.js.map +1 -1
  150. package/build-module/components/page-templates-template-parts/actions.js +54 -40
  151. package/build-module/components/page-templates-template-parts/actions.js.map +1 -1
  152. package/build-module/components/page-templates-template-parts/index.js +29 -62
  153. package/build-module/components/page-templates-template-parts/index.js.map +1 -1
  154. package/build-module/components/plugin-template-setting-panel/index.js +12 -1
  155. package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
  156. package/build-module/components/save-button/index.js +46 -17
  157. package/build-module/components/save-button/index.js.map +1 -1
  158. package/build-module/components/save-hub/index.js +10 -114
  159. package/build-module/components/save-hub/index.js.map +1 -1
  160. package/build-module/components/sidebar/index.js +1 -5
  161. package/build-module/components/sidebar/index.js.map +1 -1
  162. package/build-module/components/sidebar-dataviews/default-views.js +1 -1
  163. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  164. package/build-module/components/sidebar-dataviews/index.js +1 -1
  165. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  166. package/build-module/components/sidebar-edit-mode/index.js +1 -2
  167. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  168. package/build-module/components/sidebar-edit-mode/page-panels/index.js +8 -18
  169. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  170. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
  171. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  172. package/build-module/components/sidebar-edit-mode/template-panel/index.js +11 -17
  173. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  174. package/build-module/components/sidebar-navigation-screen-details-footer/index.js +5 -1
  175. package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  176. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +10 -5
  177. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  178. package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -5
  179. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  180. package/build-module/components/style-book/index.js +1 -1
  181. package/build-module/components/style-book/index.js.map +1 -1
  182. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
  183. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  184. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
  185. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  186. package/build-module/hooks/index.js +0 -1
  187. package/build-module/hooks/index.js.map +1 -1
  188. package/build-module/store/selectors.js +1 -9
  189. package/build-module/store/selectors.js.map +1 -1
  190. package/build-style/style-rtl.css +116 -104
  191. package/build-style/style.css +116 -104
  192. package/package.json +44 -44
  193. package/src/components/block-editor/editor-canvas.js +14 -2
  194. package/src/components/block-editor/site-editor-canvas.js +10 -7
  195. package/src/components/editor/index.js +11 -4
  196. package/src/components/editor-canvas-container/index.js +0 -1
  197. package/src/components/global-styles/background-panel.js +34 -0
  198. package/src/components/global-styles/font-families.js +1 -1
  199. package/src/components/global-styles/font-library-modal/context.js +43 -14
  200. package/src/components/global-styles/font-library-modal/style.scss +1 -1
  201. package/src/components/global-styles/font-library-modal/utils/index.js +17 -4
  202. package/src/components/global-styles/palette.js +3 -1
  203. package/src/components/global-styles/preview-colors.js +2 -2
  204. package/src/components/global-styles/root-menu.js +12 -1
  205. package/src/components/global-styles/screen-background.js +29 -0
  206. package/src/components/global-styles/screen-color-palette.js +2 -2
  207. package/src/components/global-styles/screen-colors.js +4 -4
  208. package/src/components/global-styles/screen-style-variations.js +4 -36
  209. package/src/components/global-styles/screen-typography.js +6 -9
  210. package/src/components/global-styles/style-variations-container.js +2 -1
  211. package/src/components/global-styles/style.scss +14 -12
  212. package/src/components/global-styles/ui.js +5 -0
  213. package/src/components/global-styles/variations/style.scss +32 -17
  214. package/src/components/global-styles/variations/variations-color.js +4 -2
  215. package/src/components/global-styles/variations/variations-typography.js +4 -1
  216. package/src/components/header-edit-mode/style.scss +28 -17
  217. package/src/components/keyboard-shortcut-help-modal/index.js +4 -0
  218. package/src/components/layout/animation.js +122 -0
  219. package/src/components/layout/index.js +12 -27
  220. package/src/components/layout/router.js +25 -19
  221. package/src/components/layout/style.scss +2 -0
  222. package/src/components/page-pages/index.js +27 -43
  223. package/src/components/page-patterns/index.js +20 -28
  224. package/src/components/page-patterns/search-items.js +13 -58
  225. package/src/components/page-templates-template-parts/actions.js +106 -91
  226. package/src/components/page-templates-template-parts/index.js +34 -78
  227. package/src/components/page-templates-template-parts/style.scss +5 -0
  228. package/src/components/plugin-template-setting-panel/index.js +14 -1
  229. package/src/components/save-button/index.js +55 -26
  230. package/src/components/save-hub/index.js +20 -164
  231. package/src/components/sidebar/index.js +0 -5
  232. package/src/components/sidebar-dataviews/default-views.js +1 -1
  233. package/src/components/sidebar-dataviews/index.js +1 -1
  234. package/src/components/sidebar-edit-mode/index.js +0 -2
  235. package/src/components/sidebar-edit-mode/page-panels/index.js +29 -60
  236. package/src/components/sidebar-edit-mode/page-panels/page-content.js +10 -10
  237. package/src/components/sidebar-edit-mode/template-panel/index.js +23 -33
  238. package/src/components/sidebar-edit-mode/template-panel/style.scss +1 -29
  239. package/src/components/sidebar-navigation-screen/style.scss +12 -9
  240. package/src/components/sidebar-navigation-screen-details-footer/index.js +6 -2
  241. package/src/components/sidebar-navigation-screen-global-styles/index.js +7 -13
  242. package/src/components/sidebar-navigation-screen-patterns/index.js +0 -7
  243. package/src/components/style-book/index.js +1 -3
  244. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
  245. package/src/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
  246. package/src/hooks/index.js +0 -1
  247. package/src/store/selectors.js +3 -15
  248. package/src/style.scss +0 -1
  249. package/build/components/actions/index.js +0 -319
  250. package/build/components/actions/index.js.map +0 -1
  251. package/build/components/sidebar-edit-mode/sidebar-card/index.js +0 -48
  252. package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +0 -1
  253. package/build/components/sidebar-edit-mode/template-panel/template-areas.js +0 -70
  254. package/build/components/sidebar-edit-mode/template-panel/template-areas.js.map +0 -1
  255. package/build/components/sidebar-navigation-screen-pages/index.js +0 -175
  256. package/build/components/sidebar-navigation-screen-pages/index.js.map +0 -1
  257. package/build/hooks/template-part-edit.js +0 -82
  258. package/build/hooks/template-part-edit.js.map +0 -1
  259. package/build/store/utils.js +0 -71
  260. package/build/store/utils.js.map +0 -1
  261. package/build-module/components/actions/index.js +0 -308
  262. package/build-module/components/actions/index.js.map +0 -1
  263. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +0 -40
  264. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +0 -1
  265. package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js +0 -63
  266. package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js.map +0 -1
  267. package/build-module/components/sidebar-navigation-screen-pages/index.js +0 -167
  268. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +0 -1
  269. package/build-module/hooks/template-part-edit.js +0 -75
  270. package/build-module/hooks/template-part-edit.js.map +0 -1
  271. package/build-module/store/utils.js +0 -64
  272. package/build-module/store/utils.js.map +0 -1
  273. package/src/components/actions/index.js +0 -409
  274. package/src/components/sidebar-edit-mode/sidebar-card/index.js +0 -53
  275. package/src/components/sidebar-edit-mode/sidebar-card/style.scss +0 -36
  276. package/src/components/sidebar-edit-mode/template-panel/template-areas.js +0 -86
  277. package/src/components/sidebar-navigation-screen-pages/index.js +0 -238
  278. package/src/hooks/template-part-edit.js +0 -89
  279. package/src/store/test/utils.js +0 -191
  280. package/src/store/utils.js +0 -69
@@ -4,55 +4,77 @@ import { createElement } from "react";
4
4
  */
5
5
  import { useSelect, useDispatch } from '@wordpress/data';
6
6
  import { Button } from '@wordpress/components';
7
- import { __, sprintf } from '@wordpress/i18n';
7
+ import { __, _n, sprintf } from '@wordpress/i18n';
8
8
  import { store as coreStore } from '@wordpress/core-data';
9
9
  import { displayShortcut } from '@wordpress/keycodes';
10
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
11
+ import { useEntitiesSavedStatesIsDirty, store as editorStore } from '@wordpress/editor';
10
12
 
11
13
  /**
12
14
  * Internal dependencies
13
15
  */
14
16
  import { store as editSiteStore } from '../../store';
15
17
  import { currentlyPreviewingTheme, isPreviewingTheme } from '../../utils/is-previewing-theme';
18
+ import { unlock } from '../../lock-unlock';
19
+ const {
20
+ useLocation
21
+ } = unlock(routerPrivateApis);
16
22
  export default function SaveButton({
17
23
  className = 'edit-site-save-button__button',
18
24
  variant = 'primary',
19
25
  showTooltip = true,
20
- defaultLabel,
26
+ showReviewMessage,
21
27
  icon,
22
28
  size,
23
29
  __next40pxDefaultSize = false
24
30
  }) {
25
31
  const {
26
- isDirty,
32
+ params
33
+ } = useLocation();
34
+ const {
35
+ setIsSaveViewOpened
36
+ } = useDispatch(editSiteStore);
37
+ const {
38
+ saveDirtyEntities
39
+ } = unlock(useDispatch(editorStore));
40
+ const {
41
+ dirtyEntityRecords
42
+ } = useEntitiesSavedStatesIsDirty();
43
+ const {
27
44
  isSaving,
28
45
  isSaveViewOpen,
29
46
  previewingThemeName
30
47
  } = useSelect(select => {
31
48
  const {
32
- __experimentalGetDirtyEntityRecords,
33
49
  isSavingEntityRecord,
34
50
  isResolving
35
51
  } = select(coreStore);
36
- const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
37
52
  const {
38
53
  isSaveViewOpened
39
54
  } = select(editSiteStore);
40
55
  const isActivatingTheme = isResolving('activateTheme');
41
56
  const currentlyPreviewingThemeId = currentlyPreviewingTheme();
42
57
  return {
43
- isDirty: dirtyEntityRecords.length > 0,
44
58
  isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)) || isActivatingTheme,
45
59
  isSaveViewOpen: isSaveViewOpened(),
46
60
  // Do not call `getTheme` with null, it will cause a request to
47
61
  // the server.
48
62
  previewingThemeName: currentlyPreviewingThemeId ? select(coreStore).getTheme(currentlyPreviewingThemeId)?.name?.rendered : undefined
49
63
  };
50
- }, []);
51
- const {
52
- setIsSaveViewOpened
53
- } = useDispatch(editSiteStore);
54
- const activateSaveEnabled = isPreviewingTheme() || isDirty;
55
- const disabled = isSaving || !activateSaveEnabled;
64
+ }, [dirtyEntityRecords]);
65
+ const hasDirtyEntities = !!dirtyEntityRecords.length;
66
+ let isOnlyCurrentEntityDirty;
67
+ // Check if the current entity is the only entity with changes.
68
+ // We have some extra logic for `wp_global_styles` for now, that
69
+ // is used in navigation sidebar.
70
+ if (dirtyEntityRecords.length === 1) {
71
+ if (params.postId) {
72
+ isOnlyCurrentEntityDirty = `${dirtyEntityRecords[0].key}` === params.postId && dirtyEntityRecords[0].name === params.postType;
73
+ } else if (params.path?.includes('wp_global_styles')) {
74
+ isOnlyCurrentEntityDirty = dirtyEntityRecords[0].name === 'globalStyles';
75
+ }
76
+ }
77
+ const disabled = isSaving || !hasDirtyEntities && !isPreviewingTheme();
56
78
  const getLabel = () => {
57
79
  if (isPreviewingTheme()) {
58
80
  if (isSaving) {
@@ -60,7 +82,7 @@ export default function SaveButton({
60
82
  __('Activating %s'), previewingThemeName);
61
83
  } else if (disabled) {
62
84
  return __('Saved');
63
- } else if (isDirty) {
85
+ } else if (hasDirtyEntities) {
64
86
  return sprintf( /* translators: %s: The name of theme to be activated. */
65
87
  __('Activate %s & Save'), previewingThemeName);
66
88
  }
@@ -69,21 +91,28 @@ export default function SaveButton({
69
91
  }
70
92
  if (isSaving) {
71
93
  return __('Saving');
72
- } else if (disabled) {
94
+ }
95
+ if (disabled) {
73
96
  return __('Saved');
74
- } else if (defaultLabel) {
75
- return defaultLabel;
97
+ }
98
+ if (!isOnlyCurrentEntityDirty && showReviewMessage) {
99
+ return sprintf(
100
+ // translators: %d: number of unsaved changes (number).
101
+ _n('Review %d change…', 'Review %d changes…', dirtyEntityRecords.length), dirtyEntityRecords.length);
76
102
  }
77
103
  return __('Save');
78
104
  };
79
105
  const label = getLabel();
106
+ const onClick = isOnlyCurrentEntityDirty ? () => saveDirtyEntities({
107
+ dirtyEntityRecords
108
+ }) : () => setIsSaveViewOpened(true);
80
109
  return createElement(Button, {
81
110
  variant: variant,
82
111
  className: className,
83
112
  "aria-disabled": disabled,
84
113
  "aria-expanded": isSaveViewOpen,
85
114
  isBusy: isSaving,
86
- onClick: disabled ? undefined : () => setIsSaveViewOpened(true),
115
+ onClick: disabled ? undefined : onClick,
87
116
  label: label
88
117
  /*
89
118
  * We want the tooltip to show the keyboard shortcut only when the
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","Button","__","sprintf","store","coreStore","displayShortcut","editSiteStore","currentlyPreviewingTheme","isPreviewingTheme","SaveButton","className","variant","showTooltip","defaultLabel","icon","size","__next40pxDefaultSize","isDirty","isSaving","isSaveViewOpen","previewingThemeName","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","isResolving","dirtyEntityRecords","isSaveViewOpened","isActivatingTheme","currentlyPreviewingThemeId","length","some","record","kind","name","key","getTheme","rendered","undefined","setIsSaveViewOpened","activateSaveEnabled","disabled","getLabel","label","createElement","isBusy","onClick","shortcut","primary"],"sources":["@wordpress/edit-site/src/components/save-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport {\n\tcurrentlyPreviewingTheme,\n\tisPreviewingTheme,\n} from '../../utils/is-previewing-theme';\n\nexport default function SaveButton( {\n\tclassName = 'edit-site-save-button__button',\n\tvariant = 'primary',\n\tshowTooltip = true,\n\tdefaultLabel,\n\ticon,\n\tsize,\n\t__next40pxDefaultSize = false,\n} ) {\n\tconst { isDirty, isSaving, isSaveViewOpen, previewingThemeName } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\t\tisSavingEntityRecord,\n\t\t\t\tisResolving,\n\t\t\t} = select( coreStore );\n\t\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\t\tconst { isSaveViewOpened } = select( editSiteStore );\n\t\t\tconst isActivatingTheme = isResolving( 'activateTheme' );\n\t\t\tconst currentlyPreviewingThemeId = currentlyPreviewingTheme();\n\n\t\t\treturn {\n\t\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\t\tisSaving:\n\t\t\t\t\tdirtyEntityRecords.some( ( record ) =>\n\t\t\t\t\t\tisSavingEntityRecord(\n\t\t\t\t\t\t\trecord.kind,\n\t\t\t\t\t\t\trecord.name,\n\t\t\t\t\t\t\trecord.key\n\t\t\t\t\t\t)\n\t\t\t\t\t) || isActivatingTheme,\n\t\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\t\t// Do not call `getTheme` with null, it will cause a request to\n\t\t\t\t// the server.\n\t\t\t\tpreviewingThemeName: currentlyPreviewingThemeId\n\t\t\t\t\t? select( coreStore ).getTheme( currentlyPreviewingThemeId )\n\t\t\t\t\t\t\t?.name?.rendered\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t}, [] );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\n\tconst activateSaveEnabled = isPreviewingTheme() || isDirty;\n\tconst disabled = isSaving || ! activateSaveEnabled;\n\n\tconst getLabel = () => {\n\t\tif ( isPreviewingTheme() ) {\n\t\t\tif ( isSaving ) {\n\t\t\t\treturn sprintf(\n\t\t\t\t\t/* translators: %s: The name of theme to be activated. */\n\t\t\t\t\t__( 'Activating %s' ),\n\t\t\t\t\tpreviewingThemeName\n\t\t\t\t);\n\t\t\t} else if ( disabled ) {\n\t\t\t\treturn __( 'Saved' );\n\t\t\t} else if ( isDirty ) {\n\t\t\t\treturn sprintf(\n\t\t\t\t\t/* translators: %s: The name of theme to be activated. */\n\t\t\t\t\t__( 'Activate %s & Save' ),\n\t\t\t\t\tpreviewingThemeName\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn sprintf(\n\t\t\t\t/* translators: %s: The name of theme to be activated. */\n\t\t\t\t__( 'Activate %s' ),\n\t\t\t\tpreviewingThemeName\n\t\t\t);\n\t\t}\n\n\t\tif ( isSaving ) {\n\t\t\treturn __( 'Saving' );\n\t\t} else if ( disabled ) {\n\t\t\treturn __( 'Saved' );\n\t\t} else if ( defaultLabel ) {\n\t\t\treturn defaultLabel;\n\t\t}\n\t\treturn __( 'Save' );\n\t};\n\tconst label = getLabel();\n\n\treturn (\n\t\t<Button\n\t\t\tvariant={ variant }\n\t\t\tclassName={ className }\n\t\t\taria-disabled={ disabled }\n\t\t\taria-expanded={ isSaveViewOpen }\n\t\t\tisBusy={ isSaving }\n\t\t\tonClick={ disabled ? undefined : () => setIsSaveViewOpened( true ) }\n\t\t\tlabel={ label }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ disabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\t/*\n\t\t\t * Displaying the keyboard shortcut conditionally makes the tooltip\n\t\t\t * itself show conditionally. This would trigger a full-rerendering\n\t\t\t * of the button that we want to avoid. By setting `showTooltip`,\n\t\t\t * the tooltip is always rendered even when there's no keyboard shortcut.\n\t\t\t */\n\t\t\tshowTooltip={ showTooltip }\n\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KAAK,GAAGD,QAAQ,CAAC,CAAC;EAExB,OACCE,aAAA,CAAC3C,MAAM;IACNW,OAAO,EAAGA,OAAS;IACnBD,SAAS,EAAGA,SAAW;IACvB,iBAAgB8B,QAAU;IAC1B,iBAAgBrB,cAAgB;IAChCyB,MAAM,EAAG1B,QAAU;IACnB2B,OAAO,EAAGL,QAAQ,GAAGH,SAAS,GAAG,MAAMC,mBAAmB,CAAE,IAAK,CAAG;IACpEI,KAAK,EAAGA;IACR;AACH;AACA;AACA,OAHG;IAIAI,QAAQ,EAAGN,QAAQ,GAAGH,SAAS,GAAGhC,eAAe,CAAC0C,OAAO,CAAE,GAAI;IAC/D;AACH;AACA;AACA;AACA;AACA,OALG;IAMAnC,WAAW,EAAGA,WAAa;IAC3BE,IAAI,EAAGA,IAAM;IACbE,qBAAqB,EAAGA,qBAAuB;IAC/CD,IAAI,EAAGA;EAAM,GAEX2B,KACK,CAAC;AAEX"}
1
+ {"version":3,"names":["useSelect","useDispatch","Button","__","_n","sprintf","store","coreStore","displayShortcut","privateApis","routerPrivateApis","useEntitiesSavedStatesIsDirty","editorStore","editSiteStore","currentlyPreviewingTheme","isPreviewingTheme","unlock","useLocation","SaveButton","className","variant","showTooltip","showReviewMessage","icon","size","__next40pxDefaultSize","params","setIsSaveViewOpened","saveDirtyEntities","dirtyEntityRecords","isSaving","isSaveViewOpen","previewingThemeName","select","isSavingEntityRecord","isResolving","isSaveViewOpened","isActivatingTheme","currentlyPreviewingThemeId","some","record","kind","name","key","getTheme","rendered","undefined","hasDirtyEntities","length","isOnlyCurrentEntityDirty","postId","postType","path","includes","disabled","getLabel","label","onClick","createElement","isBusy","shortcut","primary"],"sources":["@wordpress/edit-site/src/components/save-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport {\n\tuseEntitiesSavedStatesIsDirty,\n\tstore as editorStore,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport {\n\tcurrentlyPreviewingTheme,\n\tisPreviewingTheme,\n} from '../../utils/is-previewing-theme';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function SaveButton( {\n\tclassName = 'edit-site-save-button__button',\n\tvariant = 'primary',\n\tshowTooltip = true,\n\tshowReviewMessage,\n\ticon,\n\tsize,\n\t__next40pxDefaultSize = false,\n} ) {\n\tconst { params } = useLocation();\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\tconst { saveDirtyEntities } = unlock( useDispatch( editorStore ) );\n\tconst { dirtyEntityRecords } = useEntitiesSavedStatesIsDirty();\n\tconst { isSaving, isSaveViewOpen, previewingThemeName } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isSavingEntityRecord, isResolving } = select( coreStore );\n\t\t\tconst { isSaveViewOpened } = select( editSiteStore );\n\t\t\tconst isActivatingTheme = isResolving( 'activateTheme' );\n\t\t\tconst currentlyPreviewingThemeId = currentlyPreviewingTheme();\n\t\t\treturn {\n\t\t\t\tisSaving:\n\t\t\t\t\tdirtyEntityRecords.some( ( record ) =>\n\t\t\t\t\t\tisSavingEntityRecord(\n\t\t\t\t\t\t\trecord.kind,\n\t\t\t\t\t\t\trecord.name,\n\t\t\t\t\t\t\trecord.key\n\t\t\t\t\t\t)\n\t\t\t\t\t) || isActivatingTheme,\n\t\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\t\t// Do not call `getTheme` with null, it will cause a request to\n\t\t\t\t// the server.\n\t\t\t\tpreviewingThemeName: currentlyPreviewingThemeId\n\t\t\t\t\t? select( coreStore ).getTheme( currentlyPreviewingThemeId )\n\t\t\t\t\t\t\t?.name?.rendered\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t},\n\t\t[ dirtyEntityRecords ]\n\t);\n\tconst hasDirtyEntities = !! dirtyEntityRecords.length;\n\tlet isOnlyCurrentEntityDirty;\n\t// Check if the current entity is the only entity with changes.\n\t// We have some extra logic for `wp_global_styles` for now, that\n\t// is used in navigation sidebar.\n\tif ( dirtyEntityRecords.length === 1 ) {\n\t\tif ( params.postId ) {\n\t\t\tisOnlyCurrentEntityDirty =\n\t\t\t\t`${ dirtyEntityRecords[ 0 ].key }` === params.postId &&\n\t\t\t\tdirtyEntityRecords[ 0 ].name === params.postType;\n\t\t} else if ( params.path?.includes( 'wp_global_styles' ) ) {\n\t\t\tisOnlyCurrentEntityDirty =\n\t\t\t\tdirtyEntityRecords[ 0 ].name === 'globalStyles';\n\t\t}\n\t}\n\tconst disabled =\n\t\tisSaving || ( ! hasDirtyEntities && ! isPreviewingTheme() );\n\tconst getLabel = () => {\n\t\tif ( isPreviewingTheme() ) {\n\t\t\tif ( isSaving ) {\n\t\t\t\treturn sprintf(\n\t\t\t\t\t/* translators: %s: The name of theme to be activated. */\n\t\t\t\t\t__( 'Activating %s' ),\n\t\t\t\t\tpreviewingThemeName\n\t\t\t\t);\n\t\t\t} else if ( disabled ) {\n\t\t\t\treturn __( 'Saved' );\n\t\t\t} else if ( hasDirtyEntities ) {\n\t\t\t\treturn sprintf(\n\t\t\t\t\t/* translators: %s: The name of theme to be activated. */\n\t\t\t\t\t__( 'Activate %s & Save' ),\n\t\t\t\t\tpreviewingThemeName\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn sprintf(\n\t\t\t\t/* translators: %s: The name of theme to be activated. */\n\t\t\t\t__( 'Activate %s' ),\n\t\t\t\tpreviewingThemeName\n\t\t\t);\n\t\t}\n\t\tif ( isSaving ) {\n\t\t\treturn __( 'Saving' );\n\t\t}\n\t\tif ( disabled ) {\n\t\t\treturn __( 'Saved' );\n\t\t}\n\t\tif ( ! isOnlyCurrentEntityDirty && showReviewMessage ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %d: number of unsaved changes (number).\n\t\t\t\t_n(\n\t\t\t\t\t'Review %d change…',\n\t\t\t\t\t'Review %d changes…',\n\t\t\t\t\tdirtyEntityRecords.length\n\t\t\t\t),\n\t\t\t\tdirtyEntityRecords.length\n\t\t\t);\n\t\t}\n\t\treturn __( 'Save' );\n\t};\n\tconst label = getLabel();\n\tconst onClick = isOnlyCurrentEntityDirty\n\t\t? () => saveDirtyEntities( { dirtyEntityRecords } )\n\t\t: () => setIsSaveViewOpened( true );\n\treturn (\n\t\t<Button\n\t\t\tvariant={ variant }\n\t\t\tclassName={ className }\n\t\t\taria-disabled={ disabled }\n\t\t\taria-expanded={ isSaveViewOpen }\n\t\t\tisBusy={ isSaving }\n\t\t\tonClick={ disabled ? undefined : onClick }\n\t\t\tlabel={ label }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ disabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\t/*\n\t\t\t * Displaying the keyboard shortcut conditionally makes the tooltip\n\t\t\t * itself show conditionally. This would trigger a full-rerendering\n\t\t\t * of the button that we want to avoid. By setting `showTooltip`,\n\t\t\t * the tooltip is always rendered even when there's no keyboard shortcut.\n\t\t\t */\n\t\t\tshowTooltip={ showTooltip }\n\t\t\ticon={ icon }\n\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\tsize={ size }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,WAAW,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EAAM,GAEXgC,KACK,CAAC;AAEX"}
@@ -2,46 +2,19 @@ import { createElement } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
5
- import { useSelect, useDispatch } from '@wordpress/data';
6
- import { Button, __experimentalHStack as HStack } from '@wordpress/components';
7
- import { __, sprintf, _n } from '@wordpress/i18n';
5
+ import { useSelect } from '@wordpress/data';
6
+ import { __experimentalHStack as HStack } from '@wordpress/components';
8
7
  import { store as coreStore } from '@wordpress/core-data';
9
- import { store as blockEditorStore } from '@wordpress/block-editor';
10
8
  import { check } from '@wordpress/icons';
11
- import { privateApis as routerPrivateApis } from '@wordpress/router';
12
- import { store as noticesStore } from '@wordpress/notices';
13
9
 
14
10
  /**
15
11
  * Internal dependencies
16
12
  */
17
13
  import SaveButton from '../save-button';
18
14
  import { isPreviewingTheme } from '../../utils/is-previewing-theme';
19
- import { unlock } from '../../lock-unlock';
20
- import { NAVIGATION_POST_TYPE } from '../../utils/constants';
21
- const {
22
- useLocation
23
- } = unlock(routerPrivateApis);
24
- const PUBLISH_ON_SAVE_ENTITIES = [{
25
- kind: 'postType',
26
- name: NAVIGATION_POST_TYPE
27
- }];
28
15
  export default function SaveHub() {
29
- const saveNoticeId = 'site-edit-save-notice';
30
16
  const {
31
- params
32
- } = useLocation();
33
- const {
34
- __unstableMarkLastChangeAsPersistent
35
- } = useDispatch(blockEditorStore);
36
- const {
37
- createSuccessNotice,
38
- createErrorNotice,
39
- removeNotice
40
- } = useDispatch(noticesStore);
41
- const {
42
- dirtyCurrentEntity,
43
- countUnsavedChanges,
44
- isDirty,
17
+ isDisabled,
45
18
  isSaving
46
19
  } = useSelect(select => {
47
20
  const {
@@ -49,99 +22,22 @@ export default function SaveHub() {
49
22
  isSavingEntityRecord
50
23
  } = select(coreStore);
51
24
  const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
52
- let calcDirtyCurrentEntity = null;
53
- if (dirtyEntityRecords.length === 1) {
54
- // if we are on global styles
55
- if (params.path?.includes('wp_global_styles')) {
56
- calcDirtyCurrentEntity = dirtyEntityRecords.find(record => record.name === 'globalStyles');
57
- }
58
- // if we are on pages
59
- else if (params.postId) {
60
- calcDirtyCurrentEntity = dirtyEntityRecords.find(record => record.name === params.postType && String(record.key) === params.postId);
61
- }
62
- }
63
- return {
64
- dirtyCurrentEntity: calcDirtyCurrentEntity,
65
- isDirty: dirtyEntityRecords.length > 0,
66
- isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)),
67
- countUnsavedChanges: dirtyEntityRecords.length
68
- };
69
- }, [params.path, params.postType, params.postId]);
70
- const {
71
- editEntityRecord,
72
- saveEditedEntityRecord,
73
- __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
74
- } = useDispatch(coreStore);
75
- const disabled = isSaving || !isDirty && !isPreviewingTheme();
76
-
77
- // if we have only one unsaved change and it matches current context, we can show a more specific label
78
- let label = dirtyCurrentEntity ? __('Save') : sprintf(
79
- // translators: %d: number of unsaved changes (number).
80
- _n('Review %d change…', 'Review %d changes…', countUnsavedChanges), countUnsavedChanges);
81
- if (isSaving) {
82
- label = __('Saving');
83
- }
84
- const {
85
- homeUrl
86
- } = useSelect(select => {
87
- const {
88
- getUnstableBase // Site index.
89
- } = select(coreStore);
25
+ const _isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key));
90
26
  return {
91
- homeUrl: getUnstableBase()?.home
27
+ isSaving: _isSaving,
28
+ isDisabled: _isSaving || !dirtyEntityRecords.length && !isPreviewingTheme()
92
29
  };
93
30
  }, []);
94
- const saveCurrentEntity = async () => {
95
- if (!dirtyCurrentEntity) return;
96
- removeNotice(saveNoticeId);
97
- const {
98
- kind,
99
- name,
100
- key,
101
- property
102
- } = dirtyCurrentEntity;
103
- try {
104
- if ('root' === dirtyCurrentEntity.kind && 'site' === name) {
105
- await saveSpecifiedEntityEdits('root', 'site', undefined, [property]);
106
- } else {
107
- if (PUBLISH_ON_SAVE_ENTITIES.some(typeToPublish => typeToPublish.kind === kind && typeToPublish.name === name)) {
108
- editEntityRecord(kind, name, key, {
109
- status: 'publish'
110
- });
111
- }
112
- await saveEditedEntityRecord(kind, name, key);
113
- }
114
- __unstableMarkLastChangeAsPersistent();
115
- createSuccessNotice(__('Site updated.'), {
116
- type: 'snackbar',
117
- actions: [{
118
- label: __('View site'),
119
- url: homeUrl
120
- }],
121
- id: saveNoticeId
122
- });
123
- } catch (error) {
124
- createErrorNotice(`${__('Saving failed.')} ${error}`);
125
- }
126
- };
127
31
  return createElement(HStack, {
128
32
  className: "edit-site-save-hub",
129
33
  alignment: "right",
130
34
  spacing: 4
131
- }, dirtyCurrentEntity ? createElement(Button, {
132
- variant: "primary",
133
- onClick: saveCurrentEntity,
134
- isBusy: isSaving,
135
- disabled: isSaving,
136
- "aria-disabled": isSaving,
137
- className: "edit-site-save-hub__button",
138
- __next40pxDefaultSize: true
139
- }, label) : createElement(SaveButton, {
35
+ }, createElement(SaveButton, {
140
36
  className: "edit-site-save-hub__button",
141
- variant: disabled ? null : 'primary',
37
+ variant: isDisabled ? null : 'primary',
142
38
  showTooltip: false,
143
- icon: disabled && !isSaving ? check : null,
144
- defaultLabel: label,
39
+ icon: isDisabled && !isSaving ? check : null,
40
+ showReviewMessage: true,
145
41
  __next40pxDefaultSize: true
146
42
  }));
147
43
  }
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","Button","__experimentalHStack","HStack","__","sprintf","_n","store","coreStore","blockEditorStore","check","privateApis","routerPrivateApis","noticesStore","SaveButton","isPreviewingTheme","unlock","NAVIGATION_POST_TYPE","useLocation","PUBLISH_ON_SAVE_ENTITIES","kind","name","SaveHub","saveNoticeId","params","__unstableMarkLastChangeAsPersistent","createSuccessNotice","createErrorNotice","removeNotice","dirtyCurrentEntity","countUnsavedChanges","isDirty","isSaving","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","dirtyEntityRecords","calcDirtyCurrentEntity","length","path","includes","find","record","postId","postType","String","key","some","editEntityRecord","saveEditedEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","disabled","label","homeUrl","getUnstableBase","home","saveCurrentEntity","property","undefined","typeToPublish","status","type","actions","url","id","error","createElement","className","alignment","spacing","variant","onClick","isBusy","__next40pxDefaultSize","showTooltip","icon","defaultLabel"],"sources":["@wordpress/edit-site/src/components/save-hub/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, __experimentalHStack as HStack } from '@wordpress/components';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { check } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport { unlock } from '../../lock-unlock';\nimport { NAVIGATION_POST_TYPE } from '../../utils/constants';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst PUBLISH_ON_SAVE_ENTITIES = [\n\t{\n\t\tkind: 'postType',\n\t\tname: NAVIGATION_POST_TYPE,\n\t},\n];\n\nexport default function SaveHub() {\n\tconst saveNoticeId = 'site-edit-save-notice';\n\tconst { params } = useLocation();\n\n\tconst { __unstableMarkLastChangeAsPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst { createSuccessNotice, createErrorNotice, removeNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst { dirtyCurrentEntity, countUnsavedChanges, isDirty, isSaving } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\t\t\tisSavingEntityRecord,\n\t\t\t\t} = select( coreStore );\n\t\t\t\tconst dirtyEntityRecords =\n\t\t\t\t\t__experimentalGetDirtyEntityRecords();\n\t\t\t\tlet calcDirtyCurrentEntity = null;\n\n\t\t\t\tif ( dirtyEntityRecords.length === 1 ) {\n\t\t\t\t\t// if we are on global styles\n\t\t\t\t\tif ( params.path?.includes( 'wp_global_styles' ) ) {\n\t\t\t\t\t\tcalcDirtyCurrentEntity = dirtyEntityRecords.find(\n\t\t\t\t\t\t\t( record ) => record.name === 'globalStyles'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\t// if we are on pages\n\t\t\t\t\telse if ( params.postId ) {\n\t\t\t\t\t\tcalcDirtyCurrentEntity = dirtyEntityRecords.find(\n\t\t\t\t\t\t\t( record ) =>\n\t\t\t\t\t\t\t\trecord.name === params.postType &&\n\t\t\t\t\t\t\t\tString( record.key ) === params.postId\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tdirtyCurrentEntity: calcDirtyCurrentEntity,\n\t\t\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\t\t\tisSaving: dirtyEntityRecords.some( ( record ) =>\n\t\t\t\t\t\tisSavingEntityRecord(\n\t\t\t\t\t\t\trecord.kind,\n\t\t\t\t\t\t\trecord.name,\n\t\t\t\t\t\t\trecord.key\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\tcountUnsavedChanges: dirtyEntityRecords.length,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ params.path, params.postType, params.postId ]\n\t\t);\n\n\tconst {\n\t\teditEntityRecord,\n\t\tsaveEditedEntityRecord,\n\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t} = useDispatch( coreStore );\n\n\tconst disabled = isSaving || ( ! isDirty && ! isPreviewingTheme() );\n\n\t// if we have only one unsaved change and it matches current context, we can show a more specific label\n\tlet label = dirtyCurrentEntity\n\t\t? __( 'Save' )\n\t\t: sprintf(\n\t\t\t\t// translators: %d: number of unsaved changes (number).\n\t\t\t\t_n(\n\t\t\t\t\t'Review %d change…',\n\t\t\t\t\t'Review %d changes…',\n\t\t\t\t\tcountUnsavedChanges\n\t\t\t\t),\n\t\t\t\tcountUnsavedChanges\n\t\t );\n\n\tif ( isSaving ) {\n\t\tlabel = __( 'Saving' );\n\t}\n\n\tconst { homeUrl } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetUnstableBase, // Site index.\n\t\t} = select( coreStore );\n\t\treturn {\n\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t};\n\t}, [] );\n\n\tconst saveCurrentEntity = async () => {\n\t\tif ( ! dirtyCurrentEntity ) return;\n\n\t\tremoveNotice( saveNoticeId );\n\t\tconst { kind, name, key, property } = dirtyCurrentEntity;\n\n\t\ttry {\n\t\t\tif ( 'root' === dirtyCurrentEntity.kind && 'site' === name ) {\n\t\t\t\tawait saveSpecifiedEntityEdits( 'root', 'site', undefined, [\n\t\t\t\t\tproperty,\n\t\t\t\t] );\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tPUBLISH_ON_SAVE_ENTITIES.some(\n\t\t\t\t\t\t( typeToPublish ) =>\n\t\t\t\t\t\t\ttypeToPublish.kind === kind &&\n\t\t\t\t\t\t\ttypeToPublish.name === name\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\teditEntityRecord( kind, name, key, { status: 'publish' } );\n\t\t\t\t}\n\n\t\t\t\tawait saveEditedEntityRecord( kind, name, key );\n\t\t\t}\n\n\t\t\t__unstableMarkLastChangeAsPersistent();\n\n\t\t\tcreateSuccessNotice( __( 'Site updated.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'View site' ),\n\t\t\t\t\t\turl: homeUrl,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tid: saveNoticeId,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice( `${ __( 'Saving failed.' ) } ${ error }` );\n\t\t}\n\t};\n\n\treturn (\n\t\t<HStack className=\"edit-site-save-hub\" alignment=\"right\" spacing={ 4 }>\n\t\t\t{ dirtyCurrentEntity ? (\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tonClick={ saveCurrentEntity }\n\t\t\t\t\tisBusy={ isSaving }\n\t\t\t\t\tdisabled={ isSaving }\n\t\t\t\t\taria-disabled={ isSaving }\n\t\t\t\t\tclassName=\"edit-site-save-hub__button\"\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t>\n\t\t\t\t\t{ label }\n\t\t\t\t</Button>\n\t\t\t) : (\n\t\t\t\t<SaveButton\n\t\t\t\t\tclassName=\"edit-site-save-hub__button\"\n\t\t\t\t\tvariant={ disabled ? null : 'primary' }\n\t\t\t\t\tshowTooltip={ false }\n\t\t\t\t\ticon={ disabled && ! isSaving ? check : null }\n\t\t\t\t\tdefaultLabel={ label }\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t/>\n\t\t\t) }\n\t\t</HStack>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,MAAM,EAAEC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AAC9E,SAASC,EAAE,EAAEC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AACjD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASL,KAAK,IAAIM,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,OAAOC,UAAU,MAAM,gBAAgB;AACvC,SAASC,iBAAiB,QAAQ,iCAAiC;AACnE,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,oBAAoB,QAAQ,uBAAuB;AAE5D,MAAM;EAAEC;AAAY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,EAAGpB,QAAU;IACrB,iBAAgBA,QAAU;IAC1BoC,SAAS,EAAC,4BAA4B;IACtCM,qBAAqB;EAAA,GAEnBrB,KACK,CAAC,GAETc,aAAA,CAACrD,UAAU;IACVsD,SAAS,EAAC,4BAA4B;IACtCG,OAAO,EAAGnB,QAAQ,GAAG,IAAI,GAAG,SAAW;IACvCuB,WAAW,EAAG,KAAO;IACrBC,IAAI,EAAGxB,QAAQ,IAAI,CAAEpB,QAAQ,GAAGtB,KAAK,GAAG,IAAM;IAC9CmE,YAAY,EAAGxB,KAAO;IACtBqB,qBAAqB;EAAA,CACrB,CAEK,CAAC;AAEX"}
1
+ {"version":3,"names":["useSelect","__experimentalHStack","HStack","store","coreStore","check","SaveButton","isPreviewingTheme","SaveHub","isDisabled","isSaving","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","dirtyEntityRecords","_isSaving","some","record","kind","name","key","length","createElement","className","alignment","spacing","variant","showTooltip","icon","showReviewMessage","__next40pxDefaultSize"],"sources":["@wordpress/edit-site/src/components/save-hub/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __experimentalHStack as HStack } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\n\nexport default function SaveHub() {\n\tconst { isDisabled, isSaving } = useSelect( ( select ) => {\n\t\tconst { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } =\n\t\t\tselect( coreStore );\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\tconst _isSaving = dirtyEntityRecords.some( ( record ) =>\n\t\t\tisSavingEntityRecord( record.kind, record.name, record.key )\n\t\t);\n\t\treturn {\n\t\t\tisSaving: _isSaving,\n\t\t\tisDisabled:\n\t\t\t\t_isSaving ||\n\t\t\t\t( ! dirtyEntityRecords.length && ! isPreviewingTheme() ),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<HStack className=\"edit-site-save-hub\" alignment=\"right\" spacing={ 4 }>\n\t\t\t<SaveButton\n\t\t\t\tclassName=\"edit-site-save-hub__button\"\n\t\t\t\tvariant={ isDisabled ? null : 'primary' }\n\t\t\t\tshowTooltip={ false }\n\t\t\t\ticon={ isDisabled && ! isSaving ? check : null }\n\t\t\t\tshowReviewMessage\n\t\t\t\t__next40pxDefaultSize\n\t\t\t/>\n\t\t</HStack>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,KAAK,QAAQ,kBAAkB;;AAExC;AACA;AACA;AACA,OAAOC,UAAU,MAAM,gBAAgB;AACvC,SAASC,iBAAiB,QAAQ,iCAAiC;AAEnE,eAAe,SAASC,OAAOA,CAAA,EAAG;EACjC,MAAM;IAAEC,UAAU;IAAEC;EAAS,CAAC,GAAGV,SAAS,CAAIW,MAAM,IAAM;IACzD,MAAM;MAAEC,mCAAmC;MAAEC;IAAqB,CAAC,GAClEF,MAAM,CAAEP,SAAU,CAAC;IACpB,MAAMU,kBAAkB,GAAGF,mCAAmC,CAAC,CAAC;IAChE,MAAMG,SAAS,GAAGD,kBAAkB,CAACE,IAAI,CAAIC,MAAM,IAClDJ,oBAAoB,CAAEI,MAAM,CAACC,IAAI,EAAED,MAAM,CAACE,IAAI,EAAEF,MAAM,CAACG,GAAI,CAC5D,CAAC;IACD,OAAO;MACNV,QAAQ,EAAEK,SAAS;MACnBN,UAAU,EACTM,SAAS,IACP,CAAED,kBAAkB,CAACO,MAAM,IAAI,CAAEd,iBAAiB,CAAC;IACvD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,OACCe,aAAA,CAACpB,MAAM;IAACqB,SAAS,EAAC,oBAAoB;IAACC,SAAS,EAAC,OAAO;IAACC,OAAO,EAAG;EAAG,GACrEH,aAAA,CAAChB,UAAU;IACViB,SAAS,EAAC,4BAA4B;IACtCG,OAAO,EAAGjB,UAAU,GAAG,IAAI,GAAG,SAAW;IACzCkB,WAAW,EAAG,KAAO;IACrBC,IAAI,EAAGnB,UAAU,IAAI,CAAEC,QAAQ,GAAGL,KAAK,GAAG,IAAM;IAChDwB,iBAAiB;IACjBC,qBAAqB;EAAA,CACrB,CACM,CAAC;AAEX"}
@@ -27,7 +27,6 @@ import SidebarNavigationScreenGlobalStyles from '../sidebar-navigation-screen-gl
27
27
  import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
28
28
  import SaveHub from '../save-hub';
29
29
  import { unlock } from '../../lock-unlock';
30
- import SidebarNavigationScreenPages from '../sidebar-navigation-screen-pages';
31
30
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
32
31
  import DataViewsSidebarContent from '../sidebar-dataviews';
33
32
  import SidebarNavigationScreenPage from '../sidebar-navigation-screen-page';
@@ -56,12 +55,9 @@ function SidebarScreens() {
56
55
  path: "/wp_global_styles"
57
56
  }, createElement(SidebarNavigationScreenGlobalStyles, null)), createElement(SidebarScreenWrapper, {
58
57
  path: "/page"
59
- }, createElement(SidebarNavigationScreenPages, null)), createElement(SidebarScreenWrapper, {
60
- path: "/pages"
61
58
  }, createElement(SidebarNavigationScreen, {
62
59
  title: __('Manage pages'),
63
- content: createElement(DataViewsSidebarContent, null),
64
- backPath: "/page"
60
+ content: createElement(DataViewsSidebarContent, null)
65
61
  })), createElement(SidebarScreenWrapper, {
66
62
  path: "/page/:postId"
67
63
  }, createElement(SidebarNavigationScreenPage, null)), createElement(SidebarScreenWrapper, {
@@ -1 +1 @@
1
- {"version":3,"names":["classNames","memo","useRef","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","privateApis","routerPrivateApis","useViewportMatch","__","SidebarNavigationScreenMain","SidebarNavigationScreenTemplate","SidebarNavigationScreenPatterns","SidebarNavigationScreenPattern","useSyncPathWithURL","getPathFromURL","SidebarNavigationScreenNavigationMenus","SidebarNavigationScreenNavigationMenu","SidebarNavigationScreenGlobalStyles","SidebarNavigationScreenTemplatesBrowse","SaveHub","unlock","SidebarNavigationScreenPages","SidebarNavigationScreen","DataViewsSidebarContent","SidebarNavigationScreenPage","useLocation","SidebarScreenWrapper","className","props","createElement","SidebarScreens","isMobileViewport","Fragment","path","title","content","backPath","Sidebar","params","urlParams","initialPath","current"],"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { memo, useRef } from '@wordpress/element';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';\nimport SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';\nimport SidebarNavigationScreenPattern from '../sidebar-navigation-screen-pattern';\nimport useSyncPathWithURL, {\n\tgetPathFromURL,\n} from '../sync-state-with-url/use-sync-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SidebarNavigationScreenNavigationMenu from '../sidebar-navigation-screen-navigation-menu';\nimport SidebarNavigationScreenGlobalStyles from '../sidebar-navigation-screen-global-styles';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SaveHub from '../save-hub';\nimport { unlock } from '../../lock-unlock';\nimport SidebarNavigationScreenPages from '../sidebar-navigation-screen-pages';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\nimport SidebarNavigationScreenPage from '../sidebar-navigation-screen-page';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction SidebarScreenWrapper( { className, ...props } ) {\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName={ classNames(\n\t\t\t\t'edit-site-sidebar__screen-wrapper',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction SidebarScreens() {\n\tuseSyncPathWithURL();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarScreenWrapper path=\"/\">\n\t\t\t\t<SidebarNavigationScreenMain />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/navigation\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/navigation/:postType/:postId\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenu />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/wp_global_styles\">\n\t\t\t\t<SidebarNavigationScreenGlobalStyles />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/page\">\n\t\t\t\t<SidebarNavigationScreenPages />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/pages\">\n\t\t\t\t<SidebarNavigationScreen\n\t\t\t\t\ttitle={ __( 'Manage pages' ) }\n\t\t\t\t\tcontent={ <DataViewsSidebarContent /> }\n\t\t\t\t\tbackPath=\"/page\"\n\t\t\t\t/>\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/page/:postId\">\n\t\t\t\t<SidebarNavigationScreenPage />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template)\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t{ ! isMobileViewport && (\n\t\t\t\t<SidebarScreenWrapper path=\"/patterns\">\n\t\t\t\t\t<SidebarNavigationScreenPatterns />\n\t\t\t\t</SidebarScreenWrapper>\n\t\t\t) }\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template_part)/all\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template_part|wp_block)/:postId\">\n\t\t\t\t<SidebarNavigationScreenPattern />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template)/:postId\">\n\t\t\t\t<SidebarNavigationScreenTemplate />\n\t\t\t</SidebarScreenWrapper>\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { params: urlParams } = useLocation();\n\tconst initialPath = useRef( getPathFromURL( urlParams ) );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath={ initialPath.current }\n\t\t\t>\n\t\t\t\t<SidebarScreens />\n\t\t\t</NavigatorProvider>\n\t\t\t<SaveHub />\n\t\t</>\n\t);\n}\n\nexport default memo( Sidebar );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,IAAI,EAAEC,MAAM,QAAQ,oBAAoB;AACjD,SACCC,+BAA+B,IAAIC,iBAAiB,EACpDC,6BAA6B,IAAIC,eAAe,QAC1C,uBAAuB;AAC9B,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,2BAA2B,MAAM,mCAAmC;AAC3E,OAAOC,+BAA+B,MAAM,uCAAu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ACCV,aAAA,CAAAG,QAAA,QACCH,aAAA,CAAC3B,iBAAiB;IACjByB,SAAS,EAAC,4BAA4B;IACtCa,WAAW,EAAGA,WAAW,CAACC;EAAS,GAEnCZ,aAAA,CAACC,cAAc,MAAE,CACC,CAAC,EACpBD,aAAA,CAACV,OAAO,MAAE,CACT,CAAC;AAEL;AAEA,eAAepB,IAAI,CAAEsC,OAAQ,CAAC"}
1
+ {"version":3,"names":["classNames","memo","useRef","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","privateApis","routerPrivateApis","useViewportMatch","__","SidebarNavigationScreenMain","SidebarNavigationScreenTemplate","SidebarNavigationScreenPatterns","SidebarNavigationScreenPattern","useSyncPathWithURL","getPathFromURL","SidebarNavigationScreenNavigationMenus","SidebarNavigationScreenNavigationMenu","SidebarNavigationScreenGlobalStyles","SidebarNavigationScreenTemplatesBrowse","SaveHub","unlock","SidebarNavigationScreen","DataViewsSidebarContent","SidebarNavigationScreenPage","useLocation","SidebarScreenWrapper","className","props","createElement","SidebarScreens","isMobileViewport","Fragment","path","title","content","Sidebar","params","urlParams","initialPath","current"],"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { memo, useRef } from '@wordpress/element';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';\nimport SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';\nimport SidebarNavigationScreenPattern from '../sidebar-navigation-screen-pattern';\nimport useSyncPathWithURL, {\n\tgetPathFromURL,\n} from '../sync-state-with-url/use-sync-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SidebarNavigationScreenNavigationMenu from '../sidebar-navigation-screen-navigation-menu';\nimport SidebarNavigationScreenGlobalStyles from '../sidebar-navigation-screen-global-styles';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SaveHub from '../save-hub';\nimport { unlock } from '../../lock-unlock';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\nimport SidebarNavigationScreenPage from '../sidebar-navigation-screen-page';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction SidebarScreenWrapper( { className, ...props } ) {\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName={ classNames(\n\t\t\t\t'edit-site-sidebar__screen-wrapper',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction SidebarScreens() {\n\tuseSyncPathWithURL();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarScreenWrapper path=\"/\">\n\t\t\t\t<SidebarNavigationScreenMain />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/navigation\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/navigation/:postType/:postId\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenu />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/wp_global_styles\">\n\t\t\t\t<SidebarNavigationScreenGlobalStyles />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/page\">\n\t\t\t\t<SidebarNavigationScreen\n\t\t\t\t\ttitle={ __( 'Manage pages' ) }\n\t\t\t\t\tcontent={ <DataViewsSidebarContent /> }\n\t\t\t\t/>\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/page/:postId\">\n\t\t\t\t<SidebarNavigationScreenPage />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template)\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t{ ! isMobileViewport && (\n\t\t\t\t<SidebarScreenWrapper path=\"/patterns\">\n\t\t\t\t\t<SidebarNavigationScreenPatterns />\n\t\t\t\t</SidebarScreenWrapper>\n\t\t\t) }\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template_part)/all\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template_part|wp_block)/:postId\">\n\t\t\t\t<SidebarNavigationScreenPattern />\n\t\t\t</SidebarScreenWrapper>\n\t\t\t<SidebarScreenWrapper path=\"/:postType(wp_template)/:postId\">\n\t\t\t\t<SidebarNavigationScreenTemplate />\n\t\t\t</SidebarScreenWrapper>\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { params: urlParams } = useLocation();\n\tconst initialPath = useRef( getPathFromURL( urlParams ) );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath={ initialPath.current }\n\t\t\t>\n\t\t\t\t<SidebarScreens />\n\t\t\t</NavigatorProvider>\n\t\t\t<SaveHub />\n\t\t</>\n\t);\n}\n\nexport default memo( Sidebar );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,IAAI,EAAEC,MAAM,QAAQ,oBAAoB;AACjD,SACCC,+BAA+B,IAAIC,iBAAiB,EACpDC,6BAA6B,IAAIC,eAAe,QAC1C,uBA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,CAAEc,cAAc,CAAEuB,SAAU,CAAE,CAAC;EAEzD,OACCT,aAAA,CAAAG,QAAA,QACCH,aAAA,CAAC1B,iBAAiB;IACjBwB,SAAS,EAAC,4BAA4B;IACtCY,WAAW,EAAGA,WAAW,CAACC;EAAS,GAEnCX,aAAA,CAACC,cAAc,MAAE,CACC,CAAC,EACpBD,aAAA,CAACT,OAAO,MAAE,CACT,CAAC;AAEL;AAEA,eAAepB,IAAI,CAAEoC,OAAQ,CAAC"}
@@ -22,7 +22,7 @@ export const DEFAULT_CONFIG_PER_VIEW_TYPE = {
22
22
  }
23
23
  };
24
24
  const DEFAULT_PAGE_BASE = {
25
- type: LAYOUT_TABLE,
25
+ type: LAYOUT_LIST,
26
26
  search: '',
27
27
  filters: [],
28
28
  page: 1,
@@ -1 +1 @@
1
- {"version":3,"names":["__","trash","pages","drafts","LAYOUT_LIST","LAYOUT_TABLE","LAYOUT_GRID","OPERATOR_IS_ANY","DEFAULT_CONFIG_PER_VIEW_TYPE","primaryField","mediaField","DEFAULT_PAGE_BASE","type","search","filters","page","perPage","sort","field","direction","hiddenFields","layout","DEFAULT_VIEWS","title","slug","icon","view","operator","value"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/default-views.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { trash, pages, drafts } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLAYOUT_LIST,\n\tLAYOUT_TABLE,\n\tLAYOUT_GRID,\n\tOPERATOR_IS_ANY,\n} from '../../utils/constants';\n\nexport const DEFAULT_CONFIG_PER_VIEW_TYPE = {\n\t[ LAYOUT_TABLE ]: {\n\t\tprimaryField: 'title',\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tmediaField: 'featured-image',\n\t\tprimaryField: 'title',\n\t},\n\t[ LAYOUT_LIST ]: {\n\t\tprimaryField: 'title',\n\t\tmediaField: 'featured-image',\n\t},\n};\n\nconst DEFAULT_PAGE_BASE = {\n\ttype: LAYOUT_TABLE,\n\tsearch: '',\n\tfilters: [],\n\tpage: 1,\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'date',\n\t\tdirection: 'desc',\n\t},\n\t// All fields are visible by default, so it's\n\t// better to keep track of the hidden ones.\n\thiddenFields: [ 'date', 'featured-image' ],\n\tlayout: {\n\t\t...DEFAULT_CONFIG_PER_VIEW_TYPE[ LAYOUT_TABLE ],\n\t},\n};\n\nexport const DEFAULT_VIEWS = {\n\tpage: [\n\t\t{\n\t\t\ttitle: __( 'All pages' ),\n\t\t\tslug: 'all',\n\t\t\ticon: pages,\n\t\t\tview: DEFAULT_PAGE_BASE,\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Drafts' ),\n\t\t\tslug: 'drafts',\n\t\t\ticon: drafts,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'draft',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Trash' ),\n\t\t\tslug: 'trash',\n\t\t\ticon: trash,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'trash',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t],\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,EAAEC,KAAK,EAAEC,MAAM,QAAQ,kBAAkB;;AAEvD;AACA;AACA;AACA,SACCC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,QACT,uBAAuB;AAE9B,OAAO,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K,EAAE,QAAQ;QACfS,QAAQ,EAAEpB,eAAe;QACzBqB,KAAK,EAAE;MACR,CAAC;IAEH;EACD,CAAC;AAEH,CAAC"}
1
+ {"version":3,"names":["__","trash","pages","drafts","LAYOUT_LIST","LAYOUT_TABLE","LAYOUT_GRID","OPERATOR_IS_ANY","DEFAULT_CONFIG_PER_VIEW_TYPE","primaryField","mediaField","DEFAULT_PAGE_BASE","type","search","filters","page","perPage","sort","field","direction","hiddenFields","layout","DEFAULT_VIEWS","title","slug","icon","view","operator","value"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/default-views.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { trash, pages, drafts } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLAYOUT_LIST,\n\tLAYOUT_TABLE,\n\tLAYOUT_GRID,\n\tOPERATOR_IS_ANY,\n} from '../../utils/constants';\n\nexport const DEFAULT_CONFIG_PER_VIEW_TYPE = {\n\t[ LAYOUT_TABLE ]: {\n\t\tprimaryField: 'title',\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tmediaField: 'featured-image',\n\t\tprimaryField: 'title',\n\t},\n\t[ LAYOUT_LIST ]: {\n\t\tprimaryField: 'title',\n\t\tmediaField: 'featured-image',\n\t},\n};\n\nconst DEFAULT_PAGE_BASE = {\n\ttype: LAYOUT_LIST,\n\tsearch: '',\n\tfilters: [],\n\tpage: 1,\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'date',\n\t\tdirection: 'desc',\n\t},\n\t// All fields are visible by default, so it's\n\t// better to keep track of the hidden ones.\n\thiddenFields: [ 'date', 'featured-image' ],\n\tlayout: {\n\t\t...DEFAULT_CONFIG_PER_VIEW_TYPE[ LAYOUT_TABLE ],\n\t},\n};\n\nexport const DEFAULT_VIEWS = {\n\tpage: [\n\t\t{\n\t\t\ttitle: __( 'All pages' ),\n\t\t\tslug: 'all',\n\t\t\ticon: pages,\n\t\t\tview: DEFAULT_PAGE_BASE,\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Drafts' ),\n\t\t\tslug: 'drafts',\n\t\t\ticon: drafts,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'draft',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Trash' ),\n\t\t\tslug: 'trash',\n\t\t\ticon: trash,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'trash',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t],\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,EAAEC,KAAK,EAAEC,MAAM,QAAQ,kBAAkB;;AAEvD;AACA;AACA;AACA,SACCC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,QACT,uBAAuB;AAE9B,OAAO,MAAMC,4BAA4B,GAAG;EAC3C,CAAEH,YAAY,GAAI;IACjBI,YAAY,EAAE;EACf,CAAC;EACD,CAAEH,WAAW,GAAI;IAChBI,UAAU,EAAE,gBAAgB;IAC5BD,YAAY,EAAE;EACf,CAAC;EACD,CAAEL,WAAW,GAAI;IAChBK,YAAY,EAAE,OAAO;IACrBC,UAAU,EAAE;EACb;AACD,CAAC;AAED,MAAMC,iBAAiB,GAAG;EACzBC,IAAI,EAAER,WAAW;EACjBS,MAAM,EAAE,EAAE;EACVC,OAAO,EAAE,EAAE;EACXC,IAAI,EAAE,CAAC;EACPC,OAAO,EAAE,EAAE;EACXC,IAAI,EAAE;IACLC,KAAK,EAAE,MAAM;IACbC,SAAS,EAAE;EACZ,CAAC;EACD;EACA;EACAC,YAAY,EAAE,CAAE,MAAM,EAAE,gBAAgB,CAAE;EAC1CC,MAAM,EAAE;IACP,GAAGb,4BAA4B,CAAEH,YAAY;EAC9C;AACD,CAAC;AAED,OAAO,MAAMiB,aAAa,GAAG;EAC5BP,IAAI,EAAE,CACL;IACCQ,KAAK,EAAEvB,EAAE,CAAE,WAAY,CAAC;IACxBwB,IAAI,EAAE,KAAK;IACXC,IAAI,EAAEvB,KAAK;IACXwB,IAAI,EAAEf;EACP,CAAC,EACD;IACCY,KAAK,EAAEvB,EAAE,CAAE,QAAS,CAAC;IACrBwB,IAAI,EAAE,QAAQ;IACdC,IAAI,EAAEtB,MAAM;IACZuB,IAAI,EAAE;MACL,GAAGf,iBAAiB;MACpBG,OAAO,EAAE,CACR;QACCI,KAAK,EAAE,QAAQ;QACfS,QAAQ,EAAEpB,eAAe;QACzBqB,KAAK,EAAE;MACR,CAAC;IAEH;EACD,CAAC,EACD;IACCL,KAAK,EAAEvB,EAAE,CAAE,OAAQ,CAAC;IACpBwB,IAAI,EAAE,OAAO;IACbC,IAAI,EAAExB,KAAK;IACXyB,IAAI,EAAE;MACL,GAAGf,iBAAiB;MACpBG,OAAO,EAAE,CACR;QACCI,KAAK,EAAE,QAAQ;QACfS,QAAQ,EAAEpB,eAAe;QACzBqB,KAAK,EAAE;MACR,CAAC;IAEH;EACD,CAAC;AAEH,CAAC"}
@@ -16,7 +16,7 @@ const {
16
16
  import DataViewItem from './dataview-item';
17
17
  import CustomDataViewsList from './custom-dataviews-list';
18
18
  const PATH_TO_TYPE = {
19
- '/pages': 'page'
19
+ '/page': 'page'
20
20
  };
21
21
  export default function DataViewsSidebarContent() {
22
22
  const {
@@ -1 +1 @@
1
- {"version":3,"names":["__experimentalItemGroup","ItemGroup","privateApis","routerPrivateApis","DEFAULT_VIEWS","unlock","useLocation","DataViewItem","CustomDataViewsList","PATH_TO_TYPE","DataViewsSidebarContent","params","path","activeView","isCustom","isCustomBoolean","type","createElement","Fragment","map","dataview","key","slug","title","icon","view","isActive","window","__experimentalAdminViews"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\n\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n/**\n * Internal dependencies\n */\n\nimport { DEFAULT_VIEWS } from './default-views';\nimport { unlock } from '../../lock-unlock';\nconst { useLocation } = unlock( routerPrivateApis );\nimport DataViewItem from './dataview-item';\nimport CustomDataViewsList from './custom-dataviews-list';\n\nconst PATH_TO_TYPE = {\n\t'/pages': 'page',\n};\n\nexport default function DataViewsSidebarContent() {\n\tconst {\n\t\tparams: { path, activeView = 'all', isCustom = 'false' },\n\t} = useLocation();\n\tif ( ! path || ! PATH_TO_TYPE[ path ] ) {\n\t\treturn null;\n\t}\n\tconst isCustomBoolean = isCustom === 'true';\n\tconst type = PATH_TO_TYPE[ path ];\n\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup>\n\t\t\t\t{ DEFAULT_VIEWS[ type ].map( ( dataview ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<DataViewItem\n\t\t\t\t\t\t\tkey={ dataview.slug }\n\t\t\t\t\t\t\tslug={ dataview.slug }\n\t\t\t\t\t\t\ttitle={ dataview.title }\n\t\t\t\t\t\t\ticon={ dataview.icon }\n\t\t\t\t\t\t\ttype={ dataview.view.type }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\t! isCustomBoolean &&\n\t\t\t\t\t\t\t\tdataview.slug === activeView\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisCustom={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</ItemGroup>\n\t\t\t{ window?.__experimentalAdminViews && (\n\t\t\t\t<CustomDataViewsList\n\t\t\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AAM;MAC3BU,QAAQ,EACP,CAAEX,eAAe,IACjBK,QAAQ,CAACE,IAAI,KAAKT,UAClB;MACDC,QAAQ,EAAG;IAAO,CAClB,CAAC;EAEJ,CAAE,CACQ,CAAC,EACVa,MAAM,EAAEC,wBAAwB,IACjCX,aAAA,CAACT,mBAAmB;IACnBK,UAAU,EAAGA,UAAY;IACzBG,IAAI,EAAGA,IAAM;IACbF,QAAQ;EAAA,CACR,CAED,CAAC;AAEL"}
1
+ {"version":3,"names":["__experimentalItemGroup","ItemGroup","privateApis","routerPrivateApis","DEFAULT_VIEWS","unlock","useLocation","DataViewItem","CustomDataViewsList","PATH_TO_TYPE","DataViewsSidebarContent","params","path","activeView","isCustom","isCustomBoolean","type","createElement","Fragment","map","dataview","key","slug","title","icon","view","isActive","window","__experimentalAdminViews"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\n\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n/**\n * Internal dependencies\n */\n\nimport { DEFAULT_VIEWS } from './default-views';\nimport { unlock } from '../../lock-unlock';\nconst { useLocation } = unlock( routerPrivateApis );\nimport DataViewItem from './dataview-item';\nimport CustomDataViewsList from './custom-dataviews-list';\n\nconst PATH_TO_TYPE = {\n\t'/page': 'page',\n};\n\nexport default function DataViewsSidebarContent() {\n\tconst {\n\t\tparams: { path, activeView = 'all', isCustom = 'false' },\n\t} = useLocation();\n\tif ( ! path || ! PATH_TO_TYPE[ path ] ) {\n\t\treturn null;\n\t}\n\tconst isCustomBoolean = isCustom === 'true';\n\tconst type = PATH_TO_TYPE[ path ];\n\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup>\n\t\t\t\t{ DEFAULT_VIEWS[ type ].map( ( dataview ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<DataViewItem\n\t\t\t\t\t\t\tkey={ dataview.slug }\n\t\t\t\t\t\t\tslug={ dataview.slug }\n\t\t\t\t\t\t\ttitle={ dataview.title }\n\t\t\t\t\t\t\ticon={ dataview.icon }\n\t\t\t\t\t\t\ttype={ dataview.view.type }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\t! isCustomBoolean &&\n\t\t\t\t\t\t\t\tdataview.slug === activeView\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisCustom={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</ItemGroup>\n\t\t\t{ window?.__experimentalAdminViews && (\n\t\t\t\t<CustomDataViewsList\n\t\t\t\t\tactiveView={ activeView }\n\t\t\t\t\ttype={ type }\n\t\t\t\t\tisCustom\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,uBAAuB,IAAIC,SAAS,QAAQ,uBAAuB;AAE5E,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE;AACA;AACA;;AAEA,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,MAAM;EAAEC;AAAY,CAAC,GAAGD,MAAM,CAAEF,iBAAkB,CAAC;AACnD,OAAOI,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,mBAAmB,MAAM,yBAAyB;AAEzD,MAAMC,YAAY,GAAG;EACpB,OAAO,EAAE;AACV,CAAC;AAED,eAAe,SAASC,uBAAuBA,CAAA,EAAG;EACjD,MAAM;IACLC,MAAM,EAAE;MAAEC,IAAI;MAAEC,UAAU,GAAG,KAAK;MAAEC,QAAQ,GAAG;IAAQ;EACxD,CAAC,GAAGR,WAAW,CAAC,CAAC;EACjB,IAAK,CAAEM,IAAI,IAAI,CAAEH,YAAY,CAAEG,IAAI,CAAE,EAAG;IACvC,OAAO,IAAI;EACZ;EACA,MAAMG,eAAe,GAAGD,QAAQ,KAAK,MAAM;EAC3C,MAAME,IAAI,GAAGP,YAAY,CAAEG,IAAI,CAAE;EAEjC,OACCK,aAAA,CAAAC,QAAA,QACCD,aAAA,CAAChB,SAAS,QACPG,aAAa,CAAEY,IAAI,CAAE,CAACG,GAAG,CAAIC,QAAQ,IAAM;IAC5C,OACCH,aAAA,CAACV,YAAY;MACZc,GAAG,EAAGD,QAAQ,CAACE,IAAM;MACrBA,IAAI,EAAGF,QAAQ,CAACE,IAAM;MACtBC,KAAK,EAAGH,QAAQ,CAACG,KAAO;MACxBC,IAAI,EAAGJ,QAAQ,CAACI,IAAM;MACtBR,IAAI,EAAGI,QAAQ,CAACK,IAAI,CAACT,IAAM;MAC3BU,QAAQ,EACP,CAAEX,eAAe,IACjBK,QAAQ,CAACE,IAAI,KAAKT,UAClB;MACDC,QAAQ,EAAG;IAAO,CAClB,CAAC;EAEJ,CAAE,CACQ,CAAC,EACVa,MAAM,EAAEC,wBAAwB,IACjCX,aAAA,CAACT,mBAAmB;IACnBK,UAAU,EAAGA,UAAY;IACzBG,IAAI,EAAGA,IAAM;IACbF,QAAQ;EAAA,CACR,CAED,CAAC;AAEL"}
@@ -20,7 +20,6 @@ import { STORE_NAME } from '../../store/constants';
20
20
  import SettingsHeader from './settings-header';
21
21
  import PagePanels from './page-panels';
22
22
  import TemplatePanel from './template-panel';
23
- import PluginTemplateSettingPanel from '../plugin-template-setting-panel';
24
23
  import { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';
25
24
  import { store as editSiteStore } from '../../store';
26
25
  import { unlock } from '../../lock-unlock';
@@ -83,7 +82,7 @@ const FillContents = ({
83
82
  }, createElement(Tabs.TabPanel, {
84
83
  tabId: SIDEBAR_TEMPLATE,
85
84
  focusable: false
86
- }, isEditingPage ? createElement(PagePanels, null) : createElement(TemplatePanel, null), createElement(PluginTemplateSettingPanel.Slot, null)), createElement(Tabs.TabPanel, {
85
+ }, isEditingPage ? createElement(PagePanels, null) : createElement(TemplatePanel, null)), createElement(Tabs.TabPanel, {
87
86
  tabId: SIDEBAR_BLOCK,
88
87
  focusable: false
89
88
  }, createElement(InspectorSlot, {
@@ -1 +1 @@
1
- {"version":3,"names":["createSlotFill","privateApis","componentsPrivateApis","isRTL","__","drawerLeft","drawerRight","useCallback","useContext","useEffect","useRef","useSelect","useDispatch","store","interfaceStore","blockEditorStore","coreStore","DefaultSidebar","GlobalStylesSidebar","STORE_NAME","SettingsHeader","PagePanels","TemplatePanel","PluginTemplateSettingPanel","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","editSiteStore","unlock","Tabs","Slot","InspectorSlot","Fill","InspectorFill","SidebarInspectorFill","FillContents","sidebarName","isEditingPage","supportsGlobalStyles","tabListRef","tabsContextValue","Context","tabsElements","Array","from","current","querySelectorAll","selectedTabElement","find","element","getAttribute","activeElement","ownerDocument","tabsHasFocus","some","id","focus","createElement","Fragment","identifier","title","icon","closeLabel","header","Provider","value","ref","headerClassName","className","TabPanel","tabId","focusable","bubblesVirtually","SidebarComplementaryAreaFills","sidebar","isEditorSidebarOpened","hasBlockSelection","isEditorOpen","select","_sidebar","getActiveComplementaryArea","_isEditorSidebarOpened","includes","getCanvasMode","getBlockSelectionStart","getCurrentTheme","is_block_theme","isPage","enableComplementaryArea","onTabSelect","newSelectedTabId","selectedTabId","onSelect","selectOnMove"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateSlotFill,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { useCallback, useContext, useEffect, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport { STORE_NAME } from '../../store/constants';\nimport SettingsHeader from './settings-header';\nimport PagePanels from './page-panels';\nimport TemplatePanel from './template-panel';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nconst FillContents = ( {\n\tsidebarName,\n\tisEditingPage,\n\tsupportsGlobalStyles,\n} ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `DefaultSidebar` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way.\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === sidebarName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ sidebarName ] );\n\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ sidebarName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t\theader={\n\t\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t\t<SettingsHeader ref={ tabListRef } />\n\t\t\t\t\t</Tabs.Context.Provider>\n\t\t\t\t}\n\t\t\t\theaderClassName=\"edit-site-sidebar-edit-mode__panel-tabs\"\n\t\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t\t// margin to the panel.\n\t\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\t\tclassName=\"edit-site-sidebar__panel\"\n\t\t\t>\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\ttabId={ SIDEBAR_TEMPLATE }\n\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isEditingPage ? <PagePanels /> : <TemplatePanel /> }\n\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t<Tabs.TabPanel tabId={ SIDEBAR_BLOCK } focusable={ false }>\n\t\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t</DefaultSidebar>\n\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t</>\n\t);\n};\n\nexport function SidebarComplementaryAreaFills() {\n\tconst {\n\t\tsidebar,\n\t\tisEditorSidebarOpened,\n\t\thasBlockSelection,\n\t\tsupportsGlobalStyles,\n\t\tisEditingPage,\n\t\tisEditorOpen,\n\t} = useSelect( ( select ) => {\n\t\tconst _sidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( STORE_NAME );\n\n\t\tconst _isEditorSidebarOpened = [\n\t\t\tSIDEBAR_BLOCK,\n\t\t\tSIDEBAR_TEMPLATE,\n\t\t].includes( _sidebar );\n\t\tconst { getCanvasMode } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tsidebar: _sidebar,\n\t\t\tisEditorSidebarOpened: _isEditorSidebarOpened,\n\t\t\thasBlockSelection:\n\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\tsupportsGlobalStyles:\n\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\tisEditingPage: select( editSiteStore ).isPage(),\n\t\t\tisEditorOpen: getCanvasMode() === 'edit',\n\t\t};\n\t}, [] );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\t// Don't automatically switch tab when the sidebar is closed or when we\n\t\t// are focused on page content.\n\t\tif ( ! isEditorSidebarOpened ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( hasBlockSelection ) {\n\t\t\tif ( ! isEditingPage ) {\n\t\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t\t}\n\t\t} else {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\t\t}\n\t}, [\n\t\thasBlockSelection,\n\t\tisEditorSidebarOpened,\n\t\tisEditingPage,\n\t\tenableComplementaryArea,\n\t] );\n\n\tlet sidebarName = sidebar;\n\tif ( ! isEditorSidebarOpened ) {\n\t\tsidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;\n\t}\n\n\t// `newSelectedTabId` could technically be falsey if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsey handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea( STORE_NAME, newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// edit-site store), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop. Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={\n\t\t\t\tisEditorOpen && isEditorSidebarOpened ? sidebarName : null\n\t\t\t}\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<FillContents\n\t\t\t\tsidebarName={ sidebarName }\n\t\t\t\tisEditingPage={ isEditingPage }\n\t\t\t\tsupportsGlobalStyles={ supportsGlobalStyles }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,cAAc,EACdC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,KAAK,EAAEC,EAAE,QAAQ,iBAAiB;AAC3C,SAASC,UAAU,EAAEC,WAAW,QAAQ,kBAAkB;AAC1D,SAASC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AAC/E,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,cAAc,QAAQ,sBAAsB;AAC9D,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,yBAAyB;AACnE,SAASF,KAAK,IAAIG,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC,cAAc,MAAM,mBAAmB;AAC9C,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,SAASC,UAAU,QAAQ,uBAAuB;AAClD,OAAOC,cAAc,MAAM,mBAAmB;AAC9C,OAAOC,UAAU,MAAM,eAAe;AACtC,OAAOC,aAAa,MAAM,kBAAkB;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W,GAAGsC,OAAO;EACzB,IAAK,CAAEC,qBAAqB,EAAG;IAC9BvC,WAAW,GAAGwC,iBAAiB,GAAGnD,aAAa,GAAGC,gBAAgB;EACnE;;EAEA;EACA;EACA;EACA;EACA,MAAM+D,WAAW,GAAGjF,WAAW,CAC5BkF,gBAAgB,IAAM;IACvB,IAAK,CAAC,CAAEA,gBAAgB,EAAG;MAC1BF,uBAAuB,CAAEpE,UAAU,EAAEsE,gBAAiB,CAAC;IACxD;EACD,CAAC,EACD,CAAEF,uBAAuB,CAC1B,CAAC;EAED,OACC/B,aAAA,CAAC5B;EACA;EACA;EACA;EACA;EACA;EAAA;IACA8D,aAAa,EACZd,YAAY,IAAIF,qBAAqB,GAAGvC,WAAW,GAAG,IACtD;IACDwD,QAAQ,EAAGH,WAAa;IACxBI,YAAY,EAAG;EAAO,GAEtBpC,aAAA,CAACtB,YAAY;IACZC,WAAW,EAAGA,WAAa;IAC3BC,aAAa,EAAGA,aAAe;IAC/BC,oBAAoB,EAAGA;EAAsB,CAC7C,CACI,CAAC;AAET"}
1
+ {"version":3,"names":["createSlotFill","privateApis","componentsPrivateApis","isRTL","__","drawerLeft","drawerRight","useCallback","useContext","useEffect","useRef","useSelect","useDispatch","store","interfaceStore","blockEditorStore","coreStore","DefaultSidebar","GlobalStylesSidebar","STORE_NAME","SettingsHeader","PagePanels","TemplatePanel","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","editSiteStore","unlock","Tabs","Slot","InspectorSlot","Fill","InspectorFill","SidebarInspectorFill","FillContents","sidebarName","isEditingPage","supportsGlobalStyles","tabListRef","tabsContextValue","Context","tabsElements","Array","from","current","querySelectorAll","selectedTabElement","find","element","getAttribute","activeElement","ownerDocument","tabsHasFocus","some","id","focus","createElement","Fragment","identifier","title","icon","closeLabel","header","Provider","value","ref","headerClassName","className","TabPanel","tabId","focusable","bubblesVirtually","SidebarComplementaryAreaFills","sidebar","isEditorSidebarOpened","hasBlockSelection","isEditorOpen","select","_sidebar","getActiveComplementaryArea","_isEditorSidebarOpened","includes","getCanvasMode","getBlockSelectionStart","getCurrentTheme","is_block_theme","isPage","enableComplementaryArea","onTabSelect","newSelectedTabId","selectedTabId","onSelect","selectOnMove"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateSlotFill,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { useCallback, useContext, useEffect, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport { STORE_NAME } from '../../store/constants';\nimport SettingsHeader from './settings-header';\nimport PagePanels from './page-panels';\nimport TemplatePanel from './template-panel';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nconst FillContents = ( {\n\tsidebarName,\n\tisEditingPage,\n\tsupportsGlobalStyles,\n} ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `DefaultSidebar` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way.\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === sidebarName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ sidebarName ] );\n\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ sidebarName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t\theader={\n\t\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t\t<SettingsHeader ref={ tabListRef } />\n\t\t\t\t\t</Tabs.Context.Provider>\n\t\t\t\t}\n\t\t\t\theaderClassName=\"edit-site-sidebar-edit-mode__panel-tabs\"\n\t\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t\t// margin to the panel.\n\t\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\t\tclassName=\"edit-site-sidebar__panel\"\n\t\t\t>\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\ttabId={ SIDEBAR_TEMPLATE }\n\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isEditingPage ? <PagePanels /> : <TemplatePanel /> }\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t<Tabs.TabPanel tabId={ SIDEBAR_BLOCK } focusable={ false }>\n\t\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t</DefaultSidebar>\n\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t</>\n\t);\n};\n\nexport function SidebarComplementaryAreaFills() {\n\tconst {\n\t\tsidebar,\n\t\tisEditorSidebarOpened,\n\t\thasBlockSelection,\n\t\tsupportsGlobalStyles,\n\t\tisEditingPage,\n\t\tisEditorOpen,\n\t} = useSelect( ( select ) => {\n\t\tconst _sidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( STORE_NAME );\n\n\t\tconst _isEditorSidebarOpened = [\n\t\t\tSIDEBAR_BLOCK,\n\t\t\tSIDEBAR_TEMPLATE,\n\t\t].includes( _sidebar );\n\t\tconst { getCanvasMode } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tsidebar: _sidebar,\n\t\t\tisEditorSidebarOpened: _isEditorSidebarOpened,\n\t\t\thasBlockSelection:\n\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\tsupportsGlobalStyles:\n\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\tisEditingPage: select( editSiteStore ).isPage(),\n\t\t\tisEditorOpen: getCanvasMode() === 'edit',\n\t\t};\n\t}, [] );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\t// Don't automatically switch tab when the sidebar is closed or when we\n\t\t// are focused on page content.\n\t\tif ( ! isEditorSidebarOpened ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( hasBlockSelection ) {\n\t\t\tif ( ! isEditingPage ) {\n\t\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t\t}\n\t\t} else {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\t\t}\n\t}, [\n\t\thasBlockSelection,\n\t\tisEditorSidebarOpened,\n\t\tisEditingPage,\n\t\tenableComplementaryArea,\n\t] );\n\n\tlet sidebarName = sidebar;\n\tif ( ! isEditorSidebarOpened ) {\n\t\tsidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;\n\t}\n\n\t// `newSelectedTabId` could technically be falsey if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsey handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea( STORE_NAME, newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// edit-site store), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop. Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={\n\t\t\t\tisEditorOpen && isEditorSidebarOpened ? sidebarName : null\n\t\t\t}\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<FillContents\n\t\t\t\tsidebarName={ sidebarName }\n\t\t\t\tisEditingPage={ isEditingPage }\n\t\t\t\tsupportsGlobalStyles={ supportsGlobalStyles }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,cAAc,EACdC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,KAAK,EAAEC,EAAE,QAAQ,iBAAiB;AAC3C,SAASC,UAAU,EAAEC,WAAW,QAAQ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