@wordpress/block-library 9.33.1-next.b8c8708f3.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.
Files changed (158) 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 -1
  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 +3 -3
  26. package/build/navigation/edit/menu-inspector-controls.js.map +2 -2
  27. package/build/navigation-link/edit.js +6 -3
  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 +4 -1
  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 +6 -3
  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/edit.js +4 -1
  52. package/build/term-template/edit.js.map +2 -2
  53. package/build/utils/get-transformed-attributes.js +82 -0
  54. package/build/utils/get-transformed-attributes.js.map +7 -0
  55. package/build-module/breadcrumbs/block.json +8 -2
  56. package/build-module/breadcrumbs/edit.js +117 -14
  57. package/build-module/breadcrumbs/edit.js.map +2 -2
  58. package/build-module/buttons/transforms.js +7 -7
  59. package/build-module/buttons/transforms.js.map +2 -2
  60. package/build-module/code/transforms.js +19 -15
  61. package/build-module/code/transforms.js.map +2 -2
  62. package/build-module/heading/index.js +1 -3
  63. package/build-module/heading/index.js.map +2 -2
  64. package/build-module/heading/transforms.js +22 -20
  65. package/build-module/heading/transforms.js.map +2 -2
  66. package/build-module/index.js +5 -1
  67. package/build-module/index.js.map +2 -2
  68. package/build-module/math/block.json +21 -0
  69. package/build-module/math/edit.js +110 -0
  70. package/build-module/math/edit.js.map +7 -0
  71. package/build-module/math/index.js +26 -0
  72. package/build-module/math/index.js.map +7 -0
  73. package/build-module/math/init.js +8 -0
  74. package/build-module/math/init.js.map +7 -0
  75. package/build-module/math/save.js +20 -0
  76. package/build-module/math/save.js.map +7 -0
  77. package/build-module/navigation/edit/menu-inspector-controls.js +3 -3
  78. package/build-module/navigation/edit/menu-inspector-controls.js.map +2 -2
  79. package/build-module/navigation-link/edit.js +6 -3
  80. package/build-module/navigation-link/edit.js.map +2 -2
  81. package/build-module/navigation-link/link-ui/index.js +1 -1
  82. package/build-module/navigation-link/link-ui/index.js.map +2 -2
  83. package/build-module/navigation-link/shared/controls.js +4 -1
  84. package/build-module/navigation-link/shared/controls.js.map +2 -2
  85. package/build-module/navigation-link/shared/index.js +5 -1
  86. package/build-module/navigation-link/shared/index.js.map +2 -2
  87. package/build-module/navigation-link/shared/update-attributes.js +3 -1
  88. package/build-module/navigation-link/shared/update-attributes.js.map +2 -2
  89. package/build-module/navigation-link/shared/use-entity-binding.js +45 -13
  90. package/build-module/navigation-link/shared/use-entity-binding.js.map +2 -2
  91. package/build-module/navigation-submenu/edit.js +6 -3
  92. package/build-module/navigation-submenu/edit.js.map +2 -2
  93. package/build-module/page-list/use-convert-to-navigation-links.js +6 -1
  94. package/build-module/page-list/use-convert-to-navigation-links.js.map +2 -2
  95. package/build-module/paragraph/index.js +1 -3
  96. package/build-module/paragraph/index.js.map +2 -2
  97. package/build-module/post-date/deprecated.js +98 -2
  98. package/build-module/post-date/deprecated.js.map +2 -2
  99. package/build-module/post-date/edit.js +1 -1
  100. package/build-module/post-date/edit.js.map +1 -1
  101. package/build-module/post-date/variations.js +4 -4
  102. package/build-module/post-date/variations.js.map +2 -2
  103. package/build-module/term-template/edit.js +4 -1
  104. package/build-module/term-template/edit.js.map +2 -2
  105. package/build-module/utils/get-transformed-attributes.js +58 -0
  106. package/build-module/utils/get-transformed-attributes.js.map +7 -0
  107. package/package.json +61 -36
  108. package/src/breadcrumbs/block.json +8 -2
  109. package/src/breadcrumbs/edit.js +163 -18
  110. package/src/breadcrumbs/index.php +118 -16
  111. package/src/buttons/transforms.js +6 -6
  112. package/src/code/transforms.js +16 -14
  113. package/src/heading/index.js +0 -2
  114. package/src/heading/transforms.js +25 -24
  115. package/src/index.js +6 -1
  116. package/src/math/block.json +21 -0
  117. package/src/math/edit.js +123 -0
  118. package/src/math/index.js +31 -0
  119. package/src/math/init.js +4 -0
  120. package/src/math/save.js +20 -0
  121. package/src/navigation/edit/menu-inspector-controls.js +8 -7
  122. package/src/navigation-link/edit.js +6 -3
  123. package/src/navigation-link/index.php +4 -18
  124. package/src/navigation-link/link-ui/index.js +4 -2
  125. package/src/navigation-link/shared/controls.js +12 -3
  126. package/src/navigation-link/shared/index.js +4 -1
  127. package/src/navigation-link/shared/test/update-attributes.test.js +8 -0
  128. package/src/navigation-link/shared/test/use-entity-binding.js +132 -17
  129. package/src/navigation-link/shared/update-attributes.js +1 -0
  130. package/src/navigation-link/shared/use-entity-binding.js +74 -19
  131. package/src/navigation-submenu/edit.js +6 -3
  132. package/src/navigation-submenu/index.php +3 -17
  133. package/src/page-list/test/{convert-to-links-modal.js → convert-to-navigation-links.js} +67 -0
  134. package/src/page-list/use-convert-to-navigation-links.js +11 -1
  135. package/src/paragraph/index.js +0 -2
  136. package/src/post-date/deprecated.js +100 -2
  137. package/src/post-date/edit.js +1 -1
  138. package/src/post-date/index.php +3 -3
  139. package/src/post-date/variations.js +5 -4
  140. package/src/term-template/edit.js +4 -1
  141. package/src/term-template/index.php +4 -6
  142. package/src/utils/get-transformed-attributes.js +98 -0
  143. package/tsconfig.json +1 -0
  144. package/build/heading/variations.js +0 -48
  145. package/build/heading/variations.js.map +0 -7
  146. package/build/paragraph/variations.js +0 -48
  147. package/build/paragraph/variations.js.map +0 -7
  148. package/build/utils/get-transformed-metadata.js +0 -59
  149. package/build/utils/get-transformed-metadata.js.map +0 -7
  150. package/build-module/heading/variations.js +0 -28
  151. package/build-module/heading/variations.js.map +0 -7
  152. package/build-module/paragraph/variations.js +0 -28
  153. package/build-module/paragraph/variations.js.map +0 -7
  154. package/build-module/utils/get-transformed-metadata.js +0 -35
  155. package/build-module/utils/get-transformed-metadata.js.map +0 -7
  156. package/src/heading/variations.js +0 -29
  157. package/src/paragraph/variations.js +0 -29
  158. package/src/utils/get-transformed-metadata.js +0 -60
