@wordpress/block-library 11.0.2-next.v.202609171837.0 → 11.2.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 (686) hide show
  1. package/CHANGELOG.md +44 -1
  2. package/build/accordion/block.json +4 -1
  3. package/build/accordion-heading/block.json +1 -0
  4. package/build/accordion-item/block.json +7 -1
  5. package/build/accordion-panel/block.json +9 -1
  6. package/build/archives/block.json +12 -0
  7. package/build/audio/block.json +8 -0
  8. package/build/audio/edit.cjs +2 -1
  9. package/build/audio/edit.cjs.map +2 -2
  10. package/build/avatar/block.json +4 -0
  11. package/build/avatar/edit.cjs +31 -1
  12. package/build/avatar/edit.cjs.map +3 -3
  13. package/build/breadcrumbs/block.json +3 -0
  14. package/build/breadcrumbs/edit.cjs.map +3 -3
  15. package/build/button/block.json +6 -0
  16. package/build/button/edit.cjs +9 -6
  17. package/build/button/edit.cjs.map +2 -2
  18. package/build/buttons/block.json +15 -1
  19. package/build/categories/block.json +12 -1
  20. package/build/code/block.json +13 -0
  21. package/build/column/block.json +9 -0
  22. package/build/column/edit.cjs +5 -0
  23. package/build/column/edit.cjs.map +2 -2
  24. package/build/columns/block.json +13 -0
  25. package/build/columns/edit.cjs +21 -112
  26. package/build/columns/edit.cjs.map +3 -3
  27. package/build/comment-author-name/block.json +3 -0
  28. package/build/comment-content/block.json +5 -0
  29. package/build/comment-date/block.json +3 -0
  30. package/build/comment-edit-link/block.json +3 -0
  31. package/build/comment-reply-link/block.json +3 -0
  32. package/build/comments/block.json +10 -0
  33. package/build/comments/edit/placeholder.cjs +95 -87
  34. package/build/comments/edit/placeholder.cjs.map +2 -2
  35. package/build/comments-pagination/block.json +14 -0
  36. package/build/comments-pagination-next/block.json +3 -0
  37. package/build/comments-pagination-numbers/block.json +3 -0
  38. package/build/comments-pagination-previous/block.json +6 -0
  39. package/build/comments-title/block.json +3 -0
  40. package/build/cover/block.json +2 -1
  41. package/build/cover/edit/index.cjs +30 -6
  42. package/build/cover/edit/index.cjs.map +2 -2
  43. package/build/cover/edit/inspector-controls.cjs +56 -14
  44. package/build/cover/edit/inspector-controls.cjs.map +2 -2
  45. package/build/cover/embed-video-utils.cjs +9 -8
  46. package/build/cover/embed-video-utils.cjs.map +2 -2
  47. package/build/cover/view.cjs +21 -0
  48. package/build/cover/view.cjs.map +7 -0
  49. package/build/details/block.json +14 -0
  50. package/build/embed/block.json +6 -1
  51. package/build/file/block.json +14 -0
  52. package/build/footnotes/block.json +13 -0
  53. package/build/gallery/block.json +22 -0
  54. package/build/gallery/dynamic-gallery.cjs +32 -93
  55. package/build/gallery/dynamic-gallery.cjs.map +3 -3
  56. package/build/gallery/edit.cjs +104 -42
  57. package/build/gallery/edit.cjs.map +2 -2
  58. package/build/gallery/order-controls.cjs +107 -0
  59. package/build/gallery/order-controls.cjs.map +7 -0
  60. package/build/gallery/order-images.cjs +92 -0
  61. package/build/gallery/order-images.cjs.map +7 -0
  62. package/build/gallery/order-options.cjs +62 -0
  63. package/build/gallery/order-options.cjs.map +7 -0
  64. package/build/gallery/use-dynamic-gallery.cjs +1 -7
  65. package/build/gallery/use-dynamic-gallery.cjs.map +2 -2
  66. package/build/gallery/use-get-media.cjs +2 -3
  67. package/build/gallery/use-get-media.cjs.map +2 -2
  68. package/build/group/block.json +1 -0
  69. package/build/group/edit.cjs +3 -3
  70. package/build/group/edit.cjs.map +2 -2
  71. package/build/heading/block.json +14 -0
  72. package/build/home-link/block.json +30 -0
  73. package/build/home-link/edit.cjs.map +3 -3
  74. package/build/icon/components/custom-inserter/index.cjs +3 -1
  75. package/build/icon/components/custom-inserter/index.cjs.map +2 -2
  76. package/build/icon/edit.cjs +49 -5
  77. package/build/icon/edit.cjs.map +2 -2
  78. package/build/image/image.cjs +10 -8
  79. package/build/image/image.cjs.map +3 -3
  80. package/build/image/use-open-image-media-editor-modal.cjs +32 -8
  81. package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
  82. package/build/image/view.cjs +44 -50
  83. package/build/image/view.cjs.map +2 -2
  84. package/build/latest-comments/block.json +20 -0
  85. package/build/latest-posts/block.json +14 -0
  86. package/build/list/block.json +12 -1
  87. package/build/list-item/block.json +8 -1
  88. package/build/list-item/index.cjs +4 -0
  89. package/build/list-item/index.cjs.map +3 -3
  90. package/build/loginout/block.json +14 -0
  91. package/build/math/block.json +14 -0
  92. package/build/media-text/block.json +19 -0
  93. package/build/navigation/edit/index.cjs +1 -4
  94. package/build/navigation/edit/index.cjs.map +2 -2
  95. package/build/navigation-link/link-ui/index.cjs +33 -19
  96. package/build/navigation-link/link-ui/index.cjs.map +2 -2
  97. package/build/navigation-link/link-ui/page-creator.cjs.map +3 -3
  98. package/build/navigation-link/shared/controls.cjs.map +3 -3
  99. package/build/navigation-link/shared/index.cjs +5 -0
  100. package/build/navigation-link/shared/index.cjs.map +2 -2
  101. package/build/navigation-link/shared/use-block-suggestions.cjs +141 -0
  102. package/build/navigation-link/shared/use-block-suggestions.cjs.map +7 -0
  103. package/build/navigation-link/shared/use-link-preview.cjs +13 -13
  104. package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
  105. package/build/navigation-overlay-close/block.json +7 -0
  106. package/build/navigation-submenu/block.json +6 -0
  107. package/build/navigation-submenu/edit.cjs +9 -1
  108. package/build/navigation-submenu/edit.cjs.map +3 -3
  109. package/build/page-list/block.json +14 -0
  110. package/build/paragraph/block.json +1 -0
  111. package/build/paragraph/edit.cjs +1 -2
  112. package/build/paragraph/edit.cjs.map +2 -2
  113. package/build/playlist/block.json +1 -0
  114. package/build/post-author-biography/block.json +5 -0
  115. package/build/post-author-name/block.json +5 -0
  116. package/build/post-comments-count/block.json +3 -0
  117. package/build/post-comments-form/block.json +15 -0
  118. package/build/post-content/block.json +4 -1
  119. package/build/post-date/block.json +3 -0
  120. package/build/post-excerpt/block.json +9 -0
  121. package/build/post-featured-image/block.json +1 -0
  122. package/build/post-featured-image/edit.cjs +12 -10
  123. package/build/post-featured-image/edit.cjs.map +2 -2
  124. package/build/post-navigation-link/block.json +30 -0
  125. package/build/post-navigation-link/edit.cjs +13 -2
  126. package/build/post-navigation-link/edit.cjs.map +3 -3
  127. package/build/post-template/block.json +13 -1
  128. package/build/post-terms/block.json +10 -0
  129. package/build/post-time-to-read/block.json +10 -0
  130. package/build/post-title/block.json +14 -0
  131. package/build/preformatted/block.json +11 -0
  132. package/build/pullquote/block.json +3 -1
  133. package/build/query-no-results/block.json +14 -2
  134. package/build/query-pagination/block.json +20 -0
  135. package/build/query-pagination-next/block.json +3 -0
  136. package/build/query-pagination-numbers/block.json +3 -0
  137. package/build/query-pagination-previous/block.json +3 -0
  138. package/build/query-title/block.json +3 -0
  139. package/build/query-total/block.json +10 -0
  140. package/build/quote/block.json +3 -0
  141. package/build/read-more/block.json +11 -0
  142. package/build/rss/block.json +10 -0
  143. package/build/search/block.json +2 -1
  144. package/build/site-tagline/block.json +12 -1
  145. package/build/site-title/block.json +11 -1
  146. package/build/social-links/block.json +4 -0
  147. package/build/social-links/edit.cjs +2 -3
  148. package/build/social-links/edit.cjs.map +2 -2
  149. package/build/tab-list/block.json +4 -0
  150. package/build/tab-list/edit.cjs +3 -1
  151. package/build/tab-list/edit.cjs.map +3 -3
  152. package/build/tab-list/save.cjs +3 -1
  153. package/build/tab-list/save.cjs.map +3 -3
  154. package/build/tab-panel/block.json +25 -0
  155. package/build/tab-panel/controls.cjs.map +3 -3
  156. package/build/tab-panels/block.json +21 -1
  157. package/build/table-of-contents/block.json +7 -0
  158. package/build/tabs/block.json +27 -1
  159. package/build/tag-cloud/block.json +19 -0
  160. package/build/template-part/edit/selection-modal.cjs.map +1 -1
  161. package/build/term-count/block.json +12 -0
  162. package/build/term-description/block.json +13 -0
  163. package/build/term-name/block.json +16 -1
  164. package/build/term-template/block.json +14 -1
  165. package/build/utils/search-patterns.cjs +7 -43
  166. package/build/utils/search-patterns.cjs.map +3 -3
  167. package/build/utils/style-state.cjs +4 -6
  168. package/build/utils/style-state.cjs.map +2 -2
  169. package/build/utils/waveform-utils.cjs +2 -2
  170. package/build/utils/waveform-utils.cjs.map +2 -2
  171. package/build/verse/block.json +4 -0
  172. package/build/video/block.json +12 -0
  173. package/build/video/edit.cjs +30 -14
  174. package/build/video/edit.cjs.map +3 -3
  175. package/build/video/index.cjs +0 -2
  176. package/build/video/index.cjs.map +3 -3
  177. package/build/video/save.cjs +5 -1
  178. package/build/video/save.cjs.map +3 -3
  179. package/build-module/accordion/block.json +4 -1
  180. package/build-module/accordion-heading/block.json +1 -0
  181. package/build-module/accordion-item/block.json +7 -1
  182. package/build-module/accordion-panel/block.json +9 -1
  183. package/build-module/archives/block.json +12 -0
  184. package/build-module/audio/block.json +8 -0
  185. package/build-module/audio/edit.mjs +2 -1
  186. package/build-module/audio/edit.mjs.map +2 -2
  187. package/build-module/avatar/block.json +4 -0
  188. package/build-module/avatar/edit.mjs +33 -2
  189. package/build-module/avatar/edit.mjs.map +2 -2
  190. package/build-module/breadcrumbs/block.json +3 -0
  191. package/build-module/breadcrumbs/edit.mjs +3 -3
  192. package/build-module/breadcrumbs/edit.mjs.map +2 -2
  193. package/build-module/button/block.json +6 -0
  194. package/build-module/button/edit.mjs +11 -7
  195. package/build-module/button/edit.mjs.map +2 -2
  196. package/build-module/buttons/block.json +15 -1
  197. package/build-module/categories/block.json +12 -1
  198. package/build-module/code/block.json +13 -0
  199. package/build-module/column/block.json +9 -0
  200. package/build-module/column/edit.mjs +5 -0
  201. package/build-module/column/edit.mjs.map +2 -2
  202. package/build-module/columns/block.json +13 -0
  203. package/build-module/columns/edit.mjs +22 -122
  204. package/build-module/columns/edit.mjs.map +2 -2
  205. package/build-module/comment-author-name/block.json +3 -0
  206. package/build-module/comment-content/block.json +5 -0
  207. package/build-module/comment-date/block.json +3 -0
  208. package/build-module/comment-edit-link/block.json +3 -0
  209. package/build-module/comment-reply-link/block.json +3 -0
  210. package/build-module/comments/block.json +10 -0
  211. package/build-module/comments/edit/placeholder.mjs +95 -87
  212. package/build-module/comments/edit/placeholder.mjs.map +2 -2
  213. package/build-module/comments-pagination/block.json +14 -0
  214. package/build-module/comments-pagination-next/block.json +3 -0
  215. package/build-module/comments-pagination-numbers/block.json +3 -0
  216. package/build-module/comments-pagination-previous/block.json +6 -0
  217. package/build-module/comments-title/block.json +3 -0
  218. package/build-module/cover/block.json +2 -1
  219. package/build-module/cover/edit/index.mjs +36 -7
  220. package/build-module/cover/edit/index.mjs.map +2 -2
  221. package/build-module/cover/edit/inspector-controls.mjs +62 -16
  222. package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
  223. package/build-module/cover/embed-video-utils.mjs +9 -8
  224. package/build-module/cover/embed-video-utils.mjs.map +2 -2
  225. package/build-module/cover/view.mjs +19 -0
  226. package/build-module/cover/view.mjs.map +7 -0
  227. package/build-module/details/block.json +14 -0
  228. package/build-module/embed/block.json +6 -1
  229. package/build-module/file/block.json +14 -0
  230. package/build-module/footnotes/block.json +13 -0
  231. package/build-module/gallery/block.json +22 -0
  232. package/build-module/gallery/dynamic-gallery.mjs +33 -97
  233. package/build-module/gallery/dynamic-gallery.mjs.map +2 -2
  234. package/build-module/gallery/edit.mjs +111 -44
  235. package/build-module/gallery/edit.mjs.map +2 -2
  236. package/build-module/gallery/order-controls.mjs +87 -0
  237. package/build-module/gallery/order-controls.mjs.map +7 -0
  238. package/build-module/gallery/order-images.mjs +66 -0
  239. package/build-module/gallery/order-images.mjs.map +7 -0
  240. package/build-module/gallery/order-options.mjs +33 -0
  241. package/build-module/gallery/order-options.mjs.map +7 -0
  242. package/build-module/gallery/use-dynamic-gallery.mjs +1 -7
  243. package/build-module/gallery/use-dynamic-gallery.mjs.map +2 -2
  244. package/build-module/gallery/use-get-media.mjs +2 -3
  245. package/build-module/gallery/use-get-media.mjs.map +2 -2
  246. package/build-module/group/block.json +1 -0
  247. package/build-module/group/edit.mjs +4 -4
  248. package/build-module/group/edit.mjs.map +2 -2
  249. package/build-module/heading/block.json +14 -0
  250. package/build-module/home-link/block.json +30 -0
  251. package/build-module/home-link/edit.mjs +2 -2
  252. package/build-module/home-link/edit.mjs.map +2 -2
  253. package/build-module/icon/components/custom-inserter/index.mjs +3 -1
  254. package/build-module/icon/components/custom-inserter/index.mjs.map +2 -2
  255. package/build-module/icon/edit.mjs +50 -6
  256. package/build-module/icon/edit.mjs.map +2 -2
  257. package/build-module/image/image.mjs +12 -10
  258. package/build-module/image/image.mjs.map +2 -2
  259. package/build-module/image/use-open-image-media-editor-modal.mjs +32 -8
  260. package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
  261. package/build-module/image/view.mjs +44 -50
  262. package/build-module/image/view.mjs.map +2 -2
  263. package/build-module/latest-comments/block.json +20 -0
  264. package/build-module/latest-posts/block.json +14 -0
  265. package/build-module/list/block.json +12 -1
  266. package/build-module/list-item/block.json +8 -1
  267. package/build-module/list-item/index.mjs +4 -0
  268. package/build-module/list-item/index.mjs.map +2 -2
  269. package/build-module/loginout/block.json +14 -0
  270. package/build-module/math/block.json +14 -0
  271. package/build-module/media-text/block.json +19 -0
  272. package/build-module/navigation/edit/index.mjs +1 -4
  273. package/build-module/navigation/edit/index.mjs.map +2 -2
  274. package/build-module/navigation-link/link-ui/index.mjs +39 -20
  275. package/build-module/navigation-link/link-ui/index.mjs.map +2 -2
  276. package/build-module/navigation-link/link-ui/page-creator.mjs +2 -2
  277. package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
  278. package/build-module/navigation-link/shared/controls.mjs +2 -2
  279. package/build-module/navigation-link/shared/controls.mjs.map +2 -2
  280. package/build-module/navigation-link/shared/index.mjs +6 -0
  281. package/build-module/navigation-link/shared/index.mjs.map +2 -2
  282. package/build-module/navigation-link/shared/use-block-suggestions.mjs +120 -0
  283. package/build-module/navigation-link/shared/use-block-suggestions.mjs.map +7 -0
  284. package/build-module/navigation-link/shared/use-link-preview.mjs +13 -13
  285. package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
  286. package/build-module/navigation-overlay-close/block.json +7 -0
  287. package/build-module/navigation-submenu/block.json +6 -0
  288. package/build-module/navigation-submenu/edit.mjs +11 -2
  289. package/build-module/navigation-submenu/edit.mjs.map +2 -2
  290. package/build-module/page-list/block.json +14 -0
  291. package/build-module/paragraph/block.json +1 -0
  292. package/build-module/paragraph/edit.mjs +1 -2
  293. package/build-module/paragraph/edit.mjs.map +2 -2
  294. package/build-module/playlist/block.json +1 -0
  295. package/build-module/post-author-biography/block.json +5 -0
  296. package/build-module/post-author-name/block.json +5 -0
  297. package/build-module/post-comments-count/block.json +3 -0
  298. package/build-module/post-comments-form/block.json +15 -0
  299. package/build-module/post-content/block.json +4 -1
  300. package/build-module/post-date/block.json +3 -0
  301. package/build-module/post-excerpt/block.json +9 -0
  302. package/build-module/post-featured-image/block.json +1 -0
  303. package/build-module/post-featured-image/edit.mjs +12 -10
  304. package/build-module/post-featured-image/edit.mjs.map +2 -2
  305. package/build-module/post-navigation-link/block.json +30 -0
  306. package/build-module/post-navigation-link/edit.mjs +17 -3
  307. package/build-module/post-navigation-link/edit.mjs.map +2 -2
  308. package/build-module/post-template/block.json +13 -1
  309. package/build-module/post-terms/block.json +10 -0
  310. package/build-module/post-time-to-read/block.json +10 -0
  311. package/build-module/post-title/block.json +14 -0
  312. package/build-module/preformatted/block.json +11 -0
  313. package/build-module/pullquote/block.json +3 -1
  314. package/build-module/query-no-results/block.json +14 -2
  315. package/build-module/query-pagination/block.json +20 -0
  316. package/build-module/query-pagination-next/block.json +3 -0
  317. package/build-module/query-pagination-numbers/block.json +3 -0
  318. package/build-module/query-pagination-previous/block.json +3 -0
  319. package/build-module/query-title/block.json +3 -0
  320. package/build-module/query-total/block.json +10 -0
  321. package/build-module/quote/block.json +3 -0
  322. package/build-module/read-more/block.json +11 -0
  323. package/build-module/rss/block.json +10 -0
  324. package/build-module/search/block.json +2 -1
  325. package/build-module/site-tagline/block.json +12 -1
  326. package/build-module/site-title/block.json +11 -1
  327. package/build-module/social-links/block.json +4 -0
  328. package/build-module/social-links/edit.mjs +2 -3
  329. package/build-module/social-links/edit.mjs.map +2 -2
  330. package/build-module/tab-list/block.json +4 -0
  331. package/build-module/tab-list/edit.mjs +4 -1
  332. package/build-module/tab-list/edit.mjs.map +2 -2
  333. package/build-module/tab-list/save.mjs +4 -1
  334. package/build-module/tab-list/save.mjs.map +2 -2
  335. package/build-module/tab-panel/block.json +25 -0
  336. package/build-module/tab-panel/controls.mjs +2 -2
  337. package/build-module/tab-panel/controls.mjs.map +2 -2
  338. package/build-module/tab-panels/block.json +21 -1
  339. package/build-module/table-of-contents/block.json +7 -0
  340. package/build-module/tabs/block.json +27 -1
  341. package/build-module/tag-cloud/block.json +19 -0
  342. package/build-module/template-part/edit/selection-modal.mjs.map +1 -1
  343. package/build-module/term-count/block.json +12 -0
  344. package/build-module/term-description/block.json +13 -0
  345. package/build-module/term-name/block.json +16 -1
  346. package/build-module/term-template/block.json +14 -1
  347. package/build-module/utils/search-patterns.mjs +7 -32
  348. package/build-module/utils/search-patterns.mjs.map +2 -2
  349. package/build-module/utils/style-state.mjs +6 -4
  350. package/build-module/utils/style-state.mjs.map +2 -2
  351. package/build-module/utils/waveform-utils.mjs +1 -1
  352. package/build-module/utils/waveform-utils.mjs.map +1 -1
  353. package/build-module/verse/block.json +4 -0
  354. package/build-module/video/block.json +12 -0
  355. package/build-module/video/edit.mjs +32 -15
  356. package/build-module/video/edit.mjs.map +2 -2
  357. package/build-module/video/index.mjs +0 -2
  358. package/build-module/video/index.mjs.map +2 -2
  359. package/build-module/video/save.mjs +7 -2
  360. package/build-module/video/save.mjs.map +2 -2
  361. package/build-style/avatar/editor-rtl.css +4 -0
  362. package/build-style/avatar/editor.css +4 -0
  363. package/build-style/comments-pagination/style-rtl.css +3 -0
  364. package/build-style/comments-pagination/style.css +3 -0
  365. package/build-style/common-rtl.css +32 -1
  366. package/build-style/common.css +35 -2
  367. package/build-style/editor-rtl.css +23 -6
  368. package/build-style/editor.css +23 -6
  369. package/build-style/embed/style-rtl.css +4 -1
  370. package/build-style/embed/style.css +4 -1
  371. package/build-style/gallery/editor-rtl.css +1 -3
  372. package/build-style/gallery/editor.css +1 -3
  373. package/build-style/image/editor-rtl.css +6 -0
  374. package/build-style/image/editor.css +6 -0
  375. package/build-style/image/style-rtl.css +11 -2
  376. package/build-style/image/style.css +11 -2
  377. package/build-style/media-text/style-rtl.css +4 -1
  378. package/build-style/media-text/style.css +4 -1
  379. package/build-style/navigation/style-rtl.css +18 -3
  380. package/build-style/navigation/style.css +18 -3
  381. package/build-style/navigation-link/editor-rtl.css +3 -1
  382. package/build-style/navigation-link/editor.css +3 -1
  383. package/build-style/navigation-overlay-close/style-rtl.css +1 -1
  384. package/build-style/navigation-overlay-close/style.css +1 -1
  385. package/build-style/navigation-submenu/editor-rtl.css +3 -1
  386. package/build-style/navigation-submenu/editor.css +3 -1
  387. package/build-style/post-navigation-link/style-rtl.css +3 -0
  388. package/build-style/post-navigation-link/style.css +3 -0
  389. package/build-style/query-pagination/style-rtl.css +3 -0
  390. package/build-style/query-pagination/style.css +3 -0
  391. package/build-style/style-rtl.css +94 -13
  392. package/build-style/style.css +97 -14
  393. package/build-style/tab-panel/style-rtl.css +2 -0
  394. package/build-style/tab-panel/style.css +2 -0
  395. package/build-style/table/editor-rtl.css +6 -1
  396. package/build-style/table/editor.css +6 -1
  397. package/build-style/table/style-rtl.css +4 -2
  398. package/build-style/table/style.css +4 -2
  399. package/build-style/tag-cloud/style-rtl.css +1 -1
  400. package/build-style/tag-cloud/style.css +1 -1
  401. package/build-style/verse/style-rtl.css +8 -1
  402. package/build-style/verse/style.css +8 -1
  403. package/build-types/gallery/order-controls.d.ts +58 -0
  404. package/build-types/gallery/order-controls.d.ts.map +1 -0
  405. package/build-types/gallery/order-options.d.ts +67 -0
  406. package/build-types/gallery/order-options.d.ts.map +1 -0
  407. package/package.json +46 -44
  408. package/src/accordion/README.md +3 -0
  409. package/src/accordion/block.json +4 -1
  410. package/src/accordion-heading/README.md +1 -0
  411. package/src/accordion-heading/block.json +1 -0
  412. package/src/accordion-item/README.md +5 -0
  413. package/src/accordion-item/block.json +7 -1
  414. package/src/accordion-panel/README.md +7 -0
  415. package/src/accordion-panel/block.json +9 -1
  416. package/src/archives/README.md +6 -0
  417. package/src/archives/block.json +12 -0
  418. package/src/audio/README.md +4 -0
  419. package/src/audio/block.json +8 -0
  420. package/src/audio/edit.jsx +2 -1
  421. package/src/avatar/README.md +2 -0
  422. package/src/avatar/block.json +4 -0
  423. package/src/avatar/edit.jsx +48 -2
  424. package/src/avatar/editor.scss +4 -0
  425. package/src/avatar/index.php +5 -3
  426. package/src/breadcrumbs/README.md +2 -0
  427. package/src/breadcrumbs/block.json +3 -0
  428. package/src/breadcrumbs/edit.jsx +3 -3
  429. package/src/breadcrumbs/index.php +1 -1
  430. package/src/button/README.md +4 -0
  431. package/src/button/block.json +6 -0
  432. package/src/button/edit.jsx +47 -52
  433. package/src/button/index.php +47 -0
  434. package/src/buttons/README.md +8 -0
  435. package/src/buttons/block.json +15 -1
  436. package/src/categories/README.md +6 -0
  437. package/src/categories/block.json +12 -1
  438. package/src/code/README.md +7 -0
  439. package/src/code/block.json +13 -0
  440. package/src/column/README.md +4 -0
  441. package/src/column/block.json +9 -0
  442. package/src/column/edit.jsx +6 -0
  443. package/src/columns/README.md +7 -0
  444. package/src/columns/block.json +13 -0
  445. package/src/columns/edit.jsx +1 -131
  446. package/src/comment-author-name/README.md +2 -0
  447. package/src/comment-author-name/block.json +3 -0
  448. package/src/comment-content/README.md +4 -0
  449. package/src/comment-content/block.json +5 -0
  450. package/src/comment-date/README.md +2 -0
  451. package/src/comment-date/block.json +3 -0
  452. package/src/comment-edit-link/README.md +2 -0
  453. package/src/comment-edit-link/block.json +3 -0
  454. package/src/comment-reply-link/README.md +2 -0
  455. package/src/comment-reply-link/block.json +3 -0
  456. package/src/comments/README.md +5 -0
  457. package/src/comments/block.json +10 -0
  458. package/src/comments/edit/placeholder.jsx +5 -1
  459. package/src/comments-pagination/README.md +6 -0
  460. package/src/comments-pagination/block.json +14 -0
  461. package/src/comments-pagination/style.scss +3 -0
  462. package/src/comments-pagination-next/README.md +2 -0
  463. package/src/comments-pagination-next/block.json +3 -0
  464. package/src/comments-pagination-numbers/README.md +2 -0
  465. package/src/comments-pagination-numbers/block.json +3 -0
  466. package/src/comments-pagination-previous/README.md +2 -0
  467. package/src/comments-pagination-previous/block.json +6 -0
  468. package/src/comments-title/README.md +2 -0
  469. package/src/comments-title/block.json +3 -0
  470. package/src/common.scss +38 -0
  471. package/src/cover/README.md +1 -0
  472. package/src/cover/block.json +2 -1
  473. package/src/cover/edit/index.jsx +41 -6
  474. package/src/cover/edit/inspector-controls.jsx +74 -14
  475. package/src/cover/embed-video-utils.js +18 -10
  476. package/src/cover/index.php +44 -15
  477. package/src/cover/test/edit.browser.test.js +200 -4
  478. package/src/cover/test/embed-video-utils.test.js +48 -0
  479. package/src/cover/view.js +22 -0
  480. package/src/details/README.md +8 -0
  481. package/src/details/block.json +14 -0
  482. package/src/embed/README.md +4 -0
  483. package/src/embed/block.json +6 -1
  484. package/src/embed/style.scss +7 -1
  485. package/src/file/README.md +8 -0
  486. package/src/file/block.json +14 -0
  487. package/src/footnotes/README.md +7 -0
  488. package/src/footnotes/block.json +13 -0
  489. package/src/gallery/README.md +17 -0
  490. package/src/gallery/block.json +22 -0
  491. package/src/gallery/dynamic-gallery.jsx +11 -91
  492. package/src/gallery/edit.jsx +147 -49
  493. package/src/gallery/editor.scss +5 -9
  494. package/src/gallery/order-controls.tsx +143 -0
  495. package/src/gallery/order-images.js +111 -0
  496. package/src/gallery/order-options.ts +75 -0
  497. package/src/gallery/test/edit.jsdom.test.js +87 -10
  498. package/src/gallery/test/order-images.js +162 -0
  499. package/src/gallery/use-dynamic-gallery.js +1 -9
  500. package/src/gallery/use-get-media.js +7 -2
  501. package/src/group/README.md +1 -0
  502. package/src/group/block.json +1 -0
  503. package/src/group/edit.jsx +5 -5
  504. package/src/heading/README.md +8 -0
  505. package/src/heading/block.json +14 -0
  506. package/src/home-link/README.md +11 -0
  507. package/src/home-link/block.json +30 -0
  508. package/src/home-link/edit.jsx +2 -2
  509. package/src/icon/components/custom-inserter/index.jsx +5 -1
  510. package/src/icon/edit.jsx +68 -7
  511. package/src/icon/index.php +10 -1
  512. package/src/image/editor.scss +8 -0
  513. package/src/image/image.jsx +13 -11
  514. package/src/image/index.php +3 -4
  515. package/src/image/style.scss +14 -2
  516. package/src/image/test/use-open-image-media-editor-modal.jsdom.test.js +201 -0
  517. package/src/image/use-open-image-media-editor-modal.js +37 -4
  518. package/src/image/view.js +64 -68
  519. package/src/latest-comments/README.md +8 -0
  520. package/src/latest-comments/block.json +20 -0
  521. package/src/latest-posts/README.md +8 -0
  522. package/src/latest-posts/block.json +14 -0
  523. package/src/list/README.md +6 -0
  524. package/src/list/block.json +12 -1
  525. package/src/list-item/README.md +6 -0
  526. package/src/list-item/block.json +8 -1
  527. package/src/list-item/index.js +5 -0
  528. package/src/loginout/README.md +8 -0
  529. package/src/loginout/block.json +14 -0
  530. package/src/math/README.md +8 -0
  531. package/src/math/block.json +14 -0
  532. package/src/media-text/README.md +18 -0
  533. package/src/media-text/block.json +19 -0
  534. package/src/media-text/style.scss +5 -1
  535. package/src/navigation/edit/index.jsx +2 -4
  536. package/src/navigation/style.scss +40 -4
  537. package/src/navigation/test/use-navigation-menu.jsdom.test.js +1 -1
  538. package/src/navigation-link/README.md +1 -1
  539. package/src/navigation-link/editor.scss +6 -1
  540. package/src/navigation-link/link-ui/index.jsx +60 -27
  541. package/src/navigation-link/link-ui/page-creator.jsx +2 -2
  542. package/src/navigation-link/link-ui/test/get-suggestions-query.jsdom.test.js +67 -0
  543. package/src/navigation-link/shared/controls.jsx +2 -2
  544. package/src/navigation-link/shared/index.js +4 -0
  545. package/src/navigation-link/shared/test/use-block-suggestions.jsdom.test.js +158 -0
  546. package/src/navigation-link/shared/test/use-entity-binding.jsdom.test.js +1 -7
  547. package/src/navigation-link/shared/test/use-link-preview.jsdom.test.js +22 -22
  548. package/src/navigation-link/shared/use-block-suggestions.js +192 -0
  549. package/src/navigation-link/shared/use-link-preview.js +15 -14
  550. package/src/navigation-overlay-close/README.md +1 -0
  551. package/src/navigation-overlay-close/block.json +7 -0
  552. package/src/navigation-overlay-close/style.scss +1 -1
  553. package/src/navigation-submenu/README.md +7 -0
  554. package/src/navigation-submenu/block.json +6 -0
  555. package/src/navigation-submenu/edit.jsx +11 -1
  556. package/src/navigation-submenu/editor.scss +6 -1
  557. package/src/navigation-submenu/index.php +11 -0
  558. package/src/page-list/README.md +8 -0
  559. package/src/page-list/block.json +14 -0
  560. package/src/paragraph/README.md +1 -0
  561. package/src/paragraph/block.json +1 -0
  562. package/src/paragraph/edit.jsx +1 -3
  563. package/src/playlist/README.md +1 -0
  564. package/src/playlist/block.json +1 -0
  565. package/src/playlist/test/edit-component.jsdom.test.jsx +11 -11
  566. package/src/playlist-track/test/edit.jsdom.test.jsx +3 -3
  567. package/src/post-author-biography/README.md +4 -0
  568. package/src/post-author-biography/block.json +5 -0
  569. package/src/post-author-name/README.md +4 -0
  570. package/src/post-author-name/block.json +5 -0
  571. package/src/post-comments-count/README.md +2 -0
  572. package/src/post-comments-count/block.json +3 -0
  573. package/src/post-comments-form/README.md +8 -0
  574. package/src/post-comments-form/block.json +15 -0
  575. package/src/post-content/README.md +3 -0
  576. package/src/post-content/block.json +4 -1
  577. package/src/post-date/README.md +2 -0
  578. package/src/post-date/block.json +3 -0
  579. package/src/post-excerpt/README.md +7 -0
  580. package/src/post-excerpt/block.json +9 -0
  581. package/src/post-featured-image/block.json +1 -0
  582. package/src/post-featured-image/edit.jsx +13 -11
  583. package/src/post-navigation-link/README.md +12 -0
  584. package/src/post-navigation-link/block.json +30 -0
  585. package/src/post-navigation-link/edit.jsx +23 -2
  586. package/src/post-navigation-link/index.php +94 -5
  587. package/src/post-navigation-link/style.scss +2 -0
  588. package/src/post-template/README.md +7 -0
  589. package/src/post-template/block.json +13 -1
  590. package/src/post-terms/README.md +8 -0
  591. package/src/post-terms/block.json +10 -0
  592. package/src/post-time-to-read/README.md +8 -0
  593. package/src/post-time-to-read/block.json +10 -0
  594. package/src/post-title/README.md +8 -0
  595. package/src/post-title/block.json +14 -0
  596. package/src/preformatted/README.md +9 -0
  597. package/src/preformatted/block.json +11 -0
  598. package/src/pullquote/README.md +2 -0
  599. package/src/pullquote/block.json +3 -1
  600. package/src/query-no-results/README.md +10 -0
  601. package/src/query-no-results/block.json +14 -2
  602. package/src/query-pagination/README.md +6 -0
  603. package/src/query-pagination/block.json +20 -0
  604. package/src/query-pagination/style.scss +3 -0
  605. package/src/query-pagination-next/README.md +2 -0
  606. package/src/query-pagination-next/block.json +3 -0
  607. package/src/query-pagination-numbers/README.md +2 -0
  608. package/src/query-pagination-numbers/block.json +3 -0
  609. package/src/query-pagination-previous/README.md +2 -0
  610. package/src/query-pagination-previous/block.json +3 -0
  611. package/src/query-title/README.md +2 -0
  612. package/src/query-title/block.json +3 -0
  613. package/src/query-total/README.md +8 -0
  614. package/src/query-total/block.json +10 -0
  615. package/src/quote/README.md +3 -0
  616. package/src/quote/block.json +3 -0
  617. package/src/read-more/README.md +8 -0
  618. package/src/read-more/block.json +11 -0
  619. package/src/rss/README.md +8 -0
  620. package/src/rss/block.json +10 -0
  621. package/src/search/README.md +1 -0
  622. package/src/search/block.json +2 -1
  623. package/src/site-tagline/README.md +9 -0
  624. package/src/site-tagline/block.json +12 -1
  625. package/src/site-title/README.md +8 -0
  626. package/src/site-title/block.json +11 -1
  627. package/src/social-links/README.md +3 -0
  628. package/src/social-links/block.json +4 -0
  629. package/src/social-links/edit.jsx +2 -3
  630. package/src/tab-list/README.md +2 -0
  631. package/src/tab-list/block.json +4 -0
  632. package/src/tab-list/edit.jsx +3 -0
  633. package/src/tab-list/save.jsx +3 -0
  634. package/src/tab-panel/README.md +9 -0
  635. package/src/tab-panel/block.json +25 -0
  636. package/src/tab-panel/controls.jsx +2 -2
  637. package/src/tab-panel/style.scss +5 -2
  638. package/src/tab-panels/README.md +9 -0
  639. package/src/tab-panels/block.json +21 -1
  640. package/src/table/editor.scss +8 -2
  641. package/src/table/style.scss +4 -4
  642. package/src/table-of-contents/README.md +6 -0
  643. package/src/table-of-contents/block.json +7 -0
  644. package/src/tabs/README.md +11 -0
  645. package/src/tabs/block.json +27 -1
  646. package/src/tag-cloud/README.md +9 -0
  647. package/src/tag-cloud/block.json +19 -0
  648. package/src/tag-cloud/style.scss +1 -1
  649. package/src/template-part/edit/selection-modal.jsx +1 -1
  650. package/src/template-part/index.php +16 -3
  651. package/src/term-count/README.md +10 -0
  652. package/src/term-count/block.json +12 -0
  653. package/src/term-description/README.md +8 -0
  654. package/src/term-description/block.json +13 -0
  655. package/src/term-name/README.md +9 -0
  656. package/src/term-name/block.json +16 -1
  657. package/src/term-name/index.php +1 -1
  658. package/src/term-template/README.md +8 -0
  659. package/src/term-template/block.json +14 -1
  660. package/src/utils/search-patterns.js +9 -53
  661. package/src/utils/style-state.js +6 -4
  662. package/src/utils/test/{search-patterns.js → search-patterns.jsdom.test.js} +1 -22
  663. package/src/utils/test/waveform-player-auto-init.jsdom.test.js +25 -0
  664. package/src/utils/test/waveform-player-dependency.jsdom.test.js +7 -60
  665. package/src/utils/test/waveform-utils.browser.test.js +3 -15
  666. package/src/utils/waveform-utils.js +1 -1
  667. package/src/verse/README.md +4 -0
  668. package/src/verse/block.json +4 -0
  669. package/src/verse/style.scss +11 -2
  670. package/src/video/README.md +11 -0
  671. package/src/video/block.json +12 -0
  672. package/src/video/edit.jsx +65 -49
  673. package/src/video/index.js +0 -2
  674. package/src/video/save.jsx +10 -1
  675. package/build/columns/utils.cjs +0 -112
  676. package/build/columns/utils.cjs.map +0 -7
  677. package/build/video/variations.cjs +0 -75
  678. package/build/video/variations.cjs.map +0 -7
  679. package/build-module/columns/utils.mjs +0 -78
  680. package/build-module/columns/utils.mjs.map +0 -7
  681. package/build-module/video/variations.mjs +0 -50
  682. package/build-module/video/variations.mjs.map +0 -7
  683. package/src/columns/test/utils.js +0 -331
  684. package/src/columns/utils.js +0 -176
  685. package/src/video/test/variations.js +0 -63
  686. package/src/video/variations.js +0 -62
