@wordpress/edit-site 5.30.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 (470) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/block-editor/editor-canvas.js +24 -4
  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/block-editor/use-site-editor-settings.js +1 -1
  7. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  8. package/build/components/editor/index.js +12 -3
  9. package/build/components/editor/index.js.map +1 -1
  10. package/build/components/editor-canvas-container/index.js +1 -2
  11. package/build/components/editor-canvas-container/index.js.map +1 -1
  12. package/build/components/global-styles/background-panel.js +38 -0
  13. package/build/components/global-styles/background-panel.js.map +1 -0
  14. package/build/components/global-styles/color-palette-panel.js +0 -9
  15. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  16. package/build/components/global-styles/font-families.js +1 -1
  17. package/build/components/global-styles/font-families.js.map +1 -1
  18. package/build/components/global-styles/font-library-modal/context.js +53 -17
  19. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  20. package/build/components/global-styles/font-library-modal/font-collection.js +4 -3
  21. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  22. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +3 -2
  23. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  24. package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -1
  25. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  26. package/build/components/global-styles/font-library-modal/upload-fonts.js +44 -10
  27. package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  28. package/build/components/global-styles/font-library-modal/utils/index.js +22 -4
  29. package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  30. package/build/components/global-styles/font-library-modal/utils/preview-styles.js +3 -0
  31. package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  32. package/build/components/global-styles/header.js +1 -1
  33. package/build/components/global-styles/header.js.map +1 -1
  34. package/build/components/global-styles/hooks.js +50 -1
  35. package/build/components/global-styles/hooks.js.map +1 -1
  36. package/build/components/global-styles/palette.js +3 -1
  37. package/build/components/global-styles/palette.js.map +1 -1
  38. package/build/components/global-styles/preview-colors.js +2 -2
  39. package/build/components/global-styles/preview-colors.js.map +1 -1
  40. package/build/components/global-styles/preview-iframe.js +0 -1
  41. package/build/components/global-styles/preview-iframe.js.map +1 -1
  42. package/build/components/global-styles/preview-styles.js +2 -2
  43. package/build/components/global-styles/preview-styles.js.map +1 -1
  44. package/build/components/global-styles/root-menu.js +8 -2
  45. package/build/components/global-styles/root-menu.js.map +1 -1
  46. package/build/components/global-styles/screen-background.js +34 -0
  47. package/build/components/global-styles/screen-background.js.map +1 -0
  48. package/build/components/global-styles/screen-color-palette.js +2 -2
  49. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  50. package/build/components/global-styles/screen-colors.js +5 -10
  51. package/build/components/global-styles/screen-colors.js.map +1 -1
  52. package/build/components/global-styles/screen-style-variations.js +3 -37
  53. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  54. package/build/components/global-styles/screen-typography.js +6 -11
  55. package/build/components/global-styles/screen-typography.js.map +1 -1
  56. package/build/components/global-styles/style-variations-container.js +5 -2
  57. package/build/components/global-styles/style-variations-container.js.map +1 -1
  58. package/build/components/global-styles/typography-elements.js +3 -1
  59. package/build/components/global-styles/typography-elements.js.map +1 -1
  60. package/build/components/global-styles/{preview-typography.js → typography-example.js} +4 -2
  61. package/build/components/global-styles/typography-example.js.map +1 -0
  62. package/build/components/global-styles/typography-preview.js +3 -1
  63. package/build/components/global-styles/typography-preview.js.map +1 -1
  64. package/build/components/global-styles/ui.js +4 -1
  65. package/build/components/global-styles/ui.js.map +1 -1
  66. package/build/components/global-styles/utils.js +1 -1
  67. package/build/components/global-styles/utils.js.map +1 -1
  68. package/build/components/global-styles/variations/variations-color.js +13 -7
  69. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  70. package/build/components/global-styles/variations/variations-typography.js +34 -37
  71. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  72. package/build/components/header-edit-mode/index.js +2 -1
  73. package/build/components/header-edit-mode/index.js.map +1 -1
  74. package/build/components/keyboard-shortcut-help-modal/config.js +6 -0
  75. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  76. package/build/components/keyboard-shortcut-help-modal/index.js +3 -0
  77. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  78. package/build/components/keyboard-shortcuts/global.js +17 -3
  79. package/build/components/keyboard-shortcuts/global.js.map +1 -1
  80. package/build/components/layout/animation.js +129 -0
  81. package/build/components/layout/animation.js.map +1 -0
  82. package/build/components/layout/index.js +9 -17
  83. package/build/components/layout/index.js.map +1 -1
  84. package/build/components/layout/router.js +22 -22
  85. package/build/components/layout/router.js.map +1 -1
  86. package/build/components/page-pages/index.js +24 -27
  87. package/build/components/page-pages/index.js.map +1 -1
  88. package/build/components/page-patterns/delete-category-menu-item.js +6 -1
  89. package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
  90. package/build/components/page-patterns/index.js +19 -32
  91. package/build/components/page-patterns/index.js.map +1 -1
  92. package/build/components/page-patterns/search-items.js +16 -58
  93. package/build/components/page-patterns/search-items.js.map +1 -1
  94. package/build/components/page-patterns/use-patterns.js +9 -9
  95. package/build/components/page-patterns/use-patterns.js.map +1 -1
  96. package/build/components/page-templates-template-parts/actions.js +54 -41
  97. package/build/components/page-templates-template-parts/actions.js.map +1 -1
  98. package/build/components/page-templates-template-parts/index.js +31 -69
  99. package/build/components/page-templates-template-parts/index.js.map +1 -1
  100. package/build/components/plugin-template-setting-panel/index.js +12 -1
  101. package/build/components/plugin-template-setting-panel/index.js.map +1 -1
  102. package/build/components/save-button/index.js +45 -16
  103. package/build/components/save-button/index.js.map +1 -1
  104. package/build/components/save-hub/index.js +8 -112
  105. package/build/components/save-hub/index.js.map +1 -1
  106. package/build/components/save-panel/index.js +14 -9
  107. package/build/components/save-panel/index.js.map +1 -1
  108. package/build/components/sidebar/index.js +3 -8
  109. package/build/components/sidebar/index.js.map +1 -1
  110. package/build/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  111. package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  112. package/build/components/sidebar-dataviews/dataview-item.js +2 -2
  113. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  114. package/build/components/sidebar-dataviews/default-views.js +3 -3
  115. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  116. package/build/components/sidebar-dataviews/index.js +5 -4
  117. package/build/components/sidebar-dataviews/index.js.map +1 -1
  118. package/build/components/sidebar-edit-mode/index.js +1 -2
  119. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  120. package/build/components/sidebar-edit-mode/page-panels/index.js +7 -17
  121. package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  122. package/build/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
  123. package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  124. package/build/components/sidebar-edit-mode/page-panels/page-summary.js +3 -1
  125. package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  126. package/build/components/sidebar-edit-mode/template-panel/index.js +32 -18
  127. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  128. package/build/components/sidebar-navigation-screen-details-footer/index.js +5 -1
  129. package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  130. package/build/components/sidebar-navigation-screen-global-styles/index.js +18 -1
  131. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  132. package/build/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +4 -5
  133. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
  134. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
  135. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  136. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  137. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  138. package/build/components/sidebar-navigation-screen-patterns/index.js +1 -5
  139. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  140. package/build/components/sidebar-navigation-screen-template/index.js +5 -1
  141. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  142. package/build/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
  143. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  144. package/build/components/style-book/index.js +1 -1
  145. package/build/components/style-book/index.js.map +1 -1
  146. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -3
  147. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  148. package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -11
  149. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  150. package/build/components/template-actions/index.js +44 -27
  151. package/build/components/template-actions/index.js.map +1 -1
  152. package/build/components/welcome-guide/editor.js +11 -2
  153. package/build/components/welcome-guide/editor.js.map +1 -1
  154. package/build/hooks/index.js +0 -1
  155. package/build/hooks/index.js.map +1 -1
  156. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +15 -2
  157. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  158. package/build/store/selectors.js +1 -9
  159. package/build/store/selectors.js.map +1 -1
  160. package/build/utils/constants.js +5 -3
  161. package/build/utils/constants.js.map +1 -1
  162. package/build/utils/get-is-list-page.js +1 -1
  163. package/build/utils/get-is-list-page.js.map +1 -1
  164. package/build/utils/math.js +98 -0
  165. package/build/utils/math.js.map +1 -0
  166. package/build-module/components/block-editor/editor-canvas.js +24 -4
  167. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  168. package/build-module/components/block-editor/site-editor-canvas.js +15 -4
  169. package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
  170. package/build-module/components/block-editor/use-site-editor-settings.js +1 -1
  171. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  172. package/build-module/components/editor/index.js +13 -4
  173. package/build-module/components/editor/index.js.map +1 -1
  174. package/build-module/components/editor-canvas-container/index.js +1 -2
  175. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  176. package/build-module/components/global-styles/background-panel.js +31 -0
  177. package/build-module/components/global-styles/background-panel.js.map +1 -0
  178. package/build-module/components/global-styles/color-palette-panel.js +0 -8
  179. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  180. package/build-module/components/global-styles/font-families.js +1 -1
  181. package/build-module/components/global-styles/font-families.js.map +1 -1
  182. package/build-module/components/global-styles/font-library-modal/context.js +54 -18
  183. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  184. package/build-module/components/global-styles/font-library-modal/font-collection.js +4 -3
  185. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  186. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +4 -3
  187. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  188. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -1
  189. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  190. package/build-module/components/global-styles/font-library-modal/upload-fonts.js +44 -10
  191. package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  192. package/build-module/components/global-styles/font-library-modal/utils/index.js +22 -4
  193. package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  194. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +3 -0
  195. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  196. package/build-module/components/global-styles/header.js +1 -1
  197. package/build-module/components/global-styles/header.js.map +1 -1
  198. package/build-module/components/global-styles/hooks.js +48 -1
  199. package/build-module/components/global-styles/hooks.js.map +1 -1
  200. package/build-module/components/global-styles/palette.js +3 -1
  201. package/build-module/components/global-styles/palette.js.map +1 -1
  202. package/build-module/components/global-styles/preview-colors.js +2 -2
  203. package/build-module/components/global-styles/preview-colors.js.map +1 -1
  204. package/build-module/components/global-styles/preview-iframe.js +0 -1
  205. package/build-module/components/global-styles/preview-iframe.js.map +1 -1
  206. package/build-module/components/global-styles/preview-styles.js +2 -2
  207. package/build-module/components/global-styles/preview-styles.js.map +1 -1
  208. package/build-module/components/global-styles/root-menu.js +9 -3
  209. package/build-module/components/global-styles/root-menu.js.map +1 -1
  210. package/build-module/components/global-styles/screen-background.js +26 -0
  211. package/build-module/components/global-styles/screen-background.js.map +1 -0
  212. package/build-module/components/global-styles/screen-color-palette.js +2 -2
  213. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  214. package/build-module/components/global-styles/screen-colors.js +5 -10
  215. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  216. package/build-module/components/global-styles/screen-style-variations.js +4 -38
  217. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  218. package/build-module/components/global-styles/screen-typography.js +6 -11
  219. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  220. package/build-module/components/global-styles/style-variations-container.js +5 -2
  221. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  222. package/build-module/components/global-styles/typography-elements.js +3 -1
  223. package/build-module/components/global-styles/typography-elements.js.map +1 -1
  224. package/build-module/components/global-styles/{preview-typography.js → typography-example.js} +4 -2
  225. package/build-module/components/global-styles/typography-example.js.map +1 -0
  226. package/build-module/components/global-styles/typography-preview.js +3 -1
  227. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  228. package/build-module/components/global-styles/ui.js +4 -1
  229. package/build-module/components/global-styles/ui.js.map +1 -1
  230. package/build-module/components/global-styles/utils.js +1 -1
  231. package/build-module/components/global-styles/utils.js.map +1 -1
  232. package/build-module/components/global-styles/variations/variations-color.js +13 -7
  233. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  234. package/build-module/components/global-styles/variations/variations-typography.js +35 -38
  235. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  236. package/build-module/components/header-edit-mode/index.js +2 -1
  237. package/build-module/components/header-edit-mode/index.js.map +1 -1
  238. package/build-module/components/keyboard-shortcut-help-modal/config.js +6 -0
  239. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  240. package/build-module/components/keyboard-shortcut-help-modal/index.js +3 -0
  241. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  242. package/build-module/components/keyboard-shortcuts/global.js +17 -3
  243. package/build-module/components/keyboard-shortcuts/global.js.map +1 -1
  244. package/build-module/components/layout/animation.js +122 -0
  245. package/build-module/components/layout/animation.js.map +1 -0
  246. package/build-module/components/layout/index.js +9 -17
  247. package/build-module/components/layout/index.js.map +1 -1
  248. package/build-module/components/layout/router.js +22 -22
  249. package/build-module/components/layout/router.js.map +1 -1
  250. package/build-module/components/page-pages/index.js +25 -28
  251. package/build-module/components/page-pages/index.js.map +1 -1
  252. package/build-module/components/page-patterns/delete-category-menu-item.js +6 -1
  253. package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
  254. package/build-module/components/page-patterns/index.js +21 -34
  255. package/build-module/components/page-patterns/index.js.map +1 -1
  256. package/build-module/components/page-patterns/search-items.js +14 -55
  257. package/build-module/components/page-patterns/search-items.js.map +1 -1
  258. package/build-module/components/page-patterns/use-patterns.js +9 -9
  259. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  260. package/build-module/components/page-templates-template-parts/actions.js +54 -40
  261. package/build-module/components/page-templates-template-parts/actions.js.map +1 -1
  262. package/build-module/components/page-templates-template-parts/index.js +34 -72
  263. package/build-module/components/page-templates-template-parts/index.js.map +1 -1
  264. package/build-module/components/plugin-template-setting-panel/index.js +12 -1
  265. package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
  266. package/build-module/components/save-button/index.js +46 -17
  267. package/build-module/components/save-button/index.js.map +1 -1
  268. package/build-module/components/save-hub/index.js +10 -114
  269. package/build-module/components/save-hub/index.js.map +1 -1
  270. package/build-module/components/save-panel/index.js +14 -9
  271. package/build-module/components/save-panel/index.js.map +1 -1
  272. package/build-module/components/sidebar/index.js +3 -8
  273. package/build-module/components/sidebar/index.js.map +1 -1
  274. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  275. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  276. package/build-module/components/sidebar-dataviews/dataview-item.js +2 -2
  277. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  278. package/build-module/components/sidebar-dataviews/default-views.js +4 -4
  279. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  280. package/build-module/components/sidebar-dataviews/index.js +5 -4
  281. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  282. package/build-module/components/sidebar-edit-mode/index.js +1 -2
  283. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  284. package/build-module/components/sidebar-edit-mode/page-panels/index.js +10 -20
  285. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  286. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
  287. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  288. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +4 -2
  289. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  290. package/build-module/components/sidebar-edit-mode/template-panel/index.js +33 -19
  291. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  292. package/build-module/components/sidebar-navigation-screen-details-footer/index.js +5 -1
  293. package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  294. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +19 -2
  295. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  296. package/build-module/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +3 -4
  297. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
  298. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
  299. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  300. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  301. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  302. package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -5
  303. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  304. package/build-module/components/sidebar-navigation-screen-template/index.js +5 -1
  305. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  306. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
  307. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  308. package/build-module/components/style-book/index.js +1 -1
  309. package/build-module/components/style-book/index.js.map +1 -1
  310. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -3
  311. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  312. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -11
  313. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  314. package/build-module/components/template-actions/index.js +44 -27
  315. package/build-module/components/template-actions/index.js.map +1 -1
  316. package/build-module/components/welcome-guide/editor.js +11 -2
  317. package/build-module/components/welcome-guide/editor.js.map +1 -1
  318. package/build-module/hooks/index.js +0 -1
  319. package/build-module/hooks/index.js.map +1 -1
  320. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +15 -2
  321. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  322. package/build-module/store/selectors.js +1 -9
  323. package/build-module/store/selectors.js.map +1 -1
  324. package/build-module/utils/constants.js +4 -2
  325. package/build-module/utils/constants.js.map +1 -1
  326. package/build-module/utils/get-is-list-page.js +1 -1
  327. package/build-module/utils/get-is-list-page.js.map +1 -1
  328. package/build-module/utils/math.js +92 -0
  329. package/build-module/utils/math.js.map +1 -0
  330. package/build-style/style-rtl.css +146 -130
  331. package/build-style/style.css +146 -130
  332. package/package.json +44 -44
  333. package/src/components/block-editor/editor-canvas.js +34 -9
  334. package/src/components/block-editor/site-editor-canvas.js +10 -7
  335. package/src/components/block-editor/use-site-editor-settings.js +0 -2
  336. package/src/components/editor/index.js +11 -4
  337. package/src/components/editor-canvas-container/index.js +0 -1
  338. package/src/components/global-styles/background-panel.js +34 -0
  339. package/src/components/global-styles/color-palette-panel.js +0 -11
  340. package/src/components/global-styles/font-families.js +1 -1
  341. package/src/components/global-styles/font-library-modal/context.js +77 -31
  342. package/src/components/global-styles/font-library-modal/font-collection.js +4 -3
  343. package/src/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +9 -2
  344. package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -1
  345. package/src/components/global-styles/font-library-modal/style.scss +15 -6
  346. package/src/components/global-styles/font-library-modal/upload-fonts.js +53 -8
  347. package/src/components/global-styles/font-library-modal/utils/index.js +21 -8
  348. package/src/components/global-styles/font-library-modal/utils/preview-styles.js +4 -0
  349. package/src/components/global-styles/header.js +1 -1
  350. package/src/components/global-styles/hooks.js +68 -1
  351. package/src/components/global-styles/palette.js +3 -1
  352. package/src/components/global-styles/preview-colors.js +2 -2
  353. package/src/components/global-styles/preview-iframe.js +0 -1
  354. package/src/components/global-styles/preview-styles.js +2 -2
  355. package/src/components/global-styles/root-menu.js +12 -1
  356. package/src/components/global-styles/screen-background.js +29 -0
  357. package/src/components/global-styles/screen-color-palette.js +2 -2
  358. package/src/components/global-styles/screen-colors.js +4 -15
  359. package/src/components/global-styles/screen-style-variations.js +4 -36
  360. package/src/components/global-styles/screen-typography.js +6 -20
  361. package/src/components/global-styles/style-variations-container.js +2 -1
  362. package/src/components/global-styles/style.scss +15 -10
  363. package/src/components/global-styles/typography-elements.js +5 -1
  364. package/src/components/global-styles/{preview-typography.js → typography-example.js} +3 -1
  365. package/src/components/global-styles/typography-preview.js +3 -1
  366. package/src/components/global-styles/ui.js +5 -0
  367. package/src/components/global-styles/utils.js +1 -1
  368. package/src/components/global-styles/variations/style.scss +32 -23
  369. package/src/components/global-styles/variations/variations-color.js +12 -6
  370. package/src/components/global-styles/variations/variations-typography.js +41 -60
  371. package/src/components/header-edit-mode/index.js +1 -0
  372. package/src/components/header-edit-mode/style.scss +28 -17
  373. package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
  374. package/src/components/keyboard-shortcut-help-modal/index.js +4 -0
  375. package/src/components/keyboard-shortcuts/global.js +16 -4
  376. package/src/components/layout/animation.js +122 -0
  377. package/src/components/layout/index.js +12 -27
  378. package/src/components/layout/router.js +26 -25
  379. package/src/components/layout/style.scss +2 -0
  380. package/src/components/page-pages/index.js +33 -54
  381. package/src/components/page-patterns/delete-category-menu-item.js +7 -0
  382. package/src/components/page-patterns/index.js +22 -31
  383. package/src/components/page-patterns/search-items.js +13 -58
  384. package/src/components/page-patterns/use-patterns.js +17 -10
  385. package/src/components/page-templates-template-parts/actions.js +106 -91
  386. package/src/components/page-templates-template-parts/index.js +41 -93
  387. package/src/components/page-templates-template-parts/style.scss +5 -0
  388. package/src/components/plugin-template-setting-panel/index.js +14 -1
  389. package/src/components/save-button/index.js +55 -26
  390. package/src/components/save-hub/index.js +20 -164
  391. package/src/components/save-panel/index.js +24 -17
  392. package/src/components/sidebar/index.js +2 -8
  393. package/src/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  394. package/src/components/sidebar-dataviews/dataview-item.js +2 -2
  395. package/src/components/sidebar-dataviews/default-views.js +12 -4
  396. package/src/components/sidebar-dataviews/index.js +5 -4
  397. package/src/components/sidebar-edit-mode/index.js +0 -2
  398. package/src/components/sidebar-edit-mode/page-panels/index.js +31 -62
  399. package/src/components/sidebar-edit-mode/page-panels/page-content.js +10 -10
  400. package/src/components/sidebar-edit-mode/page-panels/page-summary.js +2 -0
  401. package/src/components/sidebar-edit-mode/template-panel/index.js +33 -24
  402. package/src/components/sidebar-edit-mode/template-panel/style.scss +1 -29
  403. package/src/components/sidebar-navigation-screen/style.scss +21 -9
  404. package/src/components/sidebar-navigation-screen-details-footer/index.js +6 -2
  405. package/src/components/sidebar-navigation-screen-global-styles/index.js +29 -2
  406. package/src/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +2 -3
  407. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +11 -9
  408. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +6 -3
  409. package/src/components/sidebar-navigation-screen-patterns/index.js +0 -7
  410. package/src/components/sidebar-navigation-screen-template/index.js +6 -1
  411. package/src/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
  412. package/src/components/style-book/index.js +1 -3
  413. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -3
  414. package/src/components/sync-state-with-url/use-sync-path-with-url.js +3 -19
  415. package/src/components/template-actions/index.js +63 -46
  416. package/src/components/welcome-guide/editor.js +9 -6
  417. package/src/hooks/index.js +0 -1
  418. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +21 -4
  419. package/src/store/selectors.js +3 -15
  420. package/src/style.scss +0 -2
  421. package/src/utils/constants.js +4 -2
  422. package/src/utils/get-is-list-page.js +1 -1
  423. package/src/utils/math.js +93 -0
  424. package/build/components/actions/index.js +0 -321
  425. package/build/components/actions/index.js.map +0 -1
  426. package/build/components/global-styles/preview-typography.js.map +0 -1
  427. package/build/components/sidebar-edit-mode/sidebar-card/index.js +0 -42
  428. package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +0 -1
  429. package/build/components/sidebar-edit-mode/template-panel/template-actions.js +0 -50
  430. package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
  431. package/build/components/sidebar-edit-mode/template-panel/template-areas.js +0 -70
  432. package/build/components/sidebar-edit-mode/template-panel/template-areas.js.map +0 -1
  433. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
  434. package/build/components/sidebar-navigation-screen-pages/index.js +0 -175
  435. package/build/components/sidebar-navigation-screen-pages/index.js.map +0 -1
  436. package/build/components/sidebar-navigation-screen-templates/index.js +0 -132
  437. package/build/components/sidebar-navigation-screen-templates/index.js.map +0 -1
  438. package/build/hooks/template-part-edit.js +0 -82
  439. package/build/hooks/template-part-edit.js.map +0 -1
  440. package/build/store/utils.js +0 -71
  441. package/build/store/utils.js.map +0 -1
  442. package/build-module/components/actions/index.js +0 -310
  443. package/build-module/components/actions/index.js.map +0 -1
  444. package/build-module/components/global-styles/preview-typography.js.map +0 -1
  445. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +0 -34
  446. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +0 -1
  447. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js +0 -42
  448. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
  449. package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js +0 -63
  450. package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js.map +0 -1
  451. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
  452. package/build-module/components/sidebar-navigation-screen-pages/index.js +0 -167
  453. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +0 -1
  454. package/build-module/components/sidebar-navigation-screen-templates/index.js +0 -124
  455. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +0 -1
  456. package/build-module/hooks/template-part-edit.js +0 -75
  457. package/build-module/hooks/template-part-edit.js.map +0 -1
  458. package/build-module/store/utils.js +0 -64
  459. package/build-module/store/utils.js.map +0 -1
  460. package/src/components/actions/index.js +0 -411
  461. package/src/components/sidebar-edit-mode/sidebar-card/index.js +0 -34
  462. package/src/components/sidebar-edit-mode/sidebar-card/style.scss +0 -37
  463. package/src/components/sidebar-edit-mode/template-panel/template-actions.js +0 -49
  464. package/src/components/sidebar-edit-mode/template-panel/template-areas.js +0 -86
  465. package/src/components/sidebar-navigation-screen-pages/index.js +0 -238
  466. package/src/components/sidebar-navigation-screen-templates/index.js +0 -156
  467. package/src/components/sidebar-navigation-screen-templates/style.scss +0 -9
  468. package/src/hooks/template-part-edit.js +0 -89
  469. package/src/store/test/utils.js +0 -191
  470. 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\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,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,eAAe,QAAQ,qBAAqB;;AAErD;AACA;AACA;AACA,SAASF,KAAK,IAAIG,aAAa,QAAQ,aAAa;AACpD,SACCC,wBAAwB,EACxBC,iBAAiB,QACX,iCAAiC;AAExC,eAAe,SAASC,UAAUA,CAAE;EACnCC,SAAS,GAAG,+BAA+B;EAC3CC,OAAO,GAAG,SAAS;EACnBC,WAAW,GAAG,IAAI;EAClBC,YAAY;EACZC,IAAI;EACJC,IAAI;EACJC,qBAAqB,GAAG;AACzB,CAAC,EAAG;EACH,MAAM;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,cAAc;IAAEC;EAAoB,CAAC,GAC/DtB,SAAS,CAAIuB,MAAM,IAAM;IACxB,MAAM;MACLC,mCAAmC;MACnCC,oBAAoB;MACpBC;IACD,CAAC,GAAGH,MAAM,CAAEjB,SAAU,CAAC;IACvB,MAAMqB,kBAAkB,GAAGH,mCAAmC,CAAC,CAAC;IAChE,MAAM;MAAEI;IAAiB,CAAC,GAAGL,MAAM,CAAEf,aAAc,CAAC;IACpD,MAAMqB,iBAAiB,GAAGH,WAAW,CAAE,eAAgB,CAAC;IACxD,MAAMI,0BAA0B,GAA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AKuC,QAAQ,EAAG;MACtB,OAAOvC,EAAE,CAAE,OAAQ,CAAC;IACrB,CAAC,MAAM,IAAKY,YAAY,EAAG;MAC1B,OAAOA,YAAY;IACpB;IACA,OAAOZ,EAAE,CAAE,MAAO,CAAC;EACpB,CAAC;EACD,MAAMyC,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,SA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S,GAAGtC,eAAe,CAACqD,OAAO,CAAE,GAAI;IAC/D;AACH;AACA;AACA;AACA;AACA,OALG;IAMAxC,WAAW,EAAGA,WAAa;IAC3BE,IAAI,EAAGA,IAAM;IACbE,qBAAqB,EAAGA,qBAAuB;IAC/CD,IAAI,EAAGA;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,oBAAo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SAAS,EAAC,OAAO;IAACC,OAAO,EAAG;EAAG,GACnEzC,kBAAkB,GACnBsC,aAAA,CAAClE,MAAM;IACNsE,OAAO,EAAC,SAAS;IACjBC,OAAO,EAAGf,iBAAmB;IAC7BgB,MAAM,EAAGzC,QAAU;IACnBoB,QAAQ,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"}
