@wordpress/edit-site 4.3.5 → 4.5.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 (87) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/block-editor/index.js +1 -1
  3. package/build/components/block-editor/index.js.map +1 -1
  4. package/build/components/global-styles/border-panel.js +100 -79
  5. package/build/components/global-styles/border-panel.js.map +1 -1
  6. package/build/components/global-styles/context-menu.js +3 -3
  7. package/build/components/global-styles/context-menu.js.map +1 -1
  8. package/build/components/global-styles/header.js +15 -11
  9. package/build/components/global-styles/header.js.map +1 -1
  10. package/build/components/global-styles/navigation-button.js +4 -4
  11. package/build/components/global-styles/navigation-button.js.map +1 -1
  12. package/build/components/global-styles/palette.js +1 -1
  13. package/build/components/global-styles/palette.js.map +1 -1
  14. package/build/components/global-styles/screen-block-list.js +1 -1
  15. package/build/components/global-styles/screen-block-list.js.map +1 -1
  16. package/build/components/global-styles/screen-colors.js +3 -3
  17. package/build/components/global-styles/screen-colors.js.map +1 -1
  18. package/build/components/global-styles/screen-root.js +13 -3
  19. package/build/components/global-styles/screen-root.js.map +1 -1
  20. package/build/components/global-styles/screen-typography.js +1 -1
  21. package/build/components/global-styles/screen-typography.js.map +1 -1
  22. package/build/components/global-styles/use-global-styles-output.js +18 -7
  23. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  24. package/build/components/secondary-sidebar/list-view-sidebar.js +1 -5
  25. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  26. package/build/components/sidebar/index.js +1 -1
  27. package/build/components/sidebar/index.js.map +1 -1
  28. package/build/components/sidebar/navigation-menu-sidebar/index.js +4 -2
  29. package/build/components/sidebar/navigation-menu-sidebar/index.js.map +1 -1
  30. package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js +1 -5
  31. package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -1
  32. package/build/index.js +0 -1
  33. package/build/index.js.map +1 -1
  34. package/build-module/components/block-editor/index.js +2 -2
  35. package/build-module/components/block-editor/index.js.map +1 -1
  36. package/build-module/components/global-styles/border-panel.js +103 -80
  37. package/build-module/components/global-styles/border-panel.js.map +1 -1
  38. package/build-module/components/global-styles/context-menu.js +4 -4
  39. package/build-module/components/global-styles/context-menu.js.map +1 -1
  40. package/build-module/components/global-styles/header.js +16 -11
  41. package/build-module/components/global-styles/header.js.map +1 -1
  42. package/build-module/components/global-styles/navigation-button.js +3 -3
  43. package/build-module/components/global-styles/navigation-button.js.map +1 -1
  44. package/build-module/components/global-styles/palette.js +2 -2
  45. package/build-module/components/global-styles/palette.js.map +1 -1
  46. package/build-module/components/global-styles/screen-block-list.js +2 -2
  47. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  48. package/build-module/components/global-styles/screen-colors.js +4 -4
  49. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  50. package/build-module/components/global-styles/screen-root.js +15 -5
  51. package/build-module/components/global-styles/screen-root.js.map +1 -1
  52. package/build-module/components/global-styles/screen-typography.js +2 -2
  53. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  54. package/build-module/components/global-styles/use-global-styles-output.js +17 -7
  55. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  56. package/build-module/components/secondary-sidebar/list-view-sidebar.js +1 -5
  57. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  58. package/build-module/components/sidebar/index.js +3 -3
  59. package/build-module/components/sidebar/index.js.map +1 -1
  60. package/build-module/components/sidebar/navigation-menu-sidebar/index.js +4 -2
  61. package/build-module/components/sidebar/navigation-menu-sidebar/index.js.map +1 -1
  62. package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js +1 -5
  63. package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -1
  64. package/build-module/index.js +0 -1
  65. package/build-module/index.js.map +1 -1
  66. package/build-style/style-rtl.css +58 -29
  67. package/build-style/style.css +58 -29
  68. package/package.json +29 -29
  69. package/src/components/block-editor/index.js +2 -2
  70. package/src/components/global-styles/border-panel.js +112 -109
  71. package/src/components/global-styles/context-menu.js +7 -7
  72. package/src/components/global-styles/header.js +20 -17
  73. package/src/components/global-styles/navigation-button.js +3 -3
  74. package/src/components/global-styles/palette.js +3 -3
  75. package/src/components/global-styles/screen-block-list.js +3 -3
  76. package/src/components/global-styles/screen-colors.js +7 -7
  77. package/src/components/global-styles/screen-root.js +34 -24
  78. package/src/components/global-styles/screen-typography.js +3 -3
  79. package/src/components/global-styles/test/use-global-styles-output.js +1 -0
  80. package/src/components/global-styles/use-global-styles-output.js +30 -7
  81. package/src/components/header/style.scss +14 -29
  82. package/src/components/secondary-sidebar/list-view-sidebar.js +1 -5
  83. package/src/components/sidebar/index.js +2 -2
  84. package/src/components/sidebar/navigation-menu-sidebar/index.js +4 -1
  85. package/src/components/sidebar/navigation-menu-sidebar/navigation-menu.js +1 -7
  86. package/src/components/sidebar/style.scss +56 -0
  87. package/src/index.js +0 -1
