@wordpress/block-library 8.19.4 → 8.19.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "8.19.4",
3
+ "version": "8.19.5",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,36 +31,36 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.42.4",
35
- "@wordpress/api-fetch": "^6.39.4",
36
- "@wordpress/autop": "^3.42.4",
37
- "@wordpress/blob": "^3.42.4",
38
- "@wordpress/block-editor": "^12.10.4",
39
- "@wordpress/blocks": "^12.19.4",
40
- "@wordpress/components": "^25.8.4",
41
- "@wordpress/compose": "^6.19.4",
42
- "@wordpress/core-data": "^6.19.4",
43
- "@wordpress/data": "^9.12.4",
44
- "@wordpress/date": "^4.42.4",
45
- "@wordpress/deprecated": "^3.42.4",
46
- "@wordpress/dom": "^3.42.4",
47
- "@wordpress/element": "^5.19.4",
48
- "@wordpress/escape-html": "^2.42.4",
49
- "@wordpress/hooks": "^3.42.4",
50
- "@wordpress/html-entities": "^3.42.4",
51
- "@wordpress/i18n": "^4.42.4",
52
- "@wordpress/icons": "^9.33.4",
53
- "@wordpress/interactivity": "^2.3.4",
54
- "@wordpress/keycodes": "^3.42.4",
55
- "@wordpress/notices": "^4.10.4",
56
- "@wordpress/primitives": "^3.40.4",
57
- "@wordpress/private-apis": "^0.24.4",
58
- "@wordpress/reusable-blocks": "^4.19.4",
59
- "@wordpress/rich-text": "^6.19.4",
60
- "@wordpress/server-side-render": "^4.19.4",
61
- "@wordpress/url": "^3.43.4",
62
- "@wordpress/viewport": "^5.19.4",
63
- "@wordpress/wordcount": "^3.42.4",
34
+ "@wordpress/a11y": "^3.42.5",
35
+ "@wordpress/api-fetch": "^6.39.5",
36
+ "@wordpress/autop": "^3.42.5",
37
+ "@wordpress/blob": "^3.42.5",
38
+ "@wordpress/block-editor": "^12.10.5",
39
+ "@wordpress/blocks": "^12.19.5",
40
+ "@wordpress/components": "^25.8.5",
41
+ "@wordpress/compose": "^6.19.5",
42
+ "@wordpress/core-data": "^6.19.5",
43
+ "@wordpress/data": "^9.12.5",
44
+ "@wordpress/date": "^4.42.5",
45
+ "@wordpress/deprecated": "^3.42.5",
46
+ "@wordpress/dom": "^3.42.5",
47
+ "@wordpress/element": "^5.19.5",
48
+ "@wordpress/escape-html": "^2.42.5",
49
+ "@wordpress/hooks": "^3.42.5",
50
+ "@wordpress/html-entities": "^3.42.5",
51
+ "@wordpress/i18n": "^4.42.5",
52
+ "@wordpress/icons": "^9.33.5",
53
+ "@wordpress/interactivity": "^2.3.5",
54
+ "@wordpress/keycodes": "^3.42.5",
55
+ "@wordpress/notices": "^4.10.5",
56
+ "@wordpress/primitives": "^3.40.5",
57
+ "@wordpress/private-apis": "^0.24.5",
58
+ "@wordpress/reusable-blocks": "^4.19.5",
59
+ "@wordpress/rich-text": "^6.19.5",
60
+ "@wordpress/server-side-render": "^4.19.5",
61
+ "@wordpress/url": "^3.43.5",
62
+ "@wordpress/viewport": "^5.19.5",
63
+ "@wordpress/wordcount": "^3.42.5",
64
64
  "change-case": "^4.1.2",
65
65
  "classnames": "^2.3.1",
66
66
  "colord": "^2.7.0",
@@ -78,5 +78,5 @@
78
78
  "publishConfig": {
79
79
  "access": "public"
80
80
  },
81
- "gitHead": "d1072bbcaf037a18d414da7865ebaf366a0e7062"
81
+ "gitHead": "edc87d3e33740b82b30f5e21c5953ecded84f08f"
82
82
  }
