@wordpress/block-library 9.33.1-next.ff1cebbba.0 → 9.33.1
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 +1 -1
- package/README.md +1 -1
- package/build/breadcrumbs/block.json +8 -2
- package/build/breadcrumbs/edit.js +113 -12
- package/build/breadcrumbs/edit.js.map +2 -2
- package/build/buttons/transforms.js +7 -7
- package/build/buttons/transforms.js.map +2 -2
- package/build/code/transforms.js +19 -15
- package/build/code/transforms.js.map +2 -2
- package/build/heading/index.js +1 -3
- package/build/heading/index.js.map +3 -3
- package/build/heading/transforms.js +22 -20
- package/build/heading/transforms.js.map +2 -2
- package/build/index.js +5 -3
- package/build/index.js.map +2 -2
- package/build/math/block.json +21 -0
- package/build/math/edit.js +132 -0
- package/build/math/edit.js.map +7 -0
- package/build/math/index.js +63 -0
- package/build/math/index.js.map +7 -0
- package/build/math/init.js +35 -0
- package/build/math/init.js.map +7 -0
- package/build/math/save.js +40 -0
- package/build/math/save.js.map +7 -0
- package/build/navigation/edit/menu-inspector-controls.js +3 -3
- package/build/navigation/edit/menu-inspector-controls.js.map +2 -2
- package/build/navigation-link/edit.js +6 -3
- package/build/navigation-link/edit.js.map +2 -2
- package/build/navigation-link/link-ui/index.js +1 -1
- package/build/navigation-link/link-ui/index.js.map +2 -2
- package/build/navigation-link/shared/controls.js +4 -1
- package/build/navigation-link/shared/controls.js.map +3 -3
- package/build/navigation-link/shared/index.js +2 -0
- package/build/navigation-link/shared/index.js.map +2 -2
- package/build/navigation-link/shared/update-attributes.js +3 -1
- package/build/navigation-link/shared/update-attributes.js.map +2 -2
- package/build/navigation-link/shared/use-entity-binding.js +46 -13
- package/build/navigation-link/shared/use-entity-binding.js.map +2 -2
- package/build/navigation-submenu/edit.js +6 -3
- package/build/navigation-submenu/edit.js.map +2 -2
- package/build/page-list/use-convert-to-navigation-links.js +6 -1
- package/build/page-list/use-convert-to-navigation-links.js.map +2 -2
- package/build/paragraph/index.js +1 -3
- package/build/paragraph/index.js.map +3 -3
- package/build/post-date/deprecated.js +98 -2
- package/build/post-date/deprecated.js.map +2 -2
- package/build/post-date/edit.js +1 -1
- package/build/post-date/edit.js.map +1 -1
- package/build/post-date/variations.js +4 -4
- package/build/post-date/variations.js.map +2 -2
- package/build/term-template/block.json +0 -1
- package/build/term-template/edit.js +4 -1
- package/build/term-template/edit.js.map +2 -2
- package/build/terms-query/block.json +0 -1
- package/build/utils/get-transformed-attributes.js +82 -0
- package/build/utils/get-transformed-attributes.js.map +7 -0
- package/build-module/breadcrumbs/block.json +8 -2
- package/build-module/breadcrumbs/edit.js +117 -14
- package/build-module/breadcrumbs/edit.js.map +2 -2
- package/build-module/buttons/transforms.js +7 -7
- package/build-module/buttons/transforms.js.map +2 -2
- package/build-module/code/transforms.js +19 -15
- package/build-module/code/transforms.js.map +2 -2
- package/build-module/heading/index.js +1 -3
- package/build-module/heading/index.js.map +2 -2
- package/build-module/heading/transforms.js +22 -20
- package/build-module/heading/transforms.js.map +2 -2
- package/build-module/index.js +5 -3
- package/build-module/index.js.map +2 -2
- package/build-module/math/block.json +21 -0
- package/build-module/math/edit.js +110 -0
- package/build-module/math/edit.js.map +7 -0
- package/build-module/math/index.js +26 -0
- package/build-module/math/index.js.map +7 -0
- package/build-module/math/init.js +8 -0
- package/build-module/math/init.js.map +7 -0
- package/build-module/math/save.js +20 -0
- package/build-module/math/save.js.map +7 -0
- package/build-module/navigation/edit/menu-inspector-controls.js +3 -3
- package/build-module/navigation/edit/menu-inspector-controls.js.map +2 -2
- package/build-module/navigation-link/edit.js +6 -3
- package/build-module/navigation-link/edit.js.map +2 -2
- package/build-module/navigation-link/link-ui/index.js +1 -1
- package/build-module/navigation-link/link-ui/index.js.map +2 -2
- package/build-module/navigation-link/shared/controls.js +4 -1
- package/build-module/navigation-link/shared/controls.js.map +2 -2
- package/build-module/navigation-link/shared/index.js +5 -1
- package/build-module/navigation-link/shared/index.js.map +2 -2
- package/build-module/navigation-link/shared/update-attributes.js +3 -1
- package/build-module/navigation-link/shared/update-attributes.js.map +2 -2
- package/build-module/navigation-link/shared/use-entity-binding.js +45 -13
- package/build-module/navigation-link/shared/use-entity-binding.js.map +2 -2
- package/build-module/navigation-submenu/edit.js +6 -3
- package/build-module/navigation-submenu/edit.js.map +2 -2
- package/build-module/page-list/use-convert-to-navigation-links.js +6 -1
- package/build-module/page-list/use-convert-to-navigation-links.js.map +2 -2
- package/build-module/paragraph/index.js +1 -3
- package/build-module/paragraph/index.js.map +2 -2
- package/build-module/post-date/deprecated.js +98 -2
- package/build-module/post-date/deprecated.js.map +2 -2
- package/build-module/post-date/edit.js +1 -1
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-date/variations.js +4 -4
- package/build-module/post-date/variations.js.map +2 -2
- package/build-module/term-template/block.json +0 -1
- package/build-module/term-template/edit.js +4 -1
- package/build-module/term-template/edit.js.map +2 -2
- package/build-module/terms-query/block.json +0 -1
- package/build-module/utils/get-transformed-attributes.js +58 -0
- package/build-module/utils/get-transformed-attributes.js.map +7 -0
- package/package.json +61 -36
- package/src/breadcrumbs/block.json +8 -2
- package/src/breadcrumbs/edit.js +163 -18
- package/src/breadcrumbs/index.php +118 -16
- package/src/buttons/transforms.js +6 -6
- package/src/code/transforms.js +16 -14
- package/src/heading/index.js +0 -2
- package/src/heading/transforms.js +25 -24
- package/src/index.js +5 -3
- package/src/math/block.json +21 -0
- package/src/math/edit.js +123 -0
- package/src/math/index.js +31 -0
- package/src/math/init.js +4 -0
- package/src/math/save.js +20 -0
- package/src/navigation/edit/menu-inspector-controls.js +8 -7
- package/src/navigation-link/edit.js +6 -3
- package/src/navigation-link/index.php +4 -18
- package/src/navigation-link/link-ui/index.js +4 -2
- package/src/navigation-link/shared/controls.js +12 -3
- package/src/navigation-link/shared/index.js +4 -1
- package/src/navigation-link/shared/test/update-attributes.test.js +8 -0
- package/src/navigation-link/shared/test/use-entity-binding.js +132 -17
- package/src/navigation-link/shared/update-attributes.js +1 -0
- package/src/navigation-link/shared/use-entity-binding.js +74 -19
- package/src/navigation-submenu/edit.js +6 -3
- package/src/navigation-submenu/index.php +3 -17
- package/src/page-list/test/{convert-to-links-modal.js → convert-to-navigation-links.js} +67 -0
- package/src/page-list/use-convert-to-navigation-links.js +11 -1
- package/src/paragraph/index.js +0 -2
- package/src/post-date/deprecated.js +100 -2
- package/src/post-date/edit.js +1 -1
- package/src/post-date/index.php +3 -3
- package/src/post-date/variations.js +5 -4
- package/src/term-template/block.json +0 -1
- package/src/term-template/edit.js +4 -1
- package/src/term-template/index.php +4 -6
- package/src/terms-query/block.json +0 -1
- package/src/utils/get-transformed-attributes.js +98 -0
- package/tsconfig.json +1 -0
- package/build/heading/variations.js +0 -48
- package/build/heading/variations.js.map +0 -7
- package/build/paragraph/variations.js +0 -48
- package/build/paragraph/variations.js.map +0 -7
- package/build/utils/get-transformed-metadata.js +0 -65
- package/build/utils/get-transformed-metadata.js.map +0 -7
- package/build-module/heading/variations.js +0 -28
- package/build-module/heading/variations.js.map +0 -7
- package/build-module/paragraph/variations.js +0 -28
- package/build-module/paragraph/variations.js.map +0 -7
- package/build-module/utils/get-transformed-metadata.js +0 -41
- package/build-module/utils/get-transformed-metadata.js.map +0 -7
- package/src/heading/variations.js +0 -29
- package/src/paragraph/variations.js +0 -29
- package/src/utils/get-transformed-metadata.js +0 -69
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { getBlockType } from "@wordpress/blocks";
|
|
2
|
-
function getTransformedMetadata(metadata, newBlockName, bindingsCallback) {
|
|
3
|
-
if (!metadata) {
|
|
4
|
-
return;
|
|
5
|
-
}
|
|
6
|
-
const { supports } = getBlockType(newBlockName);
|
|
7
|
-
const BLOCK_BINDINGS_SUPPORTED_BLOCKS = [
|
|
8
|
-
"core/paragraph",
|
|
9
|
-
"core/heading",
|
|
10
|
-
"core/image",
|
|
11
|
-
"core/button"
|
|
12
|
-
];
|
|
13
|
-
const transformSupportedProps = ["commentId"];
|
|
14
|
-
if (BLOCK_BINDINGS_SUPPORTED_BLOCKS.includes(newBlockName) && bindingsCallback) {
|
|
15
|
-
transformSupportedProps.push("id", "bindings");
|
|
16
|
-
}
|
|
17
|
-
if (supports.renaming !== false) {
|
|
18
|
-
transformSupportedProps.push("name");
|
|
19
|
-
}
|
|
20
|
-
if (supports.blockVisibility !== false) {
|
|
21
|
-
transformSupportedProps.push("blockVisibility");
|
|
22
|
-
}
|
|
23
|
-
if (!transformSupportedProps.length) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const newMetadata = Object.entries(metadata).reduce(
|
|
27
|
-
(obj, [prop, value]) => {
|
|
28
|
-
if (!transformSupportedProps.includes(prop)) {
|
|
29
|
-
return obj;
|
|
30
|
-
}
|
|
31
|
-
obj[prop] = prop === "bindings" ? bindingsCallback(value) : value;
|
|
32
|
-
return obj;
|
|
33
|
-
},
|
|
34
|
-
{}
|
|
35
|
-
);
|
|
36
|
-
return Object.keys(newMetadata).length ? newMetadata : void 0;
|
|
37
|
-
}
|
|
38
|
-
export {
|
|
39
|
-
getTransformedMetadata
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=get-transformed-metadata.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/get-transformed-metadata.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Transform the metadata attribute with only the values and bindings specified by each transform.\n * Returns `undefined` if the input metadata is falsy.\n *\n * @param {Object} metadata Original metadata attribute from the block that is being transformed.\n * @param {Object} newBlockName Name of the final block after the transformation.\n * @param {Function} bindingsCallback Optional callback to transform the `bindings` property object.\n * @return {Object|undefined} New metadata object only with the relevant properties.\n */\nexport function getTransformedMetadata(\n\tmetadata,\n\tnewBlockName,\n\tbindingsCallback\n) {\n\tif ( ! metadata ) {\n\t\treturn;\n\t}\n\tconst { supports } = getBlockType( newBlockName );\n\t// Fixed until an opt-in mechanism is implemented.\n\tconst BLOCK_BINDINGS_SUPPORTED_BLOCKS = [\n\t\t'core/paragraph',\n\t\t'core/heading',\n\t\t'core/image',\n\t\t'core/button',\n\t];\n\t// The metadata properties that should be preserved after the transform.\n\tconst transformSupportedProps = [ 'commentId' ];\n\t// If it support bindings, and there is a transform bindings callback, add the `id` and `bindings` properties.\n\tif (\n\t\tBLOCK_BINDINGS_SUPPORTED_BLOCKS.includes( newBlockName ) &&\n\t\tbindingsCallback\n\t) {\n\t\ttransformSupportedProps.push( 'id', 'bindings' );\n\t}\n\t// If it support block naming (true by default), add the `name` property.\n\tif ( supports.renaming !== false ) {\n\t\ttransformSupportedProps.push( 'name' );\n\t}\n\t// If it supports block visibility (true by default), add the `blockVisibility` property.\n\tif ( supports.blockVisibility !== false ) {\n\t\ttransformSupportedProps.push( 'blockVisibility' );\n\t}\n\n\t// Return early if no supported properties.\n\tif ( ! transformSupportedProps.length ) {\n\t\treturn;\n\t}\n\n\tconst newMetadata = Object.entries( metadata ).reduce(\n\t\t( obj, [ prop, value ] ) => {\n\t\t\t// If prop is not supported, don't add it to the new metadata object.\n\t\t\tif ( ! transformSupportedProps.includes( prop ) ) {\n\t\t\t\treturn obj;\n\t\t\t}\n\t\t\tobj[ prop ] =\n\t\t\t\tprop === 'bindings' ? bindingsCallback( value ) : value;\n\t\t\treturn obj;\n\t\t},\n\t\t{}\n\t);\n\n\t// Return undefined if object is empty.\n\treturn Object.keys( newMetadata ).length ? newMetadata : undefined;\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,oBAAoB;AAWtB,SAAS,uBACf,UACA,cACA,kBACC;AACD,MAAK,CAAE,UAAW;AACjB;AAAA,EACD;AACA,QAAM,EAAE,SAAS,IAAI,aAAc,YAAa;AAEhD,QAAM,kCAAkC;AAAA,IACvC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,QAAM,0BAA0B,CAAE,WAAY;AAE9C,MACC,gCAAgC,SAAU,YAAa,KACvD,kBACC;AACD,4BAAwB,KAAM,MAAM,UAAW;AAAA,EAChD;AAEA,MAAK,SAAS,aAAa,OAAQ;AAClC,4BAAwB,KAAM,MAAO;AAAA,EACtC;AAEA,MAAK,SAAS,oBAAoB,OAAQ;AACzC,4BAAwB,KAAM,iBAAkB;AAAA,EACjD;AAGA,MAAK,CAAE,wBAAwB,QAAS;AACvC;AAAA,EACD;AAEA,QAAM,cAAc,OAAO,QAAS,QAAS,EAAE;AAAA,IAC9C,CAAE,KAAK,CAAE,MAAM,KAAM,MAAO;AAE3B,UAAK,CAAE,wBAAwB,SAAU,IAAK,GAAI;AACjD,eAAO;AAAA,MACR;AACA,UAAK,IAAK,IACT,SAAS,aAAa,iBAAkB,KAAM,IAAI;AACnD,aAAO;AAAA,IACR;AAAA,IACA,CAAC;AAAA,EACF;AAGA,SAAO,OAAO,KAAM,WAAY,EAAE,SAAS,cAAc;AAC1D;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { textColor } from '@wordpress/icons';
|
|
6
|
-
|
|
7
|
-
const variations = [
|
|
8
|
-
{
|
|
9
|
-
name: 'Stretchy Heading',
|
|
10
|
-
title: __( 'Stretchy Heading' ),
|
|
11
|
-
description: __(
|
|
12
|
-
'Heading text automatically resizes to fit the container width.'
|
|
13
|
-
),
|
|
14
|
-
attributes: { fitText: true },
|
|
15
|
-
scope: [ 'inserter' ],
|
|
16
|
-
isActive: ( blockAttributes ) => blockAttributes.fitText,
|
|
17
|
-
icon: textColor,
|
|
18
|
-
example: {
|
|
19
|
-
attributes: {
|
|
20
|
-
content: __(
|
|
21
|
-
'This heading will automatically resize to fit its container width.'
|
|
22
|
-
),
|
|
23
|
-
fitText: true,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
export default variations;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { textColor } from '@wordpress/icons';
|
|
6
|
-
|
|
7
|
-
const variations = [
|
|
8
|
-
{
|
|
9
|
-
name: 'Stretchy Paragraph',
|
|
10
|
-
title: __( 'Stretchy Paragraph' ),
|
|
11
|
-
description: __(
|
|
12
|
-
'Text automatically resizes to fit the container width.'
|
|
13
|
-
),
|
|
14
|
-
attributes: { fitText: true },
|
|
15
|
-
scope: [ 'inserter' ],
|
|
16
|
-
isActive: ( blockAttributes ) => blockAttributes.fitText,
|
|
17
|
-
icon: textColor,
|
|
18
|
-
example: {
|
|
19
|
-
attributes: {
|
|
20
|
-
content: __(
|
|
21
|
-
'This text will automatically resize to fit its container width.'
|
|
22
|
-
),
|
|
23
|
-
fitText: true,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
export default variations;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { getBlockType } from '@wordpress/blocks';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Transform the metadata attribute with only the values and bindings specified by each transform.
|
|
8
|
-
* Returns `undefined` if the input metadata is falsy.
|
|
9
|
-
*
|
|
10
|
-
* @param {Object} metadata Original metadata attribute from the block that is being transformed.
|
|
11
|
-
* @param {Object} newBlockName Name of the final block after the transformation.
|
|
12
|
-
* @param {Function} bindingsCallback Optional callback to transform the `bindings` property object.
|
|
13
|
-
* @return {Object|undefined} New metadata object only with the relevant properties.
|
|
14
|
-
*/
|
|
15
|
-
export function getTransformedMetadata(
|
|
16
|
-
metadata,
|
|
17
|
-
newBlockName,
|
|
18
|
-
bindingsCallback
|
|
19
|
-
) {
|
|
20
|
-
if ( ! metadata ) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const { supports } = getBlockType( newBlockName );
|
|
24
|
-
// Fixed until an opt-in mechanism is implemented.
|
|
25
|
-
const BLOCK_BINDINGS_SUPPORTED_BLOCKS = [
|
|
26
|
-
'core/paragraph',
|
|
27
|
-
'core/heading',
|
|
28
|
-
'core/image',
|
|
29
|
-
'core/button',
|
|
30
|
-
];
|
|
31
|
-
// The metadata properties that should be preserved after the transform.
|
|
32
|
-
const transformSupportedProps = [ 'commentId' ];
|
|
33
|
-
// If it support bindings, and there is a transform bindings callback, add the `id` and `bindings` properties.
|
|
34
|
-
if (
|
|
35
|
-
BLOCK_BINDINGS_SUPPORTED_BLOCKS.includes( newBlockName ) &&
|
|
36
|
-
bindingsCallback
|
|
37
|
-
) {
|
|
38
|
-
transformSupportedProps.push( 'id', 'bindings' );
|
|
39
|
-
}
|
|
40
|
-
// If it support block naming (true by default), add the `name` property.
|
|
41
|
-
if ( supports.renaming !== false ) {
|
|
42
|
-
transformSupportedProps.push( 'name' );
|
|
43
|
-
}
|
|
44
|
-
// If it supports block visibility (true by default), add the `blockVisibility` property.
|
|
45
|
-
if ( supports.blockVisibility !== false ) {
|
|
46
|
-
transformSupportedProps.push( 'blockVisibility' );
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Return early if no supported properties.
|
|
50
|
-
if ( ! transformSupportedProps.length ) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const newMetadata = Object.entries( metadata ).reduce(
|
|
55
|
-
( obj, [ prop, value ] ) => {
|
|
56
|
-
// If prop is not supported, don't add it to the new metadata object.
|
|
57
|
-
if ( ! transformSupportedProps.includes( prop ) ) {
|
|
58
|
-
return obj;
|
|
59
|
-
}
|
|
60
|
-
obj[ prop ] =
|
|
61
|
-
prop === 'bindings' ? bindingsCallback( value ) : value;
|
|
62
|
-
return obj;
|
|
63
|
-
},
|
|
64
|
-
{}
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
// Return undefined if object is empty.
|
|
68
|
-
return Object.keys( newMetadata ).length ? newMetadata : undefined;
|
|
69
|
-
}
|