@wordpress/edit-site 5.3.3 → 5.4.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 (172) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-template/new-template.js +1 -20
  3. package/build/components/add-new-template/new-template.js.map +1 -1
  4. package/build/components/app/index.js.map +1 -1
  5. package/build/components/block-editor/editor-canvas.js +1 -0
  6. package/build/components/block-editor/editor-canvas.js.map +1 -1
  7. package/build/components/editor/index.js +3 -1
  8. package/build/components/editor/index.js.map +1 -1
  9. package/build/components/global-styles/border-panel.js +4 -4
  10. package/build/components/global-styles/border-panel.js.map +1 -1
  11. package/build/components/global-styles/color-palette-panel.js +5 -2
  12. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  13. package/build/components/global-styles/color-utils.js +1 -1
  14. package/build/components/global-styles/color-utils.js.map +1 -1
  15. package/build/components/global-styles/context-menu.js +16 -3
  16. package/build/components/global-styles/context-menu.js.map +1 -1
  17. package/build/components/global-styles/custom-css.js +1 -1
  18. package/build/components/global-styles/custom-css.js.map +1 -1
  19. package/build/components/global-styles/dimensions-panel.js +8 -7
  20. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  21. package/build/components/global-styles/gradients-palette-panel.js +8 -3
  22. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  23. package/build/components/global-styles/header.js +3 -1
  24. package/build/components/global-styles/header.js.map +1 -1
  25. package/build/components/global-styles/hooks.js +14 -51
  26. package/build/components/global-styles/hooks.js.map +1 -1
  27. package/build/components/global-styles/palette.js +3 -1
  28. package/build/components/global-styles/palette.js.map +1 -1
  29. package/build/components/global-styles/screen-background-color.js +3 -2
  30. package/build/components/global-styles/screen-background-color.js.map +1 -1
  31. package/build/components/global-styles/screen-block-list.js +14 -3
  32. package/build/components/global-styles/screen-block-list.js.map +1 -1
  33. package/build/components/global-styles/screen-button-color.js +7 -5
  34. package/build/components/global-styles/screen-button-color.js.map +1 -1
  35. package/build/components/global-styles/screen-colors.js +8 -6
  36. package/build/components/global-styles/screen-colors.js.map +1 -1
  37. package/build/components/global-styles/screen-heading-color.js +8 -6
  38. package/build/components/global-styles/screen-heading-color.js.map +1 -1
  39. package/build/components/global-styles/screen-link-color.js +3 -2
  40. package/build/components/global-styles/screen-link-color.js.map +1 -1
  41. package/build/components/global-styles/screen-text-color.js +3 -2
  42. package/build/components/global-styles/screen-text-color.js.map +1 -1
  43. package/build/components/global-styles/screen-typography.js +3 -1
  44. package/build/components/global-styles/screen-typography.js.map +1 -1
  45. package/build/components/global-styles/shadow-panel.js +2 -3
  46. package/build/components/global-styles/shadow-panel.js.map +1 -1
  47. package/build/components/global-styles/subtitle.js +3 -2
  48. package/build/components/global-styles/subtitle.js.map +1 -1
  49. package/build/components/global-styles/typography-panel.js +23 -300
  50. package/build/components/global-styles/typography-panel.js.map +1 -1
  51. package/build/components/navigation-inspector/index.js +0 -29
  52. package/build/components/navigation-inspector/index.js.map +1 -1
  53. package/build/components/navigation-inspector/navigation-menu.js +4 -2
  54. package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
  55. package/build/components/sidebar/index.js +1 -20
  56. package/build/components/sidebar/index.js.map +1 -1
  57. package/build/components/sidebar-edit-mode/index.js +1 -1
  58. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  59. package/build/components/sidebar-edit-mode/template-card/index.js +9 -2
  60. package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  61. package/build/components/sidebar-edit-mode/template-card/last-revision.js +84 -0
  62. package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +1 -0
  63. package/build/components/start-template-options/index.js +175 -0
  64. package/build/components/start-template-options/index.js.map +1 -0
  65. package/build/hooks/push-changes-to-global-styles/index.js +5 -4
  66. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  67. package/build-module/components/add-new-template/new-template.js +1 -18
  68. package/build-module/components/add-new-template/new-template.js.map +1 -1
  69. package/build-module/components/app/index.js.map +1 -1
  70. package/build-module/components/block-editor/editor-canvas.js +1 -0
  71. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  72. package/build-module/components/editor/index.js +2 -1
  73. package/build-module/components/editor/index.js.map +1 -1
  74. package/build-module/components/global-styles/border-panel.js +5 -5
  75. package/build-module/components/global-styles/border-panel.js.map +1 -1
  76. package/build-module/components/global-styles/color-palette-panel.js +5 -2
  77. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  78. package/build-module/components/global-styles/color-utils.js +2 -2
  79. package/build-module/components/global-styles/color-utils.js.map +1 -1
  80. package/build-module/components/global-styles/context-menu.js +13 -2
  81. package/build-module/components/global-styles/context-menu.js.map +1 -1
  82. package/build-module/components/global-styles/custom-css.js +1 -1
  83. package/build-module/components/global-styles/custom-css.js.map +1 -1
  84. package/build-module/components/global-styles/dimensions-panel.js +9 -8
  85. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  86. package/build-module/components/global-styles/gradients-palette-panel.js +8 -3
  87. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  88. package/build-module/components/global-styles/header.js +3 -1
  89. package/build-module/components/global-styles/header.js.map +1 -1
  90. package/build-module/components/global-styles/hooks.js +12 -49
  91. package/build-module/components/global-styles/hooks.js.map +1 -1
  92. package/build-module/components/global-styles/palette.js +3 -1
  93. package/build-module/components/global-styles/palette.js.map +1 -1
  94. package/build-module/components/global-styles/screen-background-color.js +4 -3
  95. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  96. package/build-module/components/global-styles/screen-block-list.js +12 -3
  97. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  98. package/build-module/components/global-styles/screen-button-color.js +8 -6
  99. package/build-module/components/global-styles/screen-button-color.js.map +1 -1
  100. package/build-module/components/global-styles/screen-colors.js +9 -7
  101. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  102. package/build-module/components/global-styles/screen-heading-color.js +9 -7
  103. package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
  104. package/build-module/components/global-styles/screen-link-color.js +4 -3
  105. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  106. package/build-module/components/global-styles/screen-text-color.js +4 -3
  107. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  108. package/build-module/components/global-styles/screen-typography.js +3 -1
  109. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  110. package/build-module/components/global-styles/shadow-panel.js +3 -4
  111. package/build-module/components/global-styles/shadow-panel.js.map +1 -1
  112. package/build-module/components/global-styles/subtitle.js +3 -2
  113. package/build-module/components/global-styles/subtitle.js.map +1 -1
  114. package/build-module/components/global-styles/typography-panel.js +27 -300
  115. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  116. package/build-module/components/navigation-inspector/index.js +0 -27
  117. package/build-module/components/navigation-inspector/index.js.map +1 -1
  118. package/build-module/components/navigation-inspector/navigation-menu.js +4 -2
  119. package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
  120. package/build-module/components/sidebar/index.js +1 -18
  121. package/build-module/components/sidebar/index.js.map +1 -1
  122. package/build-module/components/sidebar-edit-mode/index.js +1 -1
  123. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  124. package/build-module/components/sidebar-edit-mode/template-card/index.js +9 -4
  125. package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  126. package/build-module/components/sidebar-edit-mode/template-card/last-revision.js +70 -0
  127. package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +1 -0
  128. package/build-module/components/start-template-options/index.js +156 -0
  129. package/build-module/components/start-template-options/index.js.map +1 -0
  130. package/build-module/hooks/push-changes-to-global-styles/index.js +6 -5
  131. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  132. package/build-style/style-rtl.css +73 -4
  133. package/build-style/style.css +73 -4
  134. package/package.json +31 -31
  135. package/src/components/add-new-template/new-template.js +1 -16
  136. package/src/components/app/index.js +0 -1
  137. package/src/components/block-editor/editor-canvas.js +1 -0
  138. package/src/components/editor/index.js +2 -0
  139. package/src/components/global-styles/border-panel.js +5 -5
  140. package/src/components/global-styles/color-palette-panel.js +3 -0
  141. package/src/components/global-styles/color-utils.js +2 -3
  142. package/src/components/global-styles/context-menu.js +17 -2
  143. package/src/components/global-styles/custom-css.js +1 -1
  144. package/src/components/global-styles/dimensions-panel.js +12 -8
  145. package/src/components/global-styles/gradients-palette-panel.js +4 -1
  146. package/src/components/global-styles/header.js +7 -1
  147. package/src/components/global-styles/hooks.js +17 -90
  148. package/src/components/global-styles/palette.js +1 -1
  149. package/src/components/global-styles/screen-background-color.js +3 -2
  150. package/src/components/global-styles/screen-block-list.js +19 -3
  151. package/src/components/global-styles/screen-button-color.js +8 -6
  152. package/src/components/global-styles/screen-colors.js +7 -7
  153. package/src/components/global-styles/screen-heading-color.js +9 -7
  154. package/src/components/global-styles/screen-link-color.js +3 -2
  155. package/src/components/global-styles/screen-text-color.js +3 -2
  156. package/src/components/global-styles/screen-typography.js +1 -1
  157. package/src/components/global-styles/shadow-panel.js +6 -3
  158. package/src/components/global-styles/style.scss +5 -0
  159. package/src/components/global-styles/subtitle.js +5 -2
  160. package/src/components/global-styles/typography-panel.js +30 -394
  161. package/src/components/navigation-inspector/index.js +0 -32
  162. package/src/components/navigation-inspector/navigation-menu.js +8 -2
  163. package/src/components/sidebar/index.js +4 -17
  164. package/src/components/sidebar-edit-mode/index.js +1 -1
  165. package/src/components/sidebar-edit-mode/template-card/index.js +24 -14
  166. package/src/components/sidebar-edit-mode/template-card/last-revision.js +75 -0
  167. package/src/components/sidebar-edit-mode/template-card/style.scss +4 -0
  168. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +0 -4
  169. package/src/components/start-template-options/index.js +171 -0
  170. package/src/components/start-template-options/style.scss +76 -0
  171. package/src/hooks/push-changes-to-global-styles/index.js +26 -21
  172. package/src/style.scss +1 -0
