@wordpress/edit-site 4.17.0 → 4.19.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 (141) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/add-custom-template-modal.js +3 -1
  3. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  4. package/build/components/app/index.js +8 -3
  5. package/build/components/app/index.js.map +1 -1
  6. package/build/components/block-editor/resizable-editor.js +9 -47
  7. package/build/components/block-editor/resizable-editor.js.map +1 -1
  8. package/build/components/editor/index.js +9 -13
  9. package/build/components/editor/index.js.map +1 -1
  10. package/build/components/global-styles/border-panel.js +2 -1
  11. package/build/components/global-styles/border-panel.js.map +1 -1
  12. package/build/components/global-styles/dimensions-panel.js +46 -2
  13. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  14. package/build/components/global-styles/global-styles-provider.js +6 -5
  15. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  16. package/build/components/global-styles/hooks.js +32 -0
  17. package/build/components/global-styles/hooks.js.map +1 -1
  18. package/build/components/global-styles/palette.js +8 -1
  19. package/build/components/global-styles/palette.js.map +1 -1
  20. package/build/components/global-styles/typography-panel.js +53 -16
  21. package/build/components/global-styles/typography-panel.js.map +1 -1
  22. package/build/components/global-styles/use-global-styles-output.js +43 -8
  23. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  24. package/build/components/header-edit-mode/document-actions/index.js +3 -1
  25. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  26. package/build/components/header-edit-mode/index.js +15 -13
  27. package/build/components/header-edit-mode/index.js.map +1 -1
  28. package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -7
  29. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  30. package/build/components/keyboard-shortcuts/index.js +8 -5
  31. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  32. package/build/components/list/table.js +1 -1
  33. package/build/components/list/table.js.map +1 -1
  34. package/build/components/list/use-register-shortcuts.js +3 -0
  35. package/build/components/list/use-register-shortcuts.js.map +1 -1
  36. package/build/components/navigation-sidebar/navigation-panel/index.js +9 -8
  37. package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  38. package/build/components/save-button/index.js +36 -14
  39. package/build/components/save-button/index.js.map +1 -1
  40. package/build/components/sidebar-edit-mode/template-card/index.js +4 -2
  41. package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  42. package/build/components/template-details/index.js +4 -2
  43. package/build/components/template-details/index.js.map +1 -1
  44. package/build/index.js +5 -10
  45. package/build/index.js.map +1 -1
  46. package/build/store/actions.js +15 -0
  47. package/build/store/actions.js.map +1 -1
  48. package/build/store/reducer.js +28 -1
  49. package/build/store/reducer.js.map +1 -1
  50. package/build/store/selectors.js +13 -0
  51. package/build/store/selectors.js.map +1 -1
  52. package/build-module/components/add-new-template/add-custom-template-modal.js +2 -1
  53. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  54. package/build-module/components/app/index.js +8 -3
  55. package/build-module/components/app/index.js.map +1 -1
  56. package/build-module/components/block-editor/resizable-editor.js +11 -49
  57. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  58. package/build-module/components/editor/index.js +10 -14
  59. package/build-module/components/editor/index.js.map +1 -1
  60. package/build-module/components/global-styles/border-panel.js +2 -1
  61. package/build-module/components/global-styles/border-panel.js.map +1 -1
  62. package/build-module/components/global-styles/dimensions-panel.js +46 -2
  63. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  64. package/build-module/components/global-styles/global-styles-provider.js +7 -6
  65. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  66. package/build-module/components/global-styles/hooks.js +27 -1
  67. package/build-module/components/global-styles/hooks.js.map +1 -1
  68. package/build-module/components/global-styles/palette.js +9 -3
  69. package/build-module/components/global-styles/palette.js.map +1 -1
  70. package/build-module/components/global-styles/typography-panel.js +54 -16
  71. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  72. package/build-module/components/global-styles/use-global-styles-output.js +44 -9
  73. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  74. package/build-module/components/header-edit-mode/document-actions/index.js +2 -1
  75. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  76. package/build-module/components/header-edit-mode/index.js +14 -13
  77. package/build-module/components/header-edit-mode/index.js.map +1 -1
  78. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -6
  79. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  80. package/build-module/components/keyboard-shortcuts/index.js +8 -5
  81. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  82. package/build-module/components/list/table.js +1 -1
  83. package/build-module/components/list/table.js.map +1 -1
  84. package/build-module/components/list/use-register-shortcuts.js +3 -0
  85. package/build-module/components/list/use-register-shortcuts.js.map +1 -1
  86. package/build-module/components/navigation-sidebar/navigation-panel/index.js +9 -7
  87. package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  88. package/build-module/components/save-button/index.js +39 -16
  89. package/build-module/components/save-button/index.js.map +1 -1
  90. package/build-module/components/sidebar-edit-mode/template-card/index.js +3 -2
  91. package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  92. package/build-module/components/template-details/index.js +3 -2
  93. package/build-module/components/template-details/index.js.map +1 -1
  94. package/build-module/index.js +5 -3
  95. package/build-module/index.js.map +1 -1
  96. package/build-module/store/actions.js +13 -0
  97. package/build-module/store/actions.js.map +1 -1
  98. package/build-module/store/reducer.js +26 -1
  99. package/build-module/store/reducer.js.map +1 -1
  100. package/build-module/store/selectors.js +11 -0
  101. package/build-module/store/selectors.js.map +1 -1
  102. package/build-style/style-rtl.css +17 -15
  103. package/build-style/style.css +17 -15
  104. package/package.json +30 -29
  105. package/src/components/add-new-template/add-custom-template-modal.js +5 -1
  106. package/src/components/app/index.js +11 -2
  107. package/src/components/block-editor/resizable-editor.js +10 -55
  108. package/src/components/block-editor/style.scss +1 -0
  109. package/src/components/editor/index.js +16 -25
  110. package/src/components/editor/style.scss +1 -7
  111. package/src/components/global-styles/border-panel.js +1 -0
  112. package/src/components/global-styles/dimensions-panel.js +59 -1
  113. package/src/components/global-styles/global-styles-provider.js +5 -6
  114. package/src/components/global-styles/hooks.js +36 -0
  115. package/src/components/global-styles/palette.js +15 -1
  116. package/src/components/global-styles/style.scss +1 -0
  117. package/src/components/global-styles/test/typography-utils.js +82 -98
  118. package/src/components/global-styles/test/use-global-styles-output.js +6 -6
  119. package/src/components/global-styles/typography-panel.js +58 -15
  120. package/src/components/global-styles/use-global-styles-output.js +47 -10
  121. package/src/components/header-edit-mode/document-actions/index.js +2 -1
  122. package/src/components/header-edit-mode/index.js +10 -13
  123. package/src/components/keyboard-shortcut-help-modal/shortcut.js +15 -18
  124. package/src/components/keyboard-shortcuts/index.js +7 -2
  125. package/src/components/list/table.js +1 -1
  126. package/src/components/list/use-register-shortcuts.js +4 -0
  127. package/src/components/navigation-sidebar/navigation-panel/index.js +30 -24
  128. package/src/components/navigation-sidebar/navigation-panel/style.scss +0 -7
  129. package/src/components/navigation-sidebar/navigation-toggle/test/index.js +24 -30
  130. package/src/components/save-button/index.js +31 -15
  131. package/src/components/sidebar-edit-mode/template-card/index.js +3 -2
  132. package/src/components/template-details/index.js +3 -2
  133. package/src/index.js +10 -3
  134. package/src/store/actions.js +13 -0
  135. package/src/store/reducer.js +19 -0
  136. package/src/store/selectors.js +11 -0
  137. package/build/components/main-dashboard-button/index.js +0 -41
  138. package/build/components/main-dashboard-button/index.js.map +0 -1
  139. package/build-module/components/main-dashboard-button/index.js +0 -32
  140. package/build-module/components/main-dashboard-button/index.js.map +0 -1
  141. package/src/components/main-dashboard-button/index.js +0 -28