@@ -13,9 +13,12 @@ import {
13
13
  MediaReplaceFlow,
14
14
  useBlockProps,
15
15
  useBlockEditingMode,
16
+ __experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,
16
17
  } from '@wordpress/block-editor';
17
18
  import { useRef, useEffect, useState } from '@wordpress/element';
19
+ import { useReducedMotion } from '@wordpress/compose';
18
20
  import { __ } from '@wordpress/i18n';
21
+ import { inertValue } from '@wordpress/react-inert-value';
19
22
  import { useDispatch } from '@wordpress/data';
20
23
  import { video as icon } from '@wordpress/icons';
21
24
  import { store as noticesStore } from '@wordpress/notices';
@@ -30,7 +33,6 @@ import TracksEditor from './tracks-editor';
30
33
  import Tracks from './tracks';
31
34
  import { Caption } from '../utils/caption';
32
35
  import PosterImage from '../utils/poster-image';
33
- import { isGifVariation } from './variations';
34
36
 
35
37
  const ALLOWED_MEDIA_TYPES = [ 'video' ];
36
38
 
@@ -43,8 +45,19 @@ function VideoEdit( {
43
45
  onReplace,
44
46
  } ) {
45
47
  const videoPlayer = useRef();
46
- const { id, controls, poster, src, tracks, width, height } = attributes;
47
- const isGif = isGifVariation( attributes );
48
+ const {
49
+ id,
50
+ controls,
51
+ poster,
52
+ src,
53
+ tracks,
54
+ width,
55
+ height,
56
+ autoplay,
57
+ loop,
58
+ muted,
59
+ playsInline,
60
+ } = attributes;
48
61
  // Give the <video> an explicit (non-`auto`) aspect ratio derived from the
49
62
  // stored dimensions. The width/height attributes alone only yield
50
63
  // `aspect-ratio: auto W/H`, whose `auto` keyword defers to the element's
@@ -54,10 +67,15 @@ function VideoEdit( {
54
67
  // swap. A non-`auto` ratio governs the box height throughout the load.
55
68
  const aspectRatio =
56
69
  width && height ? `${ width } / ${ height }` : undefined;
70
+ const videoStyle = {
71
+ ...( aspectRatio && { aspectRatio } ),
72
+ ...getShadowClassesAndStyles( attributes ).style,
73
+ };
57
74
  const [ temporaryURL, setTemporaryURL ] = useState( attributes.blob );
58
75
  const dropdownMenuProps = useToolsPanelDropdownMenuProps();
59
76
  const blockEditingMode = useBlockEditingMode();
60
77
  const hasNonContentControls = blockEditingMode === 'default';
78
+ const prefersReducedMotion = useReducedMotion();
61
79
 
62
80
  useUploadMediaFromBlobURL( {
63
81
  url: temporaryURL,
@@ -73,17 +91,13 @@ function VideoEdit( {
73
91
  }
74
92
  }, [ poster ] );
75
93
 
76
- // The GIF variation plays like an animated GIF in the editor (the playback
77
- // attributes are applied to the preview <video> below). Regular videos do
78
- // not autoplay in the editor, so only nudge GIFs into playing after a
79
- // source change in case the muted autoplay did not start on its own.
94
+ // `autoPlay` only applies when the video loads, so pause a video that is
95
+ // already playing when the user turns on reduced motion.
80
96
  useEffect( () => {
81
- if ( isGif ) {
82
- // Browsers allow muted videos to be played programmatically.
83
- videoPlayer.current?.play().catch( () => {} );
97
+ if ( prefersReducedMotion ) {
98
+ videoPlayer.current?.pause();
84
99
  }
85
- }, [ isGif, src, poster ] );
86
-
100
+ }, [ prefersReducedMotion ] );
87
101
  // TODO: Whether the video was obtained from the media library or was provided by URL, obtain the `videoWidth` and `videoHeight` of the video once its metadata has loaded and persist in the block attributes.
88
102
  function onSelectVideo( media ) {
89
103
  if ( ! media || ! media.url ) {
@@ -214,52 +228,54 @@ function VideoEdit( {
214
228
  </BlockControls>
215
229
  </>
216
230
  ) }
217
- { ! isGif && (
218
- <InspectorControls>
219
- <ToolsPanel
220
- label={ __( 'Settings' ) }
221
- resetAll={ () => {
231
+ <InspectorControls>
232
+ <ToolsPanel
233
+ label={ __( 'Settings' ) }
234
+ resetAll={ () => {
235
+ setAttributes( {
236
+ autoplay: false,
237
+ controls: true,
238
+ loop: false,
239
+ muted: false,
240
+ playsInline: false,
241
+ preload: 'metadata',
242
+ poster: undefined,
243
+ } );
244
+ } }
245
+ dropdownMenuProps={ dropdownMenuProps }
246
+ >
247
+ <VideoCommonSettings
248
+ setAttributes={ setAttributes }
249
+ attributes={ attributes }
250
+ />
251
+ <PosterImage
252
+ poster={ poster }
253
+ onChange={ ( posterImage ) =>
222
254
  setAttributes( {
223
- autoplay: false,
224
- controls: true,
225
- loop: false,
226
- muted: false,
227
- playsInline: false,
228
- preload: 'metadata',
229
- poster: undefined,
230
- } );
231
- } }
232
- dropdownMenuProps={ dropdownMenuProps }
233
- >
234
- <VideoCommonSettings
235
- setAttributes={ setAttributes }
236
- attributes={ attributes }
237
- />
238
- <PosterImage
239
- poster={ poster }
240
- onChange={ ( posterImage ) =>
241
- setAttributes( {
242
- poster: posterImage?.url,
243
- } )
244
- }
245
- />
246
- </ToolsPanel>
247
- </InspectorControls>
248
- ) }
255
+ poster: posterImage?.url,
256
+ } )
257
+ }
258
+ />
259
+ </ToolsPanel>
260
+ </InspectorControls>
249
261
  <figure { ...blockProps }>
250
262
  <video
251
263
  controls={ controls }
252
- inert={ ! isSingleSelected ? 'true' : undefined }
264
+ inert={ inertValue( ! isSingleSelected ) }
253
265
  poster={ poster }
254
266
  src={ src || temporaryURL }
255
267
  ref={ videoPlayer }
256
- autoPlay={ isGif }
257
- loop={ isGif }
258
- muted={ isGif }
259
- playsInline={ isGif }
268
+ autoPlay={ autoplay && ! prefersReducedMotion }
269
+ loop={ loop }
270
+ muted={ muted }
271
+ playsInline={ playsInline }
260
272
  width={ width }
261
273
  height={ height }
262
- style={ aspectRatio ? { aspectRatio } : undefined }
274
+ style={
275
+ Object.keys( videoStyle ).length
276
+ ? videoStyle
277
+ : undefined
278
+ }
263
279
  >
264
280
  <Tracks tracks={ tracks } />
265
281
  </video>
@@ -6,7 +6,6 @@ import edit from './edit';
6
6
  import metadata from './block.json';
7
7
  import save from './save';
8
8
  import transforms from './transforms';
9
- import variations from './variations';
10
9
 
11
10
  const { name } = metadata;
12
11
 
@@ -22,7 +21,6 @@ export const settings = {
22
21
  },
23
22
  },
24
23
  transforms,
25
- variations,
26
24
  deprecated,
27
25
  edit,
28
26
  save,
@@ -2,6 +2,7 @@ import {
2
2
  RichText,
3
3
  useBlockProps,
4
4
  __experimentalGetElementClassName,
5
+ __experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,
5
6
  } from '@wordpress/block-editor';
6
7
  import Tracks from './tracks';
7
8
 
@@ -27,6 +28,10 @@ export default function save( { attributes } ) {
27
28
  // `aspect-ratio: auto W/H`, whose `auto` keyword is unreliable during load.
28
29
  const aspectRatio =
29
30
  width && height ? `${ width } / ${ height }` : undefined;
31
+ const videoStyle = {
32
+ ...( aspectRatio && { aspectRatio } ),
33
+ ...getShadowClassesAndStyles( attributes ).style,
34
+ };
30
35
  return (
31
36
  <figure { ...useBlockProps.save() }>
32
37
  { src && (
@@ -41,7 +46,11 @@ export default function save( { attributes } ) {
41
46
  playsInline={ playsInline }
42
47
  width={ width }
43
48
  height={ height }
44
- style={ aspectRatio ? { aspectRatio } : undefined }
49
+ style={
50
+ Object.keys( videoStyle ).length
51
+ ? videoStyle
52
+ : undefined
53
+ }
45
54
  >
46
55
  <Tracks tracks={ tracks } />
47
56
  </video>
@@ -1,112 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // packages/block-library/src/columns/utils.js
21
- var utils_exports = {};
22
- __export(utils_exports, {
23
- getColumnWidths: () => getColumnWidths,
24
- getEffectiveColumnWidth: () => getEffectiveColumnWidth,
25
- getMappedColumnWidths: () => getMappedColumnWidths,
26
- getRedistributedColumnWidths: () => getRedistributedColumnWidths,
27
- getTotalColumnsWidth: () => getTotalColumnsWidth,
28
- getWidthWithUnit: () => getWidthWithUnit,
29
- getWidths: () => getWidths,
30
- hasExplicitPercentColumnWidths: () => hasExplicitPercentColumnWidths,
31
- isPercentageUnit: () => isPercentageUnit,
32
- toWidthPrecision: () => toWidthPrecision
33
- });
34
- module.exports = __toCommonJS(utils_exports);
35
- var toWidthPrecision = (value) => {
36
- const unitlessValue = parseFloat(value);
37
- return Number.isFinite(unitlessValue) ? parseFloat(unitlessValue.toFixed(2)) : void 0;
38
- };
39
- function getEffectiveColumnWidth(block, totalBlockCount) {
40
- const { width = 100 / totalBlockCount } = block.attributes;
41
- return toWidthPrecision(width);
42
- }
43
- function getTotalColumnsWidth(blocks, totalBlockCount = blocks.length) {
44
- return blocks.reduce(
45
- (sum, block) => sum + getEffectiveColumnWidth(block, totalBlockCount),
46
- 0
47
- );
48
- }
49
- function getColumnWidths(blocks, totalBlockCount = blocks.length) {
50
- return blocks.reduce((accumulator, block) => {
51
- const width = getEffectiveColumnWidth(block, totalBlockCount);
52
- return Object.assign(accumulator, { [block.clientId]: width });
53
- }, {});
54
- }
55
- function getRedistributedColumnWidths(blocks, availableWidth, totalBlockCount = blocks.length) {
56
- const totalWidth = getTotalColumnsWidth(blocks, totalBlockCount);
57
- return Object.fromEntries(
58
- Object.entries(getColumnWidths(blocks, totalBlockCount)).map(
59
- ([clientId, width]) => {
60
- const newWidth = availableWidth * width / totalWidth;
61
- return [clientId, toWidthPrecision(newWidth)];
62
- }
63
- )
64
- );
65
- }
66
- function hasExplicitPercentColumnWidths(blocks) {
67
- return blocks.every((block) => {
68
- const blockWidth = block.attributes.width;
69
- return Number.isFinite(
70
- blockWidth?.endsWith?.("%") ? parseFloat(blockWidth) : blockWidth
71
- );
72
- });
73
- }
74
- function getMappedColumnWidths(blocks, widths) {
75
- return blocks.map((block) => ({
76
- ...block,
77
- attributes: {
78
- ...block.attributes,
79
- width: `${widths[block.clientId]}%`
80
- }
81
- }));
82
- }
83
- function getWidths(blocks, withParsing = true) {
84
- return blocks.map((innerColumn) => {
85
- const innerColumnWidth = innerColumn.attributes.width || 100 / blocks.length;
86
- return withParsing ? parseFloat(innerColumnWidth) : innerColumnWidth;
87
- });
88
- }
89
- function getWidthWithUnit(width, unit) {
90
- width = 0 > parseFloat(width) ? "0" : width;
91
- if (isPercentageUnit(unit)) {
92
- width = Math.min(width, 100);
93
- }
94
- return `${width}${unit}`;
95
- }
96
- function isPercentageUnit(unit) {
97
- return unit === "%";
98
- }
99
- // Annotate the CommonJS export names for ESM import in node:
100
- 0 && (module.exports = {
101
- getColumnWidths,
102
- getEffectiveColumnWidth,
103
- getMappedColumnWidths,
104
- getRedistributedColumnWidths,
105
- getTotalColumnsWidth,
106
- getWidthWithUnit,
107
- getWidths,
108
- hasExplicitPercentColumnWidths,
109
- isPercentageUnit,
110
- toWidthPrecision
111
- });
112
- //# sourceMappingURL=utils.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/columns/utils.js"],
4
- "sourcesContent": ["/**\n * Returns a column width attribute value rounded to standard precision.\n * Returns `undefined` if the value is not a valid finite number.\n *\n * @param {?number} value Raw value.\n *\n * @return {number} Value rounded to standard precision.\n */\nexport const toWidthPrecision = ( value ) => {\n\tconst unitlessValue = parseFloat( value );\n\treturn Number.isFinite( unitlessValue )\n\t\t? parseFloat( unitlessValue.toFixed( 2 ) )\n\t\t: undefined;\n};\n/**\n * Returns an effective width for a given block. An effective width is equal to\n * its attribute value if set, or a computed value assuming equal distribution.\n *\n * @param {WPBlock} block Block object.\n * @param {number} totalBlockCount Total number of blocks in Columns.\n *\n * @return {number} Effective column width.\n */\nexport function getEffectiveColumnWidth( block, totalBlockCount ) {\n\tconst { width = 100 / totalBlockCount } = block.attributes;\n\treturn toWidthPrecision( width );\n}\n\n/**\n * Returns the total width occupied by the given set of column blocks.\n *\n * @param {WPBlock[]} blocks Block objects.\n * @param {?number} totalBlockCount Total number of blocks in Columns.\n * Defaults to number of blocks passed.\n *\n * @return {number} Total width occupied by blocks.\n */\nexport function getTotalColumnsWidth(\n\tblocks,\n\ttotalBlockCount = blocks.length\n) {\n\treturn blocks.reduce(\n\t\t( sum, block ) =>\n\t\t\tsum + getEffectiveColumnWidth( block, totalBlockCount ),\n\t\t0\n\t);\n}\n\n/**\n * Returns an object of `clientId` → `width` of effective column widths.\n *\n * @param {WPBlock[]} blocks Block objects.\n * @param {?number} totalBlockCount Total number of blocks in Columns.\n * Defaults to number of blocks passed.\n *\n * @return {Object<string,number>} Column widths.\n */\nexport function getColumnWidths( blocks, totalBlockCount = blocks.length ) {\n\treturn blocks.reduce( ( accumulator, block ) => {\n\t\tconst width = getEffectiveColumnWidth( block, totalBlockCount );\n\t\treturn Object.assign( accumulator, { [ block.clientId ]: width } );\n\t}, {} );\n}\n\n/**\n * Returns an object of `clientId` → `width` of column widths as redistributed\n * proportional to their current widths, constrained or expanded to fit within\n * the given available width.\n *\n * @param {WPBlock[]} blocks Block objects.\n * @param {number} availableWidth Maximum width to fit within.\n * @param {?number} totalBlockCount Total number of blocks in Columns.\n * Defaults to number of blocks passed.\n *\n * @return {Object<string,number>} Redistributed column widths.\n */\nexport function getRedistributedColumnWidths(\n\tblocks,\n\tavailableWidth,\n\ttotalBlockCount = blocks.length\n) {\n\tconst totalWidth = getTotalColumnsWidth( blocks, totalBlockCount );\n\n\treturn Object.fromEntries(\n\t\tObject.entries( getColumnWidths( blocks, totalBlockCount ) ).map(\n\t\t\t( [ clientId, width ] ) => {\n\t\t\t\tconst newWidth = ( availableWidth * width ) / totalWidth;\n\t\t\t\treturn [ clientId, toWidthPrecision( newWidth ) ];\n\t\t\t}\n\t\t)\n\t);\n}\n\n/**\n * Returns true if column blocks within the provided set are assigned with\n * explicit widths, or false otherwise.\n *\n * @param {WPBlock[]} blocks Block objects.\n *\n * @return {boolean} Whether columns have explicit widths.\n */\nexport function hasExplicitPercentColumnWidths( blocks ) {\n\treturn blocks.every( ( block ) => {\n\t\tconst blockWidth = block.attributes.width;\n\t\treturn Number.isFinite(\n\t\t\tblockWidth?.endsWith?.( '%' )\n\t\t\t\t? parseFloat( blockWidth )\n\t\t\t\t: blockWidth\n\t\t);\n\t} );\n}\n\n/**\n * Returns a copy of the given set of blocks with new widths assigned from the\n * provided object of redistributed column widths.\n *\n * @param {WPBlock[]} blocks Block objects.\n * @param {Object<string,number>} widths Redistributed column widths.\n *\n * @return {WPBlock[]} blocks Mapped block objects.\n */\nexport function getMappedColumnWidths( blocks, widths ) {\n\treturn blocks.map( ( block ) => ( {\n\t\t...block,\n\t\tattributes: {\n\t\t\t...block.attributes,\n\t\t\twidth: `${ widths[ block.clientId ] }%`,\n\t\t},\n\t} ) );\n}\n\n/**\n * Returns an array with columns widths values, parsed or no depends on `withParsing` flag.\n *\n * @param {WPBlock[]} blocks Block objects.\n * @param {?boolean} withParsing Whether value has to be parsed.\n *\n * @return {Array<number,string>} Column widths.\n */\nexport function getWidths( blocks, withParsing = true ) {\n\treturn blocks.map( ( innerColumn ) => {\n\t\tconst innerColumnWidth =\n\t\t\tinnerColumn.attributes.width || 100 / blocks.length;\n\n\t\treturn withParsing ? parseFloat( innerColumnWidth ) : innerColumnWidth;\n\t} );\n}\n\n/**\n * Returns a column width with unit.\n *\n * @param {string} width Column width.\n * @param {string} unit Column width unit.\n *\n * @return {string} Column width with unit.\n */\nexport function getWidthWithUnit( width, unit ) {\n\twidth = 0 > parseFloat( width ) ? '0' : width;\n\n\tif ( isPercentageUnit( unit ) ) {\n\t\twidth = Math.min( width, 100 );\n\t}\n\n\treturn `${ width }${ unit }`;\n}\n\n/**\n * Returns a boolean whether passed unit is percentage\n *\n * @param {string} unit Column width unit.\n *\n * @return {boolean} \tWhether unit is '%'.\n */\nexport function isPercentageUnit( unit ) {\n\treturn unit === '%';\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,IAAM,mBAAmB,CAAE,UAAW;AAC5C,QAAM,gBAAgB,WAAY,KAAM;AACxC,SAAO,OAAO,SAAU,aAAc,IACnC,WAAY,cAAc,QAAS,CAAE,CAAE,IACvC;AACJ;AAUO,SAAS,wBAAyB,OAAO,iBAAkB;AACjE,QAAM,EAAE,QAAQ,MAAM,gBAAgB,IAAI,MAAM;AAChD,SAAO,iBAAkB,KAAM;AAChC;AAWO,SAAS,qBACf,QACA,kBAAkB,OAAO,QACxB;AACD,SAAO,OAAO;AAAA,IACb,CAAE,KAAK,UACN,MAAM,wBAAyB,OAAO,eAAgB;AAAA,IACvD;AAAA,EACD;AACD;AAWO,SAAS,gBAAiB,QAAQ,kBAAkB,OAAO,QAAS;AAC1E,SAAO,OAAO,OAAQ,CAAE,aAAa,UAAW;AAC/C,UAAM,QAAQ,wBAAyB,OAAO,eAAgB;AAC9D,WAAO,OAAO,OAAQ,aAAa,EAAE,CAAE,MAAM,QAAS,GAAG,MAAM,CAAE;AAAA,EAClE,GAAG,CAAC,CAAE;AACP;AAcO,SAAS,6BACf,QACA,gBACA,kBAAkB,OAAO,QACxB;AACD,QAAM,aAAa,qBAAsB,QAAQ,eAAgB;AAEjE,SAAO,OAAO;AAAA,IACb,OAAO,QAAS,gBAAiB,QAAQ,eAAgB,CAAE,EAAE;AAAA,MAC5D,CAAE,CAAE,UAAU,KAAM,MAAO;AAC1B,cAAM,WAAa,iBAAiB,QAAU;AAC9C,eAAO,CAAE,UAAU,iBAAkB,QAAS,CAAE;AAAA,MACjD;AAAA,IACD;AAAA,EACD;AACD;AAUO,SAAS,+BAAgC,QAAS;AACxD,SAAO,OAAO,MAAO,CAAE,UAAW;AACjC,UAAM,aAAa,MAAM,WAAW;AACpC,WAAO,OAAO;AAAA,MACb,YAAY,WAAY,GAAI,IACzB,WAAY,UAAW,IACvB;AAAA,IACJ;AAAA,EACD,CAAE;AACH;AAWO,SAAS,sBAAuB,QAAQ,QAAS;AACvD,SAAO,OAAO,IAAK,CAAE,WAAa;AAAA,IACjC,GAAG;AAAA,IACH,YAAY;AAAA,MACX,GAAG,MAAM;AAAA,MACT,OAAO,GAAI,OAAQ,MAAM,QAAS,CAAE;AAAA,IACrC;AAAA,EACD,EAAI;AACL;AAUO,SAAS,UAAW,QAAQ,cAAc,MAAO;AACvD,SAAO,OAAO,IAAK,CAAE,gBAAiB;AACrC,UAAM,mBACL,YAAY,WAAW,SAAS,MAAM,OAAO;AAE9C,WAAO,cAAc,WAAY,gBAAiB,IAAI;AAAA,EACvD,CAAE;AACH;AAUO,SAAS,iBAAkB,OAAO,MAAO;AAC/C,UAAQ,IAAI,WAAY,KAAM,IAAI,MAAM;AAExC,MAAK,iBAAkB,IAAK,GAAI;AAC/B,YAAQ,KAAK,IAAK,OAAO,GAAI;AAAA,EAC9B;AAEA,SAAO,GAAI,KAAM,GAAI,IAAK;AAC3B;AASO,SAAS,iBAAkB,MAAO;AACxC,SAAO,SAAS;AACjB;",
6
- "names": []
7
- }
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // packages/block-library/src/video/variations.js
21
- var variations_exports = {};
22
- __export(variations_exports, {
23
- default: () => variations_default,
24
- isGifVariation: () => isGifVariation
25
- });
26
- module.exports = __toCommonJS(variations_exports);
27
- var import_i18n = require("@wordpress/i18n");
28
- var import_icons = require("@wordpress/icons");
29
- var isGifVariation = ({
30
- controls,
31
- loop,
32
- autoplay,
33
- muted,
34
- playsInline
35
- } = {}) => !controls && !!loop && !!autoplay && !!muted && !!playsInline;
36
- var variations = [
37
- {
38
- name: "video",
39
- title: (0, import_i18n.__)("Video"),
40
- description: (0, import_i18n.__)(
41
- "A video with customizable playback and interaction controls."
42
- ),
43
- icon: import_icons.video,
44
- attributes: { controls: true },
45
- isActive: (blockAttributes) => !isGifVariation(blockAttributes),
46
- // Not offered in the inserter; used to label a regular video and to
47
- // switch a GIF back to a standard video.
48
- scope: ["block", "transform"]
49
- },
50
- {
51
- name: "gif",
52
- title: (0, import_i18n.__)("GIF"),
53
- description: (0, import_i18n.__)(
54
- "A muted, looping video that plays automatically like an animated GIF."
55
- ),
56
- icon: import_icons.video,
57
- keywords: [(0, import_i18n.__)("animated"), "gif"],
58
- attributes: {
59
- controls: false,
60
- loop: true,
61
- autoplay: true,
62
- muted: true,
63
- playsInline: true
64
- },
65
- isActive: (blockAttributes) => isGifVariation(blockAttributes),
66
- // Created by converting an uploaded GIF, not inserted directly.
67
- scope: ["block", "transform"]
68
- }
69
- ];
70
- var variations_default = variations;
71
- // Annotate the CommonJS export names for ESM import in node:
72
- 0 && (module.exports = {
73
- isGifVariation
74
- });
75
- //# sourceMappingURL=variations.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/video/variations.js"],
4
- "sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { video as videoIcon } from '@wordpress/icons';\n\n/**\n * Whether a set of Video block attributes describes a GIF-behaving video: a\n * muted, looping, autoplaying, inline video with no controls. An animated GIF\n * uploaded through the editor is converted to a video and presented with these\n * attributes so it plays like the original GIF.\n *\n * @param {Object} attributes Video block attributes.\n * @param {boolean} attributes.controls Whether playback controls are shown.\n * @param {boolean} attributes.loop Whether the video loops.\n * @param {boolean} attributes.autoplay Whether the video autoplays.\n * @param {boolean} attributes.muted Whether the video is muted.\n * @param {boolean} attributes.playsInline Whether the video plays inline.\n *\n * @return {boolean} Whether the attributes describe a GIF-behaving video.\n */\nexport const isGifVariation = ( {\n\tcontrols,\n\tloop,\n\tautoplay,\n\tmuted,\n\tplaysInline,\n} = {} ) => ! controls && !! loop && !! autoplay && !! muted && !! playsInline;\n\nconst variations = [\n\t{\n\t\tname: 'video',\n\t\ttitle: __( 'Video' ),\n\t\tdescription: __(\n\t\t\t'A video with customizable playback and interaction controls.'\n\t\t),\n\t\ticon: videoIcon,\n\t\tattributes: { controls: true },\n\t\tisActive: ( blockAttributes ) => ! isGifVariation( blockAttributes ),\n\t\t// Not offered in the inserter; used to label a regular video and to\n\t\t// switch a GIF back to a standard video.\n\t\tscope: [ 'block', 'transform' ],\n\t},\n\t{\n\t\tname: 'gif',\n\t\ttitle: __( 'GIF' ),\n\t\tdescription: __(\n\t\t\t'A muted, looping video that plays automatically like an animated GIF.'\n\t\t),\n\t\ticon: videoIcon,\n\t\tkeywords: [ __( 'animated' ), 'gif' ],\n\t\tattributes: {\n\t\t\tcontrols: false,\n\t\t\tloop: true,\n\t\t\tautoplay: true,\n\t\t\tmuted: true,\n\t\t\tplaysInline: true,\n\t\t},\n\t\tisActive: ( blockAttributes ) => isGifVariation( blockAttributes ),\n\t\t// Created by converting an uploaded GIF, not inserted directly.\n\t\tscope: [ 'block', 'transform' ],\n\t},\n];\n\nexport default variations;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmB;AACnB,mBAAmC;AAiB5B,IAAM,iBAAiB,CAAE;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,IAAI,CAAC,MAAO,CAAE,YAAY,CAAC,CAAE,QAAQ,CAAC,CAAE,YAAY,CAAC,CAAE,SAAS,CAAC,CAAE;AAEnE,IAAM,aAAa;AAAA,EAClB;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,OAAQ;AAAA,IACnB,iBAAa;AAAA,MACZ;AAAA,IACD;AAAA,IACA,MAAM,aAAAA;AAAA,IACN,YAAY,EAAE,UAAU,KAAK;AAAA,IAC7B,UAAU,CAAE,oBAAqB,CAAE,eAAgB,eAAgB;AAAA;AAAA;AAAA,IAGnE,OAAO,CAAE,SAAS,WAAY;AAAA,EAC/B;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,KAAM;AAAA,IACjB,iBAAa;AAAA,MACZ;AAAA,IACD;AAAA,IACA,MAAM,aAAAA;AAAA,IACN,UAAU,KAAE,gBAAI,UAAW,GAAG,KAAM;AAAA,IACpC,YAAY;AAAA,MACX,UAAU;AAAA,MACV,MAAM;AAAA,MACN,UAAU;AAAA,MACV,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,IACA,UAAU,CAAE,oBAAqB,eAAgB,eAAgB;AAAA;AAAA,IAEjE,OAAO,CAAE,SAAS,WAAY;AAAA,EAC/B;AACD;AAEA,IAAO,qBAAQ;",
6
- "names": ["videoIcon"]
7
- }
@@ -1,78 +0,0 @@
1
- // packages/block-library/src/columns/utils.js
2
- var toWidthPrecision = (value) => {
3
- const unitlessValue = parseFloat(value);
4
- return Number.isFinite(unitlessValue) ? parseFloat(unitlessValue.toFixed(2)) : void 0;
5
- };
6
- function getEffectiveColumnWidth(block, totalBlockCount) {
7
- const { width = 100 / totalBlockCount } = block.attributes;
8
- return toWidthPrecision(width);
9
- }
10
- function getTotalColumnsWidth(blocks, totalBlockCount = blocks.length) {
11
- return blocks.reduce(
12
- (sum, block) => sum + getEffectiveColumnWidth(block, totalBlockCount),
13
- 0
14
- );
15
- }
16
- function getColumnWidths(blocks, totalBlockCount = blocks.length) {
17
- return blocks.reduce((accumulator, block) => {
18
- const width = getEffectiveColumnWidth(block, totalBlockCount);
19
- return Object.assign(accumulator, { [block.clientId]: width });
20
- }, {});
21
- }
22
- function getRedistributedColumnWidths(blocks, availableWidth, totalBlockCount = blocks.length) {
23
- const totalWidth = getTotalColumnsWidth(blocks, totalBlockCount);
24
- return Object.fromEntries(
25
- Object.entries(getColumnWidths(blocks, totalBlockCount)).map(
26
- ([clientId, width]) => {
27
- const newWidth = availableWidth * width / totalWidth;
28
- return [clientId, toWidthPrecision(newWidth)];
29
- }
30
- )
31
- );
32
- }
33
- function hasExplicitPercentColumnWidths(blocks) {
34
- return blocks.every((block) => {
35
- const blockWidth = block.attributes.width;
36
- return Number.isFinite(
37
- blockWidth?.endsWith?.("%") ? parseFloat(blockWidth) : blockWidth
38
- );
39
- });
40
- }
41
- function getMappedColumnWidths(blocks, widths) {
42
- return blocks.map((block) => ({
43
- ...block,
44
- attributes: {
45
- ...block.attributes,
46
- width: `${widths[block.clientId]}%`
47
- }
48
- }));
49
- }
50
- function getWidths(blocks, withParsing = true) {
51
- return blocks.map((innerColumn) => {
52
- const innerColumnWidth = innerColumn.attributes.width || 100 / blocks.length;
53
- return withParsing ? parseFloat(innerColumnWidth) : innerColumnWidth;
54
- });
55
- }
56
- function getWidthWithUnit(width, unit) {
57
- width = 0 > parseFloat(width) ? "0" : width;
58
- if (isPercentageUnit(unit)) {
59
- width = Math.min(width, 100);
60
- }
61
- return `${width}${unit}`;
62
- }
63
- function isPercentageUnit(unit) {
64
- return unit === "%";
65
- }
66
- export {
67
- getColumnWidths,
68
- getEffectiveColumnWidth,
69
- getMappedColumnWidths,
70
- getRedistributedColumnWidths,
71
- getTotalColumnsWidth,
72
- getWidthWithUnit,
73
- getWidths,
74
- hasExplicitPercentColumnWidths,
75
- isPercentageUnit,
76
- toWidthPrecision
77
- };
78
- //# sourceMappingURL=utils.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/columns/utils.js"],
4
- "sourcesContent": ["/**\n * Returns a column width attribute value rounded to standard precision.\n * Returns `undefined` if the value is not a valid finite number.\n *\n * @param {?number} value Raw value.\n *\n * @return {number} Value rounded to standard precision.\n */\nexport const toWidthPrecision = ( value ) => {\n\tconst unitlessValue = parseFloat( value );\n\treturn Number.isFinite( unitlessValue )\n\t\t? parseFloat( unitlessValue.toFixed( 2 ) )\n\t\t: undefined;\n};\n/**\n * Returns an effective width for a given block. An effective width is equal to\n * its attribute value if set, or a computed value assuming equal distribution.\n *\n * @param {WPBlock} block Block object.\n * @param {number} totalBlockCount Total number of blocks in Columns.\n *\n * @return {number} Effective column width.\n */\nexport function getEffectiveColumnWidth( block, totalBlockCount ) {\n\tconst { width = 100 / totalBlockCount } = block.attributes;\n\treturn toWidthPrecision( width );\n}\n\n/**\n * Returns the total width occupied by the given set of column blocks.\n *\n * @param {WPBlock[]} blocks Block objects.\n * @param {?number} totalBlockCount Total number of blocks in Columns.\n * Defaults to number of blocks passed.\n *\n * @return {number} Total width occupied by blocks.\n */\nexport function getTotalColumnsWidth(\n\tblocks,\n\ttotalBlockCount = blocks.length\n) {\n\treturn blocks.reduce(\n\t\t( sum, block ) =>\n\t\t\tsum + getEffectiveColumnWidth( block, totalBlockCount ),\n\t\t0\n\t);\n}\n\n/**\n * Returns an object of `clientId` → `width` of effective column widths.\n *\n * @param {WPBlock[]} blocks Block objects.\n * @param {?number} totalBlockCount Total number of blocks in Columns.\n * Defaults to number of blocks passed.\n *\n * @return {Object<string,number>} Column widths.\n */\nexport function getColumnWidths( blocks, totalBlockCount = blocks.length ) {\n\treturn blocks.reduce( ( accumulator, block ) => {\n\t\tconst width = getEffectiveColumnWidth( block, totalBlockCount );\n\t\treturn Object.assign( accumulator, { [ block.clientId ]: width } );\n\t}, {} );\n}\n\n/**\n * Returns an object of `clientId` → `width` of column widths as redistributed\n * proportional to their current widths, constrained or expanded to fit within\n * the given available width.\n *\n * @param {WPBlock[]} blocks Block objects.\n * @param {number} availableWidth Maximum width to fit within.\n * @param {?number} totalBlockCount Total number of blocks in Columns.\n * Defaults to number of blocks passed.\n *\n * @return {Object<string,number>} Redistributed column widths.\n */\nexport function getRedistributedColumnWidths(\n\tblocks,\n\tavailableWidth,\n\ttotalBlockCount = blocks.length\n) {\n\tconst totalWidth = getTotalColumnsWidth( blocks, totalBlockCount );\n\n\treturn Object.fromEntries(\n\t\tObject.entries( getColumnWidths( blocks, totalBlockCount ) ).map(\n\t\t\t( [ clientId, width ] ) => {\n\t\t\t\tconst newWidth = ( availableWidth * width ) / totalWidth;\n\t\t\t\treturn [ clientId, toWidthPrecision( newWidth ) ];\n\t\t\t}\n\t\t)\n\t);\n}\n\n/**\n * Returns true if column blocks within the provided set are assigned with\n * explicit widths, or false otherwise.\n *\n * @param {WPBlock[]} blocks Block objects.\n *\n * @return {boolean} Whether columns have explicit widths.\n */\nexport function hasExplicitPercentColumnWidths( blocks ) {\n\treturn blocks.every( ( block ) => {\n\t\tconst blockWidth = block.attributes.width;\n\t\treturn Number.isFinite(\n\t\t\tblockWidth?.endsWith?.( '%' )\n\t\t\t\t? parseFloat( blockWidth )\n\t\t\t\t: blockWidth\n\t\t);\n\t} );\n}\n\n/**\n * Returns a copy of the given set of blocks with new widths assigned from the\n * provided object of redistributed column widths.\n *\n * @param {WPBlock[]} blocks Block objects.\n * @param {Object<string,number>} widths Redistributed column widths.\n *\n * @return {WPBlock[]} blocks Mapped block objects.\n */\nexport function getMappedColumnWidths( blocks, widths ) {\n\treturn blocks.map( ( block ) => ( {\n\t\t...block,\n\t\tattributes: {\n\t\t\t...block.attributes,\n\t\t\twidth: `${ widths[ block.clientId ] }%`,\n\t\t},\n\t} ) );\n}\n\n/**\n * Returns an array with columns widths values, parsed or no depends on `withParsing` flag.\n *\n * @param {WPBlock[]} blocks Block objects.\n * @param {?boolean} withParsing Whether value has to be parsed.\n *\n * @return {Array<number,string>} Column widths.\n */\nexport function getWidths( blocks, withParsing = true ) {\n\treturn blocks.map( ( innerColumn ) => {\n\t\tconst innerColumnWidth =\n\t\t\tinnerColumn.attributes.width || 100 / blocks.length;\n\n\t\treturn withParsing ? parseFloat( innerColumnWidth ) : innerColumnWidth;\n\t} );\n}\n\n/**\n * Returns a column width with unit.\n *\n * @param {string} width Column width.\n * @param {string} unit Column width unit.\n *\n * @return {string} Column width with unit.\n */\nexport function getWidthWithUnit( width, unit ) {\n\twidth = 0 > parseFloat( width ) ? '0' : width;\n\n\tif ( isPercentageUnit( unit ) ) {\n\t\twidth = Math.min( width, 100 );\n\t}\n\n\treturn `${ width }${ unit }`;\n}\n\n/**\n * Returns a boolean whether passed unit is percentage\n *\n * @param {string} unit Column width unit.\n *\n * @return {boolean} \tWhether unit is '%'.\n */\nexport function isPercentageUnit( unit ) {\n\treturn unit === '%';\n}\n"],
5
- "mappings": ";AAQO,IAAM,mBAAmB,CAAE,UAAW;AAC5C,QAAM,gBAAgB,WAAY,KAAM;AACxC,SAAO,OAAO,SAAU,aAAc,IACnC,WAAY,cAAc,QAAS,CAAE,CAAE,IACvC;AACJ;AAUO,SAAS,wBAAyB,OAAO,iBAAkB;AACjE,QAAM,EAAE,QAAQ,MAAM,gBAAgB,IAAI,MAAM;AAChD,SAAO,iBAAkB,KAAM;AAChC;AAWO,SAAS,qBACf,QACA,kBAAkB,OAAO,QACxB;AACD,SAAO,OAAO;AAAA,IACb,CAAE,KAAK,UACN,MAAM,wBAAyB,OAAO,eAAgB;AAAA,IACvD;AAAA,EACD;AACD;AAWO,SAAS,gBAAiB,QAAQ,kBAAkB,OAAO,QAAS;AAC1E,SAAO,OAAO,OAAQ,CAAE,aAAa,UAAW;AAC/C,UAAM,QAAQ,wBAAyB,OAAO,eAAgB;AAC9D,WAAO,OAAO,OAAQ,aAAa,EAAE,CAAE,MAAM,QAAS,GAAG,MAAM,CAAE;AAAA,EAClE,GAAG,CAAC,CAAE;AACP;AAcO,SAAS,6BACf,QACA,gBACA,kBAAkB,OAAO,QACxB;AACD,QAAM,aAAa,qBAAsB,QAAQ,eAAgB;AAEjE,SAAO,OAAO;AAAA,IACb,OAAO,QAAS,gBAAiB,QAAQ,eAAgB,CAAE,EAAE;AAAA,MAC5D,CAAE,CAAE,UAAU,KAAM,MAAO;AAC1B,cAAM,WAAa,iBAAiB,QAAU;AAC9C,eAAO,CAAE,UAAU,iBAAkB,QAAS,CAAE;AAAA,MACjD;AAAA,IACD;AAAA,EACD;AACD;AAUO,SAAS,+BAAgC,QAAS;AACxD,SAAO,OAAO,MAAO,CAAE,UAAW;AACjC,UAAM,aAAa,MAAM,WAAW;AACpC,WAAO,OAAO;AAAA,MACb,YAAY,WAAY,GAAI,IACzB,WAAY,UAAW,IACvB;AAAA,IACJ;AAAA,EACD,CAAE;AACH;AAWO,SAAS,sBAAuB,QAAQ,QAAS;AACvD,SAAO,OAAO,IAAK,CAAE,WAAa;AAAA,IACjC,GAAG;AAAA,IACH,YAAY;AAAA,MACX,GAAG,MAAM;AAAA,MACT,OAAO,GAAI,OAAQ,MAAM,QAAS,CAAE;AAAA,IACrC;AAAA,EACD,EAAI;AACL;AAUO,SAAS,UAAW,QAAQ,cAAc,MAAO;AACvD,SAAO,OAAO,IAAK,CAAE,gBAAiB;AACrC,UAAM,mBACL,YAAY,WAAW,SAAS,MAAM,OAAO;AAE9C,WAAO,cAAc,WAAY,gBAAiB,IAAI;AAAA,EACvD,CAAE;AACH;AAUO,SAAS,iBAAkB,OAAO,MAAO;AAC/C,UAAQ,IAAI,WAAY,KAAM,IAAI,MAAM;AAExC,MAAK,iBAAkB,IAAK,GAAI;AAC/B,YAAQ,KAAK,IAAK,OAAO,GAAI;AAAA,EAC9B;AAEA,SAAO,GAAI,KAAM,GAAI,IAAK;AAC3B;AASO,SAAS,iBAAkB,MAAO;AACxC,SAAO,SAAS;AACjB;",
6
- "names": []
7
- }
@@ -1,50 +0,0 @@
1
- // packages/block-library/src/video/variations.js
2
- import { __ } from "@wordpress/i18n";
3
- import { video as videoIcon } from "@wordpress/icons";
4
- var isGifVariation = ({
5
- controls,
6
- loop,
7
- autoplay,
8
- muted,
9
- playsInline
10
- } = {}) => !controls && !!loop && !!autoplay && !!muted && !!playsInline;
11
- var variations = [
12
- {
13
- name: "video",
14
- title: __("Video"),
15
- description: __(
16
- "A video with customizable playback and interaction controls."
17
- ),
18
- icon: videoIcon,
19
- attributes: { controls: true },
20
- isActive: (blockAttributes) => !isGifVariation(blockAttributes),
21
- // Not offered in the inserter; used to label a regular video and to
22
- // switch a GIF back to a standard video.
23
- scope: ["block", "transform"]
24
- },
25
- {
26
- name: "gif",
27
- title: __("GIF"),
28
- description: __(
29
- "A muted, looping video that plays automatically like an animated GIF."
30
- ),
31
- icon: videoIcon,
32
- keywords: [__("animated"), "gif"],
33
- attributes: {
34
- controls: false,
35
- loop: true,
36
- autoplay: true,
37
- muted: true,
38
- playsInline: true
39
- },
40
- isActive: (blockAttributes) => isGifVariation(blockAttributes),
41
- // Created by converting an uploaded GIF, not inserted directly.
42
- scope: ["block", "transform"]
43
- }
44
- ];
45
- var variations_default = variations;
46
- export {
47
- variations_default as default,
48
- isGifVariation
49
- };
50
- //# sourceMappingURL=variations.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/video/variations.js"],
4
- "sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { video as videoIcon } from '@wordpress/icons';\n\n/**\n * Whether a set of Video block attributes describes a GIF-behaving video: a\n * muted, looping, autoplaying, inline video with no controls. An animated GIF\n * uploaded through the editor is converted to a video and presented with these\n * attributes so it plays like the original GIF.\n *\n * @param {Object} attributes Video block attributes.\n * @param {boolean} attributes.controls Whether playback controls are shown.\n * @param {boolean} attributes.loop Whether the video loops.\n * @param {boolean} attributes.autoplay Whether the video autoplays.\n * @param {boolean} attributes.muted Whether the video is muted.\n * @param {boolean} attributes.playsInline Whether the video plays inline.\n *\n * @return {boolean} Whether the attributes describe a GIF-behaving video.\n */\nexport const isGifVariation = ( {\n\tcontrols,\n\tloop,\n\tautoplay,\n\tmuted,\n\tplaysInline,\n} = {} ) => ! controls && !! loop && !! autoplay && !! muted && !! playsInline;\n\nconst variations = [\n\t{\n\t\tname: 'video',\n\t\ttitle: __( 'Video' ),\n\t\tdescription: __(\n\t\t\t'A video with customizable playback and interaction controls.'\n\t\t),\n\t\ticon: videoIcon,\n\t\tattributes: { controls: true },\n\t\tisActive: ( blockAttributes ) => ! isGifVariation( blockAttributes ),\n\t\t// Not offered in the inserter; used to label a regular video and to\n\t\t// switch a GIF back to a standard video.\n\t\tscope: [ 'block', 'transform' ],\n\t},\n\t{\n\t\tname: 'gif',\n\t\ttitle: __( 'GIF' ),\n\t\tdescription: __(\n\t\t\t'A muted, looping video that plays automatically like an animated GIF.'\n\t\t),\n\t\ticon: videoIcon,\n\t\tkeywords: [ __( 'animated' ), 'gif' ],\n\t\tattributes: {\n\t\t\tcontrols: false,\n\t\t\tloop: true,\n\t\t\tautoplay: true,\n\t\t\tmuted: true,\n\t\t\tplaysInline: true,\n\t\t},\n\t\tisActive: ( blockAttributes ) => isGifVariation( blockAttributes ),\n\t\t// Created by converting an uploaded GIF, not inserted directly.\n\t\tscope: [ 'block', 'transform' ],\n\t},\n];\n\nexport default variations;\n"],
5
- "mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,SAAS,iBAAiB;AAiB5B,IAAM,iBAAiB,CAAE;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,IAAI,CAAC,MAAO,CAAE,YAAY,CAAC,CAAE,QAAQ,CAAC,CAAE,YAAY,CAAC,CAAE,SAAS,CAAC,CAAE;AAEnE,IAAM,aAAa;AAAA,EAClB;AAAA,IACC,MAAM;AAAA,IACN,OAAO,GAAI,OAAQ;AAAA,IACnB,aAAa;AAAA,MACZ;AAAA,IACD;AAAA,IACA,MAAM;AAAA,IACN,YAAY,EAAE,UAAU,KAAK;AAAA,IAC7B,UAAU,CAAE,oBAAqB,CAAE,eAAgB,eAAgB;AAAA;AAAA;AAAA,IAGnE,OAAO,CAAE,SAAS,WAAY;AAAA,EAC/B;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,OAAO,GAAI,KAAM;AAAA,IACjB,aAAa;AAAA,MACZ;AAAA,IACD;AAAA,IACA,MAAM;AAAA,IACN,UAAU,CAAE,GAAI,UAAW,GAAG,KAAM;AAAA,IACpC,YAAY;AAAA,MACX,UAAU;AAAA,MACV,MAAM;AAAA,MACN,UAAU;AAAA,MACV,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,IACA,UAAU,CAAE,oBAAqB,eAAgB,eAAgB;AAAA;AAAA,IAEjE,OAAO,CAAE,SAAS,WAAY;AAAA,EAC/B;AACD;AAEA,IAAO,qBAAQ;",
6
- "names": []
7
- }