@@ -0,0 +1,75 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { Button } from '@wordpress/components';
5
+ import { sprintf, _n } from '@wordpress/i18n';
6
+ import { backup } from '@wordpress/icons';
7
+ import { addQueryArgs } from '@wordpress/url';
8
+ import { PostTypeSupportCheck } from '@wordpress/editor';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import useEditedEntityRecord from '../../use-edited-entity-record';
14
+
15
+ const useRevisionData = () => {
16
+ const { record: currentTemplate } = useEditedEntityRecord();
17
+
18
+ const lastRevisionId =
19
+ currentTemplate?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;
20
+
21
+ const revisionsCount =
22
+ ( currentTemplate?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0 ) +
23
+ 1;
24
+
25
+ return {
26
+ currentTemplate,
27
+ lastRevisionId,
28
+ revisionsCount,
29
+ };
30
+ };
31
+
32
+ function PostLastRevisionCheck( { children } ) {
33
+ const { lastRevisionId, revisionsCount } = useRevisionData();
34
+
35
+ if ( ! lastRevisionId || revisionsCount < 2 ) {
36
+ return null;
37
+ }
38
+
39
+ return (
40
+ <PostTypeSupportCheck supportKeys="revisions">
41
+ { children }
42
+ </PostTypeSupportCheck>
43
+ );
44
+ }
45
+
46
+ const PostLastRevision = () => {
47
+ const { lastRevisionId, revisionsCount } = useRevisionData();
48
+
49
+ return (
50
+ <PostLastRevisionCheck>
51
+ <Button
52
+ href={ addQueryArgs( 'revision.php', {
53
+ revision: lastRevisionId,
54
+ gutenberg: true,
55
+ } ) }
56
+ className="edit-site-template-last-revision__title"
57
+ icon={ backup }
58
+ >
59
+ { sprintf(
60
+ /* translators: %d: number of revisions */
61
+ _n( '%d Revision', '%d Revisions', revisionsCount ),
62
+ revisionsCount
63
+ ) }
64
+ </Button>
65
+ </PostLastRevisionCheck>
66
+ );
67
+ };
68
+
69
+ export default function LastRevision() {
70
+ return (
71
+ <PostLastRevisionCheck>
72
+ <PostLastRevision />
73
+ </PostLastRevisionCheck>
74
+ );
75
+ }
@@ -59,6 +59,10 @@
59
59
  }
