@wordpress/block-library 8.18.0 → 8.19.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 (393) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +1 -1
  3. package/build/block/edit.js +53 -2
  4. package/build/block/edit.js.map +1 -1
  5. package/build/button/edit.js +7 -4
  6. package/build/button/edit.js.map +1 -1
  7. package/build/button/index.js +11 -2
  8. package/build/button/index.js.map +1 -1
  9. package/build/button/save.js +10 -4
  10. package/build/button/save.js.map +1 -1
  11. package/build/buttons/edit.js +12 -3
  12. package/build/buttons/edit.js.map +1 -1
  13. package/build/code/edit.js +8 -2
  14. package/build/code/edit.js.map +1 -1
  15. package/build/code/index.js +7 -1
  16. package/build/code/index.js.map +1 -1
  17. package/build/column/edit.native.js +5 -5
  18. package/build/column/edit.native.js.map +1 -1
  19. package/build/column/index.js +1 -0
  20. package/build/column/index.js.map +1 -1
  21. package/build/columns/index.js +2 -0
  22. package/build/columns/index.js.map +1 -1
  23. package/build/file/edit.native.js +1 -1
  24. package/build/file/edit.native.js.map +1 -1
  25. package/build/file/index.js +2 -1
  26. package/build/file/index.js.map +1 -1
  27. package/build/file/utils/index.js +1 -15
  28. package/build/file/utils/index.js.map +1 -1
  29. package/build/file/view.js +14 -1
  30. package/build/file/view.js.map +1 -1
  31. package/build/footnotes/edit.js +14 -5
  32. package/build/footnotes/edit.js.map +1 -1
  33. package/build/gallery/edit.js +1 -1
  34. package/build/gallery/edit.js.map +1 -1
  35. package/build/group/edit.js +0 -1
  36. package/build/group/edit.js.map +1 -1
  37. package/build/group/index.js +5 -0
  38. package/build/group/index.js.map +1 -1
  39. package/build/heading/edit.js +0 -1
  40. package/build/heading/edit.js.map +1 -1
  41. package/build/heading/index.js +2 -0
  42. package/build/heading/index.js.map +1 -1
  43. package/build/heading/transforms.js +3 -6
  44. package/build/heading/transforms.js.map +1 -1
  45. package/build/image/deprecated.js +191 -7
  46. package/build/image/deprecated.js.map +1 -1
  47. package/build/image/edit.js +27 -12
  48. package/build/image/edit.js.map +1 -1
  49. package/build/image/image.js +75 -40
  50. package/build/image/image.js.map +1 -1
  51. package/build/image/index.js +7 -4
  52. package/build/image/index.js.map +1 -1
  53. package/build/image/{view-interactivity.js → view.js} +1 -1
  54. package/build/image/view.js.map +1 -0
  55. package/build/list/deprecated.js +93 -1
  56. package/build/list/deprecated.js.map +1 -1
  57. package/build/list/edit.js +10 -10
  58. package/build/list/edit.js.map +1 -1
  59. package/build/list/ordered-list-settings.js +10 -10
  60. package/build/list/ordered-list-settings.js.map +1 -1
  61. package/build/list/save.js +4 -2
  62. package/build/list/save.js.map +1 -1
  63. package/build/list/utils.js +21 -2
  64. package/build/list/utils.js.map +1 -1
  65. package/build/navigation/constants.js +1 -1
  66. package/build/navigation/constants.js.map +1 -1
  67. package/build/navigation/index.js +4 -2
  68. package/build/navigation/index.js.map +1 -1
  69. package/build/navigation/view.js +168 -82
  70. package/build/navigation/view.js.map +1 -1
  71. package/build/navigation-link/edit.js +3 -9
  72. package/build/navigation-link/edit.js.map +1 -1
  73. package/build/navigation-link/transforms.js +24 -0
  74. package/build/navigation-link/transforms.js.map +1 -1
  75. package/build/page-list/edit.js +2 -1
  76. package/build/page-list/edit.js.map +1 -1
  77. package/build/post-comments-form/edit.js +10 -2
  78. package/build/post-comments-form/edit.js.map +1 -1
  79. package/build/post-comments-form/form.js +5 -3
  80. package/build/post-comments-form/form.js.map +1 -1
  81. package/build/post-content/edit.js +8 -7
  82. package/build/post-content/edit.js.map +1 -1
  83. package/build/post-content/index.js +3 -0
  84. package/build/post-content/index.js.map +1 -1
  85. package/build/post-featured-image/overlay.js +2 -1
  86. package/build/post-featured-image/overlay.js.map +1 -1
  87. package/build/post-terms/use-post-terms.js +3 -2
  88. package/build/post-terms/use-post-terms.js.map +1 -1
  89. package/build/preformatted/edit.js +4 -1
  90. package/build/preformatted/edit.js.map +1 -1
  91. package/build/preformatted/index.js +1 -1
  92. package/build/preformatted/index.js.map +1 -1
  93. package/build/pullquote/deprecated.js +6 -7
  94. package/build/pullquote/deprecated.js.map +1 -1
  95. package/build/query/edit/enhanced-pagination-modal.js +56 -0
  96. package/build/query/edit/enhanced-pagination-modal.js.map +1 -0
  97. package/build/query/edit/inspector-controls/enhanced-pagination-control.js +42 -0
  98. package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -0
  99. package/build/query/edit/inspector-controls/index.js +8 -25
  100. package/build/query/edit/inspector-controls/index.js.map +1 -1
  101. package/build/query/edit/query-content.js +8 -2
  102. package/build/query/edit/query-content.js.map +1 -1
  103. package/build/query/utils.js +19 -0
  104. package/build/query/utils.js.map +1 -1
  105. package/build/query/view.js +4 -5
  106. package/build/query/view.js.map +1 -1
  107. package/build/search/index.js +1 -0
  108. package/build/search/index.js.map +1 -1
  109. package/build/search/view.js +81 -150
  110. package/build/search/view.js.map +1 -1
  111. package/build/social-link/edit.native.js +3 -1
  112. package/build/social-link/edit.native.js.map +1 -1
  113. package/build/table/edit.js +7 -7
  114. package/build/table/edit.js.map +1 -1
  115. package/build/table-of-contents/edit.js +2 -130
  116. package/build/table-of-contents/edit.js.map +1 -1
  117. package/build/table-of-contents/hooks.js +145 -0
  118. package/build/table-of-contents/hooks.js.map +1 -0
  119. package/build/table-of-contents/index.js +2 -1
  120. package/build/table-of-contents/index.js.map +1 -1
  121. package/build/verse/edit.js +4 -1
  122. package/build/verse/edit.js.map +1 -1
  123. package/build/verse/index.js +1 -1
  124. package/build/verse/index.js.map +1 -1
  125. package/build-module/block/edit.js +54 -3
  126. package/build-module/block/edit.js.map +1 -1
  127. package/build-module/button/edit.js +7 -4
  128. package/build-module/button/edit.js.map +1 -1
  129. package/build-module/button/index.js +11 -2
  130. package/build-module/button/index.js.map +1 -1
  131. package/build-module/button/save.js +10 -4
  132. package/build-module/button/save.js.map +1 -1
  133. package/build-module/buttons/edit.js +12 -3
  134. package/build-module/buttons/edit.js.map +1 -1
  135. package/build-module/code/edit.js +8 -2
  136. package/build-module/code/edit.js.map +1 -1
  137. package/build-module/code/index.js +7 -1
  138. package/build-module/code/index.js.map +1 -1
  139. package/build-module/column/edit.native.js +5 -5
  140. package/build-module/column/edit.native.js.map +1 -1
  141. package/build-module/column/index.js +1 -0
  142. package/build-module/column/index.js.map +1 -1
  143. package/build-module/columns/index.js +2 -0
  144. package/build-module/columns/index.js.map +1 -1
  145. package/build-module/file/edit.native.js +1 -1
  146. package/build-module/file/edit.native.js.map +1 -1
  147. package/build-module/file/index.js +2 -1
  148. package/build-module/file/index.js.map +1 -1
  149. package/build-module/file/utils/index.js +0 -13
  150. package/build-module/file/utils/index.js.map +1 -1
  151. package/build-module/file/view.js +14 -2
  152. package/build-module/file/view.js.map +1 -1
  153. package/build-module/footnotes/edit.js +14 -5
  154. package/build-module/footnotes/edit.js.map +1 -1
  155. package/build-module/gallery/edit.js +1 -1
  156. package/build-module/gallery/edit.js.map +1 -1
  157. package/build-module/group/edit.js +0 -1
  158. package/build-module/group/edit.js.map +1 -1
  159. package/build-module/group/index.js +5 -0
  160. package/build-module/group/index.js.map +1 -1
  161. package/build-module/heading/edit.js +0 -1
  162. package/build-module/heading/edit.js.map +1 -1
  163. package/build-module/heading/index.js +2 -0
  164. package/build-module/heading/index.js.map +1 -1
  165. package/build-module/heading/transforms.js +3 -6
  166. package/build-module/heading/transforms.js.map +1 -1
  167. package/build-module/image/deprecated.js +191 -7
  168. package/build-module/image/deprecated.js.map +1 -1
  169. package/build-module/image/edit.js +27 -12
  170. package/build-module/image/edit.js.map +1 -1
  171. package/build-module/image/image.js +77 -42
  172. package/build-module/image/image.js.map +1 -1
  173. package/build-module/image/index.js +7 -4
  174. package/build-module/image/index.js.map +1 -1
  175. package/build-module/image/{view-interactivity.js → view.js} +1 -1
  176. package/build-module/image/view.js.map +1 -0
  177. package/build-module/list/deprecated.js +95 -3
  178. package/build-module/list/deprecated.js.map +1 -1
  179. package/build-module/list/edit.js +10 -10
  180. package/build-module/list/edit.js.map +1 -1
  181. package/build-module/list/ordered-list-settings.js +10 -10
  182. package/build-module/list/ordered-list-settings.js.map +1 -1
  183. package/build-module/list/save.js +4 -2
  184. package/build-module/list/save.js.map +1 -1
  185. package/build-module/list/utils.js +20 -2
  186. package/build-module/list/utils.js.map +1 -1
  187. package/build-module/navigation/constants.js +1 -1
  188. package/build-module/navigation/constants.js.map +1 -1
  189. package/build-module/navigation/index.js +4 -2
  190. package/build-module/navigation/index.js.map +1 -1
  191. package/build-module/navigation/view.js +168 -83
  192. package/build-module/navigation/view.js.map +1 -1
  193. package/build-module/navigation-link/edit.js +3 -9
  194. package/build-module/navigation-link/edit.js.map +1 -1
  195. package/build-module/navigation-link/transforms.js +24 -0
  196. package/build-module/navigation-link/transforms.js.map +1 -1
  197. package/build-module/page-list/edit.js +2 -1
  198. package/build-module/page-list/edit.js.map +1 -1
  199. package/build-module/post-comments-form/edit.js +10 -2
  200. package/build-module/post-comments-form/edit.js.map +1 -1
  201. package/build-module/post-comments-form/form.js +5 -3
  202. package/build-module/post-comments-form/form.js.map +1 -1
  203. package/build-module/post-content/edit.js +8 -7
  204. package/build-module/post-content/edit.js.map +1 -1
  205. package/build-module/post-content/index.js +3 -0
  206. package/build-module/post-content/index.js.map +1 -1
  207. package/build-module/post-featured-image/overlay.js +2 -1
  208. package/build-module/post-featured-image/overlay.js.map +1 -1
  209. package/build-module/post-terms/use-post-terms.js +3 -2
  210. package/build-module/post-terms/use-post-terms.js.map +1 -1
  211. package/build-module/preformatted/edit.js +4 -1
  212. package/build-module/preformatted/edit.js.map +1 -1
  213. package/build-module/preformatted/index.js +1 -1
  214. package/build-module/preformatted/index.js.map +1 -1
  215. package/build-module/pullquote/deprecated.js +6 -7
  216. package/build-module/pullquote/deprecated.js.map +1 -1
  217. package/build-module/query/edit/enhanced-pagination-modal.js +50 -0
  218. package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -0
  219. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +35 -0
  220. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -0
  221. package/build-module/query/edit/inspector-controls/index.js +9 -26
  222. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  223. package/build-module/query/edit/query-content.js +8 -2
  224. package/build-module/query/edit/query-content.js.map +1 -1
  225. package/build-module/query/utils.js +17 -0
  226. package/build-module/query/utils.js.map +1 -1
  227. package/build-module/query/view.js +4 -5
  228. package/build-module/query/view.js.map +1 -1
  229. package/build-module/search/index.js +1 -0
  230. package/build-module/search/index.js.map +1 -1
  231. package/build-module/search/view.js +81 -151
  232. package/build-module/search/view.js.map +1 -1
  233. package/build-module/social-link/edit.native.js +3 -1
  234. package/build-module/social-link/edit.native.js.map +1 -1
  235. package/build-module/table/edit.js +7 -7
  236. package/build-module/table/edit.js.map +1 -1
  237. package/build-module/table-of-contents/edit.js +3 -131
  238. package/build-module/table-of-contents/edit.js.map +1 -1
  239. package/build-module/table-of-contents/hooks.js +137 -0
  240. package/build-module/table-of-contents/hooks.js.map +1 -0
  241. package/build-module/table-of-contents/index.js +2 -1
  242. package/build-module/table-of-contents/index.js.map +1 -1
  243. package/build-module/verse/edit.js +4 -1
  244. package/build-module/verse/edit.js.map +1 -1
  245. package/build-module/verse/index.js +1 -1
  246. package/build-module/verse/index.js.map +1 -1
  247. package/build-style/cover/style-rtl.css +9 -0
  248. package/build-style/cover/style.css +9 -0
  249. package/build-style/editor-rtl.css +15 -9
  250. package/build-style/editor.css +15 -9
  251. package/build-style/file/style-rtl.css +5 -0
  252. package/build-style/file/style.css +5 -0
  253. package/build-style/heading/style-rtl.css +13 -0
  254. package/build-style/heading/style.css +13 -0
  255. package/build-style/navigation-link/editor-rtl.css +0 -9
  256. package/build-style/navigation-link/editor.css +0 -9
  257. package/build-style/paragraph/editor-rtl.css +5 -0
  258. package/build-style/paragraph/editor.css +5 -0
  259. package/build-style/paragraph/style-rtl.css +5 -0
  260. package/build-style/paragraph/style.css +5 -0
  261. package/build-style/post-navigation-link/style-rtl.css +3 -0
  262. package/build-style/post-navigation-link/style.css +3 -0
  263. package/build-style/query/editor-rtl.css +10 -0
  264. package/build-style/query/editor.css +10 -0
  265. package/build-style/query/style-rtl.css +1 -1
  266. package/build-style/query/style.css +1 -1
  267. package/build-style/reset-rtl.css +27 -27
  268. package/build-style/reset.css +27 -27
  269. package/build-style/style-rtl.css +35 -0
  270. package/build-style/style.css +35 -0
  271. package/package.json +32 -33
  272. package/src/audio/test/__snapshots__/edit.native.js.snap +78 -106
  273. package/src/avatar/index.php +2 -2
  274. package/src/block/edit.js +58 -2
  275. package/src/block/test/edit.native.js +2 -3
  276. package/src/button/block.json +11 -2
  277. package/src/button/edit.js +27 -11
  278. package/src/button/save.js +10 -4
  279. package/src/buttons/edit.js +13 -3
  280. package/src/buttons/test/edit.native.js +28 -24
  281. package/src/calendar/index.php +2 -2
  282. package/src/code/block.json +2 -1
  283. package/src/code/edit.js +13 -1
  284. package/src/code/index.js +5 -0
  285. package/src/column/block.json +1 -0
  286. package/src/column/edit.native.js +4 -4
  287. package/src/columns/block.json +2 -0
  288. package/src/columns/test/__snapshots__/edit.native.js.snap +14 -0
  289. package/src/columns/test/edit.native.js +47 -17
  290. package/src/comment-template/index.php +1 -1
  291. package/src/comments-pagination-next/index.php +1 -1
  292. package/src/comments-pagination-previous/index.php +1 -1
  293. package/src/cover/style.scss +12 -1
  294. package/src/cover/test/edit.js +7 -7
  295. package/src/cover/test/edit.native.js +18 -27
  296. package/src/embed/test/index.native.js +30 -45
  297. package/src/file/block.json +2 -1
  298. package/src/file/edit.native.js +1 -1
  299. package/src/file/index.php +19 -21
  300. package/src/file/style.scss +6 -1
  301. package/src/file/test/__snapshots__/edit.native.js.snap +162 -218
  302. package/src/file/utils/index.js +0 -15
  303. package/src/file/view.js +14 -5
  304. package/src/footnotes/edit.js +16 -2
  305. package/src/gallery/edit.js +1 -1
  306. package/src/gallery/index.php +1 -1
  307. package/src/group/block.json +5 -0
  308. package/src/group/edit.js +0 -1
  309. package/src/heading/block.json +2 -0
  310. package/src/heading/edit.js +0 -1
  311. package/src/heading/style.scss +4 -0
  312. package/src/heading/transforms.js +1 -6
  313. package/src/image/block.json +7 -4
  314. package/src/image/deprecated.js +210 -7
  315. package/src/image/edit.js +43 -29
  316. package/src/image/image.js +86 -43
  317. package/src/image/index.php +251 -28
  318. package/src/latest-posts/index.php +1 -1
  319. package/src/list/deprecated.js +84 -3
  320. package/src/list/edit.js +6 -3
  321. package/src/list/ordered-list-settings.js +20 -5
  322. package/src/list/save.js +10 -1
  323. package/src/list/test/edit.native.js +2 -4
  324. package/src/list/utils.js +22 -1
  325. package/src/navigation/block.json +4 -2
  326. package/src/navigation/constants.js +1 -0
  327. package/src/navigation/index.php +85 -123
  328. package/src/navigation/view.js +192 -96
  329. package/src/navigation-link/edit.js +21 -36
  330. package/src/navigation-link/editor.scss +0 -8
  331. package/src/navigation-link/transforms.js +22 -0
  332. package/src/page-list/edit.js +2 -1
  333. package/src/paragraph/editor.scss +5 -0
  334. package/src/paragraph/style.scss +5 -0
  335. package/src/pattern/index.php +2 -2
  336. package/src/post-comments-form/edit.js +10 -0
  337. package/src/post-comments-form/form.js +7 -1
  338. package/src/post-content/block.json +3 -0
  339. package/src/post-content/edit.js +14 -6
  340. package/src/post-excerpt/index.php +2 -2
  341. package/src/post-featured-image/index.php +2 -2
  342. package/src/post-featured-image/overlay.js +1 -0
  343. package/src/post-navigation-link/index.php +5 -1
  344. package/src/post-navigation-link/style.scss +4 -0
  345. package/src/post-template/index.php +1 -1
  346. package/src/post-terms/index.php +5 -2
  347. package/src/post-terms/use-post-terms.js +4 -2
  348. package/src/preformatted/edit.js +5 -0
  349. package/src/preformatted/index.js +1 -1
  350. package/src/pullquote/deprecated.js +8 -13
  351. package/src/query/edit/enhanced-pagination-modal.js +65 -0
  352. package/src/query/edit/inspector-controls/enhanced-pagination-control.js +49 -0
  353. package/src/query/edit/inspector-controls/index.js +9 -45
  354. package/src/query/edit/query-content.js +8 -0
  355. package/src/query/editor.scss +10 -0
  356. package/src/query/index.php +29 -16
  357. package/src/query/style.scss +2 -2
  358. package/src/query/utils.js +22 -0
  359. package/src/query/view.js +5 -5
  360. package/src/query-pagination-next/index.php +1 -1
  361. package/src/query-pagination-previous/index.php +1 -1
  362. package/src/reset.scss +1 -1
  363. package/src/search/block.json +1 -0
  364. package/src/search/index.php +45 -4
  365. package/src/search/test/__snapshots__/edit.native.js.snap +265 -363
  366. package/src/search/view.js +70 -169
  367. package/src/social-link/edit.native.js +1 -1
  368. package/src/social-link/editor.native.scss +4 -0
  369. package/src/table/edit.js +21 -19
  370. package/src/table-of-contents/block.json +2 -1
  371. package/src/table-of-contents/edit.js +5 -162
  372. package/src/table-of-contents/hooks.js +156 -0
  373. package/src/verse/edit.js +5 -0
  374. package/src/verse/index.js +1 -1
  375. package/src/verse/test/edit.native.js +2 -3
  376. package/build/file/view-interactivity.js +0 -22
  377. package/build/file/view-interactivity.js.map +0 -1
  378. package/build/image/view-interactivity.js.map +0 -1
  379. package/build/navigation/view-interactivity.js +0 -172
  380. package/build/navigation/view-interactivity.js.map +0 -1
  381. package/build/navigation/view-modal.js +0 -115
  382. package/build/navigation/view-modal.js.map +0 -1
  383. package/build-module/file/view-interactivity.js +0 -18
  384. package/build-module/file/view-interactivity.js.map +0 -1
  385. package/build-module/image/view-interactivity.js.map +0 -1
  386. package/build-module/navigation/view-interactivity.js +0 -169
  387. package/build-module/navigation/view-interactivity.js.map +0 -1
  388. package/build-module/navigation/view-modal.js +0 -112
  389. package/build-module/navigation/view-modal.js.map +0 -1
  390. package/src/file/view-interactivity.js +0 -18
  391. package/src/navigation/view-interactivity.js +0 -196
  392. package/src/navigation/view-modal.js +0 -127
  393. /package/src/image/{view-interactivity.js → view.js} +0 -0