@@ -200,6 +200,7 @@ function block_core_image_render_lightbox( $block_content, $block ) {
200
200
  $w->set_attribute( 'data-wp-init', 'effects.core.image.setCurrentSrc' );
201
201
  $w->set_attribute( 'data-wp-on--load', 'actions.core.image.handleLoad' );
202
202
  $w->set_attribute( 'data-wp-effect', 'effects.core.image.setButtonStyles' );
203
+ $w->set_attribute( 'data-wp-effect--setStylesOnResize', 'effects.core.image.setStylesOnResize' );
203
204
  $body_content = $w->get_updated_html();
204
205
 
205
206
  // Wrap the image in the body content with a button.
package/src/image/view.js CHANGED
@@ -105,7 +105,10 @@ store(
105
105
  context.core.image.scrollDelta = 0;
106
106
 
107
107
  context.core.image.lightboxEnabled = true;
108
- setStyles( context, event );
108
+ setStyles(
109
+ context,
110
+ event.target.previousElementSibling
111
+ );
109
112
 
110
113
  context.core.image.scrollTopReset =
111
114
  window.pageYOffset ||
@@ -338,6 +341,15 @@ store(
338
341
  context.core.image.imageButtonHeight = offsetHeight;
339
342
  }
340
343
  },
344
+ setStylesOnResize: ( { state, context, ref } ) => {
345
+ if (
346
+ context.core.image.lightboxEnabled &&
347
+ ( state.core.image.windowWidth ||
348
+ state.core.image.windowHeight )
349
+ ) {
350
+ setStyles( context, ref );
351
+ }
352
+ },
341
353
  },
342
354
  },
343
355
  },
