@wordpress/block-library 9.42.0 → 9.43.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 (85) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/form-input/edit.cjs +36 -29
  3. package/build/form-input/edit.cjs.map +2 -2
  4. package/build/form-input/variations.cjs +10 -0
  5. package/build/form-input/variations.cjs.map +2 -2
  6. package/build/group/block.json +3 -1
  7. package/build/image/image.cjs +13 -4
  8. package/build/image/image.cjs.map +2 -2
  9. package/build/latest-comments/deprecated.cjs +33 -0
  10. package/build/latest-comments/deprecated.cjs.map +2 -2
  11. package/build/list-item/block.json +1 -0
  12. package/build/navigation/edit/index.cjs +123 -119
  13. package/build/navigation/edit/index.cjs.map +3 -3
  14. package/build/navigation/edit/navigation-menu-selector.cjs +2 -1
  15. package/build/navigation/edit/navigation-menu-selector.cjs.map +2 -2
  16. package/build/site-logo/edit.cjs +19 -13
  17. package/build/site-logo/edit.cjs.map +3 -3
  18. package/build/site-tagline/deprecated.cjs +2 -1
  19. package/build/site-tagline/deprecated.cjs.map +2 -2
  20. package/build/tab/save.cjs +2 -4
  21. package/build/tab/save.cjs.map +2 -2
  22. package/build/tabs/save.cjs +2 -4
  23. package/build/tabs/save.cjs.map +2 -2
  24. package/build/utils/media-control.cjs +1 -1
  25. package/build/utils/media-control.cjs.map +2 -2
  26. package/build-module/form-input/edit.mjs +36 -29
  27. package/build-module/form-input/edit.mjs.map +2 -2
  28. package/build-module/form-input/variations.mjs +10 -0
  29. package/build-module/form-input/variations.mjs.map +2 -2
  30. package/build-module/group/block.json +3 -1
  31. package/build-module/image/image.mjs +13 -4
  32. package/build-module/image/image.mjs.map +2 -2
  33. package/build-module/latest-comments/deprecated.mjs +33 -0
  34. package/build-module/latest-comments/deprecated.mjs.map +2 -2
  35. package/build-module/list-item/block.json +1 -0
  36. package/build-module/navigation/edit/index.mjs +123 -119
  37. package/build-module/navigation/edit/index.mjs.map +2 -2
  38. package/build-module/navigation/edit/navigation-menu-selector.mjs +2 -1
  39. package/build-module/navigation/edit/navigation-menu-selector.mjs.map +2 -2
  40. package/build-module/site-logo/edit.mjs +21 -14
  41. package/build-module/site-logo/edit.mjs.map +2 -2
  42. package/build-module/site-tagline/deprecated.mjs +2 -1
  43. package/build-module/site-tagline/deprecated.mjs.map +2 -2
  44. package/build-module/tab/save.mjs +2 -4
  45. package/build-module/tab/save.mjs.map +2 -2
  46. package/build-module/tabs/save.mjs +2 -4
  47. package/build-module/tabs/save.mjs.map +2 -2
  48. package/build-module/utils/media-control.mjs +1 -1
  49. package/build-module/utils/media-control.mjs.map +2 -2
  50. package/build-style/editor-rtl.css +15 -5
  51. package/build-style/editor.css +15 -5
  52. package/build-style/form-input/editor-rtl.css +6 -5
  53. package/build-style/form-input/editor.css +6 -5
  54. package/build-style/icon/editor-rtl.css +5 -0
  55. package/build-style/icon/editor.css +5 -0
  56. package/build-style/image/editor-rtl.css +4 -0
  57. package/build-style/image/editor.css +4 -0
  58. package/build-style/navigation/style-rtl.css +4 -1
  59. package/build-style/navigation/style.css +4 -1
  60. package/build-style/style-rtl.css +4 -1
  61. package/build-style/style.css +4 -1
  62. package/package.json +38 -38
  63. package/src/form-input/edit.js +19 -15
  64. package/src/form-input/editor.scss +6 -6
  65. package/src/form-input/variations.js +10 -0
  66. package/src/group/block.json +3 -1
  67. package/src/home-link/index.php +14 -33
  68. package/src/icon/editor.scss +5 -0
  69. package/src/image/editor.scss +5 -0
  70. package/src/image/image.js +18 -3
  71. package/src/latest-comments/deprecated.js +33 -0
  72. package/src/list-item/block.json +1 -0
  73. package/src/loginout/index.php +13 -0
  74. package/src/navigation/edit/index.js +134 -130
  75. package/src/navigation/edit/navigation-menu-selector.js +2 -1
  76. package/src/navigation/style.scss +5 -3
  77. package/src/navigation-link/index.php +10 -38
  78. package/src/navigation-link/shared/build-css-font-sizes.php +43 -0
  79. package/src/navigation-submenu/index.php +10 -38
  80. package/src/page-list/index.php +14 -41
  81. package/src/site-logo/edit.js +24 -13
  82. package/src/site-tagline/deprecated.js +1 -0
  83. package/src/tab/save.js +2 -6
  84. package/src/tabs/save.js +2 -6
  85. package/src/utils/media-control.js +3 -1
