@wordpress/edit-site 5.15.0 → 5.16.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 (229) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-pattern/index.js +2 -1
  3. package/build/components/add-new-pattern/index.js.map +1 -1
  4. package/build/components/block-editor/use-site-editor-settings.js +29 -2
  5. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  6. package/build/components/editor/index.js +4 -4
  7. package/build/components/editor/index.js.map +1 -1
  8. package/build/components/global-styles/global-styles-provider.js +12 -7
  9. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  10. package/build/components/global-styles/screen-block.js +16 -0
  11. package/build/components/global-styles/screen-block.js.map +1 -1
  12. package/build/components/global-styles/screen-revisions/index.js +12 -5
  13. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  14. package/build/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
  15. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  16. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +32 -25
  17. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  18. package/build/components/global-styles/style-variations-container.js +5 -3
  19. package/build/components/global-styles/style-variations-container.js.map +1 -1
  20. package/build/components/header-edit-mode/document-actions/index.js +4 -2
  21. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  22. package/build/components/keyboard-shortcuts/edit-mode.js +7 -5
  23. package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  24. package/build/components/layout/index.js +9 -2
  25. package/build/components/layout/index.js.map +1 -1
  26. package/build/components/page/index.js +3 -3
  27. package/build/components/page/index.js.map +1 -1
  28. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +1 -1
  29. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  30. package/build/components/page-patterns/patterns-list.js +18 -4
  31. package/build/components/page-patterns/patterns-list.js.map +1 -1
  32. package/build/components/page-patterns/use-patterns.js +20 -3
  33. package/build/components/page-patterns/use-patterns.js.map +1 -1
  34. package/build/components/page-template-parts/index.js +1 -2
  35. package/build/components/page-template-parts/index.js.map +1 -1
  36. package/build/components/page-templates/index.js +1 -16
  37. package/build/components/page-templates/index.js.map +1 -1
  38. package/build/components/resizable-frame/index.js +11 -19
  39. package/build/components/resizable-frame/index.js.map +1 -1
  40. package/build/components/save-button/index.js +4 -2
  41. package/build/components/save-button/index.js.map +1 -1
  42. package/build/components/save-hub/index.js +10 -4
  43. package/build/components/save-hub/index.js.map +1 -1
  44. package/build/components/sidebar-edit-mode/template-panel/index.js +15 -8
  45. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  46. package/build/components/sidebar-navigation-screen/index.js +24 -14
  47. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  48. package/build/components/sidebar-navigation-screen-global-styles/index.js +34 -40
  49. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  50. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  51. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  52. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
  53. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  54. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +8 -0
  55. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  56. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -1
  57. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  58. package/build/components/sidebar-navigation-screen-pages/index.js +2 -0
  59. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  60. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
  61. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  62. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +8 -1
  63. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
  64. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +50 -26
  65. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  66. package/build/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
  67. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  68. package/build/components/sidebar-navigation-screen-patterns/index.js +0 -9
  69. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  70. package/build/components/sidebar-navigation-screen-templates/index.js +1 -10
  71. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  72. package/build/components/sidebar-navigation-screen-templates-browse/index.js +9 -0
  73. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  74. package/build/components/site-hub/index.js +5 -2
  75. package/build/components/site-hub/index.js.map +1 -1
  76. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
  77. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  78. package/build/hooks/commands/use-common-commands.js +57 -27
  79. package/build/hooks/commands/use-common-commands.js.map +1 -1
  80. package/build/hooks/commands/use-edit-mode-commands.js +65 -7
  81. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  82. package/build/hooks/push-changes-to-global-styles/index.js +84 -49
  83. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  84. package/build/store/private-actions.js +2 -1
  85. package/build/store/private-actions.js.map +1 -1
  86. package/build/utils/use-debounced-input.js +5 -7
  87. package/build/utils/use-debounced-input.js.map +1 -1
  88. package/build-module/components/add-new-pattern/index.js +2 -1
  89. package/build-module/components/add-new-pattern/index.js.map +1 -1
  90. package/build-module/components/block-editor/use-site-editor-settings.js +29 -2
  91. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  92. package/build-module/components/editor/index.js +4 -4
  93. package/build-module/components/editor/index.js.map +1 -1
  94. package/build-module/components/global-styles/global-styles-provider.js +12 -7
  95. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  96. package/build-module/components/global-styles/screen-block.js +16 -0
  97. package/build-module/components/global-styles/screen-block.js.map +1 -1
  98. package/build-module/components/global-styles/screen-revisions/index.js +13 -6
  99. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  100. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
  101. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  102. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +28 -21
  103. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  104. package/build-module/components/global-styles/style-variations-container.js +5 -3
  105. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  106. package/build-module/components/header-edit-mode/document-actions/index.js +6 -4
  107. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  108. package/build-module/components/keyboard-shortcuts/edit-mode.js +7 -5
  109. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  110. package/build-module/components/layout/index.js +9 -2
  111. package/build-module/components/layout/index.js.map +1 -1
  112. package/build-module/components/page/index.js +3 -3
  113. package/build-module/components/page/index.js.map +1 -1
  114. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +1 -1
  115. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  116. package/build-module/components/page-patterns/patterns-list.js +19 -5
  117. package/build-module/components/page-patterns/patterns-list.js.map +1 -1
  118. package/build-module/components/page-patterns/use-patterns.js +19 -3
  119. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  120. package/build-module/components/page-template-parts/index.js +1 -2
  121. package/build-module/components/page-template-parts/index.js.map +1 -1
  122. package/build-module/components/page-templates/index.js +2 -15
  123. package/build-module/components/page-templates/index.js.map +1 -1
  124. package/build-module/components/resizable-frame/index.js +12 -20
  125. package/build-module/components/resizable-frame/index.js.map +1 -1
  126. package/build-module/components/save-button/index.js +4 -2
  127. package/build-module/components/save-button/index.js.map +1 -1
  128. package/build-module/components/save-hub/index.js +10 -4
  129. package/build-module/components/save-hub/index.js.map +1 -1
  130. package/build-module/components/sidebar-edit-mode/template-panel/index.js +15 -9
  131. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  132. package/build-module/components/sidebar-navigation-screen/index.js +21 -14
  133. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  134. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +34 -40
  135. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  136. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  137. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  138. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
  139. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  140. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +7 -0
  141. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  142. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +2 -2
  143. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  144. package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -0
  145. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  146. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
  147. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  148. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +7 -1
  149. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
  150. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +49 -26
  151. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  152. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
  153. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  154. package/build-module/components/sidebar-navigation-screen-patterns/index.js +0 -7
  155. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  156. package/build-module/components/sidebar-navigation-screen-templates/index.js +1 -8
  157. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  158. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -0
  159. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  160. package/build-module/components/site-hub/index.js +4 -2
  161. package/build-module/components/site-hub/index.js.map +1 -1
  162. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
  163. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  164. package/build-module/hooks/commands/use-common-commands.js +57 -27
  165. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  166. package/build-module/hooks/commands/use-edit-mode-commands.js +65 -9
  167. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  168. package/build-module/hooks/push-changes-to-global-styles/index.js +84 -49
  169. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  170. package/build-module/store/private-actions.js +2 -1
  171. package/build-module/store/private-actions.js.map +1 -1
  172. package/build-module/utils/use-debounced-input.js +5 -7
  173. package/build-module/utils/use-debounced-input.js.map +1 -1
  174. package/build-style/style-rtl.css +67 -47
  175. package/build-style/style.css +67 -47
  176. package/package.json +39 -39
  177. package/src/components/add-new-pattern/index.js +2 -0
  178. package/src/components/block-editor/use-site-editor-settings.js +22 -2
  179. package/src/components/editor/index.js +3 -3
  180. package/src/components/global-styles/global-styles-provider.js +7 -2
  181. package/src/components/global-styles/screen-block.js +15 -0
  182. package/src/components/global-styles/screen-revisions/index.js +64 -58
  183. package/src/components/global-styles/screen-revisions/revisions-buttons.js +17 -31
  184. package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +14 -1
  185. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +64 -48
  186. package/src/components/global-styles/style-variations-container.js +2 -0
  187. package/src/components/header-edit-mode/document-actions/index.js +8 -4
  188. package/src/components/header-edit-mode/document-actions/style.scss +41 -28
  189. package/src/components/keyboard-shortcuts/edit-mode.js +4 -5
  190. package/src/components/layout/index.js +33 -20
  191. package/src/components/layout/style.scss +2 -2
  192. package/src/components/page/index.js +8 -8
  193. package/src/components/page/style.scss +8 -5
  194. package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +1 -1
  195. package/src/components/page-patterns/patterns-list.js +25 -12
  196. package/src/components/page-patterns/style.scss +9 -8
  197. package/src/components/page-patterns/use-patterns.js +19 -3
  198. package/src/components/page-template-parts/index.js +0 -1
  199. package/src/components/page-templates/index.js +6 -19
  200. package/src/components/resizable-frame/index.js +10 -25
  201. package/src/components/save-button/index.js +2 -0
  202. package/src/components/save-hub/index.js +6 -1
  203. package/src/components/save-hub/style.scss +1 -1
  204. package/src/components/sidebar-edit-mode/template-panel/index.js +15 -11
  205. package/src/components/sidebar-navigation-screen/index.js +24 -16
  206. package/src/components/sidebar-navigation-screen/style.scss +4 -0
  207. package/src/components/sidebar-navigation-screen-details-panel/style.scss +1 -0
  208. package/src/components/sidebar-navigation-screen-global-styles/index.js +48 -44
  209. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -2
  210. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
  211. package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +27 -15
  212. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -4
  213. package/src/components/sidebar-navigation-screen-pages/index.js +9 -4
  214. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
  215. package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +11 -1
  216. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +69 -41
  217. package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -13
  218. package/src/components/sidebar-navigation-screen-patterns/index.js +0 -8
  219. package/src/components/sidebar-navigation-screen-templates/index.js +1 -9
  220. package/src/components/sidebar-navigation-screen-templates-browse/index.js +10 -0
  221. package/src/components/site-hub/index.js +3 -1
  222. package/src/components/site-hub/style.scss +1 -2
  223. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -4
  224. package/src/components/table/style.scss +1 -0
  225. package/src/hooks/commands/use-common-commands.js +63 -23
  226. package/src/hooks/commands/use-edit-mode-commands.js +94 -23
  227. package/src/hooks/push-changes-to-global-styles/index.js +83 -46
  228. package/src/store/private-actions.js +5 -1
  229. package/src/utils/use-debounced-input.js +8 -7
@@ -20,7 +20,9 @@ import { useSupportedStyles } from '../../components/global-styles/hooks';
20
20
  import { unlock } from '../../lock-unlock';
21
21
  const {
22
22
  GlobalStylesContext,
23
- useBlockEditingMode
23
+ useBlockEditingMode,
24
+ __experimentalUseGlobalBehaviors: useGlobalBehaviors,
25
+ __experimentalUseHasBehaviorsPanel: useHasBehaviorsPanel
24
26
  } = unlock(blockEditorPrivateApis); // TODO: Temporary duplication of constant in @wordpress/block-editor. Can be
25
27
  // removed by moving PushChangesToGlobalStylesControl to
26
28
  // @wordpress/block-editor.
@@ -107,7 +109,7 @@ function useChangesToPush(name, attributes) {
107
109
  path,
108
110
  value
109
111
  }] : [];
110
- }), [supports, name, attributes]);
112
+ }), [supports, attributes]);
111
113
  }
112
114
  /**
113
115
  * Sets the value at path of object.
@@ -162,6 +164,9 @@ function PushChangesToGlobalStylesControl({
162
164
  setAttributes
163
165
  }) {
164
166
  const changes = useChangesToPush(name, attributes);
167
+ const hasBehaviorsPanel = useHasBehaviorsPanel(attributes, name, {
168
+ blockSupportOnly: true
169
+ });
165
170
  const {
166
171
  user: userConfig,
167
172
  setUserConfig
@@ -172,64 +177,94 @@ function PushChangesToGlobalStylesControl({
172
177
  const {
173
178
  createSuccessNotice
174
179
  } = useDispatch(noticesStore);
180
+ const {
181
+ inheritedBehaviors,
182
+ setBehavior
183
+ } = useGlobalBehaviors(name);
184
+ const userHasEditedBehaviors = attributes.hasOwnProperty('behaviors') && hasBehaviorsPanel;
175
185
  const pushChanges = useCallback(() => {
176
- if (changes.length === 0) {
186
+ if (changes.length === 0 && !userHasEditedBehaviors) {
177
187
  return;
178
188
  }
179
189
 
180
- const {
181
- style: blockStyles
182
- } = attributes;
183
- const newBlockStyles = cloneDeep(blockStyles);
184
- const newUserConfig = cloneDeep(userConfig);
190
+ if (changes.length > 0) {
191
+ const {
192
+ style: blockStyles
193
+ } = attributes;
194
+ const newBlockStyles = cloneDeep(blockStyles);
195
+ const newUserConfig = cloneDeep(userConfig);
185
196
 
186
- for (const {
187
- path,
188
- value
189
- } of changes) {
190
- setNestedValue(newBlockStyles, path, undefined);
191
- setNestedValue(newUserConfig, ['styles', 'blocks', name, ...path], value);
192
- } // @wordpress/core-data doesn't support editing multiple entity types in
193
- // a single undo level. So for now, we disable @wordpress/core-data undo
194
- // tracking and implement our own Undo button in the snackbar
195
- // notification.
196
-
197
-
198
- __unstableMarkNextChangeAsNotPersistent();
199
-
200
- setAttributes({
201
- style: newBlockStyles
202
- });
203
- setUserConfig(() => newUserConfig, {
204
- undoIgnore: true
205
- });
206
- createSuccessNotice(sprintf( // translators: %s: Title of the block e.g. 'Heading'.
207
- __('%s styles applied.'), getBlockType(name).title), {
208
- type: 'snackbar',
209
- actions: [{
210
- label: __('Undo'),
211
-
212
- onClick() {
213
- __unstableMarkNextChangeAsNotPersistent();
214
-
215
- setAttributes({
216
- style: blockStyles
217
- });
218
- setUserConfig(() => userConfig, {
219
- undoIgnore: true
220
- });
221
- }
222
-
223
- }]
224
- });
197
+ for (const {
198
+ path,
199
+ value
200
+ } of changes) {
201
+ setNestedValue(newBlockStyles, path, undefined);
202
+ setNestedValue(newUserConfig, ['styles', 'blocks', name, ...path], value);
203
+ } // @wordpress/core-data doesn't support editing multiple entity types in
204
+ // a single undo level. So for now, we disable @wordpress/core-data undo
205
+ // tracking and implement our own Undo button in the snackbar
206
+ // notification.
207
+
208
+
209
+ __unstableMarkNextChangeAsNotPersistent();
210
+
211
+ setAttributes({
212
+ style: newBlockStyles
213
+ });
214
+ setUserConfig(() => newUserConfig, {
215
+ undoIgnore: true
216
+ });
217
+ createSuccessNotice(sprintf( // translators: %s: Title of the block e.g. 'Heading'.
218
+ __('%s styles applied.'), getBlockType(name).title), {
219
+ type: 'snackbar',
220
+ actions: [{
221
+ label: __('Undo'),
222
+
223
+ onClick() {
224
+ __unstableMarkNextChangeAsNotPersistent();
225
+
226
+ setAttributes({
227
+ style: blockStyles
228
+ });
229
+ setUserConfig(() => userConfig, {
230
+ undoIgnore: true
231
+ });
232
+ }
233
+
234
+ }]
235
+ });
236
+ }
237
+
238
+ if (userHasEditedBehaviors) {
239
+ __unstableMarkNextChangeAsNotPersistent();
240
+
241
+ setBehavior(attributes.behaviors);
242
+ createSuccessNotice(sprintf( // translators: %s: Title of the block e.g. 'Heading'.
243
+ __('%s behaviors applied.'), getBlockType(name).title), {
244
+ type: 'snackbar',
245
+ actions: [{
246
+ label: __('Undo'),
247
+
248
+ onClick() {
249
+ __unstableMarkNextChangeAsNotPersistent();
250
+
251
+ setBehavior(inheritedBehaviors);
252
+ setUserConfig(() => userConfig, {
253
+ undoIgnore: true
254
+ });
255
+ }
256
+
257
+ }]
258
+ });
259
+ }
225
260
  }, [changes, attributes, userConfig, name]);
226
261
  return createElement(BaseControl, {
227
262
  className: "edit-site-push-changes-to-global-styles-control",
228
263
  help: sprintf( // translators: %s: Title of the block e.g. 'Heading'.
229
- __('Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'), getBlockType(name).title)
264
+ __('Apply this block’s typography, spacing, dimensions, color styles, and behaviors to all %s blocks.'), getBlockType(name).title)
230
265
  }, createElement(BaseControl.VisualLabel, null, __('Styles')), createElement(Button, {
231
266
  variant: "primary",
232
- disabled: changes.length === 0,
267
+ disabled: changes.length === 0 && !userHasEditedBehaviors,
233
268
  onClick: pushChanges
234
269
  }, __('Apply globally')));
235
270
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"names":["addFilter","createHigherOrderComponent","InspectorAdvancedControls","store","blockEditorStore","privateApis","blockEditorPrivateApis","BaseControl","Button","__","sprintf","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","getBlockType","hasBlockSupport","useContext","useMemo","useCallback","useDispatch","noticesStore","useSupportedStyles","unlock","GlobalStylesContext","useBlockEditingMode","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","SUPPORTED_STYLES","getValueFromObjectPath","object","path","value","forEach","fieldName","useChangesToPush","name","attributes","supports","flatMap","key","presetAttributeKey","join","presetAttributeValue","style","setNestedValue","reduce","acc","idx","undefined","Number","isInteger","length","cloneDeep","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","changes","user","userConfig","setUserConfig","__unstableMarkNextChangeAsNotPersistent","createSuccessNotice","pushChanges","blockStyles","newBlockStyles","newUserConfig","undoIgnore","title","type","actions","label","onClick","withPushChangesToGlobalStyles","BlockEdit","props","blockEditingMode","supportsStyles","some","feature"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,kBAA1B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,EAGCC,WAAW,IAAIC,sBAHhB,QAIO,yBAJP;AAKA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,uBAApC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,6BAA6B,IAAIC,cADlC,EAECC,YAFD,EAGCC,eAHD,QAIO,mBAJP;AAKA,SAASC,UAAT,EAAqBC,OAArB,EAA8BC,WAA9B,QAAiD,oBAAjD;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OAAd,CADO,CAAvB;AAIA,SACC,8BACC,cAAC,SAAD,OAAgBJ;AAAhB,IADD,EAEGC,gBAAgB,KAAK,SAArB,IAAkCC,cAAlC,IACD,cAAC,yBAAD,QACC,cAAC,gCAAD,OAAuCF;AAAvC,IADD,CAHF,CADD;AAUA,CAjB8D,CAAhE;AAoBA3E,SAAS,CACR,kBADQ,EAER,8CAFQ,EAGRyE,6BAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext, useBlockEditingMode } = unlock(\n\tblockEditorPrivateApis\n);\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\nfunction useChangesToPush( name, attributes ) {\n\tconst supports = useSupportedStyles( name );\n\n\treturn useMemo(\n\t\t() =>\n\t\t\tsupports.flatMap( ( key ) => {\n\t\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\t\tconst presetAttributeValue =\n\t\t\t\t\tattributes[\n\t\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[\n\t\t\t\t\t\t\tpresetAttributeKey\n\t\t\t\t\t\t]\n\t\t\t\t\t];\n\t\t\t\tconst value = presetAttributeValue\n\t\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t\t: getValueFromObjectPath( attributes.style, path );\n\t\t\t\treturn value ? [ { path, value } ] : [];\n\t\t\t} ),\n\t\t[ supports, name, attributes ]\n\t);\n}\n\n/**\n * Sets the value at path of object.\n * If a portion of path doesn’t exist, it’s created.\n * Arrays are created for missing index properties while objects are created\n * for all other missing properties.\n *\n * This function intentionally mutates the input object.\n *\n * Inspired by _.set().\n *\n * @see https://lodash.com/docs/4.17.15#set\n *\n * @todo Needs to be deduplicated with its copy in `@wordpress/core-data`.\n *\n * @param {Object} object Object to modify\n * @param {Array} path Path of the property to set.\n * @param {*} value Value to set.\n */\nfunction setNestedValue( object, path, value ) {\n\tif ( ! object || typeof object !== 'object' ) {\n\t\treturn object;\n\t}\n\n\tpath.reduce( ( acc, key, idx ) => {\n\t\tif ( acc[ key ] === undefined ) {\n\t\t\tif ( Number.isInteger( path[ idx + 1 ] ) ) {\n\t\t\t\tacc[ key ] = [];\n\t\t\t} else {\n\t\t\t\tacc[ key ] = {};\n\t\t\t}\n\t\t}\n\t\tif ( idx === path.length - 1 ) {\n\t\t\tacc[ key ] = value;\n\t\t}\n\t\treturn acc[ key ];\n\t}, object );\n\n\treturn object;\n}\n\nfunction cloneDeep( object ) {\n\treturn ! object ? {} : JSON.parse( JSON.stringify( object ) );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst changes = useChangesToPush( name, attributes );\n\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { style: blockStyles } = attributes;\n\n\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\tfor ( const { path, value } of changes ) {\n\t\t\tsetNestedValue( newBlockStyles, path, undefined );\n\t\t\tsetNestedValue(\n\t\t\t\tnewUserConfig,\n\t\t\t\t[ 'styles', 'blocks', name, ...path ],\n\t\t\t\tvalue\n\t\t\t);\n\t\t}\n\n\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t// tracking and implement our own Undo button in the snackbar\n\t\t// notification.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { style: newBlockStyles } );\n\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tsetAttributes( { style: blockStyles } );\n\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [ changes, attributes, userConfig, name ] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst blockEditingMode = useBlockEditingMode();\n\t\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\t\thasBlockSupport( props.name, feature )\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ blockEditingMode === 'default' && supportsStyles && (\n\t\t\t\t\t<InspectorAdvancedControls>\n\t\t\t\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t\t\t\t</InspectorAdvancedControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"names":["addFilter","createHigherOrderComponent","InspectorAdvancedControls","store","blockEditorStore","privateApis","blockEditorPrivateApis","BaseControl","Button","__","sprintf","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","getBlockType","hasBlockSupport","useContext","useMemo","useCallback","useDispatch","noticesStore","useSupportedStyles","unlock","GlobalStylesContext","useBlockEditingMode","__experimentalUseGlobalBehaviors","useGlobalBehaviors","__experimentalUseHasBehaviorsPanel","useHasBehaviorsPanel","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","SUPPORTED_STYLES","getValueFromObjectPath","object","path","value","forEach","fieldName","useChangesToPush","name","attributes","supports","flatMap","key","presetAttributeKey","join","presetAttributeValue","style","setNestedValue","reduce","acc","idx","undefined","Number","isInteger","length","cloneDeep","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","changes","hasBehaviorsPanel","blockSupportOnly","user","userConfig","setUserConfig","__unstableMarkNextChangeAsNotPersistent","createSuccessNotice","inheritedBehaviors","setBehavior","userHasEditedBehaviors","hasOwnProperty","pushChanges","blockStyles","newBlockStyles","newUserConfig","undoIgnore","title","type","actions","label","onClick","behaviors","withPushChangesToGlobalStyles","BlockEdit","props","blockEditingMode","supportsStyles","some","feature"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,kBAA1B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,EAGCC,WAAW,IAAIC,sBAHhB,QAIO,yBAJP;AAKA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,uBAApC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,6BAA6B,IAAIC,cADlC,EAECC,YAFD,EAGCC,eAHD,QAIO,mBAJP;AAKA,SAASC,UAAT,EAAqBC,OAArB,EAA8BC,WAA9B,QAAiD,o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jB8D,CAAhE;AAoBAtF,SAAS,CACR,kBADQ,EAER,8CAFQ,EAGRoF,6BAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tGlobalStylesContext,\n\tuseBlockEditingMode,\n\t__experimentalUseGlobalBehaviors: useGlobalBehaviors,\n\t__experimentalUseHasBehaviorsPanel: useHasBehaviorsPanel,\n} = unlock( blockEditorPrivateApis );\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\nfunction useChangesToPush( name, attributes ) {\n\tconst supports = useSupportedStyles( name );\n\n\treturn useMemo(\n\t\t() =>\n\t\t\tsupports.flatMap( ( key ) => {\n\t\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\t\tconst presetAttributeValue =\n\t\t\t\t\tattributes[\n\t\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[\n\t\t\t\t\t\t\tpresetAttributeKey\n\t\t\t\t\t\t]\n\t\t\t\t\t];\n\t\t\t\tconst value = presetAttributeValue\n\t\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t\t: getValueFromObjectPath( attributes.style, path );\n\t\t\t\treturn value ? [ { path, value } ] : [];\n\t\t\t} ),\n\t\t[ supports, attributes ]\n\t);\n}\n\n/**\n * Sets the value at path of object.\n * If a portion of path doesn’t exist, it’s created.\n * Arrays are created for missing index properties while objects are created\n * for all other missing properties.\n *\n * This function intentionally mutates the input object.\n *\n * Inspired by _.set().\n *\n * @see https://lodash.com/docs/4.17.15#set\n *\n * @todo Needs to be deduplicated with its copy in `@wordpress/core-data`.\n *\n * @param {Object} object Object to modify\n * @param {Array} path Path of the property to set.\n * @param {*} value Value to set.\n */\nfunction setNestedValue( object, path, value ) {\n\tif ( ! object || typeof object !== 'object' ) {\n\t\treturn object;\n\t}\n\n\tpath.reduce( ( acc, key, idx ) => {\n\t\tif ( acc[ key ] === undefined ) {\n\t\t\tif ( Number.isInteger( path[ idx + 1 ] ) ) {\n\t\t\t\tacc[ key ] = [];\n\t\t\t} else {\n\t\t\t\tacc[ key ] = {};\n\t\t\t}\n\t\t}\n\t\tif ( idx === path.length - 1 ) {\n\t\t\tacc[ key ] = value;\n\t\t}\n\t\treturn acc[ key ];\n\t}, object );\n\n\treturn object;\n}\n\nfunction cloneDeep( object ) {\n\treturn ! object ? {} : JSON.parse( JSON.stringify( object ) );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst changes = useChangesToPush( name, attributes );\n\n\tconst hasBehaviorsPanel = useHasBehaviorsPanel( attributes, name, {\n\t\tblockSupportOnly: true,\n\t} );\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst { inheritedBehaviors, setBehavior } = useGlobalBehaviors( name );\n\n\tconst userHasEditedBehaviors =\n\t\tattributes.hasOwnProperty( 'behaviors' ) && hasBehaviorsPanel;\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 && ! userHasEditedBehaviors ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( changes.length > 0 ) {\n\t\t\tconst { style: blockStyles } = attributes;\n\n\t\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\t\tfor ( const { path, value } of changes ) {\n\t\t\t\tsetNestedValue( newBlockStyles, path, undefined );\n\t\t\t\tsetNestedValue(\n\t\t\t\t\tnewUserConfig,\n\t\t\t\t\t[ 'styles', 'blocks', name, ...path ],\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t\t// tracking and implement our own Undo button in the snackbar\n\t\t\t// notification.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { style: newBlockStyles } );\n\t\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\t\tgetBlockType( name ).title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tsetAttributes( { style: blockStyles } );\n\t\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\t\tundoIgnore: true,\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],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t\tif ( userHasEditedBehaviors ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetBehavior( attributes.behaviors );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t\t__( '%s behaviors applied.' ),\n\t\t\t\t\tgetBlockType( name ).title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tsetBehavior( inheritedBehaviors );\n\t\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\t\tundoIgnore: true,\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],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}, [ changes, attributes, userConfig, name ] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, color styles, and behaviors to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tdisabled={ changes.length === 0 && ! userHasEditedBehaviors }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst blockEditingMode = useBlockEditingMode();\n\t\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\t\thasBlockSupport( props.name, feature )\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ blockEditingMode === 'default' && supportsStyles && (\n\t\t\t\t\t<InspectorAdvancedControls>\n\t\t\t\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t\t\t\t</InspectorAdvancedControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"]}
@@ -20,8 +20,9 @@ export const setCanvasMode = mode => ({
20
20
  type: 'SET_CANVAS_MODE',
21
21
  mode
22
22
  }); // Check if the block list view should be open by default.
23
+ // If `distractionFree` mode is enabled, the block list view should not be open.
23
24
 
24
- if (mode === 'edit' && registry.select(preferencesStore).get('core/edit-site', 'showListViewByDefault')) {
25
+ if (mode === 'edit' && registry.select(preferencesStore).get('core/edit-site', 'showListViewByDefault') && !registry.select(preferencesStore).get('core/edit-site', 'distractionFree')) {
25
26
  dispatch.setIsListViewOpened(true);
26
27
  } // Switch focus away from editing the template when switching to view mode.
27
28
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/private-actions.js"],"names":["store","blockEditorStore","preferencesStore","setCanvasMode","mode","registry","dispatch","select","__unstableSetEditorMode","type","get","setIsListViewOpened","isPage","setHasPageContentFocus","setEditorCanvasContainerView","view"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GACvBC,IAAF,IACA,CAAE;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,QAAZ;AAAsBC,EAAAA;AAAtB,CAAF,KAAsC;AACrCF,EAAAA,QAAQ,CAACC,QAAT,CAAmBL,gBAAnB,EAAsCO,uBAAtC,CAA+D,MAA/D;;AACAF,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,iBADG;AAETL,IAAAA;AAFS,GAAF,CAAR,CAFqC,CAMrC;;AACA,MACCA,IAAI,KAAK,MAAT,IACAC,QAAQ,CACNE,MADF,CACUL,gBADV,EAEEQ,GAFF,CAEO,gBAFP,EAEyB,uBAFzB,CAFD,EAKE;AACDJ,IAAAA,QAAQ,CAACK,mBAAT,CAA8B,IAA9B;AACA,GAdoC,CAerC;;;AACA,MAAKP,IAAI,KAAK,MAAT,IAAmBG,MAAM,CAACK,MAAP,EAAxB,EAA0C;AACzCN,IAAAA,QAAQ,CAACO,sBAAT,CAAiC,IAAjC;AACA;AACD,CArBK;AAuBP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,4BAA4B,GACtCC,IAAF,IACA,CAAE;AAAET,EAAAA;AAAF,CAAF,KAAoB;AACnBA,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,kCADG;AAETM,IAAAA;AAFS,GAAF,CAAR;AAIA,CAPK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch, select } ) => {\n\t\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'showListViewByDefault' )\n\t\t) {\n\t\t\tdispatch.setIsListViewOpened( true );\n\t\t}\n\t\t// Switch focus away from editing the template when switching to view mode.\n\t\tif ( mode === 'view' && select.isPage() ) {\n\t\t\tdispatch.setHasPageContentFocus( true );\n\t\t}\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/private-actions.js"],"names":["store","blockEditorStore","preferencesStore","setCanvasMode","mode","registry","dispatch","select","__unstableSetEditorMode","type","get","setIsListViewOpened","isPage","setHasPageContentFocus","setEditorCanvasContainerView","view"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GACvBC,IAAF,IACA,CAAE;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,QAAZ;AAAsBC,EAAAA;AAAtB,CAAF,KAAsC;AACrCF,EAAAA,QAAQ,CAACC,QAAT,CAAmBL,gBAAnB,EAAsCO,uBAAtC,CAA+D,MAA/D;;AACAF,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,iBADG;AAETL,IAAAA;AAFS,GAAF,CAAR,CAFqC,CAMrC;AACA;;AACA,MACCA,IAAI,KAAK,MAAT,IACAC,QAAQ,CACNE,MADF,CACUL,gBADV,EAEEQ,GAFF,CAEO,gBAFP,EAEyB,uBAFzB,CADA,IAIA,CAAEL,QAAQ,CACRE,MADA,CACQL,gBADR,EAEAQ,GAFA,CAEK,gBAFL,EAEuB,iBAFvB,CALH,EAQE;AACDJ,IAAAA,QAAQ,CAACK,mBAAT,CAA8B,IAA9B;AACA,GAlBoC,CAmBrC;;;AACA,MAAKP,IAAI,KAAK,MAAT,IAAmBG,MAAM,CAACK,MAAP,EAAxB,EAA0C;AACzCN,IAAAA,QAAQ,CAACO,sBAAT,CAAiC,IAAjC;AACA;AACD,CAzBK;AA2BP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,4BAA4B,GACtCC,IAAF,IACA,CAAE;AAAET,EAAAA;AAAF,CAAF,KAAoB;AACnBA,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,kCADG;AAETM,IAAAA;AAFS,GAAF,CAAR;AAIA,CAPK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch, select } ) => {\n\t\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\t// Check if the block list view should be open by default.\n\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'showListViewByDefault' ) &&\n\t\t\t! registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'distractionFree' )\n\t\t) {\n\t\t\tdispatch.setIsListViewOpened( true );\n\t\t}\n\t\t// Switch focus away from editing the template when switching to view mode.\n\t\tif ( mode === 'view' && select.isPage() ) {\n\t\t\tdispatch.setHasPageContentFocus( true );\n\t\t}\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"]}
@@ -5,13 +5,11 @@ import { useEffect, useState } from '@wordpress/element';
5
5
  import { useDebounce } from '@wordpress/compose';
6
6
  export default function useDebouncedInput(defaultValue = '') {
7
7
  const [input, setInput] = useState(defaultValue);
8
- const [debounced, setter] = useState(defaultValue);
9
- const setDebounced = useDebounce(setter, 250);
8
+ const [debouncedInput, setDebouncedState] = useState(defaultValue);
9
+ const setDebouncedInput = useDebounce(setDebouncedState, 250);
10
10
  useEffect(() => {
11
- if (debounced !== input) {
12
- setDebounced(input);
13
- }
14
- }, [debounced, input]);
15
- return [input, setInput, debounced];
11
+ setDebouncedInput(input);
12
+ }, [input]);
13
+ return [input, setInput, debouncedInput];
16
14
  }
