@wordpress/edit-site 6.0.0 → 6.1.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 (205) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-page/index.js +2 -1
  3. package/build/components/add-new-page/index.js.map +1 -1
  4. package/build/components/app/index.js +17 -1
  5. package/build/components/app/index.js.map +1 -1
  6. package/build/components/editor/index.js +55 -69
  7. package/build/components/editor/index.js.map +1 -1
  8. package/build/components/editor/use-editor-title.js +39 -0
  9. package/build/components/editor/use-editor-title.js.map +1 -0
  10. package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  11. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  12. package/build/components/global-styles/screen-css.js +1 -1
  13. package/build/components/global-styles/screen-css.js.map +1 -1
  14. package/build/components/global-styles/screen-revisions/index.js +4 -23
  15. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  16. package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  17. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  18. package/build/components/global-styles/shadows-edit-panel.js +1 -0
  19. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  20. package/build/components/global-styles/variations/variation.js +11 -16
  21. package/build/components/global-styles/variations/variation.js.map +1 -1
  22. package/build/components/global-styles/variations/variations-color.js +2 -1
  23. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  24. package/build/components/global-styles/variations/variations-typography.js +1 -0
  25. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  26. package/build/components/global-styles-sidebar/index.js +2 -0
  27. package/build/components/global-styles-sidebar/index.js.map +1 -1
  28. package/build/components/layout/index.js +23 -95
  29. package/build/components/layout/index.js.map +1 -1
  30. package/build/components/page/header.js +1 -0
  31. package/build/components/page/header.js.map +1 -1
  32. package/build/components/page-patterns/header.js +2 -1
  33. package/build/components/page-patterns/header.js.map +1 -1
  34. package/build/components/page-patterns/index.js +5 -5
  35. package/build/components/page-patterns/index.js.map +1 -1
  36. package/build/components/pagination/index.js +17 -8
  37. package/build/components/pagination/index.js.map +1 -1
  38. package/build/components/posts-app/index.js +50 -0
  39. package/build/components/posts-app/index.js.map +1 -0
  40. package/build/components/sidebar-dataviews/dataview-item.js +6 -2
  41. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  42. package/build/components/sidebar-navigation-screen/index.js +1 -1
  43. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  44. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  45. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
  46. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
  47. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  48. package/build/components/sidebar-navigation-screen-patterns/category-item.js +1 -1
  49. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  50. package/build/components/sidebar-navigation-screen-patterns/index.js +1 -1
  51. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  52. package/build/components/site-hub/index.js +38 -128
  53. package/build/components/site-hub/index.js.map +1 -1
  54. package/build/hooks/commands/use-set-command-context.js +53 -0
  55. package/build/hooks/commands/use-set-command-context.js.map +1 -0
  56. package/build/hooks/push-changes-to-global-styles/index.js +3 -2
  57. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  58. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +20 -88
  59. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  60. package/build/index.js +15 -2
  61. package/build/index.js.map +1 -1
  62. package/build/posts.js +34 -0
  63. package/build/posts.js.map +1 -0
  64. package/build/store/private-actions.js +33 -18
  65. package/build/store/private-actions.js.map +1 -1
  66. package/build-module/components/add-new-page/index.js +2 -1
  67. package/build-module/components/add-new-page/index.js.map +1 -1
  68. package/build-module/components/app/index.js +17 -1
  69. package/build-module/components/app/index.js.map +1 -1
  70. package/build-module/components/editor/index.js +55 -69
  71. package/build-module/components/editor/index.js.map +1 -1
  72. package/build-module/components/editor/use-editor-title.js +31 -0
  73. package/build-module/components/editor/use-editor-title.js.map +1 -0
  74. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  75. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  76. package/build-module/components/global-styles/screen-css.js +1 -1
  77. package/build-module/components/global-styles/screen-css.js.map +1 -1
  78. package/build-module/components/global-styles/screen-revisions/index.js +4 -23
  79. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  80. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  81. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  82. package/build-module/components/global-styles/shadows-edit-panel.js +1 -0
  83. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  84. package/build-module/components/global-styles/variations/variation.js +11 -16
  85. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  86. package/build-module/components/global-styles/variations/variations-color.js +3 -2
  87. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  88. package/build-module/components/global-styles/variations/variations-typography.js +1 -0
  89. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  90. package/build-module/components/global-styles-sidebar/index.js +2 -0
  91. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  92. package/build-module/components/layout/index.js +27 -99
  93. package/build-module/components/layout/index.js.map +1 -1
  94. package/build-module/components/page/header.js +1 -0
  95. package/build-module/components/page/header.js.map +1 -1
  96. package/build-module/components/page-patterns/header.js +2 -1
  97. package/build-module/components/page-patterns/header.js.map +1 -1
  98. package/build-module/components/page-patterns/index.js +5 -5
  99. package/build-module/components/page-patterns/index.js.map +1 -1
  100. package/build-module/components/pagination/index.js +17 -8
  101. package/build-module/components/pagination/index.js.map +1 -1
  102. package/build-module/components/posts-app/index.js +43 -0
  103. package/build-module/components/posts-app/index.js.map +1 -0
  104. package/build-module/components/sidebar-dataviews/dataview-item.js +6 -2
  105. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  106. package/build-module/components/sidebar-navigation-screen/index.js +1 -1
  107. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  108. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  109. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
  110. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
  111. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  112. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +2 -2
  113. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  114. package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -1
  115. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  116. package/build-module/components/site-hub/index.js +40 -130
  117. package/build-module/components/site-hub/index.js.map +1 -1
  118. package/build-module/hooks/commands/use-set-command-context.js +46 -0
  119. package/build-module/hooks/commands/use-set-command-context.js.map +1 -0
  120. package/build-module/hooks/push-changes-to-global-styles/index.js +3 -2
  121. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  122. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +19 -86
  123. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  124. package/build-module/index.js +8 -2
  125. package/build-module/index.js.map +1 -1
  126. package/build-module/posts.js +27 -0
  127. package/build-module/posts.js.map +1 -0
  128. package/build-module/store/private-actions.js +33 -18
  129. package/build-module/store/private-actions.js.map +1 -1
  130. package/build-style/posts-rtl.css +1707 -0
  131. package/build-style/posts.css +1707 -0
  132. package/build-style/style-rtl.css +59 -104
  133. package/build-style/style.css +59 -104
  134. package/package.json +41 -41
  135. package/src/components/add-new-page/index.js +2 -1
  136. package/src/components/app/index.js +17 -1
  137. package/src/components/block-editor/style.scss +11 -0
  138. package/src/components/editor/index.js +69 -103
  139. package/src/components/editor/style.scss +1 -5
  140. package/src/components/editor/use-editor-title.js +35 -0
  141. package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  142. package/src/components/global-styles/screen-css.js +1 -1
  143. package/src/components/global-styles/screen-revisions/index.js +4 -24
  144. package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  145. package/src/components/global-styles/screen-revisions/style.scss +4 -8
  146. package/src/components/global-styles/shadows-edit-panel.js +1 -0
  147. package/src/components/global-styles/style.scss +1 -7
  148. package/src/components/global-styles/variations/variation.js +14 -19
  149. package/src/components/global-styles/variations/variations-color.js +12 -4
  150. package/src/components/global-styles/variations/variations-typography.js +5 -1
  151. package/src/components/global-styles-sidebar/index.js +2 -0
  152. package/src/components/global-styles-sidebar/style.scss +0 -1
  153. package/src/components/layout/index.js +41 -137
  154. package/src/components/layout/style.scss +18 -58
  155. package/src/components/page/header.js +1 -0
  156. package/src/components/page/style.scss +6 -0
  157. package/src/components/page-patterns/header.js +8 -2
  158. package/src/components/page-patterns/index.js +15 -12
  159. package/src/components/page-patterns/style.scss +6 -0
  160. package/src/components/pagination/index.js +21 -16
  161. package/src/components/posts-app/index.js +39 -0
  162. package/src/components/sidebar/style.scss +4 -4
  163. package/src/components/sidebar-dataviews/dataview-item.js +6 -2
  164. package/src/components/sidebar-navigation-screen/index.js +1 -1
  165. package/src/components/sidebar-navigation-screen/style.scss +2 -2
  166. package/src/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  167. package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
  168. package/src/components/sidebar-navigation-screen-patterns/category-item.js +11 -2
  169. package/src/components/sidebar-navigation-screen-patterns/index.js +5 -1
  170. package/src/components/site-hub/index.js +55 -146
  171. package/src/components/site-hub/style.scss +1 -4
  172. package/src/components/site-icon/style.scss +0 -4
  173. package/src/hooks/commands/use-set-command-context.js +37 -0
  174. package/src/hooks/push-changes-to-global-styles/index.js +3 -2
  175. package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +1 -875
  176. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +29 -117
  177. package/src/index.js +10 -2
  178. package/src/posts.js +29 -0
  179. package/src/posts.scss +46 -0
  180. package/src/store/private-actions.js +58 -30
  181. package/build/components/block-editor/block-inspector-button.js +0 -57
  182. package/build/components/block-editor/block-inspector-button.js.map +0 -1
  183. package/build/components/block-editor/inserter-media-categories.js +0 -183
  184. package/build/components/block-editor/inserter-media-categories.js.map +0 -1
  185. package/build/components/template-part-converter/convert-to-regular.js +0 -38
  186. package/build/components/template-part-converter/convert-to-regular.js.map +0 -1
  187. package/build/components/template-part-converter/convert-to-template-part.js +0 -84
  188. package/build/components/template-part-converter/convert-to-template-part.js.map +0 -1
  189. package/build/components/template-part-converter/index.js +0 -67
  190. package/build/components/template-part-converter/index.js.map +0 -1
  191. package/build-module/components/block-editor/block-inspector-button.js +0 -50
  192. package/build-module/components/block-editor/block-inspector-button.js.map +0 -1
  193. package/build-module/components/block-editor/inserter-media-categories.js +0 -177
  194. package/build-module/components/block-editor/inserter-media-categories.js.map +0 -1
  195. package/build-module/components/template-part-converter/convert-to-regular.js +0 -31
  196. package/build-module/components/template-part-converter/convert-to-regular.js.map +0 -1
  197. package/build-module/components/template-part-converter/convert-to-template-part.js +0 -79
  198. package/build-module/components/template-part-converter/convert-to-template-part.js.map +0 -1
  199. package/build-module/components/template-part-converter/index.js +0 -59
  200. package/build-module/components/template-part-converter/index.js.map +0 -1
  201. package/src/components/block-editor/block-inspector-button.js +0 -60
  202. package/src/components/block-editor/inserter-media-categories.js +0 -227
  203. package/src/components/template-part-converter/convert-to-regular.js +0 -32
  204. package/src/components/template-part-converter/convert-to-template-part.js +0 -78
  205. package/src/components/template-part-converter/index.js +0 -59
@@ -3,7 +3,12 @@
3
3
  */
4
4
  import SidebarNavigationItem from '../sidebar-navigation-item';
5
5
  import { useLink } from '../routes/link';
6
- import { TEMPLATE_PART_POST_TYPE, PATTERN_TYPES } from '../../utils/constants';
6
+ import {
7
+ TEMPLATE_PART_POST_TYPE,
8
+ TEMPLATE_PART_ALL_AREAS_CATEGORY,
9
+ PATTERN_DEFAULT_CATEGORY,
10
+ PATTERN_TYPES,
11
+ } from '../../utils/constants';
7
12
 
8
13
  export default function CategoryItem( {
9
14
  count,
@@ -14,7 +19,11 @@ export default function CategoryItem( {
14
19
  type,
15
20
  } ) {
16
21
  const linkInfo = useLink( {
17
- categoryId: id,
22
+ categoryId:
23
+ id !== TEMPLATE_PART_ALL_AREAS_CATEGORY &&
24
+ id !== PATTERN_DEFAULT_CATEGORY
25
+ ? id
26
+ : undefined,
18
27
  postType:
19
28
  type === TEMPLATE_PART_POST_TYPE
20
29
  ? TEMPLATE_PART_POST_TYPE
@@ -106,8 +106,12 @@ export default function SidebarNavigationScreenPatterns( { backPath } ) {
106
106
  const {
107
107
  params: { postType, categoryId },
108
108
  } = useLocation();
109
- const currentCategory = categoryId || PATTERN_DEFAULT_CATEGORY;
110
109
  const currentType = postType || PATTERN_TYPES.user;
110
+ const currentCategory =
111
+ categoryId ||
112
+ ( currentType === PATTERN_TYPES.user
113
+ ? PATTERN_DEFAULT_CATEGORY
114
+ : TEMPLATE_PART_ALL_AREAS_CATEGORY );
111
115
 
112
116
  const { templatePartAreas, hasTemplateParts, isLoading } =
113
117
  useTemplatePartAreas();
@@ -7,19 +7,11 @@ import clsx from 'clsx';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { useSelect, useDispatch } from '@wordpress/data';
10
- import {
11
- Button,
12
- __unstableMotion as motion,
13
- __unstableAnimatePresence as AnimatePresence,
14
- __experimentalHStack as HStack,
15
- } from '@wordpress/components';
16
- import { useReducedMotion } from '@wordpress/compose';
10
+ import { Button, __experimentalHStack as HStack } from '@wordpress/components';
17
11
  import { __ } from '@wordpress/i18n';
18
- import { store as blockEditorStore } from '@wordpress/block-editor';
19
12
  import { store as coreStore } from '@wordpress/core-data';
20
- import { store as editorStore } from '@wordpress/editor';
21
13
  import { decodeEntities } from '@wordpress/html-entities';
22
- import { memo } from '@wordpress/element';
14
+ import { memo, forwardRef } from '@wordpress/element';
23
15
  import { search } from '@wordpress/icons';
24
16
  import { store as commandsStore } from '@wordpress/commands';
25
17
  import { displayShortcut } from '@wordpress/keycodes';
@@ -32,14 +24,10 @@ import { store as editSiteStore } from '../../store';
32
24
  import SiteIcon from '../site-icon';
33
25
  import { unlock } from '../../lock-unlock';
34
26
 
35
- const HUB_ANIMATION_DURATION = 0.3;
36
-
37
- const SiteHub = memo( ( { isTransparent, className } ) => {
38
- const { canvasMode, dashboardLink, homeUrl, siteTitle } = useSelect(
39
- ( select ) => {
40
- const { getCanvasMode, getSettings } = unlock(
41
- select( editSiteStore )
42
- );
27
+ const SiteHub = memo(
28
+ forwardRef( ( { isTransparent }, ref ) => {
29
+ const { dashboardLink, homeUrl, siteTitle } = useSelect( ( select ) => {
30
+ const { getSettings } = unlock( select( editSiteStore ) );
43
31
 
44
32
  const {
45
33
  getSite,
@@ -47,7 +35,6 @@ const SiteHub = memo( ( { isTransparent, className } ) => {
47
35
  } = select( coreStore );
48
36
  const _site = getSite();
49
37
  return {
50
- canvasMode: getCanvasMode(),
51
38
  dashboardLink:
52
39
  getSettings().__experimentalDashboardLink || 'index.php',
53
40
  homeUrl: getUnstableBase()?.home,
@@ -56,141 +43,63 @@ const SiteHub = memo( ( { isTransparent, className } ) => {
56
43
  ? filterURLForDisplay( _site?.url )
57
44
  : _site?.title,
58
45
  };
59
- },
60
- []
61
- );
62
- const { open: openCommandCenter } = useDispatch( commandsStore );
63
-
64
- const disableMotion = useReducedMotion();
65
- const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
66
- const { clearSelectedBlock } = useDispatch( blockEditorStore );
67
- const { setDeviceType } = useDispatch( editorStore );
68
- const isBackToDashboardButton = canvasMode === 'view';
69
- const siteIconButtonProps = isBackToDashboardButton
70
- ? {
71
- href: dashboardLink,
72
- label: __( 'Go to the Dashboard' ),
73
- }
74
- : {
75
- href: dashboardLink, // We need to keep the `href` here so the component doesn't remount as a `<button>` and break the animation.
76
- role: 'button',
77
- label: __( 'Open Navigation' ),
78
- onClick: ( event ) => {
79
- event.preventDefault();
80
- if ( canvasMode === 'edit' ) {
81
- clearSelectedBlock();
82
- setDeviceType( 'Desktop' );
83
- setCanvasMode( 'view' );
84
- }
85
- },
86
- };
46
+ }, [] );
47
+ const { open: openCommandCenter } = useDispatch( commandsStore );
87
48
 
88
- return (
89
- <motion.div
90
- className={ clsx( 'edit-site-site-hub', className ) }
91
- variants={ {
92
- isDistractionFree: { x: '-100%' },
93
- isDistractionFreeHovering: { x: 0 },
94
- view: { x: 0 },
95
- edit: { x: 0 },
96
- } }
97
- initial={ false }
98
- transition={ {
99
- type: 'tween',
100
- duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
101
- ease: 'easeOut',
102
- } }
103
- >
104
- <HStack justify="flex-start" spacing="0">
105
- <motion.div
106
- className={ clsx(
107
- 'edit-site-site-hub__view-mode-toggle-container',
108
- {
109
- 'has-transparent-background': isTransparent,
110
- }
111
- ) }
112
- layout
113
- transition={ {
114
- type: 'tween',
115
- duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
116
- ease: 'easeOut',
117
- } }
118
- >
119
- <Button
120
- { ...siteIconButtonProps }
121
- className="edit-site-layout__view-mode-toggle"
49
+ return (
50
+ <div className="edit-site-site-hub">
51
+ <HStack justify="flex-start" spacing="0">
52
+ <div
53
+ className={ clsx(
54
+ 'edit-site-site-hub__view-mode-toggle-container',
55
+ {
56
+ 'has-transparent-background': isTransparent,
57
+ }
58
+ ) }
122
59
  >
123
- <motion.div
124
- initial={ false }
125
- animate={ {
126
- scale: canvasMode === 'view' ? 0.5 : 1,
127
- } }
128
- whileHover={ {
129
- scale: canvasMode === 'view' ? 0.5 : 0.96,
130
- } }
131
- transition={ {
132
- type: 'tween',
133
- duration: disableMotion
134
- ? 0
135
- : HUB_ANIMATION_DURATION,
136
- ease: 'easeOut',
60
+ <Button
61
+ ref={ ref }
62
+ href={ dashboardLink }
63
+ label={ __( 'Go to the Dashboard' ) }
64
+ className="edit-site-layout__view-mode-toggle"
65
+ style={ {
66
+ transform: 'scale(0.5)',
67
+ borderRadius: 4,
137
68
  } }
138
69
  >
139
70
  <SiteIcon className="edit-site-layout__view-mode-toggle-icon" />
140
- </motion.div>
141
- </Button>
142
- </motion.div>
71
+ </Button>
72
+ </div>
143
73
 
144
- <AnimatePresence initial={ false }>
145
- { canvasMode === 'view' && (
74
+ <HStack>
75
+ <div className="edit-site-site-hub__title">
76
+ <Button
77
+ variant="link"
78
+ href={ homeUrl }
79
+ target="_blank"
80
+ label={ __( 'View site (opens in a new tab)' ) }
81
+ >
82
+ { decodeEntities( siteTitle ) }
83
+ </Button>
84
+ </div>
146
85
  <HStack
147
- as={ motion.div }
148
- initial={ { opacity: 0 } }
149
- animate={ {
150
- opacity: isTransparent ? 0 : 1,
151
- } }
152
- exit={ { opacity: 0 } }
153
- transition={ {
154
- type: 'tween',
155
- duration: disableMotion ? 0 : 0.2,
156
- ease: 'easeOut',
157
- delay: canvasMode === 'view' ? 0.1 : 0,
158
- } }
86
+ spacing={ 0 }
87
+ expanded={ false }
88
+ className="edit-site-site-hub__actions"
159
89
  >
160
- <div className="edit-site-site-hub__title">
161
- <Button
162
- variant="link"
163
- href={ homeUrl }
164
- target="_blank"
165
- label={ __(
166
- 'View site (opens in a new tab)'
167
- ) }
168
- aria-label={ __(
169
- 'View site (opens in a new tab)'
170
- ) }
171
- >
172
- { decodeEntities( siteTitle ) }
173
- </Button>
174
- </div>
175
- <HStack
176
- spacing={ 0 }
177
- expanded={ false }
178
- className="edit-site-site-hub__actions"
179
- >
180
- <Button
181
- className="edit-site-site-hub_toggle-command-center"
182
- icon={ search }
183
- onClick={ () => openCommandCenter() }
184
- label={ __( 'Open command palette' ) }
185
- shortcut={ displayShortcut.primary( 'k' ) }
186
- />
187
- </HStack>
90
+ <Button
91
+ className="edit-site-site-hub_toggle-command-center"
92
+ icon={ search }
93
+ onClick={ () => openCommandCenter() }
94
+ label={ __( 'Open command palette' ) }
95
+ shortcut={ displayShortcut.primary( 'k' ) }
96
+ />
188
97
  </HStack>
189
- ) }
190
- </AnimatePresence>
191
- </HStack>
192
- </motion.div>
193
- );
194
- } );
98
+ </HStack>
99
+ </HStack>
100
+ </div>
101
+ );
102
+ } )
103
+ );
195
104
 
196
105
  export default SiteHub;
@@ -3,6 +3,7 @@
3
3
  align-items: center;
4
4
  justify-content: space-between;
5
5
  gap: $grid-unit-10;
6
+ margin-right: $grid-unit-15;
6
7
  }
7
8
 
8
9
  .edit-site-site-hub__actions {
@@ -14,10 +15,6 @@
14
15
  width: $header-height;
15
16
  flex-shrink: 0;
16
17
 
17
- .edit-site-layout__view-mode-toggle-icon {
18
- background: $gray-900;
19
- }
20
-
21
18
  &.has-transparent-background .edit-site-layout__view-mode-toggle-icon {
22
19
  background: transparent;
23
20
  }
@@ -1,8 +1,5 @@
1
1
  .edit-site-site-icon__icon {
2
2
  fill: currentColor;
3
- // Matches SiteIcon motion, smoothing out the transition.
4
- transition: padding 0.3s ease-out;
5
- @include reduce-motion("transition");
6
3
 
7
4
  .edit-site-layout.is-full-canvas & {
8
5
  // Make the WordPress icon not so big in full canvas.
@@ -13,7 +10,6 @@
13
10
  .edit-site-site-icon__image {
14
11
  width: 100%;
15
12
  height: 100%;
16
- border-radius: $radius-block-ui * 2;
17
13
  object-fit: cover;
18
14
  background: #333;
19
15
 
@@ -0,0 +1,37 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useSelect } from '@wordpress/data';
5
+ import { privateApis as commandsPrivateApis } from '@wordpress/commands';
6
+ import { store as blockEditorStore } from '@wordpress/block-editor';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import { store as editSiteStore } from '../../store';
12
+ import { unlock } from '../../lock-unlock';
13
+
14
+ const { useCommandContext } = unlock( commandsPrivateApis );
15
+
16
+ /**
17
+ * React hook used to set the correct command context based on the current state.
18
+ */
19
+ export default function useSetCommandContext() {
20
+ const { hasBlockSelected, canvasMode } = useSelect( ( select ) => {
21
+ const { getCanvasMode } = unlock( select( editSiteStore ) );
22
+ const { getBlockSelectionStart } = select( blockEditorStore );
23
+ return {
24
+ canvasMode: getCanvasMode(),
25
+ hasBlockSelected: getBlockSelectionStart(),
26
+ };
27
+ }, [] );
28
+ // Sets the right context for the command palette
29
+ let commandContext = 'site-editor';
30
+ if ( canvasMode === 'edit' ) {
31
+ commandContext = 'entity-edit';
32
+ }
33
+ if ( hasBlockSelected ) {
34
+ commandContext = 'block-selection-edit';
35
+ }
36
+ useCommandContext( commandContext );
37
+ }
@@ -287,7 +287,7 @@ function PushChangesToGlobalStylesControl( {
287
287
  // notification.
288
288
  __unstableMarkNextChangeAsNotPersistent();
289
289
  setAttributes( newBlockAttributes );
290
- setUserConfig( () => newUserConfig, { undoIgnore: true } );
290
+ setUserConfig( newUserConfig, { undoIgnore: true } );
291
291
  createSuccessNotice(
292
292
  sprintf(
293
293
  // translators: %s: Title of the block e.g. 'Heading'.
@@ -302,7 +302,7 @@ function PushChangesToGlobalStylesControl( {
302
302
  onClick() {
303
303
  __unstableMarkNextChangeAsNotPersistent();
304
304
  setAttributes( attributes );
305
- setUserConfig( () => userConfig, {
305
+ setUserConfig( userConfig, {
306
306
  undoIgnore: true,
307
307
  } );
308
308
  },
@@ -339,6 +339,7 @@ function PushChangesToGlobalStylesControl( {
339
339
  <Button
340
340
  __next40pxDefaultSize
341
341
  variant="secondary"
342
+ __experimentalIsFocusable
342
343
  disabled={ changes.length === 0 }
343
344
  onClick={ pushChanges }
344
345
  >