@@ -8,6 +8,104 @@ import clsx from 'clsx';
8
8
  */
9
9
  import migrateFontFamily from '../utils/migrate-font-family';
10
10
 
11
+ const v3 = {
12
+ attributes: {
13
+ datetime: {
14
+ type: 'string',
15
+ role: 'content',
16
+ },
17
+ textAlign: {
18
+ type: 'string',
19
+ },
20
+ format: {
21
+ type: 'string',
22
+ },
23
+ isLink: {
24
+ type: 'boolean',
25
+ default: false,
26
+ role: 'content',
27
+ },
28
+ },
29
+ supports: {
30
+ html: false,
31
+ color: {
32
+ gradients: true,
33
+ link: true,
34
+ __experimentalDefaultControls: {
35
+ background: true,
36
+ text: true,
37
+ link: true,
38
+ },
39
+ },
40
+ spacing: {
41
+ margin: true,
42
+ padding: true,
43
+ },
44
+ typography: {
45
+ fontSize: true,
46
+ lineHeight: true,
47
+ __experimentalFontFamily: true,
48
+ __experimentalFontWeight: true,
49
+ __experimentalFontStyle: true,
50
+ __experimentalTextTransform: true,
51
+ __experimentalTextDecoration: true,
52
+ __experimentalLetterSpacing: true,
53
+ __experimentalDefaultControls: {
54
+ fontSize: true,
55
+ },
56
+ },
57
+ interactivity: {
58
+ clientNavigation: true,
59
+ },
60
+ __experimentalBorder: {
61
+ radius: true,
62
+ color: true,
63
+ width: true,
64
+ style: true,
65
+ __experimentalDefaultControls: {
66
+ radius: true,
67
+ color: true,
68
+ width: true,
69
+ style: true,
70
+ },
71
+ },
72
+ },
73
+ save() {
74
+ return null;
75
+ },
76
+ migrate( {
77
+ metadata: {
78
+ bindings: {
79
+ datetime: {
80
+ source,
81
+ args: { key, ...otherArgs },
82
+ },
83
+ ...otherBindings
84
+ },
85
+ ...otherMetadata
86
+ },
87
+ ...otherAttributes
88
+ } ) {
89
+ // Change the block bindings source argument name from "key" to "field".
90
+ return {
91
+ metadata: {
92
+ bindings: {
93
+ datetime: {
94
+ source,
95
+ args: { field: key, ...otherArgs },
96
+ },
97
+ ...otherBindings,
98
+ },
99
+ ...otherMetadata,
100
+ },
101
+ ...otherAttributes,
102
+ };
103
+ },
104
+ isEligible( attributes ) {
105
+ return !! attributes?.metadata?.bindings?.datetime?.args?.key;
106
+ },
107
+ };
108
+
11
109
  const v2 = {
12
110
  attributes: {
13
111
  textAlign: {
@@ -90,7 +188,7 @@ const v2 = {
90
188
  bindings: {
91
189
  datetime: {
92
190
  source: 'core/post-data',
93
- args: { key: displayType },
191
+ args: { field: displayType },
94
192
  },
95
193
  },
96
194
  },
@@ -152,4 +250,4 @@ const v1 = {
152
250
  *
153
251
  * See block-deprecation.md
154
252
  */
155
- export default [ v2, v1 ];
253
+ export default [ v3, v2, v1 ];
@@ -48,7 +48,7 @@ export default function PostDateEdit( {
48
48
  } ) {
49
49
  const displayType =
50
50
  metadata?.bindings?.datetime?.source === 'core/post-data' &&
51
- metadata?.bindings?.datetime?.args?.key;
51
+ metadata?.bindings?.datetime?.args?.field;
52
52
 
53
53
  const blockProps = useBlockProps( {
54
54
  className: clsx( {
@@ -32,17 +32,17 @@ function render_block_core_post_date( $attributes, $content, $block ) {
32
32
  $source = get_block_bindings_source( 'core/post-data' );
33
33
  if ( isset( $attributes['displayType'] ) && 'modified' === $attributes['displayType'] ) {
34
34
  $source_args = array(
35
- 'key' => 'modified',
35
+ 'field' => 'modified',
36
36
  );
37
37
  } else {
38
38
  $source_args = array(
39
- 'key' => 'date',
39
+ 'field' => 'date',
40
40
  );
41
41
  }
42
42
  $attributes['datetime'] = $source->get_value( $source_args, $block, 'datetime' );
43
43
  }
44
44
 
45
- if ( isset( $source_args['key'] ) && 'modified' === $source_args['key'] ) {
45
+ if ( isset( $source_args['field'] ) && 'modified' === $source_args['field'] ) {
46
46
  $classes[] = 'wp-block-post-date__modified-date';
47
47
  }
48
48
 
@@ -14,7 +14,7 @@ const variations = [
14
14
  bindings: {
15
15
  datetime: {
16
16
  source: 'core/post-data',
17
- args: { key: 'date' },
17
+ args: { field: 'date' },
18
18
  },
19
19
  },
20
20
  },
@@ -23,7 +23,8 @@ const variations = [
23
23
  isActive: ( blockAttributes ) =>
24
24
  blockAttributes?.metadata?.bindings?.datetime?.source ===
25
25
  'core/post-data' &&
26
- blockAttributes?.metadata?.bindings?.datetime?.args?.key === 'date',
26
+ blockAttributes?.metadata?.bindings?.datetime?.args?.field ===
27
+ 'date',
27
28
  icon: postDate,
28
29
  },
29
30
  {
@@ -35,7 +36,7 @@ const variations = [
35
36
  bindings: {
36
37
  datetime: {
37
38
  source: 'core/post-data',
38
- args: { key: 'modified' },
39
+ args: { field: 'modified' },
39
40
  },
40
41
  },
41
42
  },
@@ -45,7 +46,7 @@ const variations = [
45
46
  isActive: ( blockAttributes ) =>
46
47
  blockAttributes?.metadata?.bindings?.datetime?.source ===
47
48
  'core/post-data' &&
48
- blockAttributes?.metadata?.bindings?.datetime?.args?.key ===
49
+ blockAttributes?.metadata?.bindings?.datetime?.args?.field ===
49
50
  'modified',
50
51
  icon: postDate,
51
52
  },
@@ -93,7 +93,10 @@ export default function TermTemplateEdit( {
93
93
  hide_empty: hideEmpty,
94
94
  order,
95
95
  orderby: orderBy,
96
- per_page: perPage,
96
+ // There is a mismatch between `WP_Term_Query` and the REST API parameter default
97
+ // values to fetch all items. In `WP_Term_Query`, the default is `''|0` and in
98
+ // the REST API is `-1`.
99
+ per_page: perPage || -1,
97
100
  };
98
101
 
99
102
  // Nested terms are returned by default from REST API as long as parent is not set.
@@ -85,27 +85,25 @@ function render_block_core_term_template( $attributes, $content, $block ) {
85
85
  return $context;
86
86
  };
87
87
 
88
- $block_content = '';
89
-
90
88
  // Use an early priority to so that other 'render_block_context' filters have access to the values.
91
89
  add_filter( 'render_block_context', $filter_block_context, 1 );
92
90
 
93
91
  // Render the inner blocks of the Term Template block with `dynamic` set to `false` to prevent calling
94
92
  // `render_callback` and ensure that no wrapper markup is included.
95
- $block_content .= ( new WP_Block( $block_instance ) )->render( array( 'dynamic' => false ) );
93
+ $block_content = ( new WP_Block( $block_instance ) )->render( array( 'dynamic' => false ) );
96
94
 
97
95
  remove_filter( 'render_block_context', $filter_block_context, 1 );
98
96
 
99
97
  // Wrap the render inner blocks in a `li` element with the appropriate term classes.
100
- $term_classes = implode( ' ', array( 'wp-block-term', "term-{$term->term_id}", $term->taxonomy, "taxonomy-{$term->taxonomy}" ) );
98
+ $term_classes = "wp-block-term term-{$term->term_id} {$term->taxonomy} taxonomy-{$term->taxonomy}";
101
99
 
102
100
  $content .= '<li class="' . esc_attr( $term_classes ) . '">' . $block_content . '</li>';
103
101
  }
104
102
 
105
- $classnames = 'wp-block-term-template';
103
+ $classnames = '';
106
104
 
107
105
  if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
108
- $classnames .= ' has-link-color';
106
+ $classnames .= 'has-link-color';
109
107
  }
110
108
 
111
109
  $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => trim( $classnames ) ) );
@@ -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
+ }
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,59 +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 transformSupportedProps = ["commentId"];
31
- if (bindingsCallback) {
32
- transformSupportedProps.push("id", "bindings");
33
- }
34
- if (supports.renaming !== false) {
35
- transformSupportedProps.push("name");
36
- }
37
- if (supports.blockVisibility !== false) {
38
- transformSupportedProps.push("blockVisibility");
39
- }
40
- if (!transformSupportedProps.length) {
41
- return;
42
- }
43
- const newMetadata = Object.entries(metadata).reduce(
44
- (obj, [prop, value]) => {
45
- if (!transformSupportedProps.includes(prop)) {
46
- return obj;
47
- }
48
- obj[prop] = prop === "bindings" ? bindingsCallback(value) : value;
49
- return obj;
50
- },
51
- {}
52
- );
53
- return Object.keys(newMetadata).length ? newMetadata : void 0;
54
- }
55
- // Annotate the CommonJS export names for ESM import in node:
56
- 0 && (module.exports = {
57
- getTransformedMetadata
58
- });
59
- //# 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\n\t// The metadata properties that should be preserved after the transform.\n\tconst transformSupportedProps = [ 'commentId' ];\n\t// If there is a transform bindings callback, add the `id` and `bindings` properties.\n\tif ( bindingsCallback ) {\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;AAGhD,QAAM,0BAA0B,CAAE,WAAY;AAE9C,MAAK,kBAAmB;AACvB,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,35 +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 transformSupportedProps = ["commentId"];
8
- if (bindingsCallback) {
9
- transformSupportedProps.push("id", "bindings");
10
- }
11
- if (supports.renaming !== false) {
12
- transformSupportedProps.push("name");
13
- }
14
- if (supports.blockVisibility !== false) {
15
- transformSupportedProps.push("blockVisibility");
16
- }
17
- if (!transformSupportedProps.length) {
18
- return;
19
- }
20
- const newMetadata = Object.entries(metadata).reduce(
21
- (obj, [prop, value]) => {
22
- if (!transformSupportedProps.includes(prop)) {
23
- return obj;
24
- }
25
- obj[prop] = prop === "bindings" ? bindingsCallback(value) : value;
26
- return obj;
27
- },
28
- {}
29
- );
30
- return Object.keys(newMetadata).length ? newMetadata : void 0;
31
- }
32
- export {
33
- getTransformedMetadata
34
- };
35
- //# 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\n\t// The metadata properties that should be preserved after the transform.\n\tconst transformSupportedProps = [ 'commentId' ];\n\t// If there is a transform bindings callback, add the `id` and `bindings` properties.\n\tif ( bindingsCallback ) {\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;AAGhD,QAAM,0BAA0B,CAAE,WAAY;AAE9C,MAAK,kBAAmB;AACvB,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
- }