17
15
  //# sourceMappingURL=use-debounced-input.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/utils/use-debounced-input.js"],"names":["useEffect","useState","useDebounce","useDebouncedInput","defaultValue","input","setInput","debounced","setter","setDebounced"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,WAAT,QAA4B,oBAA5B;AAEA,eAAe,SAASC,iBAAT,CAA4BC,YAAY,GAAG,EAA3C,EAAgD;AAC9D,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsBL,QAAQ,CAAEG,YAAF,CAApC;AACA,QAAM,CAAEG,SAAF,EAAaC,MAAb,IAAwBP,QAAQ,CAAEG,YAAF,CAAtC;AACA,QAAMK,YAAY,GAAGP,WAAW,CAAEM,MAAF,EAAU,GAAV,CAAhC;AACAR,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKO,SAAS,KAAKF,KAAnB,EAA2B;AAC1BI,MAAAA,YAAY,CAAEJ,KAAF,CAAZ;AACA;AACD,GAJQ,EAIN,CAAEE,SAAF,EAAaF,KAAb,CAJM,CAAT;AAKA,SAAO,CAAEA,KAAF,EAASC,QAAT,EAAmBC,SAAnB,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\n\nexport default function useDebouncedInput( defaultValue = '' ) {\n\tconst [ input, setInput ] = useState( defaultValue );\n\tconst [ debounced, setter ] = useState( defaultValue );\n\tconst setDebounced = useDebounce( setter, 250 );\n\tuseEffect( () => {\n\t\tif ( debounced !== input ) {\n\t\t\tsetDebounced( input );\n\t\t}\n\t}, [ debounced, input ] );\n\treturn [ input, setInput, debounced ];\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/utils/use-debounced-input.js"],"names":["useEffect","useState","useDebounce","useDebouncedInput","defaultValue","input","setInput","debouncedInput","setDebouncedState","setDebouncedInput"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,WAAT,QAA4B,oBAA5B;AAEA,eAAe,SAASC,iBAAT,CAA4BC,YAAY,GAAG,EAA3C,EAAgD;AAC9D,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsBL,QAAQ,CAAEG,YAAF,CAApC;AACA,QAAM,CAAEG,cAAF,EAAkBC,iBAAlB,IAAwCP,QAAQ,CAAEG,YAAF,CAAtD;AAEA,QAAMK,iBAAiB,GAAGP,WAAW,CAAEM,iBAAF,EAAqB,GAArB,CAArC;AAEAR,EAAAA,SAAS,CAAE,MAAM;AAChBS,IAAAA,iBAAiB,CAAEJ,KAAF,CAAjB;AACA,GAFQ,EAEN,CAAEA,KAAF,CAFM,CAAT;AAIA,SAAO,CAAEA,KAAF,EAASC,QAAT,EAAmBC,cAAnB,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\n\nexport default function useDebouncedInput( defaultValue = '' ) {\n\tconst [ input, setInput ] = useState( defaultValue );\n\tconst [ debouncedInput, setDebouncedState ] = useState( defaultValue );\n\n\tconst setDebouncedInput = useDebounce( setDebouncedState, 250 );\n\n\tuseEffect( () => {\n\t\tsetDebouncedInput( input );\n\t}, [ input ] );\n\n\treturn [ input, setInput, debouncedInput ];\n}\n"]}
