@wordpress/block-library 8.20.0 → 8.21.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 (277) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +12 -0
  3. package/build/block/index.js +2 -1
  4. package/build/block/index.js.map +1 -1
  5. package/build/code/edit.native.js +8 -2
  6. package/build/code/edit.native.js.map +1 -1
  7. package/build/cover/deprecated.js +110 -1
  8. package/build/cover/deprecated.js.map +1 -1
  9. package/build/cover/edit/index.js +9 -3
  10. package/build/cover/edit/index.js.map +1 -1
  11. package/build/cover/edit/inspector-controls.js +1 -2
  12. package/build/cover/edit/inspector-controls.js.map +1 -1
  13. package/build/cover/index.js +0 -3
  14. package/build/cover/index.js.map +1 -1
  15. package/build/cover/save.js +2 -1
  16. package/build/cover/save.js.map +1 -1
  17. package/build/cover/shared.js +1 -1
  18. package/build/cover/shared.js.map +1 -1
  19. package/build/footnotes/index.js +1 -0
  20. package/build/footnotes/index.js.map +1 -1
  21. package/build/form/edit.js +138 -0
  22. package/build/form/edit.js.map +1 -0
  23. package/build/form/index.js +92 -0
  24. package/build/form/index.js.map +1 -0
  25. package/build/form/init.js +13 -0
  26. package/build/form/init.js.map +1 -0
  27. package/build/form/save.js +28 -0
  28. package/build/form/save.js.map +1 -0
  29. package/build/form/utils.js +24 -0
  30. package/build/form/utils.js.map +1 -0
  31. package/build/form/variations.js +95 -0
  32. package/build/form/variations.js.map +1 -0
  33. package/build/form/view.js +42 -0
  34. package/build/form/view.js.map +1 -0
  35. package/build/form-input/edit.js +124 -0
  36. package/build/form-input/edit.js.map +1 -0
  37. package/build/form-input/index.js +105 -0
  38. package/build/form-input/index.js.map +1 -0
  39. package/build/form-input/init.js +13 -0
  40. package/build/form-input/init.js.map +1 -0
  41. package/build/form-input/save.js +87 -0
  42. package/build/form-input/save.js.map +1 -0
  43. package/build/form-input/variations.js +93 -0
  44. package/build/form-input/variations.js.map +1 -0
  45. package/build/form-submission-notification/edit.js +59 -0
  46. package/build/form-submission-notification/edit.js.map +1 -0
  47. package/build/form-submission-notification/index.js +56 -0
  48. package/build/form-submission-notification/index.js.map +1 -0
  49. package/build/form-submission-notification/init.js +13 -0
  50. package/build/form-submission-notification/init.js.map +1 -0
  51. package/build/form-submission-notification/save.js +33 -0
  52. package/build/form-submission-notification/save.js.map +1 -0
  53. package/build/form-submission-notification/variations.js +63 -0
  54. package/build/form-submission-notification/variations.js.map +1 -0
  55. package/build/form-submit-button/edit.js +32 -0
  56. package/build/form-submit-button/edit.js.map +1 -0
  57. package/build/form-submit-button/index.js +44 -0
  58. package/build/form-submit-button/index.js.map +1 -0
  59. package/build/form-submit-button/init.js +13 -0
  60. package/build/form-submit-button/init.js.map +1 -0
  61. package/build/form-submit-button/save.js +22 -0
  62. package/build/form-submit-button/save.js.map +1 -0
  63. package/build/group/index.js +0 -1
  64. package/build/group/index.js.map +1 -1
  65. package/build/heading/index.js +3 -2
  66. package/build/heading/index.js.map +1 -1
  67. package/build/image/image.js +4 -1
  68. package/build/image/image.js.map +1 -1
  69. package/build/image/view.js +82 -40
  70. package/build/image/view.js.map +1 -1
  71. package/build/index.js +10 -0
  72. package/build/index.js.map +1 -1
  73. package/build/latest-posts/edit.js +6 -2
  74. package/build/latest-posts/edit.js.map +1 -1
  75. package/build/list-item/hooks/use-merge.js +15 -15
  76. package/build/list-item/hooks/use-merge.js.map +1 -1
  77. package/build/lock-unlock.js +1 -1
  78. package/build/lock-unlock.js.map +1 -1
  79. package/build/missing/edit.native.js +14 -62
  80. package/build/missing/edit.native.js.map +1 -1
  81. package/build/navigation/edit/index.js +0 -1
  82. package/build/navigation/edit/index.js.map +1 -1
  83. package/build/navigation/index.js +2 -1
  84. package/build/navigation/index.js.map +1 -1
  85. package/build/navigation/view.js +27 -5
  86. package/build/navigation/view.js.map +1 -1
  87. package/build/page-list-item/edit.js +3 -1
  88. package/build/page-list-item/edit.js.map +1 -1
  89. package/build/paragraph/index.js +7 -0
  90. package/build/paragraph/index.js.map +1 -1
  91. package/build/pattern/index.js +2 -1
  92. package/build/pattern/index.js.map +1 -1
  93. package/build/template-part/index.js +2 -1
  94. package/build/template-part/index.js.map +1 -1
  95. package/build-module/block/index.js +2 -1
  96. package/build-module/block/index.js.map +1 -1
  97. package/build-module/code/edit.native.js +8 -2
  98. package/build-module/code/edit.native.js.map +1 -1
  99. package/build-module/cover/deprecated.js +110 -1
  100. package/build-module/cover/deprecated.js.map +1 -1
  101. package/build-module/cover/edit/index.js +9 -3
  102. package/build-module/cover/edit/index.js.map +1 -1
  103. package/build-module/cover/edit/inspector-controls.js +1 -2
  104. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  105. package/build-module/cover/index.js +0 -3
  106. package/build-module/cover/index.js.map +1 -1
  107. package/build-module/cover/save.js +2 -1
  108. package/build-module/cover/save.js.map +1 -1
  109. package/build-module/cover/shared.js +1 -1
  110. package/build-module/cover/shared.js.map +1 -1
  111. package/build-module/footnotes/index.js +1 -0
  112. package/build-module/footnotes/index.js.map +1 -1
  113. package/build-module/form/edit.js +130 -0
  114. package/build-module/form/edit.js.map +1 -0
  115. package/build-module/form/index.js +82 -0
  116. package/build-module/form/index.js.map +1 -0
  117. package/build-module/form/init.js +6 -0
  118. package/build-module/form/init.js.map +1 -0
  119. package/build-module/form/save.js +20 -0
  120. package/build-module/form/save.js.map +1 -0
  121. package/build-module/form/utils.js +15 -0
  122. package/build-module/form/utils.js.map +1 -0
  123. package/build-module/form/variations.js +86 -0
  124. package/build-module/form/variations.js.map +1 -0
  125. package/build-module/form/view.js +40 -0
  126. package/build-module/form/view.js.map +1 -0
  127. package/build-module/form-input/edit.js +115 -0
  128. package/build-module/form-input/edit.js.map +1 -0
  129. package/build-module/form-input/index.js +95 -0
  130. package/build-module/form-input/index.js.map +1 -0
  131. package/build-module/form-input/init.js +6 -0
  132. package/build-module/form-input/init.js.map +1 -0
  133. package/build-module/form-input/save.js +80 -0
  134. package/build-module/form-input/save.js.map +1 -0
  135. package/build-module/form-input/variations.js +85 -0
  136. package/build-module/form-input/variations.js.map +1 -0
  137. package/build-module/form-submission-notification/edit.js +50 -0
  138. package/build-module/form-submission-notification/edit.js.map +1 -0
  139. package/build-module/form-submission-notification/index.js +47 -0
  140. package/build-module/form-submission-notification/index.js.map +1 -0
  141. package/build-module/form-submission-notification/init.js +6 -0
  142. package/build-module/form-submission-notification/init.js.map +1 -0
  143. package/build-module/form-submission-notification/save.js +25 -0
  144. package/build-module/form-submission-notification/save.js.map +1 -0
  145. package/build-module/form-submission-notification/variations.js +55 -0
  146. package/build-module/form-submission-notification/variations.js.map +1 -0
  147. package/build-module/form-submit-button/edit.js +24 -0
  148. package/build-module/form-submit-button/edit.js.map +1 -0
  149. package/build-module/form-submit-button/index.js +34 -0
  150. package/build-module/form-submit-button/index.js.map +1 -0
  151. package/build-module/form-submit-button/init.js +6 -0
  152. package/build-module/form-submit-button/init.js.map +1 -0
  153. package/build-module/form-submit-button/save.js +14 -0
  154. package/build-module/form-submit-button/save.js.map +1 -0
  155. package/build-module/group/index.js +0 -1
  156. package/build-module/group/index.js.map +1 -1
  157. package/build-module/heading/index.js +3 -2
  158. package/build-module/heading/index.js.map +1 -1
  159. package/build-module/image/image.js +4 -1
  160. package/build-module/image/image.js.map +1 -1
  161. package/build-module/image/view.js +82 -40
  162. package/build-module/image/view.js.map +1 -1
  163. package/build-module/index.js +10 -0
  164. package/build-module/index.js.map +1 -1
  165. package/build-module/latest-posts/edit.js +6 -2
  166. package/build-module/latest-posts/edit.js.map +1 -1
  167. package/build-module/list-item/hooks/use-merge.js +15 -15
  168. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  169. package/build-module/lock-unlock.js +1 -1
  170. package/build-module/lock-unlock.js.map +1 -1
  171. package/build-module/missing/edit.native.js +17 -65
  172. package/build-module/missing/edit.native.js.map +1 -1
  173. package/build-module/navigation/edit/index.js +0 -1
  174. package/build-module/navigation/edit/index.js.map +1 -1
  175. package/build-module/navigation/index.js +2 -1
  176. package/build-module/navigation/index.js.map +1 -1
  177. package/build-module/navigation/view.js +27 -5
  178. package/build-module/navigation/view.js.map +1 -1
  179. package/build-module/page-list-item/edit.js +3 -1
  180. package/build-module/page-list-item/edit.js.map +1 -1
  181. package/build-module/paragraph/index.js +7 -0
  182. package/build-module/paragraph/index.js.map +1 -1
  183. package/build-module/pattern/index.js +2 -1
  184. package/build-module/pattern/index.js.map +1 -1
  185. package/build-module/template-part/index.js +2 -1
  186. package/build-module/template-part/index.js.map +1 -1
  187. package/build-style/editor-rtl.css +50 -0
  188. package/build-style/editor.css +50 -0
  189. package/build-style/form-input/editor-rtl.css +106 -0
  190. package/build-style/form-input/editor.css +106 -0
  191. package/build-style/form-input/style-rtl.css +135 -0
  192. package/build-style/form-input/style.css +135 -0
  193. package/build-style/form-submission-notification/editor-rtl.css +118 -0
  194. package/build-style/form-submission-notification/editor.css +118 -0
  195. package/build-style/form-submit-button/style-rtl.css +91 -0
  196. package/build-style/form-submit-button/style.css +91 -0
  197. package/build-style/image/style-rtl.css +39 -5
  198. package/build-style/image/style.css +39 -5
  199. package/build-style/query/style-rtl.css +0 -10
  200. package/build-style/query/style.css +0 -10
  201. package/build-style/style-rtl.css +87 -5
  202. package/build-style/style.css +87 -5
  203. package/package.json +32 -32
  204. package/src/block/block.json +2 -1
  205. package/src/code/edit.native.js +15 -1
  206. package/src/cover/block.json +0 -3
  207. package/src/cover/deprecated.js +151 -1
  208. package/src/cover/edit/index.js +12 -3
  209. package/src/cover/edit/inspector-controls.js +19 -25
  210. package/src/cover/save.js +2 -1
  211. package/src/cover/shared.js +1 -1
  212. package/src/editor.scss +2 -0
  213. package/src/footnotes/block.json +1 -0
  214. package/src/form/block.json +60 -0
  215. package/src/form/edit.js +179 -0
  216. package/src/form/index.js +20 -0
  217. package/src/form/index.php +214 -0
  218. package/src/form/init.js +6 -0
  219. package/src/form/save.js +20 -0
  220. package/src/form/utils.js +39 -0
  221. package/src/form/variations.js +139 -0
  222. package/src/form/view.js +41 -0
  223. package/src/form-input/block.json +73 -0
  224. package/src/form-input/edit.js +151 -0
  225. package/src/form-input/editor.scss +24 -0
  226. package/src/form-input/index.js +20 -0
  227. package/src/form-input/index.php +45 -0
  228. package/src/form-input/init.js +6 -0
  229. package/src/form-input/save.js +83 -0
  230. package/src/form-input/style.scss +61 -0
  231. package/src/form-input/variations.js +82 -0
  232. package/src/form-submission-notification/block.json +19 -0
  233. package/src/form-submission-notification/edit.js +63 -0
  234. package/src/form-submission-notification/editor.scss +45 -0
  235. package/src/form-submission-notification/index.js +26 -0
  236. package/src/form-submission-notification/index.php +48 -0
  237. package/src/form-submission-notification/init.js +6 -0
  238. package/src/form-submission-notification/save.js +28 -0
  239. package/src/form-submission-notification/variations.js +59 -0
  240. package/src/form-submit-button/block.json +14 -0
  241. package/src/form-submit-button/edit.js +33 -0
  242. package/src/form-submit-button/index.js +18 -0
  243. package/src/form-submit-button/init.js +6 -0
  244. package/src/form-submit-button/save.js +14 -0
  245. package/src/form-submit-button/style.scss +3 -0
  246. package/src/group/block.json +0 -1
  247. package/src/heading/index.js +4 -2
  248. package/src/image/image.js +10 -0
  249. package/src/image/index.php +128 -82
  250. package/src/image/style.scss +49 -5
  251. package/src/image/view.js +100 -52
  252. package/src/index.js +10 -0
  253. package/src/latest-posts/edit.js +11 -2
  254. package/src/latest-posts/index.php +17 -8
  255. package/src/list-item/hooks/use-merge.js +20 -23
  256. package/src/lock-unlock.js +1 -1
  257. package/src/missing/edit.native.js +17 -115
  258. package/src/missing/style.native.scss +0 -67
  259. package/src/missing/test/edit-integration.native.js +135 -49
  260. package/src/missing/test/edit.native.js +0 -41
  261. package/src/navigation/block.json +2 -1
  262. package/src/navigation/edit/index.js +0 -1
  263. package/src/navigation/index.php +28 -8
  264. package/src/navigation/view.js +25 -6
  265. package/src/page-list-item/edit.js +2 -0
  266. package/src/paragraph/index.js +10 -0
  267. package/src/pattern/block.json +2 -1
  268. package/src/pattern/index.php +0 -3
  269. package/src/post-navigation-link/index.php +2 -1
  270. package/src/preformatted/test/edit.native.js +38 -0
  271. package/src/query/index.php +3 -2
  272. package/src/query/style.scss +0 -11
  273. package/src/search/index.php +0 -4
  274. package/src/style.scss +1 -0
  275. package/src/template-part/block.json +2 -1
  276. package/src/template-part/index.php +4 -7
  277. package/src/verse/test/edit.native.js +37 -0