@@ -2466,7 +2466,6 @@ ul {
2466
2466
  .wp-block-navigation ul,
2467
2467
  .wp-block-navigation ul li {
2468
2468
  list-style: none;
2469
- padding: 0;
2470
2469
  }
2471
2470
  .wp-block-navigation .wp-block-navigation-item {
2472
2471
  background-color: inherit;
@@ -2553,6 +2552,10 @@ ul {
2553
2552
  --navigation-layout-justify: space-between;
2554
2553
  }
2555
2554
 
2555
+ :where(.wp-block-navigation) ul li {
2556
+ padding: 0;
2557
+ }
2558
+
2556
2559
  .wp-block-navigation .has-child .wp-block-navigation__submenu-container {
2557
2560
  background-color: inherit;
2558
2561
  color: inherit;
@@ -2496,7 +2496,6 @@ ul {
2496
2496
  .wp-block-navigation ul,
2497
2497
  .wp-block-navigation ul li {
2498
2498
  list-style: none;
2499
- padding: 0;
2500
2499
  }
2501
2500
  .wp-block-navigation .wp-block-navigation-item {
2502
2501
  background-color: inherit;
@@ -2583,6 +2582,10 @@ ul {
2583
2582
  --navigation-layout-justify: space-between;
2584
2583
  }
2585
2584
 
2585
+ :where(.wp-block-navigation) ul li {
2586
+ padding: 0;
2587
+ }
2588
+
2586
2589
  .wp-block-navigation .has-child .wp-block-navigation__submenu-container {
2587
2590
  background-color: inherit;
2588
2591
  color: inherit;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "9.42.0",
3
+ "version": "9.43.0",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -95,42 +95,42 @@
95
95
  ],
96
96
  "dependencies": {
97
97
  "@arraypress/waveform-player": "1.2.1",
98
- "@wordpress/a11y": "^4.42.0",
99
- "@wordpress/api-fetch": "^7.42.0",
100
- "@wordpress/autop": "^4.42.0",
101
- "@wordpress/base-styles": "^6.18.0",
102
- "@wordpress/blob": "^4.42.0",
103
- "@wordpress/block-editor": "^15.15.0",
104
- "@wordpress/blocks": "^15.15.0",
105
- "@wordpress/components": "^32.4.0",
106
- "@wordpress/compose": "^7.42.0",
107
- "@wordpress/core-data": "^7.42.0",
108
- "@wordpress/data": "^10.42.0",
109
- "@wordpress/date": "^5.42.0",
110
- "@wordpress/deprecated": "^4.42.0",
111
- "@wordpress/dom": "^4.42.0",
112
- "@wordpress/element": "^6.42.0",
113
- "@wordpress/escape-html": "^3.42.0",
114
- "@wordpress/hooks": "^4.42.0",
115
- "@wordpress/html-entities": "^4.42.0",
116
- "@wordpress/i18n": "^6.15.0",
117
- "@wordpress/icons": "^12.0.0",
118
- "@wordpress/interactivity": "^6.42.0",
119
- "@wordpress/interactivity-router": "^2.42.0",
120
- "@wordpress/keyboard-shortcuts": "^5.42.0",
121
- "@wordpress/keycodes": "^4.42.0",
122
- "@wordpress/latex-to-mathml": "^1.10.0",
123
- "@wordpress/notices": "^5.42.0",
124
- "@wordpress/patterns": "^2.42.0",
125
- "@wordpress/primitives": "^4.42.0",
126
- "@wordpress/private-apis": "^1.42.0",
127
- "@wordpress/reusable-blocks": "^5.42.0",
128
- "@wordpress/rich-text": "^7.42.0",
129
- "@wordpress/server-side-render": "^6.18.0",
130
- "@wordpress/upload-media": "^0.27.0",
131
- "@wordpress/url": "^4.42.0",
132
- "@wordpress/viewport": "^6.42.0",
133
- "@wordpress/wordcount": "^4.42.0",
98
+ "@wordpress/a11y": "^4.43.0",
99
+ "@wordpress/api-fetch": "^7.43.0",
100
+ "@wordpress/autop": "^4.43.0",
101
+ "@wordpress/base-styles": "^6.19.0",
102
+ "@wordpress/blob": "^4.43.0",
103
+ "@wordpress/block-editor": "^15.16.0",
104
+ "@wordpress/blocks": "^15.16.0",
105
+ "@wordpress/components": "^32.5.0",
106
+ "@wordpress/compose": "^7.43.0",
107
+ "@wordpress/core-data": "^7.43.0",
108
+ "@wordpress/data": "^10.43.0",
109
+ "@wordpress/date": "^5.43.0",
110
+ "@wordpress/deprecated": "^4.43.0",
111
+ "@wordpress/dom": "^4.43.0",
112
+ "@wordpress/element": "^6.43.0",
113
+ "@wordpress/escape-html": "^3.43.0",
114
+ "@wordpress/hooks": "^4.43.0",
115
+ "@wordpress/html-entities": "^4.43.0",
116
+ "@wordpress/i18n": "^6.16.0",
117
+ "@wordpress/icons": "^12.1.0",
118
+ "@wordpress/interactivity": "^6.43.0",
119
+ "@wordpress/interactivity-router": "^2.43.0",
120
+ "@wordpress/keyboard-shortcuts": "^5.43.0",
121
+ "@wordpress/keycodes": "^4.43.0",
122
+ "@wordpress/latex-to-mathml": "^1.11.0",
123
+ "@wordpress/notices": "^5.43.0",
124
+ "@wordpress/patterns": "^2.43.0",
125
+ "@wordpress/primitives": "^4.43.0",
126
+ "@wordpress/private-apis": "^1.43.0",
127
+ "@wordpress/reusable-blocks": "^5.43.0",
128
+ "@wordpress/rich-text": "^7.43.0",
129
+ "@wordpress/server-side-render": "^6.19.0",
130
+ "@wordpress/upload-media": "^0.28.0",
131
+ "@wordpress/url": "^4.43.0",
132
+ "@wordpress/viewport": "^6.43.0",
133
+ "@wordpress/wordcount": "^4.43.0",
134
134
  "change-case": "^4.1.2",
135
135
  "clsx": "^2.1.1",
136
136
  "colord": "^2.7.0",
@@ -151,5 +151,5 @@
151
151
  "publishConfig": {
152
152
  "access": "public"
153
153
  },
154
- "gitHead": "c20787b1778ae64c2db65643b1c236309d68e6ba"
154
+ "gitHead": "2cea90674d11aa521ec3f71652fb3a6a4c383969"
155
155
  }
@@ -115,6 +115,20 @@ function InputFieldBlock( { attributes, setAttributes, className } ) {
115
115
  'Affects the "name" attribute of the input element, and is used as a name for the form submission results.'
116
116
  ) }
117
117
  />
118
+ { 'hidden' === type && (
119
+ <TextControl
120
+ __next40pxDefaultSize
121
+ autoComplete="off"
122
+ label={ __( 'Value' ) }
123
+ value={ value }
124
+ onChange={ ( newVal ) =>
125
+ setAttributes( { value: newVal } )
126
+ }
127
+ help={ __(
128
+ 'Sets the stored value for this hidden field.'
129
+ ) }
130
+ />
131
+ ) }
118
132
  </InspectorControls>
119
133
  </>
120
134
  );
@@ -133,23 +147,13 @@ function InputFieldBlock( { attributes, setAttributes, className } ) {
133
147
 
134
148
  if ( 'hidden' === type ) {
135
149
  return (
136
- <>
150
+ <div { ...blockProps }>
137
151
  { controls }
138
- <input
139
- type="hidden"
140
- className={ clsx(
141
- className,
142
- 'wp-block-form-input__input',
143
- colorProps.className,
144
- borderProps.className
145
- ) }
146
- aria-label={ __( 'Value' ) }
147
- value={ value }
148
- onChange={ ( event ) =>
149
- setAttributes( { value: event.target.value } )
150
- }
152
+ <span
153
+ className="wp-block-form-input__label is-input-hidden"
154
+ data-message={ __( 'Hidden field' ) }
151
155
  />
152
- </>
156
+ </div>
153
157
  );
154
158
  }
155
159
 
@@ -1,24 +1,24 @@
1
1
  .wp-block-form-input {
2
2
  .is-input-hidden {
3
+ display: flex;
4
+ position: relative;
3
5
  font-size: 0.85em;
4
6
  opacity: 0.3;
5
7
  border: 1px dashed;
6
8
  padding: 0.5em;
7
9
  box-sizing: border-box;
8
10
  background: repeating-linear-gradient(45deg, transparent, transparent 5px, currentColor 5px, currentColor 6px);
11
+ justify-content: center;
12
+ align-items: center;
9
13
 
10
- input[type="text"] {
11
- background: transparent;
14
+ &::after {
15
+ content: attr(data-message);
12
16
  }
13
17
  }
14
18
  &.is-selected {
15
19
  .is-input-hidden {
16
20
  opacity: 1;
17
21
  background: none;
18
-
19
- input[type="text"] {
20
- background: unset;
21
- }
22
22
  }
23
23
  }
24
24
  }
@@ -70,6 +70,16 @@ const variations = [
70
70
  scope: [ 'inserter', 'transform' ],
71
71
  isActive: ( blockAttributes ) => blockAttributes?.type === 'number',
72
72
  },
73
+ {
74
+ name: 'hidden',
75
+ title: __( 'Hidden Input' ),
76
+ icon: 'visibility',
77
+ description: __( 'A hidden input field.' ),
78
+ attributes: { type: 'hidden' },
79
+ isDefault: true,
80
+ scope: [ 'inserter', 'transform' ],
81
+ isActive: ( blockAttributes ) => blockAttributes?.type === 'hidden',
82
+ },
73
83
  ];
74
84
 
75
85
  export default variations;
@@ -28,8 +28,10 @@
28
28
  "background": {
29
29
  "backgroundImage": true,
30
30
  "backgroundSize": true,
31
+ "gradient": true,
31
32
  "__experimentalDefaultControls": {
32
- "backgroundImage": true
33
+ "backgroundImage": true,
34
+ "gradient": true
33
35
  }
34
36
  },
35
37
  "color": {
@@ -5,6 +5,8 @@
5
5
  * @package WordPress
6
6
  */
7
7
 
8
+ require_once __DIR__ . '/navigation-link/shared/build-css-font-sizes.php';
9
+
8
10
  /**
9
11
  * Build an array with CSS classes and inline styles defining the colors
10
12
  * which will be applied to the home link markup in the front-end.
@@ -59,36 +61,6 @@ function block_core_home_link_build_css_colors( $context ) {
59
61
  return $colors;
60
62
  }
61
63
 
62
- /**
63
- * Build an array with CSS classes and inline styles defining the font sizes
64
- * which will be applied to the home link markup in the front-end.
65
- *
66
- * @since 6.0.0
67
- *
68
- * @param array $context Home link block context.
69
- * @return array Font size CSS classes and inline styles.
70
- */
71
- function block_core_home_link_build_css_font_sizes( $context ) {
72
- // CSS classes.
73
- $font_sizes = array(
74
- 'css_classes' => array(),
75
- 'inline_styles' => '',
76
- );
77
-
78
- $has_named_font_size = array_key_exists( 'fontSize', $context );
79
- $has_custom_font_size = isset( $context['style']['typography']['fontSize'] );
80
-
81
- if ( $has_named_font_size ) {
82
- // Add the font size class.
83
- $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] );
84
- } elseif ( $has_custom_font_size ) {
85
- // Add the custom font size inline style.
86
- $font_sizes['inline_styles'] = sprintf( 'font-size: %s;', $context['style']['typography']['fontSize'] );
87
- }
88
-
89
- return $font_sizes;
90
- }
91
-
92
64
  /**
93
65
  * Builds an array with classes and style for the li wrapper
94
66
  *
@@ -98,12 +70,21 @@ function block_core_home_link_build_css_font_sizes( $context ) {
98
70
  * @return string The li wrapper attributes.
99
71
  */
100
72
  function block_core_home_link_build_li_wrapper_attributes( $context ) {
101
- $colors = block_core_home_link_build_css_colors( $context );
102
- $font_sizes = block_core_home_link_build_css_font_sizes( $context );
103
- $classes = array_merge(
73
+ $colors = block_core_home_link_build_css_colors( $context );
74
+ // The build system prefixes this function with "gutenberg_" to avoid
75
+ // collisions with the core version. Until this function is backported to
76
+ // core, we need to guard it's use and only call the prefixed name in
77
+ // the plugin.
78
+ if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
79
+ $font_sizes = gutenberg_block_core_shared_navigation_build_css_font_sizes( $context );
80
+ } else {
81
+ $font_sizes = block_core_shared_navigation_build_css_font_sizes( $context );
82
+ }
83
+ $classes = array_merge(
104
84
  $colors['css_classes'],
105
85
  $font_sizes['css_classes']
106
86
  );
87
+
107
88
  $style_attribute = ( $colors['inline_styles'] . $font_sizes['inline_styles'] );
108
89
  $classes[] = 'wp-block-navigation-item';
109
90
 
@@ -1,6 +1,11 @@
1
1
  @use "@wordpress/base-styles/variables" as *;
2
2
  @use "@wordpress/base-styles/colors" as *;
3
3
 
4
+ .wp-block[data-align="center"] > .wp-block-icon {
5
+ display: flex;
6
+ justify-content: center;
7
+ }
8
+
4
9
  // Style for the icon library modal.
5
10
  .wp-block-icon__inserter {
6
11
  padding: 0 $grid-unit-30;
@@ -52,6 +52,11 @@ figure.wp-block-image:not(.wp-block) {
52
52
  }
53
53
  }
54
54
 
55
+ // Disable any duotone filter applied in the selected state.
56
+ .wp-block-image.is-selected .block-editor-media-placeholder {
57
+ filter: none !important;
58
+ }
59
+
55
60
  .block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal {
56
61
  position: absolute;
57
62
  left: 0;
@@ -70,7 +70,9 @@ import {
70
70
  } from './constants';
71
71
  import { evalAspectRatio, mediaPosition } from './utils';
72
72
 
73
- const { DimensionsTool, ResolutionTool } = unlock( blockEditorPrivateApis );
73
+ const { DimensionsTool, ResolutionTool, mediaEditKey } = unlock(
74
+ blockEditorPrivateApis
75
+ );
74
76
 
75
77
  const scaleOptions = [
76
78
  {
@@ -342,7 +344,13 @@ export default function Image( {
342
344
  [ id, isSingleSelected ]
343
345
  );
344
346
 
345
- const { canInsertCover, imageEditing, imageSizes, maxWidth } = useSelect(
347
+ const {
348
+ canInsertCover,
349
+ imageEditing,
350
+ imageSizes,
351
+ maxWidth,
352
+ editMediaEntity,
353
+ } = useSelect(
346
354
  ( select ) => {
347
355
  const { getBlockRootClientId, canInsertBlockType, getSettings } =
348
356
  select( blockEditorStore );
@@ -354,6 +362,7 @@ export default function Image( {
354
362
  imageEditing: settings.imageEditing,
355
363
  imageSizes: settings.imageSizes,
356
364
  maxWidth: settings.maxWidth,
365
+ editMediaEntity: settings?.[ mediaEditKey ],
357
366
  canInsertCover: canInsertBlockType(
358
367
  'core/cover',
359
368
  rootClientId
@@ -550,7 +559,12 @@ export default function Image( {
550
559
  }
551
560
  }, [ isSingleSelected ] );
552
561
 
553
- const canEditImage = id && naturalWidth && naturalHeight && imageEditing;
562
+ const canEditImage =
563
+ id &&
564
+ naturalWidth &&
565
+ naturalHeight &&
566
+ imageEditing &&
567
+ !! editMediaEntity;
554
568
  const allowCrop =
555
569
  isSingleSelected &&
556
570
  canEditImage &&
@@ -762,6 +776,7 @@ export default function Image( {
762
776
  id &&
763
777
  isSingleSelected &&
764
778
  canUserEdit &&
779
+ !! editMediaEntity &&
765
780
  ! isExternalImage( id, url ) &&
766
781
  ! isEditingImage &&
767
782
  onNavigateToEntityRecord && (
@@ -23,6 +23,39 @@ const v1 = {
23
23
  default: true,
24
24
  },
25
25
  },
26
+ supports: {
27
+ align: true,
28
+ color: {
29
+ gradients: true,
30
+ link: true,
31
+ __experimentalDefaultControls: {
32
+ background: true,
33
+ text: true,
34
+ link: true,
35
+ },
36
+ },
37
+ html: false,
38
+ spacing: {
39
+ margin: true,
40
+ padding: true,
41
+ },
42
+ typography: {
43
+ fontSize: true,
44
+ lineHeight: true,
45
+ __experimentalFontFamily: true,
46
+ __experimentalFontWeight: true,
47
+ __experimentalFontStyle: true,
48
+ __experimentalTextTransform: true,
49
+ __experimentalTextDecoration: true,
50
+ __experimentalLetterSpacing: true,
51
+ __experimentalDefaultControls: {
52
+ fontSize: true,
53
+ },
54
+ },
55
+ interactivity: {
56
+ clientNavigation: true,
57
+ },
58
+ },
26
59
  isEligible( attributes ) {
27
60
  return attributes?.displayExcerpt === false;
28
61
  },
@@ -21,6 +21,7 @@
21
21
  },
22
22
  "supports": {
23
23
  "anchor": true,
24
+ "html": false,
24
25
  "className": false,
25
26
  "splitting": true,
26
27
  "__experimentalBorder": {
@@ -38,6 +38,19 @@ function render_block_core_loginout( $attributes ) {
38
38
 
39
39
  // Get the form.
40
40
  $contents = wp_login_form( array( 'echo' => false ) );
41
+
42
+ if ( wp_is_block_theme() ) {
43
+ $processor = new WP_HTML_Tag_Processor( $contents );
44
+
45
+ while ( $processor->next_tag( 'input' ) ) {
46
+ if ( 'submit' === $processor->get_attribute( 'type' ) && 'wp-submit' === $processor->get_attribute( 'name' ) ) {
47
+ $processor->add_class( 'wp-block-button__link' );
48
+ $processor->add_class( wp_theme_get_element_class_name( 'button' ) );
49
+ $contents = $processor->get_updated_html();
50
+ break;
51
+ }
52
+ }
53
+ }
41
54
  }
42
55
 
43
56
  $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );