@wordpress/edit-site 6.33.2 → 6.33.3-next.36001005c.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 (32) hide show
  1. package/build/components/global-styles-renderer/index.js +2 -4
  2. package/build/components/global-styles-renderer/index.js.map +3 -3
  3. package/build/components/revisions/index.js +2 -2
  4. package/build/components/revisions/index.js.map +2 -2
  5. package/build/components/style-book/index.js +24 -19
  6. package/build/components/style-book/index.js.map +2 -2
  7. package/build/hooks/use-global-styles-output.js +77 -0
  8. package/build/hooks/use-global-styles-output.js.map +7 -0
  9. package/build-module/components/global-styles-renderer/index.js +1 -3
  10. package/build-module/components/global-styles-renderer/index.js.map +2 -2
  11. package/build-module/components/revisions/index.js +1 -1
  12. package/build-module/components/revisions/index.js.map +2 -2
  13. package/build-module/components/style-book/index.js +22 -17
  14. package/build-module/components/style-book/index.js.map +2 -2
  15. package/build-module/hooks/use-global-styles-output.js +52 -0
  16. package/build-module/hooks/use-global-styles-output.js.map +7 -0
  17. package/build-style/posts-rtl.css +13 -13
  18. package/build-style/posts.css +13 -13
  19. package/build-style/style-rtl.css +23 -23
  20. package/build-style/style.css +23 -23
  21. package/package.json +45 -44
  22. package/src/components/global-styles/font-library-modal/style.scss +3 -3
  23. package/src/components/global-styles/style.scss +1 -1
  24. package/src/components/global-styles-renderer/index.js +1 -4
  25. package/src/components/global-styles-sidebar/style.scss +2 -2
  26. package/src/components/revisions/index.js +1 -1
  27. package/src/components/sidebar-navigation-screen/style.scss +1 -1
  28. package/src/components/sidebar-navigation-screen-patterns/style.scss +1 -1
  29. package/src/components/site-hub/style.scss +1 -1
  30. package/src/components/style-book/index.js +26 -19
  31. package/src/hooks/use-global-styles-output.js +80 -0
  32. package/tsconfig.json +1 -0
@@ -403,7 +403,7 @@
403
403
  }
404
404
  .dataviews-title-field {
405
405
  font-size: 13px;
406
- font-weight: 500;
406
+ font-weight: 499;
407
407
  color: #2f2f2f;
408
408
  text-overflow: ellipsis;
409
409
  white-space: nowrap;
@@ -500,7 +500,7 @@
500
500
 
501
501
  .dataviews-bulk-actions-footer__item-count {
502
502
  color: #1e1e1e;
503
- font-weight: 500;
503
+ font-weight: 499;
504
504
  font-size: 11px;
505
505
  text-transform: uppercase;
506
506
  }
@@ -616,7 +616,7 @@
616
616
  }
617
617
 
618
618
  .dataviews-filters__summary-chip-container .dataviews-filters__summary-chip .dataviews-filters-__summary-filter-text-name {
619
- font-weight: 500;
619
+ font-weight: 499;
620
620
  }
621
621
 
622
622
  .dataviews-filters__summary-chip-container .dataviews-filters__summary-chip-remove {
@@ -1135,14 +1135,14 @@
1135
1135
  }
1136
1136
  .dataviews-pagination__page-select {
1137
1137
  font-size: 11px;
1138
- font-weight: 500;
1138
+ font-weight: 499;
1139
1139
  text-transform: uppercase;
1140
1140
  }
1141
1141
 
1142
1142
  @media (min-width: 600px) {
1143
1143
  .dataviews-pagination__page-select .components-select-control__input {
1144
1144
  font-size: 11px !important;
1145
- font-weight: 500;
1145
+ font-weight: 499;
1146
1146
  }
1147
1147
  }