@@ -87,8 +87,9 @@ store({
87
87
  context.core.image.initialized = true;
88
88
  context.core.image.lastFocusedElement = window.document.activeElement;
89
89
  context.core.image.scrollDelta = 0;
90
+ context.core.image.pointerType = event.pointerType;
90
91
  context.core.image.lightboxEnabled = true;
91
- setStyles(context, event);
92
+ setStyles(context, context.core.image.imageRef);
92
93
  context.core.image.scrollTopReset = window.pageYOffset || document.documentElement.scrollTop;
93
94
 
94
95
  // In most cases, this value will be 0, but this is included
@@ -109,7 +110,8 @@ store({
109
110
  window.addEventListener('scroll', scrollCallback, false);
110
111
  },
111
112
  hideLightbox: async ({
112
- context
113
+ context,
114
+ event
113
115
  }) => {
114
116
  context.core.image.hideAnimationEnabled = true;
115
117
  if (context.core.image.lightboxEnabled) {
@@ -123,9 +125,16 @@ store({
123
125
  window.removeEventListener('scroll', scrollCallback);
124
126
  }, 450);
125
127
  context.core.image.lightboxEnabled = false;
126
- context.core.image.lastFocusedElement.focus({
127
- preventScroll: true
128
- });
128
+
129
+ // We want to avoid drawing attention to the button
130
+ // after the lightbox closes for mouse and touch users.
131
+ // Note that the `event.pointerType` property returns
132
+ // as an empty string if a keyboard fired the event.
133
+ if (event.pointerType === '') {
134
+ context.core.image.lastFocusedElement.focus({
135
+ preventScroll: true
136
+ });
137
+ }
129
138
  }
130
139
  },
131
140
  handleKeydown: ({
@@ -152,8 +161,9 @@ store({
152
161
  }
153
162
  }
154
163
  },
164
+ // This is fired just by lazily loaded
165
+ // images on the page, not all images.
155
166
  handleLoad: ({
156
- state,
157
167
  context,
158
168
  effects,
159
169
  ref
@@ -161,7 +171,6 @@ store({
161
171
  context.core.image.imageLoaded = true;
162
172
  context.core.image.imageCurrentSrc = ref.currentSrc;
163
173
  effects.core.image.setButtonStyles({
164
- state,
165
174
  context,
166
175
  ref
167
176
  });
@@ -199,7 +208,17 @@ store({
199
208
  roleAttribute: ({
200
209
  context
201
210
  }) => {
202
- return context.core.image.lightboxEnabled ? 'dialog' : '';
211
+ return context.core.image.lightboxEnabled ? 'dialog' : null;
212
+ },
213
+ ariaModal: ({
214
+ context
215
+ }) => {
216
+ return context.core.image.lightboxEnabled ? 'true' : null;
217
+ },
218
+ dialogLabel: ({
219
+ context
220
+ }) => {
221
+ return context.core.image.lightboxEnabled ? context.core.image.dialogLabel : null;
203
222
  },
204
223
  lightboxObjectFit: ({
205
224
  context
@@ -211,7 +230,7 @@ store({
211
230
  enlargedImgSrc: ({
212
231
  context
213
232
  }) => {
214
- return context.core.image.initialized ? context.core.image.imageUploadedSrc : '';
233
+ return context.core.image.initialized ? context.core.image.imageUploadedSrc : 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';
215
234
  }
216
235
  }
217
236
  }
@@ -219,10 +238,11 @@ store({
219
238
  effects: {
220
239
  core: {
221
240
  image: {
222
- setCurrentSrc: ({
241
+ initOriginImage: ({
223
242
  context,
224
243
  ref
225
244
  }) => {
245
+ context.core.image.imageRef = ref;
226
246
  if (ref.complete) {
227
247
  context.core.image.imageLoaded = true;
228
248
  context.core.image.imageCurrentSrc = ref.currentSrc;
@@ -232,17 +252,22 @@ store({
232
252
  context,
233
253
  ref
234
254
  }) => {
235
- context.core.image.figureRef = ref.querySelector('figure');
236
- context.core.image.imageRef = ref.querySelector('img');
237
255
  if (context.core.image.lightboxEnabled) {
238
256
  const focusableElements = ref.querySelectorAll(focusableSelectors);
239
257
  context.core.image.firstFocusableElement = focusableElements[0];
240
258
  context.core.image.lastFocusableElement = focusableElements[focusableElements.length - 1];
241
- ref.querySelector('.close-button').focus();
259
+
260
+ // We want to avoid drawing unnecessary attention to the close
261
+ // button for mouse and touch users. Note that even if opening
262
+ // the lightbox via keyboard, the event fired is of type
263
+ // `pointerEvent`, so we need to rely on the `event.pointerType`
264
+ // property, which returns an empty string for keyboard events.
265
+ if (context.core.image.pointerType === '') {
266
+ ref.querySelector('.close-button').focus();
267
+ }
242
268
  }
243
269
  },
244
270
  setButtonStyles: ({
245
- state,
246
271
  context,
247
272
  ref
248
273
  }) => {
@@ -254,43 +279,60 @@ store({
254
279
  } = ref;
255
280
 
256
281
  // If the image isn't loaded yet, we can't
257
- // calculate how big the button should be.
282
+ // calculate where the button should be.
258
283
  if (naturalWidth === 0 || naturalHeight === 0) {
259
284
  return;
260
285
  }
286
+ const figure = ref.parentElement;
287
+ const figureWidth = ref.parentElement.clientWidth;
261
288
 
262
- // Subscribe to the window dimensions so we can
263
- // recalculate the styles if the window is resized.
264
- if ((state.core.image.windowWidth || state.core.image.windowHeight) && context.core.image.scaleAttr === 'contain') {
265
- // In the case of an image with object-fit: contain, the
266
- // size of the img element can be larger than the image itself,
267
- // so we need to calculate the size of the button to match.
289
+ // We need special handling for the height because
290
+ // a caption will cause the figure to be taller than
291
+ // the image, which means we need to account for that
292
+ // when calculating the placement of the button in the
293
+ // top right corner of the image.
294
+ let figureHeight = ref.parentElement.clientHeight;
295
+ const caption = figure.querySelector('figcaption');
296
+ if (caption) {
297
+ const captionComputedStyle = window.getComputedStyle(caption);
298
+ figureHeight = figureHeight - caption.offsetHeight - parseFloat(captionComputedStyle.marginTop) - parseFloat(captionComputedStyle.marginBottom);
299
+ }
300
+ const buttonOffsetTop = figureHeight - offsetHeight;
301
+ const buttonOffsetRight = figureWidth - offsetWidth;
268
302
 
303
+ // In the case of an image with object-fit: contain, the
304
+ // size of the <img> element can be larger than the image itself,
305
+ // so we need to calculate where to place the button.
306
+ if (context.core.image.scaleAttr === 'contain') {
269
307
  // Natural ratio of the image.
270
308
  const naturalRatio = naturalWidth / naturalHeight;
271
309
  // Offset ratio of the image.
272
310
  const offsetRatio = offsetWidth / offsetHeight;
273
- if (naturalRatio > offsetRatio) {
311
+ if (naturalRatio >= offsetRatio) {
274
312
  // If it reaches the width first, keep
275
- // the width and recalculate the height.
276
- context.core.image.imageButtonWidth = offsetWidth;
277
- const buttonHeight = offsetWidth / naturalRatio;
278
- context.core.image.imageButtonHeight = buttonHeight;
279
- context.core.image.imageButtonTop = (offsetHeight - buttonHeight) / 2;
313
+ // the width and compute the height.
314
+ const referenceHeight = offsetWidth / naturalRatio;
315
+ context.core.image.imageButtonTop = (offsetHeight - referenceHeight) / 2 + buttonOffsetTop + 10;
316
+ context.core.image.imageButtonRight = buttonOffsetRight + 10;
280
317
  } else {
281
318
  // If it reaches the height first, keep
282
- // the height and recalculate the width.
283
- context.core.image.imageButtonHeight = offsetHeight;
284
- const buttonWidth = offsetHeight * naturalRatio;
285
- context.core.image.imageButtonWidth = buttonWidth;
286
- context.core.image.imageButtonLeft = (offsetWidth - buttonWidth) / 2;
319
+ // the height and compute the width.
320
+ const referenceWidth = offsetHeight * naturalRatio;
321
+ context.core.image.imageButtonTop = buttonOffsetTop + 10;
322
+ context.core.image.imageButtonRight = (offsetWidth - referenceWidth) / 2 + buttonOffsetRight + 10;
287
323
  }
288
324
  } else {
289
- // In all other cases, we can trust that the size of
290
- // the image is the right size for the button as well.
291
-
292
- context.core.image.imageButtonWidth = offsetWidth;
293
- context.core.image.imageButtonHeight = offsetHeight;
325
+ context.core.image.imageButtonTop = buttonOffsetTop + 10;
326
+ context.core.image.imageButtonRight = buttonOffsetRight + 10;
327
+ }
328
+ },
329
+ setStylesOnResize: ({
330
+ state,
331
+ context,
332
+ ref
333
+ }) => {
334
+ if (context.core.image.lightboxEnabled && (state.core.image.windowWidth || state.core.image.windowHeight)) {
335
+ setStyles(context, ref);
294
336
  }
295
337
  }
296
338
  }
@@ -314,7 +356,7 @@ store({
314
356
  * @param {Object} context - An Interactivity API context
315
357
  * @param {Object} event - A triggering event
316
358
  */
317
- function setStyles(context, event) {
359
+ function setStyles(context, ref) {
318
360
  // The reference img element lies adjacent
319
361
  // to the event target button in the DOM.
320
362
  let {
@@ -322,11 +364,11 @@ function setStyles(context, event) {
322
364
  naturalHeight,
323
365
  offsetWidth: originalWidth,
324
366
  offsetHeight: originalHeight
325
- } = event.target.nextElementSibling;
367
+ } = ref;
326
368
  let {
327
369
  x: screenPosX,
328
370
  y: screenPosY
329
- } = event.target.nextElementSibling.getBoundingClientRect();
371
+ } = ref.getBoundingClientRect();
330
372
 
331
373
  // Natural ratio of the image clicked to open the lightbox.
332
374
  const naturalRatio = naturalWidth / naturalHeight;
@@ -1 +1 @@
1
- {"version":3,"names":["store","focusableSelectors","scrollCallback","isTouching","lastTouchTime","handleScroll","context","Date","now","window","scrollTo","core","image","scrollLeftReset","scrollTopReset","state","windowWidth","innerWidth","windowHeight","innerHeight","actions","showLightbox","event","imageLoaded","initialized","lastFocusedElement","document","activeElement","scrollDelta","lightboxEnabled","setStyles","pageYOffset","documentElement","scrollTop","pageXOffset","scrollLeft","bind","addEventListener","hideLightbox","hideAnimationEnabled","setTimeout","removeEventListener","focus","preventScroll","handleKeydown","key","keyCode","shiftKey","firstFocusableElement","preventDefault","lastFocusableElement","handleLoad","effects","ref","imageCurrentSrc","currentSrc","setButtonStyles","handleTouchStart","handleTouchMove","handleTouchEnd","selectors","roleAttribute","lightboxObjectFit","enlargedImgSrc","imageUploadedSrc","setCurrentSrc","complete","initLightbox","figureRef","querySelector","imageRef","focusableElements","querySelectorAll","length","naturalWidth","naturalHeight","offsetWidth","offsetHeight","scaleAttr","naturalRatio","offsetRatio","imageButtonWidth","buttonHeight","imageButtonHeight","imageButtonTop","buttonWidth","imageButtonLeft","afterLoad","debounce","originalWidth","originalHeight","target","nextElementSibling","x","screenPosX","y","screenPosY","getBoundingClientRect","originalRatio","heightWithoutSpace","widthWithoutSpace","imgMaxWidth","parseFloat","targetWidth","imgMaxHeight","targetHeight","imgRatio","containerMaxWidth","containerMaxHeight","containerWidth","containerHeight","toFixed","reducedHeight","reducedWidth","horizontalPadding","verticalPadding","targetMaxWidth","Math","min","targetMaxHeight","targetContainerRatio","containerScale","lightboxImgWidth","lightboxImgHeight","styleTag","getElementById","createElement","id","head","appendChild","innerHTML","func","wait","timeout","later","clearTimeout"],"sources":["@wordpress/block-library/src/image/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store } from '@wordpress/interactivity';\n\nconst focusableSelectors = [\n\t'a[href]',\n\t'area[href]',\n\t'input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden])',\n\t'select:not([disabled]):not([aria-hidden])',\n\t'textarea:not([disabled]):not([aria-hidden])',\n\t'button:not([disabled]):not([aria-hidden])',\n\t'iframe',\n\t'object',\n\t'embed',\n\t'[contenteditable]',\n\t'[tabindex]:not([tabindex^=\"-\"])',\n];\n\n/*\n * Stores a context-bound scroll handler.\n *\n * This callback could be defined inline inside of the store\n * object but it's created externally to avoid confusion about\n * how its logic is called. This logic is not referenced directly\n * by the directives in the markup because the scroll event we\n * need to listen to is triggered on the window; so by defining it\n * outside of the store, we signal that the behavior here is different.\n * If we find a compelling reason to move it to the store, feel free.\n *\n * @type {Function}\n */\nlet scrollCallback;\n\n/*\n * Tracks whether user is touching screen; used to\n * differentiate behavior for touch and mouse input.\n *\n * @type {boolean}\n */\nlet isTouching = false;\n\n/*\n * Tracks the last time the screen was touched; used to\n * differentiate behavior for touch and mouse input.\n *\n * @type {number}\n */\nlet lastTouchTime = 0;\n\n/*\n * Lightbox page-scroll handler: prevents scrolling.\n *\n * This handler is added to prevent scrolling behaviors that\n * trigger content shift while the lightbox is open.\n *\n * It would be better to accomplish this through CSS alone, but\n * using overflow: hidden is currently the only way to do so, and\n * that causes the layout to shift and prevents the zoom animation\n * from working in some cases because we're unable to account for\n * the layout shift when doing the animation calculations. Instead,\n * here we use JavaScript to prevent and reset the scrolling\n * behavior. In the future, we may be able to use CSS or overflow: hidden\n * instead to not rely on JavaScript, but this seems to be the best approach\n * for now that provides the best visual experience.\n *\n * @param {Object} context Interactivity page context?\n */\nfunction handleScroll( context ) {\n\t// We can't override the scroll behavior on mobile devices\n\t// because doing so breaks the pinch to zoom functionality, and we\n\t// want to allow users to zoom in further on the high-res image.\n\tif ( ! isTouching && Date.now() - lastTouchTime > 450 ) {\n\t\t// We are unable to use event.preventDefault() to prevent scrolling\n\t\t// because the scroll event can't be canceled, so we reset the position instead.\n\t\twindow.scrollTo(\n\t\t\tcontext.core.image.scrollLeftReset,\n\t\t\tcontext.core.image.scrollTopReset\n\t\t);\n\t}\n}\n\nstore(\n\t{\n\t\tstate: {\n\t\t\tcore: {\n\t\t\t\timage: {\n\t\t\t\t\twindowWidth: window.innerWidth,\n\t\t\t\t\twindowHeight: window.innerHeight,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\tcore: {\n\t\t\t\timage: {\n\t\t\t\t\tshowLightbox: ( { context, event } ) => {\n\t\t\t\t\t\t// We can't initialize the lightbox until the reference\n\t\t\t\t\t\t// image is loaded, otherwise the UX is broken.\n\t\t\t\t\t\tif ( ! context.core.image.imageLoaded ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontext.core.image.initialized = true;\n\t\t\t\t\t\tcontext.core.image.lastFocusedElement =\n\t\t\t\t\t\t\twindow.document.activeElement;\n\t\t\t\t\t\tcontext.core.image.scrollDelta = 0;\n\n\t\t\t\t\t\tcontext.core.image.lightboxEnabled = true;\n\t\t\t\t\t\tsetStyles( context, event );\n\n\t\t\t\t\t\tcontext.core.image.scrollTopReset =\n\t\t\t\t\t\t\twindow.pageYOffset ||\n\t\t\t\t\t\t\tdocument.documentElement.scrollTop;\n\n\t\t\t\t\t\t// In most cases, this value will be 0, but this is included\n\t\t\t\t\t\t// in case a user has created a page with horizontal scrolling.\n\t\t\t\t\t\tcontext.core.image.scrollLeftReset =\n\t\t\t\t\t\t\twindow.pageXOffset ||\n\t\t\t\t\t\t\tdocument.documentElement.scrollLeft;\n\n\t\t\t\t\t\t// We define and bind the scroll callback here so\n\t\t\t\t\t\t// that we can pass the context and as an argument.\n\t\t\t\t\t\t// We may be able to change this in the future if we\n\t\t\t\t\t\t// define the scroll callback in the store instead, but\n\t\t\t\t\t\t// this approach seems to tbe clearest for now.\n\t\t\t\t\t\tscrollCallback = handleScroll.bind( null, context );\n\n\t\t\t\t\t\t// We need to add a scroll event listener to the window\n\t\t\t\t\t\t// here because we are unable to otherwise access it via\n\t\t\t\t\t\t// the Interactivity API directives. If we add a native way\n\t\t\t\t\t\t// to access the window, we can remove this.\n\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t'scroll',\n\t\t\t\t\t\t\tscrollCallback,\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\thideLightbox: async ( { context } ) => {\n\t\t\t\t\t\tcontext.core.image.hideAnimationEnabled = true;\n\t\t\t\t\t\tif ( context.core.image.lightboxEnabled ) {\n\t\t\t\t\t\t\t// We want to wait until the close animation is completed\n\t\t\t\t\t\t\t// before allowing a user to scroll again. The duration of this\n\t\t\t\t\t\t\t// animation is defined in the styles.scss and depends on if the\n\t\t\t\t\t\t\t// animation is 'zoom' or 'fade', but in any case we should wait\n\t\t\t\t\t\t\t// a few milliseconds longer than the duration, otherwise a user\n\t\t\t\t\t\t\t// may scroll too soon and cause the animation to look sloppy.\n\t\t\t\t\t\t\tsetTimeout( function () {\n\t\t\t\t\t\t\t\twindow.removeEventListener(\n\t\t\t\t\t\t\t\t\t'scroll',\n\t\t\t\t\t\t\t\t\tscrollCallback\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}, 450 );\n\n\t\t\t\t\t\t\tcontext.core.image.lightboxEnabled = false;\n\t\t\t\t\t\t\tcontext.core.image.lastFocusedElement.focus( {\n\t\t\t\t\t\t\t\tpreventScroll: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\thandleKeydown: ( { context, actions, event } ) => {\n\t\t\t\t\t\tif ( context.core.image.lightboxEnabled ) {\n\t\t\t\t\t\t\tif ( event.key === 'Tab' || event.keyCode === 9 ) {\n\t\t\t\t\t\t\t\t// If shift + tab it change the direction\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tevent.shiftKey &&\n\t\t\t\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\t\t\t\tcontext.core.image.firstFocusableElement\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\tcontext.core.image.lastFocusableElement.focus();\n\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\t! event.shiftKey &&\n\t\t\t\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\t\t\t\tcontext.core.image.lastFocusableElement\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\tcontext.core.image.firstFocusableElement.focus();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tevent.key === 'Escape' ||\n\t\t\t\t\t\t\t\tevent.keyCode === 27\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tactions.core.image.hideLightbox( {\n\t\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\thandleLoad: ( { state, context, effects, ref } ) => {\n\t\t\t\t\t\tcontext.core.image.imageLoaded = true;\n\t\t\t\t\t\tcontext.core.image.imageCurrentSrc = ref.currentSrc;\n\t\t\t\t\t\teffects.core.image.setButtonStyles( {\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t} );\n\t\t\t\t\t},\n\t\t\t\t\thandleTouchStart: () => {\n\t\t\t\t\t\tisTouching = true;\n\t\t\t\t\t},\n\t\t\t\t\thandleTouchMove: ( { context, event } ) => {\n\t\t\t\t\t\t// On mobile devices, we want to prevent triggering the\n\t\t\t\t\t\t// scroll event because otherwise the page jumps around as\n\t\t\t\t\t\t// we reset the scroll position. This also means that closing\n\t\t\t\t\t\t// the lightbox requires that a user perform a simple tap. This\n\t\t\t\t\t\t// may be changed in the future if we find a better alternative\n\t\t\t\t\t\t// to override or reset the scroll position during swipe actions.\n\t\t\t\t\t\tif ( context.core.image.lightboxEnabled ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\thandleTouchEnd: () => {\n\t\t\t\t\t\t// We need to wait a few milliseconds before resetting\n\t\t\t\t\t\t// to ensure that pinch to zoom works consistently\n\t\t\t\t\t\t// on mobile devices when the lightbox is open.\n\t\t\t\t\t\tlastTouchTime = Date.now();\n\t\t\t\t\t\tisTouching = false;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tselectors: {\n\t\t\tcore: {\n\t\t\t\timage: {\n\t\t\t\t\troleAttribute: ( { context } ) => {\n\t\t\t\t\t\treturn context.core.image.lightboxEnabled\n\t\t\t\t\t\t\t? 'dialog'\n\t\t\t\t\t\t\t: '';\n\t\t\t\t\t},\n\t\t\t\t\tlightboxObjectFit: ( { context } ) => {\n\t\t\t\t\t\tif ( context.core.image.initialized ) {\n\t\t\t\t\t\t\treturn 'cover';\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tenlargedImgSrc: ( { context } ) => {\n\t\t\t\t\t\treturn context.core.image.initialized\n\t\t\t\t\t\t\t? context.core.image.imageUploadedSrc\n\t\t\t\t\t\t\t: '';\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\teffects: {\n\t\t\tcore: {\n\t\t\t\timage: {\n\t\t\t\t\tsetCurrentSrc: ( { context, ref } ) => {\n\t\t\t\t\t\tif ( ref.complete ) {\n\t\t\t\t\t\t\tcontext.core.image.imageLoaded = true;\n\t\t\t\t\t\t\tcontext.core.image.imageCurrentSrc = ref.currentSrc;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tinitLightbox: async ( { context, ref } ) => {\n\t\t\t\t\t\tcontext.core.image.figureRef =\n\t\t\t\t\t\t\tref.querySelector( 'figure' );\n\t\t\t\t\t\tcontext.core.image.imageRef =\n\t\t\t\t\t\t\tref.querySelector( 'img' );\n\t\t\t\t\t\tif ( context.core.image.lightboxEnabled ) {\n\t\t\t\t\t\t\tconst focusableElements =\n\t\t\t\t\t\t\t\tref.querySelectorAll( focusableSelectors );\n\t\t\t\t\t\t\tcontext.core.image.firstFocusableElement =\n\t\t\t\t\t\t\t\tfocusableElements[ 0 ];\n\t\t\t\t\t\t\tcontext.core.image.lastFocusableElement =\n\t\t\t\t\t\t\t\tfocusableElements[\n\t\t\t\t\t\t\t\t\tfocusableElements.length - 1\n\t\t\t\t\t\t\t\t];\n\n\t\t\t\t\t\t\tref.querySelector( '.close-button' ).focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tsetButtonStyles: ( { state, context, ref } ) => {\n\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\tnaturalWidth,\n\t\t\t\t\t\t\tnaturalHeight,\n\t\t\t\t\t\t\toffsetWidth,\n\t\t\t\t\t\t\toffsetHeight,\n\t\t\t\t\t\t} = ref;\n\n\t\t\t\t\t\t// If the image isn't loaded yet, we can't\n\t\t\t\t\t\t// calculate how big the button should be.\n\t\t\t\t\t\tif ( naturalWidth === 0 || naturalHeight === 0 ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Subscribe to the window dimensions so we can\n\t\t\t\t\t\t// recalculate the styles if the window is resized.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t( state.core.image.windowWidth ||\n\t\t\t\t\t\t\t\tstate.core.image.windowHeight ) &&\n\t\t\t\t\t\t\tcontext.core.image.scaleAttr === 'contain'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// In the case of an image with object-fit: contain, the\n\t\t\t\t\t\t\t// size of the img element can be larger than the image itself,\n\t\t\t\t\t\t\t// so we need to calculate the size of the button to match.\n\n\t\t\t\t\t\t\t// Natural ratio of the image.\n\t\t\t\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t\t\t\t// Offset ratio of the image.\n\t\t\t\t\t\t\tconst offsetRatio = offsetWidth / offsetHeight;\n\n\t\t\t\t\t\t\tif ( naturalRatio > offsetRatio ) {\n\t\t\t\t\t\t\t\t// If it reaches the width first, keep\n\t\t\t\t\t\t\t\t// the width and recalculate the height.\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonWidth =\n\t\t\t\t\t\t\t\t\toffsetWidth;\n\t\t\t\t\t\t\t\tconst buttonHeight = offsetWidth / naturalRatio;\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonHeight =\n\t\t\t\t\t\t\t\t\tbuttonHeight;\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonTop =\n\t\t\t\t\t\t\t\t\t( offsetHeight - buttonHeight ) / 2;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// If it reaches the height first, keep\n\t\t\t\t\t\t\t\t// the height and recalculate the width.\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonHeight =\n\t\t\t\t\t\t\t\t\toffsetHeight;\n\t\t\t\t\t\t\t\tconst buttonWidth = offsetHeight * naturalRatio;\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonWidth =\n\t\t\t\t\t\t\t\t\tbuttonWidth;\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonLeft =\n\t\t\t\t\t\t\t\t\t( offsetWidth - buttonWidth ) / 2;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// In all other cases, we can trust that the size of\n\t\t\t\t\t\t\t// the image is the right size for the button as well.\n\n\t\t\t\t\t\t\tcontext.core.image.imageButtonWidth = offsetWidth;\n\t\t\t\t\t\t\tcontext.core.image.imageButtonHeight = offsetHeight;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tafterLoad: ( { state } ) => {\n\t\t\twindow.addEventListener(\n\t\t\t\t'resize',\n\t\t\t\tdebounce( () => {\n\t\t\t\t\tstate.core.image.windowWidth = window.innerWidth;\n\t\t\t\t\tstate.core.image.windowHeight = window.innerHeight;\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t}\n);\n\n/*\n * Computes styles for the lightbox and adds them to the document.\n *\n * @function\n * @param {Object} context - An Interactivity API context\n * @param {Object} event - A triggering event\n */\nfunction setStyles( context, event ) {\n\t// The reference img element lies adjacent\n\t// to the event target button in the DOM.\n\tlet {\n\t\tnaturalWidth,\n\t\tnaturalHeight,\n\t\toffsetWidth: originalWidth,\n\t\toffsetHeight: originalHeight,\n\t} = event.target.nextElementSibling;\n\tlet { x: screenPosX, y: screenPosY } =\n\t\tevent.target.nextElementSibling.getBoundingClientRect();\n\n\t// Natural ratio of the image clicked to open the lightbox.\n\tconst naturalRatio = naturalWidth / naturalHeight;\n\t// Original ratio of the image clicked to open the lightbox.\n\tlet originalRatio = originalWidth / originalHeight;\n\n\t// If it has object-fit: contain, recalculate the original sizes\n\t// and the screen position without the blank spaces.\n\tif ( context.core.image.scaleAttr === 'contain' ) {\n\t\tif ( naturalRatio > originalRatio ) {\n\t\t\tconst heightWithoutSpace = originalWidth / naturalRatio;\n\t\t\t// Recalculate screen position without the top space.\n\t\t\tscreenPosY += ( originalHeight - heightWithoutSpace ) / 2;\n\t\t\toriginalHeight = heightWithoutSpace;\n\t\t} else {\n\t\t\tconst widthWithoutSpace = originalHeight * naturalRatio;\n\t\t\t// Recalculate screen position without the left space.\n\t\t\tscreenPosX += ( originalWidth - widthWithoutSpace ) / 2;\n\t\t\toriginalWidth = widthWithoutSpace;\n\t\t}\n\t}\n\toriginalRatio = originalWidth / originalHeight;\n\n\t// Typically, we use the image's full-sized dimensions. If those\n\t// dimensions have not been set (i.e. an external image with only one size),\n\t// the image's dimensions in the lightbox are the same\n\t// as those of the image in the content.\n\tlet imgMaxWidth = parseFloat(\n\t\tcontext.core.image.targetWidth !== 'none'\n\t\t\t? context.core.image.targetWidth\n\t\t\t: naturalWidth\n\t);\n\tlet imgMaxHeight = parseFloat(\n\t\tcontext.core.image.targetHeight !== 'none'\n\t\t\t? context.core.image.targetHeight\n\t\t\t: naturalHeight\n\t);\n\n\t// Ratio of the biggest image stored in the database.\n\tlet imgRatio = imgMaxWidth / imgMaxHeight;\n\tlet containerMaxWidth = imgMaxWidth;\n\tlet containerMaxHeight = imgMaxHeight;\n\tlet containerWidth = imgMaxWidth;\n\tlet containerHeight = imgMaxHeight;\n\t// Check if the target image has a different ratio than the original one (thumbnail).\n\t// Recalculate the width and height.\n\tif ( naturalRatio.toFixed( 2 ) !== imgRatio.toFixed( 2 ) ) {\n\t\tif ( naturalRatio > imgRatio ) {\n\t\t\t// If the width is reached before the height, we keep the maxWidth\n\t\t\t// and recalculate the height.\n\t\t\t// Unless the difference between the maxHeight and the reducedHeight\n\t\t\t// is higher than the maxWidth, where we keep the reducedHeight and\n\t\t\t// recalculate the width.\n\t\t\tconst reducedHeight = imgMaxWidth / naturalRatio;\n\t\t\tif ( imgMaxHeight - reducedHeight > imgMaxWidth ) {\n\t\t\t\timgMaxHeight = reducedHeight;\n\t\t\t\timgMaxWidth = reducedHeight * naturalRatio;\n\t\t\t} else {\n\t\t\t\timgMaxHeight = imgMaxWidth / naturalRatio;\n\t\t\t}\n\t\t} else {\n\t\t\t// If the height is reached before the width, we keep the maxHeight\n\t\t\t// and recalculate the width.\n\t\t\t// Unless the difference between the maxWidth and the reducedWidth\n\t\t\t// is higher than the maxHeight, where we keep the reducedWidth and\n\t\t\t// recalculate the height.\n\t\t\tconst reducedWidth = imgMaxHeight * naturalRatio;\n\t\t\tif ( imgMaxWidth - reducedWidth > imgMaxHeight ) {\n\t\t\t\timgMaxWidth = reducedWidth;\n\t\t\t\timgMaxHeight = reducedWidth / naturalRatio;\n\t\t\t} else {\n\t\t\t\timgMaxWidth = imgMaxHeight * naturalRatio;\n\t\t\t}\n\t\t}\n\t\tcontainerWidth = imgMaxWidth;\n\t\tcontainerHeight = imgMaxHeight;\n\t\timgRatio = imgMaxWidth / imgMaxHeight;\n\n\t\t// Calculate the max size of the container.\n\t\tif ( originalRatio > imgRatio ) {\n\t\t\tcontainerMaxWidth = imgMaxWidth;\n\t\t\tcontainerMaxHeight = containerMaxWidth / originalRatio;\n\t\t} else {\n\t\t\tcontainerMaxHeight = imgMaxHeight;\n\t\t\tcontainerMaxWidth = containerMaxHeight * originalRatio;\n\t\t}\n\t}\n\n\t// If the image has been pixelated on purpose, keep that size.\n\tif ( originalWidth > containerWidth || originalHeight > containerHeight ) {\n\t\tcontainerWidth = originalWidth;\n\t\tcontainerHeight = originalHeight;\n\t}\n\n\t// Calculate the final lightbox image size and the\n\t// scale factor. MaxWidth is either the window container\n\t// (accounting for padding) or the image resolution.\n\tlet horizontalPadding = 0;\n\tif ( window.innerWidth > 480 ) {\n\t\thorizontalPadding = 80;\n\t} else if ( window.innerWidth > 1920 ) {\n\t\thorizontalPadding = 160;\n\t}\n\tconst verticalPadding = 80;\n\n\tconst targetMaxWidth = Math.min(\n\t\twindow.innerWidth - horizontalPadding,\n\t\tcontainerWidth\n\t);\n\tconst targetMaxHeight = Math.min(\n\t\twindow.innerHeight - verticalPadding,\n\t\tcontainerHeight\n\t);\n\tconst targetContainerRatio = targetMaxWidth / targetMaxHeight;\n\n\tif ( originalRatio > targetContainerRatio ) {\n\t\t// If targetMaxWidth is reached before targetMaxHeight\n\t\tcontainerWidth = targetMaxWidth;\n\t\tcontainerHeight = containerWidth / originalRatio;\n\t} else {\n\t\t// If targetMaxHeight is reached before targetMaxWidth\n\t\tcontainerHeight = targetMaxHeight;\n\t\tcontainerWidth = containerHeight * originalRatio;\n\t}\n\n\tconst containerScale = originalWidth / containerWidth;\n\tconst lightboxImgWidth =\n\t\timgMaxWidth * ( containerWidth / containerMaxWidth );\n\tconst lightboxImgHeight =\n\t\timgMaxHeight * ( containerHeight / containerMaxHeight );\n\n\t// Add the CSS variables needed.\n\tlet styleTag = document.getElementById( 'wp-lightbox-styles' );\n\tif ( ! styleTag ) {\n\t\tstyleTag = document.createElement( 'style' );\n\t\tstyleTag.id = 'wp-lightbox-styles';\n\t\tdocument.head.appendChild( styleTag );\n\t}\n\n\t// As of this writing, using the calculations above will render the lightbox\n\t// with a small, erroneous whitespace on the left side of the image in iOS Safari,\n\t// perhaps due to an inconsistency in how browsers handle absolute positioning and CSS\n\t// transformation. In any case, adding 1 pixel to the container width and height solves\n\t// the problem, though this can be removed if the issue is fixed in the future.\n\tstyleTag.innerHTML = `\n\t\t:root {\n\t\t\t--wp--lightbox-initial-top-position: ${ screenPosY }px;\n\t\t\t--wp--lightbox-initial-left-position: ${ screenPosX }px;\n\t\t\t--wp--lightbox-container-width: ${ containerWidth + 1 }px;\n\t\t\t--wp--lightbox-container-height: ${ containerHeight + 1 }px;\n\t\t\t--wp--lightbox-image-width: ${ lightboxImgWidth }px;\n\t\t\t--wp--lightbox-image-height: ${ lightboxImgHeight }px;\n\t\t\t--wp--lightbox-scale: ${ containerScale };\n\t\t}\n\t`;\n}\n\n/*\n * Debounces a function call.\n *\n * @function\n * @param {Function} func - A function to be called\n * @param {number} wait - The time to wait before calling the function\n */\nfunction debounce( func, wait = 50 ) {\n\tlet timeout;\n\treturn () => {\n\t\tconst later = () => {\n\t\t\ttimeout = null;\n\t\t\tfunc();\n\t\t};\n\t\tclearTimeout( timeout );\n\t\ttimeout = setTimeout( later, wait );\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,0BAA0B;AAEhD,MAAMC,kBAAkB,GAAG,CAC1B,SAAS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F,kBAAkB,CAAE;;EAExD;EACA,IAAIgB,QAAQ,GAAGlG,QAAQ,CAACmG,cAAc,CAAE,oBAAqB,CAAC;EAC9D,IAAK,CAAED,QAAQ,EAAG;IACjBA,QAAQ,GAAGlG,QAAQ,CAACoG,aAAa,CAAE,OAAQ,CAAC;IAC5CF,QAAQ,CAACG,EAAE,GAAG,oBAAoB;IAClCrG,QAAQ,CAACsG,IAAI,CAACC,WAAW,CAAEL,QAAS,CAAC;EACtC;;EAEA;EACA;EACA;EACA;EACA;EACAA,QAAQ,CAACM,SAAS,GAAI;AACvB;AACA,0CAA2ClC,UAAY;AACvD,2CAA4CF,UAAY;AACxD,qCAAsCe,cAAc,GAAG,CAAG;AAC1D,sCAAuCC,eAAe,GAAG,CAAG;AAC5D,iCAAkCY,gBAAkB;AACpD,kCAAmCC,iBAAmB;AACtD,2BAA4BF,cAAgB;AAC5C;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASjC,QAAQA,CAAE2C,IAAI,EAAEC,IAAI,GAAG,EAAE,EAAG;EACpC,IAAIC,OAAO;EACX,OAAO,MAAM;IACZ,MAAMC,KAAK,GAAGA,CAAA,KAAM;MACnBD,OAAO,GAAG,IAAI;MACdF,IAAI,CAAC,CAAC;IACP,CAAC;IACDI,YAAY,CAAEF,OAAQ,CAAC;IACvBA,OAAO,GAAG7F,UAAU,CAAE8F,KAAK,EAAEF,IAAK,CAAC;EACpC,CAAC;AACF"}
1
+ {"version":3,"names":["store","focusableSelectors","scrollCallback","isTouching","lastTouchTime","handleScroll","context","Date","now","window","scrollTo","core","image","scrollLeftReset","scrollTopReset","state","windowWidth","innerWidth","windowHeight","innerHeight","actions","showLightbox","event","imageLoaded","initialized","lastFocusedElement","document","activeElement","scrollDelta","pointerType","lightboxEnabled","setStyles","imageRef","pageYOffset","documentElement","scrollTop","pageXOffset","scrollLeft","bind","addEventListener","hideLightbox","hideAnimationEnabled","setTimeout","removeEventListener","focus","preventScroll","handleKeydown","key","keyCode","shiftKey","firstFocusableElement","preventDefault","lastFocusableElement","handleLoad","effects","ref","imageCurrentSrc","currentSrc","setButtonStyles","handleTouchStart","handleTouchMove","handleTouchEnd","selectors","roleAttribute","ariaModal","dialogLabel","lightboxObjectFit","enlargedImgSrc","imageUploadedSrc","initOriginImage","complete","initLightbox","focusableElements","querySelectorAll","length","querySelector","naturalWidth","naturalHeight","offsetWidth","offsetHeight","figure","parentElement","figureWidth","clientWidth","figureHeight","clientHeight","caption","captionComputedStyle","getComputedStyle","parseFloat","marginTop","marginBottom","buttonOffsetTop","buttonOffsetRight","scaleAttr","naturalRatio","offsetRatio","referenceHeight","imageButtonTop","imageButtonRight","referenceWidth","setStylesOnResize","afterLoad","debounce","originalWidth","originalHeight","x","screenPosX","y","screenPosY","getBoundingClientRect","originalRatio","heightWithoutSpace","widthWithoutSpace","imgMaxWidth","targetWidth","imgMaxHeight","targetHeight","imgRatio","containerMaxWidth","containerMaxHeight","containerWidth","containerHeight","toFixed","reducedHeight","reducedWidth","horizontalPadding","verticalPadding","targetMaxWidth","Math","min","targetMaxHeight","targetContainerRatio","containerScale","lightboxImgWidth","lightboxImgHeight","styleTag","getElementById","createElement","id","head","appendChild","innerHTML","func","wait","timeout","later","clearTimeout"],"sources":["@wordpress/block-library/src/image/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store } from '@wordpress/interactivity';\n\nconst focusableSelectors = [\n\t'a[href]',\n\t'area[href]',\n\t'input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden])',\n\t'select:not([disabled]):not([aria-hidden])',\n\t'textarea:not([disabled]):not([aria-hidden])',\n\t'button:not([disabled]):not([aria-hidden])',\n\t'iframe',\n\t'object',\n\t'embed',\n\t'[contenteditable]',\n\t'[tabindex]:not([tabindex^=\"-\"])',\n];\n\n/*\n * Stores a context-bound scroll handler.\n *\n * This callback could be defined inline inside of the store\n * object but it's created externally to avoid confusion about\n * how its logic is called. This logic is not referenced directly\n * by the directives in the markup because the scroll event we\n * need to listen to is triggered on the window; so by defining it\n * outside of the store, we signal that the behavior here is different.\n * If we find a compelling reason to move it to the store, feel free.\n *\n * @type {Function}\n */\nlet scrollCallback;\n\n/*\n * Tracks whether user is touching screen; used to\n * differentiate behavior for touch and mouse input.\n *\n * @type {boolean}\n */\nlet isTouching = false;\n\n/*\n * Tracks the last time the screen was touched; used to\n * differentiate behavior for touch and mouse input.\n *\n * @type {number}\n */\nlet lastTouchTime = 0;\n\n/*\n * Lightbox page-scroll handler: prevents scrolling.\n *\n * This handler is added to prevent scrolling behaviors that\n * trigger content shift while the lightbox is open.\n *\n * It would be better to accomplish this through CSS alone, but\n * using overflow: hidden is currently the only way to do so, and\n * that causes the layout to shift and prevents the zoom animation\n * from working in some cases because we're unable to account for\n * the layout shift when doing the animation calculations. Instead,\n * here we use JavaScript to prevent and reset the scrolling\n * behavior. In the future, we may be able to use CSS or overflow: hidden\n * instead to not rely on JavaScript, but this seems to be the best approach\n * for now that provides the best visual experience.\n *\n * @param {Object} context Interactivity page context?\n */\nfunction handleScroll( context ) {\n\t// We can't override the scroll behavior on mobile devices\n\t// because doing so breaks the pinch to zoom functionality, and we\n\t// want to allow users to zoom in further on the high-res image.\n\tif ( ! isTouching && Date.now() - lastTouchTime > 450 ) {\n\t\t// We are unable to use event.preventDefault() to prevent scrolling\n\t\t// because the scroll event can't be canceled, so we reset the position instead.\n\t\twindow.scrollTo(\n\t\t\tcontext.core.image.scrollLeftReset,\n\t\t\tcontext.core.image.scrollTopReset\n\t\t);\n\t}\n}\n\nstore(\n\t{\n\t\tstate: {\n\t\t\tcore: {\n\t\t\t\timage: {\n\t\t\t\t\twindowWidth: window.innerWidth,\n\t\t\t\t\twindowHeight: window.innerHeight,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\tcore: {\n\t\t\t\timage: {\n\t\t\t\t\tshowLightbox: ( { context, event } ) => {\n\t\t\t\t\t\t// We can't initialize the lightbox until the reference\n\t\t\t\t\t\t// image is loaded, otherwise the UX is broken.\n\t\t\t\t\t\tif ( ! context.core.image.imageLoaded ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontext.core.image.initialized = true;\n\t\t\t\t\t\tcontext.core.image.lastFocusedElement =\n\t\t\t\t\t\t\twindow.document.activeElement;\n\t\t\t\t\t\tcontext.core.image.scrollDelta = 0;\n\t\t\t\t\t\tcontext.core.image.pointerType = event.pointerType;\n\n\t\t\t\t\t\tcontext.core.image.lightboxEnabled = true;\n\t\t\t\t\t\tsetStyles( context, context.core.image.imageRef );\n\n\t\t\t\t\t\tcontext.core.image.scrollTopReset =\n\t\t\t\t\t\t\twindow.pageYOffset ||\n\t\t\t\t\t\t\tdocument.documentElement.scrollTop;\n\n\t\t\t\t\t\t// In most cases, this value will be 0, but this is included\n\t\t\t\t\t\t// in case a user has created a page with horizontal scrolling.\n\t\t\t\t\t\tcontext.core.image.scrollLeftReset =\n\t\t\t\t\t\t\twindow.pageXOffset ||\n\t\t\t\t\t\t\tdocument.documentElement.scrollLeft;\n\n\t\t\t\t\t\t// We define and bind the scroll callback here so\n\t\t\t\t\t\t// that we can pass the context and as an argument.\n\t\t\t\t\t\t// We may be able to change this in the future if we\n\t\t\t\t\t\t// define the scroll callback in the store instead, but\n\t\t\t\t\t\t// this approach seems to tbe clearest for now.\n\t\t\t\t\t\tscrollCallback = handleScroll.bind( null, context );\n\n\t\t\t\t\t\t// We need to add a scroll event listener to the window\n\t\t\t\t\t\t// here because we are unable to otherwise access it via\n\t\t\t\t\t\t// the Interactivity API directives. If we add a native way\n\t\t\t\t\t\t// to access the window, we can remove this.\n\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t'scroll',\n\t\t\t\t\t\t\tscrollCallback,\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\thideLightbox: async ( { context, event } ) => {\n\t\t\t\t\t\tcontext.core.image.hideAnimationEnabled = true;\n\t\t\t\t\t\tif ( context.core.image.lightboxEnabled ) {\n\t\t\t\t\t\t\t// We want to wait until the close animation is completed\n\t\t\t\t\t\t\t// before allowing a user to scroll again. The duration of this\n\t\t\t\t\t\t\t// animation is defined in the styles.scss and depends on if the\n\t\t\t\t\t\t\t// animation is 'zoom' or 'fade', but in any case we should wait\n\t\t\t\t\t\t\t// a few milliseconds longer than the duration, otherwise a user\n\t\t\t\t\t\t\t// may scroll too soon and cause the animation to look sloppy.\n\t\t\t\t\t\t\tsetTimeout( function () {\n\t\t\t\t\t\t\t\twindow.removeEventListener(\n\t\t\t\t\t\t\t\t\t'scroll',\n\t\t\t\t\t\t\t\t\tscrollCallback\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}, 450 );\n\n\t\t\t\t\t\t\tcontext.core.image.lightboxEnabled = false;\n\n\t\t\t\t\t\t\t// We want to avoid drawing attention to the button\n\t\t\t\t\t\t\t// after the lightbox closes for mouse and touch users.\n\t\t\t\t\t\t\t// Note that the `event.pointerType` property returns\n\t\t\t\t\t\t\t// as an empty string if a keyboard fired the event.\n\t\t\t\t\t\t\tif ( event.pointerType === '' ) {\n\t\t\t\t\t\t\t\tcontext.core.image.lastFocusedElement.focus( {\n\t\t\t\t\t\t\t\t\tpreventScroll: true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\thandleKeydown: ( { context, actions, event } ) => {\n\t\t\t\t\t\tif ( context.core.image.lightboxEnabled ) {\n\t\t\t\t\t\t\tif ( event.key === 'Tab' || event.keyCode === 9 ) {\n\t\t\t\t\t\t\t\t// If shift + tab it change the direction\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tevent.shiftKey &&\n\t\t\t\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\t\t\t\tcontext.core.image.firstFocusableElement\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\tcontext.core.image.lastFocusableElement.focus();\n\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\t! event.shiftKey &&\n\t\t\t\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\t\t\t\tcontext.core.image.lastFocusableElement\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\tcontext.core.image.firstFocusableElement.focus();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tevent.key === 'Escape' ||\n\t\t\t\t\t\t\t\tevent.keyCode === 27\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tactions.core.image.hideLightbox( {\n\t\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t// This is fired just by lazily loaded\n\t\t\t\t\t// images on the page, not all images.\n\t\t\t\t\thandleLoad: ( { context, effects, ref } ) => {\n\t\t\t\t\t\tcontext.core.image.imageLoaded = true;\n\t\t\t\t\t\tcontext.core.image.imageCurrentSrc = ref.currentSrc;\n\t\t\t\t\t\teffects.core.image.setButtonStyles( {\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t} );\n\t\t\t\t\t},\n\t\t\t\t\thandleTouchStart: () => {\n\t\t\t\t\t\tisTouching = true;\n\t\t\t\t\t},\n\t\t\t\t\thandleTouchMove: ( { context, event } ) => {\n\t\t\t\t\t\t// On mobile devices, we want to prevent triggering the\n\t\t\t\t\t\t// scroll event because otherwise the page jumps around as\n\t\t\t\t\t\t// we reset the scroll position. This also means that closing\n\t\t\t\t\t\t// the lightbox requires that a user perform a simple tap. This\n\t\t\t\t\t\t// may be changed in the future if we find a better alternative\n\t\t\t\t\t\t// to override or reset the scroll position during swipe actions.\n\t\t\t\t\t\tif ( context.core.image.lightboxEnabled ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\thandleTouchEnd: () => {\n\t\t\t\t\t\t// We need to wait a few milliseconds before resetting\n\t\t\t\t\t\t// to ensure that pinch to zoom works consistently\n\t\t\t\t\t\t// on mobile devices when the lightbox is open.\n\t\t\t\t\t\tlastTouchTime = Date.now();\n\t\t\t\t\t\tisTouching = false;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tselectors: {\n\t\t\tcore: {\n\t\t\t\timage: {\n\t\t\t\t\troleAttribute: ( { context } ) => {\n\t\t\t\t\t\treturn context.core.image.lightboxEnabled\n\t\t\t\t\t\t\t? 'dialog'\n\t\t\t\t\t\t\t: null;\n\t\t\t\t\t},\n\t\t\t\t\tariaModal: ( { context } ) => {\n\t\t\t\t\t\treturn context.core.image.lightboxEnabled\n\t\t\t\t\t\t\t? 'true'\n\t\t\t\t\t\t\t: null;\n\t\t\t\t\t},\n\t\t\t\t\tdialogLabel: ( { context } ) => {\n\t\t\t\t\t\treturn context.core.image.lightboxEnabled\n\t\t\t\t\t\t\t? context.core.image.dialogLabel\n\t\t\t\t\t\t\t: null;\n\t\t\t\t\t},\n\t\t\t\t\tlightboxObjectFit: ( { context } ) => {\n\t\t\t\t\t\tif ( context.core.image.initialized ) {\n\t\t\t\t\t\t\treturn 'cover';\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tenlargedImgSrc: ( { context } ) => {\n\t\t\t\t\t\treturn context.core.image.initialized\n\t\t\t\t\t\t\t? context.core.image.imageUploadedSrc\n\t\t\t\t\t\t\t: 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\teffects: {\n\t\t\tcore: {\n\t\t\t\timage: {\n\t\t\t\t\tinitOriginImage: ( { context, ref } ) => {\n\t\t\t\t\t\tcontext.core.image.imageRef = ref;\n\t\t\t\t\t\tif ( ref.complete ) {\n\t\t\t\t\t\t\tcontext.core.image.imageLoaded = true;\n\t\t\t\t\t\t\tcontext.core.image.imageCurrentSrc = ref.currentSrc;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tinitLightbox: async ( { context, ref } ) => {\n\t\t\t\t\t\tif ( context.core.image.lightboxEnabled ) {\n\t\t\t\t\t\t\tconst focusableElements =\n\t\t\t\t\t\t\t\tref.querySelectorAll( focusableSelectors );\n\t\t\t\t\t\t\tcontext.core.image.firstFocusableElement =\n\t\t\t\t\t\t\t\tfocusableElements[ 0 ];\n\t\t\t\t\t\t\tcontext.core.image.lastFocusableElement =\n\t\t\t\t\t\t\t\tfocusableElements[\n\t\t\t\t\t\t\t\t\tfocusableElements.length - 1\n\t\t\t\t\t\t\t\t];\n\n\t\t\t\t\t\t\t// We want to avoid drawing unnecessary attention to the close\n\t\t\t\t\t\t\t// button for mouse and touch users. Note that even if opening\n\t\t\t\t\t\t\t// the lightbox via keyboard, the event fired is of type\n\t\t\t\t\t\t\t// `pointerEvent`, so we need to rely on the `event.pointerType`\n\t\t\t\t\t\t\t// property, which returns an empty string for keyboard events.\n\t\t\t\t\t\t\tif ( context.core.image.pointerType === '' ) {\n\t\t\t\t\t\t\t\tref.querySelector( '.close-button' ).focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tsetButtonStyles: ( { context, ref } ) => {\n\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\tnaturalWidth,\n\t\t\t\t\t\t\tnaturalHeight,\n\t\t\t\t\t\t\toffsetWidth,\n\t\t\t\t\t\t\toffsetHeight,\n\t\t\t\t\t\t} = ref;\n\n\t\t\t\t\t\t// If the image isn't loaded yet, we can't\n\t\t\t\t\t\t// calculate where the button should be.\n\t\t\t\t\t\tif ( naturalWidth === 0 || naturalHeight === 0 ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst figure = ref.parentElement;\n\t\t\t\t\t\tconst figureWidth = ref.parentElement.clientWidth;\n\n\t\t\t\t\t\t// We need special handling for the height because\n\t\t\t\t\t\t// a caption will cause the figure to be taller than\n\t\t\t\t\t\t// the image, which means we need to account for that\n\t\t\t\t\t\t// when calculating the placement of the button in the\n\t\t\t\t\t\t// top right corner of the image.\n\t\t\t\t\t\tlet figureHeight = ref.parentElement.clientHeight;\n\t\t\t\t\t\tconst caption = figure.querySelector( 'figcaption' );\n\t\t\t\t\t\tif ( caption ) {\n\t\t\t\t\t\t\tconst captionComputedStyle =\n\t\t\t\t\t\t\t\twindow.getComputedStyle( caption );\n\t\t\t\t\t\t\tfigureHeight =\n\t\t\t\t\t\t\t\tfigureHeight -\n\t\t\t\t\t\t\t\tcaption.offsetHeight -\n\t\t\t\t\t\t\t\tparseFloat( captionComputedStyle.marginTop ) -\n\t\t\t\t\t\t\t\tparseFloat( captionComputedStyle.marginBottom );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst buttonOffsetTop = figureHeight - offsetHeight;\n\t\t\t\t\t\tconst buttonOffsetRight = figureWidth - offsetWidth;\n\n\t\t\t\t\t\t// In the case of an image with object-fit: contain, the\n\t\t\t\t\t\t// size of the <img> element can be larger than the image itself,\n\t\t\t\t\t\t// so we need to calculate where to place the button.\n\t\t\t\t\t\tif ( context.core.image.scaleAttr === 'contain' ) {\n\t\t\t\t\t\t\t// Natural ratio of the image.\n\t\t\t\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t\t\t\t// Offset ratio of the image.\n\t\t\t\t\t\t\tconst offsetRatio = offsetWidth / offsetHeight;\n\n\t\t\t\t\t\t\tif ( naturalRatio >= offsetRatio ) {\n\t\t\t\t\t\t\t\t// If it reaches the width first, keep\n\t\t\t\t\t\t\t\t// the width and compute the height.\n\t\t\t\t\t\t\t\tconst referenceHeight =\n\t\t\t\t\t\t\t\t\toffsetWidth / naturalRatio;\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonTop =\n\t\t\t\t\t\t\t\t\t( offsetHeight - referenceHeight ) / 2 +\n\t\t\t\t\t\t\t\t\tbuttonOffsetTop +\n\t\t\t\t\t\t\t\t\t10;\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonRight =\n\t\t\t\t\t\t\t\t\tbuttonOffsetRight + 10;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// If it reaches the height first, keep\n\t\t\t\t\t\t\t\t// the height and compute the width.\n\t\t\t\t\t\t\t\tconst referenceWidth =\n\t\t\t\t\t\t\t\t\toffsetHeight * naturalRatio;\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonTop =\n\t\t\t\t\t\t\t\t\tbuttonOffsetTop + 10;\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonRight =\n\t\t\t\t\t\t\t\t\t( offsetWidth - referenceWidth ) / 2 +\n\t\t\t\t\t\t\t\t\tbuttonOffsetRight +\n\t\t\t\t\t\t\t\t\t10;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcontext.core.image.imageButtonTop =\n\t\t\t\t\t\t\t\tbuttonOffsetTop + 10;\n\t\t\t\t\t\t\tcontext.core.image.imageButtonRight =\n\t\t\t\t\t\t\t\tbuttonOffsetRight + 10;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tsetStylesOnResize: ( { state, context, ref } ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tcontext.core.image.lightboxEnabled &&\n\t\t\t\t\t\t\t( state.core.image.windowWidth ||\n\t\t\t\t\t\t\t\tstate.core.image.windowHeight )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tsetStyles( context, ref );\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tafterLoad: ( { state } ) => {\n\t\t\twindow.addEventListener(\n\t\t\t\t'resize',\n\t\t\t\tdebounce( () => {\n\t\t\t\t\tstate.core.image.windowWidth = window.innerWidth;\n\t\t\t\t\tstate.core.image.windowHeight = window.innerHeight;\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t}\n);\n\n/*\n * Computes styles for the lightbox and adds them to the document.\n *\n * @function\n * @param {Object} context - An Interactivity API context\n * @param {Object} event - A triggering event\n */\nfunction setStyles( context, ref ) {\n\t// The reference img element lies adjacent\n\t// to the event target button in the DOM.\n\tlet {\n\t\tnaturalWidth,\n\t\tnaturalHeight,\n\t\toffsetWidth: originalWidth,\n\t\toffsetHeight: originalHeight,\n\t} = ref;\n\tlet { x: screenPosX, y: screenPosY } = ref.getBoundingClientRect();\n\n\t// Natural ratio of the image clicked to open the lightbox.\n\tconst naturalRatio = naturalWidth / naturalHeight;\n\t// Original ratio of the image clicked to open the lightbox.\n\tlet originalRatio = originalWidth / originalHeight;\n\n\t// If it has object-fit: contain, recalculate the original sizes\n\t// and the screen position without the blank spaces.\n\tif ( context.core.image.scaleAttr === 'contain' ) {\n\t\tif ( naturalRatio > originalRatio ) {\n\t\t\tconst heightWithoutSpace = originalWidth / naturalRatio;\n\t\t\t// Recalculate screen position without the top space.\n\t\t\tscreenPosY += ( originalHeight - heightWithoutSpace ) / 2;\n\t\t\toriginalHeight = heightWithoutSpace;\n\t\t} else {\n\t\t\tconst widthWithoutSpace = originalHeight * naturalRatio;\n\t\t\t// Recalculate screen position without the left space.\n\t\t\tscreenPosX += ( originalWidth - widthWithoutSpace ) / 2;\n\t\t\toriginalWidth = widthWithoutSpace;\n\t\t}\n\t}\n\toriginalRatio = originalWidth / originalHeight;\n\n\t// Typically, we use the image's full-sized dimensions. If those\n\t// dimensions have not been set (i.e. an external image with only one size),\n\t// the image's dimensions in the lightbox are the same\n\t// as those of the image in the content.\n\tlet imgMaxWidth = parseFloat(\n\t\tcontext.core.image.targetWidth !== 'none'\n\t\t\t? context.core.image.targetWidth\n\t\t\t: naturalWidth\n\t);\n\tlet imgMaxHeight = parseFloat(\n\t\tcontext.core.image.targetHeight !== 'none'\n\t\t\t? context.core.image.targetHeight\n\t\t\t: naturalHeight\n\t);\n\n\t// Ratio of the biggest image stored in the database.\n\tlet imgRatio = imgMaxWidth / imgMaxHeight;\n\tlet containerMaxWidth = imgMaxWidth;\n\tlet containerMaxHeight = imgMaxHeight;\n\tlet containerWidth = imgMaxWidth;\n\tlet containerHeight = imgMaxHeight;\n\t// Check if the target image has a different ratio than the original one (thumbnail).\n\t// Recalculate the width and height.\n\tif ( naturalRatio.toFixed( 2 ) !== imgRatio.toFixed( 2 ) ) {\n\t\tif ( naturalRatio > imgRatio ) {\n\t\t\t// If the width is reached before the height, we keep the maxWidth\n\t\t\t// and recalculate the height.\n\t\t\t// Unless the difference between the maxHeight and the reducedHeight\n\t\t\t// is higher than the maxWidth, where we keep the reducedHeight and\n\t\t\t// recalculate the width.\n\t\t\tconst reducedHeight = imgMaxWidth / naturalRatio;\n\t\t\tif ( imgMaxHeight - reducedHeight > imgMaxWidth ) {\n\t\t\t\timgMaxHeight = reducedHeight;\n\t\t\t\timgMaxWidth = reducedHeight * naturalRatio;\n\t\t\t} else {\n\t\t\t\timgMaxHeight = imgMaxWidth / naturalRatio;\n\t\t\t}\n\t\t} else {\n\t\t\t// If the height is reached before the width, we keep the maxHeight\n\t\t\t// and recalculate the width.\n\t\t\t// Unless the difference between the maxWidth and the reducedWidth\n\t\t\t// is higher than the maxHeight, where we keep the reducedWidth and\n\t\t\t// recalculate the height.\n\t\t\tconst reducedWidth = imgMaxHeight * naturalRatio;\n\t\t\tif ( imgMaxWidth - reducedWidth > imgMaxHeight ) {\n\t\t\t\timgMaxWidth = reducedWidth;\n\t\t\t\timgMaxHeight = reducedWidth / naturalRatio;\n\t\t\t} else {\n\t\t\t\timgMaxWidth = imgMaxHeight * naturalRatio;\n\t\t\t}\n\t\t}\n\t\tcontainerWidth = imgMaxWidth;\n\t\tcontainerHeight = imgMaxHeight;\n\t\timgRatio = imgMaxWidth / imgMaxHeight;\n\n\t\t// Calculate the max size of the container.\n\t\tif ( originalRatio > imgRatio ) {\n\t\t\tcontainerMaxWidth = imgMaxWidth;\n\t\t\tcontainerMaxHeight = containerMaxWidth / originalRatio;\n\t\t} else {\n\t\t\tcontainerMaxHeight = imgMaxHeight;\n\t\t\tcontainerMaxWidth = containerMaxHeight * originalRatio;\n\t\t}\n\t}\n\n\t// If the image has been pixelated on purpose, keep that size.\n\tif ( originalWidth > containerWidth || originalHeight > containerHeight ) {\n\t\tcontainerWidth = originalWidth;\n\t\tcontainerHeight = originalHeight;\n\t}\n\n\t// Calculate the final lightbox image size and the\n\t// scale factor. MaxWidth is either the window container\n\t// (accounting for padding) or the image resolution.\n\tlet horizontalPadding = 0;\n\tif ( window.innerWidth > 480 ) {\n\t\thorizontalPadding = 80;\n\t} else if ( window.innerWidth > 1920 ) {\n\t\thorizontalPadding = 160;\n\t}\n\tconst verticalPadding = 80;\n\n\tconst targetMaxWidth = Math.min(\n\t\twindow.innerWidth - horizontalPadding,\n\t\tcontainerWidth\n\t);\n\tconst targetMaxHeight = Math.min(\n\t\twindow.innerHeight - verticalPadding,\n\t\tcontainerHeight\n\t);\n\tconst targetContainerRatio = targetMaxWidth / targetMaxHeight;\n\n\tif ( originalRatio > targetContainerRatio ) {\n\t\t// If targetMaxWidth is reached before targetMaxHeight\n\t\tcontainerWidth = targetMaxWidth;\n\t\tcontainerHeight = containerWidth / originalRatio;\n\t} else {\n\t\t// If targetMaxHeight is reached before targetMaxWidth\n\t\tcontainerHeight = targetMaxHeight;\n\t\tcontainerWidth = containerHeight * originalRatio;\n\t}\n\n\tconst containerScale = originalWidth / containerWidth;\n\tconst lightboxImgWidth =\n\t\timgMaxWidth * ( containerWidth / containerMaxWidth );\n\tconst lightboxImgHeight =\n\t\timgMaxHeight * ( containerHeight / containerMaxHeight );\n\n\t// Add the CSS variables needed.\n\tlet styleTag = document.getElementById( 'wp-lightbox-styles' );\n\tif ( ! styleTag ) {\n\t\tstyleTag = document.createElement( 'style' );\n\t\tstyleTag.id = 'wp-lightbox-styles';\n\t\tdocument.head.appendChild( styleTag );\n\t}\n\n\t// As of this writing, using the calculations above will render the lightbox\n\t// with a small, erroneous whitespace on the left side of the image in iOS Safari,\n\t// perhaps due to an inconsistency in how browsers handle absolute positioning and CSS\n\t// transformation. In any case, adding 1 pixel to the container width and height solves\n\t// the problem, though this can be removed if the issue is fixed in the future.\n\tstyleTag.innerHTML = `\n\t\t:root {\n\t\t\t--wp--lightbox-initial-top-position: ${ screenPosY }px;\n\t\t\t--wp--lightbox-initial-left-position: ${ screenPosX }px;\n\t\t\t--wp--lightbox-container-width: ${ containerWidth + 1 }px;\n\t\t\t--wp--lightbox-container-height: ${ containerHeight + 1 }px;\n\t\t\t--wp--lightbox-image-width: ${ lightboxImgWidth }px;\n\t\t\t--wp--lightbox-image-height: ${ lightboxImgHeight }px;\n\t\t\t--wp--lightbox-scale: ${ containerScale };\n\t\t}\n\t`;\n}\n\n/*\n * Debounces a function call.\n *\n * @function\n * @param {Function} func - A function to be called\n * @param {number} wait - The time to wait before calling the function\n */\nfunction debounce( func, wait = 50 ) {\n\tlet timeout;\n\treturn () => {\n\t\tconst later = () => {\n\t\t\ttimeout = null;\n\t\t\tfunc();\n\t\t};\n\t\tclearTimeout( timeout );\n\t\ttimeout = setTimeout( later, wait );\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,0BAA0B;AAEhD,MAAMC,kBAAkB,GAAG,CAC1B,SAAS,EACT,YAAY,EACZ,+DAA+D,EAC/D,2CAA2C,EAC3C,6CAA6C,EAC7C,2CAA2C,EAC3C,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,mBAAmB,EACnB,iCAAiC,CACjC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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AG,oBAAoB;IAClCjH,QAAQ,CAACkH,IAAI,CAACC,WAAW,CAAEL,QAAS,CAAC;EACtC;;EAEA;EACA;EACA;EACA;EACA;EACAA,QAAQ,CAACM,SAAS,GAAI;AACvB;AACA,0CAA2CjC,UAAY;AACvD,2CAA4CF,UAAY;AACxD,qCAAsCc,cAAc,GAAG,CAAG;AAC1D,sCAAuCC,eAAe,GAAG,CAAG;AAC5D,iCAAkCY,gBAAkB;AACpD,kCAAmCC,iBAAmB;AACtD,2BAA4BF,cAAgB;AAC5C;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS9B,QAAQA,CAAEwC,IAAI,EAAEC,IAAI,GAAG,EAAE,EAAG;EACpC,IAAIC,OAAO;EACX,OAAO,MAAM;IACZ,MAAMC,KAAK,GAAGA,CAAA,KAAM;MACnBD,OAAO,GAAG,IAAI;MACdF,IAAI,CAAC,CAAC;IACP,CAAC;IACDI,YAAY,CAAEF,OAAQ,CAAC;IACvBA,OAAO,GAAGvG,UAAU,CAAEwG,KAAK,EAAEF,IAAK,CAAC;EACpC,CAAC;AACF"}
@@ -43,6 +43,10 @@ import * as cover from './cover';
43
43
  import * as details from './details';
44
44
  import * as embed from './embed';
45
45
  import * as file from './file';
46
+ import * as form from './form';
47
+ import * as formInput from './form-input';
48
+ import * as formSubmitButton from './form-submit-button';
49
+ import * as formSubmissionNotification from './form-submission-notification';
46
50
  import * as gallery from './gallery';
47
51
  import * as group from './group';
48
52
  import * as heading from './heading';
@@ -126,6 +130,12 @@ const getAllBlocks = () => {
126
130
  archives, audio, button, buttons, calendar, categories, code, column, columns, commentAuthorAvatar, cover, details, embed, file, group, html, latestComments, latestPosts, mediaText, missing, more, nextpage, pageList, pageListItem, pattern, preformatted, pullquote, reusableBlock, rss, search, separator, shortcode, socialLink, socialLinks, spacer, table, tagCloud, textColumns, verse, video, footnotes,
127
131
  // theme blocks
128
132
  navigation, navigationLink, navigationSubmenu, siteLogo, siteTitle, siteTagline, query, templatePart, avatar, postTitle, postExcerpt, postFeaturedImage, postContent, postAuthor, postAuthorName, postComment, postCommentsCount, postCommentsLink, postDate, postTerms, postNavigationLink, postTemplate, postTimeToRead, queryPagination, queryPaginationNext, queryPaginationNumbers, queryPaginationPrevious, queryNoResults, readMore, comments, commentAuthorName, commentContent, commentDate, commentEditLink, commentReplyLink, commentTemplate, commentsTitle, commentsPagination, commentsPaginationNext, commentsPaginationNumbers, commentsPaginationPrevious, postCommentsForm, tableOfContents, homeLink, logInOut, termDescription, queryTitle, postAuthorBiography];
133
+ if (window?.__experimentalEnableFormBlocks) {
134
+ blocks.push(form);
135
+ blocks.push(formInput);
136
+ blocks.push(formSubmitButton);
137
+ blocks.push(formSubmissionNotification);
138
+ }
129
139
 
130
140
  // When in a WordPress context, conditionally
131
141
  // add the classic block and TinyMCE editor
@@ -1 +1 @@
1
- {"version":3,"names":["setDefaultBlockName","setFreeformContentHandlerName","setUnregisteredTypeHandlerName","setGroupingBlockName","archives","avatar","audio","button","buttons","calendar","categories","classic","code","column","columns","comments","commentAuthorAvatar","commentAuthorName","commentContent","commentDate","commentEditLink","commentReplyLink","commentTemplate","commentsPaginationPrevious","commentsPagination","commentsPaginationNext","commentsPaginationNumbers","commentsTitle","cover","details","embed","file","gallery","group","heading","homeLink","html","image","latestComments","latestPosts","list","listItem","logInOut","mediaText","missing","more","navigation","navigationLink","navigationSubmenu","nextpage","pattern","pageList","pageListItem","paragraph","postAuthor","postAuthorName","postAuthorBiography","postComment","postCommentsCount","postCommentsForm","postCommentsLink","postContent","postDate","postExcerpt","postFeaturedImage","postNavigationLink","postTemplate","postTerms","postTimeToRead","postTitle","preformatted","pullquote","query","queryNoResults","queryPagination","queryPaginationNext","queryPaginationNumbers","queryPaginationPrevious","queryTitle","quote","reusableBlock","readMore","rss","search","separator","shortcode","siteLogo","siteTagline","siteTitle","socialLink","socialLinks","spacer","table","tableOfContents","tagCloud","templatePart","termDescription","textColumns","verse","video","footnotes","isBlockMetadataExperimental","getAllBlocks","blocks","window","wp","oldEditor","needsClassicBlock","__experimentalDisableTinymce","URLSearchParams","location","get","push","filter","Boolean","__experimentalGetCoreBlocks","metadata","registerCoreBlocks","forEach","init","name","some","__experimentalRegisterExperimentalCoreBlocks","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","enabledExperiments","__experimental","includes","undefined"],"sources":["@wordpress/block-library/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tsetDefaultBlockName,\n\tsetFreeformContentHandlerName,\n\tsetUnregisteredTypeHandlerName,\n\tsetGroupingBlockName,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\n// When IS_GUTENBERG_PLUGIN is set to false, imports of experimental blocks\n// are transformed by packages/block-library/src/index.js as follows:\n// import * as experimentalBlock from './experimental-block'\n// becomes\n// const experimentalBlock = null;\n// This enables webpack to eliminate the experimental blocks code from the\n// production build to make the final bundle smaller.\n//\n// See https://github.com/WordPress/gutenberg/pull/40655 for more context.\nimport * as archives from './archives';\nimport * as avatar from './avatar';\nimport * as audio from './audio';\nimport * as button from './button';\nimport * as buttons from './buttons';\nimport * as calendar from './calendar';\nimport * as categories from './categories';\nimport * as classic from './freeform';\nimport * as code from './code';\nimport * as column from './column';\nimport * as columns from './columns';\nimport * as comments from './comments';\nimport * as commentAuthorAvatar from './comment-author-avatar';\nimport * as commentAuthorName from './comment-author-name';\nimport * as commentContent from './comment-content';\nimport * as commentDate from './comment-date';\nimport * as commentEditLink from './comment-edit-link';\nimport * as commentReplyLink from './comment-reply-link';\nimport * as commentTemplate from './comment-template';\nimport * as commentsPaginationPrevious from './comments-pagination-previous';\nimport * as commentsPagination from './comments-pagination';\nimport * as commentsPaginationNext from './comments-pagination-next';\nimport * as commentsPaginationNumbers from './comments-pagination-numbers';\nimport * as commentsTitle from './comments-title';\nimport * as cover from './cover';\nimport * as details from './details';\nimport * as embed from './embed';\nimport * as file from './file';\nimport * as gallery from './gallery';\nimport * as group from './group';\nimport * as heading from './heading';\nimport * as homeLink from './home-link';\nimport * as html from './html';\nimport * as image from './image';\nimport * as latestComments from './latest-comments';\nimport * as latestPosts from './latest-posts';\nimport * as list from './list';\nimport * as listItem from './list-item';\nimport * as logInOut from './loginout';\nimport * as mediaText from './media-text';\nimport * as missing from './missing';\nimport * as more from './more';\nimport * as navigation from './navigation';\nimport * as navigationLink from './navigation-link';\nimport * as navigationSubmenu from './navigation-submenu';\nimport * as nextpage from './nextpage';\nimport * as pattern from './pattern';\nimport * as pageList from './page-list';\nimport * as pageListItem from './page-list-item';\nimport * as paragraph from './paragraph';\nimport * as postAuthor from './post-author';\nimport * as postAuthorName from './post-author-name';\nimport * as postAuthorBiography from './post-author-biography';\nimport * as postComment from './post-comment';\nimport * as postCommentsCount from './post-comments-count';\nimport * as postCommentsForm from './post-comments-form';\nimport * as postCommentsLink from './post-comments-link';\nimport * as postContent from './post-content';\nimport * as postDate from './post-date';\nimport * as postExcerpt from './post-excerpt';\nimport * as postFeaturedImage from './post-featured-image';\nimport * as postNavigationLink from './post-navigation-link';\nimport * as postTemplate from './post-template';\nimport * as postTerms from './post-terms';\nimport * as postTimeToRead from './post-time-to-read';\nimport * as postTitle from './post-title';\nimport * as preformatted from './preformatted';\nimport * as pullquote from './pullquote';\nimport * as query from './query';\nimport * as queryNoResults from './query-no-results';\nimport * as queryPagination from './query-pagination';\nimport * as queryPaginationNext from './query-pagination-next';\nimport * as queryPaginationNumbers from './query-pagination-numbers';\nimport * as queryPaginationPrevious from './query-pagination-previous';\nimport * as queryTitle from './query-title';\nimport * as quote from './quote';\nimport * as reusableBlock from './block';\nimport * as readMore from './read-more';\nimport * as rss from './rss';\nimport * as search from './search';\nimport * as separator from './separator';\nimport * as shortcode from './shortcode';\nimport * as siteLogo from './site-logo';\nimport * as siteTagline from './site-tagline';\nimport * as siteTitle from './site-title';\nimport * as socialLink from './social-link';\nimport * as socialLinks from './social-links';\nimport * as spacer from './spacer';\nimport * as table from './table';\nimport * as tableOfContents from './table-of-contents';\nimport * as tagCloud from './tag-cloud';\nimport * as templatePart from './template-part';\nimport * as termDescription from './term-description';\nimport * as textColumns from './text-columns';\nimport * as verse from './verse';\nimport * as video from './video';\nimport * as footnotes from './footnotes';\n\nimport isBlockMetadataExperimental from './utils/is-block-metadata-experimental';\n\n/**\n * Function to get all the block-library blocks in an array\n */\nconst getAllBlocks = () => {\n\tconst blocks = [\n\t\t// Common blocks are grouped at the top to prioritize their display\n\t\t// in various contexts — like the inserter and auto-complete components.\n\t\tparagraph,\n\t\timage,\n\t\theading,\n\t\tgallery,\n\t\tlist,\n\t\tlistItem,\n\t\tquote,\n\n\t\t// Register all remaining core blocks.\n\t\tarchives,\n\t\taudio,\n\t\tbutton,\n\t\tbuttons,\n\t\tcalendar,\n\t\tcategories,\n\t\tcode,\n\t\tcolumn,\n\t\tcolumns,\n\t\tcommentAuthorAvatar,\n\t\tcover,\n\t\tdetails,\n\t\tembed,\n\t\tfile,\n\t\tgroup,\n\t\thtml,\n\t\tlatestComments,\n\t\tlatestPosts,\n\t\tmediaText,\n\t\tmissing,\n\t\tmore,\n\t\tnextpage,\n\t\tpageList,\n\t\tpageListItem,\n\t\tpattern,\n\t\tpreformatted,\n\t\tpullquote,\n\t\treusableBlock,\n\t\trss,\n\t\tsearch,\n\t\tseparator,\n\t\tshortcode,\n\t\tsocialLink,\n\t\tsocialLinks,\n\t\tspacer,\n\t\ttable,\n\t\ttagCloud,\n\t\ttextColumns,\n\t\tverse,\n\t\tvideo,\n\t\tfootnotes,\n\n\t\t// theme blocks\n\t\tnavigation,\n\t\tnavigationLink,\n\t\tnavigationSubmenu,\n\t\tsiteLogo,\n\t\tsiteTitle,\n\t\tsiteTagline,\n\t\tquery,\n\t\ttemplatePart,\n\t\tavatar,\n\t\tpostTitle,\n\t\tpostExcerpt,\n\t\tpostFeaturedImage,\n\t\tpostContent,\n\t\tpostAuthor,\n\t\tpostAuthorName,\n\t\tpostComment,\n\t\tpostCommentsCount,\n\t\tpostCommentsLink,\n\t\tpostDate,\n\t\tpostTerms,\n\t\tpostNavigationLink,\n\t\tpostTemplate,\n\t\tpostTimeToRead,\n\t\tqueryPagination,\n\t\tqueryPaginationNext,\n\t\tqueryPaginationNumbers,\n\t\tqueryPaginationPrevious,\n\t\tqueryNoResults,\n\t\treadMore,\n\t\tcomments,\n\t\tcommentAuthorName,\n\t\tcommentContent,\n\t\tcommentDate,\n\t\tcommentEditLink,\n\t\tcommentReplyLink,\n\t\tcommentTemplate,\n\t\tcommentsTitle,\n\t\tcommentsPagination,\n\t\tcommentsPaginationNext,\n\t\tcommentsPaginationNumbers,\n\t\tcommentsPaginationPrevious,\n\t\tpostCommentsForm,\n\t\ttableOfContents,\n\t\thomeLink,\n\t\tlogInOut,\n\t\ttermDescription,\n\t\tqueryTitle,\n\t\tpostAuthorBiography,\n\t];\n\n\t// When in a WordPress context, conditionally\n\t// add the classic block and TinyMCE editor\n\t// under any of the following conditions:\n\t// - the current post contains a classic block\n\t// - the experiment to disable TinyMCE isn't active.\n\t// - a query argument specifies that TinyMCE should be loaded\n\tif (\n\t\twindow?.wp?.oldEditor &&\n\t\t( window?.wp?.needsClassicBlock ||\n\t\t\t! window?.__experimentalDisableTinymce ||\n\t\t\t!! new URLSearchParams( window?.location?.search ).get(\n\t\t\t\t'requiresTinymce'\n\t\t\t) )\n\t) {\n\t\tblocks.push( classic );\n\t}\n\n\treturn blocks.filter( Boolean );\n};\n\n/**\n * Function to get all the core blocks in an array.\n *\n * @example\n * ```js\n * import { __experimentalGetCoreBlocks } from '@wordpress/block-library';\n *\n * const coreBlocks = __experimentalGetCoreBlocks();\n * ```\n */\nexport const __experimentalGetCoreBlocks = () =>\n\tgetAllBlocks().filter(\n\t\t( { metadata } ) => ! isBlockMetadataExperimental( metadata )\n\t);\n\n/**\n * Function to register core blocks provided by the block editor.\n *\n * @param {Array} blocks An optional array of the core blocks being registered.\n *\n * @example\n * ```js\n * import { registerCoreBlocks } from '@wordpress/block-library';\n *\n * registerCoreBlocks();\n * ```\n */\nexport const registerCoreBlocks = (\n\tblocks = __experimentalGetCoreBlocks()\n) => {\n\tblocks.forEach( ( { init } ) => init() );\n\n\tsetDefaultBlockName( paragraph.name );\n\tif (\n\t\twindow.wp &&\n\t\twindow.wp.oldEditor &&\n\t\tblocks.some( ( { name } ) => name === classic.name )\n\t) {\n\t\tsetFreeformContentHandlerName( classic.name );\n\t}\n\tsetUnregisteredTypeHandlerName( missing.name );\n\tsetGroupingBlockName( group.name );\n};\n\n/**\n * Function to register experimental core blocks depending on editor settings.\n *\n * @param {boolean} enableFSEBlocks Whether to enable the full site editing blocks.\n * @example\n * ```js\n * import { __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';\n *\n * __experimentalRegisterExperimentalCoreBlocks( settings );\n * ```\n */\nexport const __experimentalRegisterExperimentalCoreBlocks = process.env\n\t.IS_GUTENBERG_PLUGIN\n\t? ( { enableFSEBlocks } = {} ) => {\n\t\t\tconst enabledExperiments = [ enableFSEBlocks ? 'fse' : null ];\n\t\t\tgetAllBlocks()\n\t\t\t\t.filter( ( { metadata } ) =>\n\t\t\t\t\tisBlockMetadataExperimental( metadata )\n\t\t\t\t)\n\t\t\t\t.filter(\n\t\t\t\t\t( { metadata: { __experimental } } ) =>\n\t\t\t\t\t\t__experimental === true ||\n\t\t\t\t\t\tenabledExperiments.includes( __experimental )\n\t\t\t\t)\n\t\t\t\t.forEach( ( { init } ) => init() );\n\t }\n\t: undefined;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,mBAAmB,EACnBC,6BAA6B,EAC7BC,8BAA8B,EAC9BC,oBAAoB,QACd,mBAAmB;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKC,QAAQ,MAAM,YAAY;AACtC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,OAAO,KAAKC,KAAK,MAAM,SAAS;AAChC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,OAAO,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9C;EACAtH,8BAA8B,CAAE0C,OAAO,CAAC4E,IAAK,CAAC;EAC9CrH,oBAAoB,CAAE8B,KAAK,CAACuF,IAAK,CAAC;AACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,4CAA4C,GAAGC,OAAO,CAACC,GAAG,CACrEC,mBAAmB,GAClB,CAAE;EAAEC;AAAgB,CAAC,GAAG,CAAC,CAAC,KAAM;EAChC,MAAMC,kBAAkB,GAAG,CAAED,eAAe,GAAG,KAAK,GAAG,IAAI,CAAE;EAC7DxB,YAAY,CAAC,CAAC,CACZW,MAAM,CAAE,CAAE;IAAEG;EAAS,CAAC,KACtBf,2BAA2B,CAAEe,QAAS,CACvC,CAAC,CACAH,MAAM,CACN,CAAE;IAAEG,QAAQ,EAAE;MAAEY;IAAe;EAAE,CAAC,KACjCA,cAAc,KAAK,IAAI,IACvBD,kBAAkB,CAACE,QAAQ,CAAED,cAAe,CAC9C,CAAC,CACAV,OAAO,CAAE,CAAE;IAAEC;EAAK,CAAC,KAAMA,IAAI,CAAC,CAAE,CAAC;AACnC,CAAC,GACDW,SAAS"}
1
+ {"version":3,"names":["setDefaultBlockName","setFreeformContentHandlerName","setUnregisteredTypeHandlerName","setGroupingBlockName","archives","avatar","audio","button","buttons","calendar","categories","classic","code","column","columns","comments","commentAuthorAvatar","commentAuthorName","commentContent","commentDate","commentEditLink","commentReplyLink","commentTemplate","commentsPaginationPrevious","commentsPagination","commentsPaginationNext","commentsPaginationNumbers","commentsTitle","cover","details","embed","file","form","formInput","formSubmitButton","formSubmissionNotification","gallery","group","heading","homeLink","html","image","latestComments","latestPosts","list","listItem","logInOut","mediaText","missing","more","navigation","navigationLink","navigationSubmenu","nextpage","pattern","pageList","pageListItem","paragraph","postAuthor","postAuthorName","postAuthorBiography","postComment","postCommentsCount","postCommentsForm","postCommentsLink","postContent","postDate","postExcerpt","postFeaturedImage","postNavigationLink","postTemplate","postTerms","postTimeToRead","postTitle","preformatted","pullquote","query","queryNoResults","queryPagination","queryPaginationNext","queryPaginationNumbers","queryPaginationPrevious","queryTitle","quote","reusableBlock","readMore","rss","search","separator","shortcode","siteLogo","siteTagline","siteTitle","socialLink","socialLinks","spacer","table","tableOfContents","tagCloud","templatePart","termDescription","textColumns","verse","video","footnotes","isBlockMetadataExperimental","getAllBlocks","blocks","window","__experimentalEnableFormBlocks","push","wp","oldEditor","needsClassicBlock","__experimentalDisableTinymce","URLSearchParams","location","get","filter","Boolean","__experimentalGetCoreBlocks","metadata","registerCoreBlocks","forEach","init","name","some","__experimentalRegisterExperimentalCoreBlocks","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","enabledExperiments","__experimental","includes","undefined"],"sources":["@wordpress/block-library/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tsetDefaultBlockName,\n\tsetFreeformContentHandlerName,\n\tsetUnregisteredTypeHandlerName,\n\tsetGroupingBlockName,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\n// When IS_GUTENBERG_PLUGIN is set to false, imports of experimental blocks\n// are transformed by packages/block-library/src/index.js as follows:\n// import * as experimentalBlock from './experimental-block'\n// becomes\n// const experimentalBlock = null;\n// This enables webpack to eliminate the experimental blocks code from the\n// production build to make the final bundle smaller.\n//\n// See https://github.com/WordPress/gutenberg/pull/40655 for more context.\nimport * as archives from './archives';\nimport * as avatar from './avatar';\nimport * as audio from './audio';\nimport * as button from './button';\nimport * as buttons from './buttons';\nimport * as calendar from './calendar';\nimport * as categories from './categories';\nimport * as classic from './freeform';\nimport * as code from './code';\nimport * as column from './column';\nimport * as columns from './columns';\nimport * as comments from './comments';\nimport * as commentAuthorAvatar from './comment-author-avatar';\nimport * as commentAuthorName from './comment-author-name';\nimport * as commentContent from './comment-content';\nimport * as commentDate from './comment-date';\nimport * as commentEditLink from './comment-edit-link';\nimport * as commentReplyLink from './comment-reply-link';\nimport * as commentTemplate from './comment-template';\nimport * as commentsPaginationPrevious from './comments-pagination-previous';\nimport * as commentsPagination from './comments-pagination';\nimport * as commentsPaginationNext from './comments-pagination-next';\nimport * as commentsPaginationNumbers from './comments-pagination-numbers';\nimport * as commentsTitle from './comments-title';\nimport * as cover from './cover';\nimport * as details from './details';\nimport * as embed from './embed';\nimport * as file from './file';\nimport * as form from './form';\nimport * as formInput from './form-input';\nimport * as formSubmitButton from './form-submit-button';\nimport * as formSubmissionNotification from './form-submission-notification';\nimport * as gallery from './gallery';\nimport * as group from './group';\nimport * as heading from './heading';\nimport * as homeLink from './home-link';\nimport * as html from './html';\nimport * as image from './image';\nimport * as latestComments from './latest-comments';\nimport * as latestPosts from './latest-posts';\nimport * as list from './list';\nimport * as listItem from './list-item';\nimport * as logInOut from './loginout';\nimport * as mediaText from './media-text';\nimport * as missing from './missing';\nimport * as more from './more';\nimport * as navigation from './navigation';\nimport * as navigationLink from './navigation-link';\nimport * as navigationSubmenu from './navigation-submenu';\nimport * as nextpage from './nextpage';\nimport * as pattern from './pattern';\nimport * as pageList from './page-list';\nimport * as pageListItem from './page-list-item';\nimport * as paragraph from './paragraph';\nimport * as postAuthor from './post-author';\nimport * as postAuthorName from './post-author-name';\nimport * as postAuthorBiography from './post-author-biography';\nimport * as postComment from './post-comment';\nimport * as postCommentsCount from './post-comments-count';\nimport * as postCommentsForm from './post-comments-form';\nimport * as postCommentsLink from './post-comments-link';\nimport * as postContent from './post-content';\nimport * as postDate from './post-date';\nimport * as postExcerpt from './post-excerpt';\nimport * as postFeaturedImage from './post-featured-image';\nimport * as postNavigationLink from './post-navigation-link';\nimport * as postTemplate from './post-template';\nimport * as postTerms from './post-terms';\nimport * as postTimeToRead from './post-time-to-read';\nimport * as postTitle from './post-title';\nimport * as preformatted from './preformatted';\nimport * as pullquote from './pullquote';\nimport * as query from './query';\nimport * as queryNoResults from './query-no-results';\nimport * as queryPagination from './query-pagination';\nimport * as queryPaginationNext from './query-pagination-next';\nimport * as queryPaginationNumbers from './query-pagination-numbers';\nimport * as queryPaginationPrevious from './query-pagination-previous';\nimport * as queryTitle from './query-title';\nimport * as quote from './quote';\nimport * as reusableBlock from './block';\nimport * as readMore from './read-more';\nimport * as rss from './rss';\nimport * as search from './search';\nimport * as separator from './separator';\nimport * as shortcode from './shortcode';\nimport * as siteLogo from './site-logo';\nimport * as siteTagline from './site-tagline';\nimport * as siteTitle from './site-title';\nimport * as socialLink from './social-link';\nimport * as socialLinks from './social-links';\nimport * as spacer from './spacer';\nimport * as table from './table';\nimport * as tableOfContents from './table-of-contents';\nimport * as tagCloud from './tag-cloud';\nimport * as templatePart from './template-part';\nimport * as termDescription from './term-description';\nimport * as textColumns from './text-columns';\nimport * as verse from './verse';\nimport * as video from './video';\nimport * as footnotes from './footnotes';\n\nimport isBlockMetadataExperimental from './utils/is-block-metadata-experimental';\n\n/**\n * Function to get all the block-library blocks in an array\n */\nconst getAllBlocks = () => {\n\tconst blocks = [\n\t\t// Common blocks are grouped at the top to prioritize their display\n\t\t// in various contexts — like the inserter and auto-complete components.\n\t\tparagraph,\n\t\timage,\n\t\theading,\n\t\tgallery,\n\t\tlist,\n\t\tlistItem,\n\t\tquote,\n\n\t\t// Register all remaining core blocks.\n\t\tarchives,\n\t\taudio,\n\t\tbutton,\n\t\tbuttons,\n\t\tcalendar,\n\t\tcategories,\n\t\tcode,\n\t\tcolumn,\n\t\tcolumns,\n\t\tcommentAuthorAvatar,\n\t\tcover,\n\t\tdetails,\n\t\tembed,\n\t\tfile,\n\t\tgroup,\n\t\thtml,\n\t\tlatestComments,\n\t\tlatestPosts,\n\t\tmediaText,\n\t\tmissing,\n\t\tmore,\n\t\tnextpage,\n\t\tpageList,\n\t\tpageListItem,\n\t\tpattern,\n\t\tpreformatted,\n\t\tpullquote,\n\t\treusableBlock,\n\t\trss,\n\t\tsearch,\n\t\tseparator,\n\t\tshortcode,\n\t\tsocialLink,\n\t\tsocialLinks,\n\t\tspacer,\n\t\ttable,\n\t\ttagCloud,\n\t\ttextColumns,\n\t\tverse,\n\t\tvideo,\n\t\tfootnotes,\n\n\t\t// theme blocks\n\t\tnavigation,\n\t\tnavigationLink,\n\t\tnavigationSubmenu,\n\t\tsiteLogo,\n\t\tsiteTitle,\n\t\tsiteTagline,\n\t\tquery,\n\t\ttemplatePart,\n\t\tavatar,\n\t\tpostTitle,\n\t\tpostExcerpt,\n\t\tpostFeaturedImage,\n\t\tpostContent,\n\t\tpostAuthor,\n\t\tpostAuthorName,\n\t\tpostComment,\n\t\tpostCommentsCount,\n\t\tpostCommentsLink,\n\t\tpostDate,\n\t\tpostTerms,\n\t\tpostNavigationLink,\n\t\tpostTemplate,\n\t\tpostTimeToRead,\n\t\tqueryPagination,\n\t\tqueryPaginationNext,\n\t\tqueryPaginationNumbers,\n\t\tqueryPaginationPrevious,\n\t\tqueryNoResults,\n\t\treadMore,\n\t\tcomments,\n\t\tcommentAuthorName,\n\t\tcommentContent,\n\t\tcommentDate,\n\t\tcommentEditLink,\n\t\tcommentReplyLink,\n\t\tcommentTemplate,\n\t\tcommentsTitle,\n\t\tcommentsPagination,\n\t\tcommentsPaginationNext,\n\t\tcommentsPaginationNumbers,\n\t\tcommentsPaginationPrevious,\n\t\tpostCommentsForm,\n\t\ttableOfContents,\n\t\thomeLink,\n\t\tlogInOut,\n\t\ttermDescription,\n\t\tqueryTitle,\n\t\tpostAuthorBiography,\n\t];\n\tif ( window?.__experimentalEnableFormBlocks ) {\n\t\tblocks.push( form );\n\t\tblocks.push( formInput );\n\t\tblocks.push( formSubmitButton );\n\t\tblocks.push( formSubmissionNotification );\n\t}\n\n\t// When in a WordPress context, conditionally\n\t// add the classic block and TinyMCE editor\n\t// under any of the following conditions:\n\t// - the current post contains a classic block\n\t// - the experiment to disable TinyMCE isn't active.\n\t// - a query argument specifies that TinyMCE should be loaded\n\tif (\n\t\twindow?.wp?.oldEditor &&\n\t\t( window?.wp?.needsClassicBlock ||\n\t\t\t! window?.__experimentalDisableTinymce ||\n\t\t\t!! new URLSearchParams( window?.location?.search ).get(\n\t\t\t\t'requiresTinymce'\n\t\t\t) )\n\t) {\n\t\tblocks.push( classic );\n\t}\n\n\treturn blocks.filter( Boolean );\n};\n\n/**\n * Function to get all the core blocks in an array.\n *\n * @example\n * ```js\n * import { __experimentalGetCoreBlocks } from '@wordpress/block-library';\n *\n * const coreBlocks = __experimentalGetCoreBlocks();\n * ```\n */\nexport const __experimentalGetCoreBlocks = () =>\n\tgetAllBlocks().filter(\n\t\t( { metadata } ) => ! isBlockMetadataExperimental( metadata )\n\t);\n\n/**\n * Function to register core blocks provided by the block editor.\n *\n * @param {Array} blocks An optional array of the core blocks being registered.\n *\n * @example\n * ```js\n * import { registerCoreBlocks } from '@wordpress/block-library';\n *\n * registerCoreBlocks();\n * ```\n */\nexport const registerCoreBlocks = (\n\tblocks = __experimentalGetCoreBlocks()\n) => {\n\tblocks.forEach( ( { init } ) => init() );\n\n\tsetDefaultBlockName( paragraph.name );\n\tif (\n\t\twindow.wp &&\n\t\twindow.wp.oldEditor &&\n\t\tblocks.some( ( { name } ) => name === classic.name )\n\t) {\n\t\tsetFreeformContentHandlerName( classic.name );\n\t}\n\tsetUnregisteredTypeHandlerName( missing.name );\n\tsetGroupingBlockName( group.name );\n};\n\n/**\n * Function to register experimental core blocks depending on editor settings.\n *\n * @param {boolean} enableFSEBlocks Whether to enable the full site editing blocks.\n * @example\n * ```js\n * import { __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';\n *\n * __experimentalRegisterExperimentalCoreBlocks( settings );\n * ```\n */\nexport const __experimentalRegisterExperimentalCoreBlocks = process.env\n\t.IS_GUTENBERG_PLUGIN\n\t? ( { enableFSEBlocks } = {} ) => {\n\t\t\tconst enabledExperiments = [ enableFSEBlocks ? 'fse' : null ];\n\t\t\tgetAllBlocks()\n\t\t\t\t.filter( ( { metadata } ) =>\n\t\t\t\t\tisBlockMetadataExperimental( metadata )\n\t\t\t\t)\n\t\t\t\t.filter(\n\t\t\t\t\t( { metadata: { __experimental } } ) =>\n\t\t\t\t\t\t__experimental === true ||\n\t\t\t\t\t\tenabledExperiments.includes( __experimental )\n\t\t\t\t)\n\t\t\t\t.forEach( ( { init } ) => init() );\n\t }\n\t: undefined;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,mBAAmB,EACnBC,6BAA6B,EAC7BC,8BAA8B,EAC9BC,oBAAoB,QACd,mBAAmB;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKC,QAAQ,MAAM,YAAY;AACtC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,OAAO,KAAKC,KAAK,MAAM,SAAS;AAChC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,OAAO,KAAKC,OAAO,MAAM,WAAW;AACpC,OAAO,KAAKC,QAAQ,MAAM,YAAY;AACtC,OAAO,KAAKC,UAAU,MAAM,cAAc;AAC1C,OAAO,KAAKC,OAAO,MAAM,YAAY;AACrC,OAAO,KAAKC,IAAI,MAAM,QAAQ;AAC9B,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,OAAO,KAAKC,OAAO,MAAM,WAAW;AACpC,OAAO,KAAKC,QAAQ,MAAM,YAAY;AACtC,OAAO,KAAKC,mBAAmB,MAAM,yBAAyB;AAC9D,OAAO,KAAKC,iBAAiB,MAAM,uBAAuB;AAC1D,OAAO,KAAKC,cAAc,MAAM,mBAAmB;AACnD,OAAO,KAAKC,WAAW,MAAM,gBAAgB;AAC7C,OAAO,KAAKC,eAAe,MAAM,qBAAqB;AACtD,OAAO,KAAKC,gBAAgB,MAAM,sBAAsB;AACxD,OAAO,KAAKC,eAAe,MAAM,oBAAoB;AACrD,OAAO,KAAKC,0BAA0B,MAAM,gCAAgC;AAC5E,OAAO,KAAKC,kBAAkB,MAAM,uBAAuB;AAC3D,OAAO,KAAKC,sBAAsB,MAAM,4BAA4B;AACpE,OAAO,KAAKC,yBAAyB,MAAM,+BAA+B;AAC1E,OAAO,KAAKC,aAAa,MAAM,k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AAY,CAAC,CAAC,CACZY,MAAM,CAAE,CAAE;IAAEG;EAAS,CAAC,KACtBhB,2BAA2B,CAAEgB,QAAS,CACvC,CAAC,CACAH,MAAM,CACN,CAAE;IAAEG,QAAQ,EAAE;MAAEY;IAAe;EAAE,CAAC,KACjCA,cAAc,KAAK,IAAI,IACvBD,kBAAkB,CAACE,QAAQ,CAAED,cAAe,CAC9C,CAAC,CACAV,OAAO,CAAE,CAAE;IAAEC;EAAK,CAAC,KAAMA,IAAI,CAAC,CAAE,CAAC;AACnC,CAAC,GACDW,SAAS"}
@@ -346,14 +346,18 @@ export default function LatestPostsEdit({
346
346
  }
347
347
  });
348
348
  const needsReadMore = excerptLength < excerpt.trim().split(' ').length && post.excerpt.raw === '';
349
- const postExcerpt = needsReadMore ? createElement(Fragment, null, excerpt.trim().split(' ', excerptLength).join(' '), createInterpolateElement( /* translators: excerpt truncation character, default */
350
- __(' … <a>Read more</a>'), {
349
+ const postExcerpt = needsReadMore ? createElement(Fragment, null, excerpt.trim().split(' ', excerptLength).join(' '), createInterpolateElement(sprintf( /* translators: 1: Hidden accessibility text: Post title */
350
+ __('… <a>Read more<span>: %1$s</span></a>'), titleTrimmed || __('(no title)')), {
351
351
  a:
352
352
  // eslint-disable-next-line jsx-a11y/anchor-has-content
353
353
  createElement("a", {
354
+ className: "wp-block-latest-posts__read-more",
354
355
  href: post.link,
355
356
  rel: "noopener noreferrer",
356
357
  onClick: showRedirectionPreventedNotice
358
+ }),
359
+ span: createElement("span", {
360
+ className: "screen-reader-text"
357
361
  })
358
362
  })) : excerpt;
359
363
  return createElement("li", {