@@ -55,7 +55,8 @@ const EntitiesSavedStatesForPreview = ({
55
55
  });
56
56
  };
57
57
  const _EntitiesSavedStates = ({
58
- onClose
58
+ onClose,
59
+ renderDialog = undefined
59
60
  }) => {
60
61
  if (isPreviewingTheme()) {
61
62
  return createElement(EntitiesSavedStatesForPreview, {
@@ -63,7 +64,8 @@ const _EntitiesSavedStates = ({
63
64
  });
64
65
  }
65
66
  return createElement(EntitiesSavedStates, {
66
- close: onClose
67
+ close: onClose,
68
+ renderDialog: renderDialog
67
69
  });
68
70
  };
69
71
  export default function SavePanel() {
@@ -115,17 +117,20 @@ export default function SavePanel() {
115
117
  'is-entity-save-view-open': isSaveViewOpen
116
118
  }),
117
119
  ariaLabel: __('Save panel')
118
- }, isSaveViewOpen ? createElement(_EntitiesSavedStates, {
119
- onClose: onClose
120
- }) : createElement("div", {
121
- className: "edit-site-editor__toggle-save-panel"
120
+ }, createElement("div", {
121
+ className: classnames('edit-site-editor__toggle-save-panel', {
122
+ 'screen-reader-text': isSaveViewOpen
123
+ })
122
124
  }, createElement(Button, {
123
125
  variant: "secondary",
124
- className: "edit-site-editor__toggle-save-panel-button",
126
+ className: classnames('edit-site-editor__toggle-save-panel-button'),
125
127
  onClick: () => setIsSaveViewOpened(true),
126
- "aria-expanded": false,
128
+ "aria-haspopup": 'dialog',
127
129
  disabled: disabled,
128
130
  __experimentalIsFocusable: true
129
- }, __('Open save panel'))));
131
+ }, __('Open save panel'))), isSaveViewOpen && createElement(_EntitiesSavedStates, {
132
+ onClose: onClose,
133
+ renderDialog: true
134
+ }));
130
135
  }
