@wordpress/block-library 9.33.1-next.ff1cebbba.0 → 9.33.2-next.36001005c.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 (173) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +1 -1
  3. package/build/breadcrumbs/block.json +8 -2
  4. package/build/breadcrumbs/edit.js +113 -12
  5. package/build/breadcrumbs/edit.js.map +2 -2
  6. package/build/buttons/transforms.js +7 -7
  7. package/build/buttons/transforms.js.map +2 -2
  8. package/build/code/transforms.js +19 -15
  9. package/build/code/transforms.js.map +2 -2
  10. package/build/heading/index.js +1 -3
  11. package/build/heading/index.js.map +3 -3
  12. package/build/heading/transforms.js +22 -20
  13. package/build/heading/transforms.js.map +2 -2
  14. package/build/index.js +5 -3
  15. package/build/index.js.map +2 -2
  16. package/build/math/block.json +21 -0
  17. package/build/math/edit.js +132 -0
  18. package/build/math/edit.js.map +7 -0
  19. package/build/math/index.js +63 -0
  20. package/build/math/index.js.map +7 -0
  21. package/build/math/init.js +35 -0
  22. package/build/math/init.js.map +7 -0
  23. package/build/math/save.js +40 -0
  24. package/build/math/save.js.map +7 -0
  25. package/build/navigation/edit/menu-inspector-controls.js +2 -2
  26. package/build/navigation/edit/menu-inspector-controls.js.map +2 -2
  27. package/build/navigation-link/edit.js +5 -2
  28. package/build/navigation-link/edit.js.map +2 -2
  29. package/build/navigation-link/link-ui/index.js +1 -1
  30. package/build/navigation-link/link-ui/index.js.map +2 -2
  31. package/build/navigation-link/shared/controls.js +39 -16
  32. package/build/navigation-link/shared/controls.js.map +3 -3
  33. package/build/navigation-link/shared/index.js +2 -0
  34. package/build/navigation-link/shared/index.js.map +2 -2
  35. package/build/navigation-link/shared/update-attributes.js +3 -1
  36. package/build/navigation-link/shared/update-attributes.js.map +2 -2
  37. package/build/navigation-link/shared/use-entity-binding.js +46 -13
  38. package/build/navigation-link/shared/use-entity-binding.js.map +2 -2
  39. package/build/navigation-submenu/edit.js +5 -2
  40. package/build/navigation-submenu/edit.js.map +2 -2
  41. package/build/page-list/use-convert-to-navigation-links.js +6 -1
  42. package/build/page-list/use-convert-to-navigation-links.js.map +2 -2
  43. package/build/paragraph/index.js +1 -3
  44. package/build/paragraph/index.js.map +3 -3
  45. package/build/post-date/deprecated.js +98 -2
  46. package/build/post-date/deprecated.js.map +2 -2
  47. package/build/post-date/edit.js +1 -1
  48. package/build/post-date/edit.js.map +1 -1
  49. package/build/post-date/variations.js +4 -4
  50. package/build/post-date/variations.js.map +2 -2
  51. package/build/term-template/block.json +0 -1
  52. package/build/term-template/edit.js +4 -1
  53. package/build/term-template/edit.js.map +2 -2
  54. package/build/terms-query/block.json +0 -1
  55. package/build/utils/get-transformed-attributes.js +82 -0
  56. package/build/utils/get-transformed-attributes.js.map +7 -0
  57. package/build-module/breadcrumbs/block.json +8 -2
  58. package/build-module/breadcrumbs/edit.js +117 -14
  59. package/build-module/breadcrumbs/edit.js.map +2 -2
  60. package/build-module/buttons/transforms.js +7 -7
  61. package/build-module/buttons/transforms.js.map +2 -2
  62. package/build-module/code/transforms.js +19 -15
  63. package/build-module/code/transforms.js.map +2 -2
  64. package/build-module/heading/index.js +1 -3
  65. package/build-module/heading/index.js.map +2 -2
  66. package/build-module/heading/transforms.js +22 -20
  67. package/build-module/heading/transforms.js.map +2 -2
  68. package/build-module/index.js +5 -3
  69. package/build-module/index.js.map +2 -2
  70. package/build-module/math/block.json +21 -0
  71. package/build-module/math/edit.js +110 -0
  72. package/build-module/math/edit.js.map +7 -0
  73. package/build-module/math/index.js +26 -0
  74. package/build-module/math/index.js.map +7 -0
  75. package/build-module/math/init.js +8 -0
  76. package/build-module/math/init.js.map +7 -0
  77. package/build-module/math/save.js +20 -0
  78. package/build-module/math/save.js.map +7 -0
  79. package/build-module/navigation/edit/menu-inspector-controls.js +2 -2
  80. package/build-module/navigation/edit/menu-inspector-controls.js.map +2 -2
  81. package/build-module/navigation-link/edit.js +5 -2
  82. package/build-module/navigation-link/edit.js.map +2 -2
  83. package/build-module/navigation-link/link-ui/index.js +1 -1
  84. package/build-module/navigation-link/link-ui/index.js.map +2 -2
  85. package/build-module/navigation-link/shared/controls.js +40 -17
  86. package/build-module/navigation-link/shared/controls.js.map +2 -2
  87. package/build-module/navigation-link/shared/index.js +5 -1
  88. package/build-module/navigation-link/shared/index.js.map +2 -2
  89. package/build-module/navigation-link/shared/update-attributes.js +3 -1
  90. package/build-module/navigation-link/shared/update-attributes.js.map +2 -2
  91. package/build-module/navigation-link/shared/use-entity-binding.js +45 -13
  92. package/build-module/navigation-link/shared/use-entity-binding.js.map +2 -2
  93. package/build-module/navigation-submenu/edit.js +5 -2
  94. package/build-module/navigation-submenu/edit.js.map +2 -2
  95. package/build-module/page-list/use-convert-to-navigation-links.js +6 -1
  96. package/build-module/page-list/use-convert-to-navigation-links.js.map +2 -2
  97. package/build-module/paragraph/index.js +1 -3
  98. package/build-module/paragraph/index.js.map +2 -2
  99. package/build-module/post-date/deprecated.js +98 -2
  100. package/build-module/post-date/deprecated.js.map +2 -2
  101. package/build-module/post-date/edit.js +1 -1
  102. package/build-module/post-date/edit.js.map +1 -1
  103. package/build-module/post-date/variations.js +4 -4
  104. package/build-module/post-date/variations.js.map +2 -2
  105. package/build-module/term-template/block.json +0 -1
  106. package/build-module/term-template/edit.js +4 -1
  107. package/build-module/term-template/edit.js.map +2 -2
  108. package/build-module/terms-query/block.json +0 -1
  109. package/build-module/utils/get-transformed-attributes.js +58 -0
  110. package/build-module/utils/get-transformed-attributes.js.map +7 -0
  111. package/build-style/editor-rtl.css +2 -2
  112. package/build-style/editor.css +2 -2
  113. package/build-style/navigation-link/editor-rtl.css +1 -1
  114. package/build-style/navigation-link/editor.css +1 -1
  115. package/build-style/video/editor-rtl.css +1 -1
  116. package/build-style/video/editor.css +1 -1
  117. package/package.json +61 -36
  118. package/src/breadcrumbs/block.json +8 -2
  119. package/src/breadcrumbs/edit.js +163 -18
  120. package/src/breadcrumbs/index.php +118 -16
  121. package/src/buttons/transforms.js +6 -6
  122. package/src/code/transforms.js +16 -14
  123. package/src/heading/index.js +0 -2
  124. package/src/heading/transforms.js +25 -24
  125. package/src/index.js +5 -3
  126. package/src/math/block.json +21 -0
  127. package/src/math/edit.js +123 -0
  128. package/src/math/index.js +31 -0
  129. package/src/math/init.js +4 -0
  130. package/src/math/save.js +20 -0
  131. package/src/navigation/edit/menu-inspector-controls.js +7 -6
  132. package/src/navigation-link/edit.js +5 -2
  133. package/src/navigation-link/editor.scss +1 -1
  134. package/src/navigation-link/index.php +4 -18
  135. package/src/navigation-link/link-ui/index.js +4 -2
  136. package/src/navigation-link/shared/controls.js +69 -20
  137. package/src/navigation-link/shared/index.js +4 -1
  138. package/src/navigation-link/shared/test/controls.js +14 -9
  139. package/src/navigation-link/shared/test/update-attributes.test.js +8 -0
  140. package/src/navigation-link/shared/test/use-entity-binding.js +132 -17
  141. package/src/navigation-link/shared/update-attributes.js +1 -0
  142. package/src/navigation-link/shared/use-entity-binding.js +74 -19
  143. package/src/navigation-submenu/edit.js +5 -2
  144. package/src/navigation-submenu/index.php +3 -17
  145. package/src/page-list/test/{convert-to-links-modal.js → convert-to-navigation-links.js} +67 -0
  146. package/src/page-list/use-convert-to-navigation-links.js +11 -1
  147. package/src/paragraph/index.js +0 -2
  148. package/src/post-date/deprecated.js +104 -2
  149. package/src/post-date/edit.js +1 -1
  150. package/src/post-date/index.php +3 -3
  151. package/src/post-date/variations.js +5 -4
  152. package/src/term-template/block.json +0 -1
  153. package/src/term-template/edit.js +4 -1
  154. package/src/term-template/index.php +4 -6
  155. package/src/terms-query/block.json +0 -1
  156. package/src/utils/get-transformed-attributes.js +98 -0
  157. package/src/video/editor.scss +1 -1
  158. package/tsconfig.json +1 -0
  159. package/build/heading/variations.js +0 -48
  160. package/build/heading/variations.js.map +0 -7
  161. package/build/paragraph/variations.js +0 -48
  162. package/build/paragraph/variations.js.map +0 -7
  163. package/build/utils/get-transformed-metadata.js +0 -65
  164. package/build/utils/get-transformed-metadata.js.map +0 -7
  165. package/build-module/heading/variations.js +0 -28
  166. package/build-module/heading/variations.js.map +0 -7
  167. package/build-module/paragraph/variations.js +0 -28
  168. package/build-module/paragraph/variations.js.map +0 -7
  169. package/build-module/utils/get-transformed-metadata.js +0 -41
  170. package/build-module/utils/get-transformed-metadata.js.map +0 -7
  171. package/src/heading/variations.js +0 -29
  172. package/src/paragraph/variations.js +0 -29
  173. package/src/utils/get-transformed-metadata.js +0 -69