@@ -26,15 +26,12 @@ import { useEffect, useState, useContext } from '@wordpress/element';
26
26
  import { getCSSRules } from '@wordpress/style-engine';
27
27
  import { __unstablePresetDuotoneFilter as PresetDuotoneFilter } from '@wordpress/block-editor';
28
28
 
29
- /**
30
- * Internal dependencies
31
- */
32
-
33
29
  /**
34
30
  * Internal dependencies
35
31
  */
36
32
  import { PRESET_METADATA, ROOT_BLOCK_SELECTOR } from './utils';
37
33
  import { GlobalStylesContext } from './context';
34
+ import { useSetting } from './hooks';
38
35
 
39
36
  function compileStyleValue( uncompiledValue ) {
40
37
  const VARIABLE_REFERENCE_PREFIX = 'var:';
@@ -363,7 +360,7 @@ export const toCustomProperties = ( tree, blockSelectors ) => {
363
360
  return ruleset;
364
361
  };
365
362
 
366
- export const toStyles = ( tree, blockSelectors ) => {
363
+ export const toStyles = ( tree, blockSelectors, hasBlockGapSupport ) => {
367
364
  const nodesWithStyles = getNodesWithStyles( tree, blockSelectors );
368
365
  const nodesWithSettings = getNodesWithSettings( tree, blockSelectors );
369
366
 
@@ -402,6 +399,26 @@ export const toStyles = ( tree, blockSelectors ) => {
402
399
  ruleset = ruleset + `${ selector }{${ declarations.join( ';' ) };}`;
403
400
  } );
404
401
 
402
+ /* Add alignment / layout styles */
403
+ ruleset =
404
+ ruleset +
405
+ '.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';
406
+ ruleset =
407
+ ruleset +
408
+ '.wp-site-blocks > .alignright { float: right; margin-left: 2em; }';
409
+ ruleset =
410
+ ruleset +
411
+ '.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }';
412
+
413
+ if ( hasBlockGapSupport ) {
414
+ ruleset =
415
+ ruleset +
416
+ '.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }';
417
+ ruleset =
418
+ ruleset +
419
+ '.wp-site-blocks > * + * { margin-block-start: var( --wp--style--block-gap ); }';
420
+ }
421
+
405
422
  nodesWithSettings.forEach( ( { selector, presets } ) => {
406
423
  if ( ROOT_BLOCK_SELECTOR === selector ) {
407
424
  // Do not add extra specificity for top-level classes.
@@ -448,6 +465,8 @@ export function useGlobalStylesOutput() {
448
465
  const [ settings, setSettings ] = useState( {} );
449
466
  const [ svgFilters, setSvgFilters ] = useState( {} );
450
467
  const { merged: mergedConfig } = useContext( GlobalStylesContext );
468
+ const [ blockGap ] = useSetting( 'spacing.blockGap' );
469
+ const hasBlockGapSupport = blockGap !== null;
451
470
 
452
471
  useEffect( () => {
453
472
  if ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {
@@ -459,7 +478,11 @@ export function useGlobalStylesOutput() {
459
478
  mergedConfig,
460
479
  blockSelectors
461
480
  );
462
- const globalStyles = toStyles( mergedConfig, blockSelectors );
481
+ const globalStyles = toStyles(
482
+ mergedConfig,
483
+ blockSelectors,
484
+ hasBlockGapSupport
485
+ );
463
486
  const filters = toSvgFilters( mergedConfig, blockSelectors );
464
487
  setStylesheets( [
465
488
  {
@@ -475,5 +498,5 @@ export function useGlobalStylesOutput() {
475
498
  setSvgFilters( filters );
476
499
  }, [ mergedConfig ] );
477
500
 
478
- return [ stylesheets, settings, svgFilters ];
501
+ return [ stylesheets, settings, svgFilters, hasBlockGapSupport ];
479
502
  }
@@ -104,8 +104,9 @@ body.is-navigation-sidebar-open {
104
104
  margin: 0 -6px 0;
105
105
  }
106
106
 
107
+
107
108
  /**
108
- * Buttons in the Toolbar
109
+ * Buttons on the right side
109
110
  */
110
111
 
111
112
  .edit-site-header__actions {
@@ -113,36 +114,23 @@ body.is-navigation-sidebar-open {
113
114
  align-items: center;
114
115
  padding-right: $grid-unit-05;
115
116
 
116
- .interface-pinned-items {
117
- display: none;
118
-
119
- @include break-medium() {
120
- display: inline-flex;
121
- }
117
+ @include break-small () {
118
+ padding-right: $grid-unit-20 - ($grid-unit-15 * 0.5);
122
119
  }
123
120
 
124
- // Adjust button paddings to scale better to mobile.
125
- .editor-post-saved-state,
126
- .components-button.components-button {
127
- margin-right: $grid-unit-05;
128
-
129
- @include break-small() {
130
- margin-right: $grid-unit-15;
131
- }
132
- }
121
+ gap: $grid-unit-05;
133
122
 
134
- .editor-post-saved-state,
135
- .components-button.is-tertiary {
136
- padding: 0 #{$grid-unit-15 * 0.5};
123
+ @include break-small() {
124
+ gap: $grid-unit-10;
137
125
  }
138
126
 
139
- .edit-site-more-menu .components-button,
140
- .interface-pinned-items .components-button {
141
- margin-right: 0;
142
- }
127
+ // Pinned items.
128
+ .interface-pinned-items {
129
+ display: none;
143
130
 
144
- @include break-small() {
145
- padding-right: $grid-unit-20;
131
+ @include break-medium() {
132
+ display: inline-flex;
133
+ }
146
134
  }
147
135
  }
148
136
 
@@ -192,11 +180,8 @@ body.is-navigation-sidebar-open {
192
180
  .edit-site-save-button__button {
193
181
  padding-left: 6px;
194
182
  padding-right: 6px;
195
- margin-right: $grid-unit-05;
196
- }
197
- .block-editor-post-preview__button-toggle {
198
- margin-right: $grid-unit-05;
199
183
  }
184
+
200
185
  // The inserter and the template details toggle have custom labels, different from their aria-label, so we don't want to display both.
201
186
  .edit-site-header-toolbar__inserter-toggle.edit-site-header-toolbar__inserter-toggle,
202
187
  .edit-site-document-actions__get-info.edit-site-document-actions__get-info.edit-site-document-actions__get-info {
@@ -59,11 +59,7 @@ export default function ListViewSidebar() {
59
59
  focusOnMountRef,
60
60
  ] ) }
61
61
  >
62
- <ListView
63
- showNestedBlocks
64
- __experimentalFeatures
65
- __experimentalPersistentListViewFeatures
66
- />
62
+ <ListView />
67
63
  </div>
68
64
  </div>
69
65
  );
@@ -4,7 +4,7 @@
4
4
  import { createSlotFill, PanelBody } from '@wordpress/components';
5
5
  import { __ } from '@wordpress/i18n';
6
6
  import { cog } from '@wordpress/icons';
7
- import { useEffect } from '@wordpress/element';
7
+ import { useEffect, Fragment } from '@wordpress/element';
8
8
  import { useSelect, useDispatch } from '@wordpress/data';
9
9
  import { store as interfaceStore } from '@wordpress/interface';
10
10
  import { store as blockEditorStore } from '@wordpress/block-editor';
@@ -62,7 +62,7 @@ export function SidebarComplementaryAreaFills() {
62
62
  // Conditionally include NavMenu sidebar in Plugin only.
63
63
  // Optimise for dead code elimination.
64
64
  // See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.
65
- let MaybeNavigationMenuSidebar = 'Fragment';
65
+ let MaybeNavigationMenuSidebar = Fragment;
66
66
 
67
67
  if ( process.env.IS_GUTENBERG_PLUGIN ) {
68
68
  MaybeNavigationMenuSidebar = NavigationMenuSidebar;
@@ -16,7 +16,7 @@ export default function NavigationMenuSidebar() {
16
16
  <DefaultSidebar
17
17
  className="edit-site-navigation-menu-sidebar"
18
18
  identifier="edit-site/navigation-menu"
19
- title={ __( 'Navigation Menus' ) }
19
+ title={ __( 'Navigation' ) }
20
20
  icon={ navigation }
21
21
  closeLabel={ __( 'Close navigation menu sidebar' ) }
22
22
  panelClassName="edit-site-navigation-menu-sidebar__panel"
@@ -24,6 +24,9 @@ export default function NavigationMenuSidebar() {
24
24
  <Flex>
25
25
  <FlexBlock>
26
26
  <strong>{ __( 'Navigation Menus' ) }</strong>
27
+ <span className="edit-site-navigation-sidebar__beta">
28
+ { __( 'Beta' ) }
29
+ </span>
27
30
  </FlexBlock>
28
31
  </Flex>
29
32
  }
@@ -50,13 +50,7 @@ export default function NavigationMenu( { innerBlocks, id } ) {
50
50
  }, [ updateBlockListSettings, innerBlocks ] );
51
51
  return (
52
52
  <>
53
- <ListView
54
- id={ id }
55
- showNestedBlocks
56
- expandNested={ false }
57
- __experimentalFeatures
58
- __experimentalPersistentListViewFeatures
59
- />
53
+ <ListView id={ id } />
60
54
  </>
61
55
  );
62
56
  }
@@ -74,6 +74,7 @@
74
74
  padding: $grid-unit-20;
75
75
  }
76
76
 
77
+ .edit-site-navigation-sidebar__beta,
77
78
  .edit-site-global-styles-sidebar__beta {
78
79
  display: inline-flex;
79
80
  margin-left: $grid-unit-10;
@@ -86,3 +87,58 @@
86
87
  font-size: $helptext-font-size;
87
88
  line-height: 1;
88
89
  }
90
+
91
+
92
+ .edit-site-global-styles-sidebar__border-box-control__popover,
93
+ .edit-site-global-styles-sidebar__border-box-control__popover-top,
94
+ .edit-site-global-styles-sidebar__border-box-control__popover-right,
95
+ .edit-site-global-styles-sidebar__border-box-control__popover-bottom,
96
+ .edit-site-global-styles-sidebar__border-box-control__popover-left {
97
+ .components-popover__content {
98
+ width: 282px;
99
+ }
100
+ }
101
+
102
+ $split-border-control-offset: 55px;
103
+
104
+ @include break-medium() {
105
+ .edit-site-global-styles-sidebar__border-box-control__popover,
106
+ .edit-site-global-styles-sidebar__border-box-control__popover-left {
107
+ .components-popover__content {
108
+ margin-right: #{ $grid-unit-50 + $grid-unit-15 } !important;
109
+ }
110
+ }
111
+
112
+ .edit-site-global-styles-sidebar__border-box-control__popover-top,
113
+ .edit-site-global-styles-sidebar__border-box-control__popover-bottom {
114
+ .components-popover__content {
115
+ margin-right: #{ $grid-unit-50 + $grid-unit-15 + $split-border-control-offset } !important;
116
+ }
117
+ }
118
+
119
+ .edit-site-global-styles-sidebar__border-box-control__popover-right {
120
+ .components-popover__content {
121
+ margin-right: #{ $grid-unit-50 + $grid-unit-15 + ( $split-border-control-offset * 2 )} !important;
122
+ }
123
+ }
124
+
125
+ .edit-site-global-styles-sidebar__border-box-control__popover,
126
+ .edit-site-global-styles-sidebar__border-box-control__popover-top,
127
+ .edit-site-global-styles-sidebar__border-box-control__popover-right,
128
+ .edit-site-global-styles-sidebar__border-box-control__popover-bottom,
129
+ .edit-site-global-styles-sidebar__border-box-control__popover-left {
130
+ &.is-from-top .components-popover__content {
131
+ margin-top: #{ -($grid-unit-50 + $grid-unit-15) } !important;
132
+ }
133
+
134
+ &.is-from-bottom .components-popover__content {
135
+ margin-bottom: #{ -($grid-unit-50 + $grid-unit-15) } !important;
136
+ }
137
+ }
138
+ }
139
+
140
+ // Override the `hr` styles defined in the `ComplementaryArea` component
141
+ // from the `@wordpress/interface` package.
142
+ .edit-site-global-styles-sidebar hr {
143
+ margin: 0;
144
+ }
package/src/index.js CHANGED
@@ -103,7 +103,6 @@ export function initializeEditor( id, settings ) {
103
103
  settings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>
104
104
  fetchLinkSuggestions( search, searchOptions, settings );
105
105
  settings.__experimentalFetchRichUrlData = fetchUrlData;
106
- settings.__experimentalSpotlightEntityBlocks = [ 'core/template-part' ];
107
106
 
108
107
  const target = document.getElementById( id );
109
108