@wordpress/block-editor 15.6.1-next.36001005c.0 → 15.7.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.
- package/CHANGELOG.md +2 -0
- package/build/components/block-list/block.js +3 -3
- package/build/components/block-list/block.js.map +2 -2
- package/build/components/block-list/index.js +2 -2
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-toolbar/switch-section-style.js +2 -5
- package/build/components/block-toolbar/switch-section-style.js.map +2 -2
- package/build/components/global-styles/hooks.js +0 -107
- package/build/components/global-styles/hooks.js.map +3 -3
- package/build/components/global-styles/index.js +0 -15
- package/build/components/global-styles/index.js.map +2 -2
- package/build/components/global-styles/typography-panel.js +18 -1
- package/build/components/global-styles/typography-panel.js.map +2 -2
- package/build/components/global-styles/utils.js +0 -19
- package/build/components/global-styles/utils.js.map +3 -3
- package/build/components/inserter/media-tab/media-tab.js +33 -1
- package/build/components/inserter/media-tab/media-tab.js.map +3 -3
- package/build/components/inserter/tips.js +0 -2
- package/build/components/inserter/tips.js.map +2 -2
- package/build/components/media-placeholder/index.js +31 -1
- package/build/components/media-placeholder/index.js.map +3 -3
- package/build/components/media-replace-flow/index.js +29 -1
- package/build/components/media-replace-flow/index.js.map +3 -3
- package/build/components/{global-styles/context.js → media-upload-modal/index.js} +8 -23
- package/build/components/media-upload-modal/index.js.map +7 -0
- package/build/components/rich-text/index.js +8 -7
- package/build/components/rich-text/index.js.map +2 -2
- package/build/hooks/allowed-blocks.js +3 -8
- package/build/hooks/allowed-blocks.js.map +3 -3
- package/build/hooks/block-bindings.js +111 -170
- package/build/hooks/block-bindings.js.map +2 -2
- package/build/hooks/block-style-variation.js +4 -13
- package/build/hooks/block-style-variation.js.map +2 -2
- package/build/hooks/custom-class-name.js +1 -1
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/fit-text.js +33 -20
- package/build/hooks/fit-text.js.map +2 -2
- package/build/hooks/font-size.js +4 -3
- package/build/hooks/font-size.js.map +2 -2
- package/build/hooks/metadata.js +48 -2
- package/build/hooks/metadata.js.map +2 -2
- package/build/hooks/typography.js +11 -4
- package/build/hooks/typography.js.map +3 -3
- package/build/private-apis.js +3 -1
- package/build/private-apis.js.map +3 -3
- package/build/store/private-selectors.js +3 -3
- package/build/store/private-selectors.js.map +2 -2
- package/build/store/selectors.js +38 -13
- package/build/store/selectors.js.map +2 -2
- package/build/store/utils.js +2 -1
- package/build/store/utils.js.map +2 -2
- package/build/utils/fit-text-utils.js +4 -4
- package/build/utils/fit-text-utils.js.map +2 -2
- package/build-module/components/block-list/block.js +3 -3
- package/build-module/components/block-list/block.js.map +2 -2
- package/build-module/components/block-list/index.js +2 -2
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-toolbar/switch-section-style.js +2 -5
- package/build-module/components/block-toolbar/switch-section-style.js.map +2 -2
- package/build-module/components/global-styles/hooks.js +1 -99
- package/build-module/components/global-styles/hooks.js.map +2 -2
- package/build-module/components/global-styles/index.js +1 -15
- package/build-module/components/global-styles/index.js.map +2 -2
- package/build-module/components/global-styles/typography-panel.js +18 -1
- package/build-module/components/global-styles/typography-panel.js.map +2 -2
- package/build-module/components/global-styles/utils.js +0 -8
- package/build-module/components/global-styles/utils.js.map +2 -2
- package/build-module/components/inserter/media-tab/media-tab.js +34 -2
- package/build-module/components/inserter/media-tab/media-tab.js.map +2 -2
- package/build-module/components/inserter/tips.js +0 -2
- package/build-module/components/inserter/tips.js.map +2 -2
- package/build-module/components/media-placeholder/index.js +31 -1
- package/build-module/components/media-placeholder/index.js.map +2 -2
- package/build-module/components/media-replace-flow/index.js +29 -1
- package/build-module/components/media-replace-flow/index.js.map +2 -2
- package/build-module/components/media-upload-modal/index.js +7 -0
- package/build-module/components/media-upload-modal/index.js.map +7 -0
- package/build-module/components/rich-text/index.js +8 -7
- package/build-module/components/rich-text/index.js.map +2 -2
- package/build-module/hooks/allowed-blocks.js +3 -8
- package/build-module/hooks/allowed-blocks.js.map +2 -2
- package/build-module/hooks/block-bindings.js +112 -172
- package/build-module/hooks/block-bindings.js.map +2 -2
- package/build-module/hooks/block-style-variation.js +5 -14
- package/build-module/hooks/block-style-variation.js.map +2 -2
- package/build-module/hooks/custom-class-name.js +1 -1
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/fit-text.js +34 -21
- package/build-module/hooks/fit-text.js.map +2 -2
- package/build-module/hooks/font-size.js +4 -3
- package/build-module/hooks/font-size.js.map +2 -2
- package/build-module/hooks/metadata.js +46 -1
- package/build-module/hooks/metadata.js.map +2 -2
- package/build-module/hooks/typography.js +11 -4
- package/build-module/hooks/typography.js.map +3 -3
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +2 -2
- package/build-module/store/private-selectors.js +2 -2
- package/build-module/store/private-selectors.js.map +2 -2
- package/build-module/store/selectors.js +39 -14
- package/build-module/store/selectors.js.map +2 -2
- package/build-module/store/utils.js +3 -2
- package/build-module/store/utils.js.map +2 -2
- package/build-module/utils/fit-text-utils.js +4 -4
- package/build-module/utils/fit-text-utils.js.map +2 -2
- package/package.json +36 -36
- package/src/components/block-list/block.js +1 -1
- package/src/components/block-list/index.js +2 -2
- package/src/components/block-toolbar/switch-section-style.js +2 -5
- package/src/components/global-styles/hooks.js +1 -121
- package/src/components/global-styles/index.js +1 -9
- package/src/components/global-styles/typography-panel.js +26 -1
- package/src/components/global-styles/utils.js +0 -31
- package/src/components/inserter/media-tab/media-tab.js +44 -2
- package/src/components/inserter/tips.js +0 -2
- package/src/components/media-placeholder/index.js +41 -1
- package/src/components/media-replace-flow/index.js +39 -1
- package/src/components/media-upload-modal/index.js +18 -0
- package/src/components/rich-text/index.js +8 -14
- package/src/hooks/allowed-blocks.js +3 -11
- package/src/hooks/block-bindings.js +79 -153
- package/src/hooks/block-style-variation.js +5 -17
- package/src/hooks/custom-class-name.js +1 -1
- package/src/hooks/fit-text.js +39 -30
- package/src/hooks/font-size.js +7 -3
- package/src/hooks/metadata.js +89 -0
- package/src/hooks/test/metadata.js +316 -0
- package/src/hooks/typography.js +15 -4
- package/src/private-apis.js +2 -0
- package/src/store/private-selectors.js +2 -2
- package/src/store/selectors.js +59 -21
- package/src/store/test/selectors.js +1 -1
- package/src/store/utils.js +2 -1
- package/src/utils/fit-text-utils.js +4 -16
- package/tsconfig.json +1 -0
- package/build/components/global-styles/context.js.map +0 -7
- package/build/components/global-styles/get-global-styles-changes.js +0 -216
- package/build/components/global-styles/get-global-styles-changes.js.map +0 -7
- package/build-module/components/global-styles/context.js +0 -17
- package/build-module/components/global-styles/context.js.map +0 -7
- package/build-module/components/global-styles/get-global-styles-changes.js +0 -182
- package/build-module/components/global-styles/get-global-styles-changes.js.map +0 -7
- package/src/components/global-styles/README.md +0 -190
- package/src/components/global-styles/context.js +0 -16
- package/src/components/global-styles/get-global-styles-changes.js +0 -252
- package/src/components/global-styles/test/get-global-styles-changes.js +0 -290
- package/src/components/global-styles/test/utils.js +0 -58
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import getGlobalStylesChanges, {
|
|
5
|
-
getGlobalStylesChangelist,
|
|
6
|
-
} from '../get-global-styles-changes';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* WordPress dependencies
|
|
10
|
-
*/
|
|
11
|
-
import {
|
|
12
|
-
registerBlockType,
|
|
13
|
-
unregisterBlockType,
|
|
14
|
-
getBlockTypes,
|
|
15
|
-
} from '@wordpress/blocks';
|
|
16
|
-
|
|
17
|
-
describe( 'getGlobalStylesChanges and utils', () => {
|
|
18
|
-
const next = {
|
|
19
|
-
styles: {
|
|
20
|
-
background: {
|
|
21
|
-
backgroundImage: {
|
|
22
|
-
url: 'https://example.com/image.jpg',
|
|
23
|
-
},
|
|
24
|
-
backgroundSize: 'contain',
|
|
25
|
-
backgroundPosition: '30% 30%',
|
|
26
|
-
backgroundRepeat: 'no-repeat',
|
|
27
|
-
},
|
|
28
|
-
typography: {
|
|
29
|
-
fontSize: 'var(--wp--preset--font-size--potato)',
|
|
30
|
-
fontStyle: 'normal',
|
|
31
|
-
fontWeight: '600',
|
|
32
|
-
lineHeight: '1.85',
|
|
33
|
-
fontFamily: 'var(--wp--preset--font-family--asparagus)',
|
|
34
|
-
},
|
|
35
|
-
spacing: {
|
|
36
|
-
padding: {
|
|
37
|
-
top: '36px',
|
|
38
|
-
right: '89px',
|
|
39
|
-
bottom: '133px',
|
|
40
|
-
left: 'var(--wp--preset--spacing--20)',
|
|
41
|
-
},
|
|
42
|
-
blockGap: '114px',
|
|
43
|
-
},
|
|
44
|
-
elements: {
|
|
45
|
-
heading: {
|
|
46
|
-
typography: {
|
|
47
|
-
letterSpacing: '37px',
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
h3: {
|
|
51
|
-
typography: {
|
|
52
|
-
lineHeight: '1.2',
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
caption: {
|
|
56
|
-
color: {
|
|
57
|
-
text: 'var(--wp--preset--color--pineapple)',
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
color: {
|
|
62
|
-
text: 'var(--wp--preset--color--tomato)',
|
|
63
|
-
},
|
|
64
|
-
blocks: {
|
|
65
|
-
'core/test-fiori-di-zucca': {
|
|
66
|
-
color: {
|
|
67
|
-
text: '#000000',
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
settings: {
|
|
73
|
-
color: {
|
|
74
|
-
palette: {
|
|
75
|
-
theme: [
|
|
76
|
-
{
|
|
77
|
-
slug: 'one',
|
|
78
|
-
color: 'pink',
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
gradients: [
|
|
83
|
-
{
|
|
84
|
-
name: 'Something something',
|
|
85
|
-
gradient:
|
|
86
|
-
'linear-gradient(105deg,rgba(6,147,100,1) 0%,rgb(155,81,100) 100%)',
|
|
87
|
-
slug: 'something-something',
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
const previous = {
|
|
94
|
-
styles: {
|
|
95
|
-
background: {
|
|
96
|
-
backgroundImage: {
|
|
97
|
-
url: 'https://example.com/image_new.jpg',
|
|
98
|
-
},
|
|
99
|
-
backgroundSize: 'contain',
|
|
100
|
-
backgroundPosition: '40% 77%',
|
|
101
|
-
backgroundRepeat: 'repeat',
|
|
102
|
-
},
|
|
103
|
-
typography: {
|
|
104
|
-
fontSize: 'var(--wp--preset--font-size--fungus)',
|
|
105
|
-
fontStyle: 'normal',
|
|
106
|
-
fontWeight: '600',
|
|
107
|
-
lineHeight: '1.85',
|
|
108
|
-
fontFamily: 'var(--wp--preset--font-family--grapes)',
|
|
109
|
-
},
|
|
110
|
-
spacing: {
|
|
111
|
-
padding: {
|
|
112
|
-
top: '36px',
|
|
113
|
-
right: '89px',
|
|
114
|
-
bottom: '133px',
|
|
115
|
-
left: 'var(--wp--preset--spacing--20)',
|
|
116
|
-
},
|
|
117
|
-
blockGap: '114px',
|
|
118
|
-
},
|
|
119
|
-
elements: {
|
|
120
|
-
heading: {
|
|
121
|
-
typography: {
|
|
122
|
-
letterSpacing: '37px',
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
h3: {
|
|
126
|
-
typography: {
|
|
127
|
-
lineHeight: '2',
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
h6: {
|
|
131
|
-
typography: {
|
|
132
|
-
lineHeight: '1.2',
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
caption: {
|
|
136
|
-
typography: {
|
|
137
|
-
fontSize: '1.11rem',
|
|
138
|
-
fontStyle: 'normal',
|
|
139
|
-
fontWeight: '600',
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
link: {
|
|
143
|
-
typography: {
|
|
144
|
-
lineHeight: 2,
|
|
145
|
-
textDecoration: 'line-through',
|
|
146
|
-
},
|
|
147
|
-
color: {
|
|
148
|
-
text: 'var(--wp--preset--color--egg)',
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
color: {
|
|
153
|
-
text: 'var(--wp--preset--color--tomato)',
|
|
154
|
-
background: 'var(--wp--preset--color--pumpkin)',
|
|
155
|
-
},
|
|
156
|
-
blocks: {
|
|
157
|
-
'core/test-fiori-di-zucca': {
|
|
158
|
-
color: {
|
|
159
|
-
text: '#fff',
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
settings: {
|
|
165
|
-
color: {
|
|
166
|
-
palette: {
|
|
167
|
-
theme: [
|
|
168
|
-
{
|
|
169
|
-
slug: 'one',
|
|
170
|
-
color: 'blue',
|
|
171
|
-
},
|
|
172
|
-
],
|
|
173
|
-
custom: [
|
|
174
|
-
{
|
|
175
|
-
slug: 'one',
|
|
176
|
-
color: 'tomato',
|
|
177
|
-
},
|
|
178
|
-
],
|
|
179
|
-
},
|
|
180
|
-
gradients: [
|
|
181
|
-
{
|
|
182
|
-
name: 'Vivid cyan blue to vivid purple',
|
|
183
|
-
gradient:
|
|
184
|
-
'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
|
|
185
|
-
slug: 'vivid-cyan-blue-to-vivid-purple',
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
},
|
|
189
|
-
typography: {
|
|
190
|
-
fluid: true,
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
beforeEach( () => {
|
|
196
|
-
registerBlockType( 'core/test-fiori-di-zucca', {
|
|
197
|
-
save: () => {},
|
|
198
|
-
category: 'text',
|
|
199
|
-
title: 'Test pumpkin flowers',
|
|
200
|
-
edit: () => {},
|
|
201
|
-
} );
|
|
202
|
-
} );
|
|
203
|
-
|
|
204
|
-
afterEach( () => {
|
|
205
|
-
getBlockTypes().forEach( ( block ) => {
|
|
206
|
-
unregisterBlockType( block.name );
|
|
207
|
-
} );
|
|
208
|
-
} );
|
|
209
|
-
|
|
210
|
-
describe( 'getGlobalStylesChanges()', () => {
|
|
211
|
-
it( 'returns a list of changes', () => {
|
|
212
|
-
const result = getGlobalStylesChanges( next, previous );
|
|
213
|
-
expect( result ).toEqual( [
|
|
214
|
-
'Background, Colors, Typography styles.',
|
|
215
|
-
'Test pumpkin flowers block.',
|
|
216
|
-
'H3, Caption, H6, Link elements.',
|
|
217
|
-
'Color, Typography settings.',
|
|
218
|
-
] );
|
|
219
|
-
} );
|
|
220
|
-
|
|
221
|
-
it( 'returns a list of truncated changes', () => {
|
|
222
|
-
const resultA = getGlobalStylesChanges( next, previous, {
|
|
223
|
-
maxResults: 4,
|
|
224
|
-
} );
|
|
225
|
-
expect( resultA ).toEqual( [
|
|
226
|
-
'Background, Colors, Typography styles.',
|
|
227
|
-
'Test pumpkin flowers block.',
|
|
228
|
-
] );
|
|
229
|
-
} );
|
|
230
|
-
|
|
231
|
-
it( 'skips unknown and unchanged keys', () => {
|
|
232
|
-
const result = getGlobalStylesChanges(
|
|
233
|
-
{
|
|
234
|
-
styles: {
|
|
235
|
-
frogs: {
|
|
236
|
-
legs: 'green',
|
|
237
|
-
},
|
|
238
|
-
typography: {
|
|
239
|
-
fontSize: '1rem',
|
|
240
|
-
},
|
|
241
|
-
settings: {
|
|
242
|
-
'': {
|
|
243
|
-
'': 'foo',
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
styles: {
|
|
250
|
-
frogs: {
|
|
251
|
-
legs: 'yellow',
|
|
252
|
-
},
|
|
253
|
-
typography: {
|
|
254
|
-
fontSize: '1rem',
|
|
255
|
-
},
|
|
256
|
-
settings: {
|
|
257
|
-
'': {
|
|
258
|
-
'': 'bar',
|
|
259
|
-
},
|
|
260
|
-
},
|
|
261
|
-
},
|
|
262
|
-
}
|
|
263
|
-
);
|
|
264
|
-
expect( result ).toEqual( [] );
|
|
265
|
-
} );
|
|
266
|
-
} );
|
|
267
|
-
|
|
268
|
-
describe( 'getGlobalStylesChangelist()', () => {
|
|
269
|
-
it( 'compares two objects and returns a cached list of changed keys', () => {
|
|
270
|
-
const resultA = getGlobalStylesChangelist( next, previous );
|
|
271
|
-
|
|
272
|
-
expect( resultA ).toEqual( [
|
|
273
|
-
[ 'styles', 'Background' ],
|
|
274
|
-
[ 'styles', 'Colors' ],
|
|
275
|
-
[ 'styles', 'Typography' ],
|
|
276
|
-
[ 'blocks', 'Test pumpkin flowers' ],
|
|
277
|
-
[ 'elements', 'H3' ],
|
|
278
|
-
[ 'elements', 'Caption' ],
|
|
279
|
-
[ 'elements', 'H6' ],
|
|
280
|
-
[ 'elements', 'Link' ],
|
|
281
|
-
[ 'settings', 'Color' ],
|
|
282
|
-
[ 'settings', 'Typography' ],
|
|
283
|
-
] );
|
|
284
|
-
|
|
285
|
-
const resultB = getGlobalStylesChangelist( next, previous );
|
|
286
|
-
|
|
287
|
-
expect( resultB ).toEqual( resultA );
|
|
288
|
-
} );
|
|
289
|
-
} );
|
|
290
|
-
} );
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { areGlobalStyleConfigsEqual } from '../utils';
|
|
5
|
-
|
|
6
|
-
describe( 'editor utils', () => {
|
|
7
|
-
describe( 'areGlobalStyleConfigsEqual', () => {
|
|
8
|
-
test.each( [
|
|
9
|
-
{ original: null, variation: null, expected: true },
|
|
10
|
-
{ original: {}, variation: {}, expected: true },
|
|
11
|
-
{ original: {}, variation: undefined, expected: false },
|
|
12
|
-
{
|
|
13
|
-
original: {
|
|
14
|
-
styles: {
|
|
15
|
-
color: { text: 'var(--wp--preset--color--red)' },
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
variation: {
|
|
19
|
-
styles: {
|
|
20
|
-
color: { text: 'var(--wp--preset--color--blue)' },
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
expected: false,
|
|
24
|
-
},
|
|
25
|
-
{ original: {}, variation: undefined, expected: false },
|
|
26
|
-
{
|
|
27
|
-
original: {
|
|
28
|
-
styles: {
|
|
29
|
-
color: { text: 'var(--wp--preset--color--red)' },
|
|
30
|
-
},
|
|
31
|
-
settings: {
|
|
32
|
-
typography: {
|
|
33
|
-
fontSize: true,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
variation: {
|
|
38
|
-
styles: {
|
|
39
|
-
color: { text: 'var(--wp--preset--color--red)' },
|
|
40
|
-
},
|
|
41
|
-
settings: {
|
|
42
|
-
typography: {
|
|
43
|
-
fontSize: true,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
expected: true,
|
|
48
|
-
},
|
|
49
|
-
] )(
|
|
50
|
-
'.areGlobalStyleConfigsEqual( $original, $variation )',
|
|
51
|
-
( { original, variation, expected } ) => {
|
|
52
|
-
expect(
|
|
53
|
-
areGlobalStyleConfigsEqual( original, variation )
|
|
54
|
-
).toBe( expected );
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
} );
|
|
58
|
-
} );
|