@wordpress/block-library 9.24.0 → 9.26.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 (300) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/avatar/edit.js +84 -39
  3. package/build/avatar/edit.js.map +1 -1
  4. package/build/avatar/user-control.js +32 -17
  5. package/build/avatar/user-control.js.map +1 -1
  6. package/build/button/edit.js +29 -17
  7. package/build/button/edit.js.map +1 -1
  8. package/build/columns/edit.js +18 -22
  9. package/build/columns/edit.js.map +1 -1
  10. package/build/comment-author-name/edit.js +41 -12
  11. package/build/comment-author-name/edit.js.map +1 -1
  12. package/build/comment-date/edit.js +41 -12
  13. package/build/comment-date/edit.js.map +1 -1
  14. package/build/comment-edit-link/edit.js +27 -7
  15. package/build/comment-edit-link/edit.js.map +1 -1
  16. package/build/comments/edit/comments-inspector-controls.js +1 -3
  17. package/build/comments/edit/comments-inspector-controls.js.map +1 -1
  18. package/build/comments-pagination/edit.js +23 -9
  19. package/build/comments-pagination/edit.js.map +1 -1
  20. package/build/comments-title/edit.js +41 -12
  21. package/build/comments-title/edit.js.map +1 -1
  22. package/build/details/edit.js +27 -3
  23. package/build/details/edit.js.map +1 -1
  24. package/build/embed/edit.js +2 -4
  25. package/build/embed/edit.js.map +1 -1
  26. package/build/embed/embed-controls.js +41 -22
  27. package/build/embed/embed-controls.js.map +1 -1
  28. package/build/embed/variations.js +0 -10
  29. package/build/embed/variations.js.map +1 -1
  30. package/build/file/inspector.js +73 -30
  31. package/build/file/inspector.js.map +1 -1
  32. package/build/form/edit.js +67 -38
  33. package/build/form/edit.js.map +1 -1
  34. package/build/form/index.js +3 -3
  35. package/build/form/index.js.map +1 -1
  36. package/build/form-input/edit.js +47 -18
  37. package/build/form-input/edit.js.map +1 -1
  38. package/build/form-input/index.js +2 -1
  39. package/build/form-input/index.js.map +1 -1
  40. package/build/form-submission-notification/index.js +2 -1
  41. package/build/form-submission-notification/index.js.map +1 -1
  42. package/build/form-submit-button/index.js +2 -1
  43. package/build/form-submit-button/index.js.map +1 -1
  44. package/build/image/image.js +1 -0
  45. package/build/image/image.js.map +1 -1
  46. package/build/image/view.js +0 -3
  47. package/build/image/view.js.map +1 -1
  48. package/build/latest-posts/edit.js +154 -82
  49. package/build/latest-posts/edit.js.map +1 -1
  50. package/build/list/ordered-list-settings.js +131 -52
  51. package/build/list/ordered-list-settings.js.map +1 -1
  52. package/build/navigation/edit/index.js +93 -51
  53. package/build/navigation/edit/index.js.map +1 -1
  54. package/build/navigation/edit/overlay-menu-preview.js +43 -27
  55. package/build/navigation/edit/overlay-menu-preview.js.map +1 -1
  56. package/build/navigation-link/edit.js +11 -0
  57. package/build/navigation-link/edit.js.map +1 -1
  58. package/build/navigation-link/index.js +3 -0
  59. package/build/navigation-link/index.js.map +1 -1
  60. package/build/navigation-link/transforms.js +2 -0
  61. package/build/navigation-link/transforms.js.map +1 -1
  62. package/build/navigation-link/update-attributes.js +1 -0
  63. package/build/navigation-link/update-attributes.js.map +1 -1
  64. package/build/navigation-submenu/index.js +3 -0
  65. package/build/navigation-submenu/index.js.map +1 -1
  66. package/build/post-author/edit.js +75 -18
  67. package/build/post-author/edit.js.map +1 -1
  68. package/build/post-comments-count/index.js +3 -1
  69. package/build/post-comments-count/index.js.map +1 -1
  70. package/build/post-comments-count/transforms.js +26 -0
  71. package/build/post-comments-count/transforms.js.map +1 -0
  72. package/build/post-comments-link/index.js +3 -1
  73. package/build/post-comments-link/index.js.map +1 -1
  74. package/build/post-comments-link/transforms.js +26 -0
  75. package/build/post-comments-link/transforms.js.map +1 -0
  76. package/build/post-navigation-link/edit.js +72 -33
  77. package/build/post-navigation-link/edit.js.map +1 -1
  78. package/build/post-title/edit.js +56 -18
  79. package/build/post-title/edit.js.map +1 -1
  80. package/build/query/edit/enhanced-pagination-modal.js +1 -1
  81. package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
  82. package/build/query/edit/inspector-controls/enhanced-pagination-control.js +3 -6
  83. package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  84. package/build/rss/edit.js +120 -46
  85. package/build/rss/edit.js.map +1 -1
  86. package/build/separator/edit.js +52 -20
  87. package/build/separator/edit.js.map +1 -1
  88. package/build/shortcode/index.js +2 -1
  89. package/build/shortcode/index.js.map +1 -1
  90. package/build/site-logo/edit.js +53 -19
  91. package/build/site-logo/edit.js.map +1 -1
  92. package/build/social-link/edit.js +21 -5
  93. package/build/social-link/edit.js.map +1 -1
  94. package/build/social-link/edit.native.js +13 -5
  95. package/build/social-link/edit.native.js.map +1 -1
  96. package/build/social-link/social-list.js +17 -25
  97. package/build/social-link/social-list.js.map +1 -1
  98. package/build/social-link/variations.js +53 -48
  99. package/build/social-link/variations.js.map +1 -1
  100. package/build/social-links/edit.js +38 -45
  101. package/build/social-links/edit.js.map +1 -1
  102. package/build/video/tracks-editor.js +63 -21
  103. package/build/video/tracks-editor.js.map +1 -1
  104. package/build-module/avatar/edit.js +83 -38
  105. package/build-module/avatar/edit.js.map +1 -1
  106. package/build-module/avatar/user-control.js +33 -18
  107. package/build-module/avatar/user-control.js.map +1 -1
  108. package/build-module/button/edit.js +30 -18
  109. package/build-module/button/edit.js.map +1 -1
  110. package/build-module/columns/edit.js +18 -22
  111. package/build-module/columns/edit.js.map +1 -1
  112. package/build-module/comment-author-name/edit.js +42 -13
  113. package/build-module/comment-author-name/edit.js.map +1 -1
  114. package/build-module/comment-date/edit.js +42 -13
  115. package/build-module/comment-date/edit.js.map +1 -1
  116. package/build-module/comment-edit-link/edit.js +28 -8
  117. package/build-module/comment-edit-link/edit.js.map +1 -1
  118. package/build-module/comments/edit/comments-inspector-controls.js +1 -3
  119. package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
  120. package/build-module/comments-pagination/edit.js +24 -10
  121. package/build-module/comments-pagination/edit.js.map +1 -1
  122. package/build-module/comments-title/edit.js +42 -13
  123. package/build-module/comments-title/edit.js.map +1 -1
  124. package/build-module/details/edit.js +29 -5
  125. package/build-module/details/edit.js.map +1 -1
  126. package/build-module/embed/edit.js +2 -4
  127. package/build-module/embed/edit.js.map +1 -1
  128. package/build-module/embed/embed-controls.js +42 -23
  129. package/build-module/embed/embed-controls.js.map +1 -1
  130. package/build-module/embed/variations.js +0 -10
  131. package/build-module/embed/variations.js.map +1 -1
  132. package/build-module/file/inspector.js +74 -31
  133. package/build-module/file/inspector.js.map +1 -1
  134. package/build-module/form/edit.js +68 -39
  135. package/build-module/form/edit.js.map +1 -1
  136. package/build-module/form/index.js +3 -3
  137. package/build-module/form/index.js.map +1 -1
  138. package/build-module/form-input/edit.js +48 -19
  139. package/build-module/form-input/edit.js.map +1 -1
  140. package/build-module/form-input/index.js +2 -1
  141. package/build-module/form-input/index.js.map +1 -1
  142. package/build-module/form-submission-notification/index.js +2 -1
  143. package/build-module/form-submission-notification/index.js.map +1 -1
  144. package/build-module/form-submit-button/index.js +2 -1
  145. package/build-module/form-submit-button/index.js.map +1 -1
  146. package/build-module/image/image.js +1 -0
  147. package/build-module/image/image.js.map +1 -1
  148. package/build-module/image/view.js +0 -3
  149. package/build-module/image/view.js.map +1 -1
  150. package/build-module/latest-posts/edit.js +155 -83
  151. package/build-module/latest-posts/edit.js.map +1 -1
  152. package/build-module/list/ordered-list-settings.js +132 -53
  153. package/build-module/list/ordered-list-settings.js.map +1 -1
  154. package/build-module/navigation/edit/index.js +94 -52
  155. package/build-module/navigation/edit/index.js.map +1 -1
  156. package/build-module/navigation/edit/overlay-menu-preview.js +44 -28
  157. package/build-module/navigation/edit/overlay-menu-preview.js.map +1 -1
  158. package/build-module/navigation-link/edit.js +11 -0
  159. package/build-module/navigation-link/edit.js.map +1 -1
  160. package/build-module/navigation-link/index.js +3 -0
  161. package/build-module/navigation-link/index.js.map +1 -1
  162. package/build-module/navigation-link/transforms.js +2 -0
  163. package/build-module/navigation-link/transforms.js.map +1 -1
  164. package/build-module/navigation-link/update-attributes.js +1 -0
  165. package/build-module/navigation-link/update-attributes.js.map +1 -1
  166. package/build-module/navigation-submenu/index.js +3 -0
  167. package/build-module/navigation-submenu/index.js.map +1 -1
  168. package/build-module/post-author/edit.js +76 -19
  169. package/build-module/post-author/edit.js.map +1 -1
  170. package/build-module/post-comments-count/index.js +3 -1
  171. package/build-module/post-comments-count/index.js.map +1 -1
  172. package/build-module/post-comments-count/transforms.js +19 -0
  173. package/build-module/post-comments-count/transforms.js.map +1 -0
  174. package/build-module/post-comments-link/index.js +3 -1
  175. package/build-module/post-comments-link/index.js.map +1 -1
  176. package/build-module/post-comments-link/transforms.js +19 -0
  177. package/build-module/post-comments-link/transforms.js.map +1 -0
  178. package/build-module/post-navigation-link/edit.js +73 -34
  179. package/build-module/post-navigation-link/edit.js.map +1 -1
  180. package/build-module/post-title/edit.js +57 -19
  181. package/build-module/post-title/edit.js.map +1 -1
  182. package/build-module/query/edit/enhanced-pagination-modal.js +1 -1
  183. package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
  184. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +3 -6
  185. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  186. package/build-module/rss/edit.js +121 -47
  187. package/build-module/rss/edit.js.map +1 -1
  188. package/build-module/separator/edit.js +54 -22
  189. package/build-module/separator/edit.js.map +1 -1
  190. package/build-module/shortcode/index.js +2 -1
  191. package/build-module/shortcode/index.js.map +1 -1
  192. package/build-module/site-logo/edit.js +54 -20
  193. package/build-module/site-logo/edit.js.map +1 -1
  194. package/build-module/social-link/edit.js +24 -8
  195. package/build-module/social-link/edit.js.map +1 -1
  196. package/build-module/social-link/edit.native.js +15 -6
  197. package/build-module/social-link/edit.native.js.map +1 -1
  198. package/build-module/social-link/social-list.js +16 -21
  199. package/build-module/social-link/social-list.js.map +1 -1
  200. package/build-module/social-link/variations.js +53 -48
  201. package/build-module/social-link/variations.js.map +1 -1
  202. package/build-module/social-links/edit.js +40 -47
  203. package/build-module/social-links/edit.js.map +1 -1
  204. package/build-module/video/tracks-editor.js +65 -23
  205. package/build-module/video/tracks-editor.js.map +1 -1
  206. package/build-style/calendar/style-rtl.css +7 -7
  207. package/build-style/calendar/style.css +7 -7
  208. package/build-style/comments-pagination/editor-rtl.css +0 -12
  209. package/build-style/comments-pagination/editor.css +0 -14
  210. package/build-style/comments-pagination/style-rtl.css +0 -7
  211. package/build-style/comments-pagination/style.css +0 -9
  212. package/build-style/editor-rtl.css +9 -21
  213. package/build-style/editor.css +9 -23
  214. package/build-style/gallery/style-rtl.css +1 -0
  215. package/build-style/gallery/style.css +1 -0
  216. package/build-style/navigation/editor-rtl.css +8 -3
  217. package/build-style/navigation/editor.css +8 -3
  218. package/build-style/navigation/style-rtl.css +4 -0
  219. package/build-style/navigation/style.css +4 -0
  220. package/build-style/pullquote/editor-rtl.css +1 -1
  221. package/build-style/pullquote/editor.css +1 -1
  222. package/build-style/pullquote/style-rtl.css +2 -3
  223. package/build-style/pullquote/style.css +2 -3
  224. package/build-style/pullquote/theme-rtl.css +2 -2
  225. package/build-style/pullquote/theme.css +2 -2
  226. package/build-style/style-rtl.css +14 -17
  227. package/build-style/style.css +14 -19
  228. package/build-style/theme-rtl.css +2 -2
  229. package/build-style/theme.css +2 -2
  230. package/package.json +35 -35
  231. package/src/avatar/edit.js +99 -51
  232. package/src/avatar/user-control.js +34 -29
  233. package/src/button/edit.js +44 -29
  234. package/src/calendar/style.scss +10 -10
  235. package/src/columns/edit.js +20 -31
  236. package/src/comment-author-name/edit.js +54 -13
  237. package/src/comment-date/edit.js +50 -15
  238. package/src/comment-edit-link/edit.js +39 -11
  239. package/src/comments/edit/comments-inspector-controls.js +0 -2
  240. package/src/comments-pagination/edit.js +29 -9
  241. package/src/comments-pagination/editor.scss +0 -15
  242. package/src/comments-pagination/style.scss +0 -8
  243. package/src/comments-title/edit.js +53 -15
  244. package/src/details/edit.js +36 -4
  245. package/src/editor.scss +0 -1
  246. package/src/embed/edit.js +3 -5
  247. package/src/embed/embed-controls.js +55 -33
  248. package/src/embed/variations.js +0 -8
  249. package/src/file/inspector.js +99 -45
  250. package/src/form/block.json +1 -2
  251. package/src/form/edit.js +91 -47
  252. package/src/form/index.js +1 -0
  253. package/src/form-input/edit.js +56 -18
  254. package/src/form-input/index.js +1 -0
  255. package/src/form-submission-notification/index.js +1 -0
  256. package/src/form-submit-button/index.js +1 -0
  257. package/src/gallery/style.scss +1 -0
  258. package/src/image/image.js +1 -0
  259. package/src/image/index.php +4 -1
  260. package/src/image/view.js +0 -3
  261. package/src/latest-posts/edit.js +206 -98
  262. package/src/list/ordered-list-settings.js +172 -62
  263. package/src/navigation/edit/index.js +127 -64
  264. package/src/navigation/edit/overlay-menu-preview.js +43 -26
  265. package/src/navigation/editor.scss +8 -4
  266. package/src/navigation/style.scss +8 -0
  267. package/src/navigation-link/block.json +3 -0
  268. package/src/navigation-link/edit.js +14 -1
  269. package/src/navigation-link/index.php +4 -0
  270. package/src/navigation-link/transforms.js +2 -1
  271. package/src/navigation-link/update-attributes.js +1 -0
  272. package/src/navigation-submenu/block.json +3 -0
  273. package/src/navigation-submenu/index.php +4 -0
  274. package/src/post-author/edit.js +91 -27
  275. package/src/post-comments-count/index.js +2 -0
  276. package/src/post-comments-count/transforms.js +20 -0
  277. package/src/post-comments-link/index.js +2 -0
  278. package/src/post-comments-link/transforms.js +20 -0
  279. package/src/post-navigation-link/edit.js +96 -51
  280. package/src/post-title/edit.js +76 -24
  281. package/src/pullquote/editor.scss +1 -1
  282. package/src/pullquote/style.scss +2 -3
  283. package/src/pullquote/theme.scss +2 -2
  284. package/src/query/edit/enhanced-pagination-modal.js +1 -5
  285. package/src/query/edit/inspector-controls/enhanced-pagination-control.js +3 -13
  286. package/src/rss/edit.js +141 -55
  287. package/src/separator/edit.js +66 -21
  288. package/src/shortcode/block.json +2 -1
  289. package/src/site-logo/edit.js +69 -26
  290. package/src/site-title/index.php +1 -1
  291. package/src/social-link/edit.js +18 -7
  292. package/src/social-link/edit.native.js +10 -4
  293. package/src/social-link/index.php +62 -49
  294. package/src/social-link/social-list.js +15 -20
  295. package/src/social-link/variations.js +53 -48
  296. package/src/social-links/edit.js +38 -60
  297. package/src/video/tracks-editor.js +75 -22
  298. package/build-style/post-author/editor-rtl.css +0 -140
  299. package/build-style/post-author/editor.css +0 -140
  300. package/src/post-author/editor.scss +0 -7