@@ -0,0 +1,98 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { getBlockType, hasBlockSupport } from '@wordpress/blocks';
5
+
6
+ /**
7
+ * Transform block support attributes and metadata during block transforms.
8
+ *
9
+ * @param {Object} attributes Original attributes from the block being transformed.
10
+ * @param {string} newBlockName Name of the target block after transformation.
11
+ * @param {Function} bindingsCallback Optional callback to transform the `bindings` property object.
12
+ * @return {Object} New attributes object with preserved block support attributes and metadata.
13
+ */
14
+ export function getTransformedAttributes(
15
+ attributes,
16
+ newBlockName,
17
+ bindingsCallback = null
18
+ ) {
19
+ if ( ! attributes ) {
20
+ return undefined;
21
+ }
22
+
23
+ const newBlockType = getBlockType( newBlockName );
24
+ if ( ! newBlockType ) {
25
+ return undefined;
26
+ }
27
+
28
+ const transformedAttributes = {};
29
+
30
+ // Handle attributes derived from block support.
31
+ if (
32
+ hasBlockSupport( newBlockType, 'allowedBlocks' ) &&
33
+ attributes.allowedBlocks
34
+ ) {
35
+ transformedAttributes.allowedBlocks = attributes.allowedBlocks;
36
+ }
37
+ if ( hasBlockSupport( newBlockType, 'anchor' ) && attributes.anchor ) {
38
+ transformedAttributes.anchor = attributes.anchor;
39
+ }
40
+ if (
41
+ hasBlockSupport( newBlockType, 'ariaLabel' ) &&
42
+ attributes.ariaLabel
43
+ ) {
44
+ transformedAttributes.ariaLabel = attributes.ariaLabel;
45
+ }
46
+ if (
47
+ hasBlockSupport( newBlockType, 'className' ) &&
48
+ attributes.className
49
+ ) {
50
+ transformedAttributes.className = attributes.className;
51
+ }
52
+
53
+ // Handle metadata transformation.
54
+ if ( attributes.metadata ) {
55
+ // The metadata properties that should be preserved after the transform.
56
+ const transformedMetadata = [ 'noteId' ];
57
+
58
+ // If there is a transform bindings callback, add the `id` and `bindings` properties.
59
+ if ( bindingsCallback ) {
60
+ transformedMetadata.push( 'id', 'bindings' );
61
+ }
62
+
63
+ // Handle metadata properties derived from block support.
64
+ if ( hasBlockSupport( newBlockType, 'renaming', true ) ) {
65
+ transformedMetadata.push( 'name' );
66
+ }
67
+ if ( hasBlockSupport( newBlockType, 'blockVisibility', true ) ) {
68
+ transformedMetadata.push( 'blockVisibility' );
69
+ }
70
+
71
+ // Only process metadata if there are supported properties.
72
+ if ( transformedMetadata.length > 0 ) {
73
+ const newMetadata = Object.entries( attributes.metadata ).reduce(
74
+ ( obj, [ prop, value ] ) => {
75
+ // If prop is not supported, don't add it to the new metadata object.
76
+ if ( ! transformedMetadata.includes( prop ) ) {
77
+ return obj;
78
+ }
79
+ obj[ prop ] =
80
+ prop === 'bindings' ? bindingsCallback( value ) : value;
81
+ return obj;
82
+ },
83
+ {}
84
+ );
85
+
86
+ // Only add metadata if object is not empty.
87
+ if ( Object.keys( newMetadata ).length > 0 ) {
88
+ transformedAttributes.metadata = newMetadata;
89
+ }
90
+ }
91
+ }
92
+
93
+ if ( Object.keys( transformedAttributes ).length === 0 ) {
94
+ return undefined;
95
+ }
96
+
97
+ return transformedAttributes;
98
+ }
@@ -41,7 +41,7 @@
41
41
  color: $gray-700;