@@ -1466,17 +1466,23 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1466
1466
  }
1467
1467
 
1468
1468
  .edit-site-document-actions {
1469
- display: grid;
1470
- grid-template-columns: 1fr 2fr 1fr;
1469
+ display: flex;
1470
+ align-items: center;
1471
1471
  height: 36px;
1472
+ justify-content: space-between;
1472
1473
  min-width: 0;
1473
1474
  background: #f0f0f0;
1474
1475
  border-radius: 4px;
1475
1476
  width: min(100%, 450px);
1476
- overflow: hidden;
1477
1477
  }
1478
- .edit-site-document-actions:hover {
1479
- color: currentColor;
1478
+ .has-fixed-toolbar .edit-site-document-actions {
1479
+ width: min(100%, 380px);
1480
+ }
1481
+ .edit-site-document-actions .components-button {
1482
+ border-radius: 4px;
1483
+ }
1484
+ .edit-site-document-actions .components-button:hover {
1485
+ color: var(--wp-block-synced-color);
1480
1486
  background: #e0e0e0;
1481
1487
  }
1482
1488
  @media (min-width: 782px) {
@@ -1489,28 +1495,34 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1489
1495
  width: min(100%, 450px);
1490
1496
  }
1491
1497
  }
1498
+ .edit-site-document-actions.is-synced-entity .edit-site-document-actions__title {
1499
+ color: var(--wp-block-synced-color);
1500
+ }
1501
+ .edit-site-document-actions.is-synced-entity .edit-site-document-actions__title h1 {
1502
+ color: var(--wp-block-synced-color);
1503
+ }
1492
1504
 