60
60
  }
61
61
 
62
+ .edit-site-template-revisions {
63
+ margin-left: math.div(-$grid-unit-10, 2);
64
+ }
65
+
62
66
  h3.edit-site-template-card__template-areas-title {
63
67
  font-weight: 500;
64
68
  margin: 0 0 $grid-unit-10;
@@ -1,8 +1,4 @@
1
1
  .edit-site-sidebar-navigation-screen-navigation-menus {
2
- .block-editor-list-view-block__menu-edit,
3
- .edit-site-navigation-inspector__select-menu {
4
- display: none;
5
- }
6
2
  .offcanvas-editor-list-view-leaf {
7
3
  max-width: calc(100% - #{ $grid-unit-05 });
8
4
  }
@@ -0,0 +1,171 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { Modal } from '@wordpress/components';
5
+ import { __ } from '@wordpress/i18n';
6
+ import { useState, useEffect, useMemo } from '@wordpress/element';
7
+ import { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';
8
+ import { useSelect } from '@wordpress/data';
9
+ import { useAsyncList } from '@wordpress/compose';
10
+ import { store as preferencesStore } from '@wordpress/preferences';
11
+ import { parse } from '@wordpress/blocks';
12
+
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+ import { store as editSiteStore } from '../../store';
17
+ import { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';
18
+ import apiFetch from '@wordpress/api-fetch';
19
+ import { addQueryArgs } from '@wordpress/url';
20
+
21
+ function useFallbackTemplateContent( slug, isCustom = false ) {
22
+ const [ templateContent, setTemplateContent ] = useState( '' );
23
+
24
+ useEffect( () => {
25
+ apiFetch( {
26
+ path: addQueryArgs( '/wp/v2/templates/lookup', {
27
+ slug,
28
+ is_custom: isCustom,
29
+ ignore_empty: true,
30
+ } ),
31
+ } ).then( ( { content } ) => setTemplateContent( content.raw ) );
32
+ }, [ slug ] );
33
+ return templateContent;
34
+ }
35
+
36
+ const START_BLANK_TITLE = __( 'Start blank' );
37
+
38
+ function PatternSelection( { fallbackContent, onChoosePattern, postType } ) {
39
+ const [ , , onChange ] = useEntityBlockEditor( 'postType', postType );
40
+ const blockPatterns = useMemo(
41
+ () => [
42
+ {
43
+ name: 'fallback',
44
+ blocks: parse( fallbackContent ),
45
+ title: __( 'Fallback content' ),
46
+ },
47
+ {
48
+ name: 'start-blank',
49
+ blocks: parse(
50
+ '<!-- wp:paragraph --><p></p><!-- /wp:paragraph -->'
51
+ ),
52
+ title: START_BLANK_TITLE,
53
+ },
54
+ ],
55
+ [ fallbackContent ]
56
+ );
57
+ const shownBlockPatterns = useAsyncList( blockPatterns );
58
+
59
+ return (
60
+ <div
61
+ className="edit-site-start-template-options__pattern-container"
62
+ style={ {
63
+ '--wp-edit-site-start-template-options-start-blank': `"${ START_BLANK_TITLE }"`,
64
+ } }
65
+ >
66
+ <BlockPatternsList
67
+ blockPatterns={ blockPatterns }
68
+ shownPatterns={ shownBlockPatterns }
69
+ onClickPattern={ ( pattern, blocks ) => {
70
+ onChange( 'start-blank' === pattern.name ? [] : blocks, {
71
+ selection: undefined,
72
+ } );
73
+ onChoosePattern();
74
+ } }
75
+ />
76
+ </div>
77
+ );
78
+ }
79
+
80
+ function StartModal( { slug, isCustom, onClose, postType } ) {
81
+ const fallbackContent = useFallbackTemplateContent( slug, isCustom );
82
+ if ( ! fallbackContent ) {
83
+ return null;
84
+ }
85
+ return (
86
+ <Modal
87
+ className="edit-site-start-template-options__modal"
88
+ title={ __( 'Choose a pattern' ) }
89
+ closeLabel={ __( 'Cancel' ) }
90
+ focusOnMount="firstElement"
91
+ onRequestClose={ onClose }
92
+ >
93
+ <div className="edit-site-start-template-options__modal-content">
94
+ <PatternSelection
95
+ fallbackContent={ fallbackContent }
96
+ slug={ slug }
97
+ isCustom={ isCustom }
98
+ postType={ postType }
99
+ onChoosePattern={ () => {
100
+ onClose();
101
+ } }
102
+ />
103
+ </div>
104
+ </Modal>
105
+ );
106
+ }
107
+
108
+ const START_TEMPLATE_MODAL_STATES = {
109
+ INITIAL: 'INITIAL',
110
+ CLOSED: 'CLOSED',
111
+ };
112
+
113
+ export default function StartTemplateOptions() {
114
+ const [ modalState, setModalState ] = useState(
115
+ START_TEMPLATE_MODAL_STATES.INITIAL
116
+ );
117
+ const { shouldOpenModel, slug, isCustom, postType } = useSelect(
118
+ ( select ) => {
119
+ const { getEditedPostType, getEditedPostId } =
120
+ select( editSiteStore );
121
+ const _postType = getEditedPostType();
122
+ const postId = getEditedPostId();
123
+ const {
124
+ __experimentalGetDirtyEntityRecords,
125
+ getEditedEntityRecord,
126
+ } = select( coreStore );
127
+ const templateRecord = getEditedEntityRecord(
128
+ 'postType',
129
+ _postType,
130
+ postId
131
+ );
132
+
133
+ const hasDirtyEntityRecords =
134
+ __experimentalGetDirtyEntityRecords().length > 0;
135
+
136
+ return {
137
+ shouldOpenModel:
138
+ ! hasDirtyEntityRecords &&
139
+ '' === templateRecord.content &&
140
+ 'wp_template' === _postType &&
141
+ ! select( preferencesStore ).get(
142
+ 'core/edit-site',
143
+ 'welcomeGuide'
144
+ ),
145
+ slug: templateRecord.slug,
146
+ isCustom: templateRecord.is_custom,
147
+ postType: _postType,
148
+ };
149
+ },
150
+ []
151
+ );
152
+
153
+ if (
154
+ ( modalState === START_TEMPLATE_MODAL_STATES.INITIAL &&
155
+ ! shouldOpenModel ) ||
156
+ modalState === START_TEMPLATE_MODAL_STATES.CLOSED
157
+ ) {
158
+ return null;
159
+ }
160
+
161
+ return (
162
+ <StartModal
163
+ slug={ slug }
164
+ isCustom={ isCustom }
165
+ postType={ postType }
166
+ onClose={ () =>
167
+ setModalState( START_TEMPLATE_MODAL_STATES.CLOSED )
168
+ }
169
+ />
170
+ );
171
+ }
@@ -0,0 +1,76 @@
1
+ .edit-site-start-template-options__modal.components-modal__frame {
2
+ // To keep modal dimensions consistent as subsections are navigated, width
3
+ // and height are used instead of max-(width/height).
4
+ @include break-small() {
5
+ width: calc(100% - #{ $grid-unit-20 * 2 });
6
+ height: calc(100% - #{ $header-height * 2 });
7
+ }
8
+ @include break-medium() {
9
+ width: 50%;
10
+ }
11
+ @include break-large() {
12
+ height: fit-content;
13
+ }
14
+ }
15
+
16
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list {
17
+ display: grid;
18
+ width: 100%;
19
+ margin-top: $grid-unit-05;
20
+ gap: $grid-unit-30;
21
+ grid-template-columns: repeat(auto-fit, minmax(min(100%/2, max(240px, 100%/10)), 1fr));
22
+ .block-editor-block-patterns-list__list-item {
23
+ break-inside: avoid-column;
24
+ margin-bottom: 0;
25
+ width: 100%;
26
+ aspect-ratio: 3/4;
27
+
28
+ .block-editor-block-preview__container {
29
+ height: 100%;
30
+ box-shadow: 0 0 0 1px $gray-300;
31
+ }
32
+
33
+ .block-editor-block-preview__content {
34
+ width: 100%;
35
+ position: absolute;
36
+ }
37
+
38
+ .block-editor-block-patterns-list__item-title {
39
+ display: none;
40
+ }
41
+
42
+ &:hover {
43
+ .block-editor-block-preview__container {
44
+ box-shadow: 0 0 0 2px var(--wp-admin-theme-color);
45
+ }
46
+ }
47
+
48
+ &:focus {
49
+ .block-editor-block-preview__container {
50
+ box-shadow: inset 0 0 0 1px $white, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
51
+
52
+ // Windows High Contrast mode will show this outline, but not the box-shadow.
53
+ outline: 2px solid transparent;
54
+ }
55
+ }
56
+ }
57
+
58
+ // The start blank pattern is the last and we are selecting it.
59
+ .block-editor-block-patterns-list__list-item:nth-last-child(2) {
60
+ .block-editor-block-preview__container {
61
+ position: absolute;
62
+ padding: 0;
63
+ background: #f0f0f0;
64
+ &::after {
65
+ width: 100%;
66
+ top: 50%;
67
+ margin-top: -1em;
68
+ content: var(--wp-edit-site-start-template-options-start-blank);
69
+ text-align: center;
70
+ }
71
+ }
72
+ iframe {
73
+ display: none;
74
+ }
75
+ }
76
+ }
@@ -26,7 +26,7 @@ import { store as noticesStore } from '@wordpress/notices';
26
26
  /**
27
27
  * Internal dependencies
28
28
  */
29
- import { getSupportedGlobalStylesPanels } from '../../components/global-styles/hooks';
29
+ import { useSupportedStyles } from '../../components/global-styles/hooks';
30
30
  import { unlock } from '../../private-apis';
31
31
 
32
32
  const { GlobalStylesContext } = unlock( blockEditorPrivateApis );
@@ -90,22 +90,30 @@ const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
90
90
  'typography.fontFamily': 'fontFamily',
91
91
  };
92
92
 
93
- function getChangesToPush( name, attributes ) {
94
- return getSupportedGlobalStylesPanels( name ).flatMap( ( key ) => {
95
- if ( ! STYLE_PROPERTY[ key ] ) {
96
- return [];
97
- }
98
- const { value: path } = STYLE_PROPERTY[ key ];
99
- const presetAttributeKey = path.join( '.' );
100
- const presetAttributeValue =
101
- attributes[
102
- STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]
103
- ];
104
- const value = presetAttributeValue
105
- ? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`
106
- : get( attributes.style, path );
107
- return value ? [ { path, value } ] : [];
108
- } );
93
+ function useChangesToPush( name, attributes ) {
94
+ const supports = useSupportedStyles( name );
95
+
96
+ return useMemo(
97
+ () =>
98
+ supports.flatMap( ( key ) => {
99
+ if ( ! STYLE_PROPERTY[ key ] ) {
100
+ return [];
101
+ }
102
+ const { value: path } = STYLE_PROPERTY[ key ];
103
+ const presetAttributeKey = path.join( '.' );
104
+ const presetAttributeValue =
105
+ attributes[
106
+ STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[
107
+ presetAttributeKey
108
+ ]
109
+ ];
110
+ const value = presetAttributeValue
111
+ ? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`
112
+ : get( attributes.style, path );
113
+ return value ? [ { path, value } ] : [];
114
+ } ),
115
+ [ supports, name, attributes ]
116
+ );
109
117
  }
110
118
 
111
119
  function cloneDeep( object ) {
@@ -117,10 +125,7 @@ function PushChangesToGlobalStylesControl( {
117
125
  attributes,
118
126
  setAttributes,
119
127
  } ) {
120
- const changes = useMemo(
121
- () => getChangesToPush( name, attributes ),
122
- [ name, attributes ]
123
- );
128
+ const changes = useChangesToPush( name, attributes );
124
129
 
125
130
  const { user: userConfig, setUserConfig } =
126
131
  useContext( GlobalStylesContext );
package/src/style.scss CHANGED
@@ -17,6 +17,7 @@
17
17
  @import "./components/create-template-part-modal/style.scss";
18
18
  @import "./components/secondary-sidebar/style.scss";
19
19
  @import "./components/welcome-guide/style.scss";
20
+ @import "./components/start-template-options/style.scss";
20
21
  @import "./components/keyboard-shortcut-help-modal/style.scss";
21
22
  @import "./components/layout/style.scss";
22
23
  @import "./components/save-panel/style.scss";