@@ -1 +1 @@
1
- {"version":3,"names":["_interactivity","require","isTouching","lastTouchTime","state","actions","callbacks","store","currentImageId","currentImage","metadata","overlayOpened","roleAttribute","ariaModal","enlargedSrc","uploadedSrc","figureStyles","replace","imgStyles","imageButtonRight","imageId","getContext","imageButtonTop","isContentHidden","ctx","overlayEnabled","isContentVisible","showLightbox","imageRef","complete","scrollTopReset","document","documentElement","scrollTop","scrollLeftReset","scrollLeft","setOverlayStyles","hideLightbox","showClosingAnimation","setTimeout","buttonRef","focus","preventScroll","handleKeydown","withSyncEvent","event","key","preventDefault","ref","getElement","querySelector","handleTouchMove","handleTouchStart","handleTouchEnd","Date","now","handleScroll","window","scrollTo","naturalWidth","naturalHeight","offsetWidth","originalWidth","offsetHeight","originalHeight","x","screenPosX","y","screenPosY","getBoundingClientRect","naturalRatio","originalRatio","scaleAttr","heightWithoutSpace","widthWithoutSpace","imgMaxWidth","parseFloat","targetWidth","imgMaxHeight","targetHeight","imgRatio","containerMaxWidth","containerMaxHeight","containerWidth","containerHeight","toFixed","reducedHeight","reducedWidth","horizontalPadding","innerWidth","verticalPadding","targetMaxWidth","Math","min","targetMaxHeight","innerHeight","targetContainerRatio","containerScale","lightboxImgWidth","lightboxImgHeight","overlayStyles","clientWidth","setButtonStyles","currentSrc","figure","parentElement","figureWidth","figureHeight","clientHeight","caption","captionComputedStyle","getComputedStyle","includes","position","marginTop","marginBottom","buttonOffsetTop","buttonOffsetRight","offsetRatio","referenceHeight","referenceWidth","setOverlayFocus","initTriggerButton","lock"],"sources":["@wordpress/block-library/src/image/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tstore,\n\tgetContext,\n\tgetElement,\n\twithSyncEvent,\n} from '@wordpress/interactivity';\n\n/**\n * Tracks whether user is touching screen; used to differentiate behavior for\n * 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 differentiate behavior\n * for touch and mouse input.\n *\n * @type {number}\n */\nlet lastTouchTime = 0;\n\nconst { state, actions, callbacks } = store(\n\t'core/image',\n\t{\n\t\tstate: {\n\t\t\tcurrentImageId: null,\n\t\t\tget currentImage() {\n\t\t\t\treturn state.metadata[ state.currentImageId ];\n\t\t\t},\n\t\t\tget overlayOpened() {\n\t\t\t\treturn state.currentImageId !== null;\n\t\t\t},\n\t\t\tget roleAttribute() {\n\t\t\t\treturn state.overlayOpened ? 'dialog' : null;\n\t\t\t},\n\t\t\tget ariaModal() {\n\t\t\t\treturn state.overlayOpened ? 'true' : null;\n\t\t\t},\n\t\t\tget enlargedSrc() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.currentImage.uploadedSrc ||\n\t\t\t\t\t'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='\n\t\t\t\t);\n\t\t\t},\n\t\t\tget figureStyles() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.overlayOpened &&\n\t\t\t\t\t`${ state.currentImage.figureStyles?.replace(\n\t\t\t\t\t\t/margin[^;]*;?/g,\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\tget imgStyles() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.overlayOpened &&\n\t\t\t\t\t`${ state.currentImage.imgStyles?.replace(\n\t\t\t\t\t\t/;$/,\n\t\t\t\t\t\t''\n\t\t\t\t\t) }; object-fit:cover;`\n\t\t\t\t);\n\t\t\t},\n\t\t\tget imageButtonRight() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\treturn state.metadata[ imageId ].imageButtonRight;\n\t\t\t},\n\t\t\tget imageButtonTop() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\treturn state.metadata[ imageId ].imageButtonTop;\n\t\t\t},\n\t\t\tget isContentHidden() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn (\n\t\t\t\t\tstate.overlayEnabled && state.currentImageId === ctx.imageId\n\t\t\t\t);\n\t\t\t},\n\t\t\tget isContentVisible() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn (\n\t\t\t\t\t! state.overlayEnabled &&\n\t\t\t\t\tstate.currentImageId === ctx.imageId\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\tshowLightbox() {\n\t\t\t\tconst { imageId } = getContext();\n\n\t\t\t\t// Bails out if the image has not loaded yet.\n\t\t\t\tif ( ! state.metadata[ imageId ].imageRef?.complete ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Stores the positions of the scroll to fix it until the overlay is\n\t\t\t\t// closed.\n\t\t\t\tstate.scrollTopReset = document.documentElement.scrollTop;\n\t\t\t\tstate.scrollLeftReset = document.documentElement.scrollLeft;\n\n\t\t\t\t// Sets the current expanded image in the state and enables the overlay.\n\t\t\t\tstate.overlayEnabled = true;\n\t\t\t\tstate.currentImageId = imageId;\n\n\t\t\t\t// Computes the styles of the overlay for the animation.\n\t\t\t\tcallbacks.setOverlayStyles();\n\t\t\t},\n\t\t\thideLightbox() {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\t// Starts the overlay closing animation. The showClosingAnimation\n\t\t\t\t\t// class is used to avoid showing it on page load.\n\t\t\t\t\tstate.showClosingAnimation = true;\n\t\t\t\t\tstate.overlayEnabled = false;\n\n\t\t\t\t\t// Waits until the close animation has completed before allowing a\n\t\t\t\t\t// user to scroll again. The duration of this animation is defined in\n\t\t\t\t\t// the `styles.scss` file, but in any case we should wait a few\n\t\t\t\t\t// milliseconds longer than the duration, otherwise a user may scroll\n\t\t\t\t\t// too soon and cause the animation to look sloppy.\n\t\t\t\t\tsetTimeout( function () {\n\t\t\t\t\t\t// Delays before changing the focus. Otherwise the focus ring will\n\t\t\t\t\t\t// appear on Firefox before the image has finished animating, which\n\t\t\t\t\t\t// looks broken.\n\t\t\t\t\t\tstate.currentImage.buttonRef.focus( {\n\t\t\t\t\t\t\tpreventScroll: true,\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t// Resets the current image id to mark the overlay as closed.\n\t\t\t\t\t\tstate.currentImageId = null;\n\t\t\t\t\t}, 450 );\n\t\t\t\t}\n\t\t\t},\n\t\t\thandleKeydown: withSyncEvent( ( event ) => {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\t// Focuses the close button when the user presses the tab key.\n\t\t\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tconst { ref } = getElement();\n\t\t\t\t\t\tref.querySelector( 'button' ).focus();\n\t\t\t\t\t}\n\t\t\t\t\t// Closes the lightbox when the user presses the escape key.\n\t\t\t\t\tif ( event.key === 'Escape' ) {\n\t\t\t\t\t\tactions.hideLightbox();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} ),\n\t\t\thandleTouchMove: withSyncEvent( ( event ) => {\n\t\t\t\t// On mobile devices, prevents triggering the scroll event because\n\t\t\t\t// otherwise the page jumps around when it resets the scroll position.\n\t\t\t\t// This also means that closing the lightbox requires that a user\n\t\t\t\t// perform a simple tap. This may be changed in the future if there is a\n\t\t\t\t// better alternative to override or reset the scroll position during\n\t\t\t\t// swipe actions.\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t} ),\n\t\t\thandleTouchStart() {\n\t\t\t\tisTouching = true;\n\t\t\t},\n\t\t\thandleTouchEnd() {\n\t\t\t\t// Waits a few milliseconds before resetting to ensure that pinch to\n\t\t\t\t// zoom works consistently on mobile devices when the lightbox is open.\n\t\t\t\tlastTouchTime = Date.now();\n\t\t\t\tisTouching = false;\n\t\t\t},\n\t\t\thandleScroll() {\n\t\t\t\t// Prevents scrolling behaviors that trigger content shift while the\n\t\t\t\t// lightbox is open. It would be better to accomplish through CSS alone,\n\t\t\t\t// but using overflow: hidden is currently the only way to do so and\n\t\t\t\t// that causes a layout to shift and prevents the zoom animation from\n\t\t\t\t// working in some cases because it's not possible to account for the\n\t\t\t\t// layout shift when doing the animation calculations. Instead, it uses\n\t\t\t\t// JavaScript to prevent and reset the scrolling behavior.\n\t\t\t\tif ( state.overlayOpened ) {\n\t\t\t\t\t// Avoids overriding the scroll behavior on mobile devices because\n\t\t\t\t\t// doing so breaks the pinch to zoom functionality, and users should\n\t\t\t\t\t// be able to zoom in further on the high-res image.\n\t\t\t\t\tif ( ! isTouching && Date.now() - lastTouchTime > 450 ) {\n\t\t\t\t\t\t// It doesn't rely on `event.preventDefault()` to prevent scrolling\n\t\t\t\t\t\t// because the scroll event can't be canceled, so it resets the\n\t\t\t\t\t\t// position instead.\n\t\t\t\t\t\twindow.scrollTo(\n\t\t\t\t\t\t\tstate.scrollLeftReset,\n\t\t\t\t\t\t\tstate.scrollTopReset\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\tcallbacks: {\n\t\t\tsetOverlayStyles() {\n\t\t\t\tif ( ! state.overlayEnabled ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet {\n\t\t\t\t\tnaturalWidth,\n\t\t\t\t\tnaturalHeight,\n\t\t\t\t\toffsetWidth: originalWidth,\n\t\t\t\t\toffsetHeight: originalHeight,\n\t\t\t\t} = state.currentImage.imageRef;\n\t\t\t\tlet { x: screenPosX, y: screenPosY } =\n\t\t\t\t\tstate.currentImage.imageRef.getBoundingClientRect();\n\n\t\t\t\t// Natural ratio of the image clicked to open the lightbox.\n\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t// Original ratio of the image clicked to open the lightbox.\n\t\t\t\tlet originalRatio = originalWidth / originalHeight;\n\n\t\t\t\t// If it has object-fit: contain, recalculates the original sizes\n\t\t\t\t// and the screen position without the blank spaces.\n\t\t\t\tif ( state.currentImage.scaleAttr === 'contain' ) {\n\t\t\t\t\tif ( naturalRatio > originalRatio ) {\n\t\t\t\t\t\tconst heightWithoutSpace = originalWidth / naturalRatio;\n\t\t\t\t\t\t// Recalculates screen position without the top space.\n\t\t\t\t\t\tscreenPosY +=\n\t\t\t\t\t\t\t( originalHeight - heightWithoutSpace ) / 2;\n\t\t\t\t\t\toriginalHeight = heightWithoutSpace;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst widthWithoutSpace = originalHeight * naturalRatio;\n\t\t\t\t\t\t// Recalculates screen position without the left space.\n\t\t\t\t\t\tscreenPosX += ( originalWidth - widthWithoutSpace ) / 2;\n\t\t\t\t\t\toriginalWidth = widthWithoutSpace;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\toriginalRatio = originalWidth / originalHeight;\n\n\t\t\t\t// Typically, it uses the image's full-sized dimensions. If those\n\t\t\t\t// dimensions have not been set (i.e. an external image with only one\n\t\t\t\t// size), the image's dimensions in the lightbox are the same\n\t\t\t\t// as those of the image in the content.\n\t\t\t\tlet imgMaxWidth = parseFloat(\n\t\t\t\t\tstate.currentImage.targetWidth !== 'none'\n\t\t\t\t\t\t? state.currentImage.targetWidth\n\t\t\t\t\t\t: naturalWidth\n\t\t\t\t);\n\t\t\t\tlet imgMaxHeight = parseFloat(\n\t\t\t\t\tstate.currentImage.targetHeight !== 'none'\n\t\t\t\t\t\t? state.currentImage.targetHeight\n\t\t\t\t\t\t: naturalHeight\n\t\t\t\t);\n\n\t\t\t\t// Ratio of the biggest image stored in the database.\n\t\t\t\tlet imgRatio = imgMaxWidth / imgMaxHeight;\n\t\t\t\tlet containerMaxWidth = imgMaxWidth;\n\t\t\t\tlet containerMaxHeight = imgMaxHeight;\n\t\t\t\tlet containerWidth = imgMaxWidth;\n\t\t\t\tlet containerHeight = imgMaxHeight;\n\n\t\t\t\t// Checks if the target image has a different ratio than the original\n\t\t\t\t// one (thumbnail). Recalculates the width and height.\n\t\t\t\tif ( naturalRatio.toFixed( 2 ) !== imgRatio.toFixed( 2 ) ) {\n\t\t\t\t\tif ( naturalRatio > imgRatio ) {\n\t\t\t\t\t\t// If the width is reached before the height, it keeps the maxWidth\n\t\t\t\t\t\t// and recalculates the height unless the difference between the\n\t\t\t\t\t\t// maxHeight and the reducedHeight is higher than the maxWidth,\n\t\t\t\t\t\t// where it keeps the reducedHeight and recalculate the width.\n\t\t\t\t\t\tconst reducedHeight = imgMaxWidth / naturalRatio;\n\t\t\t\t\t\tif ( imgMaxHeight - reducedHeight > imgMaxWidth ) {\n\t\t\t\t\t\t\timgMaxHeight = reducedHeight;\n\t\t\t\t\t\t\timgMaxWidth = reducedHeight * naturalRatio;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\timgMaxHeight = imgMaxWidth / naturalRatio;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If the height is reached before the width, it keeps the maxHeight\n\t\t\t\t\t\t// and recalculate the width unlesss the difference between the\n\t\t\t\t\t\t// maxWidth and the reducedWidth is higher than the maxHeight, where\n\t\t\t\t\t\t// it keeps the reducedWidth and recalculate the height.\n\t\t\t\t\t\tconst reducedWidth = imgMaxHeight * naturalRatio;\n\t\t\t\t\t\tif ( imgMaxWidth - reducedWidth > imgMaxHeight ) {\n\t\t\t\t\t\t\timgMaxWidth = reducedWidth;\n\t\t\t\t\t\t\timgMaxHeight = reducedWidth / naturalRatio;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\timgMaxWidth = imgMaxHeight * naturalRatio;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcontainerWidth = imgMaxWidth;\n\t\t\t\t\tcontainerHeight = imgMaxHeight;\n\t\t\t\t\timgRatio = imgMaxWidth / imgMaxHeight;\n\n\t\t\t\t\t// Calculates the max size of the container.\n\t\t\t\t\tif ( originalRatio > imgRatio ) {\n\t\t\t\t\t\tcontainerMaxWidth = imgMaxWidth;\n\t\t\t\t\t\tcontainerMaxHeight = containerMaxWidth / originalRatio;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontainerMaxHeight = imgMaxHeight;\n\t\t\t\t\t\tcontainerMaxWidth = containerMaxHeight * originalRatio;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If the image has been pixelated on purpose, it keeps that size.\n\t\t\t\tif (\n\t\t\t\t\toriginalWidth > containerWidth ||\n\t\t\t\t\toriginalHeight > containerHeight\n\t\t\t\t) {\n\t\t\t\t\tcontainerWidth = originalWidth;\n\t\t\t\t\tcontainerHeight = originalHeight;\n\t\t\t\t}\n\n\t\t\t\t// Calculates the final lightbox image size and the scale factor.\n\t\t\t\t// MaxWidth is either the window container (accounting for padding) or\n\t\t\t\t// the image resolution.\n\t\t\t\tlet horizontalPadding = 0;\n\t\t\t\tif ( window.innerWidth > 480 ) {\n\t\t\t\t\thorizontalPadding = 80;\n\t\t\t\t} else if ( window.innerWidth > 1920 ) {\n\t\t\t\t\thorizontalPadding = 160;\n\t\t\t\t}\n\t\t\t\tconst verticalPadding = 80;\n\n\t\t\t\tconst targetMaxWidth = Math.min(\n\t\t\t\t\twindow.innerWidth - horizontalPadding,\n\t\t\t\t\tcontainerWidth\n\t\t\t\t);\n\t\t\t\tconst targetMaxHeight = Math.min(\n\t\t\t\t\twindow.innerHeight - verticalPadding,\n\t\t\t\t\tcontainerHeight\n\t\t\t\t);\n\t\t\t\tconst targetContainerRatio = targetMaxWidth / targetMaxHeight;\n\n\t\t\t\tif ( originalRatio > targetContainerRatio ) {\n\t\t\t\t\t// If targetMaxWidth is reached before targetMaxHeight.\n\t\t\t\t\tcontainerWidth = targetMaxWidth;\n\t\t\t\t\tcontainerHeight = containerWidth / originalRatio;\n\t\t\t\t} else {\n\t\t\t\t\t// If targetMaxHeight is reached before targetMaxWidth.\n\t\t\t\t\tcontainerHeight = targetMaxHeight;\n\t\t\t\t\tcontainerWidth = containerHeight * originalRatio;\n\t\t\t\t}\n\n\t\t\t\tconst containerScale = originalWidth / containerWidth;\n\t\t\t\tconst lightboxImgWidth =\n\t\t\t\t\timgMaxWidth * ( containerWidth / containerMaxWidth );\n\t\t\t\tconst lightboxImgHeight =\n\t\t\t\t\timgMaxHeight * ( containerHeight / containerMaxHeight );\n\n\t\t\t\t// As of this writing, using the calculations above will render the\n\t\t\t\t// lightbox with a small, erroneous whitespace on the left side of the\n\t\t\t\t// image in iOS Safari, perhaps due to an inconsistency in how browsers\n\t\t\t\t// handle absolute positioning and CSS transformation. In any case,\n\t\t\t\t// adding 1 pixel to the container width and height solves the problem,\n\t\t\t\t// though this can be removed if the issue is fixed in the future.\n\t\t\t\tstate.overlayStyles = `\n\t\t\t\t\t--wp--lightbox-initial-top-position: ${ screenPosY }px;\n\t\t\t\t\t--wp--lightbox-initial-left-position: ${ screenPosX }px;\n\t\t\t\t\t--wp--lightbox-container-width: ${ containerWidth + 1 }px;\n\t\t\t\t\t--wp--lightbox-container-height: ${ containerHeight + 1 }px;\n\t\t\t\t\t--wp--lightbox-image-width: ${ lightboxImgWidth }px;\n\t\t\t\t\t--wp--lightbox-image-height: ${ lightboxImgHeight }px;\n\t\t\t\t\t--wp--lightbox-scale: ${ containerScale };\n\t\t\t\t\t--wp--lightbox-scrollbar-width: ${\n\t\t\t\t\t\twindow.innerWidth - document.documentElement.clientWidth\n\t\t\t\t\t}px;\n\t\t\t\t`;\n\t\t\t},\n\t\t\tsetButtonStyles() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\tconst { ref } = getElement();\n\n\t\t\t\tstate.metadata[ imageId ].imageRef = ref;\n\t\t\t\tstate.metadata[ imageId ].currentSrc = ref.currentSrc;\n\n\t\t\t\tconst {\n\t\t\t\t\tnaturalWidth,\n\t\t\t\t\tnaturalHeight,\n\t\t\t\t\toffsetWidth,\n\t\t\t\t\toffsetHeight,\n\t\t\t\t} = ref;\n\n\t\t\t\t// If the image isn't loaded yet, it can't calculate where the button\n\t\t\t\t// should be.\n\t\t\t\tif ( naturalWidth === 0 || naturalHeight === 0 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst figure = ref.parentElement;\n\t\t\t\tconst figureWidth = ref.parentElement.clientWidth;\n\n\t\t\t\t// It needs special handling for the height because a caption will cause\n\t\t\t\t// the figure to be taller than the image, which means it needs to\n\t\t\t\t// account for that when calculating the placement of the button in the\n\t\t\t\t// top right corner of the image.\n\t\t\t\tlet figureHeight = ref.parentElement.clientHeight;\n\t\t\t\tconst caption = figure.querySelector( 'figcaption' );\n\t\t\t\tif ( caption ) {\n\t\t\t\t\tconst captionComputedStyle =\n\t\t\t\t\t\twindow.getComputedStyle( caption );\n\t\t\t\t\tif (\n\t\t\t\t\t\t! [ 'absolute', 'fixed' ].includes(\n\t\t\t\t\t\t\tcaptionComputedStyle.position\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tfigureHeight =\n\t\t\t\t\t\t\tfigureHeight -\n\t\t\t\t\t\t\tcaption.offsetHeight -\n\t\t\t\t\t\t\tparseFloat( captionComputedStyle.marginTop ) -\n\t\t\t\t\t\t\tparseFloat( captionComputedStyle.marginBottom );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst buttonOffsetTop = figureHeight - offsetHeight;\n\t\t\t\tconst buttonOffsetRight = figureWidth - offsetWidth;\n\n\t\t\t\tlet imageButtonTop = buttonOffsetTop + 16;\n\t\t\t\tlet imageButtonRight = buttonOffsetRight + 16;\n\n\t\t\t\t// In the case of an image with object-fit: contain, the size of the\n\t\t\t\t// <img> element can be larger than the image itself, so it needs to\n\t\t\t\t// calculate where to place the button.\n\t\t\t\tif ( state.metadata[ imageId ].scaleAttr === 'contain' ) {\n\t\t\t\t\t// Natural ratio of the image.\n\t\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t\t// Offset ratio of the image.\n\t\t\t\t\tconst offsetRatio = offsetWidth / offsetHeight;\n\n\t\t\t\t\tif ( naturalRatio >= offsetRatio ) {\n\t\t\t\t\t\t// If it reaches the width first, it keeps the width and compute the\n\t\t\t\t\t\t// height.\n\t\t\t\t\t\tconst referenceHeight = offsetWidth / naturalRatio;\n\t\t\t\t\t\timageButtonTop =\n\t\t\t\t\t\t\t( offsetHeight - referenceHeight ) / 2 +\n\t\t\t\t\t\t\tbuttonOffsetTop +\n\t\t\t\t\t\t\t16;\n\t\t\t\t\t\timageButtonRight = buttonOffsetRight + 16;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If it reaches the height first, it keeps the height and compute\n\t\t\t\t\t\t// the width.\n\t\t\t\t\t\tconst referenceWidth = offsetHeight * naturalRatio;\n\t\t\t\t\t\timageButtonTop = buttonOffsetTop + 16;\n\t\t\t\t\t\timageButtonRight =\n\t\t\t\t\t\t\t( offsetWidth - referenceWidth ) / 2 +\n\t\t\t\t\t\t\tbuttonOffsetRight +\n\t\t\t\t\t\t\t16;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tstate.metadata[ imageId ].imageButtonTop = imageButtonTop;\n\t\t\t\tstate.metadata[ imageId ].imageButtonRight = imageButtonRight;\n\t\t\t},\n\t\t\tsetOverlayFocus() {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\t// Moves the focus to the dialog when it opens.\n\t\t\t\t\tconst { ref } = getElement();\n\t\t\t\t\tref.focus();\n\t\t\t\t}\n\t\t\t},\n\t\t\tinitTriggerButton() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\tconst { ref } = getElement();\n\t\t\t\tstate.metadata[ imageId ].buttonRef = ref;\n\t\t\t},\n\t\t},\n\t},\n\t{ lock: true }\n);\n"],"mappings":";;AAGA,IAAAA,cAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,UAAU,GAAG,KAAK;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,aAAa,GAAG,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QAAI,CAAC,GAAG,IAAAC,yBAAU,EAAC,CAAC;QAC5BD,GAAG,CAACP,KAAK,CAAC,CAAC;MACZ;IACD,CAAC;IACDiF,iBAAiBA,CAAA,EAAG;MACnB,MAAM;QAAEtG;MAAQ,CAAC,GAAG,IAAAC,yBAAU,EAAC,CAAC;MAChC,MAAM;QAAE2B;MAAI,CAAC,GAAG,IAAAC,yBAAU,EAAC,CAAC;MAC5B7C,KAAK,CAACM,QAAQ,CAAEU,OAAO,CAAE,CAACoB,SAAS,GAAGQ,GAAG;IAC1C;EACD;AACD,CAAC,EACD;EAAE2E,IAAI,EAAE;AAAK,CACd,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_interactivity","require","isTouching","lastTouchTime","state","actions","callbacks","store","currentImageId","currentImage","metadata","overlayOpened","roleAttribute","ariaModal","enlargedSrc","uploadedSrc","figureStyles","replace","imgStyles","imageButtonRight","imageId","getContext","imageButtonTop","isContentHidden","ctx","overlayEnabled","isContentVisible","showLightbox","imageRef","complete","scrollTopReset","document","documentElement","scrollTop","scrollLeftReset","scrollLeft","setOverlayStyles","hideLightbox","setTimeout","buttonRef","focus","preventScroll","handleKeydown","withSyncEvent","event","key","preventDefault","ref","getElement","querySelector","handleTouchMove","handleTouchStart","handleTouchEnd","Date","now","handleScroll","window","scrollTo","naturalWidth","naturalHeight","offsetWidth","originalWidth","offsetHeight","originalHeight","x","screenPosX","y","screenPosY","getBoundingClientRect","naturalRatio","originalRatio","scaleAttr","heightWithoutSpace","widthWithoutSpace","imgMaxWidth","parseFloat","targetWidth","imgMaxHeight","targetHeight","imgRatio","containerMaxWidth","containerMaxHeight","containerWidth","containerHeight","toFixed","reducedHeight","reducedWidth","horizontalPadding","innerWidth","verticalPadding","targetMaxWidth","Math","min","targetMaxHeight","innerHeight","targetContainerRatio","containerScale","lightboxImgWidth","lightboxImgHeight","overlayStyles","clientWidth","setButtonStyles","currentSrc","figure","parentElement","figureWidth","figureHeight","clientHeight","caption","captionComputedStyle","getComputedStyle","includes","position","marginTop","marginBottom","buttonOffsetTop","buttonOffsetRight","offsetRatio","referenceHeight","referenceWidth","setOverlayFocus","initTriggerButton","lock"],"sources":["@wordpress/block-library/src/image/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tstore,\n\tgetContext,\n\tgetElement,\n\twithSyncEvent,\n} from '@wordpress/interactivity';\n\n/**\n * Tracks whether user is touching screen; used to differentiate behavior for\n * 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 differentiate behavior\n * for touch and mouse input.\n *\n * @type {number}\n */\nlet lastTouchTime = 0;\n\nconst { state, actions, callbacks } = store(\n\t'core/image',\n\t{\n\t\tstate: {\n\t\t\tcurrentImageId: null,\n\t\t\tget currentImage() {\n\t\t\t\treturn state.metadata[ state.currentImageId ];\n\t\t\t},\n\t\t\tget overlayOpened() {\n\t\t\t\treturn state.currentImageId !== null;\n\t\t\t},\n\t\t\tget roleAttribute() {\n\t\t\t\treturn state.overlayOpened ? 'dialog' : null;\n\t\t\t},\n\t\t\tget ariaModal() {\n\t\t\t\treturn state.overlayOpened ? 'true' : null;\n\t\t\t},\n\t\t\tget enlargedSrc() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.currentImage.uploadedSrc ||\n\t\t\t\t\t'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='\n\t\t\t\t);\n\t\t\t},\n\t\t\tget figureStyles() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.overlayOpened &&\n\t\t\t\t\t`${ state.currentImage.figureStyles?.replace(\n\t\t\t\t\t\t/margin[^;]*;?/g,\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\tget imgStyles() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.overlayOpened &&\n\t\t\t\t\t`${ state.currentImage.imgStyles?.replace(\n\t\t\t\t\t\t/;$/,\n\t\t\t\t\t\t''\n\t\t\t\t\t) }; object-fit:cover;`\n\t\t\t\t);\n\t\t\t},\n\t\t\tget imageButtonRight() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\treturn state.metadata[ imageId ].imageButtonRight;\n\t\t\t},\n\t\t\tget imageButtonTop() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\treturn state.metadata[ imageId ].imageButtonTop;\n\t\t\t},\n\t\t\tget isContentHidden() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn (\n\t\t\t\t\tstate.overlayEnabled && state.currentImageId === ctx.imageId\n\t\t\t\t);\n\t\t\t},\n\t\t\tget isContentVisible() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn (\n\t\t\t\t\t! state.overlayEnabled &&\n\t\t\t\t\tstate.currentImageId === ctx.imageId\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\tshowLightbox() {\n\t\t\t\tconst { imageId } = getContext();\n\n\t\t\t\t// Bails out if the image has not loaded yet.\n\t\t\t\tif ( ! state.metadata[ imageId ].imageRef?.complete ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Stores the positions of the scroll to fix it until the overlay is\n\t\t\t\t// closed.\n\t\t\t\tstate.scrollTopReset = document.documentElement.scrollTop;\n\t\t\t\tstate.scrollLeftReset = document.documentElement.scrollLeft;\n\n\t\t\t\t// Sets the current expanded image in the state and enables the overlay.\n\t\t\t\tstate.overlayEnabled = true;\n\t\t\t\tstate.currentImageId = imageId;\n\n\t\t\t\t// Computes the styles of the overlay for the animation.\n\t\t\t\tcallbacks.setOverlayStyles();\n\t\t\t},\n\t\t\thideLightbox() {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\tstate.overlayEnabled = false;\n\n\t\t\t\t\t// Waits until the close animation has completed before allowing a\n\t\t\t\t\t// user to scroll again. The duration of this animation is defined in\n\t\t\t\t\t// the `styles.scss` file, but in any case we should wait a few\n\t\t\t\t\t// milliseconds longer than the duration, otherwise a user may scroll\n\t\t\t\t\t// too soon and cause the animation to look sloppy.\n\t\t\t\t\tsetTimeout( function () {\n\t\t\t\t\t\t// Delays before changing the focus. Otherwise the focus ring will\n\t\t\t\t\t\t// appear on Firefox before the image has finished animating, which\n\t\t\t\t\t\t// looks broken.\n\t\t\t\t\t\tstate.currentImage.buttonRef.focus( {\n\t\t\t\t\t\t\tpreventScroll: true,\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t// Resets the current image id to mark the overlay as closed.\n\t\t\t\t\t\tstate.currentImageId = null;\n\t\t\t\t\t}, 450 );\n\t\t\t\t}\n\t\t\t},\n\t\t\thandleKeydown: withSyncEvent( ( event ) => {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\t// Focuses the close button when the user presses the tab key.\n\t\t\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tconst { ref } = getElement();\n\t\t\t\t\t\tref.querySelector( 'button' ).focus();\n\t\t\t\t\t}\n\t\t\t\t\t// Closes the lightbox when the user presses the escape key.\n\t\t\t\t\tif ( event.key === 'Escape' ) {\n\t\t\t\t\t\tactions.hideLightbox();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} ),\n\t\t\thandleTouchMove: withSyncEvent( ( event ) => {\n\t\t\t\t// On mobile devices, prevents triggering the scroll event because\n\t\t\t\t// otherwise the page jumps around when it resets the scroll position.\n\t\t\t\t// This also means that closing the lightbox requires that a user\n\t\t\t\t// perform a simple tap. This may be changed in the future if there is a\n\t\t\t\t// better alternative to override or reset the scroll position during\n\t\t\t\t// swipe actions.\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t} ),\n\t\t\thandleTouchStart() {\n\t\t\t\tisTouching = true;\n\t\t\t},\n\t\t\thandleTouchEnd() {\n\t\t\t\t// Waits a few milliseconds before resetting to ensure that pinch to\n\t\t\t\t// zoom works consistently on mobile devices when the lightbox is open.\n\t\t\t\tlastTouchTime = Date.now();\n\t\t\t\tisTouching = false;\n\t\t\t},\n\t\t\thandleScroll() {\n\t\t\t\t// Prevents scrolling behaviors that trigger content shift while the\n\t\t\t\t// lightbox is open. It would be better to accomplish through CSS alone,\n\t\t\t\t// but using overflow: hidden is currently the only way to do so and\n\t\t\t\t// that causes a layout to shift and prevents the zoom animation from\n\t\t\t\t// working in some cases because it's not possible to account for the\n\t\t\t\t// layout shift when doing the animation calculations. Instead, it uses\n\t\t\t\t// JavaScript to prevent and reset the scrolling behavior.\n\t\t\t\tif ( state.overlayOpened ) {\n\t\t\t\t\t// Avoids overriding the scroll behavior on mobile devices because\n\t\t\t\t\t// doing so breaks the pinch to zoom functionality, and users should\n\t\t\t\t\t// be able to zoom in further on the high-res image.\n\t\t\t\t\tif ( ! isTouching && Date.now() - lastTouchTime > 450 ) {\n\t\t\t\t\t\t// It doesn't rely on `event.preventDefault()` to prevent scrolling\n\t\t\t\t\t\t// because the scroll event can't be canceled, so it resets the\n\t\t\t\t\t\t// position instead.\n\t\t\t\t\t\twindow.scrollTo(\n\t\t\t\t\t\t\tstate.scrollLeftReset,\n\t\t\t\t\t\t\tstate.scrollTopReset\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\tcallbacks: {\n\t\t\tsetOverlayStyles() {\n\t\t\t\tif ( ! state.overlayEnabled ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet {\n\t\t\t\t\tnaturalWidth,\n\t\t\t\t\tnaturalHeight,\n\t\t\t\t\toffsetWidth: originalWidth,\n\t\t\t\t\toffsetHeight: originalHeight,\n\t\t\t\t} = state.currentImage.imageRef;\n\t\t\t\tlet { x: screenPosX, y: screenPosY } =\n\t\t\t\t\tstate.currentImage.imageRef.getBoundingClientRect();\n\n\t\t\t\t// Natural ratio of the image clicked to open the lightbox.\n\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t// Original ratio of the image clicked to open the lightbox.\n\t\t\t\tlet originalRatio = originalWidth / originalHeight;\n\n\t\t\t\t// If it has object-fit: contain, recalculates the original sizes\n\t\t\t\t// and the screen position without the blank spaces.\n\t\t\t\tif ( state.currentImage.scaleAttr === 'contain' ) {\n\t\t\t\t\tif ( naturalRatio > originalRatio ) {\n\t\t\t\t\t\tconst heightWithoutSpace = originalWidth / naturalRatio;\n\t\t\t\t\t\t// Recalculates screen position without the top space.\n\t\t\t\t\t\tscreenPosY +=\n\t\t\t\t\t\t\t( originalHeight - heightWithoutSpace ) / 2;\n\t\t\t\t\t\toriginalHeight = heightWithoutSpace;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst widthWithoutSpace = originalHeight * naturalRatio;\n\t\t\t\t\t\t// Recalculates screen position without the left space.\n\t\t\t\t\t\tscreenPosX += ( originalWidth - widthWithoutSpace ) / 2;\n\t\t\t\t\t\toriginalWidth = widthWithoutSpace;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\toriginalRatio = originalWidth / originalHeight;\n\n\t\t\t\t// Typically, it uses the image's full-sized dimensions. If those\n\t\t\t\t// dimensions have not been set (i.e. an external image with only one\n\t\t\t\t// size), the image's dimensions in the lightbox are the same\n\t\t\t\t// as those of the image in the content.\n\t\t\t\tlet imgMaxWidth = parseFloat(\n\t\t\t\t\tstate.currentImage.targetWidth !== 'none'\n\t\t\t\t\t\t? state.currentImage.targetWidth\n\t\t\t\t\t\t: naturalWidth\n\t\t\t\t);\n\t\t\t\tlet imgMaxHeight = parseFloat(\n\t\t\t\t\tstate.currentImage.targetHeight !== 'none'\n\t\t\t\t\t\t? state.currentImage.targetHeight\n\t\t\t\t\t\t: naturalHeight\n\t\t\t\t);\n\n\t\t\t\t// Ratio of the biggest image stored in the database.\n\t\t\t\tlet imgRatio = imgMaxWidth / imgMaxHeight;\n\t\t\t\tlet containerMaxWidth = imgMaxWidth;\n\t\t\t\tlet containerMaxHeight = imgMaxHeight;\n\t\t\t\tlet containerWidth = imgMaxWidth;\n\t\t\t\tlet containerHeight = imgMaxHeight;\n\n\t\t\t\t// Checks if the target image has a different ratio than the original\n\t\t\t\t// one (thumbnail). Recalculates the width and height.\n\t\t\t\tif ( naturalRatio.toFixed( 2 ) !== imgRatio.toFixed( 2 ) ) {\n\t\t\t\t\tif ( naturalRatio > imgRatio ) {\n\t\t\t\t\t\t// If the width is reached before the height, it keeps the maxWidth\n\t\t\t\t\t\t// and recalculates the height unless the difference between the\n\t\t\t\t\t\t// maxHeight and the reducedHeight is higher than the maxWidth,\n\t\t\t\t\t\t// where it keeps the reducedHeight and recalculate the width.\n\t\t\t\t\t\tconst reducedHeight = imgMaxWidth / naturalRatio;\n\t\t\t\t\t\tif ( imgMaxHeight - reducedHeight > imgMaxWidth ) {\n\t\t\t\t\t\t\timgMaxHeight = reducedHeight;\n\t\t\t\t\t\t\timgMaxWidth = reducedHeight * naturalRatio;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\timgMaxHeight = imgMaxWidth / naturalRatio;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If the height is reached before the width, it keeps the maxHeight\n\t\t\t\t\t\t// and recalculate the width unlesss the difference between the\n\t\t\t\t\t\t// maxWidth and the reducedWidth is higher than the maxHeight, where\n\t\t\t\t\t\t// it keeps the reducedWidth and recalculate the height.\n\t\t\t\t\t\tconst reducedWidth = imgMaxHeight * naturalRatio;\n\t\t\t\t\t\tif ( imgMaxWidth - reducedWidth > imgMaxHeight ) {\n\t\t\t\t\t\t\timgMaxWidth = reducedWidth;\n\t\t\t\t\t\t\timgMaxHeight = reducedWidth / naturalRatio;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\timgMaxWidth = imgMaxHeight * naturalRatio;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcontainerWidth = imgMaxWidth;\n\t\t\t\t\tcontainerHeight = imgMaxHeight;\n\t\t\t\t\timgRatio = imgMaxWidth / imgMaxHeight;\n\n\t\t\t\t\t// Calculates the max size of the container.\n\t\t\t\t\tif ( originalRatio > imgRatio ) {\n\t\t\t\t\t\tcontainerMaxWidth = imgMaxWidth;\n\t\t\t\t\t\tcontainerMaxHeight = containerMaxWidth / originalRatio;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontainerMaxHeight = imgMaxHeight;\n\t\t\t\t\t\tcontainerMaxWidth = containerMaxHeight * originalRatio;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If the image has been pixelated on purpose, it keeps that size.\n\t\t\t\tif (\n\t\t\t\t\toriginalWidth > containerWidth ||\n\t\t\t\t\toriginalHeight > containerHeight\n\t\t\t\t) {\n\t\t\t\t\tcontainerWidth = originalWidth;\n\t\t\t\t\tcontainerHeight = originalHeight;\n\t\t\t\t}\n\n\t\t\t\t// Calculates the final lightbox image size and the scale factor.\n\t\t\t\t// MaxWidth is either the window container (accounting for padding) or\n\t\t\t\t// the image resolution.\n\t\t\t\tlet horizontalPadding = 0;\n\t\t\t\tif ( window.innerWidth > 480 ) {\n\t\t\t\t\thorizontalPadding = 80;\n\t\t\t\t} else if ( window.innerWidth > 1920 ) {\n\t\t\t\t\thorizontalPadding = 160;\n\t\t\t\t}\n\t\t\t\tconst verticalPadding = 80;\n\n\t\t\t\tconst targetMaxWidth = Math.min(\n\t\t\t\t\twindow.innerWidth - horizontalPadding,\n\t\t\t\t\tcontainerWidth\n\t\t\t\t);\n\t\t\t\tconst targetMaxHeight = Math.min(\n\t\t\t\t\twindow.innerHeight - verticalPadding,\n\t\t\t\t\tcontainerHeight\n\t\t\t\t);\n\t\t\t\tconst targetContainerRatio = targetMaxWidth / targetMaxHeight;\n\n\t\t\t\tif ( originalRatio > targetContainerRatio ) {\n\t\t\t\t\t// If targetMaxWidth is reached before targetMaxHeight.\n\t\t\t\t\tcontainerWidth = targetMaxWidth;\n\t\t\t\t\tcontainerHeight = containerWidth / originalRatio;\n\t\t\t\t} else {\n\t\t\t\t\t// If targetMaxHeight is reached before targetMaxWidth.\n\t\t\t\t\tcontainerHeight = targetMaxHeight;\n\t\t\t\t\tcontainerWidth = containerHeight * originalRatio;\n\t\t\t\t}\n\n\t\t\t\tconst containerScale = originalWidth / containerWidth;\n\t\t\t\tconst lightboxImgWidth =\n\t\t\t\t\timgMaxWidth * ( containerWidth / containerMaxWidth );\n\t\t\t\tconst lightboxImgHeight =\n\t\t\t\t\timgMaxHeight * ( containerHeight / containerMaxHeight );\n\n\t\t\t\t// As of this writing, using the calculations above will render the\n\t\t\t\t// lightbox with a small, erroneous whitespace on the left side of the\n\t\t\t\t// image in iOS Safari, perhaps due to an inconsistency in how browsers\n\t\t\t\t// handle absolute positioning and CSS transformation. In any case,\n\t\t\t\t// adding 1 pixel to the container width and height solves the problem,\n\t\t\t\t// though this can be removed if the issue is fixed in the future.\n\t\t\t\tstate.overlayStyles = `\n\t\t\t\t\t--wp--lightbox-initial-top-position: ${ screenPosY }px;\n\t\t\t\t\t--wp--lightbox-initial-left-position: ${ screenPosX }px;\n\t\t\t\t\t--wp--lightbox-container-width: ${ containerWidth + 1 }px;\n\t\t\t\t\t--wp--lightbox-container-height: ${ containerHeight + 1 }px;\n\t\t\t\t\t--wp--lightbox-image-width: ${ lightboxImgWidth }px;\n\t\t\t\t\t--wp--lightbox-image-height: ${ lightboxImgHeight }px;\n\t\t\t\t\t--wp--lightbox-scale: ${ containerScale };\n\t\t\t\t\t--wp--lightbox-scrollbar-width: ${\n\t\t\t\t\t\twindow.innerWidth - document.documentElement.clientWidth\n\t\t\t\t\t}px;\n\t\t\t\t`;\n\t\t\t},\n\t\t\tsetButtonStyles() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\tconst { ref } = getElement();\n\n\t\t\t\tstate.metadata[ imageId ].imageRef = ref;\n\t\t\t\tstate.metadata[ imageId ].currentSrc = ref.currentSrc;\n\n\t\t\t\tconst {\n\t\t\t\t\tnaturalWidth,\n\t\t\t\t\tnaturalHeight,\n\t\t\t\t\toffsetWidth,\n\t\t\t\t\toffsetHeight,\n\t\t\t\t} = ref;\n\n\t\t\t\t// If the image isn't loaded yet, it can't calculate where the button\n\t\t\t\t// should be.\n\t\t\t\tif ( naturalWidth === 0 || naturalHeight === 0 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst figure = ref.parentElement;\n\t\t\t\tconst figureWidth = ref.parentElement.clientWidth;\n\n\t\t\t\t// It needs special handling for the height because a caption will cause\n\t\t\t\t// the figure to be taller than the image, which means it needs to\n\t\t\t\t// account for that when calculating the placement of the button in the\n\t\t\t\t// top right corner of the image.\n\t\t\t\tlet figureHeight = ref.parentElement.clientHeight;\n\t\t\t\tconst caption = figure.querySelector( 'figcaption' );\n\t\t\t\tif ( caption ) {\n\t\t\t\t\tconst captionComputedStyle =\n\t\t\t\t\t\twindow.getComputedStyle( caption );\n\t\t\t\t\tif (\n\t\t\t\t\t\t! [ 'absolute', 'fixed' ].includes(\n\t\t\t\t\t\t\tcaptionComputedStyle.position\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tfigureHeight =\n\t\t\t\t\t\t\tfigureHeight -\n\t\t\t\t\t\t\tcaption.offsetHeight -\n\t\t\t\t\t\t\tparseFloat( captionComputedStyle.marginTop ) -\n\t\t\t\t\t\t\tparseFloat( captionComputedStyle.marginBottom );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst buttonOffsetTop = figureHeight - offsetHeight;\n\t\t\t\tconst buttonOffsetRight = figureWidth - offsetWidth;\n\n\t\t\t\tlet imageButtonTop = buttonOffsetTop + 16;\n\t\t\t\tlet imageButtonRight = buttonOffsetRight + 16;\n\n\t\t\t\t// In the case of an image with object-fit: contain, the size of the\n\t\t\t\t// <img> element can be larger than the image itself, so it needs to\n\t\t\t\t// calculate where to place the button.\n\t\t\t\tif ( state.metadata[ imageId ].scaleAttr === 'contain' ) {\n\t\t\t\t\t// Natural ratio of the image.\n\t\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t\t// Offset ratio of the image.\n\t\t\t\t\tconst offsetRatio = offsetWidth / offsetHeight;\n\n\t\t\t\t\tif ( naturalRatio >= offsetRatio ) {\n\t\t\t\t\t\t// If it reaches the width first, it keeps the width and compute the\n\t\t\t\t\t\t// height.\n\t\t\t\t\t\tconst referenceHeight = offsetWidth / naturalRatio;\n\t\t\t\t\t\timageButtonTop =\n\t\t\t\t\t\t\t( offsetHeight - referenceHeight ) / 2 +\n\t\t\t\t\t\t\tbuttonOffsetTop +\n\t\t\t\t\t\t\t16;\n\t\t\t\t\t\timageButtonRight = buttonOffsetRight + 16;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If it reaches the height first, it keeps the height and compute\n\t\t\t\t\t\t// the width.\n\t\t\t\t\t\tconst referenceWidth = offsetHeight * naturalRatio;\n\t\t\t\t\t\timageButtonTop = buttonOffsetTop + 16;\n\t\t\t\t\t\timageButtonRight =\n\t\t\t\t\t\t\t( offsetWidth - referenceWidth ) / 2 +\n\t\t\t\t\t\t\tbuttonOffsetRight +\n\t\t\t\t\t\t\t16;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tstate.metadata[ imageId ].imageButtonTop = imageButtonTop;\n\t\t\t\tstate.metadata[ imageId ].imageButtonRight = imageButtonRight;\n\t\t\t},\n\t\t\tsetOverlayFocus() {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\t// Moves the focus to the dialog when it opens.\n\t\t\t\t\tconst { ref } = getElement();\n\t\t\t\t\tref.focus();\n\t\t\t\t}\n\t\t\t},\n\t\t\tinitTriggerButton() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\tconst { ref } = getElement();\n\t\t\t\tstate.metadata[ imageId ].buttonRef = ref;\n\t\t\t},\n\t\t},\n\t},\n\t{ lock: true }\n);\n"],"mappings":";;AAGA,IAAAA,cAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;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Ac,EAAG;QAC3B;QACA,MAAM;UAAEsB;QAAI,CAAC,GAAG,IAAAC,yBAAU,EAAC,CAAC;QAC5BD,GAAG,CAACP,KAAK,CAAC,CAAC;MACZ;IACD,CAAC;IACDiF,iBAAiBA,CAAA,EAAG;MACnB,MAAM;QAAErG;MAAQ,CAAC,GAAG,IAAAC,yBAAU,EAAC,CAAC;MAChC,MAAM;QAAE0B;MAAI,CAAC,GAAG,IAAAC,yBAAU,EAAC,CAAC;MAC5B5C,KAAK,CAACM,QAAQ,CAAEU,OAAO,CAAE,CAACmB,SAAS,GAAGQ,GAAG;IAC1C;EACD;AACD,CAAC,EACD;EAAE2E,IAAI,EAAE;AAAK,CACd,CAAC","ignoreList":[]}
@@ -253,102 +253,174 @@ function Controls({
253
253
  })
254
254
  })
255
255
  })]
256
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.PanelBody, {
257
- title: (0, _i18n.__)('Featured image'),
258
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
259
- __nextHasNoMarginBottom: true,
256
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalToolsPanel, {
257
+ label: (0, _i18n.__)('Featured image'),
258
+ resetAll: () => setAttributes({
259
+ displayFeaturedImage: false,
260
+ featuredImageAlign: undefined,
261
+ featuredImageSizeSlug: 'thumbnail',
262
+ featuredImageSizeWidth: null,
263
+ featuredImageSizeHeight: null,
264
+ addLinkToFeaturedImage: false
265
+ }),
266
+ dropdownMenuProps: dropdownMenuProps,
267
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
268
+ hasValue: () => !!displayFeaturedImage,
260
269
  label: (0, _i18n.__)('Display featured image'),
261
- checked: displayFeaturedImage,
262
- onChange: value => setAttributes({
263
- displayFeaturedImage: value
270
+ onDeselect: () => setAttributes({
271
+ displayFeaturedImage: false
272
+ }),
273
+ isShownByDefault: true,
274
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
275
+ __nextHasNoMarginBottom: true,
276
+ label: (0, _i18n.__)('Display featured image'),
277
+ checked: displayFeaturedImage,
278
+ onChange: value => setAttributes({
279
+ displayFeaturedImage: value
280
+ })
264
281
  })
265
282
  }), displayFeaturedImage && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
266
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.__experimentalImageSizeControl, {
267
- onChange: value => {
268
- const newAttrs = {};
269
- if (value.hasOwnProperty('width')) {
270
- newAttrs.featuredImageSizeWidth = value.width;
271
- }
272
- if (value.hasOwnProperty('height')) {
273
- newAttrs.featuredImageSizeHeight = value.height;
274
- }
275
- setAttributes(newAttrs);
276
- },
277
- slug: featuredImageSizeSlug,
278
- width: featuredImageSizeWidth,
279
- height: featuredImageSizeHeight,
280
- imageWidth: defaultImageWidth,
281
- imageHeight: defaultImageHeight,
282
- imageSizeOptions: imageSizeOptions,
283
- imageSizeHelp: (0, _i18n.__)('Select the size of the source image.'),
284
- onChangeImage: value => setAttributes({
285
- featuredImageSizeSlug: value,
286
- featuredImageSizeWidth: undefined,
287
- featuredImageSizeHeight: undefined
283
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
284
+ hasValue: () => featuredImageSizeSlug !== 'thumbnail' || featuredImageSizeWidth !== null || featuredImageSizeHeight !== null,
285
+ label: (0, _i18n.__)('Image size'),
286
+ onDeselect: () => setAttributes({
287
+ featuredImageSizeSlug: 'thumbnail',
288
+ featuredImageSizeWidth: null,
289
+ featuredImageSizeHeight: null
290
+ }),
291
+ isShownByDefault: true,
292
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.__experimentalImageSizeControl, {
293
+ onChange: value => {
294
+ const newAttrs = {};
295
+ if (value.hasOwnProperty('width')) {
296
+ newAttrs.featuredImageSizeWidth = value.width;
297
+ }
298
+ if (value.hasOwnProperty('height')) {
299
+ newAttrs.featuredImageSizeHeight = value.height;
300
+ }
301
+ setAttributes(newAttrs);
302
+ },
303
+ slug: featuredImageSizeSlug,
304
+ width: featuredImageSizeWidth,
305
+ height: featuredImageSizeHeight,
306
+ imageWidth: defaultImageWidth,
307
+ imageHeight: defaultImageHeight,
308
+ imageSizeOptions: imageSizeOptions,
309
+ imageSizeHelp: (0, _i18n.__)('Select the size of the source image.'),
310
+ onChangeImage: value => setAttributes({
311
+ featuredImageSizeSlug: value,
312
+ featuredImageSizeWidth: undefined,
313
+ featuredImageSizeHeight: undefined
314
+ })
288
315
  })
289
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToggleGroupControl, {
290
- className: "editor-latest-posts-image-alignment-control",
291
- __nextHasNoMarginBottom: true,
292
- __next40pxDefaultSize: true,
316
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
317
+ hasValue: () => !!featuredImageAlign,
293
318
  label: (0, _i18n.__)('Image alignment'),
294
- value: featuredImageAlign || 'none',
295
- onChange: value => setAttributes({
296
- featuredImageAlign: value !== 'none' ? value : undefined
319
+ onDeselect: () => setAttributes({
320
+ featuredImageAlign: undefined
297
321
  }),
298
- children: imageAlignmentOptions.map(({
299
- value,
300
- icon,
301
- label
302
- }) => {
303
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToggleGroupControlOptionIcon, {
304
- value: value,
305
- icon: icon,
306
- label: label
307
- }, value);
322
+ isShownByDefault: true,
323
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToggleGroupControl, {
324
+ className: "editor-latest-posts-image-alignment-control",
325
+ __nextHasNoMarginBottom: true,
326
+ __next40pxDefaultSize: true,
327
+ label: (0, _i18n.__)('Image alignment'),
328
+ value: featuredImageAlign || 'none',
329
+ onChange: value => setAttributes({
330
+ featuredImageAlign: value !== 'none' ? value : undefined
331
+ }),
332
+ children: imageAlignmentOptions.map(({
333
+ value,
334
+ icon,
335
+ label
336
+ }) => {
337
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToggleGroupControlOptionIcon, {
338
+ value: value,
339
+ icon: icon,
340
+ label: label
341
+ }, value);
342
+ })
308
343
  })
309
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
310
- __nextHasNoMarginBottom: true,
344
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
345
+ hasValue: () => !!addLinkToFeaturedImage,
311
346
  label: (0, _i18n.__)('Add link to featured image'),
312
- checked: addLinkToFeaturedImage,
313
- onChange: value => setAttributes({
314
- addLinkToFeaturedImage: value
347
+ onDeselect: () => setAttributes({
348
+ addLinkToFeaturedImage: false
349
+ }),
350
+ isShownByDefault: true,
351
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
352
+ __nextHasNoMarginBottom: true,
353
+ label: (0, _i18n.__)('Add link to featured image'),
354
+ checked: addLinkToFeaturedImage,
355
+ onChange: value => setAttributes({
356
+ addLinkToFeaturedImage: value
357
+ })
315
358
  })
316
359
  })]
317
360
  })]
318
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.PanelBody, {
319
- title: (0, _i18n.__)('Sorting and filtering'),
320
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.QueryControls, {
321
- order,
322
- orderBy,
323
- numberOfItems: postsToShow,
324
- onOrderChange: value => setAttributes({
325
- order: value
326
- }),
327
- onOrderByChange: value => setAttributes({
328
- orderBy: value
329
- }),
330
- onNumberOfItemsChange: value => setAttributes({
331
- postsToShow: value
332
- }),
333
- categorySuggestions: categorySuggestions,
334
- onCategoryChange: selectCategories,
335
- selectedCategories: categories,
336
- onAuthorChange: value => setAttributes({
337
- selectedAuthor: '' !== value ? Number(value) : undefined
361
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalToolsPanel, {
362
+ label: (0, _i18n.__)('Sorting and filtering'),
363
+ resetAll: () => setAttributes({
364
+ order: 'desc',
365
+ orderBy: 'date',
366
+ postsToShow: 5,
367
+ categories: undefined,
368
+ selectedAuthor: undefined,
369
+ columns: 3
370
+ }),
371
+ dropdownMenuProps: dropdownMenuProps,
372
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
373
+ hasValue: () => order !== 'desc' || orderBy !== 'date' || postsToShow !== 5 || categories?.length > 0 || !!selectedAuthor,
374
+ label: (0, _i18n.__)('Sort and filter'),
375
+ onDeselect: () => setAttributes({
376
+ order: 'desc',
377
+ orderBy: 'date',
378
+ postsToShow: 5,
379
+ categories: undefined,
380
+ selectedAuthor: undefined
338
381
  }),
339
- authorList: authorList !== null && authorList !== void 0 ? authorList : [],
340
- selectedAuthorId: selectedAuthor
341
- }), postLayout === 'grid' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RangeControl, {
342
- __nextHasNoMarginBottom: true,
343
- __next40pxDefaultSize: true,
382
+ isShownByDefault: true,
383
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.QueryControls, {
384
+ order,
385
+ orderBy,
386
+ numberOfItems: postsToShow,
387
+ onOrderChange: value => setAttributes({
388
+ order: value
389
+ }),
390
+ onOrderByChange: value => setAttributes({
391
+ orderBy: value
392
+ }),
393
+ onNumberOfItemsChange: value => setAttributes({
394
+ postsToShow: value
395
+ }),
396
+ categorySuggestions: categorySuggestions,
397
+ onCategoryChange: selectCategories,
398
+ selectedCategories: categories,
399
+ onAuthorChange: value => setAttributes({
400
+ selectedAuthor: '' !== value ? Number(value) : undefined
401
+ }),
402
+ authorList: authorList !== null && authorList !== void 0 ? authorList : [],
403
+ selectedAuthorId: selectedAuthor
404
+ })
405
+ }), postLayout === 'grid' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
406
+ hasValue: () => columns !== 3,
344
407
  label: (0, _i18n.__)('Columns'),
345
- value: columns,
346
- onChange: value => setAttributes({
347
- columns: value
408
+ onDeselect: () => setAttributes({
409
+ columns: 3
348
410
  }),
349
- min: 2,
350
- max: !postCount ? _constants.MAX_POSTS_COLUMNS : Math.min(_constants.MAX_POSTS_COLUMNS, postCount),
351
- required: true
411
+ isShownByDefault: true,
412
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RangeControl, {
413
+ __nextHasNoMarginBottom: true,
414
+ __next40pxDefaultSize: true,
415
+ label: (0, _i18n.__)('Columns'),
416
+ value: columns,
417
+ onChange: value => setAttributes({
418
+ columns: value
419
+ }),
420
+ min: 2,
421
+ max: !postCount ? _constants.MAX_POSTS_COLUMNS : Math.min(_constants.MAX_POSTS_COLUMNS, postCount),
422
+ required: true
423
+ })
352
424
  })]
353
425
  })]
354
426
  });