1493
1505
  .edit-site-document-actions__command {
1494
- grid-column: 1/-1;
1495
- display: grid;
1496
- grid-template-columns: 1fr 2fr 1fr;
1497
- grid-row: 1;
1506
+ flex-grow: 1;
1507
+ color: var(--wp-block-synced-color);
1508
+ overflow: hidden;
1498
1509
  }
1499
1510
 
1500
1511
  .edit-site-document-actions__title {
1501
1512
  flex-grow: 1;
1502
- color: var(--wp-block-synced-color);
1503
1513
  overflow: hidden;
1504
- grid-column: 2/3;
1514
+ }
1515
+ .edit-site-document-actions__title:hover {
1516
+ color: var(--wp-block-synced-color);
1505
1517
  }
1506
1518
  .edit-site-document-actions__title .block-editor-block-icon {
1507
1519
  min-width: 24px;
1520
+ flex-shrink: 0;
1508
1521
  }
1509
1522
  .edit-site-document-actions__title h1 {
1510
1523
  white-space: nowrap;
1511
1524
  overflow: hidden;
1512
1525
  text-overflow: ellipsis;
1513
- color: var(--wp-block-synced-color);
1514
1526
  }
1515
1527
  .edit-site-document-actions.is-page .edit-site-document-actions__title {
1516
1528
  color: #2f2f2f;
@@ -1537,31 +1549,25 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1537
1549
  }