@@ -7,7 +7,7 @@ describe( 'typography utils', () => {
7
7
  describe( 'getTypographyFontSizeValue', () => {
8
8
  [
9
9
  {
10
- message: 'Default return non-fluid value.',
10
+ message: 'returns value when fluid typography is deactivated',
11
11
  preset: {
12
12
  size: '28px',
13
13
  },
@@ -16,7 +16,7 @@ describe( 'typography utils', () => {
16
16
  },
17
17
 
18
18
  {
19
- message: 'Default return value where font size is 0.',
19
+ message: 'returns value where font size is 0',
20
20
  preset: {
21
21
  size: 0,
22
22
  },
@@ -25,7 +25,7 @@ describe( 'typography utils', () => {
25
25
  },
26
26
 
27
27
  {
28
- message: "Default return value where font size is '0'.",
28
+ message: "returns value where font size is '0'",
29
29
  preset: {
30
30
  size: '0',
31
31
  },
@@ -34,17 +34,16 @@ describe( 'typography utils', () => {
34
34
  },
35
35
 
36
36
  {
37
- message:
38
- 'Default return non-fluid value where `size` is undefined.',
37
+ message: 'returns value where `size` is `null`.',
39
38
  preset: {
40
- size: undefined,
39
+ size: null,
41
40
  },
42
- typographySettings: undefined,
43
- expected: undefined,
41
+ typographySettings: null,
42
+ expected: null,
44
43
  },
45
44
 
46
45
  {
47
- message: 'return non-fluid value when fluid is `false`.',
46
+ message: 'returns value when fluid is `false`',
48
47
  preset: {
49
48
  size: '28px',
50
49
  fluid: false,
@@ -56,84 +55,94 @@ describe( 'typography utils', () => {
56
55
  },
57
56
 
58
57
  {
59
- message:
60
- 'Should coerce integer to `px` and return fluid value.',
58
+ message: 'returns already clamped value',
61
59
  preset: {
62
- size: 33,
63
- fluid: true,
60
+ size: 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 2.524), 42px)',
61
+ fluid: false,
64
62
  },
65
63
  typographySettings: {
66
64
  fluid: true,
67
65
  },
68
66
  expected:
69
- 'clamp(24.75px, 1.547rem + ((1vw - 7.68px) * 2.975), 49.5px)',
67
+ 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 2.524), 42px)',
70
68
  },
71
69
 
72
70
  {
73
- message: 'coerce float to `px` and return fluid value.',
71
+ message: 'returns value with unsupported unit',
74
72
  preset: {
75
- size: 100.23,
73
+ size: '1000%',
74
+ fluid: false,
75
+ },
76
+ typographySettings: {
76
77
  fluid: true,
77
78
  },
79
+ expected: '1000%',
80
+ },
81
+
82
+ {
83
+ message: 'returns clamp value with rem min and max units',
84
+ preset: {
85
+ size: '1.75rem',
86
+ },
78
87
  typographySettings: {
79
88
  fluid: true,
80
89
  },
81
90
  expected:
82
- 'clamp(75.173px, 4.698rem + ((1vw - 7.68px) * 9.035), 150.345px)',
91
+ 'clamp(1.313rem, 1.313rem + ((1vw - 0.48rem) * 0.84), 1.75rem)',
83
92
  },
84
93
 
85
94
  {
86
- message: 'return incoming value when already clamped.',
95
+ message: 'returns clamp value with eem min and max units',
87
96
  preset: {
88
- size: 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 2.524), 42px)',
89
- fluid: false,
97
+ size: '1.75em',
90
98
  },
91
99
  typographySettings: {
92
100
  fluid: true,
93
101
  },
94
102
  expected:
95
- 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 2.524), 42px)',
103
+ 'clamp(1.313em, 1.313rem + ((1vw - 0.48em) * 0.84), 1.75em)',
96
104
  },
97
105
 
98
106
  {
99
- message: 'return incoming value with unsupported unit.',
107
+ message: 'returns clamp value for floats',
100
108
  preset: {
101
- size: '1000%',
102
- fluid: false,
109
+ size: '100.175px',
103
110
  },
104
111
  typographySettings: {
105
112
  fluid: true,
106
113
  },
107
- expected: '1000%',
114
+ expected:
115
+ 'clamp(75.131px, 4.696rem + ((1vw - 7.68px) * 3.01), 100.175px)',
108
116
  },
109
117
 
110
118
  {
111
- message: 'return fluid value.',
119
+ message: 'coerces integer to `px` and returns clamp value',
112
120
  preset: {
113
- size: '1.75rem',
121
+ size: 33,
122
+ fluid: true,
114
123
  },
115
124
  typographySettings: {
116
125
  fluid: true,
117
126
  },
118
127
  expected:
119
- 'clamp(1.313rem, 1.313rem + ((1vw - 0.48rem) * 2.523), 2.625rem)',
128
+ 'clamp(24.75px, 1.547rem + ((1vw - 7.68px) * 0.992), 33px)',
120
129
  },
121
130
 
122
131
  {
123
- message: 'return fluid value for floats with units.',
132
+ message: 'coerces float to `px` and returns clamp value',
124
133
  preset: {
125
- size: '100.175px',
134
+ size: 100.23,
135
+ fluid: true,
126
136
  },
127
137
  typographySettings: {
128
138
  fluid: true,
129
139
  },
130
140
  expected:
131
- 'clamp(75.131px, 4.696rem + ((1vw - 7.68px) * 9.03), 150.263px)',
141
+ 'clamp(75.173px, 4.698rem + ((1vw - 7.68px) * 3.012), 100.23px)',
132
142
  },
133
143
 
134
144
  {
135
- message:
136
- 'Should return default fluid values with empty fluid array.',
145
+ message: 'returns clamp value when `fluid` is empty array',
137
146
  preset: {
138
147
  size: '28px',
139
148
  fluid: [],
@@ -142,11 +151,11 @@ describe( 'typography utils', () => {
142
151
  fluid: true,
143
152
  },
144
153
  expected:
145
- 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 2.524), 42px)',
154
+ 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 0.841), 28px)',
146
155
  },
147
156
 
148
157
  {
149
- message: 'return default fluid values with null value.',
158
+ message: 'returns clamp value when `fluid` is `null`',
150
159
  preset: {
151
160
  size: '28px',
152
161
  fluid: null,
@@ -155,12 +164,12 @@ describe( 'typography utils', () => {
155
164
  fluid: true,
156
165
  },
157
166
  expected:
158
- 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 2.524), 42px)',
167
+ 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 0.841), 28px)',
159
168
  },
160
169
 
161
170
  {
162
171
  message:
163
- 'return clamped value if min font size is greater than max.',
172
+ 'returns clamp value if min font size is greater than max',
164
173
  preset: {
165
174
  size: '3rem',
166
175
  fluid: {
@@ -176,7 +185,7 @@ describe( 'typography utils', () => {
176
185
  },
177
186
 
178
187
  {
179
- message: 'return size with invalid fluid units.',
188
+ message: 'returns value with invalid min/max fluid units',
180
189
  preset: {
181
190
  size: '10em',
182
191
  fluid: {
@@ -192,20 +201,30 @@ describe( 'typography utils', () => {
192
201
 
193
202
  {
194
203
  message:
195
- 'return clamped using font size where no min is given and size is less than default min size.',
204
+ 'returns value when size is < lower bounds and no fluid min/max set',
196
205
  preset: {
197
206
  size: '3px',
198
207
  },
199
208
  typographySettings: {
200
209
  fluid: true,
201
210
  },
202
- expected:
203
- 'clamp(3px, 0.188rem + ((1vw - 7.68px) * 0.18), 4.5px)',
211
+ expected: '3px',
204
212
  },
205
213
 
206
214
  {
207
215
  message:
208
- 'return fluid clamp value with different min max units.',
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',
209
228
  preset: {
210
229
  size: '28px',
211
230
  fluid: {
@@ -219,10 +238,9 @@ describe( 'typography utils', () => {
219
238
  expected:
220
239
  'clamp(20px, 1.25rem + ((1vw - 7.68px) * 93.75), 50rem)',
221
240
  },
222
- //
241
+
223
242
  {
224
- message:
225
- ' Should return clamp value with default fluid max value.',
243
+ message: 'returns clamp value where no fluid max size is set',
226
244
  preset: {
227
245
  size: '28px',
228
246
  fluid: {
@@ -233,12 +251,11 @@ describe( 'typography utils', () => {
233
251
  fluid: true,
234
252
  },
235
253
  expected:
236
- 'clamp(2.6rem, 2.6rem + ((1vw - 0.48rem) * 0.048), 42px)',
254
+ 'clamp(2.6rem, 2.6rem + ((1vw - 0.48rem) * -1.635), 28px)',
237
255
  },
238
256
 
239
257
  {
240
- message:
241
- 'Should return clamp value with default fluid min value.',
258
+ message: 'returns clamp value where no fluid min size is set',
242
259
  preset: {
243
260
  size: '28px',
244
261
  fluid: {
@@ -253,90 +270,57 @@ describe( 'typography utils', () => {
253
270
  },
254
271
 
255
272
  {
256
- message: 'adjust computed min in px to min limit.',
257
- preset: {
258
- size: '14px',
259
- },
260
- typographySettings: {
261
- fluid: true,
262
- },
263
- expected:
264
- 'clamp(14px, 0.875rem + ((1vw - 7.68px) * 0.841), 21px)',
265
- },
266
-
267
- {
268
- message: 'adjust computed min in rem to min limit.',
269
- preset: {
270
- size: '1.1rem',
271
- },
272
- typographySettings: {
273
- fluid: true,
274
- },
275
- expected:
276
- 'clamp(0.875rem, 0.875rem + ((1vw - 0.48rem) * 1.49), 1.65rem)',
277
- },
278
-
279
- {
280
- message: 'adjust computed min in em to min limit.',
281
- preset: {
282
- size: '1.1em',
283
- },
284
- typographySettings: {
285
- fluid: true,
286
- },
287
- expected:
288
- 'clamp(0.875em, 0.875rem + ((1vw - 0.48em) * 1.49), 1.65em)',
289
- },
290
-
291
- {
292
- message: 'adjust fluid min value in px to min limit',
273
+ message:
274
+ 'should not apply lower bound test when fluid values are set',
293
275
  preset: {
294
- size: '20px',
276
+ size: '1.5rem',
295
277
  fluid: {
296
- min: '12px',
278
+ min: '0.5rem',
279
+ max: '5rem',
297
280
  },
298
281
  },
299
282
  typographySettings: {
300
283
  fluid: true,
301
284
  },
302
285
  expected:
303
- 'clamp(14px, 0.875rem + ((1vw - 7.68px) * 1.923), 30px)',
286
+ 'clamp(0.5rem, 0.5rem + ((1vw - 0.48rem) * 8.654), 5rem)',
304
287
  },
305
288
 
306
289
  {
307
- message: 'adjust fluid min value in rem to min limit.',
290
+ message:
291
+ 'should not apply lower bound test when only fluid min is set',
308
292
  preset: {
309
- size: '1.5rem',
293
+ size: '20px',
310
294
  fluid: {
311
- min: '0.5rem',
295
+ min: '12px',
312
296
  },
313
297
  },
314
298
  typographySettings: {
315
299
  fluid: true,
316
300
  },
317
301
  expected:
318
- 'clamp(0.875rem, 0.875rem + ((1vw - 0.48rem) * 2.644), 2.25rem)',
302
+ 'clamp(12px, 0.75rem + ((1vw - 7.68px) * 0.962), 20px)',
319
303
  },
320
304
 
321
305
  {
322
- message: 'adjust fluid min value but honor max value.',
306
+ message:
307
+ 'should not apply lower bound test when only fluid max is set',
323
308
  preset: {
324
- size: '1.5rem',
309
+ size: '0.875rem',
325
310
  fluid: {
326
- min: '0.5rem',
327
- max: '5rem',
311
+ max: '20rem',
328
312
  },
329
313
  },
330
314
  typographySettings: {
331
315
  fluid: true,
332
316
  },
333
317
  expected:
334
- 'clamp(0.875rem, 0.875rem + ((1vw - 0.48rem) * 7.933), 5rem)',
318
+ 'clamp(0.875rem, 0.875rem + ((1vw - 0.48rem) * 36.779), 20rem)',
335
319
  },
336
320
 
337
321
  {
338
322
  message:
339
- 'return a fluid font size a min and max font sizes are equal.',
323
+ 'returns clamp value when min and max font sizes are equal',
340
324
  preset: {
341
325
  size: '4rem',
342
326
  fluid: {
@@ -711,7 +711,7 @@ describe( 'global styles renderer', () => {
711
711
  },
712
712
  typography: {
713
713
  fontFamily: 'sans-serif',
714
- fontSize: '14px',
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: 14px',
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: 14px',
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: 14px',
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(14px, 0.875rem + ((1vw - 7.68px) * 0.841), 21px)',
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: 14px',
810
+ 'font-size: 15px',
811
811
  ] );
812
812
  } );
813
813
  } );
@@ -7,6 +7,7 @@ import {
7
7
  __experimentalFontAppearanceControl as FontAppearanceControl,
8
8
  __experimentalLetterSpacingControl as LetterSpacingControl,
9
9
  __experimentalTextTransformControl as TextTransformControl,
10
+ __experimentalTextDecorationControl as TextDecorationControl,
10
11
  } from '@wordpress/block-editor';
11
12
  import {
12
13
  FontSizePicker,
@@ -19,7 +20,6 @@ import { __ } from '@wordpress/i18n';
19
20
  * Internal dependencies
20
21
  */
21
22
  import { getSupportedGlobalStylesPanels, useSetting, useStyle } from './hooks';
22
- import { getTypographyFontSizeValue } from './typography-utils';
23
23
 
24
24
  export function useHasTypographyPanel( name ) {
25
25
  const hasFontFamily = useHasFontFamilyControl( name );
@@ -102,6 +102,13 @@ function useHasTextTransformControl( name, element ) {
102
102
  return supports.includes( 'textTransform' );
103
103
  }
104
104
 
105
+ function useHasTextDecorationControl( name, element ) {
106
+ // This is an exception for link elements.
107
+ // We shouldn't allow other blocks or elements to set textDecoration
108
+ // because this will be inherited by their children.
109
+ return ! name && element === 'link';
110
+ }
111
+
105
112
  function useStyleWithReset( path, blockName ) {
106
113
  const [ style, setStyle ] = useStyle( path, blockName );
107
114
  const [ userStyle ] = useStyle( path, blockName, 'user' );
@@ -110,6 +117,26 @@ function useStyleWithReset( path, blockName ) {
110
117
  return [ style, setStyle, hasStyle, resetStyle ];
111
118
  }
112
119
 
120
+ function useFontSizeWithReset( path, blockName ) {
121
+ const [ fontSize, setStyleCallback ] = useStyle( path, blockName );
122
+ const [ userStyle ] = useStyle( path, blockName, 'user' );
123
+ const hasFontSize = () => !! userStyle;
124
+ const resetFontSize = () => setStyleCallback( undefined );
125
+ const setFontSize = ( newValue, metadata ) => {
126
+ if ( !! metadata?.slug ) {
127
+ newValue = `var:preset|font-size|${ metadata?.slug }`;
128
+ }
129
+ setStyleCallback( newValue );
130
+ };
131
+
132
+ return {
133
+ fontSize,
134
+ setFontSize,
135
+ hasFontSize,
136
+ resetFontSize,
137
+ };
138
+ }
139
+
113
140
  function useFontAppearance( prefix, name ) {
114
141
  const [ fontStyle, setFontStyle ] = useStyle(
115
142
  prefix + 'typography.fontStyle',
@@ -152,19 +179,8 @@ export default function TypographyPanel( { name, element, headingLevel } ) {
152
179
  } else if ( element && element !== 'text' ) {
153
180
  prefix = `elements.${ element }.`;
154
181
  }
155
- const [ fluidTypography ] = useSetting( 'typography.fluid', name );
156
182
  const [ fontSizes ] = useSetting( 'typography.fontSizes', name );
157
183
 
158
- // Convert static font size values to fluid font sizes if fluidTypography is activated.
159
- const fontSizesWithFluidValues = fontSizes.map( ( font ) => {
160
- if ( !! fluidTypography ) {
161
- font.size = getTypographyFontSizeValue( font, {
162
- fluid: fluidTypography,
163
- } );
164
- }
165
- return font;
166
- } );
167
-
168
184
  const disableCustomFontSizes = ! useSetting(
169
185
  'typography.customFontSize',
170
186
  name
@@ -182,6 +198,10 @@ export default function TypographyPanel( { name, element, headingLevel } ) {
182
198
  const appearanceControlLabel = useAppearanceControlLabel( name );
183
199
  const hasLetterSpacingControl = useHasLetterSpacingControl( name, element );
184
200
  const hasTextTransformControl = useHasTextTransformControl( name, element );
201
+ const hasTextDecorationControl = useHasTextDecorationControl(
202
+ name,
203
+ element
204
+ );
185
205
 
186
206
  /* Disable font size controls when the option to style all headings is selected. */
187
207
  let hasFontSizeEnabled = supports.includes( 'fontSize' );
@@ -191,8 +211,8 @@ export default function TypographyPanel( { name, element, headingLevel } ) {
191
211
 
192
212
  const [ fontFamily, setFontFamily, hasFontFamily, resetFontFamily ] =
193
213
  useStyleWithReset( prefix + 'typography.fontFamily', name );
194
- const [ fontSize, setFontSize, hasFontSize, resetFontSize ] =
195
- useStyleWithReset( prefix + 'typography.fontSize', name );
214
+ const { fontSize, setFontSize, hasFontSize, resetFontSize } =
215
+ useFontSizeWithReset( prefix + 'typography.fontSize', name );
196
216
  const {
197
217
  fontStyle,
198
218
  setFontStyle,
@@ -215,6 +235,12 @@ export default function TypographyPanel( { name, element, headingLevel } ) {
215
235
  hasTextTransform,
216
236
  resetTextTransform,
217
237
  ] = useStyleWithReset( prefix + 'typography.textTransform', name );
238
+ const [
239
+ textDecoration,
240
+ setTextDecoration,
241
+ hasTextDecoration,
242
+ resetTextDecoration,
243
+ ] = useStyleWithReset( prefix + 'typography.textDecoration', name );
218
244
 
219
245
  const resetAll = () => {
220
246
  resetFontFamily();
@@ -253,9 +279,10 @@ export default function TypographyPanel( { name, element, headingLevel } ) {
253
279
  <FontSizePicker
254
280
  value={ fontSize }
255
281
  onChange={ setFontSize }
256
- fontSizes={ fontSizesWithFluidValues }
282
+ fontSizes={ fontSizes }
257
283
  disableCustomFontSizes={ disableCustomFontSizes }
258
284
  withReset={ false }
285
+ withSlider
259
286
  size="__unstable-large"
260
287
  __nextHasNoMarginBottom
261
288
  />
@@ -338,6 +365,22 @@ export default function TypographyPanel( { name, element, headingLevel } ) {
338
365
  />
339
366
  </ToolsPanelItem>
340
367
  ) }
368
+ { hasTextDecorationControl && (
369
+ <ToolsPanelItem
370
+ className="single-column"
371
+ label={ __( 'Text decoration' ) }
372
+ hasValue={ hasTextDecoration }
373
+ onDeselect={ resetTextDecoration }
374
+ isShownByDefault
375
+ >
376
+ <TextDecorationControl
377
+ value={ textDecoration }
378
+ onChange={ setTextDecoration }
379
+ size="__unstable-large"
380
+ __unstableInputWidth="auto"
381
+ />
382
+ </ToolsPanelItem>
383
+ ) }
341
384
  </ToolsPanel>
342
385
  );
343
386
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { get, isEmpty, kebabCase, pickBy, reduce, set } from 'lodash';
4
+ import { get, isEmpty, kebabCase, pickBy, set } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -61,8 +61,7 @@ function compileStyleValue( uncompiledValue ) {
61
61
  * @return {Array<Object>} An array of style declarations.
62
62
  */
63
63
  function getPresetsDeclarations( blockPresets = {}, mergedSettings ) {
64
- return reduce(
65
- PRESET_METADATA,
64
+ return PRESET_METADATA.reduce(
66
65
  ( declarations, { path, valueKey, valueFunc, cssVarInfix } ) => {
67
66
  const presetByOrigin = get( blockPresets, path, [] );
68
67
  [ 'default', 'theme', 'custom' ].forEach( ( origin ) => {
@@ -102,8 +101,7 @@ function getPresetsDeclarations( blockPresets = {}, mergedSettings ) {
102
101
  * @return {string} CSS declarations for the preset classes.
103
102
  */
104
103
  function getPresetsClasses( blockSelector, blockPresets = {} ) {
105
- return reduce(
106
- PRESET_METADATA,
104
+ return PRESET_METADATA.reduce(
107
105
  ( declarations, { path, cssVarInfix, classes } ) => {
108
106
  if ( ! classes ) {
109
107
  return declarations;
@@ -193,9 +191,11 @@ export function getStylesDeclarations(
193
191
  tree = {}
194
192
  ) {
195
193
  const isRoot = ROOT_BLOCK_SELECTOR === selector;
196
- const output = reduce(
197
- STYLE_PROPERTY,
198
- ( declarations, { value, properties, useEngine, rootOnly }, key ) => {
194
+ const output = Object.entries( STYLE_PROPERTY ).reduce(
195
+ (
196
+ declarations,
197
+ [ key, { value, properties, useEngine, rootOnly } ]
198
+ ) => {
199
199
  if ( rootOnly && ! isRoot ) {
200
200
  return declarations;
201
201
  }
@@ -453,6 +453,7 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
453
453
  [
454
454
  'border',
455
455
  'color',
456
+ 'dimensions',
456
457
  'spacing',
457
458
  'typography',
458
459
  'filter',
@@ -845,8 +846,44 @@ export const getBlockSelectors = ( blockTypes ) => {
845
846
  return result;
846
847
  };
847
848
 
849
+ /**
850
+ * If there is a separator block whose color is defined in theme.json via background,
851
+ * update the separator color to the same value by using border color.
852
+ *
853
+ * @param {Object} config Theme.json configuration file object.
854
+ * @return {Object} configTheme.json configuration file object updated.
855
+ */
856
+ function updateConfigWithSeparator( config ) {
857
+ const needsSeparatorStyleUpdate =
858
+ config.styles?.blocks[ 'core/separator' ] &&
859
+ config.styles?.blocks[ 'core/separator' ].color?.background &&
860
+ ! config.styles?.blocks[ 'core/separator' ].color?.text &&
861
+ ! config.styles?.blocks[ 'core/separator' ].border?.color;
862
+ if ( needsSeparatorStyleUpdate ) {
863
+ return {
864
+ ...config,
865
+ styles: {
866
+ ...config.styles,
867
+ blocks: {
868
+ ...config.styles.blocks,
869
+ 'core/separator': {
870
+ ...config.styles.blocks[ 'core/separator' ],
871
+ color: {
872
+ ...config.styles.blocks[ 'core/separator' ].color,
873
+ text: config.styles?.blocks[ 'core/separator' ]
874
+ .color.background,
875
+ },
876
+ },
877
+ },
878
+ },
879
+ };
880
+ }
881
+ return config;
882
+ }
883
+
848
884
  export function useGlobalStylesOutput() {
849
- const { merged: mergedConfig } = useContext( GlobalStylesContext );
885
+ let { merged: mergedConfig } = useContext( GlobalStylesContext );
886
+
850
887
  const [ blockGap ] = useSetting( 'spacing.blockGap' );
851
888
  const hasBlockGapSupport = blockGap !== null;
852
889
  const hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.
@@ -859,7 +896,7 @@ export function useGlobalStylesOutput() {
859
896
  if ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {
860
897
  return [];
861
898
  }
862
-
899
+ mergedConfig = updateConfigWithSeparator( mergedConfig );
863
900
  const blockSelectors = getBlockSelectors( getBlockTypes() );
864
901
  const customProperties = toCustomProperties(
865
902
  mergedConfig,
@@ -24,6 +24,7 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
24
24
  import { store as coreStore } from '@wordpress/core-data';
25
25
  import { store as editorStore } from '@wordpress/editor';
26
26
  import { store as preferencesStore } from '@wordpress/preferences';
27
+ import { decodeEntities } from '@wordpress/html-entities';
27
28
 
28
29
  /**
29
30
  * Internal dependencies
@@ -147,7 +148,7 @@ export default function DocumentActions() {
147
148
  entityLabel
148
149
  ) }
149
150
  </VisuallyHidden>
150
- { entityTitle }
151
+ { decodeEntities( entityTitle ) }
151
152
  </Text>
152
153
 
153
154
  <Text