package/src/verse/edit.js CHANGED
@@ -13,12 +13,14 @@ import {
13
13
  AlignmentToolbar,
14
14
  useBlockProps,
15
15
  } from '@wordpress/block-editor';
16
+ import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
16
17
 
17
18
  export default function VerseEdit( {
18
19
  attributes,
19
20
  setAttributes,
20
21
  mergeBlocks,
21
22
  onRemove,
23
+ insertBlocksAfter,
22
24
  style,
23
25
  } ) {
24
26
  const { textAlign, content } = attributes;
@@ -56,6 +58,9 @@ export default function VerseEdit( {
56
58
  textAlign={ textAlign }
57
59
  { ...blockProps }
58
60
  __unstablePastePlainText
61
+ __unstableOnSplitAtDoubleLineEnd={ () =>
62
+ insertBlocksAfter( createBlock( getDefaultBlockName() ) )
63
+ }
59
64
  />
60
65
  </>
61
66
  );
@@ -34,7 +34,7 @@ export const settings = {
34
34
  deprecated,
35
35
  merge( attributes, attributesToMerge ) {
36
36
  return {
37
- content: attributes.content + attributesToMerge.content,
37
+ content: attributes.content + '\n\n' + attributesToMerge.content,
38
38
  };
39
39
  },
40
40
  edit,
@@ -61,9 +61,8 @@ describe( 'Verse block', () => {
61
61
  await addBlock( screen, 'Verse' );
62
62
 
63
63
  // Act
64
- const verseTextInput = await screen.findByPlaceholderText(
65
- 'Write verse…'
66
- );
64
+ const verseTextInput =
65
+ await screen.findByPlaceholderText( 'Write verse…' );
67
66
  typeInRichText( verseTextInput, 'A great statement.' );
68
67
  fireEvent( verseTextInput, 'onKeyDown', {
69
68
  nativeEvent: {},
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- var _interactivity = require("@wordpress/interactivity");
4
- var _utils = require("./utils");
5
- /**
6
- * WordPress dependencies
7
- */
8
-
9
- /**
10
- * Internal dependencies
11
- */
12
-
13
- (0, _interactivity.store)({
14
- selectors: {
15
- core: {
16
- file: {
17
- hasPdfPreview: _utils.browserSupportsPdfs
18
- }
19
- }
20
- }
21
- });
22
- //# sourceMappingURL=view-interactivity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_interactivity","require","_utils","store","selectors","core","file","hasPdfPreview"],"sources":["@wordpress/block-library/src/file/view-interactivity.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store } from '@wordpress/interactivity';\n/**\n * Internal dependencies\n */\nimport { browserSupportsPdfs as hasPdfPreview } from './utils';\n\nstore( {\n\tselectors: {\n\t\tcore: {\n\t\t\tfile: {\n\t\t\t\thasPdfPreview,\n\t\t\t},\n\t\t},\n\t},\n} );\n"],"mappings":";;AAGA,IAAAA,cAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAPA;AACA;AACA;;AAEA;AACA;AACA;;AAGA,IAAAE,oBAAK,EAAE;EACNC,SAAS,EAAE;IACVC,IAAI,EAAE;MACLC,IAAI,EAAE;QACLC,aAAa,EAAbA;MACD;IACD;EACD;AACD,CAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["_interactivity","require","focusableSelectors","store","state","core","image","windowWidth","window","innerWidth","windowHeight","innerHeight","actions","showLightbox","context","event","imageLoaded","initialized","lastFocusedElement","document","activeElement","scrollDelta","lightboxEnabled","setStyles","documentElement","classList","add","hideLightbox","hideAnimationEnabled","lightboxAnimation","deltaY","type","Math","abs","scrollY","scrollTop","pageYOffset","scrollLeft","pageXOffset","onscroll","scrollTo","setTimeout","remove","focus","preventScroll","handleKeydown","key","keyCode","shiftKey","firstFocusableElement","preventDefault","lastFocusableElement","handleLoad","effects","ref","imageCurrentSrc","currentSrc","setButtonStyles","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","addEventListener","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","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-interactivity.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\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\t\t\t\t\t\t// Hide overflow only when the animation is in progress,\n\t\t\t\t\t\t// otherwise the removal of the scrollbars will draw attention\n\t\t\t\t\t\t// to itself and look like an error\n\t\t\t\t\t\tdocument.documentElement.classList.add(\n\t\t\t\t\t\t\t'wp-has-lightbox-open'\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// If scrolling, wait a moment before closing the lightbox.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tcontext.core.image.lightboxAnimation === 'fade'\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcontext.core.image.scrollDelta += event.deltaY;\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tevent.type === 'mousewheel' &&\n\t\t\t\t\t\t\t\t\tMath.abs(\n\t\t\t\t\t\t\t\t\t\twindow.scrollY -\n\t\t\t\t\t\t\t\t\t\t\tcontext.core.image.scrollDelta\n\t\t\t\t\t\t\t\t\t) < 10\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tcontext.core.image.lightboxAnimation === 'zoom'\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t// Disable scroll until the zoom animation ends.\n\t\t\t\t\t\t\t\t// Get the current page scroll position\n\t\t\t\t\t\t\t\tconst scrollTop =\n\t\t\t\t\t\t\t\t\twindow.pageYOffset ||\n\t\t\t\t\t\t\t\t\tdocument.documentElement.scrollTop;\n\t\t\t\t\t\t\t\tconst scrollLeft =\n\t\t\t\t\t\t\t\t\twindow.pageXOffset ||\n\t\t\t\t\t\t\t\t\tdocument.documentElement.scrollLeft;\n\t\t\t\t\t\t\t\t// if any scroll is attempted, set this to the previous value.\n\t\t\t\t\t\t\t\twindow.onscroll = function () {\n\t\t\t\t\t\t\t\t\twindow.scrollTo( scrollLeft, scrollTop );\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t// Enable scrolling after the animation finishes\n\t\t\t\t\t\t\t\tsetTimeout( function () {\n\t\t\t\t\t\t\t\t\twindow.onscroll = function () {};\n\t\t\t\t\t\t\t\t}, 400 );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tdocument.documentElement.classList.remove(\n\t\t\t\t\t\t\t\t'wp-has-lightbox-open'\n\t\t\t\t\t\t\t);\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},\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\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\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":";;AAGA,IAAAA,cAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,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,IAAAC,oBAAK,EACJ;EACCC,KAAK,EAAE;IACNC,IAAI,EAAE;MACLC,KAAK,EAAE;QACNC,WAAW,EAAEC,MAAM,CAACC,UAAU;QAC9BC,YAAY,EAAEF,MAAM,CAACG;MACtB;IACD;EACD,CAAC;EACDC,OAAO,EAAE;IACRP,IAAI,EAAE;MAC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T,cAAc,GAAGC,eAAe,GAAGZ,aAAa;EACjD;EAEA,MAAMsB,cAAc,GAAG/B,aAAa,GAAGoB,cAAc;EACrD,MAAMY,gBAAgB,GACrBpB,WAAW,IAAKQ,cAAc,GAAGF,iBAAiB,CAAE;EACrD,MAAMe,iBAAiB,GACtBlB,YAAY,IAAKM,eAAe,GAAGF,kBAAkB,CAAE;;EAExD;EACA,IAAIe,QAAQ,GAAGvG,QAAQ,CAACwG,cAAc,CAAE,oBAAqB,CAAC;EAC9D,IAAK,CAAED,QAAQ,EAAG;IACjBA,QAAQ,GAAGvG,QAAQ,CAACyG,aAAa,CAAE,OAAQ,CAAC;IAC5CF,QAAQ,CAACG,EAAE,GAAG,oBAAoB;IAClC1G,QAAQ,CAAC2G,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,qCAAsCe,cAAc,GAAG,CAAG;AAC1D,sCAAuCC,eAAe,GAAG,CAAG;AAC5D,iCAAkCW,gBAAkB;AACpD,kCAAmCC,iBAAmB;AACtD,2BAA4BF,cAAgB;AAC5C;AACA,EAAE;AACF;AAEA,SAAShC,QAAQA,CAAE0C,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,GAAG1F,UAAU,CAAE2F,KAAK,EAAEF,IAAK,CAAC;EACpC,CAAC;AACF"}
@@ -1,172 +0,0 @@
1
- "use strict";
2
-
3
- var _interactivity = require("@wordpress/interactivity");
4
- /**
5
- * WordPress dependencies
6
- */
7
-
8
- const focusableSelectors = ['a[href]', 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])', 'select:not([disabled]):not([aria-hidden])', 'textarea:not([disabled]):not([aria-hidden])', 'button:not([disabled]):not([aria-hidden])', '[contenteditable]', '[tabindex]:not([tabindex^="-"])'];
9
- const openMenu = (store, menuOpenedOn) => {
10
- const {
11
- context,
12
- ref,
13
- selectors
14
- } = store;
15
- selectors.core.navigation.menuOpenedBy(store)[menuOpenedOn] = true;
16
- context.core.navigation.previousFocus = ref;
17
- if (context.core.navigation.type === 'overlay') {
18
- // Add a `has-modal-open` class to the <html> root.
19
- document.documentElement.classList.add('has-modal-open');
20
- }
21
- };
22
- const closeMenu = (store, menuClosedOn) => {
23
- const {
24
- context,
25
- selectors
26
- } = store;
27
- selectors.core.navigation.menuOpenedBy(store)[menuClosedOn] = false;
28
- // Check if the menu is still open or not.
29
- if (!selectors.core.navigation.isMenuOpen(store)) {
30
- if (context.core.navigation.modal?.contains(window.document.activeElement)) {
31
- context.core.navigation.previousFocus.focus();
32
- }
33
- context.core.navigation.modal = null;
34
- context.core.navigation.previousFocus = null;
35
- if (context.core.navigation.type === 'overlay') {
36
- document.documentElement.classList.remove('has-modal-open');
37
- }
38
- }
39
- };
40
- (0, _interactivity.store)({
41
- effects: {
42
- core: {
43
- navigation: {
44
- initMenu: store => {
45
- const {
46
- context,
47
- selectors,
48
- ref
49
- } = store;
50
- if (selectors.core.navigation.isMenuOpen(store)) {
51
- const focusableElements = ref.querySelectorAll(focusableSelectors);
52
- context.core.navigation.modal = ref;
53
- context.core.navigation.firstFocusableElement = focusableElements[0];
54
- context.core.navigation.lastFocusableElement = focusableElements[focusableElements.length - 1];
55
- }
56
- },
57
- focusFirstElement: store => {
58
- const {
59
- selectors,
60
- ref
61
- } = store;
62
- if (selectors.core.navigation.isMenuOpen(store)) {
63
- ref.querySelector('.wp-block-navigation-item > *:first-child').focus();
64
- }
65
- }
66
- }
67
- }
68
- },
69
- selectors: {
70
- core: {
71
- navigation: {
72
- roleAttribute: store => {
73
- const {
74
- context,
75
- selectors
76
- } = store;
77
- return context.core.navigation.type === 'overlay' && selectors.core.navigation.isMenuOpen(store) ? 'dialog' : '';
78
- },
79
- isMenuOpen: ({
80
- context
81
- }) =>
82
- // The menu is opened if either `click`, `hover` or `focus` is true.
83
- Object.values(context.core.navigation[context.core.navigation.type === 'overlay' ? 'overlayOpenedBy' : 'submenuOpenedBy']).filter(Boolean).length > 0,
84
- menuOpenedBy: ({
85
- context
86
- }) => context.core.navigation[context.core.navigation.type === 'overlay' ? 'overlayOpenedBy' : 'submenuOpenedBy']
87
- }
88
- }
89
- },
90
- actions: {
91
- core: {
92
- navigation: {
93
- openMenuOnHover(store) {
94
- const {
95
- navigation
96
- } = store.context.core;
97
- if (navigation.type === 'submenu' &&
98
- // Only open on hover if the overlay is closed.
99
- Object.values(navigation.overlayOpenedBy || {}).filter(Boolean).length === 0) openMenu(store, 'hover');
100
- },
101
- closeMenuOnHover(store) {
102
- closeMenu(store, 'hover');
103
- },
104
- openMenuOnClick(store) {
105
- openMenu(store, 'click');
106
- },
107
- closeMenuOnClick(store) {
108
- closeMenu(store, 'click');
109
- closeMenu(store, 'focus');
110
- },
111
- openMenuOnFocus(store) {
112
- openMenu(store, 'focus');
113
- },
114
- toggleMenuOnClick: store => {
115
- const {
116
- selectors
117
- } = store;
118
- const menuOpenedBy = selectors.core.navigation.menuOpenedBy(store);
119
- if (menuOpenedBy.click || menuOpenedBy.focus) {
120
- closeMenu(store, 'click');
121
- closeMenu(store, 'focus');
122
- } else {
123
- openMenu(store, 'click');
124
- }
125
- },
126
- handleMenuKeydown: store => {
127
- const {
128
- context,
129
- selectors,
130
- event
131
- } = store;
132
- if (selectors.core.navigation.menuOpenedBy(store).click) {
133
- // If Escape close the menu.
134
- if (event?.key === 'Escape') {
135
- closeMenu(store, 'click');
136
- closeMenu(store, 'focus');
137
- return;
138
- }
139
-
140
- // Trap focus if it is an overlay (main menu).
141
- if (context.core.navigation.type === 'overlay' && event.key === 'Tab') {
142
- // If shift + tab it change the direction.
143
- if (event.shiftKey && window.document.activeElement === context.core.navigation.firstFocusableElement) {
144
- event.preventDefault();
145
- context.core.navigation.lastFocusableElement.focus();
146
- } else if (!event.shiftKey && window.document.activeElement === context.core.navigation.lastFocusableElement) {
147
- event.preventDefault();
148
- context.core.navigation.firstFocusableElement.focus();
149
- }
150
- }
151
- }
152
- },
153
- handleMenuFocusout: store => {
154
- const {
155
- context,
156
- event
157
- } = store;
158
- // If focus is outside modal, and in the document, close menu
159
- // event.target === The element losing focus
160
- // event.relatedTarget === The element receiving focus (if any)
161
- // When focusout is outsite the document,
162
- // `window.document.activeElement` doesn't change.
163
- if (!context.core.navigation.modal?.contains(event.relatedTarget) && event.target !== window.document.activeElement) {
164
- closeMenu(store, 'click');
165
- closeMenu(store, 'focus');
166
- }
167
- }
168
- }
169
- }
170
- }
171
- });
172
- //# sourceMappingURL=view-interactivity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_interactivity","require","focusableSelectors","openMenu","store","menuOpenedOn","context","ref","selectors","core","navigation","menuOpenedBy","previousFocus","type","document","documentElement","classList","add","closeMenu","menuClosedOn","isMenuOpen","modal","contains","window","activeElement","focus","remove","wpStore","effects","initMenu","focusableElements","querySelectorAll","firstFocusableElement","lastFocusableElement","length","focusFirstElement","querySelector","roleAttribute","Object","values","filter","Boolean","actions","openMenuOnHover","overlayOpenedBy","closeMenuOnHover","openMenuOnClick","closeMenuOnClick","openMenuOnFocus","toggleMenuOnClick","click","handleMenuKeydown","event","key","shiftKey","preventDefault","handleMenuFocusout","relatedTarget","target"],"sources":["@wordpress/block-library/src/navigation/view-interactivity.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as wpStore } from '@wordpress/interactivity';\n\nconst focusableSelectors = [\n\t'a[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'[contenteditable]',\n\t'[tabindex]:not([tabindex^=\"-\"])',\n];\n\nconst openMenu = ( store, menuOpenedOn ) => {\n\tconst { context, ref, selectors } = store;\n\tselectors.core.navigation.menuOpenedBy( store )[ menuOpenedOn ] = true;\n\tcontext.core.navigation.previousFocus = ref;\n\tif ( context.core.navigation.type === 'overlay' ) {\n\t\t// Add a `has-modal-open` class to the <html> root.\n\t\tdocument.documentElement.classList.add( 'has-modal-open' );\n\t}\n};\n\nconst closeMenu = ( store, menuClosedOn ) => {\n\tconst { context, selectors } = store;\n\tselectors.core.navigation.menuOpenedBy( store )[ menuClosedOn ] = false;\n\t// Check if the menu is still open or not.\n\tif ( ! selectors.core.navigation.isMenuOpen( store ) ) {\n\t\tif (\n\t\t\tcontext.core.navigation.modal?.contains(\n\t\t\t\twindow.document.activeElement\n\t\t\t)\n\t\t) {\n\t\t\tcontext.core.navigation.previousFocus.focus();\n\t\t}\n\t\tcontext.core.navigation.modal = null;\n\t\tcontext.core.navigation.previousFocus = null;\n\t\tif ( context.core.navigation.type === 'overlay' ) {\n\t\t\tdocument.documentElement.classList.remove( 'has-modal-open' );\n\t\t}\n\t}\n};\n\nwpStore( {\n\teffects: {\n\t\tcore: {\n\t\t\tnavigation: {\n\t\t\t\tinitMenu: ( store ) => {\n\t\t\t\t\tconst { context, selectors, ref } = store;\n\t\t\t\t\tif ( selectors.core.navigation.isMenuOpen( store ) ) {\n\t\t\t\t\t\tconst focusableElements =\n\t\t\t\t\t\t\tref.querySelectorAll( focusableSelectors );\n\t\t\t\t\t\tcontext.core.navigation.modal = ref;\n\t\t\t\t\t\tcontext.core.navigation.firstFocusableElement =\n\t\t\t\t\t\t\tfocusableElements[ 0 ];\n\t\t\t\t\t\tcontext.core.navigation.lastFocusableElement =\n\t\t\t\t\t\t\tfocusableElements[ focusableElements.length - 1 ];\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tfocusFirstElement: ( store ) => {\n\t\t\t\t\tconst { selectors, ref } = store;\n\t\t\t\t\tif ( selectors.core.navigation.isMenuOpen( store ) ) {\n\t\t\t\t\t\tref.querySelector(\n\t\t\t\t\t\t\t'.wp-block-navigation-item > *:first-child'\n\t\t\t\t\t\t).focus();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\tselectors: {\n\t\tcore: {\n\t\t\tnavigation: {\n\t\t\t\troleAttribute: ( store ) => {\n\t\t\t\t\tconst { context, selectors } = store;\n\t\t\t\t\treturn context.core.navigation.type === 'overlay' &&\n\t\t\t\t\t\tselectors.core.navigation.isMenuOpen( store )\n\t\t\t\t\t\t? 'dialog'\n\t\t\t\t\t\t: '';\n\t\t\t\t},\n\t\t\t\tisMenuOpen: ( { context } ) =>\n\t\t\t\t\t// The menu is opened if either `click`, `hover` or `focus` is true.\n\t\t\t\t\tObject.values(\n\t\t\t\t\t\tcontext.core.navigation[\n\t\t\t\t\t\t\tcontext.core.navigation.type === 'overlay'\n\t\t\t\t\t\t\t\t? 'overlayOpenedBy'\n\t\t\t\t\t\t\t\t: 'submenuOpenedBy'\n\t\t\t\t\t\t]\n\t\t\t\t\t).filter( Boolean ).length > 0,\n\t\t\t\tmenuOpenedBy: ( { context } ) =>\n\t\t\t\t\tcontext.core.navigation[\n\t\t\t\t\t\tcontext.core.navigation.type === 'overlay'\n\t\t\t\t\t\t\t? 'overlayOpenedBy'\n\t\t\t\t\t\t\t: 'submenuOpenedBy'\n\t\t\t\t\t],\n\t\t\t},\n\t\t},\n\t},\n\tactions: {\n\t\tcore: {\n\t\t\tnavigation: {\n\t\t\t\topenMenuOnHover( store ) {\n\t\t\t\t\tconst { navigation } = store.context.core;\n\t\t\t\t\tif (\n\t\t\t\t\t\tnavigation.type === 'submenu' &&\n\t\t\t\t\t\t// Only open on hover if the overlay is closed.\n\t\t\t\t\t\tObject.values(\n\t\t\t\t\t\t\tnavigation.overlayOpenedBy || {}\n\t\t\t\t\t\t).filter( Boolean ).length === 0\n\t\t\t\t\t)\n\t\t\t\t\t\topenMenu( store, 'hover' );\n\t\t\t\t},\n\t\t\t\tcloseMenuOnHover( store ) {\n\t\t\t\t\tcloseMenu( store, 'hover' );\n\t\t\t\t},\n\t\t\t\topenMenuOnClick( store ) {\n\t\t\t\t\topenMenu( store, 'click' );\n\t\t\t\t},\n\t\t\t\tcloseMenuOnClick( store ) {\n\t\t\t\t\tcloseMenu( store, 'click' );\n\t\t\t\t\tcloseMenu( store, 'focus' );\n\t\t\t\t},\n\t\t\t\topenMenuOnFocus( store ) {\n\t\t\t\t\topenMenu( store, 'focus' );\n\t\t\t\t},\n\t\t\t\ttoggleMenuOnClick: ( store ) => {\n\t\t\t\t\tconst { selectors } = store;\n\t\t\t\t\tconst menuOpenedBy =\n\t\t\t\t\t\tselectors.core.navigation.menuOpenedBy( store );\n\t\t\t\t\tif ( menuOpenedBy.click || menuOpenedBy.focus ) {\n\t\t\t\t\t\tcloseMenu( store, 'click' );\n\t\t\t\t\t\tcloseMenu( store, 'focus' );\n\t\t\t\t\t} else {\n\t\t\t\t\t\topenMenu( store, 'click' );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\thandleMenuKeydown: ( store ) => {\n\t\t\t\t\tconst { context, selectors, event } = store;\n\t\t\t\t\tif (\n\t\t\t\t\t\tselectors.core.navigation.menuOpenedBy( store ).click\n\t\t\t\t\t) {\n\t\t\t\t\t\t// If Escape close the menu.\n\t\t\t\t\t\tif ( event?.key === 'Escape' ) {\n\t\t\t\t\t\t\tcloseMenu( store, 'click' );\n\t\t\t\t\t\t\tcloseMenu( store, 'focus' );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Trap focus if it is an overlay (main menu).\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tcontext.core.navigation.type === 'overlay' &&\n\t\t\t\t\t\t\tevent.key === 'Tab'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// If shift + tab it change the direction.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tevent.shiftKey &&\n\t\t\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\t\t\tcontext.core.navigation\n\t\t\t\t\t\t\t\t\t\t.firstFocusableElement\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tcontext.core.navigation.lastFocusableElement.focus();\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t! event.shiftKey &&\n\t\t\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\t\t\tcontext.core.navigation.lastFocusableElement\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tcontext.core.navigation.firstFocusableElement.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},\n\t\t\t\thandleMenuFocusout: ( store ) => {\n\t\t\t\t\tconst { context, event } = store;\n\t\t\t\t\t// If focus is outside modal, and in the document, close menu\n\t\t\t\t\t// event.target === The element losing focus\n\t\t\t\t\t// event.relatedTarget === The element receiving focus (if any)\n\t\t\t\t\t// When focusout is outsite the document,\n\t\t\t\t\t// `window.document.activeElement` doesn't change.\n\t\t\t\t\tif (\n\t\t\t\t\t\t! context.core.navigation.modal?.contains(\n\t\t\t\t\t\t\tevent.relatedTarget\n\t\t\t\t\t\t) &&\n\t\t\t\t\t\tevent.target !== window.document.activeElement\n\t\t\t\t\t) {\n\t\t\t\t\t\tcloseMenu( store, 'click' );\n\t\t\t\t\t\tcloseMenu( store, 'focus' );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n} );\n"],"mappings":";;AAGA,IAAAA,cAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,kBAAkB,GAAG,CAC1B,SAAS,EACT,+DAA+D,EAC/D,2CAA2C,EAC3C,6CAA6C,EAC7C,2CAA2C,EAC3C,mBAAmB,EACnB,iCAAiC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,CAACuB,oBAAoB,CAACR,KAAK,CAAC,CAAC;cACrD,CAAC,MAAM,IACN,CAAE2B,KAAK,CAACE,QAAQ,IAChB/B,MAAM,CAACT,QAAQ,CAACU,aAAa,KAC5BlB,OAAO,CAACG,IAAI,CAACC,UAAU,CAACuB,oBAAoB,EAC5C;gBACDmB,KAAK,CAACG,cAAc,CAAC,CAAC;gBACtBjD,OAAO,CAACG,IAAI,CAACC,UAAU,CAACsB,qBAAqB,CAACP,KAAK,CAAC,CAAC;cACtD;YACD;UACD;QACD,CAAC;QACD+B,kBAAkB,EAAIpD,KAAK,IAAM;UAChC,MAAM;YAAEE,OAAO;YAAE8C;UAAM,CAAC,GAAGhD,KAAK;UAChC;UACA;UACA;UACA;UACA;UACA,IACC,CAAEE,OAAO,CAACG,IAAI,CAACC,UAAU,CAACW,KAAK,EAAEC,QAAQ,CACxC8B,KAAK,CAACK,aACP,CAAC,IACDL,KAAK,CAACM,MAAM,KAAKnC,MAAM,CAACT,QAAQ,CAACU,aAAa,EAC7C;YACDN,SAAS,CAAEd,KAAK,EAAE,OAAQ,CAAC;YAC3Bc,SAAS,CAAEd,KAAK,EAAE,OAAQ,CAAC;UAC5B;QACD;MACD;IACD;EACD;AACD,CAAE,CAAC"}
@@ -1,115 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _micromodal = _interopRequireDefault(require("micromodal"));
5
- /*eslint-env browser*/
6
- /**
7
- * External dependencies
8
- */
9
-
10
- // Responsive navigation toggle.
11
-
12
- /**
13
- * Toggles responsive navigation.
14
- *
15
- * @param {HTMLDivElement} modal
16
- * @param {boolean} isHidden
17
- */
18
- function navigationToggleModal(modal, isHidden) {
19
- const dialogContainer = modal.querySelector(`.wp-block-navigation__responsive-dialog`);
20
- modal.classList.toggle('has-modal-open', !isHidden);
21
- dialogContainer.toggleAttribute('aria-modal', !isHidden);
22
- if (isHidden) {
23
- dialogContainer.removeAttribute('role');
24
- dialogContainer.removeAttribute('aria-modal');
25
- } else {
26
- dialogContainer.setAttribute('role', 'dialog');
27
- dialogContainer.setAttribute('aria-modal', 'true');
28
- }
29
-
30
- // Add a class to indicate the modal is open.
31
- document.documentElement.classList.toggle('has-modal-open');
32
- }
33
-
34
- /**
35
- * Checks whether the provided link is an anchor on the current page.
36
- *
37
- * @param {HTMLAnchorElement} node
38
- * @return {boolean} Is anchor.
39
- */
40
- function isLinkToAnchorOnCurrentPage(node) {
41
- return node.hash && node.protocol === window.location.protocol && node.host === window.location.host && node.pathname === window.location.pathname && node.search === window.location.search;
42
- }
43
-
44
- /**
45
- * Handles effects after opening the modal.
46
- *
47
- * @param {HTMLDivElement} modal
48
- */
49
- function onShow(modal) {
50
- navigationToggleModal(modal, false);
51
- modal.addEventListener('click', handleAnchorLinkClicksInsideModal, {
52
- passive: true
53
- });
54
- }
55
-
56
- /**
57
- * Handles effects after closing the modal.
58
- *
59
- * @param {HTMLDivElement} modal
60
- */
61
- function onClose(modal) {
62
- navigationToggleModal(modal, true);
63
- modal.removeEventListener('click', handleAnchorLinkClicksInsideModal, {
64
- passive: true
65
- });
66
- }
67
-
68
- /**
69
- * Handle clicks to anchor links in modal using event delegation by closing modal automatically
70
- *
71
- * @param {UIEvent} event
72
- */
73
- function handleAnchorLinkClicksInsideModal(event) {
74
- const link = event.target.closest('.wp-block-navigation-item__content');
75
- if (!(link instanceof HTMLAnchorElement)) {
76
- return;
77
- }
78
-
79
- // Ignore non-anchor links and anchor links which open on a new tab.
80
- if (!isLinkToAnchorOnCurrentPage(link) || link.attributes?.target === '_blank') {
81
- return;
82
- }
83
-
84
- // Find the specific parent modal for this link
85
- // since .close() won't work without an ID if there are
86
- // multiple navigation menus in a post/page.
87
- const modal = link.closest('.wp-block-navigation__responsive-container');
88
- const modalId = modal?.getAttribute('id');
89
- if (!modalId) {
90
- return;
91
- }
92
-
93
- // check if modal exists and is open before trying to close it
94
- // otherwise Micromodal will toggle the `has-modal-open` class
95
- // on the html tag which prevents scrolling
96
- if (modalId && modal.classList.contains('has-modal-open')) {
97
- _micromodal.default.close(modalId);
98
- }
99
- }
100
-
101
- // MicroModal.init() does not support event delegation for the open trigger, so here MicroModal.show() is called manually.
102
- document.addEventListener('click', event => {
103
- /** @type {HTMLElement} */
104
- const target = event.target;
105
- if (target.dataset.micromodalTrigger) {
106
- _micromodal.default.show(target.dataset.micromodalTrigger, {
107
- onShow,
108
- onClose,
109
- openClass: 'is-menu-open'
110
- });
111
- }
112
- }, {
113
- passive: true
114
- });
115
- //# sourceMappingURL=view-modal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_micromodal","_interopRequireDefault","require","navigationToggleModal","modal","isHidden","dialogContainer","querySelector","classList","toggle","toggleAttribute","removeAttribute","setAttribute","document","documentElement","isLinkToAnchorOnCurrentPage","node","hash","protocol","window","location","host","pathname","search","onShow","addEventListener","handleAnchorLinkClicksInsideModal","passive","onClose","removeEventListener","event","link","target","closest","HTMLAnchorElement","attributes","modalId","getAttribute","contains","MicroModal","close","dataset","micromodalTrigger","show","openClass"],"sources":["@wordpress/block-library/src/navigation/view-modal.js"],"sourcesContent":["/*eslint-env browser*/\n/**\n * External dependencies\n */\nimport MicroModal from 'micromodal';\n\n// Responsive navigation toggle.\n\n/**\n * Toggles responsive navigation.\n *\n * @param {HTMLDivElement} modal\n * @param {boolean} isHidden\n */\nfunction navigationToggleModal( modal, isHidden ) {\n\tconst dialogContainer = modal.querySelector(\n\t\t`.wp-block-navigation__responsive-dialog`\n\t);\n\n\tmodal.classList.toggle( 'has-modal-open', ! isHidden );\n\tdialogContainer.toggleAttribute( 'aria-modal', ! isHidden );\n\n\tif ( isHidden ) {\n\t\tdialogContainer.removeAttribute( 'role' );\n\t\tdialogContainer.removeAttribute( 'aria-modal' );\n\t} else {\n\t\tdialogContainer.setAttribute( 'role', 'dialog' );\n\t\tdialogContainer.setAttribute( 'aria-modal', 'true' );\n\t}\n\n\t// Add a class to indicate the modal is open.\n\tdocument.documentElement.classList.toggle( 'has-modal-open' );\n}\n\n/**\n * Checks whether the provided link is an anchor on the current page.\n *\n * @param {HTMLAnchorElement} node\n * @return {boolean} Is anchor.\n */\nfunction isLinkToAnchorOnCurrentPage( node ) {\n\treturn (\n\t\tnode.hash &&\n\t\tnode.protocol === window.location.protocol &&\n\t\tnode.host === window.location.host &&\n\t\tnode.pathname === window.location.pathname &&\n\t\tnode.search === window.location.search\n\t);\n}\n\n/**\n * Handles effects after opening the modal.\n *\n * @param {HTMLDivElement} modal\n */\nfunction onShow( modal ) {\n\tnavigationToggleModal( modal, false );\n\tmodal.addEventListener( 'click', handleAnchorLinkClicksInsideModal, {\n\t\tpassive: true,\n\t} );\n}\n\n/**\n * Handles effects after closing the modal.\n *\n * @param {HTMLDivElement} modal\n */\nfunction onClose( modal ) {\n\tnavigationToggleModal( modal, true );\n\tmodal.removeEventListener( 'click', handleAnchorLinkClicksInsideModal, {\n\t\tpassive: true,\n\t} );\n}\n\n/**\n * Handle clicks to anchor links in modal using event delegation by closing modal automatically\n *\n * @param {UIEvent} event\n */\nfunction handleAnchorLinkClicksInsideModal( event ) {\n\tconst link = event.target.closest( '.wp-block-navigation-item__content' );\n\tif ( ! ( link instanceof HTMLAnchorElement ) ) {\n\t\treturn;\n\t}\n\n\t// Ignore non-anchor links and anchor links which open on a new tab.\n\tif (\n\t\t! isLinkToAnchorOnCurrentPage( link ) ||\n\t\tlink.attributes?.target === '_blank'\n\t) {\n\t\treturn;\n\t}\n\n\t// Find the specific parent modal for this link\n\t// since .close() won't work without an ID if there are\n\t// multiple navigation menus in a post/page.\n\tconst modal = link.closest( '.wp-block-navigation__responsive-container' );\n\tconst modalId = modal?.getAttribute( 'id' );\n\tif ( ! modalId ) {\n\t\treturn;\n\t}\n\n\t// check if modal exists and is open before trying to close it\n\t// otherwise Micromodal will toggle the `has-modal-open` class\n\t// on the html tag which prevents scrolling\n\tif ( modalId && modal.classList.contains( 'has-modal-open' ) ) {\n\t\tMicroModal.close( modalId );\n\t}\n}\n\n// MicroModal.init() does not support event delegation for the open trigger, so here MicroModal.show() is called manually.\ndocument.addEventListener(\n\t'click',\n\t( event ) => {\n\t\t/** @type {HTMLElement} */\n\t\tconst target = event.target;\n\n\t\tif ( target.dataset.micromodalTrigger ) {\n\t\t\tMicroModal.show( target.dataset.micromodalTrigger, {\n\t\t\t\tonShow,\n\t\t\t\tonClose,\n\t\t\t\topenClass: 'is-menu-open',\n\t\t\t} );\n\t\t}\n\t},\n\t{ passive: true }\n);\n"],"mappings":";;;AAIA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;AACA;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,qBAAqBA,CAAEC,KAAK,EAAEC,QAAQ,EAAG;EACjD,MAAMC,eAAe,GAAGF,KAAK,CAACG,aAAa,CACzC,yCACF,CAAC;EAEDH,KAAK,CAACI,SAAS,CAACC,MAAM,CAAE,gBAAgB,EAAE,CAAEJ,QAAS,CAAC;EACtDC,eAAe,CAACI,eAAe,CAAE,YAAY,EAAE,CAAEL,QAAS,CAAC;EAE3D,IAAKA,QAAQ,EAAG;IACfC,eAAe,CAACK,eAAe,CAAE,MAAO,CAAC;IACzCL,eAAe,CAACK,eAAe,CAAE,YAAa,CAAC;EAChD,CAAC,MAAM;IACNL,eAAe,CAACM,YAAY,CAAE,MAAM,EAAE,QAAS,CAAC;IAChDN,eAAe,CAACM,YAAY,CAAE,YAAY,EAAE,MAAO,CAAC;EACrD;;EAEA;EACAC,QAAQ,CAACC,eAAe,CAACN,SAAS,CAACC,MAAM,CAAE,gBAAiB,CAAC;AAC9D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASM,2BAA2BA,CAAEC,IAAI,EAAG;EAC5C,OACCA,IAAI,CAACC,IAAI,IACTD,IAAI,CAACE,QAAQ,KAAKC,MAAM,CAACC,QAAQ,CAACF,QAAQ,IAC1CF,IAAI,CAACK,IAAI,KAAKF,MAAM,CAACC,QAAQ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AAK,CAAEJ,OAAQ,CAAC;EAC5B;AACD;;AAEA;AACAvB,QAAQ,CAACY,gBAAgB,CACxB,OAAO,EACLK,KAAK,IAAM;EACZ;EACA,MAAME,MAAM,GAAGF,KAAK,CAACE,MAAM;EAE3B,IAAKA,MAAM,CAACS,OAAO,CAACC,iBAAiB,EAAG;IACvCH,mBAAU,CAACI,IAAI,CAAEX,MAAM,CAACS,OAAO,CAACC,iBAAiB,EAAE;MAClDlB,MAAM;MACNI,OAAO;MACPgB,SAAS,EAAE;IACZ,CAAE,CAAC;EACJ;AACD,CAAC,EACD;EAAEjB,OAAO,EAAE;AAAK,CACjB,CAAC"}
@@ -1,18 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { store } from '@wordpress/interactivity';
5
- /**
6
- * Internal dependencies
7
- */
8
- import { browserSupportsPdfs as hasPdfPreview } from './utils';
9
- store({
10
- selectors: {
11
- core: {
12
- file: {
13
- hasPdfPreview
14
- }
15
- }
16
- }
17
- });
18
- //# sourceMappingURL=view-interactivity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["store","browserSupportsPdfs","hasPdfPreview","selectors","core","file"],"sources":["@wordpress/block-library/src/file/view-interactivity.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store } from '@wordpress/interactivity';\n/**\n * Internal dependencies\n */\nimport { browserSupportsPdfs as hasPdfPreview } from './utils';\n\nstore( {\n\tselectors: {\n\t\tcore: {\n\t\t\tfile: {\n\t\t\t\thasPdfPreview,\n\t\t\t},\n\t\t},\n\t},\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,0BAA0B;AAChD;AACA;AACA;AACA,SAASC,mBAAmB,IAAIC,aAAa,QAAQ,SAAS;AAE9DF,KAAK,CAAE;EACNG,SAAS,EAAE;IACVC,IAAI,EAAE;MACLC,IAAI,EAAE;QACLH;MACD;IACD;EACD;AACD,CAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["store","focusableSelectors","state","core","image","windowWidth","window","innerWidth","windowHeight","innerHeight","actions","showLightbox","context","event","imageLoaded","initialized","lastFocusedElement","document","activeElement","scrollDelta","lightboxEnabled","setStyles","documentElement","classList","add","hideLightbox","hideAnimationEnabled","lightboxAnimation","deltaY","type","Math","abs","scrollY","scrollTop","pageYOffset","scrollLeft","pageXOffset","onscroll","scrollTo","setTimeout","remove","focus","preventScroll","handleKeydown","key","keyCode","shiftKey","firstFocusableElement","preventDefault","lastFocusableElement","handleLoad","effects","ref","imageCurrentSrc","currentSrc","setButtonStyles","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","addEventListener","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","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-interactivity.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\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\t\t\t\t\t\t// Hide overflow only when the animation is in progress,\n\t\t\t\t\t\t// otherwise the removal of the scrollbars will draw attention\n\t\t\t\t\t\t// to itself and look like an error\n\t\t\t\t\t\tdocument.documentElement.classList.add(\n\t\t\t\t\t\t\t'wp-has-lightbox-open'\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// If scrolling, wait a moment before closing the lightbox.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tcontext.core.image.lightboxAnimation === 'fade'\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcontext.core.image.scrollDelta += event.deltaY;\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tevent.type === 'mousewheel' &&\n\t\t\t\t\t\t\t\t\tMath.abs(\n\t\t\t\t\t\t\t\t\t\twindow.scrollY -\n\t\t\t\t\t\t\t\t\t\t\tcontext.core.image.scrollDelta\n\t\t\t\t\t\t\t\t\t) < 10\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tcontext.core.image.lightboxAnimation === 'zoom'\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t// Disable scroll until the zoom animation ends.\n\t\t\t\t\t\t\t\t// Get the current page scroll position\n\t\t\t\t\t\t\t\tconst scrollTop =\n\t\t\t\t\t\t\t\t\twindow.pageYOffset ||\n\t\t\t\t\t\t\t\t\tdocument.documentElement.scrollTop;\n\t\t\t\t\t\t\t\tconst scrollLeft =\n\t\t\t\t\t\t\t\t\twindow.pageXOffset ||\n\t\t\t\t\t\t\t\t\tdocument.documentElement.scrollLeft;\n\t\t\t\t\t\t\t\t// if any scroll is attempted, set this to the previous value.\n\t\t\t\t\t\t\t\twindow.onscroll = function () {\n\t\t\t\t\t\t\t\t\twindow.scrollTo( scrollLeft, scrollTop );\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t// Enable scrolling after the animation finishes\n\t\t\t\t\t\t\t\tsetTimeout( function () {\n\t\t\t\t\t\t\t\t\twindow.onscroll = function () {};\n\t\t\t\t\t\t\t\t}, 400 );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tdocument.documentElement.classList.remove(\n\t\t\t\t\t\t\t\t'wp-has-lightbox-open'\n\t\t\t\t\t\t\t);\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},\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\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\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;AAEDD,KAAK,CACJ;EACCE,KAAK,EAAE;IACNC,IAAI,EAAE;MACLC,KAAK,EAAE;QACNC,WAAW,EAAEC,MAAM,CAACC,UAAU;QAC9BC,YAAY,EAAEF,MAAM,CAACG;MACtB;IACD;EACD,CAAC;EACDC,OAAO,EAAE;IACRP,IAAI,EAAE;MACLC,KAAK,EAAE;QACNO,YAAY,EAAEA,CAAE;UAAEC,OAAO;UAAEC;QAAM,CAAC,KAAM;UACvC;UACA;UACA,IAAK,CAAED,OAAO,CAACT,IAAI,CAACC,KAAK,CAACU,WAAW,EAAG;YACvC;UACD;UACAF,OAAO,CAACT,IAAI,CAACC,KAAK,CAACW,WAAW,GAAG,IAAI;UACrCH,OAAO,CAACT,IAAI,CAACC,KAAK,CAACY,kBAAkB,GACpCV,MAAM,CAACW,QAAQ,CAACC,aAAa;UAC9BN,OAAO,CAACT,IAAI,CAACC,KAAK,CAACe,WAAW,GAAG,CAAC;UAElCP,OAAO,CAACT,IAAI,CAACC,KAAK,CAACgB,eAAe,GAAG,I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