1538
1550
  }
1539
1551
 
1540
- .edit-site-document-actions__shortcut,
1541
- .edit-site-document-actions__back {
1542
- color: #2f2f2f;
1543
- }
1544
- .edit-site-document-actions:hover .edit-site-document-actions__shortcut,
1545
- .edit-site-document-actions:hover .edit-site-document-actions__back {
1546
- color: #1e1e1e;
1547
- }
1548
-
1549
1552
  .edit-site-document-actions__shortcut {
1550
- text-align: left;
1553
+ color: #2f2f2f;
1551
1554
  }
1552
1555
 
1553
- .edit-site-document-actions__back {
1556
+ .edit-site-document-actions__back.components-button.has-icon.has-text {
1554
1557
  min-width: 36px;
1555
1558
  flex-shrink: 0;
1556
- grid-column: 1/2;
1557
- grid-row: 1;
1559
+ color: #757575;
1560
+ gap: 0;
1558
1561
  z-index: 1;
1559
1562
  }
1560
- .edit-site-document-actions.is-animated .edit-site-document-actions__back {
1563
+ .edit-site-document-actions__back.components-button.has-icon.has-text:hover {
1564
+ color: currentColor;
1565
+ }
1566
+ .edit-site-document-actions.is-animated .edit-site-document-actions__back.components-button.has-icon.has-text {
1561
1567
  animation: edit-site-document-actions__slide-in-left 0.3s;
1562
1568
  }
1563
1569
  @media (prefers-reduced-motion: reduce) {
1564
- .edit-site-document-actions.is-animated .edit-site-document-actions__back {
1570
+ .edit-site-document-actions.is-animated .edit-site-document-actions__back.components-button.has-icon.has-text {
1565
1571
  animation-duration: 1ms;
1566
1572
  animation-delay: 0s;
1567
1573
  }
@@ -1766,7 +1772,7 @@ body.is-fullscreen-mode .edit-site-list-header {
1766
1772
  color: #2f2f2f;
1767
1773
  background: #fff;
1768
1774
  flex-grow: 1;
1769
- overflow: auto;
1775
+ overflow: hidden;
1770
1776
  margin: 0;
1771
1777
  margin-top: 60px;
1772
1778
  }
@@ -1779,8 +1785,7 @@ body.is-fullscreen-mode .edit-site-list-header {
1779
1785
 
1780
1786
  .edit-site-page-header {
1781
1787
  padding: 0 32px;
1782
- height: 60px;
1783
- padding-right: 32px;
1788
+ min-height: 60px;
1784
1789
  border-bottom: 1px solid #f0f0f0;
1785
1790
  background: #fff;
1786
1791
  position: sticky;
@@ -1799,8 +1804,12 @@ body.is-fullscreen-mode .edit-site-list-header {
1799
1804
  }
1800
1805
 
1801
1806
  .edit-site-page-content {
1802
- padding: 32px 32px;
1803
- overflow-x: auto;
1807
+ height: 100%;
1808
+ display: flex;
1809
+ overflow: auto;
1810
+ flex-flow: column;
1811
+ position: relative;
1812
+ z-index: 1;
1804
1813
  }
1805
1814
 
1806
1815
  .edit-site-patterns {
@@ -1811,13 +1820,6 @@ body.is-fullscreen-mode .edit-site-list-header {
1811
1820
  padding: 0;
1812
1821
  overflow-x: auto;
1813
1822
  }
1814
- .edit-site-patterns .edit-site-page-content {
1815
- height: 100%;
1816
- position: relative;
1817
- padding: 0;
1818
- display: flex;
1819
- flex-flow: column;
1820
- }
1821
1823
  .edit-site-patterns .components-base-control {
1822
1824
  width: 100%;
1823
1825
  }
@@ -1866,6 +1868,9 @@ body.is-fullscreen-mode .edit-site-list-header {
1866
1868
  width: 300px;
1867
1869
  }
1868
1870
  }
1871
+ .edit-site-patterns .edit-site-patterns__sync-status-filter-option:not([aria-checked=true]) {
1872
+ color: #949494;
1873
+ }
1869
1874
  .edit-site-patterns .edit-site-patterns__sync-status-filter-option:active {
1870
1875
  background: #757575;
1871
1876
  color: #f0f0f0;
@@ -1922,6 +1927,16 @@ body.is-fullscreen-mode .edit-site-list-header {
1922
1927
  grid-template-columns: 1fr 1fr;
1923
1928
  }
1924
1929
  }
1930
+ @media (min-width: 1440px) {
1931
+ .edit-site-patterns__grid {
1932
+ grid-template-columns: 1fr 1fr 1fr;
1933
+ }
1934
+ }
1935
+ @media (min-width: 1920px) {
1936
+ .edit-site-patterns__grid {
1937
+ grid-template-columns: 1fr 1fr 1fr 1fr;
1938
+ }
1939
+ }
1925
1940
  .edit-site-patterns__grid .edit-site-patterns__pattern {
1926
1941
  break-inside: avoid-column;
1927
1942
  display: flex;
@@ -2000,6 +2015,7 @@ body.is-fullscreen-mode .edit-site-list-header {
2000
2015
 
2001
2016
  .edit-site-table-wrapper {
2002
2017
  width: 100%;
2018
+ padding: 32px;
2003
2019
  }
2004
2020
 
2005
2021
  .edit-site-table {
@@ -2721,28 +2737,28 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2721
2737
  display: flex;
2722
2738
  }
2723
2739
 
2724
- .edit-site-layout__sidebar {
2740
+ .edit-site-layout__sidebar-region {
2725
2741
  z-index: 1;
2726
2742
  width: 100vw;
2727
2743
  flex-shrink: 0;
2728
2744
  }
2729
2745
  @media (min-width: 782px) {
2730
- .edit-site-layout__sidebar {
2746
+ .edit-site-layout__sidebar-region {
2731
2747
  width: 360px;
2732
2748
  }
2733
2749
  }
2734
- .edit-site-layout.is-full-canvas .edit-site-layout__sidebar {
2750
+ .edit-site-layout.is-full-canvas .edit-site-layout__sidebar-region {
2735
2751
  position: fixed !important;
2736
2752
  height: 100vh;
2737
2753
  right: 0;
2738
2754
  top: 0;
2739
2755
  }
2740
- .edit-site-layout__sidebar > div {
2756
+ .edit-site-layout__sidebar-region .edit-site-layout__sidebar {
2741
2757
  display: flex;
2742
2758
  flex-direction: column;
2743
2759
  height: 100%;
2744
2760
  }
2745
- .edit-site-layout__sidebar .resizable-editor__drag-handle {
2761
+ .edit-site-layout__sidebar-region .resizable-editor__drag-handle {
2746
2762
  left: 0;
2747
2763
  }
2748
2764
 
@@ -2936,7 +2952,7 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2936
2952
  border-top: 1px solid #2f2f2f;
2937
2953
  flex-shrink: 0;
2938
2954
  margin: 0;
2939
- padding: 24px;
2955
+ padding: 20px 24px;
2940
2956
  }
2941
2957
 
2942
2958
  .edit-site-save-hub__button {
@@ -3062,6 +3078,10 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
3062
3078
 
3063
3079
  .edit-site-sidebar-navigation-screen__main {
3064
3080
  flex-grow: 1;
3081
+ margin-bottom: 16px;
3082
+ }
3083
+ .edit-site-sidebar-navigation-screen__main.has-footer {
3084
+ margin-bottom: 0;
3065
3085
  }
3066
3086
 
3067
3087
  .edit-site-sidebar-navigation-screen__content {
@@ -3283,6 +3303,7 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
3283
3303
  .edit-site-sidebar-navigation-details-screen-panel__label.edit-site-sidebar-navigation-details-screen-panel__label {
3284
3304
  color: #949494;
3285
3305
  width: 100px;
3306
+ flex-shrink: 0;
3286
3307
  }
3287
3308
 
3288
3309
  .edit-site-sidebar-navigation-details-screen-panel__value.edit-site-sidebar-navigation-details-screen-panel__value {
@@ -3403,6 +3424,7 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
3403
3424
  }
3404
3425
  .edit-site-site-hub .edit-site-site-hub__site-view-link {
3405
3426
  flex-grow: 0;
3427
+ margin-left: var(--wp-admin-border-width-focus);
3406
3428
  }
3407
3429
  @media (min-width: 480px) {
3408
3430
  .edit-site-site-hub .edit-site-site-hub__site-view-link {
@@ -3411,8 +3433,6 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
3411
3433
  }
3412
3434
  }
3413
3435
  .edit-site-site-hub .edit-site-site-hub__site-view-link:focus {
3414
- outline: none;
3415
- box-shadow: none;
3416
3436
  opacity: 1;
3417
3437
  }
3418
3438
  .edit-site-site-hub .edit-site-site-hub__site-view-link svg {