@wordpress/block-library 7.3.10 → 7.6.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 (752) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +3 -2
  3. package/babel-plugin.js +154 -0
  4. package/build/archives/edit.js +1 -1
  5. package/build/archives/edit.js.map +1 -1
  6. package/build/audio/edit.js +5 -17
  7. package/build/audio/edit.js.map +1 -1
  8. package/build/audio/edit.native.js +1 -1
  9. package/build/audio/edit.native.js.map +1 -1
  10. package/build/block/edit.js +10 -9
  11. package/build/block/edit.js.map +1 -1
  12. package/build/button/edit.native.js +7 -3
  13. package/build/button/edit.native.js.map +1 -1
  14. package/build/button/index.js +1 -0
  15. package/build/button/index.js.map +1 -1
  16. package/build/categories/edit.js +9 -4
  17. package/build/categories/edit.js.map +1 -1
  18. package/build/categories/index.js +5 -1
  19. package/build/categories/index.js.map +1 -1
  20. package/build/column/index.js +10 -0
  21. package/build/column/index.js.map +1 -1
  22. package/build/comment-author-avatar/index.js +1 -0
  23. package/build/comment-author-avatar/index.js.map +1 -1
  24. package/build/comment-template/edit.js +1 -3
  25. package/build/comment-template/edit.js.map +1 -1
  26. package/build/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
  27. package/{build-module/comments-query-loop → build/comments}/edit/comments-inspector-controls.js.map +1 -1
  28. package/build/{comments-query-loop → comments}/edit.js +2 -2
  29. package/build/comments/edit.js.map +1 -0
  30. package/build/{comments-query-loop → comments}/index.js +1 -1
  31. package/build/comments/index.js.map +1 -0
  32. package/build/{comments-query-loop → comments}/save.js +2 -2
  33. package/build/comments/save.js.map +1 -0
  34. package/build/comments-title/index.js +1 -1
  35. package/build/comments-title/index.js.map +1 -1
  36. package/build/cover/controls.native.js +2 -3
  37. package/build/cover/controls.native.js.map +1 -1
  38. package/build/cover/edit/block-controls.js +115 -0
  39. package/build/cover/edit/block-controls.js.map +1 -0
  40. package/build/cover/edit/cover-placeholder.js +49 -0
  41. package/build/cover/edit/cover-placeholder.js.map +1 -0
  42. package/build/cover/edit/index.js +333 -0
  43. package/build/cover/edit/index.js.map +1 -0
  44. package/build/cover/edit/inspector-controls.js +224 -0
  45. package/build/cover/edit/inspector-controls.js.map +1 -0
  46. package/build/cover/edit/resizable-cover.js +67 -0
  47. package/build/cover/edit/resizable-cover.js.map +1 -0
  48. package/build/cover/edit/use-cover-is-dark.js +81 -0
  49. package/build/cover/edit/use-cover-is-dark.js.map +1 -0
  50. package/build/cover/edit.native.js +36 -16
  51. package/build/cover/edit.native.js.map +1 -1
  52. package/build/cover/focal-point-settings-button.native.js.map +1 -1
  53. package/build/cover/shared.js +9 -0
  54. package/build/cover/shared.js.map +1 -1
  55. package/build/cover/transforms.js +77 -6
  56. package/build/cover/transforms.js.map +1 -1
  57. package/build/cover/use-cover-is-dark.native.js +60 -0
  58. package/build/cover/use-cover-is-dark.native.js.map +1 -0
  59. package/build/embed/edit.js +12 -18
  60. package/build/embed/edit.js.map +1 -1
  61. package/build/embed/edit.native.js +1 -7
  62. package/build/embed/edit.native.js.map +1 -1
  63. package/build/embed/embed-preview.js +1 -1
  64. package/build/embed/embed-preview.js.map +1 -1
  65. package/build/embed/util.js +29 -4
  66. package/build/embed/util.js.map +1 -1
  67. package/build/file/edit.native.js +0 -1
  68. package/build/file/edit.native.js.map +1 -1
  69. package/build/file/inspector.js +2 -4
  70. package/build/file/inspector.js.map +1 -1
  71. package/build/gallery/edit.js +3 -2
  72. package/build/gallery/edit.js.map +1 -1
  73. package/build/gallery/gallery.js +1 -1
  74. package/build/gallery/gallery.js.map +1 -1
  75. package/build/gallery/shared.js +2 -2
  76. package/build/gallery/shared.js.map +1 -1
  77. package/build/gallery/use-get-media.js +2 -1
  78. package/build/gallery/use-get-media.js.map +1 -1
  79. package/build/gallery/use-short-code-transform.js +19 -18
  80. package/build/gallery/use-short-code-transform.js.map +1 -1
  81. package/build/gallery/v1/edit.js +1 -1
  82. package/build/gallery/v1/edit.js.map +1 -1
  83. package/build/gallery/v1/gallery.js +1 -1
  84. package/build/gallery/v1/gallery.js.map +1 -1
  85. package/build/group/index.js +1 -0
  86. package/build/group/index.js.map +1 -1
  87. package/build/heading/edit.js +6 -2
  88. package/build/heading/edit.js.map +1 -1
  89. package/build/heading/index.js +1 -0
  90. package/build/heading/index.js.map +1 -1
  91. package/build/heading/transforms.js +9 -4
  92. package/build/heading/transforms.js.map +1 -1
  93. package/build/html/edit.js +2 -2
  94. package/build/html/edit.js.map +1 -1
  95. package/build/image/edit.js +9 -8
  96. package/build/image/edit.js.map +1 -1
  97. package/build/image/edit.native.js +1 -2
  98. package/build/image/edit.native.js.map +1 -1
  99. package/build/image/image.js +2 -2
  100. package/build/image/image.js.map +1 -1
  101. package/build/index.js +48 -12
  102. package/build/index.js.map +1 -1
  103. package/build/index.native.js +14 -3
  104. package/build/index.native.js.map +1 -1
  105. package/build/is-block-metadata-experimental.js +18 -0
  106. package/build/is-block-metadata-experimental.js.map +1 -0
  107. package/build/latest-comments/edit.js +1 -1
  108. package/build/latest-comments/edit.js.map +1 -1
  109. package/build/latest-posts/edit.js +30 -4
  110. package/build/latest-posts/edit.js.map +1 -1
  111. package/build/latest-posts/edit.native.js +49 -0
  112. package/build/latest-posts/edit.native.js.map +1 -1
  113. package/build/list/transforms.js +6 -0
  114. package/build/list/transforms.js.map +1 -1
  115. package/build/list/v2/edit.js +2 -1
  116. package/build/list/v2/edit.js.map +1 -1
  117. package/build/list/v2/migrate.js +1 -0
  118. package/build/list/v2/migrate.js.map +1 -1
  119. package/build/list/v2/transforms.js +46 -9
  120. package/build/list/v2/transforms.js.map +1 -1
  121. package/build/list-item/edit.js +7 -9
  122. package/build/list-item/edit.js.map +1 -1
  123. package/build/list-item/hooks/index.js +24 -0
  124. package/build/list-item/hooks/index.js.map +1 -1
  125. package/build/list-item/hooks/use-backspace.js +59 -0
  126. package/build/list-item/hooks/use-backspace.js.map +1 -0
  127. package/build/list-item/hooks/use-enter.js +6 -9
  128. package/build/list-item/hooks/use-enter.js.map +1 -1
  129. package/build/list-item/hooks/use-indent-list-item.js +33 -39
  130. package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
  131. package/build/list-item/hooks/use-space.js +54 -0
  132. package/build/list-item/hooks/use-space.js.map +1 -0
  133. package/build/list-item/hooks/use-split.js +30 -0
  134. package/build/list-item/hooks/use-split.js.map +1 -0
  135. package/build/list-item/index.js +1 -0
  136. package/build/list-item/index.js.map +1 -1
  137. package/build/list-item/utils.js +1 -1
  138. package/build/list-item/utils.js.map +1 -1
  139. package/build/loginout/edit.js +1 -1
  140. package/build/loginout/edit.js.map +1 -1
  141. package/build/media-text/edit.js +1 -2
  142. package/build/media-text/edit.js.map +1 -1
  143. package/build/media-text/edit.native.js +3 -2
  144. package/build/media-text/edit.native.js.map +1 -1
  145. package/build/media-text/media-container.native.js +2 -4
  146. package/build/media-text/media-container.native.js.map +1 -1
  147. package/build/media-text/transforms.js +137 -8
  148. package/build/media-text/transforms.js.map +1 -1
  149. package/build/navigation/edit/index.js +86 -81
  150. package/build/navigation/edit/index.js.map +1 -1
  151. package/build/navigation/edit/inner-blocks.js +1 -5
  152. package/build/navigation/edit/inner-blocks.js.map +1 -1
  153. package/build/navigation/edit/unsaved-inner-blocks.js +5 -4
  154. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  155. package/build/navigation/index.js +1 -1
  156. package/build/navigation/use-navigation-entities.js +3 -3
  157. package/build/navigation/use-navigation-entities.js.map +1 -1
  158. package/build/navigation/view-modal.js +62 -0
  159. package/build/navigation/view-modal.js.map +1 -0
  160. package/build/navigation/view.js +1 -34
  161. package/build/navigation/view.js.map +1 -1
  162. package/build/navigation-link/edit.js +1 -1
  163. package/build/navigation-link/edit.js.map +1 -1
  164. package/build/navigation-link/fallback-variations.js +1 -1
  165. package/build/navigation-link/fallback-variations.js.map +1 -1
  166. package/build/navigation-link/hooks.js +1 -1
  167. package/build/navigation-link/hooks.js.map +1 -1
  168. package/build/page-list/convert-to-links-modal.js +1 -1
  169. package/build/page-list/convert-to-links-modal.js.map +1 -1
  170. package/build/page-list/edit.js +1 -1
  171. package/build/page-list/edit.js.map +1 -1
  172. package/build/paragraph/edit.js +10 -0
  173. package/build/paragraph/edit.js.map +1 -1
  174. package/build/paragraph/edit.native.js +6 -2
  175. package/build/paragraph/edit.native.js.map +1 -1
  176. package/build/paragraph/use-enter.js +94 -0
  177. package/build/paragraph/use-enter.js.map +1 -0
  178. package/build/post-author/edit.js +2 -2
  179. package/build/post-author/edit.js.map +1 -1
  180. package/build/post-author-name/index.js +1 -0
  181. package/build/post-author-name/index.js.map +1 -1
  182. package/build/post-comment/index.js +2 -1
  183. package/build/post-comment/index.js.map +1 -1
  184. package/build/post-comments/edit.js +14 -35
  185. package/build/post-comments/edit.js.map +1 -1
  186. package/build/post-comments/index.js +1 -1
  187. package/build/post-comments-count/index.js +1 -0
  188. package/build/post-comments-count/index.js.map +1 -1
  189. package/build/post-comments-form/edit.js +37 -24
  190. package/build/post-comments-form/edit.js.map +1 -1
  191. package/build/post-comments-form/form.js +48 -0
  192. package/build/post-comments-form/form.js.map +1 -0
  193. package/build/post-comments-link/index.js +1 -0
  194. package/build/post-comments-link/index.js.map +1 -1
  195. package/build/post-excerpt/edit.js +1 -1
  196. package/build/post-excerpt/edit.js.map +1 -1
  197. package/build/post-featured-image/edit.js +1 -1
  198. package/build/post-featured-image/edit.js.map +1 -1
  199. package/build/post-template/edit.js +7 -2
  200. package/build/post-template/edit.js.map +1 -1
  201. package/build/post-terms/edit.js +35 -4
  202. package/build/post-terms/edit.js.map +1 -1
  203. package/build/post-terms/hooks.js +33 -0
  204. package/build/post-terms/hooks.js.map +1 -0
  205. package/build/post-terms/index.js +20 -5
  206. package/build/post-terms/index.js.map +1 -1
  207. package/build/post-title/index.js +1 -1
  208. package/build/post-title/index.js.map +1 -1
  209. package/build/pullquote/edit.js +1 -1
  210. package/build/pullquote/edit.js.map +1 -1
  211. package/build/pullquote/edit.native.js +1 -1
  212. package/build/pullquote/edit.native.js.map +1 -1
  213. package/build/query/edit/inspector-controls/index.js +26 -17
  214. package/build/query/edit/inspector-controls/index.js.map +1 -1
  215. package/build/query/edit/inspector-controls/parent-control.js +148 -0
  216. package/build/query/edit/inspector-controls/parent-control.js.map +1 -0
  217. package/build/query/edit/inspector-controls/sticky-control.js +41 -0
  218. package/build/query/edit/inspector-controls/sticky-control.js.map +1 -0
  219. package/build/query/index.js +2 -1
  220. package/build/query/index.js.map +1 -1
  221. package/build/query/utils.js +28 -2
  222. package/build/query/utils.js.map +1 -1
  223. package/build/query-title/index.js +1 -1
  224. package/build/query-title/index.js.map +1 -1
  225. package/build/query-title/variations.js +1 -1
  226. package/build/query-title/variations.js.map +1 -1
  227. package/build/quote/edit.js +3 -2
  228. package/build/quote/edit.js.map +1 -1
  229. package/build/quote/index.js +7 -0
  230. package/build/quote/index.js.map +1 -1
  231. package/build/quote/v2/edit.js +12 -4
  232. package/build/quote/v2/edit.js.map +1 -1
  233. package/build/rss/edit.js +1 -1
  234. package/build/rss/edit.js.map +1 -1
  235. package/build/search/edit.js +12 -9
  236. package/build/search/edit.js.map +1 -1
  237. package/build/separator/index.js +3 -0
  238. package/build/separator/index.js.map +1 -1
  239. package/build/site-logo/edit.js +1 -1
  240. package/build/site-logo/edit.js.map +1 -1
  241. package/build/spacer/constants.js +9 -0
  242. package/build/spacer/constants.js.map +1 -0
  243. package/build/spacer/controls.js +3 -3
  244. package/build/spacer/controls.js.map +1 -1
  245. package/build/spacer/controls.native.js +2 -2
  246. package/build/spacer/controls.native.js.map +1 -1
  247. package/build/spacer/edit.js +5 -6
  248. package/build/spacer/edit.js.map +1 -1
  249. package/build/table/edit.js +23 -4
  250. package/build/table/edit.js.map +1 -1
  251. package/build/table-of-contents/edit.js +138 -66
  252. package/build/table-of-contents/edit.js.map +1 -1
  253. package/build/table-of-contents/index.js +13 -3
  254. package/build/table-of-contents/index.js.map +1 -1
  255. package/build/table-of-contents/list.js +16 -9
  256. package/build/table-of-contents/list.js.map +1 -1
  257. package/build/table-of-contents/save.js +40 -0
  258. package/build/table-of-contents/save.js.map +1 -0
  259. package/build/table-of-contents/utils.js +11 -77
  260. package/build/table-of-contents/utils.js.map +1 -1
  261. package/build/tag-cloud/edit.js +1 -1
  262. package/build/tag-cloud/edit.js.map +1 -1
  263. package/build/template-part/edit/index.js +7 -3
  264. package/build/template-part/edit/index.js.map +1 -1
  265. package/build/template-part/edit/inner-blocks.js +3 -8
  266. package/build/template-part/edit/inner-blocks.js.map +1 -1
  267. package/build/video/edit.js +5 -9
  268. package/build/video/edit.js.map +1 -1
  269. package/build/video/edit.native.js +1 -1
  270. package/build/video/edit.native.js.map +1 -1
  271. package/build-module/archives/edit.js +1 -1
  272. package/build-module/archives/edit.js.map +1 -1
  273. package/build-module/audio/edit.js +6 -18
  274. package/build-module/audio/edit.js.map +1 -1
  275. package/build-module/audio/edit.native.js +1 -1
  276. package/build-module/audio/edit.native.js.map +1 -1
  277. package/build-module/block/edit.js +11 -10
  278. package/build-module/block/edit.js.map +1 -1
  279. package/build-module/button/edit.native.js +7 -3
  280. package/build-module/button/edit.native.js.map +1 -1
  281. package/build-module/button/index.js +1 -0
  282. package/build-module/button/index.js.map +1 -1
  283. package/build-module/categories/edit.js +9 -4
  284. package/build-module/categories/edit.js.map +1 -1
  285. package/build-module/categories/index.js +5 -1
  286. package/build-module/categories/index.js.map +1 -1
  287. package/build-module/column/index.js +10 -0
  288. package/build-module/column/index.js.map +1 -1
  289. package/build-module/comment-author-avatar/index.js +1 -0
  290. package/build-module/comment-author-avatar/index.js.map +1 -1
  291. package/build-module/comment-template/edit.js +1 -3
  292. package/build-module/comment-template/edit.js.map +1 -1
  293. package/build-module/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
  294. package/build-module/comments/edit/comments-inspector-controls.js.map +1 -0
  295. package/build-module/{comments-query-loop → comments}/edit.js +1 -1
  296. package/build-module/comments/edit.js.map +1 -0
  297. package/build-module/{comments-query-loop → comments}/index.js +1 -1
  298. package/build-module/comments/index.js.map +1 -0
  299. package/build-module/{comments-query-loop → comments}/save.js +1 -1
  300. package/build-module/comments/save.js.map +1 -0
  301. package/build-module/comments-title/index.js +1 -1
  302. package/build-module/comments-title/index.js.map +1 -1
  303. package/build-module/cover/controls.native.js +2 -3
  304. package/build-module/cover/controls.native.js.map +1 -1
  305. package/build-module/cover/edit/block-controls.js +104 -0
  306. package/build-module/cover/edit/block-controls.js.map +1 -0
  307. package/build-module/cover/edit/cover-placeholder.js +38 -0
  308. package/build-module/cover/edit/cover-placeholder.js.map +1 -0
  309. package/build-module/cover/edit/index.js +307 -0
  310. package/build-module/cover/edit/index.js.map +1 -0
  311. package/build-module/cover/edit/inspector-controls.js +215 -0
  312. package/build-module/cover/edit/inspector-controls.js.map +1 -0
  313. package/build-module/cover/edit/resizable-cover.js +55 -0
  314. package/build-module/cover/edit/resizable-cover.js.map +1 -0
  315. package/build-module/cover/edit/use-cover-is-dark.js +70 -0
  316. package/build-module/cover/edit/use-cover-is-dark.js.map +1 -0
  317. package/build-module/cover/edit.native.js +35 -17
  318. package/build-module/cover/edit.native.js.map +1 -1
  319. package/build-module/cover/focal-point-settings-button.native.js.map +1 -1
  320. package/build-module/cover/shared.js +7 -0
  321. package/build-module/cover/shared.js.map +1 -1
  322. package/build-module/cover/transforms.js +74 -6
  323. package/build-module/cover/transforms.js.map +1 -1
  324. package/build-module/cover/use-cover-is-dark.native.js +51 -0
  325. package/build-module/cover/use-cover-is-dark.native.js.map +1 -0
  326. package/build-module/embed/edit.js +13 -19
  327. package/build-module/embed/edit.js.map +1 -1
  328. package/build-module/embed/edit.native.js +2 -8
  329. package/build-module/embed/edit.native.js.map +1 -1
  330. package/build-module/embed/embed-preview.js +2 -2
  331. package/build-module/embed/embed-preview.js.map +1 -1
  332. package/build-module/embed/util.js +25 -3
  333. package/build-module/embed/util.js.map +1 -1
  334. package/build-module/file/edit.native.js +0 -1
  335. package/build-module/file/edit.native.js.map +1 -1
  336. package/build-module/file/inspector.js +2 -4
  337. package/build-module/file/inspector.js.map +1 -1
  338. package/build-module/gallery/edit.js +3 -2
  339. package/build-module/gallery/edit.js.map +1 -1
  340. package/build-module/gallery/gallery.js +2 -2
  341. package/build-module/gallery/gallery.js.map +1 -1
  342. package/build-module/gallery/shared.js +2 -2
  343. package/build-module/gallery/shared.js.map +1 -1
  344. package/build-module/gallery/use-get-media.js +2 -1
  345. package/build-module/gallery/use-get-media.js.map +1 -1
  346. package/build-module/gallery/use-short-code-transform.js +19 -18
  347. package/build-module/gallery/use-short-code-transform.js.map +1 -1
  348. package/build-module/gallery/v1/edit.js +1 -1
  349. package/build-module/gallery/v1/edit.js.map +1 -1
  350. package/build-module/gallery/v1/gallery.js +2 -2
  351. package/build-module/gallery/v1/gallery.js.map +1 -1
  352. package/build-module/group/index.js +1 -0
  353. package/build-module/group/index.js.map +1 -1
  354. package/build-module/heading/edit.js +6 -2
  355. package/build-module/heading/edit.js.map +1 -1
  356. package/build-module/heading/index.js +1 -0
  357. package/build-module/heading/index.js.map +1 -1
  358. package/build-module/heading/transforms.js +9 -4
  359. package/build-module/heading/transforms.js.map +1 -1
  360. package/build-module/html/edit.js +2 -2
  361. package/build-module/html/edit.js.map +1 -1
  362. package/build-module/image/edit.js +10 -9
  363. package/build-module/image/edit.js.map +1 -1
  364. package/build-module/image/edit.native.js +1 -2
  365. package/build-module/image/edit.native.js.map +1 -1
  366. package/build-module/image/image.js +3 -3
  367. package/build-module/image/image.js.map +1 -1
  368. package/build-module/index.js +43 -11
  369. package/build-module/index.js.map +1 -1
  370. package/build-module/index.native.js +14 -3
  371. package/build-module/index.native.js.map +1 -1
  372. package/build-module/is-block-metadata-experimental.js +16 -0
  373. package/build-module/is-block-metadata-experimental.js.map +1 -0
  374. package/build-module/latest-comments/edit.js +1 -1
  375. package/build-module/latest-comments/edit.js.map +1 -1
  376. package/build-module/latest-posts/edit.js +29 -5
  377. package/build-module/latest-posts/edit.js.map +1 -1
  378. package/build-module/latest-posts/edit.native.js +51 -2
  379. package/build-module/latest-posts/edit.native.js.map +1 -1
  380. package/build-module/list/transforms.js +6 -0
  381. package/build-module/list/transforms.js.map +1 -1
  382. package/build-module/list/v2/edit.js +2 -1
  383. package/build-module/list/v2/edit.js.map +1 -1
  384. package/build-module/list/v2/migrate.js +1 -3
  385. package/build-module/list/v2/migrate.js.map +1 -1
  386. package/build-module/list/v2/transforms.js +46 -9
  387. package/build-module/list/v2/transforms.js.map +1 -1
  388. package/build-module/list-item/edit.js +8 -9
  389. package/build-module/list-item/edit.js.map +1 -1
  390. package/build-module/list-item/hooks/index.js +3 -0
  391. package/build-module/list-item/hooks/index.js.map +1 -1
  392. package/build-module/list-item/hooks/use-backspace.js +44 -0
  393. package/build-module/list-item/hooks/use-backspace.js.map +1 -0
  394. package/build-module/list-item/hooks/use-enter.js +6 -9
  395. package/build-module/list-item/hooks/use-enter.js.map +1 -1
  396. package/build-module/list-item/hooks/use-indent-list-item.js +33 -38
  397. package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
  398. package/build-module/list-item/hooks/use-space.js +40 -0
  399. package/build-module/list-item/hooks/use-space.js.map +1 -0
  400. package/build-module/list-item/hooks/use-split.js +19 -0
  401. package/build-module/list-item/hooks/use-split.js.map +1 -0
  402. package/build-module/list-item/index.js +1 -0
  403. package/build-module/list-item/index.js.map +1 -1
  404. package/build-module/list-item/utils.js +1 -1
  405. package/build-module/list-item/utils.js.map +1 -1
  406. package/build-module/loginout/edit.js +1 -1
  407. package/build-module/loginout/edit.js.map +1 -1
  408. package/build-module/media-text/edit.js +1 -2
  409. package/build-module/media-text/edit.js.map +1 -1
  410. package/build-module/media-text/edit.native.js +3 -2
  411. package/build-module/media-text/edit.native.js.map +1 -1
  412. package/build-module/media-text/media-container.native.js +2 -4
  413. package/build-module/media-text/media-container.native.js.map +1 -1
  414. package/build-module/media-text/transforms.js +137 -8
  415. package/build-module/media-text/transforms.js.map +1 -1
  416. package/build-module/navigation/edit/index.js +87 -82
  417. package/build-module/navigation/edit/index.js.map +1 -1
  418. package/build-module/navigation/edit/inner-blocks.js +2 -6
  419. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  420. package/build-module/navigation/edit/unsaved-inner-blocks.js +5 -4
  421. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  422. package/build-module/navigation/index.js +1 -1
  423. package/build-module/navigation/use-navigation-entities.js +1 -1
  424. package/build-module/navigation/use-navigation-entities.js.map +1 -1
  425. package/build-module/navigation/view-modal.js +56 -0
  426. package/build-module/navigation/view-modal.js.map +1 -0
  427. package/build-module/navigation/view.js +1 -30
  428. package/build-module/navigation/view.js.map +1 -1
  429. package/build-module/navigation-link/edit.js +1 -1
  430. package/build-module/navigation-link/edit.js.map +1 -1
  431. package/build-module/navigation-link/fallback-variations.js +1 -1
  432. package/build-module/navigation-link/fallback-variations.js.map +1 -1
  433. package/build-module/navigation-link/hooks.js +2 -2
  434. package/build-module/navigation-link/hooks.js.map +1 -1
  435. package/build-module/page-list/convert-to-links-modal.js +1 -1
  436. package/build-module/page-list/convert-to-links-modal.js.map +1 -1
  437. package/build-module/page-list/edit.js +1 -1
  438. package/build-module/page-list/edit.js.map +1 -1
  439. package/build-module/paragraph/edit.js +9 -0
  440. package/build-module/paragraph/edit.js.map +1 -1
  441. package/build-module/paragraph/edit.native.js +6 -2
  442. package/build-module/paragraph/edit.native.js.map +1 -1
  443. package/build-module/paragraph/use-enter.js +81 -0
  444. package/build-module/paragraph/use-enter.js.map +1 -0
  445. package/build-module/post-author/edit.js +2 -2
  446. package/build-module/post-author/edit.js.map +1 -1
  447. package/build-module/post-author-name/index.js +1 -0
  448. package/build-module/post-author-name/index.js.map +1 -1
  449. package/build-module/post-comment/index.js +2 -1
  450. package/build-module/post-comment/index.js.map +1 -1
  451. package/build-module/post-comments/edit.js +13 -35
  452. package/build-module/post-comments/edit.js.map +1 -1
  453. package/build-module/post-comments/index.js +1 -1
  454. package/build-module/post-comments-count/index.js +1 -0
  455. package/build-module/post-comments-count/index.js.map +1 -1
  456. package/build-module/post-comments-form/edit.js +38 -26
  457. package/build-module/post-comments-form/edit.js.map +1 -1
  458. package/build-module/post-comments-form/form.js +39 -0
  459. package/build-module/post-comments-form/form.js.map +1 -0
  460. package/build-module/post-comments-link/index.js +1 -0
  461. package/build-module/post-comments-link/index.js.map +1 -1
  462. package/build-module/post-excerpt/edit.js +1 -1
  463. package/build-module/post-excerpt/edit.js.map +1 -1
  464. package/build-module/post-featured-image/edit.js +1 -1
  465. package/build-module/post-featured-image/edit.js.map +1 -1
  466. package/build-module/post-template/edit.js +7 -2
  467. package/build-module/post-template/edit.js.map +1 -1
  468. package/build-module/post-terms/edit.js +35 -6
  469. package/build-module/post-terms/edit.js.map +1 -1
  470. package/build-module/post-terms/hooks.js +25 -0
  471. package/build-module/post-terms/hooks.js.map +1 -0
  472. package/build-module/post-terms/index.js +18 -8
  473. package/build-module/post-terms/index.js.map +1 -1
  474. package/build-module/post-title/index.js +1 -1
  475. package/build-module/post-title/index.js.map +1 -1
  476. package/build-module/pullquote/edit.js +2 -2
  477. package/build-module/pullquote/edit.js.map +1 -1
  478. package/build-module/pullquote/edit.native.js +2 -2
  479. package/build-module/pullquote/edit.native.js.map +1 -1
  480. package/build-module/query/edit/inspector-controls/index.js +24 -17
  481. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  482. package/build-module/query/edit/inspector-controls/parent-control.js +135 -0
  483. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -0
  484. package/build-module/query/edit/inspector-controls/sticky-control.js +31 -0
  485. package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -0
  486. package/build-module/query/index.js +2 -1
  487. package/build-module/query/index.js.map +1 -1
  488. package/build-module/query/utils.js +21 -0
  489. package/build-module/query/utils.js.map +1 -1
  490. package/build-module/query-title/index.js +1 -1
  491. package/build-module/query-title/index.js.map +1 -1
  492. package/build-module/query-title/variations.js +2 -2
  493. package/build-module/query-title/variations.js.map +1 -1
  494. package/build-module/quote/edit.js +4 -3
  495. package/build-module/quote/edit.js.map +1 -1
  496. package/build-module/quote/index.js +2 -1
  497. package/build-module/quote/index.js.map +1 -1
  498. package/build-module/quote/v2/edit.js +12 -5
  499. package/build-module/quote/v2/edit.js.map +1 -1
  500. package/build-module/rss/edit.js +1 -1
  501. package/build-module/rss/edit.js.map +1 -1
  502. package/build-module/search/edit.js +12 -9
  503. package/build-module/search/edit.js.map +1 -1
  504. package/build-module/separator/index.js +3 -0
  505. package/build-module/separator/index.js.map +1 -1
  506. package/build-module/site-logo/edit.js +1 -1
  507. package/build-module/site-logo/edit.js.map +1 -1
  508. package/build-module/spacer/constants.js +2 -0
  509. package/build-module/spacer/constants.js.map +1 -0
  510. package/build-module/spacer/controls.js +2 -2
  511. package/build-module/spacer/controls.js.map +1 -1
  512. package/build-module/spacer/controls.native.js +1 -1
  513. package/build-module/spacer/controls.native.js.map +1 -1
  514. package/build-module/spacer/edit.js +1 -1
  515. package/build-module/spacer/edit.js.map +1 -1
  516. package/build-module/table/edit.js +26 -7
  517. package/build-module/table/edit.js.map +1 -1
  518. package/build-module/table-of-contents/edit.js +136 -68
  519. package/build-module/table-of-contents/edit.js.map +1 -1
  520. package/build-module/table-of-contents/index.js +12 -3
  521. package/build-module/table-of-contents/index.js.map +1 -1
  522. package/build-module/table-of-contents/list.js +18 -10
  523. package/build-module/table-of-contents/list.js.map +1 -1
  524. package/build-module/table-of-contents/save.js +28 -0
  525. package/build-module/table-of-contents/save.js.map +1 -0
  526. package/build-module/table-of-contents/utils.js +11 -73
  527. package/build-module/table-of-contents/utils.js.map +1 -1
  528. package/build-module/tag-cloud/edit.js +1 -1
  529. package/build-module/tag-cloud/edit.js.map +1 -1
  530. package/build-module/template-part/edit/index.js +8 -4
  531. package/build-module/template-part/edit/index.js.map +1 -1
  532. package/build-module/template-part/edit/inner-blocks.js +4 -9
  533. package/build-module/template-part/edit/inner-blocks.js.map +1 -1
  534. package/build-module/video/edit.js +6 -10
  535. package/build-module/video/edit.js.map +1 -1
  536. package/build-module/video/edit.native.js +1 -1
  537. package/build-module/video/edit.native.js.map +1 -1
  538. package/build-style/{comments-query-loop → comments}/editor-rtl.css +0 -0
  539. package/build-style/{comments-query-loop → comments}/editor.css +0 -0
  540. package/build-style/common-rtl.css +32 -0
  541. package/build-style/common.css +32 -0
  542. package/build-style/cover/style-rtl.css +0 -4
  543. package/build-style/cover/style.css +0 -4
  544. package/build-style/editor-rtl.css +16 -10
  545. package/build-style/editor.css +16 -10
  546. package/build-style/image/editor-rtl.css +1 -1
  547. package/build-style/image/editor.css +1 -1
  548. package/build-style/navigation/style-rtl.css +3 -0
  549. package/build-style/navigation/style.css +3 -0
  550. package/build-style/separator/editor-rtl.css +1 -0
  551. package/build-style/separator/editor.css +1 -0
  552. package/build-style/style-rtl.css +73 -4
  553. package/build-style/style.css +73 -4
  554. package/build-style/table/editor-rtl.css +8 -0
  555. package/build-style/table/editor.css +8 -0
  556. package/build-style/table/style-rtl.css +38 -0
  557. package/build-style/table/style.css +38 -0
  558. package/build-style/video/editor-rtl.css +2 -5
  559. package/build-style/video/editor.css +2 -5
  560. package/build-types/table-of-contents/list.d.ts +12 -0
  561. package/build-types/table-of-contents/list.d.ts.map +1 -0
  562. package/build-types/table-of-contents/utils.d.ts +24 -0
  563. package/build-types/table-of-contents/utils.d.ts.map +1 -0
  564. package/package.json +30 -29
  565. package/src/archives/edit.js +1 -1
  566. package/src/audio/edit.js +7 -10
  567. package/src/audio/edit.native.js +1 -1
  568. package/src/avatar/block.json +0 -1
  569. package/src/avatar/index.php +2 -2
  570. package/src/block/edit.js +39 -42
  571. package/src/block/test/edit.native.js +1 -1
  572. package/src/button/block.json +1 -0
  573. package/src/button/edit.native.js +6 -3
  574. package/src/categories/block.json +5 -1
  575. package/src/categories/edit.js +9 -3
  576. package/src/categories/index.php +1 -0
  577. package/src/column/block.json +10 -0
  578. package/src/comment-author-avatar/block.json +1 -0
  579. package/src/comment-template/edit.js +1 -5
  580. package/src/{comments-query-loop → comments}/block.json +1 -1
  581. package/src/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
  582. package/src/{comments-query-loop → comments}/edit.js +1 -1
  583. package/src/{comments-query-loop → comments}/editor.scss +0 -0
  584. package/src/{comments-query-loop → comments}/index.js +0 -0
  585. package/src/{comments-query-loop → comments}/save.js +1 -3
  586. package/src/comments-title/index.js +1 -1
  587. package/src/common.scss +24 -1
  588. package/src/cover/controls.native.js +1 -2
  589. package/src/cover/edit/block-controls.js +119 -0
  590. package/src/cover/edit/cover-placeholder.js +39 -0
  591. package/src/cover/edit/index.js +381 -0
  592. package/src/cover/edit/inspector-controls.js +286 -0
  593. package/src/cover/edit/resizable-cover.js +55 -0
  594. package/src/cover/edit/use-cover-is-dark.js +71 -0
  595. package/src/cover/edit.native.js +40 -14
  596. package/src/cover/editor.scss +1 -1
  597. package/src/cover/focal-point-settings-button.native.js +1 -1
  598. package/src/cover/shared.js +4 -0
  599. package/src/cover/style.native.scss +4 -0
  600. package/src/cover/style.scss +0 -4
  601. package/src/cover/test/__snapshots__/edit.native.js.snap +6 -6
  602. package/src/cover/test/block-controls.js +62 -0
  603. package/src/cover/test/transforms.js +301 -0
  604. package/src/cover/transforms.js +112 -7
  605. package/src/cover/use-cover-is-dark.native.js +51 -0
  606. package/src/editor.scss +1 -1
  607. package/src/embed/edit.js +19 -24
  608. package/src/embed/edit.native.js +9 -14
  609. package/src/embed/embed-preview.js +4 -2
  610. package/src/embed/util.js +34 -2
  611. package/src/file/edit.native.js +0 -1
  612. package/src/file/inspector.js +1 -3
  613. package/src/gallery/edit.js +3 -2
  614. package/src/gallery/gallery.js +2 -2
  615. package/src/gallery/shared.js +3 -2
  616. package/src/gallery/use-get-media.js +2 -1
  617. package/src/gallery/use-short-code-transform.js +19 -16
  618. package/src/gallery/v1/edit.js +1 -1
  619. package/src/gallery/v1/gallery.js +2 -2
  620. package/src/group/block.json +1 -0
  621. package/src/heading/block.json +1 -0
  622. package/src/heading/edit.js +5 -2
  623. package/src/heading/transforms.js +4 -3
  624. package/src/html/edit.js +2 -2
  625. package/src/image/edit.js +11 -5
  626. package/src/image/edit.native.js +1 -2
  627. package/src/image/editor.scss +1 -1
  628. package/src/image/image.js +9 -3
  629. package/src/image/test/edit.native.js +7 -7
  630. package/src/index.js +52 -30
  631. package/src/index.native.js +12 -2
  632. package/src/is-block-metadata-experimental.js +19 -0
  633. package/src/latest-comments/edit.js +1 -1
  634. package/src/latest-posts/edit.js +27 -2
  635. package/src/latest-posts/edit.native.js +56 -1
  636. package/src/list/transforms.js +7 -0
  637. package/src/list/v2/edit.js +1 -0
  638. package/src/list/v2/migrate.js +1 -1
  639. package/src/list/v2/transforms.js +35 -0
  640. package/src/list-item/block.json +2 -1
  641. package/src/list-item/edit.js +17 -10
  642. package/src/list-item/hooks/index.js +3 -0
  643. package/src/list-item/hooks/use-backspace.js +52 -0
  644. package/src/list-item/hooks/use-enter.js +9 -16
  645. package/src/list-item/hooks/use-indent-list-item.js +50 -63
  646. package/src/list-item/hooks/use-space.js +48 -0
  647. package/src/list-item/hooks/use-split.js +24 -0
  648. package/src/list-item/utils.js +1 -1
  649. package/src/loginout/edit.js +1 -1
  650. package/src/media-text/edit.js +1 -2
  651. package/src/media-text/edit.native.js +4 -2
  652. package/src/media-text/media-container.native.js +2 -4
  653. package/src/media-text/transforms.js +154 -0
  654. package/src/navigation/block.json +1 -1
  655. package/src/navigation/edit/index.js +175 -169
  656. package/src/navigation/edit/inner-blocks.js +1 -8
  657. package/src/navigation/edit/unsaved-inner-blocks.js +5 -4
  658. package/src/navigation/index.php +5 -0
  659. package/src/navigation/style.scss +3 -0
  660. package/src/navigation/use-navigation-entities.js +1 -1
  661. package/src/navigation/view-modal.js +68 -0
  662. package/src/navigation/view.js +0 -35
  663. package/src/navigation-link/edit.js +1 -1
  664. package/src/navigation-link/fallback-variations.js +1 -1
  665. package/src/navigation-link/hooks.js +2 -2
  666. package/src/navigation-link/test/__snapshots__/hooks.js.snap +4 -4
  667. package/src/page-list/convert-to-links-modal.js +1 -1
  668. package/src/page-list/edit.js +1 -4
  669. package/src/paragraph/edit.js +6 -0
  670. package/src/paragraph/edit.native.js +13 -1
  671. package/src/paragraph/use-enter.js +103 -0
  672. package/src/post-author/edit.js +25 -23
  673. package/src/post-author-name/block.json +1 -0
  674. package/src/post-comment/block.json +2 -1
  675. package/src/post-comments/block.json +1 -1
  676. package/src/post-comments/edit.js +13 -43
  677. package/src/post-comments/index.php +2 -0
  678. package/src/post-comments-count/block.json +1 -0
  679. package/src/post-comments-form/edit.js +50 -58
  680. package/src/post-comments-form/form.js +40 -0
  681. package/src/post-comments-link/block.json +1 -0
  682. package/src/post-excerpt/edit.js +1 -1
  683. package/src/post-featured-image/edit.js +1 -1
  684. package/src/post-template/edit.js +5 -0
  685. package/src/post-terms/block.json +8 -0
  686. package/src/post-terms/edit.js +47 -1
  687. package/src/post-terms/hooks.js +27 -0
  688. package/src/post-terms/index.js +14 -7
  689. package/src/post-terms/index.php +50 -2
  690. package/src/post-title/index.js +1 -1
  691. package/src/pullquote/edit.js +2 -2
  692. package/src/pullquote/edit.native.js +2 -2
  693. package/src/query/block.json +2 -1
  694. package/src/query/edit/inspector-controls/index.js +25 -11
  695. package/src/query/edit/inspector-controls/parent-control.js +133 -0
  696. package/src/query/edit/inspector-controls/sticky-control.js +25 -0
  697. package/src/query/utils.js +22 -0
  698. package/src/query-title/index.js +1 -1
  699. package/src/query-title/variations.js +2 -2
  700. package/src/quote/block.json +1 -0
  701. package/src/quote/edit.js +5 -2
  702. package/src/quote/index.js +1 -1
  703. package/src/quote/v2/edit.js +7 -2
  704. package/src/rss/edit.js +1 -1
  705. package/src/search/edit.js +14 -7
  706. package/src/search/index.php +85 -34
  707. package/src/separator/block.json +3 -0
  708. package/src/separator/editor.scss +1 -0
  709. package/src/site-logo/edit.js +1 -1
  710. package/src/spacer/constants.js +1 -0
  711. package/src/spacer/controls.js +2 -2
  712. package/src/spacer/controls.native.js +1 -1
  713. package/src/spacer/edit.js +1 -2
  714. package/src/table/edit.js +30 -6
  715. package/src/table/editor.scss +13 -0
  716. package/src/table/style.scss +52 -0
  717. package/src/table-of-contents/block.json +9 -2
  718. package/src/table-of-contents/edit.js +155 -75
  719. package/src/table-of-contents/index.js +2 -0
  720. package/src/table-of-contents/list.tsx +46 -0
  721. package/src/table-of-contents/save.js +25 -0
  722. package/src/table-of-contents/utils.ts +71 -0
  723. package/src/tag-cloud/block.json +1 -1
  724. package/src/tag-cloud/edit.js +1 -1
  725. package/src/template-part/edit/index.js +25 -15
  726. package/src/template-part/edit/inner-blocks.js +2 -10
  727. package/src/video/edit.js +8 -7
  728. package/src/video/edit.native.js +1 -1
  729. package/src/video/editor.scss +3 -6
  730. package/test/babel-plugin.js +67 -0
  731. package/tsconfig.json +11 -0
  732. package/tsconfig.tsbuildinfo +1 -0
  733. package/build/comments-query-loop/edit/comments-inspector-controls.js.map +0 -1
  734. package/build/comments-query-loop/edit.js.map +0 -1
  735. package/build/comments-query-loop/index.js.map +0 -1
  736. package/build/comments-query-loop/save.js.map +0 -1
  737. package/build/cover/edit.js +0 -668
  738. package/build/cover/edit.js.map +0 -1
  739. package/build/post-terms/variations.js +0 -37
  740. package/build/post-terms/variations.js.map +0 -1
  741. package/build-module/comments-query-loop/edit.js.map +0 -1
  742. package/build-module/comments-query-loop/index.js.map +0 -1
  743. package/build-module/comments-query-loop/save.js.map +0 -1
  744. package/build-module/cover/edit.js +0 -645
  745. package/build-module/cover/edit.js.map +0 -1
  746. package/build-module/post-terms/variations.js +0 -27
  747. package/build-module/post-terms/variations.js.map +0 -1
  748. package/src/cover/edit.js +0 -827
  749. package/src/post-terms/variations.js +0 -28
  750. package/src/table-of-contents/index.php +0 -346
  751. package/src/table-of-contents/list.js +0 -28
  752. package/src/table-of-contents/utils.js +0 -126
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/cover/edit.native.js"],"names":["INNER_BLOCKS_TEMPLATE","align","placeholder","Cover","attributes","getStylesFromColorScheme","isParentSelected","onFocus","setAttributes","openGeneralSidebar","closeSettingsBottomSheet","isSelected","selectBlock","blockWidth","hasInnerBlocks","backgroundType","dimRatio","focalPoint","minHeight","url","id","style","customOverlayColor","minHeightUnit","allowedBlocks","templateLock","customGradient","gradient","overlayColor","isScreenReaderEnabled","setIsScreenReaderEnabled","isCurrent","a11yInfoChangeSubscription","AccessibilityInfo","addEventListener","then","remove","convertedMinHeight","COVER_DEFAULT_HEIGHT","isImage","MEDIA_TYPE_IMAGE","THEME_COLORS_COUNT","colorsDefault","coverDefaultPalette","colors","slice","gradients","gradientValue","overlayColorValue","hasBackground","color","background","hasOnlyColorBackground","isCustomColorPickerShowing","setCustomColorPickerShowing","openMediaOptionsRef","overlay","childrenStyles","styles","defaultColor","isUploadInProgress","setIsUploadInProgress","didUploadFail","setDidUploadFail","shouldShowFailure","onSelectMedia","media","onSelect","onMediaPressed","isVideoLoading","setIsVideoLoading","onVideoLoadStart","onVideoLoad","onClearMedia","undefined","hasParallax","setColor","colorValue","slug","openColorPicker","backgroundColor","backgroundSolid","backgroundSolidDark","overlayStyles","opacity","overlaySelected","placeholderIconStyle","icon","iconDark","placeholderIcon","toolbarControls","open","replace","accessibilityHint","Platform","OS","addMediaButton","current","selectImageContainer","selectImage","image","selectImageIcon","onBottomSheetClosed","InteractionManager","runAfterInteractions","colorPickerControls","shouldEnableBottomSheetScroll","shouldEnableBottomSheetMaxHeight","onHandleClosingBottomSheet","onHandleHardwareButtonPress","isBottomSheetContentScrolling","renderContent","getMediaOptions","renderBackground","VIDEO_BACKGROUND_TYPE","mediaServerId","mediaUrl","IMAGE_BACKGROUND_TYPE","imageContainer","IMAGE_DEFAULT_FOCAL_POINT","width","uri","mediaPlaceholderEmptyStateContainer","height","title","ALLOWED_MEDIA_TYPES","colorPaletteWrapper","paletteColorIndicator","paletteCustomIndicatorWrapper","backgroundContainer","content","overlayContainer","imageEditButton","destructiveButton","label","onPress","separated","value","uploadFailedContainer","uploadFailed","warning","uploadFailedIcon","select","clientId","getSelectedBlockClientId","getBlock","blockEditorStore","selectedBlockClientId","getSettings","innerBlocks","length","settings","dispatch","editPostStore","closeGeneralSidebar","withPreferredColorScheme"],"mappings":";;;;;;;;;AAkDA;;;;AA/CA;;AAOA;;AAKA;;AAMA;;AACA;;AAaA;;AAaA;;AACA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AAOA;;AAxEA;AACA;AACA;;AAUA;AACA;AACA;;AA+CA;AACA;AACA;;AAWA;AACA;AACA;AACA,MAAMA,qBAAqB,GAAG,CAC7B,CACC,gBADD,EAEC;AACCC,EAAAA,KAAK,EAAE,QADR;AAECC,EAAAA,WAAW,EAAE,cAAI,cAAJ;AAFd,CAFD,CAD6B,CAA9B;;AAUA,MAAMC,KAAK,GAAG,QAYP;AAAA;;AAAA,MAZS;AACfC,IAAAA,UADe;AAEfC,IAAAA,wBAFe;AAGfC,IAAAA,gBAHe;AAIfC,IAAAA,OAJe;AAKfC,IAAAA,aALe;AAMfC,IAAAA,kBANe;AAOfC,IAAAA,wBAPe;AAQfC,IAAAA,UARe;AASfC,IAAAA,WATe;AAUfC,IAAAA,UAVe;AAWfC,IAAAA;AAXe,GAYT;AACN,QAAM;AACLC,IAAAA,cADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,UAHK;AAILC,IAAAA,SAJK;AAKLC,IAAAA,GALK;AAMLC,IAAAA,EANK;AAOLC,IAAAA,KAPK;AAQLC,IAAAA,kBARK;AASLC,IAAAA,aAAa,GAAG,IATX;AAULC,IAAAA,aAVK;AAWLC,IAAAA,YAXK;AAYLC,IAAAA,cAZK;AAaLC,IAAAA,QAbK;AAcLC,IAAAA;AAdK,MAeFxB,UAfJ;AAgBA,QAAM,CAAEyB,qBAAF,EAAyBC,wBAAzB,IAAsD,uBAC3D,KAD2D,CAA5D;AAIA,0BAAW,MAAM;AAChB,QAAIC,SAAS,GAAG,IAAhB,CADgB,CAGhB;;AACA;;AACA,UAAMC,0BAA0B,GAAGC,+BAAk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,IAAAA,WAAW,EAAE,MAAMA,WAAW,CAAEmI,QAAF;AALxB,GAAP;AAOA,CAXD,CAlBuB,EA8BvBY,iCA9BuB,CAAT,EA+BVxJ,KA/BU,C","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tView,\n\tTouchableWithoutFeedback,\n\tInteractionManager,\n\tAccessibilityInfo,\n\tPlatform,\n} from 'react-native';\nimport Video from 'react-native-video';\n\n/**\n * WordPress dependencies\n */\nimport {\n\trequestImageFailedRetryDialog,\n\trequestImageUploadCancelDialog,\n\trequestImageFullscreenPreview,\n\tmediaUploadSync,\n} from '@wordpress/react-native-bridge';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tIcon,\n\tImage,\n\tImageEditingButton,\n\tIMAGE_DEFAULT_FOCAL_POINT,\n\tToolbarButton,\n\tGradient,\n\tColorPalette,\n\tColorPicker,\n\tBottomSheetConsumer,\n\tuseConvertUnitToMobile,\n\tuseMobileGlobalStylesColors,\n} from '@wordpress/components';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tInspectorControls,\n\tMEDIA_TYPE_IMAGE,\n\tMediaPlaceholder,\n\tMediaUpload,\n\tMediaUploadProgress,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tgetGradientValueBySlug,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport {\n\tuseEffect,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\nimport { cover as icon, replace, image, warning } from '@wordpress/icons';\nimport { getProtocol } from '@wordpress/url';\nimport { store as editPostStore } from '@wordpress/edit-post';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport {\n\tattributesFromMedia,\n\tALLOWED_MEDIA_TYPES,\n\tIMAGE_BACKGROUND_TYPE,\n\tVIDEO_BACKGROUND_TYPE,\n\tCOVER_DEFAULT_HEIGHT,\n} from './shared';\nimport Controls from './controls';\n\n/**\n * Constants\n */\nconst INNER_BLOCKS_TEMPLATE = [\n\t[\n\t\t'core/paragraph',\n\t\t{\n\t\t\talign: 'center',\n\t\t\tplaceholder: __( 'Write title…' ),\n\t\t},\n\t],\n];\n\nconst Cover = ( {\n\tattributes,\n\tgetStylesFromColorScheme,\n\tisParentSelected,\n\tonFocus,\n\tsetAttributes,\n\topenGeneralSidebar,\n\tcloseSettingsBottomSheet,\n\tisSelected,\n\tselectBlock,\n\tblockWidth,\n\thasInnerBlocks,\n} ) => {\n\tconst {\n\t\tbackgroundType,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\tminHeight,\n\t\turl,\n\t\tid,\n\t\tstyle,\n\t\tcustomOverlayColor,\n\t\tminHeightUnit = 'px',\n\t\tallowedBlocks,\n\t\ttemplateLock,\n\t\tcustomGradient,\n\t\tgradient,\n\t\toverlayColor,\n\t} = attributes;\n\tconst [ isScreenReaderEnabled, setIsScreenReaderEnabled ] = useState(\n\t\tfalse\n\t);\n\n\tuseEffect( () => {\n\t\tlet isCurrent = true;\n\n\t\t// Sync with local media store.\n\t\tmediaUploadSync();\n\t\tconst a11yInfoChangeSubscription = AccessibilityInfo.addEventListener(\n\t\t\t'screenReaderChanged',\n\t\t\tsetIsScreenReaderEnabled\n\t\t);\n\n\t\tAccessibilityInfo.isScreenReaderEnabled().then( () => {\n\t\t\tif ( isCurrent ) {\n\t\t\t\tsetIsScreenReaderEnabled();\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tisCurrent = false;\n\t\t\ta11yInfoChangeSubscription.remove();\n\t\t};\n\t}, [] );\n\n\tconst convertedMinHeight = useConvertUnitToMobile(\n\t\tminHeight || COVER_DEFAULT_HEIGHT,\n\t\tminHeightUnit\n\t);\n\n\tconst isImage = backgroundType === MEDIA_TYPE_IMAGE;\n\n\tconst THEME_COLORS_COUNT = 4;\n\tconst colorsDefault = useMobileGlobalStylesColors();\n\tconst coverDefaultPalette = useMemo( () => {\n\t\treturn {\n\t\t\tcolors: colorsDefault.slice( 0, THEME_COLORS_COUNT ),\n\t\t};\n\t}, [ colorsDefault ] );\n\tconst gradients = useMobileGlobalStylesColors( 'gradients' );\n\tconst gradientValue =\n\t\tcustomGradient || getGradientValueBySlug( gradients, gradient );\n\tconst overlayColorValue = getColorObjectByAttributeValues(\n\t\tcolorsDefault,\n\t\toverlayColor\n\t);\n\n\tconst hasBackground = !! (\n\t\turl ||\n\t\t( style && style.color && style.color.background ) ||\n\t\tattributes.overlayColor ||\n\t\toverlayColorValue.color ||\n\t\tcustomOverlayColor ||\n\t\tgradientValue\n\t);\n\n\tconst hasOnlyColorBackground = ! url && ( hasBackground || hasInnerBlocks );\n\n\tconst [\n\t\tisCustomColorPickerShowing,\n\t\tsetCustomColorPickerShowing,\n\t] = useState( false );\n\n\tconst openMediaOptionsRef = useRef();\n\n\t// Used to set a default color for its InnerBlocks\n\t// since there's no system to inherit styles yet\n\t// the RichText component will check if there are\n\t// parent styles for the current block. If there are,\n\t// it will use that color instead.\n\tuseEffect( () => {\n\t\t// While we don't support theme colors.\n\t\tif ( ! attributes.overlayColor || ( ! attributes.overlay && url ) ) {\n\t\t\tsetAttributes( { childrenStyles: styles.defaultColor } );\n\t\t}\n\t}, [ setAttributes ] );\n\n\t// Initialize uploading flag to false, awaiting sync.\n\tconst [ isUploadInProgress, setIsUploadInProgress ] = useState( false );\n\n\t// Initialize upload failure flag to true if url is local.\n\tconst [ didUploadFail, setDidUploadFail ] = useState(\n\t\tid && getProtocol( url ) === 'file:'\n\t);\n\n\t// Don't show failure if upload is in progress.\n\tconst shouldShowFailure = didUploadFail && ! isUploadInProgress;\n\n\tconst onSelectMedia = ( media ) => {\n\t\tsetDidUploadFail( false );\n\t\tconst onSelect = attributesFromMedia( setAttributes, dimRatio );\n\t\tonSelect( media );\n\t};\n\n\tconst onMediaPressed = () => {\n\t\tif ( isUploadInProgress ) {\n\t\t\trequestImageUploadCancelDialog( id );\n\t\t} else if ( shouldShowFailure ) {\n\t\t\trequestImageFailedRetryDialog( id );\n\t\t} else if ( isImage && url ) {\n\t\t\trequestImageFullscreenPreview( url );\n\t\t}\n\t};\n\n\tconst [ isVideoLoading, setIsVideoLoading ] = useState( true );\n\n\tconst onVideoLoadStart = () => {\n\t\tsetIsVideoLoading( true );\n\t};\n\n\tconst onVideoLoad = () => {\n\t\tsetIsVideoLoading( false );\n\t};\n\n\tconst onClearMedia = useCallback( () => {\n\t\tsetAttributes( {\n\t\t\tfocalPoint: undefined,\n\t\t\thasParallax: undefined,\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t} );\n\t\tcloseSettingsBottomSheet();\n\t}, [ closeSettingsBottomSheet ] );\n\n\tfunction setColor( color ) {\n\t\tconst colorValue = getColorObjectByColorValue( colorsDefault, color );\n\n\t\tsetAttributes( {\n\t\t\t// Clear all related attributes (only one should be set).\n\t\t\toverlayColor: colorValue?.slug ?? undefined,\n\t\t\tcustomOverlayColor: ( ! colorValue?.slug && color ) ?? undefined,\n\t\t\tgradient: undefined,\n\t\t\tcustomGradient: undefined,\n\t\t} );\n\t}\n\n\tfunction openColorPicker() {\n\t\tselectBlock();\n\t\tsetCustomColorPickerShowing( true );\n\t\topenGeneralSidebar();\n\t}\n\n\tconst backgroundColor = getStylesFromColorScheme(\n\t\tstyles.backgroundSolid,\n\t\tstyles.backgroundSolidDark\n\t);\n\n\tconst overlayStyles = [\n\t\tstyles.overlay,\n\t\turl && { opacity: dimRatio / 100 },\n\t\t! gradientValue && {\n\t\t\tbackgroundColor:\n\t\t\t\tcustomOverlayColor ||\n\t\t\t\toverlayColorValue?.color ||\n\t\t\t\tstyle?.color?.background ||\n\t\t\t\tstyles.overlay?.color,\n\t\t},\n\t\t// While we don't support theme colors we add a default bg color.\n\t\t! overlayColorValue.color && ! url ? backgroundColor : {},\n\t\tisImage &&\n\t\t\tisParentSelected &&\n\t\t\t! isUploadInProgress &&\n\t\t\t! didUploadFail &&\n\t\t\tstyles.overlaySelected,\n\t];\n\n\tconst placeholderIconStyle = getStylesFromColorScheme(\n\t\tstyles.icon,\n\t\tstyles.iconDark\n\t);\n\n\tconst placeholderIcon = <Icon icon={ icon } { ...placeholderIconStyle } />;\n\n\tconst toolbarControls = ( open ) => (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarButton\n\t\t\t\ttitle={ __( 'Edit cover media' ) }\n\t\t\t\ticon={ replace }\n\t\t\t\tonClick={ open }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n\n\tconst accessibilityHint =\n\t\tPlatform.OS === 'ios'\n\t\t\t? __( 'Double tap to open Action Sheet to add image or video' )\n\t\t\t: __( 'Double tap to open Bottom Sheet to add image or video' );\n\n\tconst addMediaButton = () => (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\taccessibilityLabel={ __( 'Add image or video' ) }\n\t\t\taccessibilityRole=\"button\"\n\t\t\tonPress={ openMediaOptionsRef.current }\n\t\t>\n\t\t\t<View style={ styles.selectImageContainer }>\n\t\t\t\t<View style={ styles.selectImage }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tsize={ 16 }\n\t\t\t\t\t\ticon={ image }\n\t\t\t\t\t\t{ ...styles.selectImageIcon }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n\n\tconst onBottomSheetClosed = useCallback( () => {\n\t\tInteractionManager.runAfterInteractions( () => {\n\t\t\tsetCustomColorPickerShowing( false );\n\t\t} );\n\t}, [] );\n\n\tconst colorPickerControls = (\n\t\t<InspectorControls>\n\t\t\t<BottomSheetConsumer>\n\t\t\t\t{ ( {\n\t\t\t\t\tshouldEnableBottomSheetScroll,\n\t\t\t\t\tshouldEnableBottomSheetMaxHeight,\n\t\t\t\t\tonHandleClosingBottomSheet,\n\t\t\t\t\tonHandleHardwareButtonPress,\n\t\t\t\t\tisBottomSheetContentScrolling,\n\t\t\t\t} ) => (\n\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\tshouldEnableBottomSheetScroll={\n\t\t\t\t\t\t\tshouldEnableBottomSheetScroll\n\t\t\t\t\t\t}\n\t\t\t\t\t\tshouldEnableBottomSheetMaxHeight={\n\t\t\t\t\t\t\tshouldEnableBottomSheetMaxHeight\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetColor={ setColor }\n\t\t\t\t\t\tonNavigationBack={ closeSettingsBottomSheet }\n\t\t\t\t\t\tonHandleClosingBottomSheet={\n\t\t\t\t\t\t\tonHandleClosingBottomSheet\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonHandleHardwareButtonPress={\n\t\t\t\t\t\t\tonHandleHardwareButtonPress\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonBottomSheetClosed={ onBottomSheetClosed }\n\t\t\t\t\t\tisBottomSheetContentScrolling={\n\t\t\t\t\t\t\tisBottomSheetContentScrolling\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbottomLabelText={ __( 'Select a color' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BottomSheetConsumer>\n\t\t</InspectorControls>\n\t);\n\n\tconst renderContent = ( getMediaOptions ) => (\n\t\t<>\n\t\t\t{ renderBackground( getMediaOptions ) }\n\t\t\t{ isParentSelected && hasOnlyColorBackground && addMediaButton() }\n\t\t</>\n\t);\n\n\tconst renderBackground = ( getMediaOptions ) => (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessible={ ! isParentSelected }\n\t\t\tonPress={ onMediaPressed }\n\t\t\tonLongPress={ openMediaOptionsRef.current }\n\t\t\tdisabled={ ! isParentSelected }\n\t\t>\n\t\t\t<View style={ [ styles.background, backgroundColor ] }>\n\t\t\t\t{ getMediaOptions() }\n\t\t\t\t{ isParentSelected &&\n\t\t\t\t\tbackgroundType === VIDEO_BACKGROUND_TYPE &&\n\t\t\t\t\ttoolbarControls( openMediaOptionsRef.current ) }\n\t\t\t\t<MediaUploadProgress\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tonUpdateMediaProgress={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonFinishMediaUploadWithSuccess={ ( {\n\t\t\t\t\t\tmediaServerId,\n\t\t\t\t\t\tmediaUrl,\n\t\t\t\t\t} ) => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( false );\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tid: mediaServerId,\n\t\t\t\t\t\t\turl: mediaUrl,\n\t\t\t\t\t\t\tbackgroundType,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tonFinishMediaUploadWithFailure={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonMediaUploadStateReset={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( false );\n\t\t\t\t\t\tsetAttributes( { id: undefined, url: undefined } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\n\t\t\t\t{ IMAGE_BACKGROUND_TYPE === backgroundType && (\n\t\t\t\t\t<View style={ styles.imageContainer }>\n\t\t\t\t\t\t<Image\n\t\t\t\t\t\t\teditButton={ false }\n\t\t\t\t\t\t\tfocalPoint={\n\t\t\t\t\t\t\t\tfocalPoint || IMAGE_DEFAULT_FOCAL_POINT\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisSelected={ isParentSelected }\n\t\t\t\t\t\t\tisUploadFailed={ didUploadFail }\n\t\t\t\t\t\t\tisUploadInProgress={ isUploadInProgress }\n\t\t\t\t\t\t\tonSelectMediaUploadOption={ onSelectMedia }\n\t\t\t\t\t\t\topenMediaOptions={ openMediaOptionsRef.current }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\twidth={ styles.image?.width }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\n\t\t\t\t{ VIDEO_BACKGROUND_TYPE === backgroundType && (\n\t\t\t\t\t<Video\n\t\t\t\t\t\tmuted\n\t\t\t\t\t\tdisableFocus\n\t\t\t\t\t\trepeat\n\t\t\t\t\t\tresizeMode={ 'cover' }\n\t\t\t\t\t\tsource={ { uri: url } }\n\t\t\t\t\t\tonLoad={ onVideoLoad }\n\t\t\t\t\t\tonLoadStart={ onVideoLoadStart }\n\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\tstyles.background,\n\t\t\t\t\t\t\t// Hide Video component since it has black background while loading the source.\n\t\t\t\t\t\t\t{ opacity: isVideoLoading ? 0 : 1 },\n\t\t\t\t\t\t] }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n\n\tif (\n\t\t( ! hasBackground && ! hasInnerBlocks ) ||\n\t\tisCustomColorPickerShowing\n\t) {\n\t\treturn (\n\t\t\t<View>\n\t\t\t\t{ isCustomColorPickerShowing && colorPickerControls }\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\theight={\n\t\t\t\t\t\tstyles.mediaPlaceholderEmptyStateContainer?.height\n\t\t\t\t\t}\n\t\t\t\t\tbackgroundColor={ customOverlayColor }\n\t\t\t\t\thideContent={\n\t\t\t\t\t\tcustomOverlayColor !== '' &&\n\t\t\t\t\t\tcustomOverlayColor !== undefined\n\t\t\t\t\t}\n\t\t\t\t\ticon={ placeholderIcon }\n\t\t\t\t\tlabels={ {\n\t\t\t\t\t\ttitle: __( 'Cover' ),\n\t\t\t\t\t} }\n\t\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t>\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ styles.colorPaletteWrapper }\n\t\t\t\t\t\tpointerEvents={\n\t\t\t\t\t\t\tisScreenReaderEnabled ? 'none' : 'auto'\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<BottomSheetConsumer>\n\t\t\t\t\t\t\t{ ( { shouldEnableBottomSheetScroll } ) => (\n\t\t\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles={\n\t\t\t\t\t\t\t\t\t\tstyles.paletteColorIndicator\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcustomIndicatorWrapperStyles={\n\t\t\t\t\t\t\t\t\t\tstyles.paletteCustomIndicatorWrapper\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsetColor={ setColor }\n\t\t\t\t\t\t\t\t\tonCustomPress={ openColorPicker }\n\t\t\t\t\t\t\t\t\tdefaultSettings={ coverDefaultPalette }\n\t\t\t\t\t\t\t\t\tshouldShowCustomLabel={ false }\n\t\t\t\t\t\t\t\t\tshouldShowCustomVerticalSeparator={ false }\n\t\t\t\t\t\t\t\t\tshouldEnableBottomSheetScroll={\n\t\t\t\t\t\t\t\t\t\tshouldEnableBottomSheetScroll\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</BottomSheetConsumer>\n\t\t\t\t\t</View>\n\t\t\t\t</MediaPlaceholder>\n\t\t\t</View>\n\t\t);\n\t}\n\n\treturn (\n\t\t<View style={ styles.backgroundContainer }>\n\t\t\t{ isSelected && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<Controls\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\tdidUploadFail={ didUploadFail }\n\t\t\t\t\t\thasOnlyColorBackground={ hasOnlyColorBackground }\n\t\t\t\t\t\tisUploadInProgress={ isUploadInProgress }\n\t\t\t\t\t\tonClearMedia={ onClearMedia }\n\t\t\t\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\n\t\t\t<View\n\t\t\t\tpointerEvents=\"box-none\"\n\t\t\t\tstyle={ [ styles.content, { minHeight: convertedMinHeight } ] }\n\t\t\t>\n\t\t\t\t<InnerBlocks\n\t\t\t\t\tallowedBlocks={ allowedBlocks }\n\t\t\t\t\ttemplate={ INNER_BLOCKS_TEMPLATE }\n\t\t\t\t\ttemplateLock={ templateLock }\n\t\t\t\t\ttemplateInsertUpdatesSelection\n\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t/>\n\t\t\t</View>\n\n\t\t\t<View pointerEvents=\"none\" style={ styles.overlayContainer }>\n\t\t\t\t<View style={ overlayStyles }>\n\t\t\t\t\t{ gradientValue && (\n\t\t\t\t\t\t<Gradient\n\t\t\t\t\t\t\tgradientValue={ gradientValue }\n\t\t\t\t\t\t\tstyle={ styles.background }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</View>\n\t\t\t</View>\n\n\t\t\t<MediaUpload\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tisReplacingMedia={ ! hasOnlyColorBackground }\n\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\trender={ ( { open, getMediaOptions } ) => {\n\t\t\t\t\topenMediaOptionsRef.current = open;\n\t\t\t\t\treturn renderContent( getMediaOptions );\n\t\t\t\t} }\n\t\t\t/>\n\n\t\t\t{ isImage &&\n\t\t\t\turl &&\n\t\t\t\topenMediaOptionsRef.current &&\n\t\t\t\tisParentSelected &&\n\t\t\t\t! isUploadInProgress &&\n\t\t\t\t! didUploadFail && (\n\t\t\t\t\t<View style={ styles.imageEditButton }>\n\t\t\t\t\t\t<ImageEditingButton\n\t\t\t\t\t\t\tonSelectMediaUploadOption={ onSelectMedia }\n\t\t\t\t\t\t\topenMediaOptions={ openMediaOptionsRef.current }\n\t\t\t\t\t\t\tpickerOptions={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tdestructiveButton: true,\n\t\t\t\t\t\t\t\t\tid: 'clearMedia',\n\t\t\t\t\t\t\t\t\tlabel: __( 'Clear Media' ),\n\t\t\t\t\t\t\t\t\tonPress: onClearMedia,\n\t\t\t\t\t\t\t\t\tseparated: true,\n\t\t\t\t\t\t\t\t\tvalue: 'clearMedia',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\n\t\t\t{ shouldShowFailure && (\n\t\t\t\t<View\n\t\t\t\t\tpointerEvents=\"none\"\n\t\t\t\t\tstyle={ styles.uploadFailedContainer }\n\t\t\t\t>\n\t\t\t\t\t<View style={ styles.uploadFailed }>\n\t\t\t\t\t\t<Icon icon={ warning } { ...styles.uploadFailedIcon } />\n\t\t\t\t\t</View>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t</View>\n\t);\n};\n\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst { getSelectedBlockClientId, getBlock } = select(\n\t\t\tblockEditorStore\n\t\t);\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\n\t\tconst { getSettings } = select( blockEditorStore );\n\n\t\tconst hasInnerBlocks = getBlock( clientId )?.innerBlocks.length > 0;\n\n\t\treturn {\n\t\t\tsettings: getSettings(),\n\t\t\tisParentSelected: selectedBlockClientId === clientId,\n\t\t\thasInnerBlocks,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { clientId } ) => {\n\t\tconst { openGeneralSidebar } = dispatch( editPostStore );\n\t\tconst { selectBlock } = dispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\topenGeneralSidebar: () => openGeneralSidebar( 'edit-post/block' ),\n\t\t\tcloseSettingsBottomSheet() {\n\t\t\t\tdispatch( editPostStore ).closeGeneralSidebar();\n\t\t\t},\n\t\t\tselectBlock: () => selectBlock( clientId ),\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( Cover );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/cover/edit.native.js"],"names":["INNER_BLOCKS_TEMPLATE","align","placeholder","Cover","attributes","getStylesFromColorScheme","isParentSelected","onFocus","setAttributes","openGeneralSidebar","closeSettingsBottomSheet","isSelected","selectBlock","blockWidth","hasInnerBlocks","backgroundType","dimRatio","focalPoint","minHeight","url","id","style","customOverlayColor","minHeightUnit","allowedBlocks","templateLock","customGradient","gradient","overlayColor","isDark","isScreenReaderEnabled","setIsScreenReaderEnabled","isCurrent","a11yInfoChangeSubscription","AccessibilityInfo","addEventListener","then","remove","convertedMinHeight","COVER_DEFAULT_HEIGHT","isImage","MEDIA_TYPE_IMAGE","THEME_COLORS_COUNT","colorsDefault","coverDefaultPalette","colors","slice","gradients","gradientValue","overlayColorValue","hasBackground","color","background","hasOnlyColorBackground","isCustomColorPickerShowing","setCustomColorPickerShowing","openMediaOptionsRef","isUploadInProgress","setIsUploadInProgress","didUploadFail","setDidUploadFail","shouldShowFailure","onSelectMedia","media","onSelect","onMediaPressed","isVideoLoading","setIsVideoLoading","onVideoLoadStart","onVideoLoad","onClearMedia","undefined","hasParallax","setColor","colorValue","slug","openColorPicker","__unstableMarkNextChangeAsNotPersistent","blockEditorStore","isCoverDark","childrenStyles","styles","defaultColor","defaultColorLightMode","className","includes","backgroundColor","backgroundSolid","backgroundSolidDark","overlayStyles","overlay","opacity","overlaySelected","placeholderIconStyle","icon","iconDark","placeholderIcon","toolbarControls","open","replace","accessibilityHint","Platform","OS","addMediaButton","current","selectImageContainer","selectImage","image","selectImageIcon","onBottomSheetClosed","InteractionManager","runAfterInteractions","colorPickerControls","shouldEnableBottomSheetScroll","shouldEnableBottomSheetMaxHeight","onHandleClosingBottomSheet","onHandleHardwareButtonPress","isBottomSheetContentScrolling","renderContent","getMediaOptions","renderBackground","VIDEO_BACKGROUND_TYPE","mediaServerId","mediaUrl","IMAGE_BACKGROUND_TYPE","imageContainer","IMAGE_DEFAULT_FOCAL_POINT","width","uri","mediaPlaceholderEmptyStateContainer","height","title","ALLOWED_MEDIA_TYPES","colorPaletteWrapper","paletteColorIndicator","paletteCustomIndicatorWrapper","backgroundContainer","content","overlayContainer","imageEditButton","destructiveButton","label","onPress","separated","value","uploadFailedContainer","uploadFailed","warning","uploadFailedIcon","select","clientId","getSelectedBlockClientId","getBlock","selectedBlockClientId","getSettings","innerBlocks","length","settings","dispatch","editPostStore","closeGeneralSidebar","withPreferredColorScheme"],"mappings":";;;;;;;;;AAmDA;;;;AAhDA;;AAOA;;AACA;;AAKA;;AAMA;;AACA;;AAaA;;AAaA;;AACA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AAOA;;AACA;;AA1EA;AACA;AACA;;AAWA;AACA;AACA;;AA+CA;AACA;AACA;;AAYA;AACA;AACA;AACA,MAAMA,qBAAqB,GAAG,CAC7B,CACC,gBADD,EAEC;AACCC,EAAAA,KAAK,EAAE,QADR;AAECC,EAAAA,WAAW,EAAE,cAAI,cAAJ;AAFd,CAFD,CAD6B,CAA9B;;AAUA,MAAMC,KAAK,GAAG,QAYP;AAAA;;AAAA,MAZS;AACfC,IAAAA,UADe;AAEfC,IAAAA,wBAFe;AAGfC,IAAAA,gBAHe;AAIfC,IAAAA,OAJe;AAKfC,IAAAA,aALe;AAMfC,IAAAA,kBANe;AAOfC,IAAAA,wBAPe;AAQfC,IAAAA,UARe;AASfC,IAAAA,WATe;AAUfC,IAAAA,UAVe;AAWfC,IAAAA;AAXe,GAYT;AACN,QAAM;AACLC,IAAAA,cADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,UAHK;AAILC,IAAAA,SAJK;AAKLC,IAAAA,GALK;AAMLC,IAAAA,EANK;AAOLC,IAAAA,KAPK;AAQLC,IAAAA,kBARK;AASLC,IAAAA,aAAa,GAAG,IATX;AAULC,IAAAA,aAVK;AAWLC,IAAAA,YAXK;AAYLC,IAAAA,cAZK;AAaLC,IAAAA,QAbK;AAcLC,IAAAA,YAdK;AA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L,MAAM,CAAEvE,kBAAF,CAA9B;AAEA,QAAMhE,cAAc,GAAG,cAAA0I,QAAQ,CAAEF,QAAF,CAAR,wDAAsBK,WAAtB,CAAkCC,MAAlC,IAA2C,CAAlE;AAEA,SAAO;AACNC,IAAAA,QAAQ,EAAEH,WAAW,EADf;AAENpJ,IAAAA,gBAAgB,EAAEmJ,qBAAqB,KAAKH,QAFtC;AAGNxI,IAAAA;AAHM,GAAP;AAKA,CAhBD,CADuB,EAkBvB,wBAAc,CAAEgJ,QAAF,YAA8B;AAAA,MAAlB;AAAER,IAAAA;AAAF,GAAkB;AAC3C,QAAM;AAAE7I,IAAAA;AAAF,MAAyBqJ,QAAQ,CAAEC,eAAF,CAAvC;AACA,QAAM;AAAEnJ,IAAAA;AAAF,MAAkBkJ,QAAQ,CAAEhF,kBAAF,CAAhC;AAEA,SAAO;AACNrE,IAAAA,kBAAkB,EAAE,MAAMA,kBAAkB,CAAE,iBAAF,CADtC;;AAENC,IAAAA,wBAAwB,GAAG;AAC1BoJ,MAAAA,QAAQ,CAAEC,eAAF,CAAR,CAA0BC,mBAA1B;AACA,KAJK;;AAKNpJ,IAAAA,WAAW,EAAE,MAAMA,WAAW,CAAE0I,QAAF;AALxB,GAAP;AAOA,CAXD,CAlBuB,EA8BvBW,iCA9BuB,CAAT,EA+BV9J,KA/BU,C","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tView,\n\tTouchableWithoutFeedback,\n\tInteractionManager,\n\tAccessibilityInfo,\n\tPlatform,\n} from 'react-native';\nimport Video from 'react-native-video';\nimport classnames from 'classnames/dedupe';\n\n/**\n * WordPress dependencies\n */\nimport {\n\trequestImageFailedRetryDialog,\n\trequestImageUploadCancelDialog,\n\trequestImageFullscreenPreview,\n\tmediaUploadSync,\n} from '@wordpress/react-native-bridge';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tIcon,\n\tImage,\n\tImageEditingButton,\n\tIMAGE_DEFAULT_FOCAL_POINT,\n\tToolbarButton,\n\tGradient,\n\tColorPalette,\n\tColorPicker,\n\tBottomSheetConsumer,\n\tuseConvertUnitToMobile,\n\tuseMobileGlobalStylesColors,\n} from '@wordpress/components';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tInspectorControls,\n\tMEDIA_TYPE_IMAGE,\n\tMediaPlaceholder,\n\tMediaUpload,\n\tMediaUploadProgress,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tgetGradientValueBySlug,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport { useDispatch, withSelect, withDispatch } from '@wordpress/data';\nimport {\n\tuseEffect,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\nimport { cover as icon, replace, image, warning } from '@wordpress/icons';\nimport { getProtocol } from '@wordpress/url';\nimport { store as editPostStore } from '@wordpress/edit-post';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport {\n\tattributesFromMedia,\n\tALLOWED_MEDIA_TYPES,\n\tIMAGE_BACKGROUND_TYPE,\n\tVIDEO_BACKGROUND_TYPE,\n\tCOVER_DEFAULT_HEIGHT,\n} from './shared';\nimport Controls from './controls';\nimport useCoverIsDark from './use-cover-is-dark';\n\n/**\n * Constants\n */\nconst INNER_BLOCKS_TEMPLATE = [\n\t[\n\t\t'core/paragraph',\n\t\t{\n\t\t\talign: 'center',\n\t\t\tplaceholder: __( 'Write title…' ),\n\t\t},\n\t],\n];\n\nconst Cover = ( {\n\tattributes,\n\tgetStylesFromColorScheme,\n\tisParentSelected,\n\tonFocus,\n\tsetAttributes,\n\topenGeneralSidebar,\n\tcloseSettingsBottomSheet,\n\tisSelected,\n\tselectBlock,\n\tblockWidth,\n\thasInnerBlocks,\n} ) => {\n\tconst {\n\t\tbackgroundType,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\tminHeight,\n\t\turl,\n\t\tid,\n\t\tstyle,\n\t\tcustomOverlayColor,\n\t\tminHeightUnit = 'px',\n\t\tallowedBlocks,\n\t\ttemplateLock,\n\t\tcustomGradient,\n\t\tgradient,\n\t\toverlayColor,\n\t\tisDark,\n\t} = attributes;\n\tconst [ isScreenReaderEnabled, setIsScreenReaderEnabled ] = useState(\n\t\tfalse\n\t);\n\n\tuseEffect( () => {\n\t\tlet isCurrent = true;\n\n\t\t// Sync with local media store.\n\t\tmediaUploadSync();\n\t\tconst a11yInfoChangeSubscription = AccessibilityInfo.addEventListener(\n\t\t\t'screenReaderChanged',\n\t\t\tsetIsScreenReaderEnabled\n\t\t);\n\n\t\tAccessibilityInfo.isScreenReaderEnabled().then( () => {\n\t\t\tif ( isCurrent ) {\n\t\t\t\tsetIsScreenReaderEnabled();\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tisCurrent = false;\n\t\t\ta11yInfoChangeSubscription.remove();\n\t\t};\n\t}, [] );\n\n\tconst convertedMinHeight = useConvertUnitToMobile(\n\t\tminHeight || COVER_DEFAULT_HEIGHT,\n\t\tminHeightUnit\n\t);\n\n\tconst isImage = backgroundType === MEDIA_TYPE_IMAGE;\n\n\tconst THEME_COLORS_COUNT = 4;\n\tconst colorsDefault = useMobileGlobalStylesColors();\n\tconst coverDefaultPalette = useMemo( () => {\n\t\treturn {\n\t\t\tcolors: colorsDefault.slice( 0, THEME_COLORS_COUNT ),\n\t\t};\n\t}, [ colorsDefault ] );\n\tconst gradients = useMobileGlobalStylesColors( 'gradients' );\n\tconst gradientValue =\n\t\tcustomGradient || getGradientValueBySlug( gradients, gradient );\n\tconst overlayColorValue = getColorObjectByAttributeValues(\n\t\tcolorsDefault,\n\t\toverlayColor\n\t);\n\n\tconst hasBackground = !! (\n\t\turl ||\n\t\t( style && style.color && style.color.background ) ||\n\t\tattributes.overlayColor ||\n\t\toverlayColorValue.color ||\n\t\tcustomOverlayColor ||\n\t\tgradientValue\n\t);\n\n\tconst hasOnlyColorBackground = ! url && ( hasBackground || hasInnerBlocks );\n\n\tconst [\n\t\tisCustomColorPickerShowing,\n\t\tsetCustomColorPickerShowing,\n\t] = useState( false );\n\n\tconst openMediaOptionsRef = useRef();\n\n\t// Initialize uploading flag to false, awaiting sync.\n\tconst [ isUploadInProgress, setIsUploadInProgress ] = useState( false );\n\n\t// Initialize upload failure flag to true if url is local.\n\tconst [ didUploadFail, setDidUploadFail ] = useState(\n\t\tid && getProtocol( url ) === 'file:'\n\t);\n\n\t// Don't show failure if upload is in progress.\n\tconst shouldShowFailure = didUploadFail && ! isUploadInProgress;\n\n\tconst onSelectMedia = ( media ) => {\n\t\tsetDidUploadFail( false );\n\t\tconst onSelect = attributesFromMedia( setAttributes, dimRatio );\n\t\tonSelect( media );\n\t};\n\n\tconst onMediaPressed = () => {\n\t\tif ( isUploadInProgress ) {\n\t\t\trequestImageUploadCancelDialog( id );\n\t\t} else if ( shouldShowFailure ) {\n\t\t\trequestImageFailedRetryDialog( id );\n\t\t} else if ( isImage && url ) {\n\t\t\trequestImageFullscreenPreview( url );\n\t\t}\n\t};\n\n\tconst [ isVideoLoading, setIsVideoLoading ] = useState( true );\n\n\tconst onVideoLoadStart = () => {\n\t\tsetIsVideoLoading( true );\n\t};\n\n\tconst onVideoLoad = () => {\n\t\tsetIsVideoLoading( false );\n\t};\n\n\tconst onClearMedia = useCallback( () => {\n\t\tsetAttributes( {\n\t\t\tfocalPoint: undefined,\n\t\t\thasParallax: undefined,\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t} );\n\t\tcloseSettingsBottomSheet();\n\t}, [ closeSettingsBottomSheet ] );\n\n\tfunction setColor( color ) {\n\t\tconst colorValue = getColorObjectByColorValue( colorsDefault, color );\n\n\t\tsetAttributes( {\n\t\t\t// Clear all related attributes (only one should be set).\n\t\t\toverlayColor: colorValue?.slug ?? undefined,\n\t\t\tcustomOverlayColor: ( ! colorValue?.slug && color ) ?? undefined,\n\t\t\tgradient: undefined,\n\t\t\tcustomGradient: undefined,\n\t\t} );\n\t}\n\n\tfunction openColorPicker() {\n\t\tselectBlock();\n\t\tsetCustomColorPickerShowing( true );\n\t\topenGeneralSidebar();\n\t}\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tconst isCoverDark = useCoverIsDark(\n\t\tisDark,\n\t\turl,\n\t\tdimRatio,\n\t\toverlayColorValue?.color\n\t);\n\n\tuseEffect( () => {\n\t\t// This side-effect should not create an undo level.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t// Used to set a default color for its InnerBlocks\n\t\t// since there's no system to inherit styles yet\n\t\t// the RichText component will check if there are\n\t\t// parent styles for the current block. If there are,\n\t\t// it will use that color instead.\n\t\tsetAttributes( {\n\t\t\tisDark: isCoverDark,\n\t\t\tchildrenStyles: isCoverDark\n\t\t\t\t? styles.defaultColor\n\t\t\t\t: styles.defaultColorLightMode,\n\t\t} );\n\n\t\t// Ensure that \"is-light\" is removed from \"className\" attribute if cover background is dark.\n\t\tif ( isCoverDark && attributes.className?.includes( 'is-light' ) ) {\n\t\t\tconst className = classnames( attributes.className, {\n\t\t\t\t'is-light': false,\n\t\t\t} );\n\t\t\tsetAttributes( {\n\t\t\t\tclassName: className !== '' ? className : undefined,\n\t\t\t} );\n\t\t}\n\t}, [ isCoverDark ] );\n\n\tconst backgroundColor = getStylesFromColorScheme(\n\t\tstyles.backgroundSolid,\n\t\tstyles.backgroundSolidDark\n\t);\n\n\tconst overlayStyles = [\n\t\tstyles.overlay,\n\t\turl && { opacity: dimRatio / 100 },\n\t\t! gradientValue && {\n\t\t\tbackgroundColor:\n\t\t\t\tcustomOverlayColor ||\n\t\t\t\toverlayColorValue?.color ||\n\t\t\t\tstyle?.color?.background ||\n\t\t\t\tstyles.overlay?.color,\n\t\t},\n\t\t// While we don't support theme colors we add a default bg color.\n\t\t! overlayColorValue.color && ! url ? backgroundColor : {},\n\t\tisImage &&\n\t\t\tisParentSelected &&\n\t\t\t! isUploadInProgress &&\n\t\t\t! didUploadFail &&\n\t\t\tstyles.overlaySelected,\n\t];\n\n\tconst placeholderIconStyle = getStylesFromColorScheme(\n\t\tstyles.icon,\n\t\tstyles.iconDark\n\t);\n\n\tconst placeholderIcon = <Icon icon={ icon } { ...placeholderIconStyle } />;\n\n\tconst toolbarControls = ( open ) => (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarButton\n\t\t\t\ttitle={ __( 'Edit cover media' ) }\n\t\t\t\ticon={ replace }\n\t\t\t\tonClick={ open }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n\n\tconst accessibilityHint =\n\t\tPlatform.OS === 'ios'\n\t\t\t? __( 'Double tap to open Action Sheet to add image or video' )\n\t\t\t: __( 'Double tap to open Bottom Sheet to add image or video' );\n\n\tconst addMediaButton = () => (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\taccessibilityLabel={ __( 'Add image or video' ) }\n\t\t\taccessibilityRole=\"button\"\n\t\t\tonPress={ openMediaOptionsRef.current }\n\t\t>\n\t\t\t<View style={ styles.selectImageContainer }>\n\t\t\t\t<View style={ styles.selectImage }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tsize={ 16 }\n\t\t\t\t\t\ticon={ image }\n\t\t\t\t\t\t{ ...styles.selectImageIcon }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n\n\tconst onBottomSheetClosed = useCallback( () => {\n\t\tInteractionManager.runAfterInteractions( () => {\n\t\t\tsetCustomColorPickerShowing( false );\n\t\t} );\n\t}, [] );\n\n\tconst colorPickerControls = (\n\t\t<InspectorControls>\n\t\t\t<BottomSheetConsumer>\n\t\t\t\t{ ( {\n\t\t\t\t\tshouldEnableBottomSheetScroll,\n\t\t\t\t\tshouldEnableBottomSheetMaxHeight,\n\t\t\t\t\tonHandleClosingBottomSheet,\n\t\t\t\t\tonHandleHardwareButtonPress,\n\t\t\t\t\tisBottomSheetContentScrolling,\n\t\t\t\t} ) => (\n\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\tshouldEnableBottomSheetScroll={\n\t\t\t\t\t\t\tshouldEnableBottomSheetScroll\n\t\t\t\t\t\t}\n\t\t\t\t\t\tshouldEnableBottomSheetMaxHeight={\n\t\t\t\t\t\t\tshouldEnableBottomSheetMaxHeight\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetColor={ setColor }\n\t\t\t\t\t\tonNavigationBack={ closeSettingsBottomSheet }\n\t\t\t\t\t\tonHandleClosingBottomSheet={\n\t\t\t\t\t\t\tonHandleClosingBottomSheet\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonHandleHardwareButtonPress={\n\t\t\t\t\t\t\tonHandleHardwareButtonPress\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonBottomSheetClosed={ onBottomSheetClosed }\n\t\t\t\t\t\tisBottomSheetContentScrolling={\n\t\t\t\t\t\t\tisBottomSheetContentScrolling\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbottomLabelText={ __( 'Select a color' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BottomSheetConsumer>\n\t\t</InspectorControls>\n\t);\n\n\tconst renderContent = ( getMediaOptions ) => (\n\t\t<>\n\t\t\t{ renderBackground( getMediaOptions ) }\n\t\t\t{ isParentSelected && hasOnlyColorBackground && addMediaButton() }\n\t\t</>\n\t);\n\n\tconst renderBackground = ( getMediaOptions ) => (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessible={ ! isParentSelected }\n\t\t\tonPress={ onMediaPressed }\n\t\t\tdisabled={ ! isParentSelected }\n\t\t>\n\t\t\t<View style={ [ styles.background, backgroundColor ] }>\n\t\t\t\t{ getMediaOptions() }\n\t\t\t\t{ isParentSelected &&\n\t\t\t\t\tbackgroundType === VIDEO_BACKGROUND_TYPE &&\n\t\t\t\t\ttoolbarControls( openMediaOptionsRef.current ) }\n\t\t\t\t<MediaUploadProgress\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tonUpdateMediaProgress={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonFinishMediaUploadWithSuccess={ ( {\n\t\t\t\t\t\tmediaServerId,\n\t\t\t\t\t\tmediaUrl,\n\t\t\t\t\t} ) => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( false );\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tid: mediaServerId,\n\t\t\t\t\t\t\turl: mediaUrl,\n\t\t\t\t\t\t\tbackgroundType,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tonFinishMediaUploadWithFailure={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonMediaUploadStateReset={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( false );\n\t\t\t\t\t\tsetAttributes( { id: undefined, url: undefined } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\n\t\t\t\t{ IMAGE_BACKGROUND_TYPE === backgroundType && (\n\t\t\t\t\t<View style={ styles.imageContainer }>\n\t\t\t\t\t\t<Image\n\t\t\t\t\t\t\teditButton={ false }\n\t\t\t\t\t\t\tfocalPoint={\n\t\t\t\t\t\t\t\tfocalPoint || IMAGE_DEFAULT_FOCAL_POINT\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisSelected={ isParentSelected }\n\t\t\t\t\t\t\tisUploadFailed={ didUploadFail }\n\t\t\t\t\t\t\tisUploadInProgress={ isUploadInProgress }\n\t\t\t\t\t\t\tonSelectMediaUploadOption={ onSelectMedia }\n\t\t\t\t\t\t\topenMediaOptions={ openMediaOptionsRef.current }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\twidth={ styles.image?.width }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\n\t\t\t\t{ VIDEO_BACKGROUND_TYPE === backgroundType && (\n\t\t\t\t\t<Video\n\t\t\t\t\t\tmuted\n\t\t\t\t\t\tdisableFocus\n\t\t\t\t\t\trepeat\n\t\t\t\t\t\tresizeMode={ 'cover' }\n\t\t\t\t\t\tsource={ { uri: url } }\n\t\t\t\t\t\tonLoad={ onVideoLoad }\n\t\t\t\t\t\tonLoadStart={ onVideoLoadStart }\n\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\tstyles.background,\n\t\t\t\t\t\t\t// Hide Video component since it has black background while loading the source.\n\t\t\t\t\t\t\t{ opacity: isVideoLoading ? 0 : 1 },\n\t\t\t\t\t\t] }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n\n\tif (\n\t\t( ! hasBackground && ! hasInnerBlocks ) ||\n\t\tisCustomColorPickerShowing\n\t) {\n\t\treturn (\n\t\t\t<View>\n\t\t\t\t{ isCustomColorPickerShowing && colorPickerControls }\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\theight={\n\t\t\t\t\t\tstyles.mediaPlaceholderEmptyStateContainer?.height\n\t\t\t\t\t}\n\t\t\t\t\tbackgroundColor={ customOverlayColor }\n\t\t\t\t\thideContent={\n\t\t\t\t\t\tcustomOverlayColor !== '' &&\n\t\t\t\t\t\tcustomOverlayColor !== undefined\n\t\t\t\t\t}\n\t\t\t\t\ticon={ placeholderIcon }\n\t\t\t\t\tlabels={ {\n\t\t\t\t\t\ttitle: __( 'Cover' ),\n\t\t\t\t\t} }\n\t\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t>\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ styles.colorPaletteWrapper }\n\t\t\t\t\t\tpointerEvents={\n\t\t\t\t\t\t\tisScreenReaderEnabled ? 'none' : 'auto'\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<BottomSheetConsumer>\n\t\t\t\t\t\t\t{ ( { shouldEnableBottomSheetScroll } ) => (\n\t\t\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles={\n\t\t\t\t\t\t\t\t\t\tstyles.paletteColorIndicator\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcustomIndicatorWrapperStyles={\n\t\t\t\t\t\t\t\t\t\tstyles.paletteCustomIndicatorWrapper\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsetColor={ setColor }\n\t\t\t\t\t\t\t\t\tonCustomPress={ openColorPicker }\n\t\t\t\t\t\t\t\t\tdefaultSettings={ coverDefaultPalette }\n\t\t\t\t\t\t\t\t\tshouldShowCustomLabel={ false }\n\t\t\t\t\t\t\t\t\tshouldShowCustomVerticalSeparator={ false }\n\t\t\t\t\t\t\t\t\tshouldEnableBottomSheetScroll={\n\t\t\t\t\t\t\t\t\t\tshouldEnableBottomSheetScroll\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</BottomSheetConsumer>\n\t\t\t\t\t</View>\n\t\t\t\t</MediaPlaceholder>\n\t\t\t</View>\n\t\t);\n\t}\n\n\treturn (\n\t\t<View style={ styles.backgroundContainer }>\n\t\t\t{ isSelected && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<Controls\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\tdidUploadFail={ didUploadFail }\n\t\t\t\t\t\thasOnlyColorBackground={ hasOnlyColorBackground }\n\t\t\t\t\t\tisUploadInProgress={ isUploadInProgress }\n\t\t\t\t\t\tonClearMedia={ onClearMedia }\n\t\t\t\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\n\t\t\t<View\n\t\t\t\tpointerEvents=\"box-none\"\n\t\t\t\tstyle={ [ styles.content, { minHeight: convertedMinHeight } ] }\n\t\t\t>\n\t\t\t\t<InnerBlocks\n\t\t\t\t\tallowedBlocks={ allowedBlocks }\n\t\t\t\t\ttemplate={ INNER_BLOCKS_TEMPLATE }\n\t\t\t\t\ttemplateLock={ templateLock }\n\t\t\t\t\ttemplateInsertUpdatesSelection\n\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t/>\n\t\t\t</View>\n\n\t\t\t<View pointerEvents=\"none\" style={ styles.overlayContainer }>\n\t\t\t\t<View style={ overlayStyles }>\n\t\t\t\t\t{ gradientValue && (\n\t\t\t\t\t\t<Gradient\n\t\t\t\t\t\t\tgradientValue={ gradientValue }\n\t\t\t\t\t\t\tstyle={ styles.background }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</View>\n\t\t\t</View>\n\n\t\t\t<MediaUpload\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tisReplacingMedia={ ! hasOnlyColorBackground }\n\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\trender={ ( { open, getMediaOptions } ) => {\n\t\t\t\t\topenMediaOptionsRef.current = open;\n\t\t\t\t\treturn renderContent( getMediaOptions );\n\t\t\t\t} }\n\t\t\t/>\n\n\t\t\t{ isImage &&\n\t\t\t\turl &&\n\t\t\t\topenMediaOptionsRef.current &&\n\t\t\t\tisParentSelected &&\n\t\t\t\t! isUploadInProgress &&\n\t\t\t\t! didUploadFail && (\n\t\t\t\t\t<View style={ styles.imageEditButton }>\n\t\t\t\t\t\t<ImageEditingButton\n\t\t\t\t\t\t\tonSelectMediaUploadOption={ onSelectMedia }\n\t\t\t\t\t\t\topenMediaOptions={ openMediaOptionsRef.current }\n\t\t\t\t\t\t\tpickerOptions={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tdestructiveButton: true,\n\t\t\t\t\t\t\t\t\tid: 'clearMedia',\n\t\t\t\t\t\t\t\t\tlabel: __( 'Clear Media' ),\n\t\t\t\t\t\t\t\t\tonPress: onClearMedia,\n\t\t\t\t\t\t\t\t\tseparated: true,\n\t\t\t\t\t\t\t\t\tvalue: 'clearMedia',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\n\t\t\t{ shouldShowFailure && (\n\t\t\t\t<View\n\t\t\t\t\tpointerEvents=\"none\"\n\t\t\t\t\tstyle={ styles.uploadFailedContainer }\n\t\t\t\t>\n\t\t\t\t\t<View style={ styles.uploadFailed }>\n\t\t\t\t\t\t<Icon icon={ warning } { ...styles.uploadFailedIcon } />\n\t\t\t\t\t</View>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t</View>\n\t);\n};\n\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst { getSelectedBlockClientId, getBlock } = select(\n\t\t\tblockEditorStore\n\t\t);\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\n\t\tconst { getSettings } = select( blockEditorStore );\n\n\t\tconst hasInnerBlocks = getBlock( clientId )?.innerBlocks.length > 0;\n\n\t\treturn {\n\t\t\tsettings: getSettings(),\n\t\t\tisParentSelected: selectedBlockClientId === clientId,\n\t\t\thasInnerBlocks,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { clientId } ) => {\n\t\tconst { openGeneralSidebar } = dispatch( editPostStore );\n\t\tconst { selectBlock } = dispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\topenGeneralSidebar: () => openGeneralSidebar( 'edit-post/block' ),\n\t\t\tcloseSettingsBottomSheet() {\n\t\t\t\tdispatch( editPostStore ).closeGeneralSidebar();\n\t\t\t},\n\t\t\tselectBlock: () => selectBlock( clientId ),\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( Cover );\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/cover/focal-point-settings-button.native.js"],"names":["FocalPointSettingsButton","disabled","focalPoint","onFocalPointChange","url","navigation","styles","dimmedActionButton","navigate","blockSettingsScreens","chevronRight"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AAjBA;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,wBAAT,OAKI;AAAA,MAL+B;AAClCC,IAAAA,QADkC;AAElCC,IAAAA,UAFkC;AAGlCC,IAAAA,kBAHkC;AAIlCC,IAAAA;AAJkC,GAK/B;AACH,QAAMC,UAAU,GAAG,4BAAnB;AACA,SACC,4BAAC,uBAAD,CAAa,IAAb;AACC,IAAA,kBAAkB,MADnB;AAEC,IAAA,QAAQ,EAAGJ,QAFZ;AAGC,IAAA,UAAU,EAAGA,QAAQ,IAAIK,eAAOC,kBAHjC;AAIC,IAAA,SAAS,MAJV;AAKC,IAAA,KAAK,EAAG,cAAI,kBAAJ,CALT;AAMC,IAAA,OAAO,EAAG,MAAM;AACfF,MAAAA,UAAU,CAACG,QAAX,CAAqBC,kCAAqBP,UAA1C,EAAsD;AACrDA,QAAAA,UADqD;AAErDC,QAAAA,kBAFqD;AAGrDC,QAAAA;AAHqD,OAAtD;AAKA;AAZF,KAkBC,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGH,QAAQ,IAAIK,eAAOC;AAAjC,KACC,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAGG;AAAb,IADD,CAlBD,CADD;AAwBA;;eAEcV,wB","sourcesContent":["/**\n * External dependencies\n */\nimport { useNavigation } from '@react-navigation/native';\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, BottomSheet } from '@wordpress/components';\nimport { blockSettingsScreens } from '@wordpress/block-editor';\nimport { chevronRight } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nfunction FocalPointSettingsButton( {\n\tdisabled,\n\tfocalPoint,\n\tonFocalPointChange,\n\turl,\n} ) {\n\tconst navigation = useNavigation();\n\treturn (\n\t\t<BottomSheet.Cell\n\t\t\tcustomActionButton\n\t\t\tdisabled={ disabled }\n\t\t\tlabelStyle={ disabled && styles.dimmedActionButton }\n\t\t\tleftAlign\n\t\t\tlabel={ __( 'Edit focal point' ) }\n\t\t\tonPress={ () => {\n\t\t\t\tnavigation.navigate( blockSettingsScreens.focalPoint, {\n\t\t\t\t\tfocalPoint,\n\t\t\t\t\tonFocalPointChange,\n\t\t\t\t\turl,\n\t\t\t\t} );\n\t\t\t} }\n\t\t>\n\t\t\t{ /*\n\t\t\t * Wrapper View element used around Icon as workaround for SVG opacity\n\t\t\t * issue: https://git.io/JtuXD\n\t\t\t */ }\n\t\t\t<View style={ disabled && styles.dimmedActionButton }>\n\t\t\t\t<Icon icon={ chevronRight } />\n\t\t\t</View>\n\t\t</BottomSheet.Cell>\n\t);\n}\n\nexport default FocalPointSettingsButton;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/cover/focal-point-settings-button.native.js"],"names":["FocalPointSettingsButton","disabled","focalPoint","onFocalPointChange","url","navigation","styles","dimmedActionButton","navigate","blockSettingsScreens","chevronRight"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AAjBA;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,wBAAT,OAKI;AAAA,MAL+B;AAClCC,IAAAA,QADkC;AAElCC,IAAAA,UAFkC;AAGlCC,IAAAA,kBAHkC;AAIlCC,IAAAA;AAJkC,GAK/B;AACH,QAAMC,UAAU,GAAG,4BAAnB;AACA,SACC,4BAAC,uBAAD,CAAa,IAAb;AACC,IAAA,kBAAkB,MADnB;AAEC,IAAA,QAAQ,EAAGJ,QAFZ;AAGC,IAAA,UAAU,EAAGA,QAAQ,IAAIK,eAAOC,kBAHjC;AAIC,IAAA,SAAS,MAJV;AAKC,IAAA,KAAK,EAAG,cAAI,kBAAJ,CALT;AAMC,IAAA,OAAO,EAAG,MAAM;AACfF,MAAAA,UAAU,CAACG,QAAX,CAAqBC,kCAAqBP,UAA1C,EAAsD;AACrDA,QAAAA,UADqD;AAErDC,QAAAA,kBAFqD;AAGrDC,QAAAA;AAHqD,OAAtD;AAKA;AAZF,KAkBC,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGH,QAAQ,IAAIK,eAAOC;AAAjC,KACC,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAGG;AAAb,IADD,CAlBD,CADD;AAwBA;;eAEcV,wB","sourcesContent":["/**\n * External dependencies\n */\nimport { useNavigation } from '@react-navigation/native';\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, BottomSheet } from '@wordpress/components';\nimport { blockSettingsScreens } from '@wordpress/block-editor';\nimport { chevronRight } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nfunction FocalPointSettingsButton( {\n\tdisabled,\n\tfocalPoint,\n\tonFocalPointChange,\n\turl,\n} ) {\n\tconst navigation = useNavigation();\n\treturn (\n\t\t<BottomSheet.Cell\n\t\t\tcustomActionButton\n\t\t\tdisabled={ disabled }\n\t\t\tlabelStyle={ disabled && styles.dimmedActionButton }\n\t\t\tleftAlign\n\t\t\tlabel={ __( 'Edit focal point' ) }\n\t\t\tonPress={ () => {\n\t\t\t\tnavigation.navigate( blockSettingsScreens.focalPoint, {\n\t\t\t\t\tfocalPoint,\n\t\t\t\t\tonFocalPointChange,\n\t\t\t\t\turl,\n\t\t\t\t} );\n\t\t\t} }\n\t\t>\n\t\t\t{ /*\n\t\t\t * Wrapper View element used around Icon as workaround for SVG opacity\n\t\t\t * issue: https://github.com/react-native-svg/react-native-svg/issues/1345\n\t\t\t */ }\n\t\t\t<View style={ disabled && styles.dimmedActionButton }>\n\t\t\t\t<Icon icon={ chevronRight } />\n\t\t\t</View>\n\t\t</BottomSheet.Cell>\n\t);\n}\n\nexport default FocalPointSettingsButton;\n"]}
@@ -9,6 +9,7 @@ exports.backgroundImageStyles = backgroundImageStyles;
9
9
  exports.dimRatioToClass = dimRatioToClass;
10
10
  exports.getPositionClassName = getPositionClassName;
11
11
  exports.isContentPositionCenter = isContentPositionCenter;
12
+ exports.mediaPosition = mediaPosition;
12
13
 
13
14
  var _blob = require("@wordpress/blob");
14
15
 
@@ -124,4 +125,12 @@ function getPositionClassName(contentPosition) {
124
125
  if (isContentPositionCenter(contentPosition)) return '';
125
126
  return POSITION_CLASSNAMES[contentPosition];
126
127
  }
128
+
129
+ function mediaPosition(_ref) {
130
+ let {
131
+ x,
132
+ y
133
+ } = _ref;
134
+ return `${Math.round(x * 100)}% ${Math.round(y * 100)}%`;
135
+ }
127
136
  //# sourceMappingURL=shared.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/cover/shared.js"],"names":["POSITION_CLASSNAMES","center","IMAGE_BACKGROUND_TYPE","VIDEO_BACKGROUND_TYPE","COVER_MIN_HEIGHT","COVER_MAX_HEIGHT","COVER_DEFAULT_HEIGHT","backgroundImageStyles","url","backgroundImage","ALLOWED_MEDIA_TYPES","dimRatioToClass","ratio","undefined","Math","round","attributesFromMedia","setAttributes","dimRatio","media","id","type","mediaType","media_type","alt","backgroundType","focalPoint","hasParallax","isContentPositionCenter","contentPosition","getPositionClassName"],"mappings":";;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,mBAAmB,GAAG;AAC3B,cAAY,sBADe;AAE3B,gBAAc,wBAFa;AAG3B,eAAa,uBAHc;AAI3B,iBAAe,yBAJY;AAK3B,mBAAiB,2BALU;AAM3BC,EAAAA,MAAM,EAAE,2BANmB;AAO3B,kBAAgB,0BAPW;AAQ3B,iBAAe,yBARY;AAS3B,mBAAiB,2BATU;AAU3B,kBAAgB;AAVW,CAA5B;AAa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UACCgB,KAAK,CAACE,IAAN,KAAenB,qBAAf,IACAiB,KAAK,CAACE,IAAN,KAAelB,qBAFhB,EAGE;AACD;AACA;;AACDmB,MAAAA,SAAS,GAAGH,KAAK,CAACE,IAAlB;AACA;;AAEDJ,IAAAA,aAAa,CAAE;AACdC,MAAAA,QAAQ,EAAEA,QAAQ,KAAK,GAAb,GAAmB,EAAnB,GAAwBA,QADpB;AAEdV,MAAAA,GAAG,EAAEW,KAAK,CAACX,GAFG;AAGdY,MAAAA,EAAE,EAAED,KAAK,CAACC,EAHI;AAIdI,MAAAA,GAAG,EAAEL,KAAF,aAAEA,KAAF,uBAAEA,KAAK,CAAEK,GAJE;AAKdC,MAAAA,cAAc,EAAEH,SALF;AAMd,UAAKA,SAAS,KAAKnB,qBAAd,GACF;AAAEuB,QAAAA,UAAU,EAAEb,SAAd;AAAyBc,QAAAA,WAAW,EAAEd;AAAtC,OADE,GAEF,EAFH;AANc,KAAF,CAAb;AAUA,GAzCD;AA0CA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASe,uBAAT,CAAkCC,eAAlC,EAAoD;AAC1D,SACC,CAAEA,eAAF,IACAA,eAAe,KAAK,eADpB,IAEAA,eAAe,KAAK,QAHrB;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,oBAAT,CAA+BD,eAA/B,EAAiD;AACvD;AACD;AACA;AACC,MAAKD,uBAAuB,CAAEC,eAAF,CAA5B,EAAkD,OAAO,EAAP;AAElD,SAAO7B,mBAAmB,CAAE6B,eAAF,CAA1B;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlobTypeByURL, isBlobURL } from '@wordpress/blob';\n\nconst POSITION_CLASSNAMES = {\n\t'top left': 'is-position-top-left',\n\t'top center': 'is-position-top-center',\n\t'top right': 'is-position-top-right',\n\t'center left': 'is-position-center-left',\n\t'center center': 'is-position-center-center',\n\tcenter: 'is-position-center-center',\n\t'center right': 'is-position-center-right',\n\t'bottom left': 'is-position-bottom-left',\n\t'bottom center': 'is-position-bottom-center',\n\t'bottom right': 'is-position-bottom-right',\n};\n\nexport const IMAGE_BACKGROUND_TYPE = 'image';\nexport const VIDEO_BACKGROUND_TYPE = 'video';\nexport const COVER_MIN_HEIGHT = 50;\nexport const COVER_MAX_HEIGHT = 1000;\nexport const COVER_DEFAULT_HEIGHT = 300;\nexport function backgroundImageStyles( url ) {\n\treturn url ? { backgroundImage: `url(${ url })` } : {};\n}\nexport const ALLOWED_MEDIA_TYPES = [ 'image', 'video' ];\n\nexport function dimRatioToClass( ratio ) {\n\treturn ratio === 50 || ! ratio === undefined\n\t\t? null\n\t\t: 'has-background-dim-' + 10 * Math.round( ratio / 10 );\n}\n\nexport function attributesFromMedia( setAttributes, dimRatio ) {\n\treturn ( media ) => {\n\t\tif ( ! media || ! media.url ) {\n\t\t\tsetAttributes( { url: undefined, id: undefined } );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tmedia.type = getBlobTypeByURL( media.url );\n\t\t}\n\n\t\tlet mediaType;\n\t\t// For media selections originated from a file upload.\n\t\tif ( media.media_type ) {\n\t\t\tif ( media.media_type === IMAGE_BACKGROUND_TYPE ) {\n\t\t\t\tmediaType = IMAGE_BACKGROUND_TYPE;\n\t\t\t} else {\n\t\t\t\t// only images and videos are accepted so if the media_type is not an image we can assume it is a video.\n\t\t\t\t// Videos contain the media type of 'file' in the object returned from the rest api.\n\t\t\t\tmediaType = VIDEO_BACKGROUND_TYPE;\n\t\t\t}\n\t\t} else {\n\t\t\t// For media selections originated from existing files in the media library.\n\t\t\tif (\n\t\t\t\tmedia.type !== IMAGE_BACKGROUND_TYPE &&\n\t\t\t\tmedia.type !== VIDEO_BACKGROUND_TYPE\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tmediaType = media.type;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tdimRatio: dimRatio === 100 ? 50 : dimRatio,\n\t\t\turl: media.url,\n\t\t\tid: media.id,\n\t\t\talt: media?.alt,\n\t\t\tbackgroundType: mediaType,\n\t\t\t...( mediaType === VIDEO_BACKGROUND_TYPE\n\t\t\t\t? { focalPoint: undefined, hasParallax: undefined }\n\t\t\t\t: {} ),\n\t\t} );\n\t};\n}\n\n/**\n * Checks of the contentPosition is the center (default) position.\n *\n * @param {string} contentPosition The current content position.\n * @return {boolean} Whether the contentPosition is center.\n */\nexport function isContentPositionCenter( contentPosition ) {\n\treturn (\n\t\t! contentPosition ||\n\t\tcontentPosition === 'center center' ||\n\t\tcontentPosition === 'center'\n\t);\n}\n\n/**\n * Retrieves the className for the current contentPosition.\n * The default position (center) will not have a className.\n *\n * @param {string} contentPosition The current content position.\n * @return {string} The className assigned to the contentPosition.\n */\nexport function getPositionClassName( contentPosition ) {\n\t/*\n\t * Only render a className if the contentPosition is not center (the default).\n\t */\n\tif ( isContentPositionCenter( contentPosition ) ) return '';\n\n\treturn POSITION_CLASSNAMES[ contentPosition ];\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/cover/shared.js"],"names":["POSITION_CLASSNAMES","center","IMAGE_BACKGROUND_TYPE","VIDEO_BACKGROUND_TYPE","COVER_MIN_HEIGHT","COVER_MAX_HEIGHT","COVER_DEFAULT_HEIGHT","backgroundImageStyles","url","backgroundImage","ALLOWED_MEDIA_TYPES","dimRatioToClass","ratio","undefined","Math","round","attributesFromMedia","setAttributes","dimRatio","media","id","type","mediaType","media_type","alt","backgroundType","focalPoint","hasParallax","isContentPositionCenter","contentPosition","getPositionClassName","mediaPosition","x","y"],"mappings":";;;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,mBAAmB,GAAG;AAC3B,cAAY,sBADe;AAE3B,gBAAc,wBAFa;AAG3B,eAAa,uBAHc;AAI3B,iBAAe,yBAJY;AAK3B,mBAAiB,2BALU;AAM3BC,EAAAA,MAAM,EAAE,2BANmB;AAO3B,kBAAgB,0BAPW;AAQ3B,iBAAe,yBAR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AG,GAAhB,CAAuB,GAA9D;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlobTypeByURL, isBlobURL } from '@wordpress/blob';\n\nconst POSITION_CLASSNAMES = {\n\t'top left': 'is-position-top-left',\n\t'top center': 'is-position-top-center',\n\t'top right': 'is-position-top-right',\n\t'center left': 'is-position-center-left',\n\t'center center': 'is-position-center-center',\n\tcenter: 'is-position-center-center',\n\t'center right': 'is-position-center-right',\n\t'bottom left': 'is-position-bottom-left',\n\t'bottom center': 'is-position-bottom-center',\n\t'bottom right': 'is-position-bottom-right',\n};\n\nexport const IMAGE_BACKGROUND_TYPE = 'image';\nexport const VIDEO_BACKGROUND_TYPE = 'video';\nexport const COVER_MIN_HEIGHT = 50;\nexport const COVER_MAX_HEIGHT = 1000;\nexport const COVER_DEFAULT_HEIGHT = 300;\nexport function backgroundImageStyles( url ) {\n\treturn url ? { backgroundImage: `url(${ url })` } : {};\n}\nexport const ALLOWED_MEDIA_TYPES = [ 'image', 'video' ];\n\nexport function dimRatioToClass( ratio ) {\n\treturn ratio === 50 || ! ratio === undefined\n\t\t? null\n\t\t: 'has-background-dim-' + 10 * Math.round( ratio / 10 );\n}\n\nexport function attributesFromMedia( setAttributes, dimRatio ) {\n\treturn ( media ) => {\n\t\tif ( ! media || ! media.url ) {\n\t\t\tsetAttributes( { url: undefined, id: undefined } );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tmedia.type = getBlobTypeByURL( media.url );\n\t\t}\n\n\t\tlet mediaType;\n\t\t// For media selections originated from a file upload.\n\t\tif ( media.media_type ) {\n\t\t\tif ( media.media_type === IMAGE_BACKGROUND_TYPE ) {\n\t\t\t\tmediaType = IMAGE_BACKGROUND_TYPE;\n\t\t\t} else {\n\t\t\t\t// only images and videos are accepted so if the media_type is not an image we can assume it is a video.\n\t\t\t\t// Videos contain the media type of 'file' in the object returned from the rest api.\n\t\t\t\tmediaType = VIDEO_BACKGROUND_TYPE;\n\t\t\t}\n\t\t} else {\n\t\t\t// For media selections originated from existing files in the media library.\n\t\t\tif (\n\t\t\t\tmedia.type !== IMAGE_BACKGROUND_TYPE &&\n\t\t\t\tmedia.type !== VIDEO_BACKGROUND_TYPE\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tmediaType = media.type;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tdimRatio: dimRatio === 100 ? 50 : dimRatio,\n\t\t\turl: media.url,\n\t\t\tid: media.id,\n\t\t\talt: media?.alt,\n\t\t\tbackgroundType: mediaType,\n\t\t\t...( mediaType === VIDEO_BACKGROUND_TYPE\n\t\t\t\t? { focalPoint: undefined, hasParallax: undefined }\n\t\t\t\t: {} ),\n\t\t} );\n\t};\n}\n\n/**\n * Checks of the contentPosition is the center (default) position.\n *\n * @param {string} contentPosition The current content position.\n * @return {boolean} Whether the contentPosition is center.\n */\nexport function isContentPositionCenter( contentPosition ) {\n\treturn (\n\t\t! contentPosition ||\n\t\tcontentPosition === 'center center' ||\n\t\tcontentPosition === 'center'\n\t);\n}\n\n/**\n * Retrieves the className for the current contentPosition.\n * The default position (center) will not have a className.\n *\n * @param {string} contentPosition The current content position.\n * @return {string} The className assigned to the contentPosition.\n */\nexport function getPositionClassName( contentPosition ) {\n\t/*\n\t * Only render a className if the contentPosition is not center (the default).\n\t */\n\tif ( isContentPositionCenter( contentPosition ) ) return '';\n\n\treturn POSITION_CLASSNAMES[ contentPosition ];\n}\n\nexport function mediaPosition( { x, y } ) {\n\treturn `${ Math.round( x * 100 ) }% ${ Math.round( y * 100 ) }%`;\n}\n"]}
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -9,6 +11,8 @@ var _blocks = require("@wordpress/blocks");
9
11
 
10
12
  var _shared = require("./shared");
11
13
 
14
+ var _cleanEmptyObject = _interopRequireDefault(require("../utils/clean-empty-object"));
15
+
12
16
  /**
13
17
  * WordPress dependencies
14
18
  */
@@ -78,7 +82,7 @@ const transforms = {
78
82
  type: 'block',
79
83
  blocks: ['core/group'],
80
84
  transform: (attributes, innerBlocks) => {
81
- var _style$color2, _style$color3, _style$color4, _style$color5, _attributes$style;
85
+ var _innerBlocks$, _style$color2, _style$color3, _style$color4, _style$color5;
82
86
 
83
87
  const {
84
88
  align,
@@ -86,10 +90,16 @@ const transforms = {
86
90
  backgroundColor,
87
91
  gradient,
88
92
  style
89
- } = attributes; // If no background or gradient color is provided, default to 50% opacity.
93
+ } = attributes; // If the Group block being transformed has a Cover block as its
94
+ // only child return that Cover block.
95
+
96
+ if ((innerBlocks === null || innerBlocks === void 0 ? void 0 : innerBlocks.length) === 1 && ((_innerBlocks$ = innerBlocks[0]) === null || _innerBlocks$ === void 0 ? void 0 : _innerBlocks$.name) === 'core/cover') {
97
+ return (0, _blocks.createBlock)('core/cover', innerBlocks[0].attributes, innerBlocks[0].innerBlocks);
98
+ } // If no background or gradient color is provided, default to 50% opacity.
90
99
  // This matches the styling of a Cover block with a background image,
91
100
  // in the state where a background image has been removed.
92
101
 
102
+
93
103
  const dimRatio = backgroundColor || gradient || style !== null && style !== void 0 && (_style$color2 = style.color) !== null && _style$color2 !== void 0 && _style$color2.background || style !== null && style !== void 0 && (_style$color3 = style.color) !== null && _style$color3 !== void 0 && _style$color3.gradient ? undefined : 50; // Move the background or gradient color to the parent Cover block.
94
104
 
95
105
  const parentAttributes = {
@@ -104,12 +114,12 @@ const transforms = {
104
114
  const attributesWithoutBackgroundColors = { ...attributes,
105
115
  backgroundColor: undefined,
106
116
  gradient: undefined,
107
- style: { ...(attributes === null || attributes === void 0 ? void 0 : attributes.style),
108
- color: { ...(attributes === null || attributes === void 0 ? void 0 : (_attributes$style = attributes.style) === null || _attributes$style === void 0 ? void 0 : _attributes$style.color),
117
+ style: (0, _cleanEmptyObject.default)({ ...(attributes === null || attributes === void 0 ? void 0 : attributes.style),
118
+ color: style !== null && style !== void 0 && style.color ? { ...(style === null || style === void 0 ? void 0 : style.color),
109
119
  background: undefined,
110
120
  gradient: undefined
111
- }
112
- }
121
+ } : undefined
122
+ })
113
123
  }; // Preserve the block by nesting it within the Cover block,
114
124
  // instead of converting the Group block directly to the Cover block.
115
125
 
@@ -200,6 +210,67 @@ const transforms = {
200
210
  anchor
201
211
  });
202
212
  }
213
+ }, {
214
+ type: 'block',
215
+ blocks: ['core/group'],
216
+ isMatch: _ref7 => {
217
+ let {
218
+ url
219
+ } = _ref7;
220
+
221
+ // If the Cover block uses background media, skip this transform,
222
+ // and instead use the Group block's default transform.
223
+ if (url) {
224
+ return false;
225
+ }
226
+
227
+ return true;
228
+ },
229
+ transform: (attributes, innerBlocks) => {
230
+ var _attributes$style, _attributes$style2, _innerBlocks$2;
231
+
232
+ // Convert Cover overlay colors to comparable Group background colors.
233
+ const transformedColorAttributes = {
234
+ backgroundColor: attributes === null || attributes === void 0 ? void 0 : attributes.overlayColor,
235
+ gradient: attributes === null || attributes === void 0 ? void 0 : attributes.gradient,
236
+ style: (0, _cleanEmptyObject.default)({ ...(attributes === null || attributes === void 0 ? void 0 : attributes.style),
237
+ color: attributes !== null && attributes !== void 0 && attributes.customOverlayColor || attributes !== null && attributes !== void 0 && attributes.customGradient || attributes !== null && attributes !== void 0 && (_attributes$style = attributes.style) !== null && _attributes$style !== void 0 && _attributes$style.color ? {
238
+ background: attributes === null || attributes === void 0 ? void 0 : attributes.customOverlayColor,
239
+ gradient: attributes === null || attributes === void 0 ? void 0 : attributes.customGradient,
240
+ ...(attributes === null || attributes === void 0 ? void 0 : (_attributes$style2 = attributes.style) === null || _attributes$style2 === void 0 ? void 0 : _attributes$style2.color)
241
+ } : undefined
242
+ })
243
+ }; // If the Cover block contains only a single Group block as a direct child,
244
+ // then attempt to merge the Cover's background colors with the child Group block,
245
+ // and remove the Cover block as the wrapper.
246
+
247
+ if ((innerBlocks === null || innerBlocks === void 0 ? void 0 : innerBlocks.length) === 1 && ((_innerBlocks$2 = innerBlocks[0]) === null || _innerBlocks$2 === void 0 ? void 0 : _innerBlocks$2.name) === 'core/group') {
248
+ var _groupAttributes$styl, _groupAttributes$styl2, _groupAttributes$styl3, _groupAttributes$styl4, _transformedColorAttr, _groupAttributes$styl5, _transformedColorAttr2, _groupAttributes$styl6, _innerBlocks$4;
249
+
250
+ const groupAttributes = (0, _cleanEmptyObject.default)(innerBlocks[0].attributes || {}); // If the Group block contains any kind of background color or gradient,
251
+ // skip merging Cover background colors, and preserve the Group block's colors.
252
+
253
+ if (groupAttributes !== null && groupAttributes !== void 0 && groupAttributes.backgroundColor || groupAttributes !== null && groupAttributes !== void 0 && groupAttributes.gradient || groupAttributes !== null && groupAttributes !== void 0 && (_groupAttributes$styl = groupAttributes.style) !== null && _groupAttributes$styl !== void 0 && (_groupAttributes$styl2 = _groupAttributes$styl.color) !== null && _groupAttributes$styl2 !== void 0 && _groupAttributes$styl2.background || groupAttributes !== null && groupAttributes !== void 0 && (_groupAttributes$styl3 = groupAttributes.style) !== null && _groupAttributes$styl3 !== void 0 && (_groupAttributes$styl4 = _groupAttributes$styl3.color) !== null && _groupAttributes$styl4 !== void 0 && _groupAttributes$styl4.gradient) {
254
+ var _innerBlocks$3;
255
+
256
+ return (0, _blocks.createBlock)('core/group', groupAttributes, (_innerBlocks$3 = innerBlocks[0]) === null || _innerBlocks$3 === void 0 ? void 0 : _innerBlocks$3.innerBlocks);
257
+ }
258
+
259
+ return (0, _blocks.createBlock)('core/group', { ...transformedColorAttributes,
260
+ ...groupAttributes,
261
+ style: (0, _cleanEmptyObject.default)({ ...(groupAttributes === null || groupAttributes === void 0 ? void 0 : groupAttributes.style),
262
+ color: transformedColorAttributes !== null && transformedColorAttributes !== void 0 && (_transformedColorAttr = transformedColorAttributes.style) !== null && _transformedColorAttr !== void 0 && _transformedColorAttr.color || groupAttributes !== null && groupAttributes !== void 0 && (_groupAttributes$styl5 = groupAttributes.style) !== null && _groupAttributes$styl5 !== void 0 && _groupAttributes$styl5.color ? { ...(transformedColorAttributes === null || transformedColorAttributes === void 0 ? void 0 : (_transformedColorAttr2 = transformedColorAttributes.style) === null || _transformedColorAttr2 === void 0 ? void 0 : _transformedColorAttr2.color),
263
+ ...(groupAttributes === null || groupAttributes === void 0 ? void 0 : (_groupAttributes$styl6 = groupAttributes.style) === null || _groupAttributes$styl6 === void 0 ? void 0 : _groupAttributes$styl6.color)
264
+ } : undefined
265
+ })
266
+ }, (_innerBlocks$4 = innerBlocks[0]) === null || _innerBlocks$4 === void 0 ? void 0 : _innerBlocks$4.innerBlocks);
267
+ } // In all other cases, transform the Cover block directly to a Group block.
268
+
269
+
270
+ return (0, _blocks.createBlock)('core/group', { ...attributes,
271
+ ...transformedColorAttributes
272
+ }, innerBlocks);
273
+ }
203
274
  }]
204
275
  };
205
276
  var _default = transforms;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/cover/transforms.js"],"names":["transforms","from","type","blocks","transform","caption","url","alt","align","id","anchor","style","dimRatio","color","duotone","content","fontSize","src","backgroundType","VIDEO_BACKGROUND_TYPE","attributes","innerBlocks","backgroundColor","gradient","background","undefined","parentAttributes","overlayColor","customOverlayColor","customGradient","attributesWithoutBackgroundColors","to","isMatch","IMAGE_BACKGROUND_TYPE","title"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,UAAU,GAAG;AAClBC,EAAAA,IAAI,EAAE,CACL;AACCC,IAAAA,IAAI,EAAE,OADP;AAECC,IAAAA,MAAM,EAAE,CAAE,YAAF,CAFT;AAGCC,IAAAA,SAAS,EAAE;AAAA;;AAAA,UAAE;AAAEC,QAAAA,OAAF;AAAWC,QAAAA,GAAX;AAAgBC,QAAAA,GAAhB;AAAqBC,QAAAA,KAArB;AAA4BC,QAAAA,EAA5B;AAAgCC,QAAAA,MAAhC;AAAwCC,QAAAA;AAAxC,OAAF;AAAA,aACV,yBAC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OF;AAAA,UAPI;AACVd,QAAAA,cADU;AAEVZ,QAAAA,GAFU;AAGVqB,QAAAA,YAHU;AAIVC,QAAAA,kBAJU;AAKVL,QAAAA,QALU;AAMVM,QAAAA;AANU,OAOJ;;AACN,UAAKvB,GAAL,EAAW;AACV;AACA,eAAOY,cAAc,KAAKC,6BAA1B;AACA,OAJK,CAKN;;;AACA,aACC,CAAEQ,YAAF,IACA,CAAEC,kBADF,IAEA,CAAEL,QAFF,IAGA,CAAEM,cAJH;AAMA,KAtBF;AAuBCzB,IAAAA,SAAS,EAAE;AAAA,UAAE;AAAE8B,QAAAA,KAAF;AAAS5B,QAAAA,GAAT;AAAcE,QAAAA,KAAd;AAAqBC,QAAAA,EAArB;AAAyBC,QAAAA;AAAzB,OAAF;AAAA,aACV,yBAAa,YAAb,EAA2B;AAC1BL,QAAAA,OAAO,EAAE6B,KADiB;AAE1BjB,QAAAA,GAAG,EAAEX,GAFqB;AAG1BG,QAAAA,EAH0B;AAI1BD,QAAAA,KAJ0B;AAK1BE,QAAAA;AAL0B,OAA3B,CADU;AAAA;AAvBZ,GAvCG;AAjHc,CAAnB;eA2LeV,U","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { IMAGE_BACKGROUND_TYPE, VIDEO_BACKGROUND_TYPE } from './shared';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( { caption, url, alt, align, id, anchor, style } ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/cover',\n\t\t\t\t\t{\n\t\t\t\t\t\tdimRatio: 50,\n\t\t\t\t\t\turl,\n\t\t\t\t\t\talt,\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\tduotone: style?.color?.duotone,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: caption,\n\t\t\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\t\t\talign: 'center',\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/video' ],\n\t\t\ttransform: ( { caption, src, align, id, anchor } ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/cover',\n\t\t\t\t\t{\n\t\t\t\t\t\tdimRatio: 50,\n\t\t\t\t\t\turl: src,\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tbackgroundType: VIDEO_BACKGROUND_TYPE,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: caption,\n\t\t\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\t\t\talign: 'center',\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/group' ],\n\t\t\ttransform: ( attributes, innerBlocks ) => {\n\t\t\t\tconst {\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t\tbackgroundColor,\n\t\t\t\t\tgradient,\n\t\t\t\t\tstyle,\n\t\t\t\t} = attributes;\n\n\t\t\t\t// If no background or gradient color is provided, default to 50% opacity.\n\t\t\t\t// This matches the styling of a Cover block with a background image,\n\t\t\t\t// in the state where a background image has been removed.\n\t\t\t\tconst dimRatio =\n\t\t\t\t\tbackgroundColor ||\n\t\t\t\t\tgradient ||\n\t\t\t\t\tstyle?.color?.background ||\n\t\t\t\t\tstyle?.color?.gradient\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: 50;\n\n\t\t\t\t// Move the background or gradient color to the parent Cover block.\n\t\t\t\tconst parentAttributes = {\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t\tdimRatio,\n\t\t\t\t\toverlayColor: backgroundColor,\n\t\t\t\t\tcustomOverlayColor: style?.color?.background,\n\t\t\t\t\tgradient,\n\t\t\t\t\tcustomGradient: style?.color?.gradient,\n\t\t\t\t};\n\n\t\t\t\tconst attributesWithoutBackgroundColors = {\n\t\t\t\t\t...attributes,\n\t\t\t\t\tbackgroundColor: undefined,\n\t\t\t\t\tgradient: undefined,\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\t...attributes?.style,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...attributes?.style?.color,\n\t\t\t\t\t\t\tbackground: undefined,\n\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\t// Preserve the block by nesting it within the Cover block,\n\t\t\t\t// instead of converting the Group block directly to the Cover block.\n\t\t\t\treturn createBlock( 'core/cover', parentAttributes, [\n\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\tattributesWithoutBackgroundColors,\n\t\t\t\t\t\tinnerBlocks\n\t\t\t\t\t),\n\t\t\t\t] );\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\tisMatch: ( {\n\t\t\t\tbackgroundType,\n\t\t\t\turl,\n\t\t\t\toverlayColor,\n\t\t\t\tcustomOverlayColor,\n\t\t\t\tgradient,\n\t\t\t\tcustomGradient,\n\t\t\t} ) => {\n\t\t\t\tif ( url ) {\n\t\t\t\t\t// If a url exists the transform could happen if that URL represents an image background.\n\t\t\t\t\treturn backgroundType === IMAGE_BACKGROUND_TYPE;\n\t\t\t\t}\n\t\t\t\t// If a url is not set the transform could happen if the cover has no background color or gradient;\n\t\t\t\treturn (\n\t\t\t\t\t! overlayColor &&\n\t\t\t\t\t! customOverlayColor &&\n\t\t\t\t\t! gradient &&\n\t\t\t\t\t! customGradient\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform: ( { title, url, alt, align, id, anchor, style } ) =>\n\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\tcaption: title,\n\t\t\t\t\turl,\n\t\t\t\t\talt,\n\t\t\t\t\talign,\n\t\t\t\t\tid,\n\t\t\t\t\tanchor,\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\tduotone: style?.color?.duotone,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t} ),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/video' ],\n\t\t\tisMatch: ( {\n\t\t\t\tbackgroundType,\n\t\t\t\turl,\n\t\t\t\toverlayColor,\n\t\t\t\tcustomOverlayColor,\n\t\t\t\tgradient,\n\t\t\t\tcustomGradient,\n\t\t\t} ) => {\n\t\t\t\tif ( url ) {\n\t\t\t\t\t// If a url exists the transform could happen if that URL represents a video background.\n\t\t\t\t\treturn backgroundType === VIDEO_BACKGROUND_TYPE;\n\t\t\t\t}\n\t\t\t\t// If a url is not set the transform could happen if the cover has no background color or gradient;\n\t\t\t\treturn (\n\t\t\t\t\t! overlayColor &&\n\t\t\t\t\t! customOverlayColor &&\n\t\t\t\t\t! gradient &&\n\t\t\t\t\t! customGradient\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform: ( { title, url, align, id, anchor } ) =>\n\t\t\t\tcreateBlock( 'core/video', {\n\t\t\t\t\tcaption: title,\n\t\t\t\t\tsrc: url,\n\t\t\t\t\tid,\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t} ),\n\t\t},\n\t],\n};\n\nexport default transforms;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/cover/transforms.js"],"names":["transforms","from","type","blocks","transform","caption","url","alt","align","id","anchor","style","dimRatio","color","duotone","content","fontSize","src","backgroundType","VIDEO_BACKGROUND_TYPE","attributes","innerBlocks","backgroundColor","gradient","length","name","background","undefined","parentAttributes","overlayColor","customOverlayColor","customGradient","attributesWithoutBackgroundColors","to","isMatch","IMAGE_BACKGROUND_TYPE","title","transformedColorAttributes","groupAttributes"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,MAAMA,UAAU,GAAG;AAClBC,EAAAA,IAAI,EAAE,CACL;AACCC,IAAAA,IAAI,EAAE,OADP;AAECC,IAAAA,MAAM,EAAE,CAAE,YAAF,CAFT;AAGCC,IAAAA,SAAS,EAAE;AAAA;;AAAA,UAAE;AAAEC,QAAAA,OAAF;AAAWC,QAAAA,GAAX;AAAgBC,QAAAA,GAAhB;AAAqBC,QAAAA,KAArB;AAA4BC,QAAAA,EAA5B;AAAgCC,QAAAA,MAAhC;AAAwCC,QAAAA;AAAxC,OAAF;AAAA,aACV,yBACC,YADD,EAEC;AACCC,QAAAA,QAAQ,EAAE,EADX;AAECN,QAAAA,GAFD;AAGCC,QAAAA,GAHD;AAICC,QAAAA,KAJD;AAKCC,QAAAA,EALD;AAMCC,QAAAA,MAND;AAOCC,QAAAA,KAAK,EAAE;AACNE,UAAAA,KAAK,EAAE;AACNC,YAAAA,OAAO,EAAEH,KAAF,aAAEA,KAAF,uCAAEA,KAAK,CAAEE,KAAT,iDAAE,aAAcC;AADjB;AADD;AAPR,OAFD,EAeC,CACC,yBAAa,gBAAb,EAA+B;AAC9BC,QAAAA,OAAO,EAAEV,OADqB;AAE9BW,QAAAA,QAAQ,EAAE,OAFoB;AAG9BR,QAAAA,KAAK,EAAE;AAHuB,OAA/B,CADD,CAfD,CADU;AAAA;AAHZ,GADK,EA6BL;AACCN,IAAAA,IAAI,EAAE,OADP;AAECC,IAAAA,MAAM,EAAE,CAAE,YAAF,CAFT;AAGCC,IAA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IAAG2B,eAAH,aAAGA,eAAH,uBAAGA,eAAe,CAAE3B,KAApB,CADwB;AAExBE,YAAAA,KAAK,EACJwB,0BAA0B,SAA1B,IAAAA,0BAA0B,WAA1B,6BAAAA,0BAA0B,CAAE1B,KAA5B,wEAAmCE,KAAnC,IACAyB,eADA,aACAA,eADA,yCACAA,eAAe,CAAE3B,KADjB,mDACA,uBAAwBE,KADxB,GAEG,EACA,IAAGwB,0BAAH,aAAGA,0BAAH,iDAAGA,0BAA0B,CAC1B1B,KADH,2DAAG,uBACOE,KADV,CADA;AAGA,kBAAGyB,eAAH,aAAGA,eAAH,iDAAGA,eAAe,CAAE3B,KAApB,2DAAG,uBACAE,KADH;AAHA,aAFH,GAQGc;AAXoB,WAAlB;AAHR,SAFM,oBAmBNN,WAAW,CAAE,CAAF,CAnBL,mDAmBN,eAAkBA,WAnBZ,CAAP;AAqBA,OApEwC,CAsEzC;;;AACA,aAAO,yBACN,YADM,EAEN,EAAE,GAAGD,UAAL;AAAiB,WAAGiB;AAApB,OAFM,EAGNhB,WAHM,CAAP;AAKA;AAvFF,GAvEG;AAhIc,CAAnB;eAmSerB,U","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { IMAGE_BACKGROUND_TYPE, VIDEO_BACKGROUND_TYPE } from './shared';\nimport cleanEmptyObject from '../utils/clean-empty-object';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( { caption, url, alt, align, id, anchor, style } ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/cover',\n\t\t\t\t\t{\n\t\t\t\t\t\tdimRatio: 50,\n\t\t\t\t\t\turl,\n\t\t\t\t\t\talt,\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\tduotone: style?.color?.duotone,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: caption,\n\t\t\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\t\t\talign: 'center',\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/video' ],\n\t\t\ttransform: ( { caption, src, align, id, anchor } ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/cover',\n\t\t\t\t\t{\n\t\t\t\t\t\tdimRatio: 50,\n\t\t\t\t\t\turl: src,\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tbackgroundType: VIDEO_BACKGROUND_TYPE,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: caption,\n\t\t\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\t\t\talign: 'center',\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/group' ],\n\t\t\ttransform: ( attributes, innerBlocks ) => {\n\t\t\t\tconst {\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t\tbackgroundColor,\n\t\t\t\t\tgradient,\n\t\t\t\t\tstyle,\n\t\t\t\t} = attributes;\n\n\t\t\t\t// If the Group block being transformed has a Cover block as its\n\t\t\t\t// only child return that Cover block.\n\t\t\t\tif (\n\t\t\t\t\tinnerBlocks?.length === 1 &&\n\t\t\t\t\tinnerBlocks[ 0 ]?.name === 'core/cover'\n\t\t\t\t) {\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\t'core/cover',\n\t\t\t\t\t\tinnerBlocks[ 0 ].attributes,\n\t\t\t\t\t\tinnerBlocks[ 0 ].innerBlocks\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// If no background or gradient color is provided, default to 50% opacity.\n\t\t\t\t// This matches the styling of a Cover block with a background image,\n\t\t\t\t// in the state where a background image has been removed.\n\t\t\t\tconst dimRatio =\n\t\t\t\t\tbackgroundColor ||\n\t\t\t\t\tgradient ||\n\t\t\t\t\tstyle?.color?.background ||\n\t\t\t\t\tstyle?.color?.gradient\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: 50;\n\n\t\t\t\t// Move the background or gradient color to the parent Cover block.\n\t\t\t\tconst parentAttributes = {\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t\tdimRatio,\n\t\t\t\t\toverlayColor: backgroundColor,\n\t\t\t\t\tcustomOverlayColor: style?.color?.background,\n\t\t\t\t\tgradient,\n\t\t\t\t\tcustomGradient: style?.color?.gradient,\n\t\t\t\t};\n\n\t\t\t\tconst attributesWithoutBackgroundColors = {\n\t\t\t\t\t...attributes,\n\t\t\t\t\tbackgroundColor: undefined,\n\t\t\t\t\tgradient: undefined,\n\t\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t\t...attributes?.style,\n\t\t\t\t\t\tcolor: style?.color\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\t\t\tbackground: undefined,\n\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t} ),\n\t\t\t\t};\n\n\t\t\t\t// Preserve the block by nesting it within the Cover block,\n\t\t\t\t// instead of converting the Group block directly to the Cover block.\n\t\t\t\treturn createBlock( 'core/cover', parentAttributes, [\n\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\tattributesWithoutBackgroundColors,\n\t\t\t\t\t\tinnerBlocks\n\t\t\t\t\t),\n\t\t\t\t] );\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\tisMatch: ( {\n\t\t\t\tbackgroundType,\n\t\t\t\turl,\n\t\t\t\toverlayColor,\n\t\t\t\tcustomOverlayColor,\n\t\t\t\tgradient,\n\t\t\t\tcustomGradient,\n\t\t\t} ) => {\n\t\t\t\tif ( url ) {\n\t\t\t\t\t// If a url exists the transform could happen if that URL represents an image background.\n\t\t\t\t\treturn backgroundType === IMAGE_BACKGROUND_TYPE;\n\t\t\t\t}\n\t\t\t\t// If a url is not set the transform could happen if the cover has no background color or gradient;\n\t\t\t\treturn (\n\t\t\t\t\t! overlayColor &&\n\t\t\t\t\t! customOverlayColor &&\n\t\t\t\t\t! gradient &&\n\t\t\t\t\t! customGradient\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform: ( { title, url, alt, align, id, anchor, style } ) =>\n\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\tcaption: title,\n\t\t\t\t\turl,\n\t\t\t\t\talt,\n\t\t\t\t\talign,\n\t\t\t\t\tid,\n\t\t\t\t\tanchor,\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\tduotone: style?.color?.duotone,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t} ),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/video' ],\n\t\t\tisMatch: ( {\n\t\t\t\tbackgroundType,\n\t\t\t\turl,\n\t\t\t\toverlayColor,\n\t\t\t\tcustomOverlayColor,\n\t\t\t\tgradient,\n\t\t\t\tcustomGradient,\n\t\t\t} ) => {\n\t\t\t\tif ( url ) {\n\t\t\t\t\t// If a url exists the transform could happen if that URL represents a video background.\n\t\t\t\t\treturn backgroundType === VIDEO_BACKGROUND_TYPE;\n\t\t\t\t}\n\t\t\t\t// If a url is not set the transform could happen if the cover has no background color or gradient;\n\t\t\t\treturn (\n\t\t\t\t\t! overlayColor &&\n\t\t\t\t\t! customOverlayColor &&\n\t\t\t\t\t! gradient &&\n\t\t\t\t\t! customGradient\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform: ( { title, url, align, id, anchor } ) =>\n\t\t\t\tcreateBlock( 'core/video', {\n\t\t\t\t\tcaption: title,\n\t\t\t\t\tsrc: url,\n\t\t\t\t\tid,\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t} ),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/group' ],\n\t\t\tisMatch: ( { url } ) => {\n\t\t\t\t// If the Cover block uses background media, skip this transform,\n\t\t\t\t// and instead use the Group block's default transform.\n\t\t\t\tif ( url ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\ttransform: ( attributes, innerBlocks ) => {\n\t\t\t\t// Convert Cover overlay colors to comparable Group background colors.\n\t\t\t\tconst transformedColorAttributes = {\n\t\t\t\t\tbackgroundColor: attributes?.overlayColor,\n\t\t\t\t\tgradient: attributes?.gradient,\n\t\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t\t...attributes?.style,\n\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\tattributes?.customOverlayColor ||\n\t\t\t\t\t\t\tattributes?.customGradient ||\n\t\t\t\t\t\t\tattributes?.style?.color\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tbackground:\n\t\t\t\t\t\t\t\t\t\t\tattributes?.customOverlayColor,\n\t\t\t\t\t\t\t\t\t\tgradient: attributes?.customGradient,\n\t\t\t\t\t\t\t\t\t\t...attributes?.style?.color,\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t} ),\n\t\t\t\t};\n\n\t\t\t\t// If the Cover block contains only a single Group block as a direct child,\n\t\t\t\t// then attempt to merge the Cover's background colors with the child Group block,\n\t\t\t\t// and remove the Cover block as the wrapper.\n\t\t\t\tif (\n\t\t\t\t\tinnerBlocks?.length === 1 &&\n\t\t\t\t\tinnerBlocks[ 0 ]?.name === 'core/group'\n\t\t\t\t) {\n\t\t\t\t\tconst groupAttributes = cleanEmptyObject(\n\t\t\t\t\t\tinnerBlocks[ 0 ].attributes || {}\n\t\t\t\t\t);\n\n\t\t\t\t\t// If the Group block contains any kind of background color or gradient,\n\t\t\t\t\t// skip merging Cover background colors, and preserve the Group block's colors.\n\t\t\t\t\tif (\n\t\t\t\t\t\tgroupAttributes?.backgroundColor ||\n\t\t\t\t\t\tgroupAttributes?.gradient ||\n\t\t\t\t\t\tgroupAttributes?.style?.color?.background ||\n\t\t\t\t\t\tgroupAttributes?.style?.color?.gradient\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\tgroupAttributes,\n\t\t\t\t\t\t\tinnerBlocks[ 0 ]?.innerBlocks\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...transformedColorAttributes,\n\t\t\t\t\t\t\t...groupAttributes,\n\t\t\t\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t\t\t\t...groupAttributes?.style,\n\t\t\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\t\t\ttransformedColorAttributes?.style?.color ||\n\t\t\t\t\t\t\t\t\tgroupAttributes?.style?.color\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t...transformedColorAttributes\n\t\t\t\t\t\t\t\t\t\t\t\t\t?.style?.color,\n\t\t\t\t\t\t\t\t\t\t\t\t...groupAttributes?.style\n\t\t\t\t\t\t\t\t\t\t\t\t\t?.color,\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinnerBlocks[ 0 ]?.innerBlocks\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// In all other cases, transform the Cover block directly to a Group block.\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{ ...attributes, ...transformedColorAttributes },\n\t\t\t\t\tinnerBlocks\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = useCoverIsDark;
7
+
8
+ var _colord = require("colord");
9
+
10
+ var _element = require("@wordpress/element");
11
+
12
+ /**
13
+ * External dependencies
14
+ */
15
+
16
+ /**
17
+ * WordPress dependencies
18
+ */
19
+
20
+ /**
21
+ * useCoverIsDark is a hook that returns a boolean variable specifying if the cover
22
+ * background is dark or not.
23
+ *
24
+ * @param {?boolean} initialValue Initial value.
25
+ * @param {?string} url Url of the media background.
26
+ * @param {?number} dimRatio Transparency of the overlay color. If an image and
27
+ * color are set, dimRatio is used to decide what is used
28
+ * for background darkness checking purposes.
29
+ * @param {?string} overlayColor String containing the overlay color value if one exists.
30
+ *
31
+ * @return {boolean} True if the cover background is considered "dark" and false otherwise.
32
+ */
33
+ function useCoverIsDark() {
34
+ let initialValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
35
+ let url = arguments.length > 1 ? arguments[1] : undefined;
36
+ let dimRatio = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
37
+ let overlayColor = arguments.length > 3 ? arguments[3] : undefined;
38
+ const [isDark, setIsDark] = (0, _element.useState)(initialValue);
39
+ (0, _element.useEffect)(() => {
40
+ // If opacity is greater than 50 the dominant color is the overlay color,
41
+ // so use that color for the dark mode computation.
42
+ if (dimRatio > 50 || !url) {
43
+ if (!overlayColor) {
44
+ // If no overlay color exists the overlay color is black (isDark )
45
+ setIsDark(true);
46
+ return;
47
+ }
48
+
49
+ setIsDark((0, _colord.colord)(overlayColor).isDark());
50
+ }
51
+ }, [overlayColor, dimRatio > 50 || !url, setIsDark]);
52
+ (0, _element.useEffect)(() => {
53
+ if (!url && !overlayColor) {
54
+ // Reset isDark.
55
+ setIsDark(false);
56
+ }
57
+ }, [!url && !overlayColor, setIsDark]);
58
+ return isDark;
59
+ }
60
+ //# sourceMappingURL=use-cover-is-dark.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-library/src/cover/use-cover-is-dark.native.js"],"names":["useCoverIsDark","initialValue","url","dimRatio","overlayColor","isDark","setIsDark"],"mappings":";;;;;;;AAIA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAT,GAKb;AAAA,MAJDC,YAIC,uEAJc,KAId;AAAA,MAHDC,GAGC;AAAA,MAFDC,QAEC,uEAFU,EAEV;AAAA,MADDC,YACC;AACD,QAAM,CAAEC,MAAF,EAAUC,SAAV,IAAwB,uBAAUL,YAAV,CAA9B;AACA,0BAAW,MAAM;AAChB;AACA;AACA,QAAKE,QAAQ,GAAG,EAAX,IAAiB,CAAED,GAAxB,EAA8B;AAC7B,UAAK,CAAEE,YAAP,EAAsB;AACrB;AACAE,QAAAA,SAAS,CAAE,IAAF,CAAT;AACA;AACA;;AACDA,MAAAA,SAAS,CAAE,oBAAQF,YAAR,EAAuBC,MAAvB,EAAF,CAAT;AACA;AACD,GAXD,EAWG,CAAED,YAAF,EAAgBD,QAAQ,GAAG,EAAX,IAAiB,CAAED,GAAnC,EAAwCI,SAAxC,CAXH;AAYA,0BAAW,MAAM;AAChB,QAAK,CAAEJ,GAAF,IAAS,CAAEE,YAAhB,EAA+B;AAC9B;AACAE,MAAAA,SAAS,CAAE,KAAF,CAAT;AACA;AACD,GALD,EAKG,CAAE,CAAEJ,GAAF,IAAS,CAAEE,YAAb,EAA2BE,SAA3B,CALH;AAMA,SAAOD,MAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\n\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * useCoverIsDark is a hook that returns a boolean variable specifying if the cover\n * background is dark or not.\n *\n * @param {?boolean} initialValue Initial value.\n * @param {?string} url Url of the media background.\n * @param {?number} dimRatio Transparency of the overlay color. If an image and\n * color are set, dimRatio is used to decide what is used\n * for background darkness checking purposes.\n * @param {?string} overlayColor String containing the overlay color value if one exists.\n *\n * @return {boolean} True if the cover background is considered \"dark\" and false otherwise.\n */\nexport default function useCoverIsDark(\n\tinitialValue = false,\n\turl,\n\tdimRatio = 50,\n\toverlayColor\n) {\n\tconst [ isDark, setIsDark ] = useState( initialValue );\n\tuseEffect( () => {\n\t\t// If opacity is greater than 50 the dominant color is the overlay color,\n\t\t// so use that color for the dark mode computation.\n\t\tif ( dimRatio > 50 || ! url ) {\n\t\t\tif ( ! overlayColor ) {\n\t\t\t\t// If no overlay color exists the overlay color is black (isDark )\n\t\t\t\tsetIsDark( true );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsDark( colord( overlayColor ).isDark() );\n\t\t}\n\t}, [ overlayColor, dimRatio > 50 || ! url, setIsDark ] );\n\tuseEffect( () => {\n\t\tif ( ! url && ! overlayColor ) {\n\t\t\t// Reset isDark.\n\t\t\tsetIsDark( false );\n\t\t}\n\t}, [ ! url && ! overlayColor, setIsDark ] );\n\treturn isDark;\n}\n"]}
@@ -111,17 +111,15 @@ const EmbedEdit = props => {
111
111
  };
112
112
  }, [attributesUrl]);
113
113
  /**
114
- * @return {Object} Attributes derived from the preview, merged with the current attributes.
114
+ * Returns the attributes derived from the preview, merged with the current attributes.
115
+ *
116
+ * @param {boolean} ignorePreviousClassName Determines if the previous className attribute should be ignored when merging.
117
+ * @return {Object} Merged attributes.
115
118
  */
116
119
 
117
- const getMergedAttributes = () => {
118
- const {
119
- allowResponsive,
120
- className
121
- } = attributes;
122
- return { ...attributes,
123
- ...(0, _util.getAttributesFromPreview)(preview, title, className, responsive, allowResponsive)
124
- };
120
+ const getMergedAttributes = function () {
121
+ let ignorePreviousClassName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
122
+ return (0, _util.getMergedAttributesWithPreview)(attributes, preview, title, responsive, ignorePreviousClassName);
125
123
  };
126
124
 
127
125
  const toggleResponsive = () => {
@@ -156,15 +154,11 @@ const EmbedEdit = props => {
156
154
 
157
155
  (0, _element.useEffect)(() => {
158
156
  if (preview && !isEditingURL) {
159
- // Even though we set attributes that get derived from the preview,
160
- // we don't access them directly because for the initial render,
161
- // the `setAttributes` call will not have taken effect. If we're
162
- // rendering responsive content, setting the responsive classes
163
- // after the preview has been rendered can result in unwanted
164
- // clipping or scrollbars. The `getAttributesFromPreview` function
165
- // that `getMergedAttributes` uses is memoized so that we're not
166
- // calculating them on every render.
167
- setAttributes(getMergedAttributes());
157
+ // When obtaining an incoming preview, we set the attributes derived from
158
+ // the preview data. In this case when getting the merged attributes,
159
+ // we ignore the previous classname because it might not match the expected
160
+ // classes by the new preview.
161
+ setAttributes(getMergedAttributes(true));
168
162
 
169
163
  if (onReplace) {
170
164
  const upgradedBlock = (0, _util.createUpgradedEmbedBlock)(props, getMergedAttributes());