1148
1148
  .dataviews-action-modal {
@@ -1474,7 +1474,7 @@
1474
1474
 
1475
1475
  .dataviews-view-grid__group-header {
1476
1476
  font-size: 15px;
1477
- font-weight: 500;
1477
+ font-weight: 499;
1478
1478
  color: #1e1e1e;
1479
1479
  margin: 0 0 8px 0;
1480
1480
  padding: 0 48px;
@@ -1703,7 +1703,7 @@ div.dataviews-view-list {
1703
1703
 
1704
1704
  .dataviews-view-list__group-header {
1705
1705
  font-size: 15px;
1706
- font-weight: 500;
1706
+ font-weight: 499;
1707
1707
  color: #1e1e1e;
1708
1708
  margin: 0 0 8px 0;
1709
1709
  padding: 0 24px;
@@ -1865,7 +1865,7 @@ div.dataviews-view-list {
1865
1865
  padding-left: 12px;
1866
1866
  font-size: 11px;
1867
1867
  text-transform: uppercase;
1868
- font-weight: 500;
1868
+ font-weight: 499;
1869
1869
  }
1870
1870
 
1871
1871
  .dataviews-view-table thead th:has(.dataviews-view-table-header-button):not(:first-child) {
@@ -1898,7 +1898,7 @@ div.dataviews-view-list {
1898
1898
  padding: 4px 8px;
1899
1899
  font-size: 11px;
1900
1900
  text-transform: uppercase;
1901
- font-weight: 500;
1901
+ font-weight: 499;
1902
1902
  }
1903
1903
 
1904
1904
  .dataviews-view-table .dataviews-view-table-header-button:not(:hover) {
@@ -1998,7 +1998,7 @@ div.dataviews-view-list {
1998
1998
  }
1999
1999
 
2000
2000
  .dataviews-view-table__group-header-row .dataviews-view-table__group-header-cell {
2001
- font-weight: 500;
2001
+ font-weight: 499;
2002
2002
  padding: 12px 48px;
2003
2003
  color: #1e1e1e;
2004
2004
  }
@@ -2156,7 +2156,7 @@ div.dataviews-view-list {
2156
2156
 
2157
2157
  .dataviews-view-picker-grid-group__header {
2158
2158
  font-size: 15px;
2159
- font-weight: 500;
2159
+ font-weight: 499;
2160
2160
  color: #1e1e1e;
2161
2161
  margin: 0 0 8px 0;
2162
2162
  padding: 0 48px;
@@ -2278,7 +2278,7 @@ div.dataviews-view-list {
2278
2278
 
2279
2279
  .dataforms-layouts-card__field-header-label {
2280
2280
  font-family: -apple-system, "system-ui", "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
2281
- font-weight: 500;
2281
+ font-weight: 499;
2282
2282
  font-size: 15px;
2283
2283
  line-height: 20px;
2284
2284
  }
@@ -2956,7 +2956,7 @@ fieldset.fields-controls__featured-image .fields-controls__featured-image-remove
2956
2956
  .edit-site-global-styles-subtitle {
2957
2957
  margin-bottom: 0 !important;
2958
2958
  text-transform: uppercase;
2959
- font-weight: 500 !important;
2959
+ font-weight: 499 !important;
2960
2960
  font-size: 11px !important;
2961
2961
  }
2962
2962
 
@@ -3302,11 +3302,11 @@ fieldset.fields-controls__featured-image .fields-controls__featured-image-remove
3302
3302
 
3303
3303
  .edit-site-global-styles-sidebar .components-navigation__menu-title-heading {
3304
3304
  font-size: 15.6px;
3305
- font-weight: 500;
3305
+ font-weight: 499;
3306
3306
  }
3307
3307
 
3308
3308
  .edit-site-global-styles-sidebar .components-navigation__item > button span {
3309
- font-weight: 500;
3309
+ font-weight: 499;
3310
3310
  }
3311
3311
 
3312
3312
  .edit-site-global-styles-sidebar .block-editor-panel-color-gradient-settings {
@@ -4038,7 +4038,7 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
4038
4038
  .edit-site-sidebar-navigation-item.components-item[aria-current=true] {
4039
4039
  background: #2f2f2f;
4040
4040
  color: #fff;
4041
- font-weight: 500;
4041
+ font-weight: 499;
4042
4042
  }
4043
4043
  .edit-site-sidebar-navigation-item.components-item:focus-visible {
4044
4044
  transform: translateZ(0);
@@ -4113,7 +4113,7 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
4113
4113
  color: #ddd;
4114
4114
  font-size: 11px;
4115
4115
  text-transform: uppercase;
4116
- font-weight: 500;
4116
+ font-weight: 499;
4117
4117
  }
4118
4118
 
4119
4119
  .edit-site-sidebar-navigation-screen__content .edit-site-global-styles-variations_item .edit-site-global-styles-variations_item-preview {
@@ -4201,7 +4201,7 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
4201
4201
  }
4202
4202
  .edit-site-sidebar-navigation-screen-patterns__group-header h2 {
4203
4203
  font-size: 11px;
4204
- font-weight: 500;
4204
+ font-weight: 499;
4205
4205
  text-transform: uppercase;
4206
4206
  }
4207
4207
 
@@ -4274,7 +4274,7 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
4274
4274
  }
4275
4275
  .edit-site-sidebar-dataviews-dataview-item.is-selected {
4276
4276
  background: #2f2f2f;
4277
- font-weight: 500;
4277
+ font-weight: 499;
4278
4278
  color: #fff;
4279
4279
  }
4280
4280
 
@@ -4305,7 +4305,7 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
4305
4305
  display: block;
4306
4306
  flex-grow: 1;
4307
4307
  font-size: 15px;
4308
- font-weight: 500;
4308
+ font-weight: 499;
4309
4309
  overflow: hidden;
4310
4310
  padding-right: 16px;
4311
4311
  margin-left: -4px;
@@ -4608,7 +4608,7 @@ body:has(.edit-site-resizable-frame__inner.is-resizing) {
4608
4608
  }
4609
4609
  .font-library-modal .font-library-modal__subtitle {
4610
4610
  text-transform: uppercase;
4611
- font-weight: 500;
4611
+ font-weight: 499;
4612
4612
  font-size: 11px;
4613
4613
  }
4614
4614
  .font-library-modal .components-navigator-screen {
@@ -4643,13 +4643,13 @@ body:has(.edit-site-resizable-frame__inner.is-resizing) {
4643
4643
 
4644
4644
  .font-library-modal__page-selection {
4645
4645
  font-size: 11px;
4646
- font-weight: 500;
4646
+ font-weight: 499;
4647
4647
  text-transform: uppercase;
4648
4648
  }
4649
4649
  @media (min-width: 600px) {
4650
4650
  .font-library-modal__page-selection .components-select-control__input {
4651
4651
  font-size: 11px !important;
4652
- font-weight: 500;
4652
+ font-weight: 499;
4653
4653
  }
4654
4654
  }
4655
4655
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "6.33.2",
3
+ "version": "6.33.3-next.36001005c.0",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -37,48 +37,49 @@
37
37
  "wpScript": true,
38
38
  "dependencies": {
39
39
  "@react-spring/web": "^9.4.5",
40
- "@wordpress/a11y": "^4.33.0",
41
- "@wordpress/admin-ui": "^1.1.0",
42
- "@wordpress/api-fetch": "^7.33.0",
43
- "@wordpress/base-styles": "^6.9.0",
44
- "@wordpress/blob": "^4.33.0",
45
- "@wordpress/block-editor": "^15.6.0",
46
- "@wordpress/block-library": "^9.33.1",
47
- "@wordpress/blocks": "^15.6.0",
48
- "@wordpress/commands": "^1.33.0",
49
- "@wordpress/components": "^30.6.0",
50
- "@wordpress/compose": "^7.33.0",
51
- "@wordpress/core-data": "^7.33.0",
52
- "@wordpress/data": "^10.33.0",
53
- "@wordpress/dataviews": "^10.1.0",
54
- "@wordpress/date": "^5.33.0",
55
- "@wordpress/deprecated": "^4.33.0",
56
- "@wordpress/dom": "^4.33.0",
57
- "@wordpress/editor": "^14.33.2",
58
- "@wordpress/element": "^6.33.0",
59
- "@wordpress/escape-html": "^3.33.0",
60
- "@wordpress/fields": "^0.25.2",
61
- "@wordpress/hooks": "^4.33.0",
62
- "@wordpress/html-entities": "^4.33.0",
63
- "@wordpress/i18n": "^6.6.0",
64
- "@wordpress/icons": "^11.0.0",
65
- "@wordpress/keyboard-shortcuts": "^5.33.0",
66
- "@wordpress/keycodes": "^4.33.0",
67
- "@wordpress/media-utils": "^5.33.0",
68
- "@wordpress/notices": "^5.33.0",
69
- "@wordpress/patterns": "^2.33.0",
70
- "@wordpress/plugins": "^7.33.0",
71
- "@wordpress/preferences": "^4.33.0",
72
- "@wordpress/primitives": "^4.33.0",
73
- "@wordpress/private-apis": "^1.33.0",
74
- "@wordpress/reusable-blocks": "^5.33.0",
75
- "@wordpress/router": "^1.33.0",
76
- "@wordpress/style-engine": "^2.33.0",
77
- "@wordpress/url": "^4.33.0",
78
- "@wordpress/viewport": "^6.33.0",
79
- "@wordpress/views": "^1.0.1",
80
- "@wordpress/widgets": "^4.33.0",
81
- "@wordpress/wordcount": "^4.33.0",
40
+ "@wordpress/a11y": "^4.33.1-next.36001005c.0",
41
+ "@wordpress/admin-ui": "^1.1.1-next.36001005c.0",
42
+ "@wordpress/api-fetch": "^7.33.1-next.36001005c.0",
43
+ "@wordpress/base-styles": "^6.10.1-next.36001005c.0",
44
+ "@wordpress/blob": "^4.33.1-next.36001005c.0",
45
+ "@wordpress/block-editor": "^15.6.1-next.36001005c.0",
46
+ "@wordpress/block-library": "^9.33.2-next.36001005c.0",
47
+ "@wordpress/blocks": "^15.6.1-next.36001005c.0",
48
+ "@wordpress/commands": "^1.33.1-next.36001005c.0",
49
+ "@wordpress/components": "^30.7.1-next.36001005c.0",
50
+ "@wordpress/compose": "^7.33.1-next.36001005c.0",
51
+ "@wordpress/core-data": "^7.33.1-next.36001005c.0",
52
+ "@wordpress/data": "^10.33.1-next.36001005c.0",
53
+ "@wordpress/dataviews": "^10.1.1-next.36001005c.0",
54
+ "@wordpress/date": "^5.33.1-next.36001005c.0",
55
+ "@wordpress/deprecated": "^4.33.1-next.36001005c.0",
56
+ "@wordpress/dom": "^4.33.1-next.36001005c.0",
57
+ "@wordpress/editor": "^14.33.3-next.36001005c.0",
58
+ "@wordpress/element": "^6.33.1-next.36001005c.0",
59
+ "@wordpress/escape-html": "^3.33.1-next.36001005c.0",
60
+ "@wordpress/fields": "^0.25.3-next.36001005c.0",
61
+ "@wordpress/global-styles-engine": "^1.0.1-next.36001005c.0",
62
+ "@wordpress/hooks": "^4.33.1-next.36001005c.0",
63
+ "@wordpress/html-entities": "^4.33.1-next.36001005c.0",
64
+ "@wordpress/i18n": "^6.6.1-next.36001005c.0",
65
+ "@wordpress/icons": "^11.0.1-next.36001005c.0",
66
+ "@wordpress/keyboard-shortcuts": "^5.33.1-next.36001005c.0",
67
+ "@wordpress/keycodes": "^4.33.1-next.36001005c.0",
68
+ "@wordpress/media-utils": "^5.33.1-next.36001005c.0",
69
+ "@wordpress/notices": "^5.33.1-next.36001005c.0",
70
+ "@wordpress/patterns": "^2.33.1-next.36001005c.0",
71
+ "@wordpress/plugins": "^7.33.1-next.36001005c.0",
72
+ "@wordpress/preferences": "^4.33.1-next.36001005c.0",
73
+ "@wordpress/primitives": "^4.33.1-next.36001005c.0",
74
+ "@wordpress/private-apis": "^1.33.1-next.36001005c.0",
75
+ "@wordpress/reusable-blocks": "^5.33.1-next.36001005c.0",
76
+ "@wordpress/router": "^1.33.1-next.36001005c.0",
77
+ "@wordpress/style-engine": "^2.33.1-next.36001005c.0",
78
+ "@wordpress/url": "^4.33.1-next.36001005c.0",
79
+ "@wordpress/viewport": "^6.33.1-next.36001005c.0",
80
+ "@wordpress/views": "^1.0.2-next.36001005c.0",
81
+ "@wordpress/widgets": "^4.33.1-next.36001005c.0",
82
+ "@wordpress/wordcount": "^4.33.1-next.36001005c.0",
82
83
  "change-case": "^4.1.2",
83
84
  "clsx": "^2.1.1",
84
85
  "colord": "^2.9.2",
@@ -93,5 +94,5 @@
93
94
  "publishConfig": {
94
95
  "access": "public"
95
96
  },
96
- "gitHead": "2a8c29e6550fa1a246bfce534fbcc545d035a9a7"
97
+ "gitHead": "b73a8a22e779c59efb8f911e32b681652f237d60"
97
98
  }
@@ -27,7 +27,7 @@ $footer-height: 70px;
27
27
 
28
28
  .font-library-modal__subtitle {
29
29
  text-transform: uppercase;
30
- font-weight: 500;
30
+ font-weight: $font-weight-medium;
31
31
  font-size: 11px;
32
32
  }
33
33
 
@@ -68,13 +68,13 @@ $footer-height: 70px;
68
68
 
69
69
  .font-library-modal__page-selection {
70
70
  font-size: 11px;
71
- font-weight: 500;
71
+ font-weight: $font-weight-medium;
72
72
  text-transform: uppercase;
73
73
 
74
74
  @include break-small() {
75
75
  .components-select-control__input {
76
76
  font-size: 11px !important;
77
- font-weight: 500;
77
+ font-weight: $font-weight-medium;
78
78
  }
79
79
  }
80
80
  }
@@ -85,7 +85,7 @@
85
85
  // Need to override the too specific styles for complementary areas.
86
86
  margin-bottom: 0 !important;
87
87
  text-transform: uppercase;
88
- font-weight: 500 !important;
88
+ font-weight: $font-weight-medium !important;
89
89
  font-size: 11px !important;
90
90
  }
91
91
 
@@ -3,15 +3,12 @@
3
3
  */
4
4
  import { useEffect } from '@wordpress/element';
5
5
  import { useSelect, useDispatch } from '@wordpress/data';
6
- import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
7
6
 
8
7
  /**
9
8
  * Internal dependencies
10
9
  */
11
10
  import { store as editSiteStore } from '../../store';
12
- import { unlock } from '../../lock-unlock';
13
-
14
- const { useGlobalStylesOutput } = unlock( blockEditorPrivateApis );
11
+ import { useGlobalStylesOutput } from '../../hooks/use-global-styles-output';
15
12
 
16
13
  function useGlobalStylesRenderer( disableRootPadding ) {
17
14
  const [ styles, settings ] = useGlobalStylesOutput( disableRootPadding );
@@ -21,11 +21,11 @@
21
21
 
22
22
  .edit-site-global-styles-sidebar .components-navigation__menu-title-heading {
23
23
  font-size: $default-font-size * 1.2;
24
- font-weight: 500;
24
+ font-weight: $font-weight-medium;
25
25
  }
26
26
 
27
27
  .edit-site-global-styles-sidebar .components-navigation__item > button span {
28
- font-weight: 500;
28
+ font-weight: $font-weight-medium;
29
29
  }
30
30
 
31
31
  .edit-site-global-styles-sidebar .block-editor-panel-color-gradient-settings {
@@ -20,11 +20,11 @@ import { useContext, useMemo } from '@wordpress/element';
20
20
 
21
21
  import { unlock } from '../../lock-unlock';
22
22
  import EditorCanvasContainer from '../editor-canvas-container';
23
+ import { useGlobalStylesOutputWithConfig } from '../../hooks/use-global-styles-output';
23
24
 
24
25
  const {
25
26
  ExperimentalBlockEditorProvider,
26
27
  GlobalStylesContext,
27
- useGlobalStylesOutputWithConfig,
28
28
  __unstableBlockStyleVariationOverridesWithConfig,
29
29
  } = unlock( blockEditorPrivateApis );
30
30
  const { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );
@@ -76,7 +76,7 @@
76
76
  color: $gray-300;
77
77
  font-size: 11px;
78
78
  text-transform: uppercase;
79
- font-weight: 500;
79
+ font-weight: $font-weight-medium;
80
80
  }
81
81
 
82
82
  .edit-site-sidebar-navigation-screen__content .edit-site-global-styles-variations_item {
@@ -22,7 +22,7 @@
22
22
 
23
23
  h2 {
24
24
  font-size: 11px;
25
- font-weight: 500;
25
+ font-weight: $font-weight-medium;
26
26
  text-transform: uppercase;
27
27
  }
28
28
  }
@@ -29,7 +29,7 @@
29
29
  display: block;
30
30
  flex-grow: 1;
31
31
  font-size: 15px;
32
- font-weight: 500;
32
+ font-weight: $font-weight-medium;
33
33
  overflow: hidden;
34
34
  // Add space for the ↗ to render.
35
35
  padding-right: $grid-unit-20;
@@ -56,13 +56,10 @@ import {
56
56
  STYLE_BOOK_COLOR_GROUPS,
57
57
  STYLE_BOOK_PREVIEW_CATEGORIES,
58
58
  } from '../style-book/constants';
59
+ import { useGlobalStylesOutputWithConfig } from '../../hooks/use-global-styles-output';
59
60
 
60
- const {
61
- ExperimentalBlockEditorProvider,
62
- useGlobalStyle,
63
- GlobalStylesContext,
64
- useGlobalStylesOutputWithConfig,
65
- } = unlock( blockEditorPrivateApis );
61
+ const { ExperimentalBlockEditorProvider, useGlobalStyle, GlobalStylesContext } =
62
+ unlock( blockEditorPrivateApis );
66
63
  const { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );
67
64
 
68
65
  const { Tabs } = unlock( componentsPrivateApis );
@@ -227,19 +224,29 @@ function applyBlockVariationsToExamples( examples, variation ) {
227
224
  if ( ! variation ) {
228
225
  return examples;
229
226
  }
230
-
231
- return examples.map( ( example ) => ( {
232
- ...example,
233
- variation,
234
- blocks: {
235
- ...example.blocks,
236
- attributes: {
237
- ...example.blocks.attributes,
238
- style: undefined,
239
- className: getVariationClassName( variation ),
240
- },
241
- },
242
- } ) );
227
+ return examples.map( ( example ) => {
228
+ return {
229
+ ...example,
230
+ variation,
231
+ blocks: Array.isArray( example.blocks )
232
+ ? example.blocks.map( ( block ) => ( {
233
+ ...block,
234
+ attributes: {
235
+ ...block.attributes,
236
+ style: undefined,
237
+ className: getVariationClassName( variation ),
238
+ },
239
+ } ) )
240
+ : {
241
+ ...example.blocks,
242
+ attributes: {
243
+ ...example.blocks.attributes,
244
+ style: undefined,
245
+ className: getVariationClassName( variation ),
246
+ },
247
+ },
248
+ };
249
+ } );
243
250
  }
244
251
 
245
252
  function StyleBook( {
@@ -0,0 +1,80 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { getBlockTypes, store as blocksStore } from '@wordpress/blocks';
5
+ import { useSelect } from '@wordpress/data';
6
+ import { useContext, useMemo } from '@wordpress/element';
7
+ import { generateGlobalStyles } from '@wordpress/global-styles-engine';
8
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import { store as editSiteStore } from '../store';
14
+ import { unlock } from '../lock-unlock';
15
+
16
+ const { GlobalStylesContext, useGlobalSetting } = unlock(
17
+ blockEditorPrivateApis
18
+ );
19
+
20
+ /**
21
+ * Returns the global styles output based on the provided global styles config.
22
+ *
23
+ * @param {Object} mergedConfig The merged global styles config.
24
+ * @param {boolean} disableRootPadding Disable root padding styles.
25
+ *
26
+ * @return {Array} Array of stylesheets and settings.
27
+ */
28
+ export function useGlobalStylesOutputWithConfig(
29
+ mergedConfig = {},
30
+ disableRootPadding = false
31
+ ) {
32
+ const [ blockGap ] = useGlobalSetting( 'spacing.blockGap' );
33
+ const hasBlockGapSupport = blockGap !== null;
34
+ const hasFallbackGapSupport = ! hasBlockGapSupport;
35
+
36
+ const { disableLayoutStyles, getBlockStyles } = useSelect( ( select ) => {
37
+ const { getSettings } = select( editSiteStore );
38
+ const { getBlockStyles: getBlockStylesSelector } =
39
+ select( blocksStore );
40
+ return {
41
+ disableLayoutStyles: !! getSettings()?.disableLayoutStyles,
42
+ getBlockStyles: getBlockStylesSelector,
43
+ };
44
+ }, [] );
45
+
46
+ return useMemo( () => {
47
+ if ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {
48
+ return [ [], {} ];
49
+ }
50
+
51
+ const blockTypes = getBlockTypes();
52
+
53
+ return generateGlobalStyles( mergedConfig, blockTypes, {
54
+ hasBlockGapSupport,
55
+ hasFallbackGapSupport,
56
+ disableLayoutStyles,
57
+ disableRootPadding,
58
+ getBlockStyles,
59
+ } );
60
+ }, [
61
+ hasBlockGapSupport,
62
+ hasFallbackGapSupport,
63
+ mergedConfig,
64
+ disableLayoutStyles,
65
+ disableRootPadding,
66
+ getBlockStyles,
67
+ ] );
68
+ }
69
+
70
+ /**
71
+ * Returns the global styles output based on the current state of global styles config loaded in the editor context.
72
+ *
73
+ * @param {boolean} disableRootPadding Disable root padding styles.
74
+ *
75
+ * @return {Array} Array of stylesheets and settings.
76
+ */
77
+ export function useGlobalStylesOutput( disableRootPadding = false ) {
78
+ const { merged: mergedConfig } = useContext( GlobalStylesContext );
79
+ return useGlobalStylesOutputWithConfig( mergedConfig, disableRootPadding );
80
+ }
package/tsconfig.json CHANGED
@@ -21,6 +21,7 @@
21
21
  { "path": "../element" },
22
22
  { "path": "../escape-html" },
23
23
  { "path": "../fields" },
24
+ { "path": "../global-styles-engine" },
24
25
  { "path": "../hooks" },
25
26
  { "path": "../html-entities" },
26
27
  { "path": "../i18n" },