42
42
  text-transform: uppercase;
43
43
  font-size: 11px;
44
- font-weight: 500;
44
+ font-weight: $font-weight-medium;
45
45
  display: block;
46
46
  }
47
47
 
package/tsconfig.json CHANGED
@@ -27,6 +27,7 @@
27
27
  { "path": "../icons" },
28
28
  { "path": "../interactivity" },
29
29
  { "path": "../interactivity-router" },
30
+ { "path": "../latex-to-mathml" },
30
31
  { "path": "../notices" },
31
32
  { "path": "../keycodes" },
32
33
  { "path": "../primitives" },
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var variations_exports = {};
20
- __export(variations_exports, {
21
- default: () => variations_default
22
- });
23
- module.exports = __toCommonJS(variations_exports);
24
- var import_i18n = require("@wordpress/i18n");
25
- var import_icons = require("@wordpress/icons");
26
- const variations = [
27
- {
28
- name: "Stretchy Heading",
29
- title: (0, import_i18n.__)("Stretchy Heading"),
30
- description: (0, import_i18n.__)(
31
- "Heading text automatically resizes to fit the container width."
32
- ),
33
- attributes: { fitText: true },
34
- scope: ["inserter"],
35
- isActive: (blockAttributes) => blockAttributes.fitText,
36
- icon: import_icons.textColor,
37
- example: {
38
- attributes: {
39
- content: (0, import_i18n.__)(
40
- "This heading will automatically resize to fit its container width."
41
- ),
42
- fitText: true
43
- }
44
- }
45
- }
46
- ];
47
- var variations_default = variations;
48
- //# sourceMappingURL=variations.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/heading/variations.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { textColor } from '@wordpress/icons';\n\nconst variations = [\n\t{\n\t\tname: 'Stretchy Heading',\n\t\ttitle: __( 'Stretchy Heading' ),\n\t\tdescription: __(\n\t\t\t'Heading text automatically resizes to fit the container width.'\n\t\t),\n\t\tattributes: { fitText: true },\n\t\tscope: [ 'inserter' ],\n\t\tisActive: ( blockAttributes ) => blockAttributes.fitText,\n\t\ticon: textColor,\n\t\texample: {\n\t\t\tattributes: {\n\t\t\t\tcontent: __(\n\t\t\t\t\t'This heading will automatically resize to fit its container width.'\n\t\t\t\t),\n\t\t\t\tfitText: true,\n\t\t\t},\n\t\t},\n\t},\n];\n\nexport default variations;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAA0B;AAE1B,MAAM,aAAa;AAAA,EAClB;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,kBAAmB;AAAA,IAC9B,iBAAa;AAAA,MACZ;AAAA,IACD;AAAA,IACA,YAAY,EAAE,SAAS,KAAK;AAAA,IAC5B,OAAO,CAAE,UAAW;AAAA,IACpB,UAAU,CAAE,oBAAqB,gBAAgB;AAAA,IACjD,MAAM;AAAA,IACN,SAAS;AAAA,MACR,YAAY;AAAA,QACX,aAAS;AAAA,UACR;AAAA,QACD;AAAA,QACA,SAAS;AAAA,MACV;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ;",
6
- "names": []
7
- }
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var variations_exports = {};
20
- __export(variations_exports, {
21
- default: () => variations_default
22
- });
23
- module.exports = __toCommonJS(variations_exports);
24
- var import_i18n = require("@wordpress/i18n");
25
- var import_icons = require("@wordpress/icons");
26
- const variations = [
27
- {
28
- name: "Stretchy Paragraph",
29
- title: (0, import_i18n.__)("Stretchy Paragraph"),
30
- description: (0, import_i18n.__)(
31
- "Text automatically resizes to fit the container width."
32
- ),
33
- attributes: { fitText: true },
34
- scope: ["inserter"],
35
- isActive: (blockAttributes) => blockAttributes.fitText,
36
- icon: import_icons.textColor,
37
- example: {
38
- attributes: {
39
- content: (0, import_i18n.__)(
40
- "This text will automatically resize to fit its container width."
41
- ),
42
- fitText: true
43
- }
44
- }
45
- }
46
- ];
47
- var variations_default = variations;
48
- //# sourceMappingURL=variations.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/paragraph/variations.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { textColor } from '@wordpress/icons';\n\nconst variations = [\n\t{\n\t\tname: 'Stretchy Paragraph',\n\t\ttitle: __( 'Stretchy Paragraph' ),\n\t\tdescription: __(\n\t\t\t'Text automatically resizes to fit the container width.'\n\t\t),\n\t\tattributes: { fitText: true },\n\t\tscope: [ 'inserter' ],\n\t\tisActive: ( blockAttributes ) => blockAttributes.fitText,\n\t\ticon: textColor,\n\t\texample: {\n\t\t\tattributes: {\n\t\t\t\tcontent: __(\n\t\t\t\t\t'This text will automatically resize to fit its container width.'\n\t\t\t\t),\n\t\t\t\tfitText: true,\n\t\t\t},\n\t\t},\n\t},\n];\n\nexport default variations;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAA0B;AAE1B,MAAM,aAAa;AAAA,EAClB;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,oBAAqB;AAAA,IAChC,iBAAa;AAAA,MACZ;AAAA,IACD;AAAA,IACA,YAAY,EAAE,SAAS,KAAK;AAAA,IAC5B,OAAO,CAAE,UAAW;AAAA,IACpB,UAAU,CAAE,oBAAqB,gBAAgB;AAAA,IACjD,MAAM;AAAA,IACN,SAAS;AAAA,MACR,YAAY;AAAA,QACX,aAAS;AAAA,UACR;AAAA,QACD;AAAA,QACA,SAAS;AAAA,MACV;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ;",
6
- "names": []
7
- }
@@ -1,65 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var get_transformed_metadata_exports = {};
20
- __export(get_transformed_metadata_exports, {
21
- getTransformedMetadata: () => getTransformedMetadata
22
- });
23
- module.exports = __toCommonJS(get_transformed_metadata_exports);
24
- var import_blocks = require("@wordpress/blocks");
25
- function getTransformedMetadata(metadata, newBlockName, bindingsCallback) {
26
- if (!metadata) {
27
- return;
28
- }
29
- const { supports } = (0, import_blocks.getBlockType)(newBlockName);
30
- const BLOCK_BINDINGS_SUPPORTED_BLOCKS = [
31
- "core/paragraph",
32
- "core/heading",
33
- "core/image",
34
- "core/button"
35
- ];
36
- const transformSupportedProps = ["commentId"];
37
- if (BLOCK_BINDINGS_SUPPORTED_BLOCKS.includes(newBlockName) && bindingsCallback) {
38
- transformSupportedProps.push("id", "bindings");
39
- }
40
- if (supports.renaming !== false) {
41
- transformSupportedProps.push("name");
42
- }
43
- if (supports.blockVisibility !== false) {
44
- transformSupportedProps.push("blockVisibility");
45
- }
46
- if (!transformSupportedProps.length) {
47
- return;
48
- }
49
- const newMetadata = Object.entries(metadata).reduce(
50
- (obj, [prop, value]) => {
51
- if (!transformSupportedProps.includes(prop)) {
52
- return obj;
53
- }
54
- obj[prop] = prop === "bindings" ? bindingsCallback(value) : value;
55
- return obj;
56
- },
57
- {}
58
- );
59
- return Object.keys(newMetadata).length ? newMetadata : void 0;
60
- }
61
- // Annotate the CommonJS export names for ESM import in node:
62
- 0 && (module.exports = {
63
- getTransformedMetadata
64
- });
65
- //# 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": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAA6B;AAWtB,SAAS,uBACf,UACA,cACA,kBACC;AACD,MAAK,CAAE,UAAW;AACjB;AAAA,EACD;AACA,QAAM,EAAE,SAAS,QAAI,4BAAc,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,28 +0,0 @@
1
- import { __ } from "@wordpress/i18n";
2
- import { textColor } from "@wordpress/icons";
3
- const variations = [
4
- {
5
- name: "Stretchy Heading",
6
- title: __("Stretchy Heading"),
7
- description: __(
8
- "Heading text automatically resizes to fit the container width."
9
- ),
10
- attributes: { fitText: true },
11
- scope: ["inserter"],
12
- isActive: (blockAttributes) => blockAttributes.fitText,
13
- icon: textColor,
14
- example: {
15
- attributes: {
16
- content: __(
17
- "This heading will automatically resize to fit its container width."
18
- ),
19
- fitText: true
20
- }
21
- }
22
- }
23
- ];
24
- var variations_default = variations;
25
- export {
26
- variations_default as default
27
- };
28
- //# sourceMappingURL=variations.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/heading/variations.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { textColor } from '@wordpress/icons';\n\nconst variations = [\n\t{\n\t\tname: 'Stretchy Heading',\n\t\ttitle: __( 'Stretchy Heading' ),\n\t\tdescription: __(\n\t\t\t'Heading text automatically resizes to fit the container width.'\n\t\t),\n\t\tattributes: { fitText: true },\n\t\tscope: [ 'inserter' ],\n\t\tisActive: ( blockAttributes ) => blockAttributes.fitText,\n\t\ticon: textColor,\n\t\texample: {\n\t\t\tattributes: {\n\t\t\t\tcontent: __(\n\t\t\t\t\t'This heading will automatically resize to fit its container width.'\n\t\t\t\t),\n\t\t\t\tfitText: true,\n\t\t\t},\n\t\t},\n\t},\n];\n\nexport default variations;\n"],
5
- "mappings": "AAGA,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAE1B,MAAM,aAAa;AAAA,EAClB;AAAA,IACC,MAAM;AAAA,IACN,OAAO,GAAI,kBAAmB;AAAA,IAC9B,aAAa;AAAA,MACZ;AAAA,IACD;AAAA,IACA,YAAY,EAAE,SAAS,KAAK;AAAA,IAC5B,OAAO,CAAE,UAAW;AAAA,IACpB,UAAU,CAAE,oBAAqB,gBAAgB;AAAA,IACjD,MAAM;AAAA,IACN,SAAS;AAAA,MACR,YAAY;AAAA,QACX,SAAS;AAAA,UACR;AAAA,QACD;AAAA,QACA,SAAS;AAAA,MACV;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ;",
6
- "names": []
7
- }
@@ -1,28 +0,0 @@
1
- import { __ } from "@wordpress/i18n";
2
- import { textColor } from "@wordpress/icons";
3
- const variations = [
4
- {
5
- name: "Stretchy Paragraph",
6
- title: __("Stretchy Paragraph"),
7
- description: __(
8
- "Text automatically resizes to fit the container width."
9
- ),
10
- attributes: { fitText: true },
11
- scope: ["inserter"],
12
- isActive: (blockAttributes) => blockAttributes.fitText,
13
- icon: textColor,
14
- example: {
15
- attributes: {
16
- content: __(
17
- "This text will automatically resize to fit its container width."
18
- ),
19
- fitText: true
20
- }
21
- }
22
- }
23
- ];
24
- var variations_default = variations;
25
- export {
26
- variations_default as default
27
- };
28
- //# sourceMappingURL=variations.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/paragraph/variations.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { textColor } from '@wordpress/icons';\n\nconst variations = [\n\t{\n\t\tname: 'Stretchy Paragraph',\n\t\ttitle: __( 'Stretchy Paragraph' ),\n\t\tdescription: __(\n\t\t\t'Text automatically resizes to fit the container width.'\n\t\t),\n\t\tattributes: { fitText: true },\n\t\tscope: [ 'inserter' ],\n\t\tisActive: ( blockAttributes ) => blockAttributes.fitText,\n\t\ticon: textColor,\n\t\texample: {\n\t\t\tattributes: {\n\t\t\t\tcontent: __(\n\t\t\t\t\t'This text will automatically resize to fit its container width.'\n\t\t\t\t),\n\t\t\t\tfitText: true,\n\t\t\t},\n\t\t},\n\t},\n];\n\nexport default variations;\n"],
5
- "mappings": "AAGA,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAE1B,MAAM,aAAa;AAAA,EAClB;AAAA,IACC,MAAM;AAAA,IACN,OAAO,GAAI,oBAAqB;AAAA,IAChC,aAAa;AAAA,MACZ;AAAA,IACD;AAAA,IACA,YAAY,EAAE,SAAS,KAAK;AAAA,IAC5B,OAAO,CAAE,UAAW;AAAA,IACpB,UAAU,CAAE,oBAAqB,gBAAgB;AAAA,IACjD,MAAM;AAAA,IACN,SAAS;AAAA,MACR,YAAY;AAAA,QACX,SAAS;AAAA,UACR;AAAA,QACD;AAAA,QACA,SAAS;AAAA,MACV;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ;",
6
- "names": []
7
- }
@@ -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
- }