@@ -362,7 +374,7 @@ store(
362
374
  * @param {Object} context - An Interactivity API context
363
375
  * @param {Object} event - A triggering event
364
376
  */
365
- function setStyles( context, event ) {
377
+ function setStyles( context, ref ) {
366
378
  // The reference img element lies adjacent
367
379
  // to the event target button in the DOM.
368
380
  let {
@@ -370,9 +382,8 @@ function setStyles( context, event ) {
370
382
  naturalHeight,
371
383
  offsetWidth: originalWidth,
372
384
  offsetHeight: originalHeight,
373
- } = event.target.previousElementSibling;
374
- let { x: screenPosX, y: screenPosY } =
375
- event.target.previousElementSibling.getBoundingClientRect();
385
+ } = ref;
386
+ let { x: screenPosX, y: screenPosY } = ref.getBoundingClientRect();
376
387
 
377
388
  // Natural ratio of the image clicked to open the lightbox.
378
389
  const naturalRatio = naturalWidth / naturalHeight;
@@ -484,9 +484,10 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
484
484
  .join( ' ' ) }
485
485
  { createInterpolateElement(
486
486
  sprintf(
487
- /* translators: 1: The static string "Read more", 2: The post title only visible to screen readers. */
488
- __( '… <a>%1$s<span>: %2$s</span></a>' ),
489
- __( 'Read more' ),
487
+ /* translators: 1: Hidden accessibility text: Post title */
488
+ __(
489
+ '… <a>Read more<span>: %1$s</span></a>'
490
+ ),
490
491
  titleTrimmed || __( '(no title)' )
491
492
  ),
492
493
  {
@@ -152,10 +152,9 @@ function render_block_core_latest_posts( $attributes ) {
152
152
  if ( $excerpt_length <= $block_core_latest_posts_excerpt_length ) {
153
153
  $trimmed_excerpt = substr( $trimmed_excerpt, 0, -11 );
154
154
  $trimmed_excerpt .= sprintf(
155
- /* translators: 1: A URL to a post, 2: The static string "Read more", 3: The post title only visible to screen readers. */
156
- __( '… <a href="%1$s" rel="noopener noreferrer">%2$s<span class="screen-reader-text">: %3$s</span></a>' ),
155
+ /* translators: 1: A URL to a post, 2: Hidden accessibility text: Post title */
156
+ __( '… <a href="%1$s" rel="noopener noreferrer">Read more<span class="screen-reader-text">: %2$s</span></a>' ),
157
157
  esc_url( $post_link ),
158
- __( 'Read more' ),
159
158
  esc_html( $title )
160
159
  );
161
160
  }
@@ -884,7 +884,6 @@ function Navigation( {
884
884
  <ResponsiveWrapper
885
885
  id={ clientId }
886
886
  onToggle={ setResponsiveMenuVisibility }
887
- label={ __( 'Menu' ) }
888
887
  hasIcon={ hasIcon }
889
888
  icon={ icon }
890
889
  isOpen={ isResponsiveMenuOpen }
@@ -696,9 +696,22 @@ function render_block_core_navigation( $attributes, $content, $block ) {
696
696
  $responsive_dialog_directives = '';
697
697
  $close_button_directives = '';
698
698
  if ( $should_load_view_script ) {
699
+ $nav_element_context = wp_json_encode(
700
+ array(
701
+ 'core' => array(
702
+ 'navigation' => array(
703
+ 'overlayOpenedBy' => array(),
704
+ 'type' => 'overlay',
705
+ 'roleAttribute' => '',
706
+ 'ariaLabel' => __( 'Menu' ),
707
+ ),
708
+ ),
709
+ ),
710
+ JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP
711
+ );
699
712
  $nav_element_directives = '
700
713
  data-wp-interactive
701
- data-wp-context=\'{ "core": { "navigation": { "overlayOpenedBy": {}, "type": "overlay", "roleAttribute": "" } } }\'
714
+ data-wp-context=\'' . $nav_element_context . '\'
702
715
  ';
703
716
  $open_button_directives = '
704
717
  data-wp-on--click="actions.core.navigation.openMenuOnClick"
@@ -714,6 +727,7 @@ function render_block_core_navigation( $attributes, $content, $block ) {
714
727
  ';
715
728
  $responsive_dialog_directives = '
716
729
  data-wp-bind--aria-modal="selectors.core.navigation.ariaModal"
730
+ data-wp-bind--aria-label="selectors.core.navigation.ariaLabel"
717
731
  data-wp-bind--role="selectors.core.navigation.roleAttribute"
718
732
  data-wp-effect="effects.core.navigation.focusFirstElement"
719
733
  ';
@@ -723,11 +737,11 @@ function render_block_core_navigation( $attributes, $content, $block ) {
723
737
  }
724
738
 
725
739
  $responsive_container_markup = sprintf(
726
- '<button aria-haspopup="true" %3$s class="%6$s" %11$s>%9$s</button>
727
- <div class="%5$s" style="%7$s" id="%1$s" %12$s>
740
+ '<button aria-haspopup="true" %3$s class="%6$s" %10$s>%8$s</button>
741
+ <div class="%5$s" style="%7$s" id="%1$s" %11$s>
728
742
  <div class="wp-block-navigation__responsive-close" tabindex="-1">
729
- <div class="wp-block-navigation__responsive-dialog" aria-label="%8$s" %13$s>
730
- <button %4$s class="wp-block-navigation__responsive-container-close" %14$s>%10$s</button>
743
+ <div class="wp-block-navigation__responsive-dialog" %12$s>
744
+ <button %4$s class="wp-block-navigation__responsive-container-close" %13$s>%9$s</button>
731
745
  <div class="wp-block-navigation__responsive-container-content" id="%1$s-content">
732
746
  %2$s
733
747
  </div>
@@ -741,7 +755,6 @@ function render_block_core_navigation( $attributes, $content, $block ) {
741
755
  esc_attr( implode( ' ', $responsive_container_classes ) ),
742
756
  esc_attr( implode( ' ', $open_button_classes ) ),
743
757
  esc_attr( safecss_filter_attr( $colors['overlay_inline_styles'] ) ),
744
- __( 'Menu' ),
745
758
  $toggle_button_content,
746
759
  $toggle_close_button_content,
747
760
  $open_button_directives,
@@ -87,6 +87,13 @@ wpStore( {
87
87
  ? 'true'
88
88
  : null;
89
89
  },
90
+ ariaLabel: ( store ) => {
91
+ const { context, selectors } = store;
92
+ return context.core.navigation.type === 'overlay' &&
93
+ selectors.core.navigation.isMenuOpen( store )
94
+ ? context.core.navigation.ariaLabel
95
+ : null;
96
+ },
90
97
  isMenuOpen: ( { context } ) =>
91
98
  // The menu is opened if either `click`, `hover` or `focus` is true.
92
99
  Object.values(
@@ -34,7 +34,8 @@ function render_block_core_query( $attributes, $content, $block ) {
34
34
  'loadedText' => __( 'Page Loaded.' ),
35
35
  ),
36
36
  ),
37
- )
37
+ ),
38
+ JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP
38
39
  )
39
40
  );
40
41
  $content = $p->get_updated_html();