@wordpress/edit-site 5.5.0 → 5.6.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 (224) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-template/new-template.js +16 -10
  3. package/build/components/add-new-template/new-template.js.map +1 -1
  4. package/build/components/app/index.js +4 -2
  5. package/build/components/app/index.js.map +1 -1
  6. package/build/components/block-editor/editor-canvas.js +2 -1
  7. package/build/components/block-editor/editor-canvas.js.map +1 -1
  8. package/build/components/editor/index.js +2 -4
  9. package/build/components/editor/index.js.map +1 -1
  10. package/build/components/global-styles/border-panel.js +20 -159
  11. package/build/components/global-styles/border-panel.js.map +1 -1
  12. package/build/components/global-styles/context-menu.js +2 -3
  13. package/build/components/global-styles/context-menu.js.map +1 -1
  14. package/build/components/global-styles/hooks.js +11 -26
  15. package/build/components/global-styles/hooks.js.map +1 -1
  16. package/build/components/global-styles/screen-block-list.js +2 -3
  17. package/build/components/global-styles/screen-block-list.js.map +1 -1
  18. package/build/components/global-styles/screen-border.js +13 -5
  19. package/build/components/global-styles/screen-border.js.map +1 -1
  20. package/build/components/global-styles/screen-root.js +2 -1
  21. package/build/components/global-styles/screen-root.js.map +1 -1
  22. package/build/components/global-styles/screen-style-variations.js +2 -1
  23. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  24. package/build/components/layout/index.js +7 -0
  25. package/build/components/layout/index.js.map +1 -1
  26. package/build/components/list/added-by.js +128 -136
  27. package/build/components/list/added-by.js.map +1 -1
  28. package/build/components/list/index.js +2 -1
  29. package/build/components/list/index.js.map +1 -1
  30. package/build/components/list/table.js +6 -5
  31. package/build/components/list/table.js.map +1 -1
  32. package/build/components/routes/link.js +4 -1
  33. package/build/components/routes/link.js.map +1 -1
  34. package/build/components/save-button/index.js +2 -5
  35. package/build/components/save-button/index.js.map +1 -1
  36. package/build/components/save-hub/index.js +82 -0
  37. package/build/components/save-hub/index.js.map +1 -0
  38. package/build/components/sidebar/index.js +2 -4
  39. package/build/components/sidebar/index.js.map +1 -1
  40. package/build/components/sidebar-navigation-screen/index.js +5 -2
  41. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  42. package/build/components/sidebar-navigation-screen-main/index.js +13 -13
  43. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  44. package/build/components/sidebar-navigation-screen-navigation-item/index.js +9 -14
  45. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  46. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +87 -10
  47. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  48. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
  49. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  50. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
  51. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  52. package/build/components/sidebar-navigation-screen-template/index.js +59 -10
  53. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  54. package/build/components/sidebar-navigation-screen-templates/index.js +5 -2
  55. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  56. package/build/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
  57. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  58. package/build/components/site-hub/index.js +3 -1
  59. package/build/components/site-hub/index.js.map +1 -1
  60. package/build/components/style-book/index.js +134 -19
  61. package/build/components/style-book/index.js.map +1 -1
  62. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  63. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  64. package/build/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
  65. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  66. package/build/components/template-details/index.js +0 -3
  67. package/build/components/template-details/index.js.map +1 -1
  68. package/build/components/template-part-converter/convert-to-regular.js +8 -12
  69. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  70. package/build/components/template-part-converter/convert-to-template-part.js +2 -2
  71. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  72. package/build/components/template-part-converter/index.js +19 -14
  73. package/build/components/template-part-converter/index.js.map +1 -1
  74. package/build/components/use-edited-entity-record/index.js +6 -6
  75. package/build/components/use-edited-entity-record/index.js.map +1 -1
  76. package/build/index.js +3 -0
  77. package/build/index.js.map +1 -1
  78. package/build/utils/history.js +8 -2
  79. package/build/utils/history.js.map +1 -1
  80. package/build-module/components/add-new-template/new-template.js +18 -11
  81. package/build-module/components/add-new-template/new-template.js.map +1 -1
  82. package/build-module/components/app/index.js +3 -2
  83. package/build-module/components/app/index.js.map +1 -1
  84. package/build-module/components/block-editor/editor-canvas.js +2 -1
  85. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  86. package/build-module/components/editor/index.js +2 -3
  87. package/build-module/components/editor/index.js.map +1 -1
  88. package/build-module/components/global-styles/border-panel.js +21 -157
  89. package/build-module/components/global-styles/border-panel.js.map +1 -1
  90. package/build-module/components/global-styles/context-menu.js +2 -2
  91. package/build-module/components/global-styles/context-menu.js.map +1 -1
  92. package/build-module/components/global-styles/hooks.js +11 -26
  93. package/build-module/components/global-styles/hooks.js.map +1 -1
  94. package/build-module/components/global-styles/screen-block-list.js +2 -2
  95. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  96. package/build-module/components/global-styles/screen-border.js +11 -2
  97. package/build-module/components/global-styles/screen-border.js.map +1 -1
  98. package/build-module/components/global-styles/screen-root.js +2 -1
  99. package/build-module/components/global-styles/screen-root.js.map +1 -1
  100. package/build-module/components/global-styles/screen-style-variations.js +2 -1
  101. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  102. package/build-module/components/layout/index.js +7 -0
  103. package/build-module/components/layout/index.js.map +1 -1
  104. package/build-module/components/list/added-by.js +126 -137
  105. package/build-module/components/list/added-by.js.map +1 -1
  106. package/build-module/components/list/index.js +2 -1
  107. package/build-module/components/list/index.js.map +1 -1
  108. package/build-module/components/list/table.js +6 -5
  109. package/build-module/components/list/table.js.map +1 -1
  110. package/build-module/components/routes/link.js +5 -2
  111. package/build-module/components/routes/link.js.map +1 -1
  112. package/build-module/components/save-button/index.js +2 -5
  113. package/build-module/components/save-button/index.js.map +1 -1
  114. package/build-module/components/save-hub/index.js +68 -0
  115. package/build-module/components/save-hub/index.js.map +1 -0
  116. package/build-module/components/sidebar/index.js +2 -4
  117. package/build-module/components/sidebar/index.js.map +1 -1
  118. package/build-module/components/sidebar-navigation-screen/index.js +5 -2
  119. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  120. package/build-module/components/sidebar-navigation-screen-main/index.js +13 -13
  121. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  122. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +13 -18
  123. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  124. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +81 -10
  125. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  126. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
  127. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  128. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
  129. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  130. package/build-module/components/sidebar-navigation-screen-template/index.js +60 -13
  131. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  132. package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -2
  133. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  134. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
  135. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  136. package/build-module/components/site-hub/index.js +3 -1
  137. package/build-module/components/site-hub/index.js.map +1 -1
  138. package/build-module/components/style-book/index.js +135 -22
  139. package/build-module/components/style-book/index.js.map +1 -1
  140. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  141. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  142. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
  143. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  144. package/build-module/components/template-details/index.js +0 -3
  145. package/build-module/components/template-details/index.js.map +1 -1
  146. package/build-module/components/template-part-converter/convert-to-regular.js +9 -13
  147. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  148. package/build-module/components/template-part-converter/convert-to-template-part.js +3 -3
  149. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  150. package/build-module/components/template-part-converter/index.js +20 -15
  151. package/build-module/components/template-part-converter/index.js.map +1 -1
  152. package/build-module/components/use-edited-entity-record/index.js +6 -6
  153. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  154. package/build-module/index.js +4 -1
  155. package/build-module/index.js.map +1 -1
  156. package/build-module/utils/history.js +9 -3
  157. package/build-module/utils/history.js.map +1 -1
  158. package/build-style/style-rtl.css +168 -111
  159. package/build-style/style.css +168 -111
  160. package/package.json +31 -31
  161. package/src/components/add-new-template/new-template.js +57 -32
  162. package/src/components/add-new-template/style.scss +12 -1
  163. package/src/components/app/index.js +9 -6
  164. package/src/components/block-editor/editor-canvas.js +2 -1
  165. package/src/components/editor/index.js +61 -65
  166. package/src/components/global-styles/border-panel.js +24 -199
  167. package/src/components/global-styles/context-menu.js +2 -2
  168. package/src/components/global-styles/hooks.js +12 -36
  169. package/src/components/global-styles/screen-block-list.js +2 -2
  170. package/src/components/global-styles/screen-border.js +9 -2
  171. package/src/components/global-styles/screen-root.js +1 -1
  172. package/src/components/global-styles/screen-style-variations.js +5 -1
  173. package/src/components/global-styles/style.scss +10 -0
  174. package/src/components/layout/index.js +15 -0
  175. package/src/components/layout/style.scss +1 -3
  176. package/src/components/list/added-by.js +144 -140
  177. package/src/components/list/index.js +3 -1
  178. package/src/components/list/table.js +7 -4
  179. package/src/components/routes/link.js +9 -2
  180. package/src/components/save-button/index.js +2 -2
  181. package/src/components/save-hub/index.js +78 -0
  182. package/src/components/save-hub/style.scss +15 -0
  183. package/src/components/sidebar/index.js +2 -3
  184. package/src/components/sidebar/style.scss +4 -3
  185. package/src/components/sidebar-button/style.scss +2 -1
  186. package/src/components/sidebar-navigation-item/style.scss +1 -23
  187. package/src/components/sidebar-navigation-screen/index.js +6 -0
  188. package/src/components/sidebar-navigation-screen/style.scss +15 -0
  189. package/src/components/sidebar-navigation-screen-main/index.js +21 -8
  190. package/src/components/sidebar-navigation-screen-navigation-item/index.js +30 -21
  191. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +92 -9
  192. package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
  193. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
  194. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +108 -1
  195. package/src/components/sidebar-navigation-screen-template/index.js +82 -11
  196. package/src/components/sidebar-navigation-screen-template/style.scss +25 -0
  197. package/src/components/sidebar-navigation-screen-templates/index.js +7 -0
  198. package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -1
  199. package/src/components/site-hub/index.js +5 -1
  200. package/src/components/site-hub/style.scss +5 -1
  201. package/src/components/style-book/index.js +209 -54
  202. package/src/components/style-book/style.scss +1 -45
  203. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
  204. package/src/components/sync-state-with-url/use-sync-path-with-url.js +12 -7
  205. package/src/components/template-details/index.js +0 -3
  206. package/src/components/template-part-converter/convert-to-regular.js +10 -17
  207. package/src/components/template-part-converter/convert-to-template-part.js +9 -16
  208. package/src/components/template-part-converter/index.js +28 -12
  209. package/src/components/use-edited-entity-record/index.js +26 -18
  210. package/src/index.js +5 -1
  211. package/src/store/test/actions.js +0 -2
  212. package/src/style.scss +2 -1
  213. package/src/utils/history.js +13 -9
  214. package/build/components/navigation-inspector/index.js +0 -161
  215. package/build/components/navigation-inspector/index.js.map +0 -1
  216. package/build/components/navigation-inspector/navigation-menu.js +0 -79
  217. package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
  218. package/build-module/components/navigation-inspector/index.js +0 -146
  219. package/build-module/components/navigation-inspector/index.js.map +0 -1
  220. package/build-module/components/navigation-inspector/navigation-menu.js +0 -69
  221. package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
  222. package/src/components/navigation-inspector/index.js +0 -191
  223. package/src/components/navigation-inspector/navigation-menu.js +0 -84
  224. package/src/components/navigation-inspector/style.scss +0 -46
@@ -32,7 +32,7 @@ import WelcomeGuide from '../welcome-guide';
32
32
  import StartTemplateOptions from '../start-template-options';
33
33
  import { store as editSiteStore } from '../../store';
34
34
  import { GlobalStylesRenderer } from '../global-styles-renderer';
35
- import { GlobalStylesProvider } from '../global-styles/global-styles-provider';
35
+
36
36
  import useTitle from '../routes/use-title';
37
37
  import CanvasSpinner from '../canvas-spinner';
38
38
  import { unlock } from '../../private-apis';
@@ -157,70 +157,66 @@ export default function Editor() {
157
157
  type={ editedPostType }
158
158
  id={ editedPostId }
159
159
  >
160
- <GlobalStylesProvider>
161
- <BlockContextProvider value={ blockContext }>
162
- <SidebarComplementaryAreaFills />
163
- { isEditMode && <StartTemplateOptions /> }
164
- <InterfaceSkeleton
165
- enableRegionNavigation={ false }
166
- className={
167
- showIconLabels && 'show-icon-labels'
168
- }
169
- notices={ isEditMode && <EditorSnackbars /> }
170
- content={
171
- <>
172
- <GlobalStylesRenderer />
173
- { isEditMode && <EditorNotices /> }
174
- { showVisualEditor && editedPost && (
175
- <BlockEditor />
176
- ) }
177
- { editorMode === 'text' &&
178
- editedPost &&
179
- isEditMode && <CodeEditor /> }
180
- { hasLoadedPost && ! editedPost && (
181
- <Notice
182
- status="warning"
183
- isDismissible={ false }
184
- >
185
- { __(
186
- "You attempted to edit an item that doesn't exist. Perhaps it was deleted?"
187
- ) }
188
- </Notice>
189
- ) }
190
- { isEditMode && (
191
- <KeyboardShortcutsEditMode />
192
- ) }
193
- </>
194
- }
195
- secondarySidebar={
196
- isEditMode &&
197
- ( ( shouldShowInserter && (
198
- <InserterSidebar />
199
- ) ) ||
200
- ( shouldShowListView && (
201
- <ListViewSidebar />
202
- ) ) )
203
- }
204
- sidebar={
205
- isEditMode &&
206
- isRightSidebarOpen && (
207
- <ComplementaryArea.Slot scope="core/edit-site" />
208
- )
209
- }
210
- footer={
211
- showBlockBreakcrumb && (
212
- <BlockBreadcrumb
213
- rootLabelText={ __( 'Template' ) }
214
- />
215
- )
216
- }
217
- labels={ {
218
- ...interfaceLabels,
219
- secondarySidebar: secondarySidebarLabel,
220
- } }
221
- />
222
- </BlockContextProvider>
223
- </GlobalStylesProvider>
160
+ <BlockContextProvider value={ blockContext }>
161
+ <SidebarComplementaryAreaFills />
162
+ { isEditMode && <StartTemplateOptions /> }
163
+ <InterfaceSkeleton
164
+ enableRegionNavigation={ false }
165
+ className={ showIconLabels && 'show-icon-labels' }
166
+ notices={ isEditMode && <EditorSnackbars /> }
167
+ content={
168
+ <>
169
+ <GlobalStylesRenderer />
170
+ { isEditMode && <EditorNotices /> }
171
+ { showVisualEditor && editedPost && (
172
+ <BlockEditor />
173
+ ) }
174
+ { editorMode === 'text' &&
175
+ editedPost &&
176
+ isEditMode && <CodeEditor /> }
177
+ { hasLoadedPost && ! editedPost && (
178
+ <Notice
179
+ status="warning"
180
+ isDismissible={ false }
181
+ >
182
+ { __(
183
+ "You attempted to edit an item that doesn't exist. Perhaps it was deleted?"
184
+ ) }
185
+ </Notice>
186
+ ) }
187
+ { isEditMode && (
188
+ <KeyboardShortcutsEditMode />
189
+ ) }
190
+ </>
191
+ }
192
+ secondarySidebar={
193
+ isEditMode &&
194
+ ( ( shouldShowInserter && (
195
+ <InserterSidebar />
196
+ ) ) ||
197
+ ( shouldShowListView && (
198
+ <ListViewSidebar />
199
+ ) ) )
200
+ }
201
+ sidebar={
202
+ isEditMode &&
203
+ isRightSidebarOpen && (
204
+ <ComplementaryArea.Slot scope="core/edit-site" />
205
+ )
206
+ }
207
+ footer={
208
+ showBlockBreakcrumb && (
209
+ <BlockBreadcrumb
210
+ rootLabelText={ __( 'Template' ) }
211
+ />
212
+ )
213
+ }
214
+ labels={ {
215
+ ...interfaceLabels,
216
+ secondarySidebar: secondarySidebarLabel,
217
+ } }
218
+ />
219
+ </BlockContextProvider>
224
220
  </EntityProvider>
225
221
  </EntityProvider>
226
222
  </>
@@ -1,215 +1,40 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import {
5
- __experimentalBorderRadiusControl as BorderRadiusControl,
6
- privateApis as blockEditorPrivateApis,
7
- } from '@wordpress/block-editor';
8
- import {
9
- __experimentalBorderBoxControl as BorderBoxControl,
10
- __experimentalHasSplitBorders as hasSplitBorders,
11
- __experimentalIsDefinedBorder as isDefinedBorder,
12
- __experimentalToolsPanel as ToolsPanel,
13
- __experimentalToolsPanelItem as ToolsPanelItem,
14
- } from '@wordpress/components';
15
- import { useCallback } from '@wordpress/element';
16
- import { __ } from '@wordpress/i18n';
4
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
17
5
 
18
6
  /**
19
7
  * Internal dependencies
20
8
  */
21
- import { useSupportedStyles, useColorsPerOrigin } from './hooks';
22
9
  import { unlock } from '../../private-apis';
23
10
 
24
- const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
25
-
26
- export function useHasBorderPanel( name ) {
27
- const controls = [
28
- useHasBorderColorControl( name ),
29
- useHasBorderRadiusControl( name ),
30
- useHasBorderStyleControl( name ),
31
- useHasBorderWidthControl( name ),
32
- ];
33
-
34
- return controls.some( Boolean );
35
- }
36
-
37
- function useHasBorderColorControl( name ) {
38
- const supports = useSupportedStyles( name );
39
- return (
40
- useGlobalSetting( 'border.color', name )[ 0 ] &&
41
- supports.includes( 'borderColor' )
42
- );
43
- }
44
-
45
- function useHasBorderRadiusControl( name ) {
46
- const supports = useSupportedStyles( name );
47
- return (
48
- useGlobalSetting( 'border.radius', name )[ 0 ] &&
49
- supports.includes( 'borderRadius' )
50
- );
51
- }
52
-
53
- function useHasBorderStyleControl( name ) {
54
- const supports = useSupportedStyles( name );
55
- return (
56
- useGlobalSetting( 'border.style', name )[ 0 ] &&
57
- supports.includes( 'borderStyle' )
58
- );
59
- }
60
-
61
- function useHasBorderWidthControl( name ) {
62
- const supports = useSupportedStyles( name );
63
- return (
64
- useGlobalSetting( 'border.width', name )[ 0 ] &&
65
- supports.includes( 'borderWidth' )
66
- );
67
- }
68
-
69
- function applyFallbackStyle( border ) {
70
- if ( ! border ) {
71
- return border;
72
- }
73
-
74
- if ( ! border.style && ( border.color || border.width ) ) {
75
- return { ...border, style: 'solid' };
76
- }
77
-
78
- return border;
79
- }
80
-
81
- function applyAllFallbackStyles( border ) {
82
- if ( ! border ) {
83
- return border;
84
- }
85
-
86
- if ( hasSplitBorders( border ) ) {
87
- return {
88
- top: applyFallbackStyle( border.top ),
89
- right: applyFallbackStyle( border.right ),
90
- bottom: applyFallbackStyle( border.bottom ),
91
- left: applyFallbackStyle( border.left ),
92
- };
93
- }
94
-
95
- return applyFallbackStyle( border );
96
- }
11
+ const {
12
+ useGlobalStyle,
13
+ useGlobalSetting,
14
+ useSettingsForBlockElement,
15
+ BorderPanel: StylesBorderPanel,
16
+ } = unlock( blockEditorPrivateApis );
97
17
 
98
18
  export default function BorderPanel( { name, variation = '' } ) {
99
- const prefix = variation ? `variations.${ variation }.` : '';
100
- // To better reflect if the user has customized a value we need to
101
- // ensure the style value being checked is from the `user` origin.
102
- const [ userBorderStyles ] = useGlobalStyle(
103
- `${ prefix }border`,
104
- name,
105
- 'user'
106
- );
107
- const [ border, setBorder ] = useGlobalStyle( `${ prefix }border`, name );
108
- const colors = useColorsPerOrigin( name );
109
-
110
- const showBorderColor = useHasBorderColorControl( name );
111
- const showBorderStyle = useHasBorderStyleControl( name );
112
- const showBorderWidth = useHasBorderWidthControl( name );
113
-
114
- // Border radius.
115
- const showBorderRadius = useHasBorderRadiusControl( name );
116
- const [ borderRadiusValues, setBorderRadius ] = useGlobalStyle(
117
- `${ prefix }border.radius`,
118
- name
119
- );
120
- const hasBorderRadius = () => {
121
- const borderValues = userBorderStyles?.radius;
122
- if ( typeof borderValues === 'object' ) {
123
- return Object.entries( borderValues ).some( Boolean );
124
- }
125
- return !! borderValues;
126
- };
127
-
128
- const resetBorder = () => {
129
- if ( hasBorderRadius() ) {
130
- return setBorder( { radius: userBorderStyles.radius } );
131
- }
132
-
133
- setBorder( undefined );
134
- };
135
-
136
- const resetAll = useCallback( () => setBorder( undefined ), [ setBorder ] );
137
- const onBorderChange = useCallback(
138
- ( newBorder ) => {
139
- // Ensure we have a visible border style when a border width or
140
- // color is being selected.
141
- const newBorderWithStyle = applyAllFallbackStyles( newBorder );
142
-
143
- // As we can't conditionally generate styles based on if other
144
- // style properties have been set we need to force split border
145
- // definitions for user set border styles. Border radius is derived
146
- // from the same property i.e. `border.radius` if it is a string
147
- // that is used. The longhand border radii styles are only generated
148
- // if that property is an object.
149
- //
150
- // For borders (color, style, and width) those are all properties on
151
- // the `border` style property. This means if the theme.json defined
152
- // split borders and the user condenses them into a flat border or
153
- // vice-versa we'd get both sets of styles which would conflict.
154
- const updatedBorder = ! hasSplitBorders( newBorderWithStyle )
155
- ? {
156
- top: newBorderWithStyle,
157
- right: newBorderWithStyle,
158
- bottom: newBorderWithStyle,
159
- left: newBorderWithStyle,
160
- }
161
- : {
162
- color: null,
163
- style: null,
164
- width: null,
165
- ...newBorderWithStyle,
166
- };
19
+ let prefixParts = [];
20
+ if ( variation ) {
21
+ prefixParts = [ 'variations', variation ].concat( prefixParts );
22
+ }
23
+ const prefix = prefixParts.join( '.' );
167
24
 
168
- // As radius is maintained separately to color, style, and width
169
- // maintain its value. Undefined values here will be cleaned when
170
- // global styles are saved.
171
- setBorder( { radius: border?.radius, ...updatedBorder } );
172
- },
173
- [ setBorder, border?.radius ]
174
- );
25
+ const [ style ] = useGlobalStyle( prefix, name, 'user', false );
26
+ const [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {
27
+ shouldDecodeEncode: false,
28
+ } );
29
+ const [ rawSettings ] = useGlobalSetting( '', name );
30
+ const settings = useSettingsForBlockElement( rawSettings, name );
175
31
 
176
32
  return (
177
- <ToolsPanel label={ __( 'Border' ) } resetAll={ resetAll }>
178
- { ( showBorderWidth || showBorderColor ) && (
179
- <ToolsPanelItem
180
- hasValue={ () => isDefinedBorder( userBorderStyles ) }
181
- label={ __( 'Border' ) }
182
- onDeselect={ () => resetBorder() }
183
- isShownByDefault={ true }
184
- >
185
- <BorderBoxControl
186
- colors={ colors }
187
- enableAlpha={ true }
188
- enableStyle={ showBorderStyle }
189
- onChange={ onBorderChange }
190
- popoverOffset={ 40 }
191
- popoverPlacement="left-start"
192
- value={ border }
193
- __experimentalIsRenderedInSidebar={ true }
194
- size={ '__unstable-large' }
195
- />
196
- </ToolsPanelItem>
197
- ) }
198
- { showBorderRadius && (
199
- <ToolsPanelItem
200
- hasValue={ hasBorderRadius }
201
- label={ __( 'Radius' ) }
202
- onDeselect={ () => setBorderRadius( undefined ) }
203
- isShownByDefault={ true }
204
- >
205
- <BorderRadiusControl
206
- values={ borderRadiusValues }
207
- onChange={ ( value ) => {
208
- setBorderRadius( value || undefined );
209
- } }
210
- />
211
- </ToolsPanelItem>
212
- ) }
213
- </ToolsPanel>
33
+ <StylesBorderPanel
34
+ inheritedValue={ inheritedStyle }
35
+ value={ style }
36
+ onChange={ setStyle }
37
+ settings={ settings }
38
+ />
214
39
  );
215
40
  }
@@ -27,7 +27,6 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
27
27
  /**
28
28
  * Internal dependencies
29
29
  */
30
- import { useHasBorderPanel } from './border-panel';
31
30
  import { useHasColorPanel } from './color-utils';
32
31
  import { useHasFilterPanel } from './filter-utils';
33
32
  import { useHasVariationsPanel } from './variations-panel';
@@ -40,6 +39,7 @@ import { unlock } from '../../private-apis';
40
39
  const {
41
40
  useHasDimensionsPanel,
42
41
  useHasTypographyPanel,
42
+ useHasBorderPanel,
43
43
  useGlobalSetting,
44
44
  useSettingsForBlockElement,
45
45
  } = unlock( blockEditorPrivateApis );
@@ -49,7 +49,7 @@ function ContextMenu( { name, parentMenu = '' } ) {
49
49
  const settings = useSettingsForBlockElement( rawSettings, name );
50
50
  const hasTypographyPanel = useHasTypographyPanel( settings );
51
51
  const hasColorPanel = useHasColorPanel( name );
52
- const hasBorderPanel = useHasBorderPanel( name );
52
+ const hasBorderPanel = useHasBorderPanel( settings );
53
53
  const hasEffectsPanel = useHasShadowControl( name );
54
54
  const hasFilterPanel = useHasFilterPanel( name );
55
55
  const hasDimensionsPanel = useHasDimensionsPanel( settings );
@@ -18,7 +18,8 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
18
18
  import { unlock } from '../../private-apis';
19
19
  import { useSelect } from '@wordpress/data';
20
20
 
21
- const { useGlobalSetting } = unlock( blockEditorPrivateApis );
21
+ const { useGlobalSetting, useColorsPerOrigin: useColorsPerOriginFromSettings } =
22
+ unlock( blockEditorPrivateApis );
22
23
 
23
24
  // Enable colord's a11y plugin.
24
25
  extend( [ a11yPlugin ] );
@@ -31,41 +32,16 @@ export function useColorsPerOrigin( name ) {
31
32
  'color.defaultPalette'
32
33
  );
33
34
 
34
- return useMemo( () => {
35
- const result = [];
36
- if ( themeColors && themeColors.length ) {
37
- result.push( {
38
- name: _x(
39
- 'Theme',
40
- 'Indicates this palette comes from the theme.'
41
- ),
42
- colors: themeColors,
43
- } );
44
- }
45
- if (
46
- shouldDisplayDefaultColors &&
47
- defaultColors &&
48
- defaultColors.length
49
- ) {
50
- result.push( {
51
- name: _x(
52
- 'Default',
53
- 'Indicates this palette comes from WordPress.'
54
- ),
55
- colors: defaultColors,
56
- } );
57
- }
58
- if ( customColors && customColors.length ) {
59
- result.push( {
60
- name: _x(
61
- 'Custom',
62
- 'Indicates this palette is created by the user.'
63
- ),
64
- colors: customColors,
65
- } );
66
- }
67
- return result;
68
- }, [ customColors, themeColors, defaultColors ] );
35
+ return useColorsPerOriginFromSettings( {
36
+ color: {
37
+ palette: {
38
+ custom: customColors,
39
+ theme: themeColors,
40
+ default: defaultColors,
41
+ },
42
+ defaultPalette: shouldDisplayDefaultColors,
43
+ },
44
+ } );
69
45
  }
70
46
 
71
47
  export function useGradientsPerOrigin( name ) {
@@ -20,7 +20,6 @@ import { speak } from '@wordpress/a11y';
20
20
  /**
21
21
  * Internal dependencies
22
22
  */
23
- import { useHasBorderPanel } from './border-panel';
24
23
  import { useHasColorPanel } from './color-utils';
25
24
  import { useHasVariationsPanel } from './variations-panel';
26
25
  import ScreenHeader from './header';
@@ -30,6 +29,7 @@ import { unlock } from '../../private-apis';
30
29
  const {
31
30
  useHasDimensionsPanel,
32
31
  useHasTypographyPanel,
32
+ useHasBorderPanel,
33
33
  useGlobalSetting,
34
34
  useSettingsForBlockElement,
35
35
  } = unlock( blockEditorPrivateApis );
@@ -62,7 +62,7 @@ function BlockMenuItem( { block } ) {
62
62
  const settings = useSettingsForBlockElement( rawSettings, block.name );
63
63
  const hasTypographyPanel = useHasTypographyPanel( settings );
64
64
  const hasColorPanel = useHasColorPanel( block.name );
65
- const hasBorderPanel = useHasBorderPanel( block.name );
65
+ const hasBorderPanel = useHasBorderPanel( settings );
66
66
  const hasDimensionsPanel = useHasDimensionsPanel( settings );
67
67
  const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
68
68
  const hasVariationsPanel = useHasVariationsPanel( block.name );
@@ -2,17 +2,24 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
8
9
  */
9
10
  import ScreenHeader from './header';
10
- import BorderPanel, { useHasBorderPanel } from './border-panel';
11
+ import BorderPanel from './border-panel';
11
12
  import BlockPreviewPanel from './block-preview-panel';
12
13
  import { getVariationClassName } from './utils';
14
+ import { unlock } from '../../private-apis';
15
+
16
+ const { useHasBorderPanel, useGlobalSetting, useSettingsForBlockElement } =
17
+ unlock( blockEditorPrivateApis );
13
18
 
14
19
  function ScreenBorder( { name, variation = '' } ) {
15
- const hasBorderPanel = useHasBorderPanel( name );
20
+ const [ rawSettings ] = useGlobalSetting( '', name );
21
+ const settings = useSettingsForBlockElement( rawSettings, name );
22
+ const hasBorderPanel = useHasBorderPanel( settings );
16
23
  const variationClassName = getVariationClassName( variation );
17
24
  return (
18
25
  <>
@@ -51,7 +51,7 @@ function ScreenRoot() {
51
51
  }, [] );
52
52
 
53
53
  return (
54
- <Card size="small">
54
+ <Card size="small" className="edit-site-global-styles-screen-root">
55
55
  <CardBody>
56
56
  <VStack spacing={ 4 }>
57
57
  <Card>
@@ -172,7 +172,11 @@ function ScreenStyleVariations() {
172
172
  ) }
173
173
  />
174
174
 
175
- <Card size="small" isBorderless>
175
+ <Card
176
+ size="small"
177
+ isBorderless
178
+ className="edit-site-global-styles-screen-style-variations"
179
+ >
176
180
  <CardBody>
177
181
  <Grid columns={ 2 }>
178
182
  { withEmptyVariation?.map( ( variation, index ) => (
@@ -241,3 +241,13 @@
241
241
  height: 24px;
242
242
  width: 24px;
243
243
  }
244
+
245
+ .edit-site-global-styles-screen-root.edit-site-global-styles-screen-root,
246
+ .edit-site-global-styles-screen-style-variations.edit-site-global-styles-screen-style-variations {
247
+ background: unset;
248
+ color: inherit;
249
+ }
250
+
251
+ .edit-site-global-styles-sidebar__panel .block-editor-block-icon svg {
252
+ fill: currentColor;
253
+ }
@@ -277,6 +277,21 @@ export default function Layout() {
277
277
  { canvasResizer }
278
278
  { !! canvasSize.width && (
279
279
  <motion.div
280
+ whileHover={
281
+ isEditorPage && canvasMode === 'view'
282
+ ? {
283
+ scale: 1.005,
284
+ transition: {
285
+ duration:
286
+ disableMotion ||
287
+ isResizing
288
+ ? 0
289
+ : 0.5,
290
+ ease: 'easeOut',
291
+ },
292
+ }
293
+ : {}
294
+ }
280
295
  initial={ false }
281
296
  layout="position"
282
297
  className="edit-site-layout__canvas"
@@ -49,11 +49,9 @@
49
49
  }
50
50
 
51
51
  .edit-site-layout__content {
52
+ height: 100%;
52
53
  flex-grow: 1;
53
54
  display: flex;
54
-
55
- // Hide scrollbars during the edit/view animation.
56
- overflow: hidden;
57
55
  }
58
56
 
59
57
  .edit-site-layout__sidebar {