@wordpress/block-library 9.40.2-next.v.202602271551.0 → 9.41.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/button/block.json +11 -3
- package/build/button/deprecated.cjs +246 -13
- package/build/button/deprecated.cjs.map +2 -2
- package/build/button/edit.cjs +45 -58
- package/build/button/edit.cjs.map +3 -3
- package/build/button/save.cjs +3 -7
- package/build/button/save.cjs.map +2 -2
- package/build/button/utils.cjs +59 -0
- package/build/button/utils.cjs.map +7 -0
- package/build/image/image.cjs +1 -1
- package/build/image/image.cjs.map +2 -2
- package/build/navigation-link/shared/use-link-preview.cjs +2 -2
- package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
- package/build/playlist/edit.cjs +43 -136
- package/build/playlist/edit.cjs.map +3 -3
- package/build/playlist/view.cjs +56 -38
- package/build/playlist/view.cjs.map +2 -2
- package/build/playlist-track/edit.cjs +0 -1
- package/build/playlist-track/edit.cjs.map +2 -2
- package/build/post-title/block.json +3 -0
- package/build/post-title/edit.cjs +2 -2
- package/build/post-title/edit.cjs.map +2 -2
- package/build/utils/waveform-player.cjs +68 -0
- package/build/utils/waveform-player.cjs.map +7 -0
- package/build/utils/waveform-utils.cjs +171 -0
- package/build/utils/waveform-utils.cjs.map +7 -0
- package/build-module/button/block.json +11 -3
- package/build-module/button/deprecated.mjs +246 -13
- package/build-module/button/deprecated.mjs.map +2 -2
- package/build-module/button/edit.mjs +47 -63
- package/build-module/button/edit.mjs.map +2 -2
- package/build-module/button/save.mjs +3 -7
- package/build-module/button/save.mjs.map +2 -2
- package/build-module/button/utils.mjs +33 -0
- package/build-module/button/utils.mjs.map +7 -0
- package/build-module/image/image.mjs +1 -1
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/navigation-link/shared/use-link-preview.mjs +2 -2
- package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
- package/build-module/playlist/edit.mjs +41 -139
- package/build-module/playlist/edit.mjs.map +2 -2
- package/build-module/playlist/view.mjs +56 -38
- package/build-module/playlist/view.mjs.map +2 -2
- package/build-module/playlist-track/edit.mjs +0 -1
- package/build-module/playlist-track/edit.mjs.map +2 -2
- package/build-module/post-title/block.json +3 -0
- package/build-module/post-title/edit.mjs +2 -2
- package/build-module/post-title/edit.mjs.map +2 -2
- package/build-module/utils/waveform-player.mjs +43 -0
- package/build-module/utils/waveform-player.mjs.map +7 -0
- package/build-module/utils/waveform-utils.mjs +131 -0
- package/build-module/utils/waveform-utils.mjs.map +7 -0
- package/build-style/button/style-rtl.css +6 -0
- package/build-style/button/style.css +6 -0
- package/build-style/editor-rtl.css +3 -3
- package/build-style/editor.css +3 -3
- package/build-style/playlist/editor-rtl.css +3 -3
- package/build-style/playlist/editor.css +3 -3
- package/build-style/playlist/style-rtl.css +351 -17
- package/build-style/playlist/style.css +351 -17
- package/build-style/style-rtl.css +357 -17
- package/build-style/style.css +357 -17
- package/package.json +39 -38
- package/src/button/block.json +11 -3
- package/src/button/deprecated.js +254 -16
- package/src/button/edit.js +50 -61
- package/src/button/index.php +68 -0
- package/src/button/save.js +2 -8
- package/src/button/style.scss +49 -7
- package/src/button/test/utils.js +84 -0
- package/src/button/utils.js +42 -0
- package/src/image/image.js +14 -15
- package/src/image/index.php +3 -1
- package/src/navigation-link/shared/test/use-link-preview.test.js +9 -0
- package/src/navigation-link/shared/use-link-preview.js +6 -9
- package/src/playlist/edit.js +60 -154
- package/src/playlist/editor.scss +3 -3
- package/src/playlist/index.php +15 -40
- package/src/playlist/style.scss +34 -27
- package/src/playlist/test/edit.js +137 -0
- package/src/playlist/view.js +97 -40
- package/src/playlist-track/edit.js +0 -1
- package/src/post-title/block.json +3 -0
- package/src/post-title/edit.js +4 -2
- package/src/search/index.php +1 -1
- package/src/utils/test/waveform-utils.js +328 -0
- package/src/utils/waveform-player.js +77 -0
- package/src/utils/waveform-utils.js +232 -0
package/CHANGELOG.md
CHANGED
package/build/button/block.json
CHANGED
|
@@ -63,9 +63,6 @@
|
|
|
63
63
|
},
|
|
64
64
|
"gradient": {
|
|
65
65
|
"type": "string"
|
|
66
|
-
},
|
|
67
|
-
"width": {
|
|
68
|
-
"type": "number"
|
|
69
66
|
}
|
|
70
67
|
},
|
|
71
68
|
"supports": {
|
|
@@ -81,6 +78,13 @@
|
|
|
81
78
|
"text": true
|
|
82
79
|
}
|
|
83
80
|
},
|
|
81
|
+
"dimensions": {
|
|
82
|
+
"width": true,
|
|
83
|
+
"__experimentalSkipSerialization": [ "width" ],
|
|
84
|
+
"__experimentalDefaultControls": {
|
|
85
|
+
"width": true
|
|
86
|
+
}
|
|
87
|
+
},
|
|
84
88
|
"typography": {
|
|
85
89
|
"__experimentalSkipSerialization": [
|
|
86
90
|
"fontSize",
|
|
@@ -145,6 +149,10 @@
|
|
|
145
149
|
"root": ".wp-block-button .wp-block-button__link",
|
|
146
150
|
"typography": {
|
|
147
151
|
"writingMode": ".wp-block-button"
|
|
152
|
+
},
|
|
153
|
+
"dimensions": {
|
|
154
|
+
"root": ".wp-block-button",
|
|
155
|
+
"width": ".wp-block-button"
|
|
148
156
|
}
|
|
149
157
|
}
|
|
150
158
|
}
|
|
@@ -39,6 +39,22 @@ var import_compose = require("@wordpress/compose");
|
|
|
39
39
|
var import_migrate_font_family = __toESM(require("../utils/migrate-font-family.cjs"));
|
|
40
40
|
var import_migrate_text_align = __toESM(require("../utils/migrate-text-align.cjs"));
|
|
41
41
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var migrateWidth = (attributes) => {
|
|
43
|
+
const { width, ...otherAttributes } = attributes;
|
|
44
|
+
if (!width) {
|
|
45
|
+
return otherAttributes;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
...otherAttributes,
|
|
49
|
+
style: {
|
|
50
|
+
...otherAttributes.style,
|
|
51
|
+
dimensions: {
|
|
52
|
+
...otherAttributes.style?.dimensions,
|
|
53
|
+
width: `${width}%`
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
};
|
|
42
58
|
var migrateBorderRadius = (attributes) => {
|
|
43
59
|
const { borderRadius, ...newAttributes } = attributes;
|
|
44
60
|
const oldBorderRadius = [
|
|
@@ -126,6 +142,205 @@ var blockAttributes = {
|
|
|
126
142
|
selector: "a"
|
|
127
143
|
}
|
|
128
144
|
};
|
|
145
|
+
var v14 = {
|
|
146
|
+
attributes: {
|
|
147
|
+
tagName: {
|
|
148
|
+
type: "string",
|
|
149
|
+
enum: ["a", "button"],
|
|
150
|
+
default: "a"
|
|
151
|
+
},
|
|
152
|
+
type: {
|
|
153
|
+
type: "string",
|
|
154
|
+
default: "button"
|
|
155
|
+
},
|
|
156
|
+
url: {
|
|
157
|
+
type: "string",
|
|
158
|
+
source: "attribute",
|
|
159
|
+
selector: "a",
|
|
160
|
+
attribute: "href",
|
|
161
|
+
role: "content"
|
|
162
|
+
},
|
|
163
|
+
title: {
|
|
164
|
+
type: "string",
|
|
165
|
+
source: "attribute",
|
|
166
|
+
selector: "a,button",
|
|
167
|
+
attribute: "title",
|
|
168
|
+
role: "content"
|
|
169
|
+
},
|
|
170
|
+
text: {
|
|
171
|
+
type: "rich-text",
|
|
172
|
+
source: "rich-text",
|
|
173
|
+
selector: "a,button",
|
|
174
|
+
role: "content"
|
|
175
|
+
},
|
|
176
|
+
linkTarget: {
|
|
177
|
+
type: "string",
|
|
178
|
+
source: "attribute",
|
|
179
|
+
selector: "a",
|
|
180
|
+
attribute: "target",
|
|
181
|
+
role: "content"
|
|
182
|
+
},
|
|
183
|
+
rel: {
|
|
184
|
+
type: "string",
|
|
185
|
+
source: "attribute",
|
|
186
|
+
selector: "a",
|
|
187
|
+
attribute: "rel",
|
|
188
|
+
role: "content"
|
|
189
|
+
},
|
|
190
|
+
placeholder: {
|
|
191
|
+
type: "string"
|
|
192
|
+
},
|
|
193
|
+
backgroundColor: {
|
|
194
|
+
type: "string"
|
|
195
|
+
},
|
|
196
|
+
textColor: {
|
|
197
|
+
type: "string"
|
|
198
|
+
},
|
|
199
|
+
gradient: {
|
|
200
|
+
type: "string"
|
|
201
|
+
},
|
|
202
|
+
width: {
|
|
203
|
+
type: "number"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
supports: {
|
|
207
|
+
anchor: true,
|
|
208
|
+
splitting: true,
|
|
209
|
+
align: false,
|
|
210
|
+
alignWide: false,
|
|
211
|
+
color: {
|
|
212
|
+
__experimentalSkipSerialization: true,
|
|
213
|
+
gradients: true,
|
|
214
|
+
__experimentalDefaultControls: {
|
|
215
|
+
background: true,
|
|
216
|
+
text: true
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
typography: {
|
|
220
|
+
__experimentalSkipSerialization: [
|
|
221
|
+
"fontSize",
|
|
222
|
+
"lineHeight",
|
|
223
|
+
"textAlign",
|
|
224
|
+
"fontFamily",
|
|
225
|
+
"fontWeight",
|
|
226
|
+
"fontStyle",
|
|
227
|
+
"textTransform",
|
|
228
|
+
"textDecoration",
|
|
229
|
+
"letterSpacing"
|
|
230
|
+
],
|
|
231
|
+
fontSize: true,
|
|
232
|
+
lineHeight: true,
|
|
233
|
+
textAlign: true,
|
|
234
|
+
__experimentalFontFamily: true,
|
|
235
|
+
__experimentalFontWeight: true,
|
|
236
|
+
__experimentalFontStyle: true,
|
|
237
|
+
__experimentalTextTransform: true,
|
|
238
|
+
__experimentalTextDecoration: true,
|
|
239
|
+
__experimentalLetterSpacing: true,
|
|
240
|
+
__experimentalWritingMode: true,
|
|
241
|
+
__experimentalDefaultControls: {
|
|
242
|
+
fontSize: true
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
reusable: false,
|
|
246
|
+
shadow: {
|
|
247
|
+
__experimentalSkipSerialization: true
|
|
248
|
+
},
|
|
249
|
+
spacing: {
|
|
250
|
+
__experimentalSkipSerialization: true,
|
|
251
|
+
padding: ["horizontal", "vertical"],
|
|
252
|
+
__experimentalDefaultControls: {
|
|
253
|
+
padding: true
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
__experimentalBorder: {
|
|
257
|
+
color: true,
|
|
258
|
+
radius: true,
|
|
259
|
+
style: true,
|
|
260
|
+
width: true,
|
|
261
|
+
__experimentalSkipSerialization: true,
|
|
262
|
+
__experimentalDefaultControls: {
|
|
263
|
+
color: true,
|
|
264
|
+
radius: true,
|
|
265
|
+
style: true,
|
|
266
|
+
width: true
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
interactivity: {
|
|
270
|
+
clientNavigation: true
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
selectors: {
|
|
274
|
+
root: ".wp-block-button .wp-block-button__link",
|
|
275
|
+
typography: {
|
|
276
|
+
writingMode: ".wp-block-button"
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
save({ attributes, className }) {
|
|
280
|
+
const {
|
|
281
|
+
tagName,
|
|
282
|
+
type,
|
|
283
|
+
fontSize,
|
|
284
|
+
linkTarget,
|
|
285
|
+
rel,
|
|
286
|
+
style,
|
|
287
|
+
text,
|
|
288
|
+
title,
|
|
289
|
+
url,
|
|
290
|
+
width
|
|
291
|
+
} = attributes;
|
|
292
|
+
const TagName = tagName || "a";
|
|
293
|
+
const isButtonTag = "button" === TagName;
|
|
294
|
+
const buttonType = type || "button";
|
|
295
|
+
const borderProps = (0, import_block_editor.__experimentalGetBorderClassesAndStyles)(attributes);
|
|
296
|
+
const colorProps = (0, import_block_editor.__experimentalGetColorClassesAndStyles)(attributes);
|
|
297
|
+
const spacingProps = (0, import_block_editor.__experimentalGetSpacingClassesAndStyles)(attributes);
|
|
298
|
+
const shadowProps = (0, import_block_editor.__experimentalGetShadowClassesAndStyles)(attributes);
|
|
299
|
+
const typographyProps = (0, import_block_editor.getTypographyClassesAndStyles)(attributes);
|
|
300
|
+
const buttonClasses = (0, import_clsx.default)(
|
|
301
|
+
"wp-block-button__link",
|
|
302
|
+
colorProps.className,
|
|
303
|
+
borderProps.className,
|
|
304
|
+
typographyProps.className,
|
|
305
|
+
{
|
|
306
|
+
// For backwards compatibility add style that isn't
|
|
307
|
+
// provided via block support.
|
|
308
|
+
"no-border-radius": style?.border?.radius === 0,
|
|
309
|
+
[`has-custom-font-size`]: fontSize || style?.typography?.fontSize
|
|
310
|
+
},
|
|
311
|
+
(0, import_block_editor.__experimentalGetElementClassName)("button")
|
|
312
|
+
);
|
|
313
|
+
const buttonStyle = {
|
|
314
|
+
...borderProps.style,
|
|
315
|
+
...colorProps.style,
|
|
316
|
+
...spacingProps.style,
|
|
317
|
+
...shadowProps.style,
|
|
318
|
+
...typographyProps.style,
|
|
319
|
+
writingMode: void 0
|
|
320
|
+
};
|
|
321
|
+
const wrapperClasses = (0, import_clsx.default)(className, {
|
|
322
|
+
[`has-custom-width wp-block-button__width-${width}`]: width
|
|
323
|
+
});
|
|
324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...import_block_editor.useBlockProps.save({ className: wrapperClasses }), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
325
|
+
import_block_editor.RichText.Content,
|
|
326
|
+
{
|
|
327
|
+
tagName: TagName,
|
|
328
|
+
type: isButtonTag ? buttonType : null,
|
|
329
|
+
className: buttonClasses,
|
|
330
|
+
href: isButtonTag ? null : url,
|
|
331
|
+
title,
|
|
332
|
+
style: buttonStyle,
|
|
333
|
+
value: text,
|
|
334
|
+
target: isButtonTag ? null : linkTarget,
|
|
335
|
+
rel: isButtonTag ? null : rel
|
|
336
|
+
}
|
|
337
|
+
) });
|
|
338
|
+
},
|
|
339
|
+
isEligible(attributes) {
|
|
340
|
+
return typeof attributes.width === "number";
|
|
341
|
+
},
|
|
342
|
+
migrate: migrateWidth
|
|
343
|
+
};
|
|
129
344
|
var v13 = {
|
|
130
345
|
attributes: {
|
|
131
346
|
tagName: {
|
|
@@ -323,9 +538,9 @@ var v13 = {
|
|
|
323
538
|
) });
|
|
324
539
|
},
|
|
325
540
|
isEligible(attributes) {
|
|
326
|
-
return !!attributes.textAlign;
|
|
541
|
+
return !!attributes.textAlign || typeof attributes.width === "number";
|
|
327
542
|
},
|
|
328
|
-
migrate: import_migrate_text_align.default
|
|
543
|
+
migrate: (0, import_compose.compose)(migrateWidth, import_migrate_text_align.default)
|
|
329
544
|
};
|
|
330
545
|
var v12 = {
|
|
331
546
|
attributes: {
|
|
@@ -502,7 +717,11 @@ var v12 = {
|
|
|
502
717
|
rel: isButtonTag ? null : rel
|
|
503
718
|
}
|
|
504
719
|
) });
|
|
505
|
-
}
|
|
720
|
+
},
|
|
721
|
+
isEligible(attributes) {
|
|
722
|
+
return typeof attributes.width === "number";
|
|
723
|
+
},
|
|
724
|
+
migrate: migrateWidth
|
|
506
725
|
};
|
|
507
726
|
var v11 = {
|
|
508
727
|
attributes: {
|
|
@@ -743,12 +962,13 @@ var v10 = {
|
|
|
743
962
|
}
|
|
744
963
|
) });
|
|
745
964
|
},
|
|
746
|
-
migrate: import_migrate_font_family.default,
|
|
747
|
-
isEligible({ style }) {
|
|
748
|
-
return style?.typography?.fontFamily;
|
|
965
|
+
migrate: (0, import_compose.compose)(migrateWidth, import_migrate_font_family.default),
|
|
966
|
+
isEligible({ style, width }) {
|
|
967
|
+
return style?.typography?.fontFamily || typeof width === "number";
|
|
749
968
|
}
|
|
750
969
|
};
|
|
751
970
|
var deprecated = [
|
|
971
|
+
v14,
|
|
752
972
|
v13,
|
|
753
973
|
v12,
|
|
754
974
|
v11,
|
|
@@ -847,7 +1067,11 @@ var deprecated = [
|
|
|
847
1067
|
}
|
|
848
1068
|
) });
|
|
849
1069
|
},
|
|
850
|
-
migrate: (0, import_compose.compose)(
|
|
1070
|
+
migrate: (0, import_compose.compose)(
|
|
1071
|
+
migrateWidth,
|
|
1072
|
+
import_migrate_font_family.default,
|
|
1073
|
+
migrateBorderRadius
|
|
1074
|
+
)
|
|
851
1075
|
},
|
|
852
1076
|
{
|
|
853
1077
|
supports: {
|
|
@@ -927,7 +1151,11 @@ var deprecated = [
|
|
|
927
1151
|
}
|
|
928
1152
|
) });
|
|
929
1153
|
},
|
|
930
|
-
migrate: (0, import_compose.compose)(
|
|
1154
|
+
migrate: (0, import_compose.compose)(
|
|
1155
|
+
migrateWidth,
|
|
1156
|
+
import_migrate_font_family.default,
|
|
1157
|
+
migrateBorderRadius
|
|
1158
|
+
)
|
|
931
1159
|
},
|
|
932
1160
|
{
|
|
933
1161
|
supports: {
|
|
@@ -1007,7 +1235,11 @@ var deprecated = [
|
|
|
1007
1235
|
}
|
|
1008
1236
|
) });
|
|
1009
1237
|
},
|
|
1010
|
-
migrate: (0, import_compose.compose)(
|
|
1238
|
+
migrate: (0, import_compose.compose)(
|
|
1239
|
+
migrateWidth,
|
|
1240
|
+
import_migrate_font_family.default,
|
|
1241
|
+
migrateBorderRadius
|
|
1242
|
+
)
|
|
1011
1243
|
},
|
|
1012
1244
|
{
|
|
1013
1245
|
supports: {
|
|
@@ -1070,7 +1302,7 @@ var deprecated = [
|
|
|
1070
1302
|
}
|
|
1071
1303
|
);
|
|
1072
1304
|
},
|
|
1073
|
-
migrate: migrateBorderRadius
|
|
1305
|
+
migrate: (0, import_compose.compose)(migrateWidth, migrateBorderRadius)
|
|
1074
1306
|
},
|
|
1075
1307
|
{
|
|
1076
1308
|
supports: {
|
|
@@ -1118,6 +1350,7 @@ var deprecated = [
|
|
|
1118
1350
|
},
|
|
1119
1351
|
isEligible: (attributes) => !!attributes.customTextColor || !!attributes.customBackgroundColor || !!attributes.customGradient || !!attributes.align,
|
|
1120
1352
|
migrate: (0, import_compose.compose)(
|
|
1353
|
+
migrateWidth,
|
|
1121
1354
|
migrateBorderRadius,
|
|
1122
1355
|
migrateCustomColorsAndGradients,
|
|
1123
1356
|
migrateAlign
|
|
@@ -1282,7 +1515,7 @@ var deprecated = [
|
|
|
1282
1515
|
type: "string"
|
|
1283
1516
|
}
|
|
1284
1517
|
},
|
|
1285
|
-
migrate: oldColorsMigration,
|
|
1518
|
+
migrate: (0, import_compose.compose)(migrateWidth, oldColorsMigration),
|
|
1286
1519
|
save({ attributes }) {
|
|
1287
1520
|
const {
|
|
1288
1521
|
url,
|
|
@@ -1354,7 +1587,7 @@ var deprecated = [
|
|
|
1354
1587
|
}
|
|
1355
1588
|
) });
|
|
1356
1589
|
},
|
|
1357
|
-
migrate: oldColorsMigration
|
|
1590
|
+
migrate: (0, import_compose.compose)(migrateWidth, oldColorsMigration)
|
|
1358
1591
|
},
|
|
1359
1592
|
{
|
|
1360
1593
|
attributes: {
|
|
@@ -1390,7 +1623,7 @@ var deprecated = [
|
|
|
1390
1623
|
}
|
|
1391
1624
|
);
|
|
1392
1625
|
},
|
|
1393
|
-
migrate: oldColorsMigration
|
|
1626
|
+
migrate: (0, import_compose.compose)(migrateWidth, oldColorsMigration)
|
|
1394
1627
|
}
|
|
1395
1628
|
];
|
|
1396
1629
|
var deprecated_default = deprecated;
|