@wordpress/edit-site 5.10.0 → 5.12.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 (678) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-page/index.js +105 -0
  3. package/build/components/add-new-page/index.js.map +1 -0
  4. package/build/components/add-new-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +9 -25
  5. package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
  6. package/build/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +28 -41
  7. package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
  8. package/build/components/add-new-template/index.js +4 -5
  9. package/build/components/add-new-template/index.js.map +1 -1
  10. package/build/components/add-new-template/new-template-part.js +9 -12
  11. package/build/components/add-new-template/new-template-part.js.map +1 -1
  12. package/build/components/add-new-template/new-template.js +106 -80
  13. package/build/components/add-new-template/new-template.js.map +1 -1
  14. package/build/components/add-new-template/utils.js +71 -120
  15. package/build/components/add-new-template/utils.js.map +1 -1
  16. package/build/components/block-editor/back-button.js +1 -3
  17. package/build/components/block-editor/back-button.js.map +1 -1
  18. package/build/components/block-editor/block-inspector-button.js +3 -4
  19. package/build/components/block-editor/block-inspector-button.js.map +1 -1
  20. package/build/components/block-editor/editor-canvas.js +6 -7
  21. package/build/components/block-editor/editor-canvas.js.map +1 -1
  22. package/build/components/block-editor/index.js +14 -13
  23. package/build/components/block-editor/index.js.map +1 -1
  24. package/build/components/block-editor/inserter-media-categories.js +25 -42
  25. package/build/components/block-editor/inserter-media-categories.js.map +1 -1
  26. package/build/components/block-editor/resizable-editor.js +6 -7
  27. package/build/components/block-editor/resizable-editor.js.map +1 -1
  28. package/build/components/block-editor/resize-handle.js +5 -7
  29. package/build/components/block-editor/resize-handle.js.map +1 -1
  30. package/build/components/code-editor/code-editor-text-area.js +5 -6
  31. package/build/components/code-editor/code-editor-text-area.js.map +1 -1
  32. package/build/components/create-template-part-modal/index.js +30 -35
  33. package/build/components/create-template-part-modal/index.js.map +1 -1
  34. package/build/components/editor/index.js +37 -53
  35. package/build/components/editor/index.js.map +1 -1
  36. package/build/components/editor-canvas-container/index.js +15 -9
  37. package/build/components/editor-canvas-container/index.js.map +1 -1
  38. package/build/components/error-boundary/warning.js +8 -10
  39. package/build/components/error-boundary/warning.js.map +1 -1
  40. package/build/components/global-styles/block-preview-panel.js +7 -10
  41. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  42. package/build/components/global-styles/color-indicator-wrapper.js +4 -5
  43. package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
  44. package/build/components/global-styles/color-palette-panel.js +3 -4
  45. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  46. package/build/components/global-styles/dimensions-panel.js +1 -3
  47. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  48. package/build/components/global-styles/global-styles-provider.js +8 -10
  49. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  50. package/build/components/global-styles/gradients-palette-panel.js +3 -4
  51. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  52. package/build/components/global-styles/header.js +4 -5
  53. package/build/components/global-styles/header.js.map +1 -1
  54. package/build/components/global-styles/icon-with-current-color.js +4 -5
  55. package/build/components/global-styles/icon-with-current-color.js.map +1 -1
  56. package/build/components/global-styles/navigation-button.js +5 -6
  57. package/build/components/global-styles/navigation-button.js.map +1 -1
  58. package/build/components/global-styles/palette.js +10 -14
  59. package/build/components/global-styles/palette.js.map +1 -1
  60. package/build/components/global-styles/preview.js +41 -51
  61. package/build/components/global-styles/preview.js.map +1 -1
  62. package/build/components/global-styles/screen-block-list.js +4 -7
  63. package/build/components/global-styles/screen-block-list.js.map +1 -1
  64. package/build/components/global-styles/screen-block.js +88 -12
  65. package/build/components/global-styles/screen-block.js.map +1 -1
  66. package/build/components/global-styles/screen-color-palette.js +3 -4
  67. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  68. package/build/components/global-styles/screen-revisions/index.js +10 -17
  69. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  70. package/build/components/global-styles/screen-revisions/revisions-buttons.js +26 -33
  71. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  72. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +20 -35
  73. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  74. package/build/components/global-styles/screen-root.js +5 -5
  75. package/build/components/global-styles/screen-root.js.map +1 -1
  76. package/build/components/global-styles/screen-typography-element.js +3 -4
  77. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  78. package/build/components/global-styles/screen-typography.js +5 -6
  79. package/build/components/global-styles/screen-typography.js.map +1 -1
  80. package/build/components/global-styles/style-variations-container.js +11 -16
  81. package/build/components/global-styles/style-variations-container.js.map +1 -1
  82. package/build/components/global-styles/subtitle.js +4 -5
  83. package/build/components/global-styles/subtitle.js.map +1 -1
  84. package/build/components/global-styles/typography-panel.js +4 -5
  85. package/build/components/global-styles/typography-panel.js.map +1 -1
  86. package/build/components/global-styles/typography-preview.js +5 -6
  87. package/build/components/global-styles/typography-preview.js.map +1 -1
  88. package/build/components/global-styles/ui.js +49 -30
  89. package/build/components/global-styles/ui.js.map +1 -1
  90. package/build/components/global-styles/variations-panel.js +5 -6
  91. package/build/components/global-styles/variations-panel.js.map +1 -1
  92. package/build/components/header-edit-mode/document-actions/index.js +99 -95
  93. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  94. package/build/components/header-edit-mode/index.js +16 -7
  95. package/build/components/header-edit-mode/index.js.map +1 -1
  96. package/build/components/header-edit-mode/more-menu/index.js +49 -53
  97. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  98. package/build/components/header-edit-mode/tools-more-menu-group/index.js +5 -14
  99. package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -1
  100. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
  101. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  102. package/build/components/keyboard-shortcut-help-modal/index.js +41 -51
  103. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  104. package/build/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
  105. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  106. package/build/components/layout/hooks.js +54 -0
  107. package/build/components/layout/hooks.js.map +1 -0
  108. package/build/components/layout/index.js +33 -94
  109. package/build/components/layout/index.js.map +1 -1
  110. package/build/components/list/added-by.js +13 -23
  111. package/build/components/list/added-by.js.map +1 -1
  112. package/build/components/list/header.js +4 -7
  113. package/build/components/list/header.js.map +1 -1
  114. package/build/components/list/index.js +2 -4
  115. package/build/components/list/index.js.map +1 -1
  116. package/build/components/list/table.js +35 -40
  117. package/build/components/list/table.js.map +1 -1
  118. package/build/components/page-actions/delete-page-menu-item.js +70 -0
  119. package/build/components/page-actions/delete-page-menu-item.js.map +1 -0
  120. package/build/components/page-actions/index.js +43 -0
  121. package/build/components/page-actions/index.js.map +1 -0
  122. package/build/components/page-content-lock/constants.js +9 -0
  123. package/build/components/page-content-lock/constants.js.map +1 -0
  124. package/build/components/page-content-lock/index.js +29 -0
  125. package/build/components/page-content-lock/index.js.map +1 -0
  126. package/build/components/page-content-lock/use-disable-non-content-blocks.js +49 -0
  127. package/build/components/page-content-lock/use-disable-non-content-blocks.js.map +1 -0
  128. package/build/components/page-content-lock/use-page-content-lock-notifications.js +112 -0
  129. package/build/components/page-content-lock/use-page-content-lock-notifications.js.map +1 -0
  130. package/build/components/preferences-modal/index.js +4 -5
  131. package/build/components/preferences-modal/index.js.map +1 -1
  132. package/build/components/resizable-frame/index.js +250 -0
  133. package/build/components/resizable-frame/index.js.map +1 -0
  134. package/build/components/revisions/index.js +13 -15
  135. package/build/components/revisions/index.js.map +1 -1
  136. package/build/components/routes/link.js +8 -12
  137. package/build/components/routes/link.js.map +1 -1
  138. package/build/components/routes/use-title.js +1 -5
  139. package/build/components/routes/use-title.js.map +1 -1
  140. package/build/components/save-button/index.js +13 -7
  141. package/build/components/save-button/index.js.map +1 -1
  142. package/build/components/save-hub/index.js +97 -5
  143. package/build/components/save-hub/index.js.map +1 -1
  144. package/build/components/save-panel/index.js +63 -17
  145. package/build/components/save-panel/index.js.map +1 -1
  146. package/build/components/secondary-sidebar/list-view-sidebar.js +12 -6
  147. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  148. package/build/components/sidebar/index.js +11 -9
  149. package/build/components/sidebar/index.js.map +1 -1
  150. package/build/components/sidebar-edit-mode/default-sidebar.js +11 -12
  151. package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
  152. package/build/components/sidebar-edit-mode/index.js +13 -10
  153. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  154. package/build/components/sidebar-edit-mode/page-panels/content-blocks-list.js +79 -0
  155. package/build/components/sidebar-edit-mode/page-panels/content-blocks-list.js.map +1 -0
  156. package/build/components/sidebar-edit-mode/page-panels/index.js +86 -0
  157. package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -0
  158. package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +4 -5
  159. package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
  160. package/build/components/sidebar-edit-mode/settings-header/index.js +39 -21
  161. package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  162. package/build/components/sidebar-edit-mode/sidebar-card/index.js +46 -0
  163. package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -0
  164. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +3 -4
  165. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
  166. package/build/components/sidebar-edit-mode/{template-card → template-panel}/index.js +22 -18
  167. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -0
  168. package/build/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +7 -8
  169. package/build/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -0
  170. package/build/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +12 -16
  171. package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -0
  172. package/build/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +15 -19
  173. package/build/components/sidebar-edit-mode/template-panel/template-areas.js.map +1 -0
  174. package/build/components/sidebar-navigation-item/index.js +7 -8
  175. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  176. package/build/components/sidebar-navigation-screen/index.js +21 -14
  177. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  178. package/build/components/sidebar-navigation-screen-global-styles/index.js +166 -12
  179. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  180. package/build/components/sidebar-navigation-screen-main/index.js +24 -33
  181. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  182. package/build/components/sidebar-navigation-screen-navigation-item/index.js +3 -5
  183. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  184. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +159 -0
  185. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
  186. package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +17 -0
  187. package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
  188. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +51 -107
  189. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  190. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +84 -0
  191. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
  192. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +16 -74
  193. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  194. package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +52 -0
  195. package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
  196. package/build/components/sidebar-navigation-screen-page/index.js +81 -10
  197. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
  198. package/build/components/sidebar-navigation-screen-page/page-details.js +148 -0
  199. package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -0
  200. package/build/components/sidebar-navigation-screen-page/status-label.js +110 -0
  201. package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -0
  202. package/build/components/sidebar-navigation-screen-pages/index.js +128 -17
  203. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  204. package/build/components/sidebar-navigation-screen-template/index.js +22 -16
  205. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  206. package/build/components/sidebar-navigation-screen-template-part/index.js +105 -0
  207. package/build/components/sidebar-navigation-screen-template-part/index.js.map +1 -0
  208. package/build/components/sidebar-navigation-screen-templates/index.js +44 -24
  209. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  210. package/build/components/sidebar-navigation-subtitle/index.js +3 -4
  211. package/build/components/sidebar-navigation-subtitle/index.js.map +1 -1
  212. package/build/components/site-hub/index.js +20 -15
  213. package/build/components/site-hub/index.js.map +1 -1
  214. package/build/components/site-icon/index.js +4 -5
  215. package/build/components/site-icon/index.js.map +1 -1
  216. package/build/components/start-template-options/index.js +15 -21
  217. package/build/components/start-template-options/index.js.map +1 -1
  218. package/build/components/style-book/index.js +107 -37
  219. package/build/components/style-book/index.js.map +1 -1
  220. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
  221. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  222. package/build/components/sync-state-with-url/use-sync-path-with-url.js +9 -10
  223. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  224. package/build/components/{list/actions → template-actions}/index.js +39 -33
  225. package/build/components/template-actions/index.js.map +1 -0
  226. package/build/components/{list/actions → template-actions}/rename-menu-item.js +4 -5
  227. package/build/components/template-actions/rename-menu-item.js.map +1 -0
  228. package/build/components/template-part-converter/convert-to-regular.js +4 -5
  229. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  230. package/build/components/template-part-converter/convert-to-template-part.js +8 -10
  231. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  232. package/build/components/template-part-converter/index.js +12 -18
  233. package/build/components/template-part-converter/index.js.map +1 -1
  234. package/build/components/use-edited-entity-record/index.js +8 -4
  235. package/build/components/use-edited-entity-record/index.js.map +1 -1
  236. package/build/components/welcome-guide/image.js +4 -5
  237. package/build/components/welcome-guide/image.js.map +1 -1
  238. package/build/hooks/commands/use-edit-mode-commands.js +103 -0
  239. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -0
  240. package/build/hooks/push-changes-to-global-styles/index.js +11 -8
  241. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  242. package/build/hooks/template-part-edit.js +5 -6
  243. package/build/hooks/template-part-edit.js.map +1 -1
  244. package/build/index.js +3 -6
  245. package/build/index.js.map +1 -1
  246. package/build/store/actions.js +131 -125
  247. package/build/store/actions.js.map +1 -1
  248. package/build/store/private-actions.js +7 -10
  249. package/build/store/private-actions.js.map +1 -1
  250. package/build/store/reducer.js +32 -33
  251. package/build/store/reducer.js.map +1 -1
  252. package/build/store/selectors.js +35 -11
  253. package/build/store/selectors.js.map +1 -1
  254. package/build/store/utils.js +1 -3
  255. package/build/store/utils.js.map +1 -1
  256. package/build/utils/get-is-list-page.js +3 -4
  257. package/build/utils/get-is-list-page.js.map +1 -1
  258. package/build/utils/is-previewing-theme.js +1 -3
  259. package/build/utils/is-previewing-theme.js.map +1 -1
  260. package/build/utils/is-template-revertable.js +1 -1
  261. package/build/utils/is-template-revertable.js.map +1 -1
  262. package/build-module/components/add-new-page/index.js +93 -0
  263. package/build-module/components/add-new-page/index.js.map +1 -0
  264. package/build-module/components/add-new-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +10 -23
  265. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
  266. package/build-module/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +30 -42
  267. package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
  268. package/build-module/components/add-new-template/index.js +4 -5
  269. package/build-module/components/add-new-template/index.js.map +1 -1
  270. package/build-module/components/add-new-template/new-template-part.js +9 -12
  271. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  272. package/build-module/components/add-new-template/new-template.js +105 -82
  273. package/build-module/components/add-new-template/new-template.js.map +1 -1
  274. package/build-module/components/add-new-template/utils.js +71 -120
  275. package/build-module/components/add-new-template/utils.js.map +1 -1
  276. package/build-module/components/block-editor/back-button.js +1 -3
  277. package/build-module/components/block-editor/back-button.js.map +1 -1
  278. package/build-module/components/block-editor/block-inspector-button.js +3 -4
  279. package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
  280. package/build-module/components/block-editor/editor-canvas.js +6 -7
  281. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  282. package/build-module/components/block-editor/index.js +13 -13
  283. package/build-module/components/block-editor/index.js.map +1 -1
  284. package/build-module/components/block-editor/inserter-media-categories.js +25 -42
  285. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
  286. package/build-module/components/block-editor/resizable-editor.js +6 -7
  287. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  288. package/build-module/components/block-editor/resize-handle.js +5 -7
  289. package/build-module/components/block-editor/resize-handle.js.map +1 -1
  290. package/build-module/components/code-editor/code-editor-text-area.js +5 -6
  291. package/build-module/components/code-editor/code-editor-text-area.js.map +1 -1
  292. package/build-module/components/create-template-part-modal/index.js +31 -36
  293. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  294. package/build-module/components/editor/index.js +38 -56
  295. package/build-module/components/editor/index.js.map +1 -1
  296. package/build-module/components/editor-canvas-container/index.js +12 -9
  297. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  298. package/build-module/components/error-boundary/warning.js +8 -10
  299. package/build-module/components/error-boundary/warning.js.map +1 -1
  300. package/build-module/components/global-styles/block-preview-panel.js +7 -10
  301. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  302. package/build-module/components/global-styles/color-indicator-wrapper.js +4 -5
  303. package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -1
  304. package/build-module/components/global-styles/color-palette-panel.js +3 -4
  305. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  306. package/build-module/components/global-styles/dimensions-panel.js +1 -3
  307. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  308. package/build-module/components/global-styles/global-styles-provider.js +8 -10
  309. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  310. package/build-module/components/global-styles/gradients-palette-panel.js +3 -4
  311. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  312. package/build-module/components/global-styles/header.js +4 -5
  313. package/build-module/components/global-styles/header.js.map +1 -1
  314. package/build-module/components/global-styles/icon-with-current-color.js +4 -5
  315. package/build-module/components/global-styles/icon-with-current-color.js.map +1 -1
  316. package/build-module/components/global-styles/navigation-button.js +5 -6
  317. package/build-module/components/global-styles/navigation-button.js.map +1 -1
  318. package/build-module/components/global-styles/palette.js +10 -14
  319. package/build-module/components/global-styles/palette.js.map +1 -1
  320. package/build-module/components/global-styles/preview.js +41 -51
  321. package/build-module/components/global-styles/preview.js.map +1 -1
  322. package/build-module/components/global-styles/screen-block-list.js +4 -7
  323. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  324. package/build-module/components/global-styles/screen-block.js +90 -13
  325. package/build-module/components/global-styles/screen-block.js.map +1 -1
  326. package/build-module/components/global-styles/screen-color-palette.js +3 -4
  327. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  328. package/build-module/components/global-styles/screen-revisions/index.js +10 -17
  329. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  330. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +26 -34
  331. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  332. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +20 -34
  333. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  334. package/build-module/components/global-styles/screen-root.js +5 -5
  335. package/build-module/components/global-styles/screen-root.js.map +1 -1
  336. package/build-module/components/global-styles/screen-typography-element.js +3 -4
  337. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  338. package/build-module/components/global-styles/screen-typography.js +5 -6
  339. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  340. package/build-module/components/global-styles/style-variations-container.js +12 -17
  341. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  342. package/build-module/components/global-styles/subtitle.js +4 -5
  343. package/build-module/components/global-styles/subtitle.js.map +1 -1
  344. package/build-module/components/global-styles/typography-panel.js +4 -5
  345. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  346. package/build-module/components/global-styles/typography-preview.js +5 -6
  347. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  348. package/build-module/components/global-styles/ui.js +50 -31
  349. package/build-module/components/global-styles/ui.js.map +1 -1
  350. package/build-module/components/global-styles/variations-panel.js +5 -6
  351. package/build-module/components/global-styles/variations-panel.js.map +1 -1
  352. package/build-module/components/header-edit-mode/document-actions/index.js +99 -97
  353. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  354. package/build-module/components/header-edit-mode/index.js +16 -8
  355. package/build-module/components/header-edit-mode/index.js.map +1 -1
  356. package/build-module/components/header-edit-mode/more-menu/index.js +49 -53
  357. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  358. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +5 -13
  359. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -1
  360. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
  361. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  362. package/build-module/components/keyboard-shortcut-help-modal/index.js +39 -49
  363. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  364. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
  365. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  366. package/build-module/components/layout/hooks.js +41 -0
  367. package/build-module/components/layout/hooks.js.map +1 -0
  368. package/build-module/components/layout/index.js +34 -97
  369. package/build-module/components/layout/index.js.map +1 -1
  370. package/build-module/components/list/added-by.js +13 -23
  371. package/build-module/components/list/added-by.js.map +1 -1
  372. package/build-module/components/list/header.js +4 -7
  373. package/build-module/components/list/header.js.map +1 -1
  374. package/build-module/components/list/index.js +2 -4
  375. package/build-module/components/list/index.js.map +1 -1
  376. package/build-module/components/list/table.js +34 -39
  377. package/build-module/components/list/table.js.map +1 -1
  378. package/build-module/components/page-actions/delete-page-menu-item.js +58 -0
  379. package/build-module/components/page-actions/delete-page-menu-item.js.map +1 -0
  380. package/build-module/components/page-actions/index.js +30 -0
  381. package/build-module/components/page-actions/index.js.map +1 -0
  382. package/build-module/components/page-content-lock/constants.js +2 -0
  383. package/build-module/components/page-content-lock/constants.js.map +1 -0
  384. package/build-module/components/page-content-lock/index.js +14 -0
  385. package/build-module/components/page-content-lock/index.js.map +1 -0
  386. package/build-module/components/page-content-lock/use-disable-non-content-blocks.js +36 -0
  387. package/build-module/components/page-content-lock/use-disable-non-content-blocks.js.map +1 -0
  388. package/build-module/components/page-content-lock/use-page-content-lock-notifications.js +98 -0
  389. package/build-module/components/page-content-lock/use-page-content-lock-notifications.js.map +1 -0
  390. package/build-module/components/preferences-modal/index.js +4 -5
  391. package/build-module/components/preferences-modal/index.js.map +1 -1
  392. package/build-module/components/resizable-frame/index.js +236 -0
  393. package/build-module/components/resizable-frame/index.js.map +1 -0
  394. package/build-module/components/revisions/index.js +13 -14
  395. package/build-module/components/revisions/index.js.map +1 -1
  396. package/build-module/components/routes/link.js +8 -12
  397. package/build-module/components/routes/link.js.map +1 -1
  398. package/build-module/components/routes/use-title.js +1 -5
  399. package/build-module/components/routes/use-title.js.map +1 -1
  400. package/build-module/components/save-button/index.js +13 -7
  401. package/build-module/components/save-button/index.js.map +1 -1
  402. package/build-module/components/save-hub/index.js +95 -8
  403. package/build-module/components/save-hub/index.js.map +1 -1
  404. package/build-module/components/save-panel/index.js +62 -19
  405. package/build-module/components/save-panel/index.js.map +1 -1
  406. package/build-module/components/secondary-sidebar/list-view-sidebar.js +12 -6
  407. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  408. package/build-module/components/sidebar/index.js +9 -8
  409. package/build-module/components/sidebar/index.js.map +1 -1
  410. package/build-module/components/sidebar-edit-mode/default-sidebar.js +11 -12
  411. package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
  412. package/build-module/components/sidebar-edit-mode/index.js +14 -11
  413. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  414. package/build-module/components/sidebar-edit-mode/page-panels/content-blocks-list.js +67 -0
  415. package/build-module/components/sidebar-edit-mode/page-panels/content-blocks-list.js.map +1 -0
  416. package/build-module/components/sidebar-edit-mode/page-panels/index.js +67 -0
  417. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -0
  418. package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +4 -5
  419. package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
  420. package/build-module/components/sidebar-edit-mode/settings-header/index.js +36 -22
  421. package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  422. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +35 -0
  423. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -0
  424. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +3 -4
  425. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
  426. package/build-module/components/sidebar-edit-mode/{template-card → template-panel}/index.js +20 -19
  427. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -0
  428. package/build-module/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +7 -8
  429. package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -0
  430. package/build-module/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +12 -16
  431. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -0
  432. package/build-module/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +15 -19
  433. package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js.map +1 -0
  434. package/build-module/components/sidebar-navigation-item/index.js +7 -8
  435. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  436. package/build-module/components/sidebar-navigation-screen/index.js +22 -15
  437. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  438. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +161 -15
  439. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  440. package/build-module/components/sidebar-navigation-screen-main/index.js +21 -32
  441. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  442. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +3 -5
  443. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  444. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +138 -0
  445. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
  446. package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +10 -0
  447. package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
  448. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +49 -106
  449. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  450. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +68 -0
  451. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
  452. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +14 -74
  453. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  454. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +39 -0
  455. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
  456. package/build-module/components/sidebar-navigation-screen-page/index.js +79 -14
  457. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
  458. package/build-module/components/sidebar-navigation-screen-page/page-details.js +131 -0
  459. package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -0
  460. package/build-module/components/sidebar-navigation-screen-page/status-label.js +97 -0
  461. package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -0
  462. package/build-module/components/sidebar-navigation-screen-pages/index.js +125 -19
  463. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  464. package/build-module/components/sidebar-navigation-screen-template/index.js +22 -17
  465. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  466. package/build-module/components/sidebar-navigation-screen-template-part/index.js +86 -0
  467. package/build-module/components/sidebar-navigation-screen-template-part/index.js.map +1 -0
  468. package/build-module/components/sidebar-navigation-screen-templates/index.js +43 -24
  469. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  470. package/build-module/components/sidebar-navigation-subtitle/index.js +3 -4
  471. package/build-module/components/sidebar-navigation-subtitle/index.js.map +1 -1
  472. package/build-module/components/site-hub/index.js +21 -16
  473. package/build-module/components/site-hub/index.js.map +1 -1
  474. package/build-module/components/site-icon/index.js +4 -5
  475. package/build-module/components/site-icon/index.js.map +1 -1
  476. package/build-module/components/start-template-options/index.js +15 -21
  477. package/build-module/components/start-template-options/index.js.map +1 -1
  478. package/build-module/components/style-book/index.js +107 -38
  479. package/build-module/components/style-book/index.js.map +1 -1
  480. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
  481. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  482. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +9 -10
  483. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  484. package/build-module/components/template-actions/index.js +92 -0
  485. package/build-module/components/template-actions/index.js.map +1 -0
  486. package/build-module/components/{list/actions → template-actions}/rename-menu-item.js +4 -5
  487. package/build-module/components/template-actions/rename-menu-item.js.map +1 -0
  488. package/build-module/components/template-part-converter/convert-to-regular.js +4 -5
  489. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  490. package/build-module/components/template-part-converter/convert-to-template-part.js +8 -10
  491. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  492. package/build-module/components/template-part-converter/index.js +12 -18
  493. package/build-module/components/template-part-converter/index.js.map +1 -1
  494. package/build-module/components/use-edited-entity-record/index.js +8 -4
  495. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  496. package/build-module/components/welcome-guide/image.js +4 -5
  497. package/build-module/components/welcome-guide/image.js.map +1 -1
  498. package/build-module/hooks/commands/use-edit-mode-commands.js +84 -0
  499. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -0
  500. package/build-module/hooks/push-changes-to-global-styles/index.js +11 -8
  501. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  502. package/build-module/hooks/template-part-edit.js +5 -6
  503. package/build-module/hooks/template-part-edit.js.map +1 -1
  504. package/build-module/index.js +3 -6
  505. package/build-module/index.js.map +1 -1
  506. package/build-module/store/actions.js +127 -126
  507. package/build-module/store/actions.js.map +1 -1
  508. package/build-module/store/private-actions.js +7 -10
  509. package/build-module/store/private-actions.js.map +1 -1
  510. package/build-module/store/reducer.js +30 -33
  511. package/build-module/store/reducer.js.map +1 -1
  512. package/build-module/store/selectors.js +31 -11
  513. package/build-module/store/selectors.js.map +1 -1
  514. package/build-module/store/utils.js +1 -3
  515. package/build-module/store/utils.js.map +1 -1
  516. package/build-module/utils/get-is-list-page.js +3 -4
  517. package/build-module/utils/get-is-list-page.js.map +1 -1
  518. package/build-module/utils/is-previewing-theme.js +1 -3
  519. package/build-module/utils/is-previewing-theme.js.map +1 -1
  520. package/build-module/utils/is-template-revertable.js +1 -1
  521. package/build-module/utils/is-template-revertable.js.map +1 -1
  522. package/build-style/style-rtl.css +477 -232
  523. package/build-style/style.css +478 -232
  524. package/package.json +40 -37
  525. package/src/components/add-new-page/index.js +105 -0
  526. package/src/components/add-new-template/add-custom-generic-template-modal-content.js +82 -0
  527. package/src/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +13 -26
  528. package/src/components/add-new-template/new-template.js +141 -154
  529. package/src/components/add-new-template/style.scss +79 -66
  530. package/src/components/block-editor/index.js +27 -17
  531. package/src/components/create-template-part-modal/index.js +19 -25
  532. package/src/components/editor/index.js +30 -53
  533. package/src/components/editor/style.scss +11 -1
  534. package/src/components/editor-canvas-container/index.js +28 -19
  535. package/src/components/global-styles/screen-block.js +74 -3
  536. package/src/components/global-styles/screen-revisions/index.js +3 -11
  537. package/src/components/global-styles/screen-revisions/revisions-buttons.js +33 -25
  538. package/src/components/global-styles/screen-revisions/style.scss +3 -2
  539. package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +16 -3
  540. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +22 -24
  541. package/src/components/global-styles/screen-root.js +5 -3
  542. package/src/components/global-styles/style-variations-container.js +13 -18
  543. package/src/components/global-styles/style.scss +3 -0
  544. package/src/components/global-styles/ui.js +39 -9
  545. package/src/components/header-edit-mode/document-actions/index.js +112 -121
  546. package/src/components/header-edit-mode/document-actions/style.scss +78 -54
  547. package/src/components/header-edit-mode/index.js +18 -0
  548. package/src/components/header-edit-mode/style.scss +1 -0
  549. package/src/components/header-edit-mode/tools-more-menu-group/index.js +1 -6
  550. package/src/components/layout/hooks.js +46 -0
  551. package/src/components/layout/index.js +47 -122
  552. package/src/components/layout/style.scss +8 -2
  553. package/src/components/list/style.scss +1 -0
  554. package/src/components/list/table.js +6 -2
  555. package/src/components/page-actions/delete-page-menu-item.js +71 -0
  556. package/src/components/page-actions/index.js +36 -0
  557. package/src/components/page-content-lock/constants.js +5 -0
  558. package/src/components/page-content-lock/index.js +14 -0
  559. package/src/components/page-content-lock/use-disable-non-content-blocks.js +44 -0
  560. package/src/components/page-content-lock/use-page-content-lock-notifications.js +128 -0
  561. package/src/components/resizable-frame/index.js +263 -0
  562. package/src/components/resizable-frame/style.scss +71 -0
  563. package/src/components/revisions/index.js +7 -7
  564. package/src/components/save-button/index.js +6 -0
  565. package/src/components/save-hub/index.js +143 -38
  566. package/src/components/save-hub/style.scss +6 -0
  567. package/src/components/save-panel/index.js +62 -15
  568. package/src/components/secondary-sidebar/list-view-sidebar.js +10 -2
  569. package/src/components/sidebar/index.js +10 -8
  570. package/src/components/sidebar/style.scss +3 -4
  571. package/src/components/sidebar-edit-mode/index.js +16 -14
  572. package/src/components/sidebar-edit-mode/page-panels/content-blocks-list.js +77 -0
  573. package/src/components/sidebar-edit-mode/page-panels/index.js +89 -0
  574. package/src/components/sidebar-edit-mode/page-panels/style.scss +10 -0
  575. package/src/components/sidebar-edit-mode/settings-header/index.js +51 -28
  576. package/src/components/sidebar-edit-mode/sidebar-card/index.js +34 -0
  577. package/src/components/sidebar-edit-mode/sidebar-card/style.scss +34 -0
  578. package/src/components/sidebar-edit-mode/{template-card → template-panel}/index.js +22 -19
  579. package/src/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +1 -2
  580. package/src/components/sidebar-edit-mode/{template-card → template-panel}/style.scss +2 -32
  581. package/src/components/sidebar-navigation-item/style.scss +9 -0
  582. package/src/components/sidebar-navigation-screen/index.js +74 -50
  583. package/src/components/sidebar-navigation-screen/style.scss +46 -6
  584. package/src/components/sidebar-navigation-screen-global-styles/index.js +212 -21
  585. package/src/components/sidebar-navigation-screen-global-styles/style.scss +15 -0
  586. package/src/components/sidebar-navigation-screen-main/index.js +35 -52
  587. package/src/components/sidebar-navigation-screen-navigation-menu/index.js +157 -0
  588. package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +9 -0
  589. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +63 -117
  590. package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +83 -0
  591. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +6 -72
  592. package/src/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +47 -0
  593. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +7 -21
  594. package/src/components/sidebar-navigation-screen-page/index.js +137 -24
  595. package/src/components/sidebar-navigation-screen-page/page-details.js +163 -0
  596. package/src/components/sidebar-navigation-screen-page/status-label.js +101 -0
  597. package/src/components/sidebar-navigation-screen-page/style.scss +80 -0
  598. package/src/components/sidebar-navigation-screen-pages/index.js +180 -44
  599. package/src/components/sidebar-navigation-screen-template/index.js +25 -22
  600. package/src/components/sidebar-navigation-screen-template-part/index.js +103 -0
  601. package/src/components/sidebar-navigation-screen-templates/index.js +52 -13
  602. package/src/components/sidebar-navigation-subtitle/style.scss +2 -2
  603. package/src/components/site-hub/index.js +29 -15
  604. package/src/components/site-hub/style.scss +26 -0
  605. package/src/components/start-template-options/style.scss +20 -21
  606. package/src/components/style-book/index.js +132 -43
  607. package/src/components/style-book/style.scss +19 -0
  608. package/src/components/{list/actions → template-actions}/index.js +31 -11
  609. package/src/components/use-edited-entity-record/index.js +12 -3
  610. package/src/hooks/commands/use-edit-mode-commands.js +79 -0
  611. package/src/hooks/push-changes-to-global-styles/index.js +13 -7
  612. package/src/store/actions.js +24 -6
  613. package/src/store/reducer.js +20 -0
  614. package/src/store/selectors.js +24 -0
  615. package/src/store/test/actions.js +31 -0
  616. package/src/store/test/reducer.js +44 -0
  617. package/src/store/test/selectors.js +57 -0
  618. package/src/store/test/utils.js +15 -5
  619. package/src/style.scss +6 -3
  620. package/src/utils/is-previewing-theme.js +1 -4
  621. package/build/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
  622. package/build/components/add-new-template/add-custom-template-modal.js.map +0 -1
  623. package/build/components/global-styles/border-panel.js +0 -135
  624. package/build/components/global-styles/border-panel.js.map +0 -1
  625. package/build/components/list/actions/index.js.map +0 -1
  626. package/build/components/list/actions/rename-menu-item.js.map +0 -1
  627. package/build/components/navigate-to-link/index.js +0 -51
  628. package/build/components/navigate-to-link/index.js.map +0 -1
  629. package/build/components/sidebar-edit-mode/template-card/index.js.map +0 -1
  630. package/build/components/sidebar-edit-mode/template-card/template-actions.js.map +0 -1
  631. package/build/components/sidebar-edit-mode/template-card/template-areas.js.map +0 -1
  632. package/build/components/sidebar-edit-mode/template-revisions/index.js.map +0 -1
  633. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -19
  634. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
  635. package/build/components/template-details/edit-template-title.js +0 -42
  636. package/build/components/template-details/edit-template-title.js.map +0 -1
  637. package/build/components/template-details/index.js +0 -103
  638. package/build/components/template-details/index.js.map +0 -1
  639. package/build/components/template-details/template-areas.js +0 -166
  640. package/build/components/template-details/template-areas.js.map +0 -1
  641. package/build/components/template-details/template-part-area-selector.js +0 -48
  642. package/build/components/template-details/template-part-area-selector.js.map +0 -1
  643. package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
  644. package/build-module/components/add-new-template/add-custom-template-modal.js.map +0 -1
  645. package/build-module/components/global-styles/border-panel.js +0 -125
  646. package/build-module/components/global-styles/border-panel.js.map +0 -1
  647. package/build-module/components/list/actions/index.js +0 -86
  648. package/build-module/components/list/actions/index.js.map +0 -1
  649. package/build-module/components/list/actions/rename-menu-item.js.map +0 -1
  650. package/build-module/components/navigate-to-link/index.js +0 -39
  651. package/build-module/components/navigate-to-link/index.js.map +0 -1
  652. package/build-module/components/sidebar-edit-mode/template-card/index.js.map +0 -1
  653. package/build-module/components/sidebar-edit-mode/template-card/template-actions.js.map +0 -1
  654. package/build-module/components/sidebar-edit-mode/template-card/template-areas.js.map +0 -1
  655. package/build-module/components/sidebar-edit-mode/template-revisions/index.js.map +0 -1
  656. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -11
  657. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
  658. package/build-module/components/template-details/edit-template-title.js +0 -33
  659. package/build-module/components/template-details/edit-template-title.js.map +0 -1
  660. package/build-module/components/template-details/index.js +0 -83
  661. package/build-module/components/template-details/index.js.map +0 -1
  662. package/build-module/components/template-details/template-areas.js +0 -145
  663. package/build-module/components/template-details/template-areas.js.map +0 -1
  664. package/build-module/components/template-details/template-part-area-selector.js +0 -36
  665. package/build-module/components/template-details/template-part-area-selector.js.map +0 -1
  666. package/src/components/add-new-template/add-custom-generic-template-modal.js +0 -101
  667. package/src/components/global-styles/border-panel.js +0 -114
  668. package/src/components/navigate-to-link/index.js +0 -46
  669. package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -9
  670. package/src/components/sidebar-navigation-screen-pages/style.scss +0 -4
  671. package/src/components/template-details/edit-template-title.js +0 -41
  672. package/src/components/template-details/index.js +0 -113
  673. package/src/components/template-details/style.scss +0 -72
  674. package/src/components/template-details/template-areas.js +0 -167
  675. package/src/components/template-details/template-part-area-selector.js +0 -39
  676. /package/src/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +0 -0
  677. /package/src/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +0 -0
  678. /package/src/components/{list/actions → template-actions}/rename-menu-item.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-block-list.js"],"names":["useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","blockEditorPrivateApis","useSortedBlockTypes","blockItems","select","blocksStore","getBlockTypes","groupByType","blocks","block","core","noncore","type","name","startsWith","push","coreItems","nonCoreItems","reduce","useBlockHasGlobalStyles","blockName","rawSettings","settings","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","hasVariationsPanel","length","hasGlobalStyles","BlockMenuItem","hasBlockMenuItem","navigationButtonLabel","title","encodeURIComponent","icon","ScreenBlockList","sortedBlockTypes","filterValue","setFilterValue","debouncedSpeak","speak","isMatchingSearchTerm","filteredBlockTypes","filter","blockType","blockTypesListRef","count","current","childElementCount","resultsFoundMessage","map"],"mappings":";;;;;;;;;;AAWA;;AARA;;AACA;;AACA;;AAKA;;AAEA;;AAIA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAiBA;AACA;AACA;AAMA,MAAM;AACLA,EAAAA,qBADK;AAELC,EAAAA,qBAFK;AAGLC,EAAAA,iBAHK;AAILC,EAAAA,gBAJK;AAKLC,EAAAA,0BALK;AAMLC,EAAAA;AANK,IAOF,yBAAQC,wBAAR,CAPJ;;AASA,SAASC,mBAAT,GAA+B;AAC9B,QAAMC,UAAU,GAAG,qBAChBC,MAAF,IAAcA,MAAM,CAAEC,aAAF,CAAN,CAAsBC,aAAtB,EADI,EAElB,EAFkB,CAAnB,CAD8B,CAK9B;AACA;AACA;AACA;AACA;;AACA,QAAMC,WAAW,GAAG,CAAEC,MAAF,EAAUC,KAAV,KAAqB;AACxC,UAAM;AAAEC,MAAAA,IAAF;AAAQC,MAAAA;AAAR,QAAoBH,MAA1B;AACA,UAAMI,IAAI,GAAGH,KAAK,CAACI,IAAN,CAAWC,UAAX,CAAuB,OAAvB,IAAmCJ,IAAnC,GAA0CC,OAAvD;AACAC,IAAAA,IAAI,CAACG,IAAL,CAAWN,KAAX;AACA,WAAOD,MAAP;AACA,GALD;;AAMA,QAAM;AAAEE,IAAAA,IAAI,EAAEM,SAAR;AAAmBL,IAAAA,OAAO,EAAEM;AAA5B,MAA6Cd,UAAU,CAACe,MAAX,CAClDX,WADkD,EAElD;AAAEG,IAAAA,IAAI,EAAE,EAAR;AAAYC,IAAAA,OAAO,EAAE;AAArB,GAFkD,CAAnD;AAIA,SAAO,CAAE,GAAGK,SAAL,EAAgB,GAAGC,YAAnB,CAAP;AACA;;AAEM,SAASE,uBAAT,CAAkCC,SAAlC,EAA8C;AAAA;;AACpD,QAAM,CAAEC,WAAF,IAAkBvB,gBAAgB,CAAE,EAAF,EAAMsB,S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C,IAAA,KAAK,EAAG,cAAI,mBAAJ,CALT;AAMC,IAAA,WAAW,EAAG,cAAI,QAAJ;AANf,IAPD,EAeC;AACC,IAAA,GAAG,EAAGQ,iBADP;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGH,kBAAkB,CAACQ,GAAnB,CAA0B3C,KAAF,IACzB,4BAAC,aAAD;AACC,IAAA,KAAK,EAAGA,KADT;AAEC,IAAA,GAAG,EAAG,oBAAoBA,KAAK,CAACI;AAFjC,IADC,CAJH,CAfD,CADD;AA6BA;;eAEcwB,e","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport {\n\tFlexItem,\n\tSearchControl,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo, useEffect, useRef } from '@wordpress/element';\nimport {\n\tBlockIcon,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { useBlockVariations } from './variations-panel';\nimport ScreenHeader from './header';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { unlock } from '../../private-apis';\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction useSortedBlockTypes() {\n\tconst blockItems = useSelect(\n\t\t( select ) => select( blocksStore ).getBlockTypes(),\n\t\t[]\n\t);\n\t// Ensure core blocks are prioritized in the returned results,\n\t// because third party blocks can be registered earlier than\n\t// the core blocks (usually by using the `init` action),\n\t// thus affecting the display order.\n\t// We don't sort reusable blocks as they are handled differently.\n\tconst groupByType = ( blocks, block ) => {\n\t\tconst { core, noncore } = blocks;\n\t\tconst type = block.name.startsWith( 'core/' ) ? core : noncore;\n\t\ttype.push( block );\n\t\treturn blocks;\n\t};\n\tconst { core: coreItems, noncore: nonCoreItems } = blockItems.reduce(\n\t\tgroupByType,\n\t\t{ core: [], noncore: [] }\n\t);\n\treturn [ ...coreItems, ...nonCoreItems ];\n}\n\nexport function useBlockHasGlobalStyles( blockName ) {\n\tconst [ rawSettings ] = useGlobalSetting( '', blockName );\n\tconst settings = useSettingsForBlockElement( rawSettings, blockName );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;\n\tconst hasVariationsPanel = !! useBlockVariations( blockName )?.length;\n\tconst hasGlobalStyles =\n\t\thasTypographyPanel ||\n\t\thasColorPanel ||\n\t\thasLayoutPanel ||\n\t\thasVariationsPanel;\n\treturn hasGlobalStyles;\n}\n\nfunction BlockMenuItem( { block } ) {\n\tconst hasBlockMenuItem = useBlockHasGlobalStyles( block.name );\n\tif ( ! hasBlockMenuItem ) {\n\t\treturn null;\n\t}\n\n\tconst navigationButtonLabel = sprintf(\n\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t__( '%s block styles' ),\n\t\tblock.title\n\t);\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\taria-label={ navigationButtonLabel }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<BlockIcon icon={ block.icon } />\n\t\t\t\t<FlexItem>{ block.title }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction ScreenBlockList() {\n\tconst sortedBlockTypes = useSortedBlockTypes();\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst isMatchingSearchTerm = useSelect(\n\t\t( select ) => select( blocksStore ).isMatchingSearchTerm,\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn sortedBlockTypes;\n\t\t}\n\t\treturn sortedBlockTypes.filter( ( blockType ) =>\n\t\t\tisMatchingSearchTerm( blockType, filterValue )\n\t\t);\n\t}, [ filterValue, sortedBlockTypes, isMatchingSearchTerm ] );\n\n\tconst blockTypesListRef = useRef();\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\t// We extract the results from the wrapper div's `ref` because\n\t\t// filtered items can contain items that will eventually not\n\t\t// render and there is no reliable way to detect when a child\n\t\t// will return `null`.\n\t\t// TODO: We should find a better way of handling this as it's\n\t\t// fragile and depends on the number of rendered elements of `BlockMenuItem`,\n\t\t// which is now one.\n\t\t// @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116\n\t\tconst count = blockTypesListRef.current.childElementCount;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage, count );\n\t}, [ filterValue, debouncedSpeak ] );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Blocks' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Customize the appearance of specific blocks and for the whole site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tclassName=\"edit-site-block-types-search\"\n\t\t\t\tonChange={ setFilterValue }\n\t\t\t\tvalue={ filterValue }\n\t\t\t\tlabel={ __( 'Search for blocks' ) }\n\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tref={ blockTypesListRef }\n\t\t\t\tclassName=\"edit-site-block-types-item-list\"\n\t\t\t>\n\t\t\t\t{ filteredBlockTypes.map( ( block ) => (\n\t\t\t\t\t<BlockMenuItem\n\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\tkey={ 'menu-itemblock-' + block.name }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenBlockList;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-block-list.js"],"names":["useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","blockEditorPrivateApis","useSortedBlockTypes","blockItems","select","blocksStore","getBlockTypes","groupByType","blocks","block","core","noncore","type","name","startsWith","push","coreItems","nonCoreItems","reduce","useBlockHasGlobalStyles","blockName","rawSettings","settings","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","hasVariationsPanel","length","hasGlobalStyles","BlockMenuItem","hasBlockMenuItem","navigationButtonLabel","title","encodeURIComponent","icon","ScreenBlockList","sortedBlockTypes","filterValue","setFilterValue","debouncedSpeak","speak","isMatchingSearchTerm","filteredBlockTypes","filter","blockType","blockTypesListRef","count","current","childElementCount","resultsFoundMessage","map"],"mappings":";;;;;;;;;;AAWA;;AARA;;AACA;;AACA;;AAKA;;AAEA;;AAIA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAiBA;AACA;AACA;AAMA,MAAM;AACLA,EAAAA,qBADK;AAELC,EAAAA,qBAFK;AAGLC,EAAAA,iBAHK;AAILC,EAAAA,gBAJK;AAKLC,EAAAA,0BALK;AAMLC,EAAAA;AANK,IAOF,yBAAQC,wBAAR,CAPJ;;AASA,SAASC,mBAAT,GAA+B;AAC9B,QAAMC,UAAU,GAAG,qBAChBC,MAAF,IAAcA,MAAM,CAAEC,aAAF,CAAN,CAAsBC,aAAtB,EADI,EAElB,EAFkB,CAAnB,CAD8B,CAK9B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AjB0B,CAmB1B;;AACA,0BAAW,MAAM;AAChB,QAAK,CAAER,WAAP,EAAqB;AACpB;AACA,KAHe,CAIhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,UAAMS,KAAK,GAAGD,iBAAiB,CAACE,OAAlB,CAA0BC,iBAAxC;AACA,UAAMC,mBAAmB,GAAG;AAC3B;AACA,kBAAI,kBAAJ,EAAwB,mBAAxB,EAA6CH,KAA7C,CAF2B,EAG3BA,KAH2B,CAA5B;AAKAP,IAAAA,cAAc,CAAEU,mBAAF,EAAuBH,KAAvB,CAAd;AACA,GAnBD,EAmBG,CAAET,WAAF,EAAeE,cAAf,CAnBH;AAqBA,SACC,qDACC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,QAAJ,CADT;AAEC,IAAA,WAAW,EAAG,cACb,qEADa;AAFf,IADD,EAOC,4BAAC,yBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,SAAS,EAAC,8BAFX;AAGC,IAAA,QAAQ,EAAGD,cAHZ;AAIC,IAAA,KAAK,EAAGD,WAJT;AAKC,IAAA,KAAK,EAAG,cAAI,mBAAJ,CALT;AAMC,IAAA,WAAW,EAAG,cAAI,QAAJ;AANf,IAPD,EAeC;AACC,IAAA,GAAG,EAAGQ,iBADP;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGH,kBAAkB,CAACQ,GAAnB,CAA0B3C,KAAF,IACzB,4BAAC,aAAD;AACC,IAAA,KAAK,EAAGA,KADT;AAEC,IAAA,GAAG,EAAG,oBAAoBA,KAAK,CAACI;AAFjC,IADC,CAJH,CAfD,CADD;AA6BA;;eAEcwB,e","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport {\n\tFlexItem,\n\tSearchControl,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo, useEffect, useRef } from '@wordpress/element';\nimport {\n\tBlockIcon,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { useBlockVariations } from './variations-panel';\nimport ScreenHeader from './header';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { unlock } from '../../private-apis';\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction useSortedBlockTypes() {\n\tconst blockItems = useSelect(\n\t\t( select ) => select( blocksStore ).getBlockTypes(),\n\t\t[]\n\t);\n\t// Ensure core blocks are prioritized in the returned results,\n\t// because third party blocks can be registered earlier than\n\t// the core blocks (usually by using the `init` action),\n\t// thus affecting the display order.\n\t// We don't sort reusable blocks as they are handled differently.\n\tconst groupByType = ( blocks, block ) => {\n\t\tconst { core, noncore } = blocks;\n\t\tconst type = block.name.startsWith( 'core/' ) ? core : noncore;\n\t\ttype.push( block );\n\t\treturn blocks;\n\t};\n\tconst { core: coreItems, noncore: nonCoreItems } = blockItems.reduce(\n\t\tgroupByType,\n\t\t{ core: [], noncore: [] }\n\t);\n\treturn [ ...coreItems, ...nonCoreItems ];\n}\n\nexport function useBlockHasGlobalStyles( blockName ) {\n\tconst [ rawSettings ] = useGlobalSetting( '', blockName );\n\tconst settings = useSettingsForBlockElement( rawSettings, blockName );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;\n\tconst hasVariationsPanel = !! useBlockVariations( blockName )?.length;\n\tconst hasGlobalStyles =\n\t\thasTypographyPanel ||\n\t\thasColorPanel ||\n\t\thasLayoutPanel ||\n\t\thasVariationsPanel;\n\treturn hasGlobalStyles;\n}\n\nfunction BlockMenuItem( { block } ) {\n\tconst hasBlockMenuItem = useBlockHasGlobalStyles( block.name );\n\tif ( ! hasBlockMenuItem ) {\n\t\treturn null;\n\t}\n\n\tconst navigationButtonLabel = sprintf(\n\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t__( '%s block styles' ),\n\t\tblock.title\n\t);\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\taria-label={ navigationButtonLabel }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<BlockIcon icon={ block.icon } />\n\t\t\t\t<FlexItem>{ block.title }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction ScreenBlockList() {\n\tconst sortedBlockTypes = useSortedBlockTypes();\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst isMatchingSearchTerm = useSelect(\n\t\t( select ) => select( blocksStore ).isMatchingSearchTerm,\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn sortedBlockTypes;\n\t\t}\n\t\treturn sortedBlockTypes.filter( ( blockType ) =>\n\t\t\tisMatchingSearchTerm( blockType, filterValue )\n\t\t);\n\t}, [ filterValue, sortedBlockTypes, isMatchingSearchTerm ] );\n\n\tconst blockTypesListRef = useRef();\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\t// We extract the results from the wrapper div's `ref` because\n\t\t// filtered items can contain items that will eventually not\n\t\t// render and there is no reliable way to detect when a child\n\t\t// will return `null`.\n\t\t// TODO: We should find a better way of handling this as it's\n\t\t// fragile and depends on the number of rendered elements of `BlockMenuItem`,\n\t\t// which is now one.\n\t\t// @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116\n\t\tconst count = blockTypesListRef.current.childElementCount;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage, count );\n\t}, [ filterValue, debouncedSpeak ] );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Blocks' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Customize the appearance of specific blocks and for the whole site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tclassName=\"edit-site-block-types-search\"\n\t\t\t\tonChange={ setFilterValue }\n\t\t\t\tvalue={ filterValue }\n\t\t\t\tlabel={ __( 'Search for blocks' ) }\n\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tref={ blockTypesListRef }\n\t\t\t\tclassName=\"edit-site-block-types-item-list\"\n\t\t\t>\n\t\t\t\t{ filteredBlockTypes.map( ( block ) => (\n\t\t\t\t\t<BlockMenuItem\n\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\tkey={ 'menu-itemblock-' + block.name }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenBlockList;\n"]}
@@ -38,6 +38,43 @@ var _variationsPanel = require("./variations-panel");
38
38
  /**
39
39
  * Internal dependencies
40
40
  */
41
+ function applyFallbackStyle(border) {
42
+ if (!border) {
43
+ return border;
44
+ }
45
+
46
+ const hasColorOrWidth = border.color || border.width;
47
+
48
+ if (!border.style && hasColorOrWidth) {
49
+ return { ...border,
50
+ style: 'solid'
51
+ };
52
+ }
53
+
54
+ if (border.style && !hasColorOrWidth) {
55
+ return undefined;
56
+ }
57
+
58
+ return border;
59
+ }
60
+
61
+ function applyAllFallbackStyles(border) {
62
+ if (!border) {
63
+ return border;
64
+ }
65
+
66
+ if ((0, _components.__experimentalHasSplitBorders)(border)) {
67
+ return {
68
+ top: applyFallbackStyle(border.top),
69
+ right: applyFallbackStyle(border.right),
70
+ bottom: applyFallbackStyle(border.bottom),
71
+ left: applyFallbackStyle(border.left)
72
+ };
73
+ }
74
+
75
+ return applyFallbackStyle(border);
76
+ }
77
+
41
78
  const {
42
79
  useHasDimensionsPanel,
43
80
  useHasTypographyPanel,
@@ -57,11 +94,10 @@ const {
57
94
  AdvancedPanel: StylesAdvancedPanel
58
95
  } = (0, _privateApis.unlock)(_blockEditor.privateApis);
59
96
 
60
- function ScreenBlock(_ref) {
61
- let {
62
- name,
63
- variation
64
- } = _ref;
97
+ function ScreenBlock({
98
+ name,
99
+ variation
100
+ }) {
65
101
  let prefixParts = [];
66
102
 
67
103
  if (variation) {
@@ -85,11 +121,11 @@ function ScreenBlock(_ref) {
85
121
  const hasDimensionsPanel = useHasDimensionsPanel(settings);
86
122
  const hasEffectsPanel = useHasEffectsPanel(settings);
87
123
  const hasFiltersPanel = useHasFiltersPanel(settings);
88
- const hasVariationsPanel = !!(blockVariations !== null && blockVariations !== void 0 && blockVariations.length) && !variation;
124
+ const hasVariationsPanel = !!blockVariations?.length && !variation;
89
125
  const {
90
126
  canEditCSS
91
127
  } = (0, _data.useSelect)(select => {
92
- var _globalStyles$_links$, _globalStyles$_links;
128
+ var _globalStyles$_links$;
93
129
 
94
130
  const {
95
131
  getEntityRecord,
@@ -100,7 +136,7 @@ function ScreenBlock(_ref) {
100
136
 
101
137
  const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
102
138
  return {
103
- canEditCSS: (_globalStyles$_links$ = !!(globalStyles !== null && globalStyles !== void 0 && (_globalStyles$_links = globalStyles._links) !== null && _globalStyles$_links !== void 0 && _globalStyles$_links['wp:action-edit-css'])) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : false
139
+ canEditCSS: (_globalStyles$_links$ = !!globalStyles?._links?.['wp:action-edit-css']) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : false
104
140
  };
105
141
  }, []);
106
142
  const currentBlockStyle = variation ? blockVariations.find(s => s.name === variation) : null; // These intermediary objects are needed because the "layout" property is stored
@@ -130,6 +166,46 @@ function ScreenBlock(_ref) {
130
166
  }
131
167
  };
132
168
 
169
+ const onChangeBorders = newStyle => {
170
+ if (!newStyle?.border) {
171
+ setStyle(newStyle);
172
+ return;
173
+ } // As Global Styles can't conditionally generate styles based on if
174
+ // other style properties have been set, we need to force split
175
+ // border definitions for user set global border styles. Border
176
+ // radius is derived from the same property i.e. `border.radius` if
177
+ // it is a string that is used. The longhand border radii styles are
178
+ // only generated if that property is an object.
179
+ //
180
+ // For borders (color, style, and width) those are all properties on
181
+ // the `border` style property. This means if the theme.json defined
182
+ // split borders and the user condenses them into a flat border or
183
+ // vice-versa we'd get both sets of styles which would conflict.
184
+
185
+
186
+ const {
187
+ radius,
188
+ ...newBorder
189
+ } = newStyle.border;
190
+ const border = applyAllFallbackStyles(newBorder);
191
+ const updatedBorder = !(0, _components.__experimentalHasSplitBorders)(border) ? {
192
+ top: border,
193
+ right: border,
194
+ bottom: border,
195
+ left: border
196
+ } : {
197
+ color: null,
198
+ style: null,
199
+ width: null,
200
+ ...border
201
+ };
202
+ setStyle({ ...newStyle,
203
+ border: { ...updatedBorder,
204
+ radius
205
+ }
206
+ });
207
+ };
208
+
133
209
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_header.default, {
134
210
  title: variation ? currentBlockStyle.label : blockType.title
135
211
  }), (0, _element.createElement)(_blockPreviewPanel.default, {
@@ -160,18 +236,18 @@ function ScreenBlock(_ref) {
160
236
  }), hasBorderPanel && (0, _element.createElement)(StylesBorderPanel, {
161
237
  inheritedValue: inheritedStyle,
162
238
  value: style,
163
- onChange: setStyle,
239
+ onChange: onChangeBorders,
164
240
  settings: settings
165
241
  }), hasEffectsPanel && (0, _element.createElement)(StylesEffectsPanel, {
166
242
  inheritedValue: inheritedStyleWithLayout,
167
243
  value: styleWithLayout,
168
- onChange: onChangeDimensions,
244
+ onChange: setStyle,
169
245
  settings: settings,
170
246
  includeLayoutControls: true
171
247
  }), hasFiltersPanel && (0, _element.createElement)(StylesFiltersPanel, {
172
248
  inheritedValue: inheritedStyleWithLayout,
173
249
  value: styleWithLayout,
174
- onChange: onChangeDimensions,
250
+ onChange: setStyle,
175
251
  settings: { ...settings,
176
252
  color: { ...settings.color,
177
253
  customDuotone: false //TO FIX: Custom duotone only works on the block level right now
@@ -183,7 +259,7 @@ function ScreenBlock(_ref) {
183
259
  title: (0, _i18n.__)('Advanced'),
184
260
  initialOpen: false
185
261
  }, (0, _element.createElement)("p", null, (0, _i18n.sprintf)( // translators: %s: is the name of a block e.g., 'Image' or 'Table'.
186
- (0, _i18n.__)('Add your own CSS to customize the appearance of the %s block.'), blockType === null || blockType === void 0 ? void 0 : blockType.title)), (0, _element.createElement)(StylesAdvancedPanel, {
262
+ (0, _i18n.__)('Add your own CSS to customize the appearance of the %s block.'), blockType?.title)), (0, _element.createElement)(StylesAdvancedPanel, {
187
263
  value: style,
188
264
  onChange: setStyle,
189
265
  inheritedValue: inheritedStyle
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-block.js"],"names":["useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","useHasEffectsPanel","useHasFiltersPanel","useGlobalStyle","BorderPanel","StylesBorderPanel","ColorPanel","StylesColorPanel","TypographyPanel","StylesTypographyPanel","DimensionsPanel","StylesDimensionsPanel","EffectsPanel","StylesEffectsPanel","FiltersPanel","StylesFiltersPanel","AdvancedPanel","StylesAdvancedPanel","blockEditorPrivateApis","ScreenBlock","name","variation","prefixParts","concat","prefix","join","style","shouldDecodeEncode","inheritedStyle","setStyle","rawSettings","setSettings","settings","blockType","blockVariations","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasEffectsPanel","hasFiltersPanel","hasVariationsPanel","length","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","coreStore","globalStylesId","globalStyles","undefined","_links","currentBlockStyle","find","s","inheritedStyleWithLayout","layout","styleWithLayout","onChangeDimensions","newStyle","updatedStyle","label","title","color","customDuotone"],"mappings":";;;;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AACA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAYA;AACA;AACA;AAOA,MAAM;AACLA,EAAAA,qBADK;AAELC,EAAAA,qBAFK;AAGLC,EAAAA,iBAHK;AAILC,EAAAA,gBAJK;AAKLC,EAAAA,0BALK;AAMLC,EAAAA,gBANK;AAOLC,EAAAA,kBAPK;AAQLC,EAAAA,kBARK;AASLC,EAAAA,cATK;AAULC,EAAAA,WAAW,EAAEC,iBAVR;AAWLC,EAAAA,UAAU,EAAEC,gBAXP;AAYLC,EAAAA,eAAe,EAAEC,qBAZZ;AAaLC,EAAAA,eAAe,EAAEC,qBAbZ;AAcLC,EAAAA,YAAY,EAAEC,kBAdT;AAeLC,EAAAA,YAAY,EAAEC,kBAfT;AAgBLC,EAAAA,aAAa,EAAEC;AAhBV,IAiBF,yBAAQC,wBAAR,CAjBJ;;AAmBA,SAASC,WAAT,OAA4C;AAAA,MAAtB;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAsB;AAC3C,MAAIC,WAAW,GAAG,EAAlB;;AACA,MAAKD,SAAL,EAAiB;AAChBC,IAAAA,WAAW,GAAG,CAAE,YAAF,EAAgBD,SAAhB,EAA4BE,MAA5B,CAAoCD,WAApC,CAAd;AACA;;AACD,QAAME,MAAM,GAAGF,WAAW,CAACG,IAAZ,CAAkB,GAAlB,CAAf;AAEA,QAAM,CAAEC,KAAF,IAAYvB,cAAc,CAAEqB,MAAF,EAAUJ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AJZ;AAKC,IAAA,qBAAqB;AALtB,IA/CF,EAuDGQ,eAAe,IAChB,4BAAC,kBAAD;AACC,IAAA,cAAc,EAAGe,wBADlB;AAEC,IAAA,KAAK,EAAGE,eAFT;AAGC,IAAA,QAAQ,EAAGC,kBAHZ;AAIC,IAAA,QAAQ,EAAG,EACV,GAAG1B,QADO;AAEV+B,MAAAA,KAAK,EAAE,EACN,GAAG/B,QAAQ,CAAC+B,KADN;AAENC,QAAAA,aAAa,EAAE,KAFT,CAEgB;;AAFhB;AAFG,KAJZ;AAWC,IAAA,qBAAqB;AAXtB,IAxDF,EAsEGrB,UAAU,IACX,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,UAAJ,CAAnB;AAAsC,IAAA,WAAW,EAAG;AAApD,KACC,uCACG,oBACD;AACA,gBACC,+DADD,CAFC,EAKDV,SALC,aAKDA,SALC,uBAKDA,SAAS,CAAE6B,KALV,CADH,CADD,EAUC,4BAAC,mBAAD;AACC,IAAA,KAAK,EAAGpC,KADT;AAEC,IAAA,QAAQ,EAAGG,QAFZ;AAGC,IAAA,cAAc,EAAGD;AAHlB,IAVD,CAvEF,CADD;AA2FA;;eAEcT,W","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tPanelBody,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { unlock } from '../../private-apis';\nimport Subtitle from './subtitle';\nimport { useBlockVariations, VariationsPanel } from './variations-panel';\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n\tuseHasEffectsPanel,\n\tuseHasFiltersPanel,\n\tuseGlobalStyle,\n\tBorderPanel: StylesBorderPanel,\n\tColorPanel: StylesColorPanel,\n\tTypographyPanel: StylesTypographyPanel,\n\tDimensionsPanel: StylesDimensionsPanel,\n\tEffectsPanel: StylesEffectsPanel,\n\tFiltersPanel: StylesFiltersPanel,\n\tAdvancedPanel: StylesAdvancedPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction ScreenBlock( { name, variation } ) {\n\tlet prefixParts = [];\n\tif ( variation ) {\n\t\tprefixParts = [ 'variations', variation ].concat( prefixParts );\n\t}\n\tconst prefix = prefixParts.join( '.' );\n\n\tconst [ style ] = useGlobalStyle( prefix, name, 'user', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ rawSettings, setSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\tconst blockType = getBlockType( name );\n\tconst blockVariations = useBlockVariations( name );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasEffectsPanel = useHasEffectsPanel( settings );\n\tconst hasFiltersPanel = useHasFiltersPanel( settings );\n\tconst hasVariationsPanel = !! blockVariations?.length && ! variation;\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS:\n\t\t\t\t!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,\n\t\t};\n\t}, [] );\n\tconst currentBlockStyle = variation\n\t\t? blockVariations.find( ( s ) => s.name === variation )\n\t\t: null;\n\n\t// These intermediary objects are needed because the \"layout\" property is stored\n\t// in settings rather than styles.\n\tconst inheritedStyleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...inheritedStyle,\n\t\t\tlayout: settings.layout,\n\t\t};\n\t}, [ inheritedStyle, settings.layout ] );\n\tconst styleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...style,\n\t\t\tlayout: settings.layout,\n\t\t};\n\t}, [ style, settings.layout ] );\n\tconst onChangeDimensions = ( newStyle ) => {\n\t\tconst updatedStyle = { ...newStyle };\n\t\tdelete updatedStyle.layout;\n\t\tsetStyle( updatedStyle );\n\n\t\tif ( newStyle.layout !== settings.layout ) {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlayout: newStyle.layout,\n\t\t\t} );\n\t\t}\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ variation ? currentBlockStyle.label : blockType.title }\n\t\t\t/>\n\t\t\t<BlockPreviewPanel name={ name } variation={ variation } />\n\t\t\t{ hasVariationsPanel && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-variations\">\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle>{ __( 'Style Variations' ) }</Subtitle>\n\t\t\t\t\t\t<VariationsPanel name={ name } />\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasColorPanel && (\n\t\t\t\t<StylesColorPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasTypographyPanel && (\n\t\t\t\t<StylesTypographyPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasDimensionsPanel && (\n\t\t\t\t<StylesDimensionsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ onChangeDimensions }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<StylesBorderPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasEffectsPanel && (\n\t\t\t\t<StylesEffectsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ onChangeDimensions }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasFiltersPanel && (\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ onChangeDimensions }\n\t\t\t\t\tsettings={ {\n\t\t\t\t\t\t...settings,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...settings.color,\n\t\t\t\t\t\t\tcustomDuotone: false, //TO FIX: Custom duotone only works on the block level right now\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canEditCSS && (\n\t\t\t\t<PanelBody title={ __( 'Advanced' ) } initialOpen={ false }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Add your own CSS to customize the appearance of the %s block.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tblockType?.title\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<StylesAdvancedPanel\n\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenBlock;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-block.js"],"names":["applyFallbackStyle","border","hasColorOrWidth","color","width","style","undefined","applyAllFallbackStyles","top","right","bottom","left","useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","useHasEffectsPanel","useHasFiltersPanel","useGlobalStyle","BorderPanel","StylesBorderPanel","ColorPanel","StylesColorPanel","TypographyPanel","StylesTypographyPanel","DimensionsPanel","StylesDimensionsPanel","EffectsPanel","StylesEffectsPanel","FiltersPanel","StylesFiltersPanel","AdvancedPanel","StylesAdvancedPanel","blockEditorPrivateApis","ScreenBlock","name","variation","prefixParts","concat","prefix","join","shouldDecodeEncode","inheritedStyle","setStyle","rawSettings","setSettings","settings","blockType","blockVariations","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasEffectsPanel","hasFiltersPanel","hasVariationsPanel","length","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","coreStore","globalStylesId","globalStyles","_links","currentBlockStyle","find","s","inheritedStyleWithLayout","layout","styleWithLayout","onChangeDimensions","newStyle","updatedStyle","onChangeBorders","radius","newBorder","updatedBorder","label","title","customDuotone"],"mappings":";;;;;;;;;A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D;AACC,IAAA,cAAc,EAAGe,wBADlB;AAEC,IAAA,KAAK,EAAGE,eAFT;AAGC,IAAA,QAAQ,EAAG3B,QAHZ;AAIC,IAAA,QAAQ,EAAGG,QAJZ;AAKC,IAAA,qBAAqB;AALtB,IA/CF,EAuDGQ,eAAe,IAChB,4BAAC,kBAAD;AACC,IAAA,cAAc,EAAGc,wBADlB;AAEC,IAAA,KAAK,EAAGE,eAFT;AAGC,IAAA,QAAQ,EAAG3B,QAHZ;AAIC,IAAA,QAAQ,EAAG,EACV,GAAGG,QADO;AAEV7C,MAAAA,KAAK,EAAE,EACN,GAAG6C,QAAQ,CAAC7C,KADN;AAEN+E,QAAAA,aAAa,EAAE,KAFT,CAEgB;;AAFhB;AAFG,KAJZ;AAWC,IAAA,qBAAqB;AAXtB,IAxDF,EAsEGvB,UAAU,IACX,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,UAAJ,CAAnB;AAAsC,IAAA,WAAW,EAAG;AAApD,KACC,uCACG,oBACD;AACA,gBACC,+DADD,CAFC,EAKDV,SAAS,EAAEgC,KALV,CADH,CADD,EAUC,4BAAC,mBAAD;AACC,IAAA,KAAK,EAAG5E,KADT;AAEC,IAAA,QAAQ,EAAGwC,QAFZ;AAGC,IAAA,cAAc,EAAGD;AAHlB,IAVD,CAvEF,CADD;AA2FA;;eAEcR,W","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tPanelBody,\n\t__experimentalVStack as VStack,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { unlock } from '../../private-apis';\nimport Subtitle from './subtitle';\nimport { useBlockVariations, VariationsPanel } from './variations-panel';\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tconst hasColorOrWidth = border.color || border.width;\n\n\tif ( ! border.style && hasColorOrWidth ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\tif ( border.style && ! hasColorOrWidth ) {\n\t\treturn undefined;\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n\tuseHasEffectsPanel,\n\tuseHasFiltersPanel,\n\tuseGlobalStyle,\n\tBorderPanel: StylesBorderPanel,\n\tColorPanel: StylesColorPanel,\n\tTypographyPanel: StylesTypographyPanel,\n\tDimensionsPanel: StylesDimensionsPanel,\n\tEffectsPanel: StylesEffectsPanel,\n\tFiltersPanel: StylesFiltersPanel,\n\tAdvancedPanel: StylesAdvancedPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction ScreenBlock( { name, variation } ) {\n\tlet prefixParts = [];\n\tif ( variation ) {\n\t\tprefixParts = [ 'variations', variation ].concat( prefixParts );\n\t}\n\tconst prefix = prefixParts.join( '.' );\n\n\tconst [ style ] = useGlobalStyle( prefix, name, 'user', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ rawSettings, setSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\tconst blockType = getBlockType( name );\n\tconst blockVariations = useBlockVariations( name );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasEffectsPanel = useHasEffectsPanel( settings );\n\tconst hasFiltersPanel = useHasFiltersPanel( settings );\n\tconst hasVariationsPanel = !! blockVariations?.length && ! variation;\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS:\n\t\t\t\t!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,\n\t\t};\n\t}, [] );\n\tconst currentBlockStyle = variation\n\t\t? blockVariations.find( ( s ) => s.name === variation )\n\t\t: null;\n\n\t// These intermediary objects are needed because the \"layout\" property is stored\n\t// in settings rather than styles.\n\tconst inheritedStyleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...inheritedStyle,\n\t\t\tlayout: settings.layout,\n\t\t};\n\t}, [ inheritedStyle, settings.layout ] );\n\tconst styleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...style,\n\t\t\tlayout: settings.layout,\n\t\t};\n\t}, [ style, settings.layout ] );\n\tconst onChangeDimensions = ( newStyle ) => {\n\t\tconst updatedStyle = { ...newStyle };\n\t\tdelete updatedStyle.layout;\n\t\tsetStyle( updatedStyle );\n\n\t\tif ( newStyle.layout !== settings.layout ) {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlayout: newStyle.layout,\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeBorders = ( newStyle ) => {\n\t\tif ( ! newStyle?.border ) {\n\t\t\tsetStyle( newStyle );\n\t\t\treturn;\n\t\t}\n\n\t\t// As Global Styles can't conditionally generate styles based on if\n\t\t// other style properties have been set, we need to force split\n\t\t// border definitions for user set global border styles. Border\n\t\t// radius is derived from the same property i.e. `border.radius` if\n\t\t// it is a string that is used. The longhand border radii styles are\n\t\t// only generated if that property is an object.\n\t\t//\n\t\t// For borders (color, style, and width) those are all properties on\n\t\t// the `border` style property. This means if the theme.json defined\n\t\t// split borders and the user condenses them into a flat border or\n\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\tconst { radius, ...newBorder } = newStyle.border;\n\t\tconst border = applyAllFallbackStyles( newBorder );\n\t\tconst updatedBorder = ! hasSplitBorders( border )\n\t\t\t? {\n\t\t\t\t\ttop: border,\n\t\t\t\t\tright: border,\n\t\t\t\t\tbottom: border,\n\t\t\t\t\tleft: border,\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tcolor: null,\n\t\t\t\t\tstyle: null,\n\t\t\t\t\twidth: null,\n\t\t\t\t\t...border,\n\t\t\t };\n\n\t\tsetStyle( { ...newStyle, border: { ...updatedBorder, radius } } );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ variation ? currentBlockStyle.label : blockType.title }\n\t\t\t/>\n\t\t\t<BlockPreviewPanel name={ name } variation={ variation } />\n\t\t\t{ hasVariationsPanel && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-variations\">\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle>{ __( 'Style Variations' ) }</Subtitle>\n\t\t\t\t\t\t<VariationsPanel name={ name } />\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasColorPanel && (\n\t\t\t\t<StylesColorPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasTypographyPanel && (\n\t\t\t\t<StylesTypographyPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasDimensionsPanel && (\n\t\t\t\t<StylesDimensionsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ onChangeDimensions }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<StylesBorderPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ onChangeBorders }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasEffectsPanel && (\n\t\t\t\t<StylesEffectsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasFiltersPanel && (\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ {\n\t\t\t\t\t\t...settings,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...settings.color,\n\t\t\t\t\t\t\tcustomDuotone: false, //TO FIX: Custom duotone only works on the block level right now\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canEditCSS && (\n\t\t\t\t<PanelBody title={ __( 'Advanced' ) } initialOpen={ false }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Add your own CSS to customize the appearance of the %s block.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tblockType?.title\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<StylesAdvancedPanel\n\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenBlock;\n"]}
@@ -26,10 +26,9 @@ var _header = _interopRequireDefault(require("./header"));
26
26
  /**
27
27
  * Internal dependencies
28
28
  */
29
- function ScreenColorPalette(_ref) {
30
- let {
31
- name
32
- } = _ref;
29
+ function ScreenColorPalette({
30
+ name
31
+ }) {
33
32
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_header.default, {
34
33
  title: (0, _i18n.__)('Palette'),
35
34
  description: (0, _i18n.__)('Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.')
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-color-palette.js"],"names":["ScreenColorPalette","name","title","value","tab"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKA,SAASA,kBAAT,OAAwC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACvC,SACC,qDACC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,SAAJ,CADT;AAEC,IAAA,WAAW,EAAG,cACb,yIADa;AAFf,IADD,EAOC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAG,CACN;AACCA,MAAAA,IAAI,EAAE,OADP;AAECC,MAAAA,KAAK,EAAE,OAFR;AAGCC,MAAAA,KAAK,EAAE;AAHR,KADM,EAMN;AACCF,MAAAA,IAAI,EAAE,UADP;AAECC,MAAAA,KAAK,EAAE,UAFR;AAGCC,MAAAA,KAAK,EAAE;AAHR,KANM;AADR,KAcKC,GAAF,IACD,qDACGA,GAAG,CAACD,KAAJ,KAAc,OAAd,IACD,4BAAC,0BAAD;AAAmB,IAAA,IAAI,EAAGF;AAA1B,IAFF,EAIGG,GAAG,CAACD,KAAJ,KAAc,UAAd,IACD,4BAAC,8BAAD;AAAsB,IAAA,IAAI,EAAGF;AAA7B,IALF,CAfF,CAPD,CADD;AAmCA;;eAEcD,kB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { TabPanel } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ColorPalettePanel from './color-palette-panel';\nimport GradientPalettePanel from './gradients-palette-panel';\nimport ScreenHeader from './header';\n\nfunction ScreenColorPalette( { name } ) {\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Palette' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<TabPanel\n\t\t\t\ttabs={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'solid',\n\t\t\t\t\t\ttitle: 'Solid',\n\t\t\t\t\t\tvalue: 'solid',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'gradient',\n\t\t\t\t\t\ttitle: 'Gradient',\n\t\t\t\t\t\tvalue: 'gradient',\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ ( tab ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ tab.value === 'solid' && (\n\t\t\t\t\t\t\t<ColorPalettePanel name={ name } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ tab.value === 'gradient' && (\n\t\t\t\t\t\t\t<GradientPalettePanel name={ name } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</TabPanel>\n\t\t</>\n\t);\n}\n\nexport default ScreenColorPalette;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-color-palette.js"],"names":["ScreenColorPalette","name","title","value","tab"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKA,SAASA,kBAAT,CAA6B;AAAEC,EAAAA;AAAF,CAA7B,EAAwC;AACvC,SACC,qDACC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,SAAJ,CADT;AAEC,IAAA,WAAW,EAAG,cACb,yIADa;AAFf,IADD,EAOC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAG,CACN;AACCA,MAAAA,IAAI,EAAE,OADP;AAECC,MAAAA,KAAK,EAAE,OAFR;AAGCC,MAAAA,KAAK,EAAE;AAHR,KADM,EAMN;AACCF,MAAAA,IAAI,EAAE,UADP;AAECC,MAAAA,KAAK,EAAE,UAFR;AAGCC,MAAAA,KAAK,EAAE;AAHR,KANM;AADR,KAcKC,GAAF,IACD,qDACGA,GAAG,CAACD,KAAJ,KAAc,OAAd,IACD,4BAAC,0BAAD;AAAmB,IAAA,IAAI,EAAGF;AAA1B,IAFF,EAIGG,GAAG,CAACD,KAAJ,KAAc,UAAd,IACD,4BAAC,8BAAD;AAAsB,IAAA,IAAI,EAAGF;AAA7B,IALF,CAfF,CAPD,CADD;AAmCA;;eAEcD,kB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { TabPanel } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ColorPalettePanel from './color-palette-panel';\nimport GradientPalettePanel from './gradients-palette-panel';\nimport ScreenHeader from './header';\n\nfunction ScreenColorPalette( { name } ) {\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Palette' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<TabPanel\n\t\t\t\ttabs={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'solid',\n\t\t\t\t\t\ttitle: 'Solid',\n\t\t\t\t\t\tvalue: 'solid',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'gradient',\n\t\t\t\t\t\ttitle: 'Gradient',\n\t\t\t\t\t\tvalue: 'gradient',\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ ( tab ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ tab.value === 'solid' && (\n\t\t\t\t\t\t\t<ColorPalettePanel name={ name } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ tab.value === 'gradient' && (\n\t\t\t\t\t\t\t<GradientPalettePanel name={ name } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</TabPanel>\n\t\t</>\n\t);\n}\n\nexport default ScreenColorPalette;\n"]}
@@ -44,8 +44,6 @@ const {
44
44
  } = (0, _privateApis.unlock)(_blockEditor.privateApis);
45
45
 
46
46
  function ScreenRevisions() {
47
- var _revisions$;
48
-
49
47
  const {
50
48
  goBack
51
49
  } = (0, _components.__experimentalUseNavigator)();
@@ -67,13 +65,8 @@ function ScreenRevisions() {
67
65
  isLoading,
68
66
  hasUnsavedChanges
69
67
  } = (0, _useGlobalStylesRevisions.default)();
68
+ const [selectedRevisionId, setSelectedRevisionId] = (0, _element.useState)();
70
69
  const [globalStylesRevision, setGlobalStylesRevision] = (0, _element.useState)(userConfig);
71
- const [currentRevisionId, setCurrentRevisionId] = (0, _element.useState)(
72
- /*
73
- * We need this for the first render,
74
- * otherwise the unsaved changes haven't been merged into the revisions array yet.
75
- */
76
- hasUnsavedChanges ? 'unsaved' : revisions === null || revisions === void 0 ? void 0 : (_revisions$ = revisions[0]) === null || _revisions$ === void 0 ? void 0 : _revisions$.id);
77
70
  const [isLoadingRevisionWithUnsavedChanges, setIsLoadingRevisionWithUnsavedChanges] = (0, _element.useState)(false);
78
71
  const {
79
72
  setEditorCanvasContainerView
@@ -91,8 +84,8 @@ function ScreenRevisions() {
91
84
 
92
85
  const restoreRevision = revision => {
93
86
  setUserConfig(() => ({
94
- styles: revision === null || revision === void 0 ? void 0 : revision.styles,
95
- settings: revision === null || revision === void 0 ? void 0 : revision.settings
87
+ styles: revision?.styles,
88
+ settings: revision?.settings
96
89
  }));
97
90
  setIsLoadingRevisionWithUnsavedChanges(false);
98
91
  onCloseRevisions();
@@ -100,14 +93,14 @@ function ScreenRevisions() {
100
93
 
101
94
  const selectRevision = revision => {
102
95
  setGlobalStylesRevision({
103
- styles: revision === null || revision === void 0 ? void 0 : revision.styles,
104
- settings: revision === null || revision === void 0 ? void 0 : revision.settings,
105
- id: revision === null || revision === void 0 ? void 0 : revision.id
96
+ styles: revision?.styles,
97
+ settings: revision?.settings,
98
+ id: revision?.id
106
99
  });
107
- setCurrentRevisionId(revision === null || revision === void 0 ? void 0 : revision.id);
100
+ setSelectedRevisionId(revision?.id);
108
101
  };
109
102
 
110
- const isLoadButtonEnabled = !!(globalStylesRevision !== null && globalStylesRevision !== void 0 && globalStylesRevision.id) && !areGlobalStyleConfigsEqual(globalStylesRevision, userConfig);
103
+ const isLoadButtonEnabled = !!globalStylesRevision?.id && !areGlobalStyleConfigsEqual(globalStylesRevision, userConfig);
111
104
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_header.default, {
112
105
  title: (0, _i18n.__)('Revisions'),
113
106
  description: (0, _i18n.__)('Revisions are added to the timeline when style changes are saved.')
@@ -121,12 +114,12 @@ function ScreenRevisions() {
121
114
  className: "edit-site-global-styles-screen-revisions"
122
115
  }, (0, _element.createElement)(_revisionsButtons.default, {
123
116
  onChange: selectRevision,
124
- currentRevisionId: currentRevisionId,
117
+ selectedRevisionId: selectedRevisionId,
125
118
  userRevisions: revisions
126
119
  }), isLoadButtonEnabled && (0, _element.createElement)(_sidebarFixedBottom.default, null, (0, _element.createElement)(_components.Button, {
127
120
  variant: "primary",
128
121
  className: "edit-site-global-styles-screen-revisions__button",
129
- disabled: !(globalStylesRevision !== null && globalStylesRevision !== void 0 && globalStylesRevision.id) || (globalStylesRevision === null || globalStylesRevision === void 0 ? void 0 : globalStylesRevision.id) === 'unsaved',
122
+ disabled: !globalStylesRevision?.id || globalStylesRevision?.id === 'unsaved',
130
123
  onClick: () => {
131
124
  if (hasUnsavedChanges) {
132
125
  setIsLoadingRevisionWithUnsavedChanges(true);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/index.js"],"names":["GlobalStylesContext","areGlobalStyleConfigsEqual","blockEditorPrivateApis","ScreenRevisions","goBack","user","userConfig","setUserConfig","blocks","editorCanvasContainerView","select","editSiteStore","getEditorCanvasContainerView","blockEditorStore","getBlocks","revisions","isLoading","hasUnsavedChanges","globalStylesRevision","setGlobalStylesRevision","currentRevisionId","setCurrentRevisionId","id","isLoadingRevisionWithUnsavedChanges","setIsLoadingRevisionWithUnsavedChanges","setEditorCanvasContainerView","onCloseRevisions","restoreRevision","revision","styles","settings","selectRevision","isLoadButtonEnabled"],"mappings":";;;;;;;;;AAWA;;AARA;;AACA;;AAMA;;AAEA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA1BA;AACA;AACA;;AAeA;AACA;AACA;AASA,MAAM;AAAEA,EAAAA,mBAAF;AAAuBC,EAAAA;AAAvB,IAAsD,yBAC3DC,wBAD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BAAD;AACC,IAAA,QAAQ,EAAGK,cADZ;AAEC,IAAA,iBAAiB,EAAGX,iBAFrB;AAGC,IAAA,aAAa,EAAGL;AAHjB,IADD,EAMGiB,mBAAmB,IACpB,4BAAC,2BAAD,QACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,SAAS,EAAC,kDAFX;AAGC,IAAA,QAAQ,EACP,EAAEd,oBAAF,aAAEA,oBAAF,eAAEA,oBAAoB,CAAEI,EAAxB,KACA,CAAAJ,oBAAoB,SAApB,IAAAA,oBAAoB,WAApB,YAAAA,oBAAoB,CAAEI,EAAtB,MAA6B,SAL/B;AAOC,IAAA,OAAO,EAAG,MAAM;AACf,UAAKL,iBAAL,EAAyB;AACxBO,QAAAA,sCAAsC,CACrC,IADqC,CAAtC;AAGA,OAJD,MAIO;AACNG,QAAAA,eAAe,CAAET,oBAAF,CAAf;AACA;AACD;AAfF,KAiBG,cAAI,OAAJ,CAjBH,CADD,CAPF,CAjBD,EA+CGK,mCAAmC,IACpC,4BAAC,uCAAD;AACC,IAAA,KAAK,EAAG,cACP,yDADO,CADT;AAIC,IAAA,MAAM,EAAGA,mCAJV;AAKC,IAAA,iBAAiB,EAAG,cAAI,0BAAJ,CALrB;AAMC,IAAA,SAAS,EAAG,MAAMI,eAAe,CAAET,oBAAF,CANlC;AAOC,IAAA,QAAQ,EAAG,MACVM,sCAAsC,CAAE,KAAF;AARxC,KAWC,qDACC,wCACG,cACD,yDADC,CADH,CADD,EAMC,uCACG,cACD,4DADC,CADH,CAND,CAXD,CAhDF,CADD;AA4EA;;eAEcrB,e","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\t__experimentalUseNavigator as useNavigator,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tSpinner,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useContext, useState, useEffect } from '@wordpress/element';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from '../header';\nimport { unlock } from '../../../private-apis';\nimport Revisions from '../../revisions';\nimport SidebarFixedBottom from '../../sidebar-edit-mode/sidebar-fixed-bottom';\nimport { store as editSiteStore } from '../../../store';\nimport useGlobalStylesRevisions from './use-global-styles-revisions';\nimport RevisionsButtons from './revisions-buttons';\n\nconst { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(\n\tblockEditorPrivateApis\n);\n\nfunction ScreenRevisions() {\n\tconst { goBack } = useNavigator();\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\tconst { blocks, editorCanvasContainerView } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\teditorCanvasContainerView: unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView(),\n\t\t\tblocks: select( blockEditorStore ).getBlocks(),\n\t\t};\n\t}, [] );\n\n\tconst { revisions, isLoading, hasUnsavedChanges } =\n\t\tuseGlobalStylesRevisions();\n\tconst [ globalStylesRevision, setGlobalStylesRevision ] =\n\t\tuseState( userConfig );\n\n\tconst [ currentRevisionId, setCurrentRevisionId ] = useState(\n\t\t/*\n\t\t * We need this for the first render,\n\t\t * otherwise the unsaved changes haven't been merged into the revisions array yet.\n\t\t */\n\t\thasUnsavedChanges ? 'unsaved' : revisions?.[ 0 ]?.id\n\t);\n\tconst [\n\t\tisLoadingRevisionWithUnsavedChanges,\n\t\tsetIsLoadingRevisionWithUnsavedChanges,\n\t] = useState( false );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\tuseEffect( () => {\n\t\tif ( editorCanvasContainerView !== 'global-styles-revisions' ) {\n\t\t\tgoBack();\n\t\t\tsetEditorCanvasContainerView( editorCanvasContainerView );\n\t\t}\n\t}, [ editorCanvasContainerView ] );\n\n\tconst onCloseRevisions = () => {\n\t\tgoBack();\n\t};\n\n\tconst restoreRevision = ( revision ) => {\n\t\tsetUserConfig( () => ( {\n\t\t\tstyles: revision?.styles,\n\t\t\tsettings: revision?.settings,\n\t\t} ) );\n\t\tsetIsLoadingRevisionWithUnsavedChanges( false );\n\t\tonCloseRevisions();\n\t};\n\n\tconst selectRevision = ( revision ) => {\n\t\tsetGlobalStylesRevision( {\n\t\t\tstyles: revision?.styles,\n\t\t\tsettings: revision?.settings,\n\t\t\tid: revision?.id,\n\t\t} );\n\t\tsetCurrentRevisionId( revision?.id );\n\t};\n\n\tconst isLoadButtonEnabled =\n\t\t!! globalStylesRevision?.id &&\n\t\t! areGlobalStyleConfigsEqual( globalStylesRevision, userConfig );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Revisions' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Revisions are added to the timeline when style changes are saved.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t{ isLoading && (\n\t\t\t\t<Spinner className=\"edit-site-global-styles-screen-revisions__loading\" />\n\t\t\t) }\n\t\t\t{ ! isLoading && (\n\t\t\t\t<Revisions\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tuserConfig={ globalStylesRevision }\n\t\t\t\t\tonClose={ onCloseRevisions }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<div className=\"edit-site-global-styles-screen-revisions\">\n\t\t\t\t<RevisionsButtons\n\t\t\t\t\tonChange={ selectRevision }\n\t\t\t\t\tcurrentRevisionId={ currentRevisionId }\n\t\t\t\t\tuserRevisions={ revisions }\n\t\t\t\t/>\n\t\t\t\t{ isLoadButtonEnabled && (\n\t\t\t\t\t<SidebarFixedBottom>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-revisions__button\"\n\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t! globalStylesRevision?.id ||\n\t\t\t\t\t\t\t\tglobalStylesRevision?.id === 'unsaved'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tif ( hasUnsavedChanges ) {\n\t\t\t\t\t\t\t\t\tsetIsLoadingRevisionWithUnsavedChanges(\n\t\t\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\trestoreRevision( globalStylesRevision );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Apply' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</SidebarFixedBottom>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ isLoadingRevisionWithUnsavedChanges && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\ttitle={ __(\n\t\t\t\t\t\t'Loading this revision will discard all unsaved changes.'\n\t\t\t\t\t) }\n\t\t\t\t\tisOpen={ isLoadingRevisionWithUnsavedChanges }\n\t\t\t\t\tconfirmButtonText={ __( ' Discard unsaved changes' ) }\n\t\t\t\t\tonConfirm={ () => restoreRevision( globalStylesRevision ) }\n\t\t\t\t\tonCancel={ () =>\n\t\t\t\t\t\tsetIsLoadingRevisionWithUnsavedChanges( false )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<>\n\t\t\t\t\t\t<h2>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Loading this revision will discard all unsaved changes.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Do you want to replace your unsaved changes in the editor?'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</>\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenRevisions;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/index.js"],"names":["GlobalStylesContext","areGlobalStyleConfigsEqual","blockEditorPrivateApis","ScreenRevisions","goBack","user","userConfig","setUserConfig","blocks","editorCanvasContainerView","select","editSiteStore","getEditorCanvasContainerView","blockEditorStore","getBlocks","revisions","isLoading","hasUnsavedChanges","selectedRevisionId","setSelectedRevisionId","globalStylesRevision","setGlobalStylesRevision","isLoadingRevisionWithUnsavedChanges","setIsLoadingRevisionWithUnsavedChanges","setEditorCanvasContainerView","onCloseRevisions","restoreRevision","revision","styles","settings","selectRevision","id","isLoadButtonEnabled"],"mappings":";;;;;;;;;AAWA;;AARA;;AACA;;AAMA;;AAEA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA1BA;AACA;AACA;;AAeA;AACA;AACA;AASA,MAAM;AAAEA,EAAAA,mBAAF;AAAuBC,EAAAA;AAAvB,IAAsD,yBAC3DC,wBAD2D,CAA5D;;AAIA,SAASC,eAAT,GAA2B;AAC1B,QAAM;AAAEC,IAAAA;AAAF,MAAa,6CAAnB;AACA,QAAM;AAAEC,IAAAA,IAAI,EAAEC,UAAR;AAAoBC,IAAAA;AAApB,MACL,yBAAYP,mBAAZ,CADD;AAEA,QAAM;AAAEQ,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAwC,qBAAaC,MAAF,IAAc;AACtE,WAAO;AACND,MAAAA,yBAAyB,EAAE,yBAC1BC,MAAM,CAAEC,YAAF,CADoB,EAEzBC,4BAFyB,EADrB;AAINJ,MAAAA,MAAM,EAAEE,MAAM,CAAEG,kBAAF,CAAN,CAA2BC,SAA3B;AAJF,KAAP;AAMA,GAP6C,EAO3C,EAP2C,CAA9C;AAQA,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,SAAb;AAAwBC,IAAAA;AAAxB,MACL,wCADD;AAEA,QAAM,CAAEC,kBAAF,EAAsBC,qBAAtB,IAAgD,wBAAt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import { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\t__experimentalUseNavigator as useNavigator,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tSpinner,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useContext, useState, useEffect } from '@wordpress/element';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from '../header';\nimport { unlock } from '../../../private-apis';\nimport Revisions from '../../revisions';\nimport SidebarFixedBottom from '../../sidebar-edit-mode/sidebar-fixed-bottom';\nimport { store as editSiteStore } from '../../../store';\nimport useGlobalStylesRevisions from './use-global-styles-revisions';\nimport RevisionsButtons from './revisions-buttons';\n\nconst { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(\n\tblockEditorPrivateApis\n);\n\nfunction ScreenRevisions() {\n\tconst { goBack } = useNavigator();\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\tconst { blocks, editorCanvasContainerView } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\teditorCanvasContainerView: unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView(),\n\t\t\tblocks: select( blockEditorStore ).getBlocks(),\n\t\t};\n\t}, [] );\n\tconst { revisions, isLoading, hasUnsavedChanges } =\n\t\tuseGlobalStylesRevisions();\n\tconst [ selectedRevisionId, setSelectedRevisionId ] = useState();\n\tconst [ globalStylesRevision, setGlobalStylesRevision ] =\n\t\tuseState( userConfig );\n\tconst [\n\t\tisLoadingRevisionWithUnsavedChanges,\n\t\tsetIsLoadingRevisionWithUnsavedChanges,\n\t] = useState( false );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\tuseEffect( () => {\n\t\tif ( editorCanvasContainerView !== 'global-styles-revisions' ) {\n\t\t\tgoBack();\n\t\t\tsetEditorCanvasContainerView( editorCanvasContainerView );\n\t\t}\n\t}, [ editorCanvasContainerView ] );\n\n\tconst onCloseRevisions = () => {\n\t\tgoBack();\n\t};\n\n\tconst restoreRevision = ( revision ) => {\n\t\tsetUserConfig( () => ( {\n\t\t\tstyles: revision?.styles,\n\t\t\tsettings: revision?.settings,\n\t\t} ) );\n\t\tsetIsLoadingRevisionWithUnsavedChanges( false );\n\t\tonCloseRevisions();\n\t};\n\n\tconst selectRevision = ( revision ) => {\n\t\tsetGlobalStylesRevision( {\n\t\t\tstyles: revision?.styles,\n\t\t\tsettings: revision?.settings,\n\t\t\tid: revision?.id,\n\t\t} );\n\t\tsetSelectedRevisionId( revision?.id );\n\t};\n\n\tconst isLoadButtonEnabled =\n\t\t!! globalStylesRevision?.id &&\n\t\t! areGlobalStyleConfigsEqual( globalStylesRevision, userConfig );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Revisions' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Revisions are added to the timeline when style changes are saved.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t{ isLoading && (\n\t\t\t\t<Spinner className=\"edit-site-global-styles-screen-revisions__loading\" />\n\t\t\t) }\n\t\t\t{ ! isLoading && (\n\t\t\t\t<Revisions\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tuserConfig={ globalStylesRevision }\n\t\t\t\t\tonClose={ onCloseRevisions }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<div className=\"edit-site-global-styles-screen-revisions\">\n\t\t\t\t<RevisionsButtons\n\t\t\t\t\tonChange={ selectRevision }\n\t\t\t\t\tselectedRevisionId={ selectedRevisionId }\n\t\t\t\t\tuserRevisions={ revisions }\n\t\t\t\t/>\n\t\t\t\t{ isLoadButtonEnabled && (\n\t\t\t\t\t<SidebarFixedBottom>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-revisions__button\"\n\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t! globalStylesRevision?.id ||\n\t\t\t\t\t\t\t\tglobalStylesRevision?.id === 'unsaved'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tif ( hasUnsavedChanges ) {\n\t\t\t\t\t\t\t\t\tsetIsLoadingRevisionWithUnsavedChanges(\n\t\t\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\trestoreRevision( globalStylesRevision );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Apply' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</SidebarFixedBottom>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ isLoadingRevisionWithUnsavedChanges && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\ttitle={ __(\n\t\t\t\t\t\t'Loading this revision will discard all unsaved changes.'\n\t\t\t\t\t) }\n\t\t\t\t\tisOpen={ isLoadingRevisionWithUnsavedChanges }\n\t\t\t\t\tconfirmButtonText={ __( ' Discard unsaved changes' ) }\n\t\t\t\t\tonConfirm={ () => restoreRevision( globalStylesRevision ) }\n\t\t\t\t\tonCancel={ () =>\n\t\t\t\t\t\tsetIsLoadingRevisionWithUnsavedChanges( false )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<>\n\t\t\t\t\t\t<h2>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Loading this revision will discard all unsaved changes.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Do you want to replace your unsaved changes in the editor?'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</>\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenRevisions;\n"]}
@@ -32,12 +32,9 @@ var _date = require("@wordpress/date");
32
32
  * @return {string} Translated label.
33
33
  */
34
34
  function getRevisionLabel(revision) {
35
- var _revision$author;
35
+ const authorDisplayName = revision?.author?.name || (0, _i18n.__)('User');
36
36
 
37
- const authorDisplayName = (revision === null || revision === void 0 ? void 0 : (_revision$author = revision.author) === null || _revision$author === void 0 ? void 0 : _revision$author.name) || (0, _i18n.__)('User');
38
- const isUnsaved = 'unsaved' === (revision === null || revision === void 0 ? void 0 : revision.id);
39
-
40
- if (isUnsaved) {
37
+ if ('unsaved' === revision?.id) {
41
38
  return (0, _i18n.sprintf)(
42
39
  /* translators: %(name)s author display name */
43
40
  (0, _i18n.__)('Unsaved changes by %(name)s'), {
@@ -45,8 +42,8 @@ function getRevisionLabel(revision) {
45
42
  });
46
43
  }
47
44
 
48
- const formattedDate = (0, _date.dateI18n)((0, _date.getSettings)().formats.datetimeAbbreviated, (0, _date.getDate)(revision === null || revision === void 0 ? void 0 : revision.modified));
49
- return revision !== null && revision !== void 0 && revision.isLatest ? (0, _i18n.sprintf)(
45
+ const formattedDate = (0, _date.dateI18n)((0, _date.getSettings)().formats.datetimeAbbreviated, (0, _date.getDate)(revision?.modified));
46
+ return revision?.isLatest ? (0, _i18n.sprintf)(
50
47
  /* translators: %(name)s author display name, %(date)s: revision creation date */
51
48
  (0, _i18n.__)('Changes saved by %(name)s on %(date)s (current)'), {
52
49
  name: authorDisplayName,
@@ -62,50 +59,42 @@ function getRevisionLabel(revision) {
62
59
  * Returns a rendered list of revisions buttons.
63
60
  *
64
61
  * @typedef {Object} props
65
- * @property {Array<Object>} userRevisions A collection of user revisions.
66
- * @property {number} currentRevisionId Callback fired when the modal is closed or action cancelled.
67
- * @property {Function} onChange Callback fired when a revision is selected.
62
+ * @property {Array<Object>} userRevisions A collection of user revisions.
63
+ * @property {number} selectedRevisionId The id of the currently-selected revision.
64
+ * @property {Function} onChange Callback fired when a revision is selected.
68
65
  *
69
- * @param {props} Component props.
66
+ * @param {props} Component props.
70
67
  * @return {JSX.Element} The modal component.
71
68
  */
72
69
 
73
70
 
74
- function RevisionsButtons(_ref) {
75
- let {
76
- userRevisions,
77
- currentRevisionId,
78
- onChange
79
- } = _ref;
71
+ function RevisionsButtons({
72
+ userRevisions,
73
+ selectedRevisionId,
74
+ onChange
75
+ }) {
80
76
  return (0, _element.createElement)("ol", {
81
77
  className: "edit-site-global-styles-screen-revisions__revisions-list",
82
78
  "aria-label": (0, _i18n.__)('Global styles revisions'),
83
79
  role: "group"
84
- }, userRevisions.map(revision => {
85
- var _author$avatar_urls;
86
-
80
+ }, userRevisions.map((revision, index) => {
87
81
  const {
88
82
  id,
89
83
  author,
90
- isLatest,
91
84
  modified
92
85
  } = revision;
93
- const authorDisplayName = (author === null || author === void 0 ? void 0 : author.name) || (0, _i18n.__)('User');
94
- const authorAvatar = author === null || author === void 0 ? void 0 : (_author$avatar_urls = author.avatar_urls) === null || _author$avatar_urls === void 0 ? void 0 : _author$avatar_urls['48'];
95
- /*
96
- * If the currentId hasn't been selected yet, the first revision is
97
- * the current one so long as the API returns revisions in descending order.
98
- */
99
-
100
- const isActive = !!currentRevisionId ? id === currentRevisionId : isLatest;
86
+ const authorDisplayName = author?.name || (0, _i18n.__)('User');
87
+ const authorAvatar = author?.avatar_urls?.['48'];
88
+ const isUnsaved = 'unsaved' === revision?.id;
89
+ const isSelected = selectedRevisionId ? selectedRevisionId === revision?.id : index === 0;
101
90
  return (0, _element.createElement)("li", {
102
91
  className: (0, _classnames.default)('edit-site-global-styles-screen-revisions__revision-item', {
103
- 'is-current': isActive
92
+ 'is-selected': isSelected
104
93
  }),
105
94
  key: id
106
95
  }, (0, _element.createElement)(_components.Button, {
107
96
  className: "edit-site-global-styles-screen-revisions__revision-button",
108
- disabled: isActive,
97
+ disabled: isSelected,
109
98
  onClick: () => {
110
99
  onChange(revision);
111
100
  },
@@ -116,12 +105,16 @@ function RevisionsButtons(_ref) {
116
105
  dateTime: modified
117
106
  }, (0, _date.humanTimeDiff)(modified)), (0, _element.createElement)("span", {
118
107
  className: "edit-site-global-styles-screen-revisions__meta"
119
- }, (0, _i18n.sprintf)(
108
+ }, isUnsaved ? (0, _i18n.sprintf)(
109
+ /* translators: %(name)s author display name */
110
+ (0, _i18n.__)('Unsaved changes by %(name)s'), {
111
+ name: authorDisplayName
112
+ }) : (0, _i18n.sprintf)(
120
113
  /* translators: %(name)s author display name */
121
114
  (0, _i18n.__)('Changes saved by %(name)s'), {
122
115
  name: authorDisplayName
123
116
  }), (0, _element.createElement)("img", {
124
- alt: author === null || author === void 0 ? void 0 : author.name,
117
+ alt: author?.name,
125
118
  src: authorAvatar
126
119
  })))));
127
120
  }));
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/revisions-buttons.js"],"names":["getRevisionLabel","revision","authorDisplayName","author","name","isUnsaved","id","formattedDate","formats","datetimeAbbreviated","modified","isLatest","date","RevisionsButtons","userRevisions","currentRevisionId","onChange","map","authorAvatar","avatar_urls","isActive"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAT,CAA2BC,QAA3B,EAAsC;AAAA;;AACrC,QAAMC,iBAAiB,GAAG,CAAAD,QAAQ,SAAR,IAAAA,QAAQ,WAAR,gCAAAA,QAAQ,CAAEE,MAAV,sEAAkBC,IAAlB,KAA0B,cAAI,MAAJ,CAApD;AACA,QAAMC,SAAS,GAAG,eAAcJ,QAAd,aAAcA,QAAd,uBAAcA,QAAQ,CAAEK,EAAxB,CAAlB;;AAEA,MAAKD,SAAL,EAAiB;AAChB,WAAO;AACN;AACA,kBAAI,6BAAJ,CAFM,EAGN;AACCD,MAAAA,IAAI,EAAEF;AADP,KAHM,CAAP;A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A,WACC;AACC,MAAA,SAAS,EAAG,yBACX,yDADW,EAEX;AACC,sBAAcS;AADf,OAFW,CADb;AAOC,MAAA,GAAG,EAAGd;AAPP,OASC,4BAAC,kBAAD;AACC,MAAA,SAAS,EAAC,2DADX;AAEC,MAAA,QAAQ,EAAGc,QAFZ;AAGC,MAAA,OAAO,EAAG,MAAM;AACfJ,QAAAA,QAAQ,CAAEf,QAAF,CAAR;AACA,OALF;AAMC,MAAA,KAAK,EAAGD,gBAAgB,CAAEC,QAAF;AANzB,OAQC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACC;AAAM,MAAA,QAAQ,EAAGS;AAAjB,OACG,yBAAeA,QAAf,CADH,CADD,EAIC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACG;AACD;AACA,kBAAI,2BAAJ,CAFC,EAGD;AACCN,MAAAA,IAAI,EAAEF;AADP,KAHC,CADH,EASC;AACC,MAAA,GAAG,EAAGC,MAAH,aAAGA,MAAH,uBAAGA,MAAM,CAAEC,IADf;AAEC,MAAA,GAAG,EAAGc;AAFP,MATD,CAJD,CARD,CATD,CADD;AAwCA,GApDC,CALH,CADD;AA6DA;;eAEcL,gB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { dateI18n, getDate, humanTimeDiff, getSettings } from '@wordpress/date';\n\n/**\n * Returns a button label for the revision.\n *\n * @param {Object} revision A revision object.\n * @return {string} Translated label.\n */\nfunction getRevisionLabel( revision ) {\n\tconst authorDisplayName = revision?.author?.name || __( 'User' );\n\tconst isUnsaved = 'unsaved' === revision?.id;\n\n\tif ( isUnsaved ) {\n\t\treturn sprintf(\n\t\t\t/* translators: %(name)s author display name */\n\t\t\t__( 'Unsaved changes by %(name)s' ),\n\t\t\t{\n\t\t\t\tname: authorDisplayName,\n\t\t\t}\n\t\t);\n\t}\n\tconst formattedDate = dateI18n(\n\t\tgetSettings().formats.datetimeAbbreviated,\n\t\tgetDate( revision?.modified )\n\t);\n\n\treturn revision?.isLatest\n\t\t? sprintf(\n\t\t\t\t/* translators: %(name)s author display name, %(date)s: revision creation date */\n\t\t\t\t__( 'Changes saved by %(name)s on %(date)s (current)' ),\n\t\t\t\t{\n\t\t\t\t\tname: authorDisplayName,\n\t\t\t\t\tdate: formattedDate,\n\t\t\t\t}\n\t\t )\n\t\t: sprintf(\n\t\t\t\t/* translators: %(name)s author display name, %(date)s: revision creation date */\n\t\t\t\t__( 'Changes saved by %(name)s on %(date)s' ),\n\t\t\t\t{\n\t\t\t\t\tname: authorDisplayName,\n\t\t\t\t\tdate: formattedDate,\n\t\t\t\t}\n\t\t );\n}\n\n/**\n * Returns a rendered list of revisions buttons.\n *\n * @typedef {Object} props\n * @property {Array<Object>} userRevisions A collection of user revisions.\n * @property {number} currentRevisionId Callback fired when the modal is closed or action cancelled.\n * @property {Function} onChange Callback fired when a revision is selected.\n *\n * @param {props} Component props.\n * @return {JSX.Element} The modal component.\n */\nfunction RevisionsButtons( { userRevisions, currentRevisionId, onChange } ) {\n\treturn (\n\t\t<ol\n\t\t\tclassName=\"edit-site-global-styles-screen-revisions__revisions-list\"\n\t\t\taria-label={ __( 'Global styles revisions' ) }\n\t\t\trole=\"group\"\n\t\t>\n\t\t\t{ userRevisions.map( ( revision ) => {\n\t\t\t\tconst { id, author, isLatest, modified } = revision;\n\t\t\t\tconst authorDisplayName = author?.name || __( 'User' );\n\t\t\t\tconst authorAvatar = author?.avatar_urls?.[ '48' ];\n\t\t\t\t/*\n\t\t\t\t * If the currentId hasn't been selected yet, the first revision is\n\t\t\t\t * the current one so long as the API returns revisions in descending order.\n\t\t\t\t */\n\t\t\t\tconst isActive = !! currentRevisionId\n\t\t\t\t\t? id === currentRevisionId\n\t\t\t\t\t: isLatest;\n\n\t\t\t\treturn (\n\t\t\t\t\t<li\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-global-styles-screen-revisions__revision-item',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-current': isActive,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-revisions__revision-button\"\n\t\t\t\t\t\t\tdisabled={ isActive }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonChange( revision );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tlabel={ getRevisionLabel( revision ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__description\">\n\t\t\t\t\t\t\t\t<time dateTime={ modified }>\n\t\t\t\t\t\t\t\t\t{ humanTimeDiff( modified ) }\n\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__meta\">\n\t\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: %(name)s author display name */\n\t\t\t\t\t\t\t\t\t\t__( 'Changes saved by %(name)s' ),\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tname: authorDisplayName,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\talt={ author?.name }\n\t\t\t\t\t\t\t\t\t\tsrc={ authorAvatar }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</li>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ol>\n\t);\n}\n\nexport default RevisionsButtons;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/revisions-buttons.js"],"names":["getRevisionLabel","revision","authorDisplayName","author","name","id","formattedDate","formats","datetimeAbbreviated","modified","isLatest","date","RevisionsButtons","userRevisions","selectedRevisionId","onChange","map","index","authorAvatar","avatar_urls","isUnsaved","isSelected"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAT,CAA2BC,QAA3B,EAAsC;AACrC,QAAMC,iBAAiB,GAAGD,QAAQ,EAAEE,MAAV,EAAkBC,IAAlB,IAA0B,cAAI,MAAJ,CAApD;;AAEA,MAAK,cAAcH,QAAQ,EAAEI,EAA7B,EAAkC;AACjC,WAAO;AACN;AACA,kBAAI,6BAAJ,CAFM,EAGN;AACCD,MAAAA,IAAI,EAAEF;AADP,KAHM,CAAP;AAOA;;AACD,QAAMI,aAAa,GAAG,oBACrB,yBAAcC,OAAd,CAAsBC,mBADD,EAErB,mBAASP,QAAQ,EAAEQ,QAAnB,CAFqB,CAAtB;AAKA,SAAOR,QAAQ,EAAES,QAAV,GACJ;AACA;AACA,gBAAI,iDAAJ,CAFA,EAGA;AACCN,IAAAA,IAAI,EAAEF,iBADP;AAECS,IAAAA,IAAI,EAAEL;AAFP,GAHA,CADI,GASJ;AACA;AACA,gBAAI,uCAAJ,CAFA,EAGA;AACCF,IAAAA,IAAI,EAAEF,iBADP;AAECS,IAAAA,IAAI,EAAEL;AAFP,GAHA,CATH;AAiBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASM,gBAAT,CAA2B;AAAEC,EAAAA,aAAF;AAAiBC,EAAAA,kBAAjB;AAAqCC,EAAAA;AAArC,CAA3B,EAA6E;AAC5E,SACC;AACC,IAAA,SAAS,EAAC,0DADX;AAEC,kBAAa,cAAI,yBAAJ,CAFd;AAGC,IAAA,IAAI,EAAC;AAHN,KAKGF,aAAa,CAACG,GAAd,CAAmB,CAAEf,QAAF,EAAYgB,KAAZ,KAA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';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { dateI18n, getDate, humanTimeDiff, getSettings } from '@wordpress/date';\n\n/**\n * Returns a button label for the revision.\n *\n * @param {Object} revision A revision object.\n * @return {string} Translated label.\n */\nfunction getRevisionLabel( revision ) {\n\tconst authorDisplayName = revision?.author?.name || __( 'User' );\n\n\tif ( 'unsaved' === revision?.id ) {\n\t\treturn sprintf(\n\t\t\t/* translators: %(name)s author display name */\n\t\t\t__( 'Unsaved changes by %(name)s' ),\n\t\t\t{\n\t\t\t\tname: authorDisplayName,\n\t\t\t}\n\t\t);\n\t}\n\tconst formattedDate = dateI18n(\n\t\tgetSettings().formats.datetimeAbbreviated,\n\t\tgetDate( revision?.modified )\n\t);\n\n\treturn revision?.isLatest\n\t\t? sprintf(\n\t\t\t\t/* translators: %(name)s author display name, %(date)s: revision creation date */\n\t\t\t\t__( 'Changes saved by %(name)s on %(date)s (current)' ),\n\t\t\t\t{\n\t\t\t\t\tname: authorDisplayName,\n\t\t\t\t\tdate: formattedDate,\n\t\t\t\t}\n\t\t )\n\t\t: sprintf(\n\t\t\t\t/* translators: %(name)s author display name, %(date)s: revision creation date */\n\t\t\t\t__( 'Changes saved by %(name)s on %(date)s' ),\n\t\t\t\t{\n\t\t\t\t\tname: authorDisplayName,\n\t\t\t\t\tdate: formattedDate,\n\t\t\t\t}\n\t\t );\n}\n\n/**\n * Returns a rendered list of revisions buttons.\n *\n * @typedef {Object} props\n * @property {Array<Object>} userRevisions A collection of user revisions.\n * @property {number} selectedRevisionId The id of the currently-selected revision.\n * @property {Function} onChange Callback fired when a revision is selected.\n *\n * @param {props} Component props.\n * @return {JSX.Element} The modal component.\n */\nfunction RevisionsButtons( { userRevisions, selectedRevisionId, onChange } ) {\n\treturn (\n\t\t<ol\n\t\t\tclassName=\"edit-site-global-styles-screen-revisions__revisions-list\"\n\t\t\taria-label={ __( 'Global styles revisions' ) }\n\t\t\trole=\"group\"\n\t\t>\n\t\t\t{ userRevisions.map( ( revision, index ) => {\n\t\t\t\tconst { id, author, modified } = revision;\n\t\t\t\tconst authorDisplayName = author?.name || __( 'User' );\n\t\t\t\tconst authorAvatar = author?.avatar_urls?.[ '48' ];\n\t\t\t\tconst isUnsaved = 'unsaved' === revision?.id;\n\t\t\t\tconst isSelected = selectedRevisionId\n\t\t\t\t\t? selectedRevisionId === revision?.id\n\t\t\t\t\t: index === 0;\n\n\t\t\t\treturn (\n\t\t\t\t\t<li\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-global-styles-screen-revisions__revision-item',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-selected': isSelected,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-revisions__revision-button\"\n\t\t\t\t\t\t\tdisabled={ isSelected }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonChange( revision );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tlabel={ getRevisionLabel( revision ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__description\">\n\t\t\t\t\t\t\t\t<time dateTime={ modified }>\n\t\t\t\t\t\t\t\t\t{ humanTimeDiff( modified ) }\n\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__meta\">\n\t\t\t\t\t\t\t\t\t{ isUnsaved\n\t\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %(name)s author display name */\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Unsaved changes by %(name)s'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tname: authorDisplayName,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %(name)s author display name */\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Changes saved by %(name)s'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tname: authorDisplayName,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t ) }\n\n\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\talt={ author?.name }\n\t\t\t\t\t\t\t\t\t\tsrc={ authorAvatar }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</li>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ol>\n\t);\n}\n\nexport default RevisionsButtons;\n"]}