131
136
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","Button","Modal","EntitiesSavedStates","useEntitiesSavedStatesIsDirty","privateApis","useDispatch","useSelect","__","sprintf","NavigableRegion","store","coreStore","editSiteStore","unlock","useActivateTheme","useActualCurrentTheme","isPreviewingTheme","EntitiesSavedStatesExtensible","EntitiesSavedStatesForPreview","onClose","_currentTheme$name$re","_previewingTheme$name","isDirtyProps","activateSaveLabel","isDirty","currentTheme","previewingTheme","select","getCurrentTheme","additionalPrompt","createElement","name","rendered","activateTheme","onSave","values","close","saveEnabled","saveLabel","_EntitiesSavedStates","SavePanel","isSaveViewOpen","canvasMode","isSaving","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","isResolving","dirtyEntityRecords","isActivatingTheme","isSaveViewOpened","getCanvasMode","length","some","record","kind","key","setIsSaveViewOpened","className","onRequestClose","__experimentalHideHeader","contentLabel","activateSaveEnabled","disabled","ariaLabel","variant","onClick","__experimentalIsFocusable"],"sources":["@wordpress/edit-site/src/components/save-panel/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Modal } from '@wordpress/components';\nimport {\n\tEntitiesSavedStates,\n\tuseEntitiesSavedStatesIsDirty,\n\tprivateApis,\n} from '@wordpress/editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { NavigableRegion } from '@wordpress/interface';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useActivateTheme } from '../../utils/use-activate-theme';\nimport { useActualCurrentTheme } from '../../utils/use-actual-current-theme';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\n\nconst { EntitiesSavedStatesExtensible } = unlock( privateApis );\n\nconst EntitiesSavedStatesForPreview = ( { onClose } ) => {\n\tconst isDirtyProps = useEntitiesSavedStatesIsDirty();\n\tlet activateSaveLabel;\n\tif ( isDirtyProps.isDirty ) {\n\t\tactivateSaveLabel = __( 'Activate & Save' );\n\t} else {\n\t\tactivateSaveLabel = __( 'Activate' );\n\t}\n\n\tconst currentTheme = useActualCurrentTheme();\n\n\tconst previewingTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\n\tconst additionalPrompt = (\n\t\t<p>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: %1$s: The name of active theme, %2$s: The name of theme to be activated. */\n\t\t\t\t__(\n\t\t\t\t\t'Saving your changes will change your active theme from %1$s to %2$s.'\n\t\t\t\t),\n\t\t\t\tcurrentTheme?.name?.rendered ?? '...',\n\t\t\t\tpreviewingTheme?.name?.rendered ?? '...'\n\t\t\t) }\n\t\t</p>\n\t);\n\n\tconst activateTheme = useActivateTheme();\n\tconst onSave = async ( values ) => {\n\t\tawait activateTheme();\n\t\treturn values;\n\t};\n\n\treturn (\n\t\t<EntitiesSavedStatesExtensible\n\t\t\t{ ...{\n\t\t\t\t...isDirtyProps,\n\t\t\t\tadditionalPrompt,\n\t\t\t\tclose: onClose,\n\t\t\t\tonSave,\n\t\t\t\tsaveEnabled: true,\n\t\t\t\tsaveLabel: activateSaveLabel,\n\t\t\t} }\n\t\t/>\n\t);\n};\n\nconst _EntitiesSavedStates = ( { onClose } ) => {\n\tif ( isPreviewingTheme() ) {\n\t\treturn <EntitiesSavedStatesForPreview onClose={ onClose } />;\n\t}\n\treturn <EntitiesSavedStates close={ onClose } />;\n};\n\nexport default function SavePanel() {\n\tconst { isSaveViewOpen, canvasMode, isDirty, isSaving } = useSelect(\n\t\t( 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 isActivatingTheme = isResolving( 'activateTheme' );\n\t\t\tconst { isSaveViewOpened, getCanvasMode } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\n\t\t\t// The currently selected entity to display.\n\t\t\t// Typically template or template part in the site editor.\n\t\t\treturn {\n\t\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\t\tcanvasMode: getCanvasMode(),\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};\n\t\t},\n\t\t[]\n\t);\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\tconst onClose = () => setIsSaveViewOpened( false );\n\n\tif ( canvasMode === 'view' ) {\n\t\treturn isSaveViewOpen ? (\n\t\t\t<Modal\n\t\t\t\tclassName=\"edit-site-save-panel__modal\"\n\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t__experimentalHideHeader\n\t\t\t\tcontentLabel={ __(\n\t\t\t\t\t'Save site, content, and template changes'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<_EntitiesSavedStates onClose={ onClose } />\n\t\t\t</Modal>\n\t\t) : null;\n\t}\n\tconst activateSaveEnabled = isPreviewingTheme() || isDirty;\n\tconst disabled = isSaving || ! activateSaveEnabled;\n\treturn (\n\t\t<NavigableRegion\n\t\t\tclassName={ classnames( 'edit-site-layout__actions', {\n\t\t\t\t'is-entity-save-view-open': isSaveViewOpen,\n\t\t\t} ) }\n\t\t\tariaLabel={ __( 'Save panel' ) }\n\t\t>\n\t\t\t{ isSaveViewOpen ? (\n\t\t\t\t<_EntitiesSavedStates onClose={ onClose } />\n\t\t\t) : (\n\t\t\t\t<div className=\"edit-site-editor__toggle-save-panel\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tclassName=\"edit-site-editor__toggle-save-panel-button\"\n\t\t\t\t\t\tonClick={ () => setIsSaveViewOpened( true ) }\n\t\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</NavigableRegion>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,MAAM,EAAEC,KAAK,QAAQ,uBAAuB;AACrD,SACCC,mBAAmB,EACnBC,6BAA6B,EAC7BC,WAAW,QACL,mBAAmB;AAC1B,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,gBAAgB,QAAQ,gCAAgC;AACjE,SAASC,qBAAqB,QAAQ,sCAAsC;AAC5E,SAASC,iBAAiB,QAAQ,iCAAiC;AAEnE,MAAM;EAAEC;AAA8B,CAAC,GAAGJ,MAAM,CAAET,WAAY,CAAC;AAE/D,MAA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MAC1BwC,wBAAwB;MACxBC,YAAY,EAAGrD,EAAE,CAChB,0CACD;IAAG,GAEHuB,aAAA,CAACS,oBAAoB;MAACpB,OAAO,EAAGA;IAAS,CAAE,CACrC,CAAC,GACL,IAAI;EACT;EACA,MAAM0C,mBAAmB,GAAG7C,iBAAiB,CAAC,CAAC,IAAIQ,OAAO;EAC1D,MAAMsC,QAAQ,GAAGnB,QAAQ,IAAI,CAAEkB,mBAAmB;EAClD,OACC/B,aAAA,CAACrB,eAAe;IACfgD,SAAS,EAAG1D,UAAU,CAAE,2BAA2B,EAAE;MACpD,0BAA0B,EAAE0C;IAC7B,CAAE,CAAG;IACLsB,SAAS,EAAGxD,EAAE,CAAE,YAAa;EAAG,GAE9BkC,cAAc,GACfX,aAAA,CAACS,oBAAoB;IAACpB,OAAO,EAAGA;EAAS,CAAE,CAAC,GAE5CW,aAAA;IAAK2B,SAAS,EAAC;EAAqC,GACnD3B,aAAA,CAAC9B,MAAM;IACNgE,OAAO,EAAC,WAAW;IACnBP,SAAS,EAAC,4CAA4C;IACtDQ,OAAO,EAAGA,CAAA,KAAMT,mBAAmB,CAAE,IAAK,CAAG;IAC7C,iBAAgB,KAAO;IACvBM,QAAQ,EAAGA,QAAU;IACrBI,yBAAyB;EAAA,GAEvB3D,EAAE,CAAE,iBAAkB,CACjB,CACJ,CAEU,CAAC;AAEpB"}
1
+ {"version":3,"names":["classnames","Button","Modal","EntitiesSavedStates","useEntitiesSavedStatesIsDirty","privateApis","useDispatch","useSelect","__","sprintf","NavigableRegion","store","coreStore","editSiteStore","unlock","useActivateTheme","useActualCurrentTheme","isPreviewingTheme","EntitiesSavedStatesExtensible","EntitiesSavedStatesForPreview","onClose","_currentTheme$name$re","_previewingTheme$name","isDirtyProps","activateSaveLabel","isDirty","currentTheme","previewingTheme","select","getCurrentTheme","additionalPrompt","createElement","name","rendered","activateTheme","onSave","values","close","saveEnabled","saveLabel","_EntitiesSavedStates","renderDialog","undefined","SavePanel","isSaveViewOpen","canvasMode","isSaving","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","isResolving","dirtyEntityRecords","isActivatingTheme","isSaveViewOpened","getCanvasMode","length","some","record","kind","key","setIsSaveViewOpened","className","onRequestClose","__experimentalHideHeader","contentLabel","activateSaveEnabled","disabled","ariaLabel","variant","onClick","__experimentalIsFocusable"],"sources":["@wordpress/edit-site/src/components/save-panel/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Modal } from '@wordpress/components';\nimport {\n\tEntitiesSavedStates,\n\tuseEntitiesSavedStatesIsDirty,\n\tprivateApis,\n} from '@wordpress/editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { NavigableRegion } from '@wordpress/interface';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useActivateTheme } from '../../utils/use-activate-theme';\nimport { useActualCurrentTheme } from '../../utils/use-actual-current-theme';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\n\nconst { EntitiesSavedStatesExtensible } = unlock( privateApis );\n\nconst EntitiesSavedStatesForPreview = ( { onClose } ) => {\n\tconst isDirtyProps = useEntitiesSavedStatesIsDirty();\n\tlet activateSaveLabel;\n\tif ( isDirtyProps.isDirty ) {\n\t\tactivateSaveLabel = __( 'Activate & Save' );\n\t} else {\n\t\tactivateSaveLabel = __( 'Activate' );\n\t}\n\n\tconst currentTheme = useActualCurrentTheme();\n\n\tconst previewingTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\n\tconst additionalPrompt = (\n\t\t<p>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: %1$s: The name of active theme, %2$s: The name of theme to be activated. */\n\t\t\t\t__(\n\t\t\t\t\t'Saving your changes will change your active theme from %1$s to %2$s.'\n\t\t\t\t),\n\t\t\t\tcurrentTheme?.name?.rendered ?? '...',\n\t\t\t\tpreviewingTheme?.name?.rendered ?? '...'\n\t\t\t) }\n\t\t</p>\n\t);\n\n\tconst activateTheme = useActivateTheme();\n\tconst onSave = async ( values ) => {\n\t\tawait activateTheme();\n\t\treturn values;\n\t};\n\n\treturn (\n\t\t<EntitiesSavedStatesExtensible\n\t\t\t{ ...{\n\t\t\t\t...isDirtyProps,\n\t\t\t\tadditionalPrompt,\n\t\t\t\tclose: onClose,\n\t\t\t\tonSave,\n\t\t\t\tsaveEnabled: true,\n\t\t\t\tsaveLabel: activateSaveLabel,\n\t\t\t} }\n\t\t/>\n\t);\n};\n\nconst _EntitiesSavedStates = ( { onClose, renderDialog = undefined } ) => {\n\tif ( isPreviewingTheme() ) {\n\t\treturn <EntitiesSavedStatesForPreview onClose={ onClose } />;\n\t}\n\treturn (\n\t\t<EntitiesSavedStates close={ onClose } renderDialog={ renderDialog } />\n\t);\n};\n\nexport default function SavePanel() {\n\tconst { isSaveViewOpen, canvasMode, isDirty, isSaving } = useSelect(\n\t\t( 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 isActivatingTheme = isResolving( 'activateTheme' );\n\t\t\tconst { isSaveViewOpened, getCanvasMode } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\n\t\t\t// The currently selected entity to display.\n\t\t\t// Typically template or template part in the site editor.\n\t\t\treturn {\n\t\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\t\tcanvasMode: getCanvasMode(),\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};\n\t\t},\n\t\t[]\n\t);\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\tconst onClose = () => setIsSaveViewOpened( false );\n\n\tif ( canvasMode === 'view' ) {\n\t\treturn isSaveViewOpen ? (\n\t\t\t<Modal\n\t\t\t\tclassName=\"edit-site-save-panel__modal\"\n\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t__experimentalHideHeader\n\t\t\t\tcontentLabel={ __(\n\t\t\t\t\t'Save site, content, and template changes'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<_EntitiesSavedStates onClose={ onClose } />\n\t\t\t</Modal>\n\t\t) : null;\n\t}\n\tconst activateSaveEnabled = isPreviewingTheme() || isDirty;\n\tconst disabled = isSaving || ! activateSaveEnabled;\n\treturn (\n\t\t<NavigableRegion\n\t\t\tclassName={ classnames( 'edit-site-layout__actions', {\n\t\t\t\t'is-entity-save-view-open': isSaveViewOpen,\n\t\t\t} ) }\n\t\t\tariaLabel={ __( 'Save panel' ) }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={ classnames( 'edit-site-editor__toggle-save-panel', {\n\t\t\t\t\t'screen-reader-text': isSaveViewOpen,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'edit-site-editor__toggle-save-panel-button'\n\t\t\t\t\t) }\n\t\t\t\t\tonClick={ () => setIsSaveViewOpened( true ) }\n\t\t\t\t\taria-haspopup={ 'dialog' }\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t\t{ isSaveViewOpen && (\n\t\t\t\t<_Entities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SAAS,EAAG5D,UAAU,CAAE,qCAAqC,EAAE;MAC9D,oBAAoB,EAAE4C;IACvB,CAAE;EAAG,GAELb,aAAA,CAAC9B,MAAM;IACNkE,OAAO,EAAC,WAAW;IACnBP,SAAS,EAAG5D,UAAU,CACrB,4CACD,CAAG;IACHoE,OAAO,EAAGA,CAAA,KAAMT,mBAAmB,CAAE,IAAK,CAAG;IAC7C,iBAAgB,QAAU;IAC1BM,QAAQ,EAAGA,QAAU;IACrBI,yBAAyB;EAAA,GAEvB7D,EAAE,CAAE,iBAAkB,CACjB,CACJ,CAAC,EACJoC,cAAc,IACfb,aAAA,CAACS,oBAAoB;IAACpB,OAAO,EAAGA,OAAS;IAACqB,YAAY;EAAA,CAAE,CAEzC,CAAC;AAEpB"}
@@ -17,7 +17,6 @@ import { __ } from '@wordpress/i18n';
17
17
  * Internal dependencies
18
18
  */
19
19
  import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';
20
- import SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';
21
20
  import SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';
22
21
  import SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';
23
22
  import SidebarNavigationScreenPattern from '../sidebar-navigation-screen-pattern';
@@ -28,7 +27,6 @@ import SidebarNavigationScreenGlobalStyles from '../sidebar-navigation-screen-gl
28
27
  import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
29
28
  import SaveHub from '../save-hub';
30
29
  import { unlock } from '../../lock-unlock';
31
- import SidebarNavigationScreenPages from '../sidebar-navigation-screen-pages';
32
30
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
33
31
  import DataViewsSidebarContent from '../sidebar-dataviews';
34
32
  import SidebarNavigationScreenPage from '../sidebar-navigation-screen-page';
@@ -57,20 +55,17 @@ function SidebarScreens() {
57
55
  path: "/wp_global_styles"
58
56
  }, createElement(SidebarNavigationScreenGlobalStyles, null)), createElement(SidebarScreenWrapper, {
59
57
  path: "/page"
60
- }, createElement(SidebarNavigationScreenPages, null)), createElement(SidebarScreenWrapper, {
61
- path: "/pages"
62
58
  }, createElement(SidebarNavigationScreen, {
63
59
  title: __('Manage pages'),
64
- content: createElement(DataViewsSidebarContent, null),
65
- backPath: "/page"
60
+ content: createElement(DataViewsSidebarContent, null)
66
61
  })), createElement(SidebarScreenWrapper, {
67
62
  path: "/page/:postId"
68
63
  }, createElement(SidebarNavigationScreenPage, null)), createElement(SidebarScreenWrapper, {
69
64
  path: "/:postType(wp_template)"
70
- }, createElement(SidebarNavigationScreenTemplates, null)), !isMobileViewport && createElement(SidebarScreenWrapper, {
65
+ }, createElement(SidebarNavigationScreenTemplatesBrowse, null)), !isMobileViewport && createElement(SidebarScreenWrapper, {
71
66
  path: "/patterns"
72
67
  }, createElement(SidebarNavigationScreenPatterns, null)), createElement(SidebarScreenWrapper, {
73
- path: "/:postType(wp_template|wp_template_part)/all"
68
+ path: "/:postType(wp_template_part)/all"
74
69
  }, createElement(SidebarNavigationScreenTemplatesBrowse, null)), createElement(SidebarScreenWrapper, {
75
70
  path: "/:postType(wp_template_part|wp_block)/:postId"
76
71
  }, createElement(SidebarNavigationScreenPattern, null)), createElement(SidebarScreenWrapper, {
@@ -1 +1 @@
1
- {"version":3,"names":["classNames","memo","useRef","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","privateApis","routerPrivateApis","useViewportMatch","__","SidebarNavigationScreenMain","SidebarNavigationScreenTemplates","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 SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';\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<SidebarNavigationScreenTemplates />\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|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,gCAAgC,MAAM,wCAAwC;AACrF,OAAOC,+BAA+B,MAAM,uCAAuC;AACnF,OAAOC,+BAA+B,MAAM,uCAAuC;AACnF,OAAOC,8BAA8B,MAAM,sCAAsC;AACjF,OAAOC,kBAAkB,IACxBC,cAAc,QACR,+CAA+C;AACtD,OAAOC,sCAAsC,MAAM,+CAA+C;AAClG,OAAOC,qCAAqC,MAAM,8CAA8C;AAChG,OAAOC,mCAAmC,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EA,eAAerB,IAAI,CAAEuC,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,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,uCAAuC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ACpBD,aAAA,CAACT,OAAO,MAAE,CACT,CAAC;AAEL;AAEA,eAAepB,IAAI,CAAEoC,OAAQ,CAAC"}
@@ -92,7 +92,7 @@ function CustomDataViewItem({
92
92
  title: dataview.title,
93
93
  type: type,
94
94
  isActive: isActive,
95
- isCustom: "true",
95
+ isCustom: true,
96
96
  customViewId: dataviewId,
97
97
  suffix: createElement(DropdownMenu, {
98
98
  icon: moreVertical,
@@ -173,7 +173,7 @@ export default function CustomDataViewsList({
173
173
  return createElement(CustomDataViewItem, {
174
174
  key: customViewRecord.id,
175
175
  dataviewId: customViewRecord.id,
176
- isActive: isCustom === 'true' && Number(activeView) === customViewRecord.id
176
+ isActive: isCustom && Number(activeView) === customViewRecord.id
177
177
  });
178
178
  }), createElement(AddNewItem, {
179
179
  type: type