@wordpress/edit-site 4.14.12 → 4.14.13
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.
- package/build/components/global-styles/use-global-styles-output.js +37 -2
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/header/index.js +12 -7
- package/build/components/header/index.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +37 -2
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/header/index.js +12 -7
- package/build-module/components/header/index.js.map +1 -1
- package/package.json +9 -9
- package/src/components/global-styles/test/typography-utils.js +309 -179
- package/src/components/global-styles/test/use-global-styles-output.js +6 -6
- package/src/components/global-styles/use-global-styles-output.js +38 -2
- package/src/components/header/index.js +7 -4
|
@@ -5,206 +5,336 @@ import { getTypographyFontSizeValue } from '../typography-utils';
|
|
|
5
5
|
|
|
6
6
|
describe( 'typography utils', () => {
|
|
7
7
|
describe( 'getTypographyFontSizeValue', () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
{
|
|
12
|
-
|
|
13
|
-
size: '28px',
|
|
14
|
-
},
|
|
15
|
-
typographySettings: undefined,
|
|
16
|
-
expected: '28px',
|
|
8
|
+
[
|
|
9
|
+
{
|
|
10
|
+
message: 'returns value when fluid typography is deactivated',
|
|
11
|
+
preset: {
|
|
12
|
+
size: '28px',
|
|
17
13
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
typographySettings: undefined,
|
|
15
|
+
expected: '28px',
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
{
|
|
19
|
+
message: 'returns value where font size is 0',
|
|
20
|
+
preset: {
|
|
21
|
+
size: 0,
|
|
25
22
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
typographySettings: undefined,
|
|
24
|
+
expected: 0,
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
{
|
|
28
|
+
message: "returns value where font size is '0'",
|
|
29
|
+
preset: {
|
|
30
|
+
size: '0',
|
|
33
31
|
},
|
|
32
|
+
typographySettings: undefined,
|
|
33
|
+
expected: '0',
|
|
34
|
+
},
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
typographySettings: undefined,
|
|
41
|
-
expected: undefined,
|
|
42
|
-
},
|
|
43
|
-
// Should return non-fluid value when fluid is `false`.
|
|
44
|
-
{
|
|
45
|
-
preset: {
|
|
46
|
-
size: '28px',
|
|
47
|
-
fluid: false,
|
|
48
|
-
},
|
|
49
|
-
typographySettings: {
|
|
50
|
-
fluid: true,
|
|
51
|
-
},
|
|
52
|
-
expected: '28px',
|
|
36
|
+
{
|
|
37
|
+
message: 'returns value where `size` is `null`.',
|
|
38
|
+
preset: {
|
|
39
|
+
size: null,
|
|
53
40
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
41
|
+
typographySettings: null,
|
|
42
|
+
expected: null,
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
{
|
|
46
|
+
message: 'returns value when fluid is `false`',
|
|
47
|
+
preset: {
|
|
48
|
+
size: '28px',
|
|
49
|
+
fluid: false,
|
|
50
|
+
},
|
|
51
|
+
typographySettings: {
|
|
52
|
+
fluid: true,
|
|
65
53
|
},
|
|
54
|
+
expected: '28px',
|
|
55
|
+
},
|
|
66
56
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
typographySettings: {
|
|
74
|
-
fluid: true,
|
|
75
|
-
},
|
|
76
|
-
expected:
|
|
77
|
-
'clamp(75.1725px, 4.69828125rem + ((1vw - 7.68px) * 9.035), 150.345px)',
|
|
78
|
-
},
|
|
79
|
-
// Should return incoming value when already clamped.
|
|
80
|
-
{
|
|
81
|
-
preset: {
|
|
82
|
-
size: 'clamp(21px, 1.3125rem + ((1vw - 7.68px) * 2.524), 42px)',
|
|
83
|
-
fluid: false,
|
|
84
|
-
},
|
|
85
|
-
typographySettings: {
|
|
86
|
-
fluid: true,
|
|
87
|
-
},
|
|
88
|
-
expected:
|
|
89
|
-
'clamp(21px, 1.3125rem + ((1vw - 7.68px) * 2.524), 42px)',
|
|
90
|
-
},
|
|
91
|
-
// Should return incoming value with unsupported unit.
|
|
92
|
-
{
|
|
93
|
-
preset: {
|
|
94
|
-
size: '1000%',
|
|
95
|
-
fluid: false,
|
|
96
|
-
},
|
|
97
|
-
typographySettings: {
|
|
98
|
-
fluid: true,
|
|
99
|
-
},
|
|
100
|
-
expected: '1000%',
|
|
57
|
+
{
|
|
58
|
+
message: 'returns already clamped value',
|
|
59
|
+
preset: {
|
|
60
|
+
size: 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 2.524), 42px)',
|
|
61
|
+
fluid: false,
|
|
101
62
|
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
preset: {
|
|
105
|
-
size: '1.75rem',
|
|
106
|
-
},
|
|
107
|
-
typographySettings: {
|
|
108
|
-
fluid: true,
|
|
109
|
-
},
|
|
110
|
-
expected:
|
|
111
|
-
'clamp(1.3125rem, 1.3125rem + ((1vw - 0.48rem) * 2.524), 2.625rem)',
|
|
63
|
+
typographySettings: {
|
|
64
|
+
fluid: true,
|
|
112
65
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
'clamp(75.13125px, 4.695703125rem + ((1vw - 7.68px) * 9.03), 150.2625px)',
|
|
123
|
-
},
|
|
124
|
-
// Should return default fluid values with empty fluid array.
|
|
125
|
-
{
|
|
126
|
-
preset: {
|
|
127
|
-
size: '28px',
|
|
128
|
-
fluid: [],
|
|
129
|
-
},
|
|
130
|
-
typographySettings: {
|
|
131
|
-
fluid: true,
|
|
132
|
-
},
|
|
133
|
-
expected:
|
|
134
|
-
'clamp(21px, 1.3125rem + ((1vw - 7.68px) * 2.524), 42px)',
|
|
66
|
+
expected:
|
|
67
|
+
'clamp(21px, 1.313rem + ((1vw - 7.68px) * 2.524), 42px)',
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
{
|
|
71
|
+
message: 'returns value with unsupported unit',
|
|
72
|
+
preset: {
|
|
73
|
+
size: '1000%',
|
|
74
|
+
fluid: false,
|
|
135
75
|
},
|
|
76
|
+
typographySettings: {
|
|
77
|
+
fluid: true,
|
|
78
|
+
},
|
|
79
|
+
expected: '1000%',
|
|
80
|
+
},
|
|
136
81
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
82
|
+
{
|
|
83
|
+
message: 'returns clamp value with rem min and max units',
|
|
84
|
+
preset: {
|
|
85
|
+
size: '1.75rem',
|
|
86
|
+
},
|
|
87
|
+
typographySettings: {
|
|
88
|
+
fluid: true,
|
|
89
|
+
},
|
|
90
|
+
expected:
|
|
91
|
+
'clamp(1.313rem, 1.313rem + ((1vw - 0.48rem) * 0.84), 1.75rem)',
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
{
|
|
95
|
+
message: 'returns clamp value with eem min and max units',
|
|
96
|
+
preset: {
|
|
97
|
+
size: '1.75em',
|
|
98
|
+
},
|
|
99
|
+
typographySettings: {
|
|
100
|
+
fluid: true,
|
|
101
|
+
},
|
|
102
|
+
expected:
|
|
103
|
+
'clamp(1.313em, 1.313rem + ((1vw - 0.48em) * 0.84), 1.75em)',
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
{
|
|
107
|
+
message: 'returns clamp value for floats',
|
|
108
|
+
preset: {
|
|
109
|
+
size: '100.175px',
|
|
110
|
+
},
|
|
111
|
+
typographySettings: {
|
|
112
|
+
fluid: true,
|
|
113
|
+
},
|
|
114
|
+
expected:
|
|
115
|
+
'clamp(75.131px, 4.696rem + ((1vw - 7.68px) * 3.01), 100.175px)',
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
{
|
|
119
|
+
message: 'coerces integer to `px` and returns clamp value',
|
|
120
|
+
preset: {
|
|
121
|
+
size: 33,
|
|
122
|
+
fluid: true,
|
|
123
|
+
},
|
|
124
|
+
typographySettings: {
|
|
125
|
+
fluid: true,
|
|
126
|
+
},
|
|
127
|
+
expected:
|
|
128
|
+
'clamp(24.75px, 1.547rem + ((1vw - 7.68px) * 0.992), 33px)',
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
{
|
|
132
|
+
message: 'coerces float to `px` and returns clamp value',
|
|
133
|
+
preset: {
|
|
134
|
+
size: 100.23,
|
|
135
|
+
fluid: true,
|
|
136
|
+
},
|
|
137
|
+
typographySettings: {
|
|
138
|
+
fluid: true,
|
|
139
|
+
},
|
|
140
|
+
expected:
|
|
141
|
+
'clamp(75.173px, 4.698rem + ((1vw - 7.68px) * 3.012), 100.23px)',
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
{
|
|
145
|
+
message: 'returns clamp value when `fluid` is empty array',
|
|
146
|
+
preset: {
|
|
147
|
+
size: '28px',
|
|
148
|
+
fluid: [],
|
|
149
|
+
},
|
|
150
|
+
typographySettings: {
|
|
151
|
+
fluid: true,
|
|
152
|
+
},
|
|
153
|
+
expected:
|
|
154
|
+
'clamp(21px, 1.313rem + ((1vw - 7.68px) * 0.841), 28px)',
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
{
|
|
158
|
+
message: 'returns clamp value when `fluid` is `null`',
|
|
159
|
+
preset: {
|
|
160
|
+
size: '28px',
|
|
161
|
+
fluid: null,
|
|
162
|
+
},
|
|
163
|
+
typographySettings: {
|
|
164
|
+
fluid: true,
|
|
165
|
+
},
|
|
166
|
+
expected:
|
|
167
|
+
'clamp(21px, 1.313rem + ((1vw - 7.68px) * 0.841), 28px)',
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
{
|
|
171
|
+
message:
|
|
172
|
+
'returns clamp value if min font size is greater than max',
|
|
173
|
+
preset: {
|
|
174
|
+
size: '3rem',
|
|
175
|
+
fluid: {
|
|
176
|
+
min: '5rem',
|
|
177
|
+
max: '32px',
|
|
145
178
|
},
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
179
|
+
},
|
|
180
|
+
typographySettings: {
|
|
181
|
+
fluid: true,
|
|
182
|
+
},
|
|
183
|
+
expected:
|
|
184
|
+
'clamp(5rem, 5rem + ((1vw - 0.48rem) * -5.769), 32px)',
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
{
|
|
188
|
+
message: 'returns value with invalid min/max fluid units',
|
|
189
|
+
preset: {
|
|
190
|
+
size: '10em',
|
|
191
|
+
fluid: {
|
|
192
|
+
min: '20vw',
|
|
193
|
+
max: '50%',
|
|
158
194
|
},
|
|
159
|
-
|
|
160
|
-
|
|
195
|
+
},
|
|
196
|
+
typographySettings: {
|
|
197
|
+
fluid: true,
|
|
198
|
+
},
|
|
199
|
+
expected: '10em',
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
{
|
|
203
|
+
message:
|
|
204
|
+
'returns value when size is < lower bounds and no fluid min/max set',
|
|
205
|
+
preset: {
|
|
206
|
+
size: '3px',
|
|
207
|
+
},
|
|
208
|
+
typographySettings: {
|
|
209
|
+
fluid: true,
|
|
210
|
+
},
|
|
211
|
+
expected: '3px',
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
{
|
|
215
|
+
message:
|
|
216
|
+
'returns value when size is equal to lower bounds and no fluid min/max set',
|
|
217
|
+
preset: {
|
|
218
|
+
size: '14px',
|
|
219
|
+
},
|
|
220
|
+
typographySettings: {
|
|
221
|
+
fluid: true,
|
|
222
|
+
},
|
|
223
|
+
expected: '14px',
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
{
|
|
227
|
+
message: 'returns clamp value with different min max units',
|
|
228
|
+
preset: {
|
|
229
|
+
size: '28px',
|
|
230
|
+
fluid: {
|
|
231
|
+
min: '20px',
|
|
232
|
+
max: '50rem',
|
|
161
233
|
},
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
234
|
+
},
|
|
235
|
+
typographySettings: {
|
|
236
|
+
fluid: true,
|
|
237
|
+
},
|
|
238
|
+
expected:
|
|
239
|
+
'clamp(20px, 1.25rem + ((1vw - 7.68px) * 93.75), 50rem)',
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
{
|
|
243
|
+
message: 'returns clamp value where no fluid max size is set',
|
|
244
|
+
preset: {
|
|
245
|
+
size: '28px',
|
|
246
|
+
fluid: {
|
|
247
|
+
min: '2.6rem',
|
|
172
248
|
},
|
|
173
|
-
|
|
174
|
-
|
|
249
|
+
},
|
|
250
|
+
typographySettings: {
|
|
251
|
+
fluid: true,
|
|
252
|
+
},
|
|
253
|
+
expected:
|
|
254
|
+
'clamp(2.6rem, 2.6rem + ((1vw - 0.48rem) * -1.635), 28px)',
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
{
|
|
258
|
+
message: 'returns clamp value where no fluid min size is set',
|
|
259
|
+
preset: {
|
|
260
|
+
size: '28px',
|
|
261
|
+
fluid: {
|
|
262
|
+
max: '80px',
|
|
175
263
|
},
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
264
|
+
},
|
|
265
|
+
typographySettings: {
|
|
266
|
+
fluid: true,
|
|
267
|
+
},
|
|
268
|
+
expected:
|
|
269
|
+
'clamp(21px, 1.313rem + ((1vw - 7.68px) * 7.091), 80px)',
|
|
270
|
+
},
|
|
271
|
+
|
|
272
|
+
{
|
|
273
|
+
message:
|
|
274
|
+
'should not apply lower bound test when fluid values are set',
|
|
275
|
+
preset: {
|
|
276
|
+
size: '1.5rem',
|
|
277
|
+
fluid: {
|
|
278
|
+
min: '0.5rem',
|
|
279
|
+
max: '5rem',
|
|
186
280
|
},
|
|
187
|
-
|
|
188
|
-
|
|
281
|
+
},
|
|
282
|
+
typographySettings: {
|
|
283
|
+
fluid: true,
|
|
284
|
+
},
|
|
285
|
+
expected:
|
|
286
|
+
'clamp(0.5rem, 0.5rem + ((1vw - 0.48rem) * 8.654), 5rem)',
|
|
287
|
+
},
|
|
288
|
+
|
|
289
|
+
{
|
|
290
|
+
message:
|
|
291
|
+
'should not apply lower bound test when only fluid min is set',
|
|
292
|
+
preset: {
|
|
293
|
+
size: '20px',
|
|
294
|
+
fluid: {
|
|
295
|
+
min: '12px',
|
|
189
296
|
},
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
297
|
+
},
|
|
298
|
+
typographySettings: {
|
|
299
|
+
fluid: true,
|
|
300
|
+
},
|
|
301
|
+
expected:
|
|
302
|
+
'clamp(12px, 0.75rem + ((1vw - 7.68px) * 0.962), 20px)',
|
|
303
|
+
},
|
|
304
|
+
|
|
305
|
+
{
|
|
306
|
+
message:
|
|
307
|
+
'should not apply lower bound test when only fluid max is set',
|
|
308
|
+
preset: {
|
|
309
|
+
size: '0.875rem',
|
|
310
|
+
fluid: {
|
|
311
|
+
max: '20rem',
|
|
200
312
|
},
|
|
201
|
-
|
|
202
|
-
|
|
313
|
+
},
|
|
314
|
+
typographySettings: {
|
|
315
|
+
fluid: true,
|
|
316
|
+
},
|
|
317
|
+
expected:
|
|
318
|
+
'clamp(0.875rem, 0.875rem + ((1vw - 0.48rem) * 36.779), 20rem)',
|
|
319
|
+
},
|
|
320
|
+
|
|
321
|
+
{
|
|
322
|
+
message:
|
|
323
|
+
'returns clamp value when min and max font sizes are equal',
|
|
324
|
+
preset: {
|
|
325
|
+
size: '4rem',
|
|
326
|
+
fluid: {
|
|
327
|
+
min: '30px',
|
|
328
|
+
max: '30px',
|
|
203
329
|
},
|
|
204
|
-
expected:
|
|
205
|
-
'clamp(21px, 1.3125rem + ((1vw - 7.68px) * 7.091), 80px)',
|
|
206
330
|
},
|
|
207
|
-
|
|
331
|
+
typographySettings: {
|
|
332
|
+
fluid: true,
|
|
333
|
+
},
|
|
334
|
+
expected: 'clamp(30px, 1.875rem + ((1vw - 7.68px) * 1), 30px)',
|
|
335
|
+
},
|
|
336
|
+
].forEach( ( { message, preset, typographySettings, expected } ) => {
|
|
337
|
+
it( `should ${ message }`, () => {
|
|
208
338
|
expect(
|
|
209
339
|
getTypographyFontSizeValue( preset, typographySettings )
|
|
210
340
|
).toBe( expected );
|
|
@@ -711,7 +711,7 @@ describe( 'global styles renderer', () => {
|
|
|
711
711
|
},
|
|
712
712
|
typography: {
|
|
713
713
|
fontFamily: 'sans-serif',
|
|
714
|
-
fontSize: '
|
|
714
|
+
fontSize: '15px',
|
|
715
715
|
},
|
|
716
716
|
};
|
|
717
717
|
|
|
@@ -725,7 +725,7 @@ describe( 'global styles renderer', () => {
|
|
|
725
725
|
'--wp--style--root--padding-left: 33px',
|
|
726
726
|
'background-color: var(--wp--preset--color--light-green-cyan)',
|
|
727
727
|
'font-family: sans-serif',
|
|
728
|
-
'font-size:
|
|
728
|
+
'font-size: 15px',
|
|
729
729
|
] );
|
|
730
730
|
} );
|
|
731
731
|
|
|
@@ -739,7 +739,7 @@ describe( 'global styles renderer', () => {
|
|
|
739
739
|
'padding-bottom: 33px',
|
|
740
740
|
'padding-left: 33px',
|
|
741
741
|
'font-family: sans-serif',
|
|
742
|
-
'font-size:
|
|
742
|
+
'font-size: 15px',
|
|
743
743
|
] );
|
|
744
744
|
} );
|
|
745
745
|
|
|
@@ -757,7 +757,7 @@ describe( 'global styles renderer', () => {
|
|
|
757
757
|
'padding-bottom: 33px',
|
|
758
758
|
'padding-left: 33px',
|
|
759
759
|
'font-family: sans-serif',
|
|
760
|
-
'font-size:
|
|
760
|
+
'font-size: 15px',
|
|
761
761
|
] );
|
|
762
762
|
} );
|
|
763
763
|
|
|
@@ -782,7 +782,7 @@ describe( 'global styles renderer', () => {
|
|
|
782
782
|
'padding-bottom: 33px',
|
|
783
783
|
'padding-left: 33px',
|
|
784
784
|
'font-family: sans-serif',
|
|
785
|
-
'font-size: clamp(
|
|
785
|
+
'font-size: clamp(14px, 0.875rem + ((1vw - 7.68px) * 0.12), 15px)',
|
|
786
786
|
] );
|
|
787
787
|
} );
|
|
788
788
|
|
|
@@ -807,7 +807,7 @@ describe( 'global styles renderer', () => {
|
|
|
807
807
|
'padding-bottom: 33px',
|
|
808
808
|
'padding-left: 33px',
|
|
809
809
|
'font-family: sans-serif',
|
|
810
|
-
'font-size:
|
|
810
|
+
'font-size: 15px',
|
|
811
811
|
] );
|
|
812
812
|
} );
|
|
813
813
|
} );
|
|
@@ -845,8 +845,44 @@ export const getBlockSelectors = ( blockTypes ) => {
|
|
|
845
845
|
return result;
|
|
846
846
|
};
|
|
847
847
|
|
|
848
|
+
/**
|
|
849
|
+
* If there is a separator block whose color is defined in theme.json via background,
|
|
850
|
+
* update the separator color to the same value by using border color.
|
|
851
|
+
*
|
|
852
|
+
* @param {Object} config Theme.json configuration file object.
|
|
853
|
+
* @return {Object} configTheme.json configuration file object updated.
|
|
854
|
+
*/
|
|
855
|
+
function updateConfigWithSeparator( config ) {
|
|
856
|
+
const needsSeparatorStyleUpdate =
|
|
857
|
+
config.styles?.blocks[ 'core/separator' ] &&
|
|
858
|
+
config.styles?.blocks[ 'core/separator' ].color?.background &&
|
|
859
|
+
! config.styles?.blocks[ 'core/separator' ].color?.text &&
|
|
860
|
+
! config.styles?.blocks[ 'core/separator' ].border?.color;
|
|
861
|
+
if ( needsSeparatorStyleUpdate ) {
|
|
862
|
+
return {
|
|
863
|
+
...config,
|
|
864
|
+
styles: {
|
|
865
|
+
...config.styles,
|
|
866
|
+
blocks: {
|
|
867
|
+
...config.styles.blocks,
|
|
868
|
+
'core/separator': {
|
|
869
|
+
...config.styles.blocks[ 'core/separator' ],
|
|
870
|
+
color: {
|
|
871
|
+
...config.styles.blocks[ 'core/separator' ].color,
|
|
872
|
+
text: config.styles?.blocks[ 'core/separator' ]
|
|
873
|
+
.color.background,
|
|
874
|
+
},
|
|
875
|
+
},
|
|
876
|
+
},
|
|
877
|
+
},
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
return config;
|
|
881
|
+
}
|
|
882
|
+
|
|
848
883
|
export function useGlobalStylesOutput() {
|
|
849
|
-
|
|
884
|
+
let { merged: mergedConfig } = useContext( GlobalStylesContext );
|
|
885
|
+
|
|
850
886
|
const [ blockGap ] = useSetting( 'spacing.blockGap' );
|
|
851
887
|
const hasBlockGapSupport = blockGap !== null;
|
|
852
888
|
const hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.
|
|
@@ -859,7 +895,7 @@ export function useGlobalStylesOutput() {
|
|
|
859
895
|
if ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {
|
|
860
896
|
return [];
|
|
861
897
|
}
|
|
862
|
-
|
|
898
|
+
mergedConfig = updateConfigWithSeparator( mergedConfig );
|
|
863
899
|
const blockSelectors = getBlockSelectors( getBlockTypes() );
|
|
864
900
|
const customProperties = toCustomProperties(
|
|
865
901
|
mergedConfig,
|
|
@@ -60,8 +60,8 @@ export default function Header( {
|
|
|
60
60
|
listViewShortcut,
|
|
61
61
|
isLoaded,
|
|
62
62
|
isVisualMode,
|
|
63
|
-
settings,
|
|
64
63
|
blockEditorMode,
|
|
64
|
+
homeUrl,
|
|
65
65
|
} = useSelect( ( select ) => {
|
|
66
66
|
const {
|
|
67
67
|
__experimentalGetPreviewDeviceType,
|
|
@@ -70,7 +70,6 @@ export default function Header( {
|
|
|
70
70
|
isInserterOpened,
|
|
71
71
|
isListViewOpened,
|
|
72
72
|
getEditorMode,
|
|
73
|
-
getSettings,
|
|
74
73
|
} = select( editSiteStore );
|
|
75
74
|
const { getEditedEntityRecord } = select( coreStore );
|
|
76
75
|
const { __experimentalGetTemplateInfo: getTemplateInfo } =
|
|
@@ -83,6 +82,10 @@ export default function Header( {
|
|
|
83
82
|
const record = getEditedEntityRecord( 'postType', postType, postId );
|
|
84
83
|
const _isLoaded = !! postId;
|
|
85
84
|
|
|
85
|
+
const {
|
|
86
|
+
getUnstableBase, // Site index.
|
|
87
|
+
} = select( coreStore );
|
|
88
|
+
|
|
86
89
|
return {
|
|
87
90
|
deviceType: __experimentalGetPreviewDeviceType(),
|
|
88
91
|
entityTitle: getTemplateInfo( record ).title,
|
|
@@ -95,8 +98,8 @@ export default function Header( {
|
|
|
95
98
|
'core/edit-site/toggle-list-view'
|
|
96
99
|
),
|
|
97
100
|
isVisualMode: getEditorMode() === 'visual',
|
|
98
|
-
settings: getSettings(),
|
|
99
101
|
blockEditorMode: __unstableGetEditorMode(),
|
|
102
|
+
homeUrl: getUnstableBase()?.home,
|
|
100
103
|
};
|
|
101
104
|
}, [] );
|
|
102
105
|
|
|
@@ -256,7 +259,7 @@ export default function Header( {
|
|
|
256
259
|
>
|
|
257
260
|
<MenuGroup>
|
|
258
261
|
<MenuItem
|
|
259
|
-
href={
|
|
262
|
+
href={ homeUrl }
|
|
260
263
|
target="_blank"
|
|
261
264
|
icon={ external }
|
|
262
265
|
>
|