@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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/gallery/use-dynamic-gallery.js"],
4
- "sourcesContent": ["import { useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { createBlock } from '@wordpress/blocks';\nimport { pickRelevantMediaFiles } from './shared';\nimport { getHrefAndDestination } from './utils';\nimport { getUpdatedLinkTargetSettings } from '../image/utils';\nimport {\n\tgetSourceQuery,\n\tgetDynamicSource,\n\tATTACHED_MEDIA,\n\tDEFAULT_ORDERBY,\n\tDEFAULT_ORDER,\n\tMAX_IMAGES,\n} from './dynamic-source';\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Builds the attributes for a `core/image` block from a media (attachment)\n * record, applying the gallery-wide settings that affect how the image renders.\n *\n * Used to construct the (non-persisted) image blocks previewed in dynamic mode,\n * and the real image blocks created when a dynamic gallery is converted\n * (\"pinned\") back to individual images. The frontend equivalent is\n * `block_core_gallery_render_dynamic_image()` in `index.php`.\n *\n * @param {Object} media A media object as returned by the REST API.\n * @param {Object} galleryAttributes The gallery block's attributes.\n * @return {Object} Attributes to pass to `createBlock( 'core/image', ... )`.\n */\nfunction buildImageBlockAttributes( media, galleryAttributes ) {\n\tconst { sizeSlug, linkTo, linkTarget, aspectRatio } = galleryAttributes;\n\tconst hasAspectRatio = !! aspectRatio && aspectRatio !== 'auto';\n\n\treturn {\n\t\tid: media.id,\n\t\t...pickRelevantMediaFiles( media, sizeSlug ),\n\t\t...getHrefAndDestination( media, linkTo ),\n\t\t...getUpdatedLinkTargetSettings( linkTarget, galleryAttributes ),\n\t\tsizeSlug,\n\t\t// Raw caption, mirroring the frontend (`index.php`). Gap: the REST API\n\t\t// exposes no caption run through `wp_get_attachment_caption`, so neither\n\t\t// side applies that filter.\n\t\tcaption: media.caption?.raw || '',\n\t\talt: media.alt_text || '',\n\t\taspectRatio: hasAspectRatio ? aspectRatio : undefined,\n\t\t// Pair `scale` with `aspectRatio` so the image crops rather than stretches,\n\t\t// matching the image block's UI and the frontend (`index.php`).\n\t\tscale: hasAspectRatio ? 'cover' : undefined,\n\t};\n}\n\n/**\n * Builds a set of `core/image` blocks from the resolved media, applying the\n * gallery-wide settings. Each call mints fresh client IDs, so it can produce\n * both the editor preview and the materialized inner blocks on convert.\n *\n * @param {Object[]} media Media records from the REST API.\n * @param {Object} galleryAttributes The image-relevant gallery attributes.\n * @return {Object[]} New `core/image` block instances.\n */\nfunction buildImageBlocks( media, galleryAttributes ) {\n\treturn media.map( ( mediaItem ) =>\n\t\tcreateBlock(\n\t\t\t'core/image',\n\t\t\tbuildImageBlockAttributes( mediaItem, galleryAttributes )\n\t\t)\n\t);\n}\n\n/**\n * Bundles the Gallery block's \"dynamic mode\" source resolution and actions.\n *\n * Dynamic mode resolves the gallery's images from a configured source\n * (`attributes.dynamicContent`) instead of from manually-added inner image\n * blocks. This hook centralizes the shared, single-instance pieces — the source\n * resolution (one `getEntityRecords`), the editor-preview blocks, and the\n * mode/ordering actions — out of the block's `edit` component. Transient UI\n * concerns (e.g. the convert-to-dynamic confirmation) live in the components\n * that own them.\n *\n * @param {Object} options\n * @param {Object} options.attributes The gallery block attributes.\n * @param {Function} options.setAttributes The block's `setAttributes`.\n * @param {string} options.clientId The block client ID.\n * @param {?number} options.postId The current post ID (from block context).\n * @param {?string} options.postType The current post type (from block context).\n * @return {Object} Dynamic-mode source data and actions.\n */\nexport default function useDynamicGallery( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tpostId,\n\tpostType,\n} ) {\n\tconst { dynamicContent } = attributes;\n\n\t// Whether dynamic mode makes sense in the current editing context. A\n\t// `postType` means the block will resolve against some post at render time —\n\t// either a concrete post (post/page editor, Query Loop item) or a post-bound\n\t// template (`single`, `page`) whose post is filled in by `get_the_ID()` on the\n\t// frontend (see `index.php`). Without it (template part, pattern, generic\n\t// template) there's no post to attach to, so the source can never resolve.\n\tconst canUseDynamicSource = !! postType;\n\n\t// The descriptor for the configured source (its `title`/`description`/\n\t// `emptyMessage`), resolved once here so consumers read the copy without\n\t// re-deriving it from `dynamicContent`. `undefined` for an unknown source.\n\tconst sourceDescriptor = getDynamicSource( dynamicContent?.source );\n\n\t// Current source ordering, falling back to the shared defaults when unset.\n\tconst sourceOrderby = dynamicContent?.args?.orderBy ?? DEFAULT_ORDERBY;\n\tconst sourceOrder = dynamicContent?.args?.order ?? DEFAULT_ORDER;\n\n\tconst registry = useRegistry();\n\tconst { replaceInnerBlocks, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\t// Resolve the configured source to a media query. `null` (static mode, or an\n\t// unresolvable source) short-circuits the select below so no request fires.\n\tconst query = useMemo(\n\t\t() =>\n\t\t\tdynamicContent\n\t\t\t\t? getSourceQuery( dynamicContent, { postId } )\n\t\t\t\t: null,\n\t\t[ dynamicContent, postId ]\n\t);\n\n\tconst { dynamicMedia, dynamicMediaTotal, isResolvingDynamic } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! query ) {\n\t\t\t\treturn {\n\t\t\t\t\tdynamicMedia: EMPTY_ARRAY,\n\t\t\t\t\tdynamicMediaTotal: 0,\n\t\t\t\t\tisResolvingDynamic: false,\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst selectorArgs = [ 'postType', 'attachment', query ];\n\t\t\treturn {\n\t\t\t\tdynamicMedia:\n\t\t\t\t\tselect( coreStore ).getEntityRecords( ...selectorArgs ) ??\n\t\t\t\t\tEMPTY_ARRAY,\n\t\t\t\t// Total matching attachments (the `X-WP-Total` header), which the\n\t\t\t\t// query's `per_page` cap doesn't bound — so it reveals when the\n\t\t\t\t// post has more attached images than are shown.\n\t\t\t\tdynamicMediaTotal:\n\t\t\t\t\tselect( coreStore ).getEntityRecordsTotalItems(\n\t\t\t\t\t\t...selectorArgs\n\t\t\t\t\t) ?? 0,\n\t\t\t\tisResolvingDynamic: ! select( coreStore ).hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tselectorArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ query ]\n\t);\n\n\t// The source caps results at `MAX_IMAGES` (matching the frontend), so flag\n\t// when the post has more attached images than the gallery can show.\n\tconst hasMoreImagesThanCap = dynamicMediaTotal > MAX_IMAGES;\n\n\t// The only gallery settings that affect how an image renders, and so the\n\t// only ones `buildImageBlockAttributes` reads. Depending on this narrowed\n\t// set (rather than the whole `attributes` object) keeps the preview from\n\t// rebuilding on unrelated edits, e.g. typing in the gallery caption.\n\tconst { sizeSlug, linkTo, linkTarget, aspectRatio } = attributes;\n\tconst imageAttributes = useMemo(\n\t\t() => ( { sizeSlug, linkTo, linkTarget, aspectRatio } ),\n\t\t[ sizeSlug, linkTo, linkTarget, aspectRatio ]\n\t);\n\n\t// The (non-persisted) `core/image` blocks used for the editor preview.\n\t// Rebuilt when the resolved media or an image-relevant setting changes.\n\tconst dynamicImageBlocks = useMemo(\n\t\t() => buildImageBlocks( dynamicMedia, imageAttributes ),\n\t\t[ dynamicMedia, imageAttributes ]\n\t);\n\n\t// Context the gallery provides to its (previewed) image blocks.\n\tconst galleryContext = useMemo(\n\t\t() => ( {\n\t\t\tallowResize: attributes.allowResize ?? false,\n\t\t\timageCrop: attributes.imageCrop,\n\t\t\tfixedHeight: attributes.fixedHeight,\n\t\t\tnavigationButtonType: attributes.navigationButtonType,\n\t\t} ),\n\t\t[\n\t\t\tattributes.allowResize,\n\t\t\tattributes.imageCrop,\n\t\t\tattributes.fixedHeight,\n\t\t\tattributes.navigationButtonType,\n\t\t]\n\t);\n\n\t// Switches the gallery into dynamic mode, displaying images attached to the\n\t// current post. Clearing the inner blocks removes the manually-added images:\n\t// they're the gallery's image data, so there's nothing else to reset. The\n\t// legacy `images`/`ids` attributes aren't touched — they're back-compat shims\n\t// for the pre-innerBlocks format (see `deprecated.jsx`/`transforms.js`), empty\n\t// on any gallery reachable here.\n\tfunction enableDynamicMode() {\n\t\t// Batch the attribute change and the inner-block reset into a single\n\t\t// undo level: they're two halves of one mode switch, so one undo should\n\t\t// revert both. Marking the second dispatch non-persistent stops it from\n\t\t// opening a second undo level, which would otherwise leave the gallery\n\t\t// in a half-switched state (dynamic source set, images still present).\n\t\tregistry.batch( () => {\n\t\t\tsetAttributes( { dynamicContent: { source: ATTACHED_MEDIA } } );\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\treplaceInnerBlocks( clientId, [] );\n\t\t} );\n\t}\n\n\t// \"Pins\" a dynamic gallery: materializes the currently-resolved media as\n\t// real, editable image blocks and leaves dynamic mode.\n\tfunction convertToStatic() {\n\t\t// Batch the inner-block materialization and the attribute change into a\n\t\t// single undo level so one undo reverts the whole conversion (see\n\t\t// `enableDynamicMode`). Build fresh blocks rather than reusing the\n\t\t// preview's `dynamicImageBlocks` so the materialized inner blocks get\n\t\t// their own client IDs, distinct from the (disabled) preview instances.\n\t\tregistry.batch( () => {\n\t\t\treplaceInnerBlocks(\n\t\t\t\tclientId,\n\t\t\t\tbuildImageBlocks( dynamicMedia, imageAttributes )\n\t\t\t);\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { dynamicContent: undefined } );\n\t\t} );\n\t}\n\n\t// Updates the source ordering within `dynamicContent.args`. Passing\n\t// `undefined` (or the default order) strips the keys so they aren't\n\t// persisted redundantly and the ToolsPanel item reads as unset.\n\tfunction setSourceOrder( nextOrderby, nextOrder ) {\n\t\tconst nextArgs = { ...dynamicContent?.args };\n\t\tdelete nextArgs.orderBy;\n\t\tdelete nextArgs.order;\n\t\tif (\n\t\t\tnextOrderby !== undefined &&\n\t\t\t( nextOrderby !== DEFAULT_ORDERBY || nextOrder !== DEFAULT_ORDER )\n\t\t) {\n\t\t\tnextArgs.orderBy = nextOrderby;\n\t\t\tnextArgs.order = nextOrder;\n\t\t}\n\t\tconst nextSource = { ...dynamicContent };\n\t\tif ( Object.keys( nextArgs ).length ) {\n\t\t\tnextSource.args = nextArgs;\n\t\t} else {\n\t\t\tdelete nextSource.args;\n\t\t}\n\t\tsetAttributes( { dynamicContent: nextSource } );\n\t}\n\n\t// Resets the source to its bare form: keeps the source kind, drops its args.\n\tfunction resetSource() {\n\t\tsetAttributes( {\n\t\t\tdynamicContent: { source: dynamicContent.source },\n\t\t} );\n\t}\n\n\treturn {\n\t\tdynamicContent,\n\t\tcanUseDynamicSource,\n\t\tsourceDescriptor,\n\t\thasMoreImagesThanCap,\n\t\tdynamicMediaTotal,\n\t\tsourceOrderby,\n\t\tsourceOrder,\n\t\tdynamicMedia,\n\t\tdynamicImageBlocks,\n\t\tisResolvingDynamic,\n\t\tgalleryContext,\n\t\tenableDynamicMode,\n\t\tconvertToStatic,\n\t\tsetSourceOrder,\n\t\tresetSource,\n\t};\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AACxB,kBAAoD;AACpD,0BAA0C;AAC1C,uBAAmC;AACnC,oBAA4B;AAC5B,oBAAuC;AACvC,mBAAsC;AACtC,IAAAA,gBAA6C;AAC7C,4BAOO;AAEP,IAAM,cAAc,CAAC;AAerB,SAAS,0BAA2B,OAAO,mBAAoB;AAC9D,QAAM,EAAE,UAAU,QAAQ,YAAY,YAAY,IAAI;AACtD,QAAM,iBAAiB,CAAC,CAAE,eAAe,gBAAgB;AAEzD,SAAO;AAAA,IACN,IAAI,MAAM;AAAA,IACV,OAAG,sCAAwB,OAAO,QAAS;AAAA,IAC3C,OAAG,oCAAuB,OAAO,MAAO;AAAA,IACxC,OAAG,4CAA8B,YAAY,iBAAkB;AAAA,IAC/D;AAAA;AAAA;AAAA;AAAA,IAIA,SAAS,MAAM,SAAS,OAAO;AAAA,IAC/B,KAAK,MAAM,YAAY;AAAA,IACvB,aAAa,iBAAiB,cAAc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K,OAAO,KAAM,QAAS,EAAE,QAAS;AACrC,iBAAW,OAAO;AAAA,IACnB,OAAO;AACN,aAAO,WAAW;AAAA,IACnB;AACA,kBAAe,EAAE,gBAAgB,WAAW,CAAE;AAAA,EAC/C;AAGA,WAAS,cAAc;AACtB,kBAAe;AAAA,MACd,gBAAgB,EAAE,QAAQ,eAAe,OAAO;AAAA,IACjD,CAAE;AAAA,EACH;AAEA,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["import { useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { createBlock } from '@wordpress/blocks';\nimport { pickRelevantMediaFiles } from './shared';\nimport { getHrefAndDestination } from './utils';\nimport { getUpdatedLinkTargetSettings } from '../image/utils';\nimport {\n\tgetSourceQuery,\n\tgetDynamicSource,\n\tATTACHED_MEDIA,\n\tDEFAULT_ORDERBY,\n\tDEFAULT_ORDER,\n\tMAX_IMAGES,\n} from './dynamic-source';\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Builds the attributes for a `core/image` block from a media (attachment)\n * record, applying the gallery-wide settings that affect how the image renders.\n *\n * Used to construct the (non-persisted) image blocks previewed in dynamic mode,\n * and the real image blocks created when a dynamic gallery is converted\n * (\"pinned\") back to individual images. The frontend equivalent is\n * `block_core_gallery_render_dynamic_image()` in `index.php`.\n *\n * @param {Object} media A media object as returned by the REST API.\n * @param {Object} galleryAttributes The gallery block's attributes.\n * @return {Object} Attributes to pass to `createBlock( 'core/image', ... )`.\n */\nfunction buildImageBlockAttributes( media, galleryAttributes ) {\n\tconst { sizeSlug, linkTo, linkTarget, aspectRatio } = galleryAttributes;\n\tconst hasAspectRatio = !! aspectRatio && aspectRatio !== 'auto';\n\n\treturn {\n\t\tid: media.id,\n\t\t...pickRelevantMediaFiles( media, sizeSlug ),\n\t\t...getHrefAndDestination( media, linkTo ),\n\t\t...getUpdatedLinkTargetSettings( linkTarget, galleryAttributes ),\n\t\tsizeSlug,\n\t\t// Raw caption, mirroring the frontend (`index.php`). Gap: the REST API\n\t\t// exposes no caption run through `wp_get_attachment_caption`, so neither\n\t\t// side applies that filter.\n\t\tcaption: media.caption?.raw || '',\n\t\talt: media.alt_text || '',\n\t\taspectRatio: hasAspectRatio ? aspectRatio : undefined,\n\t\t// Pair `scale` with `aspectRatio` so the image crops rather than stretches,\n\t\t// matching the image block's UI and the frontend (`index.php`).\n\t\tscale: hasAspectRatio ? 'cover' : undefined,\n\t};\n}\n\n/**\n * Builds a set of `core/image` blocks from the resolved media, applying the\n * gallery-wide settings. Each call mints fresh client IDs, so it can produce\n * both the editor preview and the materialized inner blocks on convert.\n *\n * @param {Object[]} media Media records from the REST API.\n * @param {Object} galleryAttributes The image-relevant gallery attributes.\n * @return {Object[]} New `core/image` block instances.\n */\nfunction buildImageBlocks( media, galleryAttributes ) {\n\treturn media.map( ( mediaItem ) =>\n\t\tcreateBlock(\n\t\t\t'core/image',\n\t\t\tbuildImageBlockAttributes( mediaItem, galleryAttributes )\n\t\t)\n\t);\n}\n\n/**\n * Bundles the Gallery block's \"dynamic mode\" source resolution and actions.\n *\n * Dynamic mode resolves the gallery's images from a configured source\n * (`attributes.dynamicContent`) instead of from manually-added inner image\n * blocks. This hook centralizes the shared, single-instance pieces — the source\n * resolution (one `getEntityRecords`), the editor-preview blocks, and the\n * mode/ordering actions — out of the block's `edit` component. Transient UI\n * concerns (e.g. the convert-to-dynamic confirmation) live in the components\n * that own them.\n *\n * @param {Object} options\n * @param {Object} options.attributes The gallery block attributes.\n * @param {Function} options.setAttributes The block's `setAttributes`.\n * @param {string} options.clientId The block client ID.\n * @param {?number} options.postId The current post ID (from block context).\n * @param {?string} options.postType The current post type (from block context).\n * @return {Object} Dynamic-mode source data and actions.\n */\nexport default function useDynamicGallery( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tpostId,\n\tpostType,\n} ) {\n\tconst { dynamicContent } = attributes;\n\n\t// Whether dynamic mode makes sense in the current editing context. A\n\t// `postType` means the block will resolve against some post at render time —\n\t// either a concrete post (post/page editor, Query Loop item) or a post-bound\n\t// template (`single`, `page`) whose post is filled in by `get_the_ID()` on the\n\t// frontend (see `index.php`). Without it (template part, pattern, generic\n\t// template) there's no post to attach to, so the source can never resolve.\n\tconst canUseDynamicSource = !! postType;\n\n\t// The descriptor for the configured source (its `title`/`description`/\n\t// `emptyMessage`), resolved once here so consumers read the copy without\n\t// re-deriving it from `dynamicContent`. `undefined` for an unknown source.\n\tconst sourceDescriptor = getDynamicSource( dynamicContent?.source );\n\n\t// Current source ordering, falling back to the shared defaults when unset.\n\tconst sourceOrderby = dynamicContent?.args?.orderBy ?? DEFAULT_ORDERBY;\n\tconst sourceOrder = dynamicContent?.args?.order ?? DEFAULT_ORDER;\n\n\tconst registry = useRegistry();\n\tconst { replaceInnerBlocks, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\t// Resolve the configured source to a media query. `null` (static mode, or an\n\t// unresolvable source) short-circuits the select below so no request fires.\n\tconst query = useMemo(\n\t\t() =>\n\t\t\tdynamicContent\n\t\t\t\t? getSourceQuery( dynamicContent, { postId } )\n\t\t\t\t: null,\n\t\t[ dynamicContent, postId ]\n\t);\n\n\tconst { dynamicMedia, dynamicMediaTotal, isResolvingDynamic } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! query ) {\n\t\t\t\treturn {\n\t\t\t\t\tdynamicMedia: EMPTY_ARRAY,\n\t\t\t\t\tdynamicMediaTotal: 0,\n\t\t\t\t\tisResolvingDynamic: false,\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst selectorArgs = [ 'postType', 'attachment', query ];\n\t\t\treturn {\n\t\t\t\tdynamicMedia:\n\t\t\t\t\tselect( coreStore ).getEntityRecords( ...selectorArgs ) ??\n\t\t\t\t\tEMPTY_ARRAY,\n\t\t\t\t// Total matching attachments (the `X-WP-Total` header), which the\n\t\t\t\t// query's `per_page` cap doesn't bound — so it reveals when the\n\t\t\t\t// post has more attached images than are shown.\n\t\t\t\tdynamicMediaTotal:\n\t\t\t\t\tselect( coreStore ).getEntityRecordsTotalItems(\n\t\t\t\t\t\t...selectorArgs\n\t\t\t\t\t) ?? 0,\n\t\t\t\tisResolvingDynamic: ! select( coreStore ).hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tselectorArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ query ]\n\t);\n\n\t// The source caps results at `MAX_IMAGES` (matching the frontend), so flag\n\t// when the post has more attached images than the gallery can show.\n\tconst hasMoreImagesThanCap = dynamicMediaTotal > MAX_IMAGES;\n\n\t// The only gallery settings that affect how an image renders, and so the\n\t// only ones `buildImageBlockAttributes` reads. Depending on this narrowed\n\t// set (rather than the whole `attributes` object) keeps the preview from\n\t// rebuilding on unrelated edits, e.g. typing in the gallery caption.\n\tconst { sizeSlug, linkTo, linkTarget, aspectRatio } = attributes;\n\tconst imageAttributes = useMemo(\n\t\t() => ( { sizeSlug, linkTo, linkTarget, aspectRatio } ),\n\t\t[ sizeSlug, linkTo, linkTarget, aspectRatio ]\n\t);\n\n\t// The (non-persisted) `core/image` blocks used for the editor preview.\n\t// Rebuilt when the resolved media or an image-relevant setting changes.\n\tconst dynamicImageBlocks = useMemo(\n\t\t() => buildImageBlocks( dynamicMedia, imageAttributes ),\n\t\t[ dynamicMedia, imageAttributes ]\n\t);\n\n\t// Context the gallery provides to its (previewed) image blocks.\n\tconst galleryContext = useMemo(\n\t\t() => ( {\n\t\t\tallowResize: attributes.allowResize ?? false,\n\t\t\timageCrop: attributes.imageCrop,\n\t\t\tfixedHeight: attributes.fixedHeight,\n\t\t\tnavigationButtonType: attributes.navigationButtonType,\n\t\t} ),\n\t\t[\n\t\t\tattributes.allowResize,\n\t\t\tattributes.imageCrop,\n\t\t\tattributes.fixedHeight,\n\t\t\tattributes.navigationButtonType,\n\t\t]\n\t);\n\n\t// Switches the gallery into dynamic mode, displaying images attached to the\n\t// current post. Clearing the inner blocks removes the manually-added images:\n\t// they're the gallery's image data, so there's nothing else to reset. The\n\t// legacy `images`/`ids` attributes aren't touched — they're back-compat shims\n\t// for the pre-innerBlocks format (see `deprecated.jsx`/`transforms.js`), empty\n\t// on any gallery reachable here.\n\tfunction enableDynamicMode() {\n\t\t// Batch the attribute change and the inner-block reset into a single\n\t\t// undo level: they're two halves of one mode switch, so one undo should\n\t\t// revert both. Marking the second dispatch non-persistent stops it from\n\t\t// opening a second undo level, which would otherwise leave the gallery\n\t\t// in a half-switched state (dynamic source set, images still present).\n\t\tregistry.batch( () => {\n\t\t\tsetAttributes( { dynamicContent: { source: ATTACHED_MEDIA } } );\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\treplaceInnerBlocks( clientId, [] );\n\t\t} );\n\t}\n\n\t// \"Pins\" a dynamic gallery: materializes the currently-resolved media as\n\t// real, editable image blocks and leaves dynamic mode.\n\tfunction convertToStatic() {\n\t\t// Batch the inner-block materialization and the attribute change into a\n\t\t// single undo level so one undo reverts the whole conversion (see\n\t\t// `enableDynamicMode`). Build fresh blocks rather than reusing the\n\t\t// preview's `dynamicImageBlocks` so the materialized inner blocks get\n\t\t// their own client IDs, distinct from the (disabled) preview instances.\n\t\tregistry.batch( () => {\n\t\t\treplaceInnerBlocks(\n\t\t\t\tclientId,\n\t\t\t\tbuildImageBlocks( dynamicMedia, imageAttributes )\n\t\t\t);\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { dynamicContent: undefined } );\n\t\t} );\n\t}\n\n\t// Updates the source ordering within `dynamicContent.args`. Passing\n\t// `undefined` (or the default order) strips the keys so they aren't\n\t// persisted redundantly and the Settings \"Order by\" item reads as unset.\n\tfunction setSourceOrder( nextOrderby, nextOrder ) {\n\t\tconst nextArgs = { ...dynamicContent?.args };\n\t\tdelete nextArgs.orderBy;\n\t\tdelete nextArgs.order;\n\t\tif (\n\t\t\tnextOrderby !== undefined &&\n\t\t\t( nextOrderby !== DEFAULT_ORDERBY || nextOrder !== DEFAULT_ORDER )\n\t\t) {\n\t\t\tnextArgs.orderBy = nextOrderby;\n\t\t\tnextArgs.order = nextOrder;\n\t\t}\n\t\tconst nextSource = { ...dynamicContent };\n\t\tif ( Object.keys( nextArgs ).length ) {\n\t\t\tnextSource.args = nextArgs;\n\t\t} else {\n\t\t\tdelete nextSource.args;\n\t\t}\n\t\tsetAttributes( { dynamicContent: nextSource } );\n\t}\n\n\treturn {\n\t\tdynamicContent,\n\t\tcanUseDynamicSource,\n\t\tsourceDescriptor,\n\t\thasMoreImagesThanCap,\n\t\tdynamicMediaTotal,\n\t\tsourceOrderby,\n\t\tsourceOrder,\n\t\tdynamicMedia,\n\t\tdynamicImageBlocks,\n\t\tisResolvingDynamic,\n\t\tgalleryContext,\n\t\tenableDynamicMode,\n\t\tconvertToStatic,\n\t\tsetSourceOrder,\n\t};\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AACxB,kBAAoD;AACpD,0BAA0C;AAC1C,uBAAmC;AACnC,oBAA4B;AAC5B,oBAAuC;AACvC,mBAAsC;AACtC,IAAAA,gBAA6C;AAC7C,4BAOO;AAEP,IAAM,cAAc,CAAC;AAerB,SAAS,0BAA2B,OAAO,mBAAoB;AAC9D,QAAM,EAAE,UAAU,QAAQ,YAAY,YAAY,IAAI;AACtD,QAAM,iBAAiB,CAAC,CAAE,eAAe,gBAAgB;AAEzD,SAAO;AAAA,IACN,IAAI,MAAM;AAAA,IACV,OAAG,sCAAwB,OAAO,QAAS;AAAA,IAC3C,OAAG,oCAAuB,OAAO,M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AAO,SAAS;AAChB,WAAO,SAAS;AAChB,QACC,gBAAgB,WACd,gBAAgB,yCAAmB,cAAc,sCAClD;AACD,eAAS,UAAU;AACnB,eAAS,QAAQ;AAAA,IAClB;AACA,UAAM,aAAa,EAAE,GAAG,eAAe;AACvC,QAAK,OAAO,KAAM,QAAS,EAAE,QAAS;AACrC,iBAAW,OAAO;AAAA,IACnB,OAAO;AACN,aAAO,WAAW;AAAA,IACnB;AACA,kBAAe,EAAE,gBAAgB,WAAW,CAAE;AAAA,EAC/C;AAEA,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;",
6
6
  "names": ["import_utils", "blockEditorStore", "coreStore"]
7
7
  }
@@ -29,7 +29,7 @@ var EMPTY_IMAGE_MEDIA = [];
29
29
  function useGetMedia(innerBlockImages) {
30
30
  return (0, import_data.useSelect)(
31
31
  (select) => {
32
- const imageIds = innerBlockImages.map((imageBlock) => imageBlock.attributes.id).filter((id) => id !== void 0);
32
+ const imageIds = innerBlockImages.map((imageBlock) => imageBlock.attributes.id).filter((id) => id !== void 0).sort((a, b) => a - b);
33
33
  if (imageIds.length === 0) {
34
34
  return EMPTY_IMAGE_MEDIA;
35
35
  }
@@ -38,8 +38,7 @@ function useGetMedia(innerBlockImages) {
38
38
  "attachment",
39
39
  {
40
40
  include: imageIds.join(","),
41
- per_page: -1,
42
- orderby: "include"
41
+ per_page: -1
43
42
  }
44
43
  ) ?? EMPTY_IMAGE_MEDIA;
45
44
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/gallery/use-get-media.js"],
4
- "sourcesContent": ["import { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\nconst EMPTY_IMAGE_MEDIA = [];\n\n/**\n * Retrieves the extended media info for each gallery image from the store. This is used to\n * determine which image size options are available for the current gallery.\n *\n * @param {Array} innerBlockImages An array of the innerBlock images currently in the gallery.\n *\n * @return {Array} An array of media info options for each gallery image.\n */\nexport default function useGetMedia( innerBlockImages ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst imageIds = innerBlockImages\n\t\t\t\t.map( ( imageBlock ) => imageBlock.attributes.id )\n\t\t\t\t.filter( ( id ) => id !== undefined );\n\n\t\t\tif ( imageIds.length === 0 ) {\n\t\t\t\treturn EMPTY_IMAGE_MEDIA;\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\tselect( coreStore ).getEntityRecords(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\t{\n\t\t\t\t\t\tinclude: imageIds.join( ',' ),\n\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t\torderby: 'include',\n\t\t\t\t\t}\n\t\t\t\t) ?? EMPTY_IMAGE_MEDIA\n\t\t\t);\n\t\t},\n\t\t[ innerBlockImages ]\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA0B;AAC1B,uBAAmC;AAEnC,IAAM,oBAAoB,CAAC;AAUZ,SAAR,YAA8B,kBAAmB;AACvD,aAAO;AAAA,IACN,CAAE,WAAY;AACb,YAAM,WAAW,iBACf,IAAK,CAAE,eAAgB,WAAW,WAAW,EAAG,EAChD,OAAQ,CAAE,OAAQ,OAAO,MAAU;AAErC,UAAK,SAAS,WAAW,GAAI;AAC5B,eAAO;AAAA,MACR;AAEA,aACC,OAAQ,iBAAAA,KAAU,EAAE;AAAA,QACnB;AAAA,QACA;AAAA,QACA;AAAA,UACC,SAAS,SAAS,KAAM,GAAI;AAAA,UAC5B,UAAU;AAAA,UACV,SAAS;AAAA,QACV;AAAA,MACD,KAAK;AAAA,IAEP;AAAA,IACA,CAAE,gBAAiB;AAAA,EACpB;AACD;",
4
+ "sourcesContent": ["import { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\nconst EMPTY_IMAGE_MEDIA = [];\n\n/**\n * Retrieves the extended media info for each gallery image from the store. This is used to\n * determine which image size options are available for the current gallery.\n *\n * @param {Array} innerBlockImages An array of the innerBlock images currently in the gallery.\n *\n * @return {Array} An array of media info options for each gallery image.\n */\nexport default function useGetMedia( innerBlockImages ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\t// Sorted so the query only changes when the set of images changes,\n\t\t\t// not when they're reordered: a reorder would otherwise be a new\n\t\t\t// query, and the records would read as empty until it resolved.\n\t\t\t// Consumers look records up by id, so the returned order doesn't\n\t\t\t// matter.\n\t\t\tconst imageIds = innerBlockImages\n\t\t\t\t.map( ( imageBlock ) => imageBlock.attributes.id )\n\t\t\t\t.filter( ( id ) => id !== undefined )\n\t\t\t\t.sort( ( a, b ) => a - b );\n\n\t\t\tif ( imageIds.length === 0 ) {\n\t\t\t\treturn EMPTY_IMAGE_MEDIA;\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\tselect( coreStore ).getEntityRecords(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\t{\n\t\t\t\t\t\tinclude: imageIds.join( ',' ),\n\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t}\n\t\t\t\t) ?? EMPTY_IMAGE_MEDIA\n\t\t\t);\n\t\t},\n\t\t[ innerBlockImages ]\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA0B;AAC1B,uBAAmC;AAEnC,IAAM,oBAAoB,CAAC;AAUZ,SAAR,YAA8B,kBAAmB;AACvD,aAAO;AAAA,IACN,CAAE,WAAY;AAMb,YAAM,WAAW,iBACf,IAAK,CAAE,eAAgB,WAAW,WAAW,EAAG,EAChD,OAAQ,CAAE,OAAQ,OAAO,MAAU,EACnC,KAAM,CAAE,GAAG,MAAO,IAAI,CAAE;AAE1B,UAAK,SAAS,WAAW,GAAI;AAC5B,eAAO;AAAA,MACR;AAEA,aACC,OAAQ,iBAAAA,KAAU,EAAE;AAAA,QACnB;AAAA,QACA;AAAA,QACA;AAAA,UACC,SAAS,SAAS,KAAM,GAAI;AAAA,UAC5B,UAAU;AAAA,QACX;AAAA,MACD,KAAK;AAAA,IAEP;AAAA,IACA,CAAE,gBAAiB;AAAA,EACpB;AACD;",
6
6
  "names": ["coreStore"]
7
7
  }
@@ -75,6 +75,7 @@
75
75
  "typography": {
76
76
  "fontSize": true,
77
77
  "lineHeight": true,
78
+ "textColumns": true,
78
79
  "__experimentalFontFamily": true,
79
80
  "__experimentalFontWeight": true,
80
81
  "__experimentalFontStyle": true,
@@ -80,8 +80,8 @@ function GroupEdit({ attributes, name, setAttributes, clientId }) {
80
80
  } = attributes;
81
81
  const { type = "default" } = layout;
82
82
  const layoutSupportEnabled = themeSupportsLayout || type === "flex" || type === "grid";
83
- const ref = (0, import_element.useRef)();
84
- const blockProps = (0, import_block_editor.useBlockProps)({ ref });
83
+ const [dropZoneElement, setDropZoneElement] = (0, import_element.useState)(null);
84
+ const blockProps = (0, import_block_editor.useBlockProps)({ ref: setDropZoneElement });
85
85
  const [showPlaceholder, setShowPlaceholder] = (0, import_placeholder.useShouldShowPlaceHolder)({
86
86
  attributes,
87
87
  usedLayoutType: type,
@@ -96,7 +96,7 @@ function GroupEdit({ attributes, name, setAttributes, clientId }) {
96
96
  const innerBlocksProps = (0, import_block_editor.useInnerBlocksProps)(
97
97
  layoutSupportEnabled ? blockProps : { className: "wp-block-group__inner-container" },
98
98
  {
99
- dropZoneElement: ref.current,
99
+ dropZoneElement,
100
100
  templateLock,
101
101
  allowedBlocks,
102
102
  renderAppender
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/group/edit.jsx"],
4
- "sourcesContent": ["import { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';\nimport { unlock } from '../lock-unlock';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\n/**\n * Render inspector controls for the Group block.\n *\n * @param {Object} props Component props.\n * @param {string} props.tagName The HTML tag name.\n * @param {Function} props.onSelectTagName onChange function for the SelectControl.\n * @param {string} props.clientId The client ID of the current block.\n *\n * @return {React.JSX.Element} The control group.\n */\nfunction GroupEditControls( { tagName, onSelectTagName, clientId } ) {\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<HTMLElementControl\n\t\t\t\ttagName={ tagName }\n\t\t\t\tonChange={ onSelectTagName }\n\t\t\t\tclientId={ clientId }\n\t\t\t\toptions={ [\n\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t] }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nfunction GroupEdit( { attributes, name, setAttributes, clientId } ) {\n\tconst { hasInnerBlocks, themeSupportsLayout } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getSettings } = select( blockEditorStore );\n\t\t\tconst block = getBlock( clientId );\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: !! ( block && block.innerBlocks.length ),\n\t\t\t\tthemeSupportsLayout: getSettings()?.supportsLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst {\n\t\ttagName: TagName = 'div',\n\t\ttemplateLock,\n\t\tallowedBlocks,\n\t\tlayout = {},\n\t} = attributes;\n\n\t// Layout settings.\n\tconst { type = 'default' } = layout;\n\tconst layoutSupportEnabled =\n\t\tthemeSupportsLayout || type === 'flex' || type === 'grid';\n\n\t// Hooks.\n\tconst ref = useRef();\n\tconst blockProps = useBlockProps( { ref } );\n\n\tconst [ showPlaceholder, setShowPlaceholder ] = useShouldShowPlaceHolder( {\n\t\tattributes,\n\t\tusedLayoutType: type,\n\t\thasInnerBlocks,\n\t} );\n\n\t// Default to the regular appender being rendered.\n\tlet renderAppender;\n\tif ( showPlaceholder ) {\n\t\t// In the placeholder state, ensure the appender is not rendered.\n\t\t// This is needed because `...innerBlocksProps` is used in the placeholder\n\t\t// state so that blocks can dragged onto the placeholder area\n\t\t// from both the list view and in the editor canvas.\n\t\trenderAppender = false;\n\t} else if ( ! hasInnerBlocks ) {\n\t\t// When there is no placeholder, but the block is also empty,\n\t\t// use the larger button appender.\n\t\trenderAppender = InnerBlocks.ButtonBlockAppender;\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\tlayoutSupportEnabled\n\t\t\t? blockProps\n\t\t\t: { className: 'wp-block-group__inner-container' },\n\t\t{\n\t\t\tdropZoneElement: ref.current,\n\t\t\ttemplateLock,\n\t\t\tallowedBlocks,\n\t\t\trenderAppender,\n\t\t}\n\t);\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst selectVariation = ( nextVariation ) => {\n\t\tsetAttributes( nextVariation.attributes );\n\t\tselectBlock( clientId, -1 );\n\t\tsetShowPlaceholder( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<GroupEditControls\n\t\t\t\ttagName={ TagName }\n\t\t\t\tonSelectTagName={ ( value ) =>\n\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t}\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t{ showPlaceholder && (\n\t\t\t\t<div>\n\t\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t\t<GroupPlaceHolder\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tonSelect={ selectVariation }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...innerBlocksProps } />\n\t\t\t) }\n\t\t\t{ /* Ideally this is not needed but it's there for backward compatibility reason\n\t\t\t\tto keep this div for themes that might rely on its presence */ }\n\t\t\t{ ! layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default GroupEdit;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,0BAOO;AACP,qBAAuB;AACvB,kBAAmB;AACnB,yBAA2D;AAC3D,yBAAuB;AAiBpB;AAfH,IAAM,EAAE,mBAAmB,QAAI,2BAAQ,oBAAAA,WAAuB;AAY9D,SAAS,kBAAmB,EAAE,SAAS,iBAAiB,SAAS,GAAI;AACpE,SACC,4CAAC,yCAAkB,OAAM,YACxB;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,UAAW;AAAA,MACX;AAAA,MACA,SAAU;AAAA,QACT,EAAE,WAAO,gBAAI,iBAAkB,GAAG,OAAO,MAAM;AAAA,QAC/C,EAAE,OAAO,YAAY,OAAO,SAAS;AAAA,QACrC,EAAE,OAAO,UAAU,OAAO,OAAO;AAAA,QACjC,EAAE,OAAO,aAAa,OAAO,UAAU;AAAA,QACvC,EAAE,OAAO,aAAa,OAAO,UAAU;AAAA,QACvC,EAAE,OAAO,WAAW,OAAO,QAAQ;AAAA,QACnC,EAAE,OAAO,YAAY,OAAO,SAAS;AAAA,MACtC;AAAA;AAAA,EACD,GACD;AAEF;AAEA,SAAS,U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AkB,CAAE,UACnB,cAAe,EAAE,SAAS,MAAM,CAAE;AAAA,QAEnC;AAAA;AAAA,IACD;AAAA,IACE,mBACD,6CAAC,SACE;AAAA,uBAAiB;AAAA,MACnB;AAAA,QAAC,mBAAAC;AAAA,QAAA;AAAA,UACA;AAAA,UACA,UAAW;AAAA;AAAA,MACZ;AAAA,OACD;AAAA,IAEC,wBAAwB,CAAE,mBAC3B,4CAAC,WAAU,GAAG,kBAAmB;AAAA,IAIhC,CAAE,wBAAwB,CAAE,mBAC7B,4CAAC,WAAU,GAAG,YACb,sDAAC,SAAM,GAAG,kBAAmB,GAC9B;AAAA,KAEF;AAEF;AAEA,IAAO,eAAQ;",
4
+ "sourcesContent": ["import { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';\nimport { unlock } from '../lock-unlock';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\n/**\n * Render inspector controls for the Group block.\n *\n * @param {Object} props Component props.\n * @param {string} props.tagName The HTML tag name.\n * @param {Function} props.onSelectTagName onChange function for the SelectControl.\n * @param {string} props.clientId The client ID of the current block.\n *\n * @return {React.JSX.Element} The control group.\n */\nfunction GroupEditControls( { tagName, onSelectTagName, clientId } ) {\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<HTMLElementControl\n\t\t\t\ttagName={ tagName }\n\t\t\t\tonChange={ onSelectTagName }\n\t\t\t\tclientId={ clientId }\n\t\t\t\toptions={ [\n\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t] }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nfunction GroupEdit( { attributes, name, setAttributes, clientId } ) {\n\tconst { hasInnerBlocks, themeSupportsLayout } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getSettings } = select( blockEditorStore );\n\t\t\tconst block = getBlock( clientId );\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: !! ( block && block.innerBlocks.length ),\n\t\t\t\tthemeSupportsLayout: getSettings()?.supportsLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst {\n\t\ttagName: TagName = 'div',\n\t\ttemplateLock,\n\t\tallowedBlocks,\n\t\tlayout = {},\n\t} = attributes;\n\n\t// Layout settings.\n\tconst { type = 'default' } = layout;\n\tconst layoutSupportEnabled =\n\t\tthemeSupportsLayout || type === 'flex' || type === 'grid';\n\n\t// State, not a ref, so that the element is there on the next render.\n\tconst [ dropZoneElement, setDropZoneElement ] = useState( null );\n\tconst blockProps = useBlockProps( { ref: setDropZoneElement } );\n\n\tconst [ showPlaceholder, setShowPlaceholder ] = useShouldShowPlaceHolder( {\n\t\tattributes,\n\t\tusedLayoutType: type,\n\t\thasInnerBlocks,\n\t} );\n\n\t// Default to the regular appender being rendered.\n\tlet renderAppender;\n\tif ( showPlaceholder ) {\n\t\t// In the placeholder state, ensure the appender is not rendered.\n\t\t// This is needed because `...innerBlocksProps` is used in the placeholder\n\t\t// state so that blocks can dragged onto the placeholder area\n\t\t// from both the list view and in the editor canvas.\n\t\trenderAppender = false;\n\t} else if ( ! hasInnerBlocks ) {\n\t\t// When there is no placeholder, but the block is also empty,\n\t\t// use the larger button appender.\n\t\trenderAppender = InnerBlocks.ButtonBlockAppender;\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\tlayoutSupportEnabled\n\t\t\t? blockProps\n\t\t\t: { className: 'wp-block-group__inner-container' },\n\t\t{\n\t\t\tdropZoneElement,\n\t\t\ttemplateLock,\n\t\t\tallowedBlocks,\n\t\t\trenderAppender,\n\t\t}\n\t);\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst selectVariation = ( nextVariation ) => {\n\t\tsetAttributes( nextVariation.attributes );\n\t\tselectBlock( clientId, -1 );\n\t\tsetShowPlaceholder( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<GroupEditControls\n\t\t\t\ttagName={ TagName }\n\t\t\t\tonSelectTagName={ ( value ) =>\n\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t}\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t{ showPlaceholder && (\n\t\t\t\t<div>\n\t\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t\t<GroupPlaceHolder\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tonSelect={ selectVariation }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...innerBlocksProps } />\n\t\t\t) }\n\t\t\t{ /* Ideally this is not needed but it's there for backward compatibility reason\n\t\t\t\tto keep this div for themes that might rely on its presence */ }\n\t\t\t{ ! layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default GroupEdit;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,0BAOO;AACP,qBAAyB;AACzB,kBAAmB;AACnB,yBAA2D;AAC3D,yBAAuB;AAiBpB;AAfH,IAAM,EAAE,mBAAmB,QAAI,2BAAQ,oBA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AAAA,IACzE;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,EACD,CAAE;AAGF,MAAI;AACJ,MAAK,iBAAkB;AAKtB,qBAAiB;AAAA,EAClB,WAAY,CAAE,gBAAiB;AAG9B,qBAAiB,gCAAY;AAAA,EAC9B;AAEA,QAAM,uBAAmB;AAAA,IACxB,uBACG,aACA,EAAE,WAAW,kCAAkC;AAAA,IAClD;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,QAAM,EAAE,YAAY,QAAI,yBAAa,oBAAAA,KAAiB;AAEtD,QAAM,kBAAkB,CAAE,kBAAmB;AAC5C,kBAAe,cAAc,UAAW;AACxC,gBAAa,UAAU,EAAG;AAC1B,uBAAoB,KAAM;AAAA,EAC3B;AAEA,SACC,4EACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,SAAU;AAAA,QACV,iBAAkB,CAAE,UACnB,cAAe,EAAE,SAAS,MAAM,CAAE;AAAA,QAEnC;AAAA;AAAA,IACD;AAAA,IACE,mBACD,6CAAC,SACE;AAAA,uBAAiB;AAAA,MACnB;AAAA,QAAC,mBAAAC;AAAA,QAAA;AAAA,UACA;AAAA,UACA,UAAW;AAAA;AAAA,MACZ;AAAA,OACD;AAAA,IAEC,wBAAwB,CAAE,mBAC3B,4CAAC,WAAU,GAAG,kBAAmB;AAAA,IAIhC,CAAE,wBAAwB,CAAE,mBAC7B,4CAAC,WAAU,GAAG,YACb,sDAAC,SAAM,GAAG,kBAAmB,GAC9B;AAAA,KAEF;AAEF;AAEA,IAAO,eAAQ;",
6
6
  "names": ["blockEditorPrivateApis", "blockEditorStore", "GroupPlaceHolder"]
7
7
  }
@@ -30,6 +30,15 @@
30
30
  "anchor": true,
31
31
  "className": true,
32
32
  "splitting": true,
33
+ "background": {
34
+ "backgroundImage": true,
35
+ "backgroundSize": true,
36
+ "gradient": true,
37
+ "__experimentalDefaultControls": {
38
+ "backgroundImage": true,
39
+ "gradient": true
40
+ }
41
+ },
33
42
  "__experimentalBorder": {
34
43
  "color": true,
35
44
  "radius": true,
@@ -44,6 +53,10 @@
44
53
  "text": true
45
54
  }
46
55
  },
56
+ "dimensions": {
57
+ "minHeight": true,
58
+ "minWidth": true
59
+ },
47
60
  "shadow": true,
48
61
  "spacing": {
49
62
  "margin": true,
@@ -57,6 +70,7 @@
57
70
  "fontSize": true,
58
71
  "lineHeight": true,
59
72
  "textAlign": true,
73
+ "textIndent": true,
60
74
  "__experimentalFontFamily": true,
61
75
  "__experimentalFontStyle": true,
62
76
  "__experimentalFontWeight": true,
@@ -33,6 +33,11 @@
33
33
  "anchor": true,
34
34
  "reusable": false,
35
35
  "html": false,
36
+ "background": {
37
+ "backgroundImage": true,
38
+ "backgroundSize": true,
39
+ "gradient": true
40
+ },
36
41
  "typography": {
37
42
  "fontSize": true,
38
43
  "lineHeight": true,
@@ -46,6 +51,31 @@
46
51
  "fontSize": true
47
52
  }
48
53
  },
54
+ "shadow": true,
55
+ "dimensions": {
56
+ "minHeight": true,
57
+ "minWidth": true
58
+ },
59
+ "__experimentalBorder": {
60
+ "color": true,
61
+ "radius": true,
62
+ "style": true,
63
+ "width": true,
64
+ "__experimentalDefaultControls": {
65
+ "color": false,
66
+ "radius": false,
67
+ "style": false,
68
+ "width": false
69
+ }
70
+ },
71
+ "spacing": {
72
+ "margin": true,
73
+ "padding": true,
74
+ "__experimentalDefaultControls": {
75
+ "margin": false,
76
+ "padding": false
77
+ }
78
+ },
49
79
  "interactivity": {
50
80
  "clientNavigation": true
51
81
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/home-link/edit.jsx"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport {\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tButton,\n\tCheckboxControl,\n\tTextControl,\n\tTextareaControl as WCTextareaControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { external } from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst preventDefault = ( event ) => event.preventDefault();\n\nexport default function HomeEdit( { attributes, setAttributes, context } ) {\n\tconst {\n\t\thomeUrl,\n\t\tonNavigateToEntityRecord,\n\t\tfrontPageId,\n\t\tfrontPageTemplateId,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, getDefaultTemplateId, canUser } =\n\t\t\tselect( coreStore );\n\n\t\t// Site index.\n\t\tconst baseUrl = getEntityRecord( 'root', '__unstableBase' )?.home;\n\n\t\t// Front-page data (only available if the user can read site settings).\n\t\tconst canReadSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} );\n\t\tconst site = canReadSettings ? getEntityRecord( 'root', 'site' ) : null;\n\t\tconst resolvedFrontPageId =\n\t\t\tsite?.show_on_front === 'page' ? site?.page_on_front : null;\n\n\t\t// When no specific front page is set, fall back to the front-page template.\n\t\tconst resolvedFrontPageTemplateId = ! resolvedFrontPageId\n\t\t\t? getDefaultTemplateId( { slug: 'front-page' } )\n\t\t\t: null;\n\n\t\treturn {\n\t\t\thomeUrl: baseUrl,\n\t\t\tonNavigateToEntityRecord:\n\t\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t\t.onNavigateToEntityRecord,\n\t\t\tfrontPageId: resolvedFrontPageId,\n\t\t\tfrontPageTemplateId: resolvedFrontPageTemplateId,\n\t\t};\n\t}, [] );\n\n\tconst { textColor, backgroundColor, style } = context;\n\tconst { label, opensInNewTab, description } = attributes;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( 'wp-block-navigation-item', {\n\t\t\t'has-text-color': !! textColor || !! style?.color?.text,\n\t\t\t[ `has-${ textColor }-color` ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || !! style?.color?.background,\n\t\t\t[ `has-${ backgroundColor }-background-color` ]: !! backgroundColor,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: style?.color?.text,\n\t\t\tbackgroundColor: style?.color?.background,\n\t\t},\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"content\">\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tlabel: '',\n\t\t\t\t\t\t\topensInNewTab: false,\n\t\t\t\t\t\t\tdescription: '',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! label }\n\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { label: '' } ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\tvalue={ label ? stripHTML( label ) : '' }\n\t\t\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! opensInNewTab }\n\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { opensInNewTab: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tchecked={ opensInNewTab }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { opensInNewTab: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ onNavigateToEntityRecord &&\n\t\t\t\t\t\t( frontPageId || frontPageTemplateId ) && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tif ( frontPageId ) {\n\t\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\t\tpostId: frontPageId,\n\t\t\t\t\t\t\t\t\t\t\tpostType: 'page',\n\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\t\tpostId: frontPageTemplateId,\n\t\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t\t\t\t} );\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\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tclassName=\"navigation-link-to__action-button\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t{ homeUrl && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\ticonPosition=\"right\"\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tclassName=\"navigation-link-to__action-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'View' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! description }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { description: '' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<WCTextareaControl\n\t\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdescription: descriptionValue,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<a\n\t\t\t\t\tclassName=\"wp-block-home-link__content wp-block-navigation-item__content\"\n\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\tonClick={ preventDefault }\n\t\t\t\t>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\tclassName=\"wp-block-home-link__label\"\n\t\t\t\t\t\tvalue={ label ?? __( 'Home' ) }\n\t\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\taria-label={ __( 'Home link text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add label…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t/>\n\t\t\t\t\t{ description && (\n\t\t\t\t\t\t<span className=\"wp-block-navigation-item__description\">\n\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</a>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,0BAKO;AACP,wBAOO;AACP,kBAAmB;AACnB,kBAA0B;AAC1B,uBAAmC;AACnC,mBAAyB;AACzB,iBAAiD;AACjD,mBAA+C;AA2D7C;AAzDF,IAAM,iBAAiB,CAAE,UAAW,MAAM,eAAe;AAE1C,SAAR,SAA2B,EAAE,YAAY,eAAe,QAAQ,GAAI;AAC1E,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI,uBAAW,CAAE,WAAY;AAC5B,UAAM,EAAE,iBAAiB,sBAAsB,QAAQ,IACtD,OAAQ,iBAAAA,KAAU;AAGnB,UAAM,UAAU,gBAAiB,QAAQ,gBAAiB,GAAG;AAG7D,UAAM,kBAAkB,QAAS,QAAQ;AAAA,MACxC,MAAM;AAAA,MACN,MAAM;AAAA,IACP,CAAE;AACF,UAAM,OAAO,kBAAkB,gBAAiB,QAAQ,MAAO,IAAI;AACnE,UAAM,sBACL,MAAM,kBAAkB,SAAS,MAAM,gBAAgB;AAGxD,UAAM,8BAA8B,CAAE,sBACnC,qBAAsB,EAAE,MAAM,aAAa,CAAE,IAC7C;AAEH,WAAO;AAAA,MACN,SAAS;AAAA,MACT,0BACC,OAAQ,oBAAAC,KAAiB,EAAE,YAAY,EACrC;AAAA,MACH,aAAa;AAAA,MACb,qBAAqB;AAAA,IACtB;AAAA,EAC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aAAc;AAAA,kBAC1B,OAAQ,eAAe;AAAA,kBACvB,UAAW,CAAE,qBAAsB;AAClC,kCAAe;AAAA,sBACd,aAAa;AAAA,oBACd,CAAE;AAAA,kBACH;AAAA,kBACA,UAAO;AAAA,oBACN;AAAA,kBACD;AAAA;AAAA,cACD;AAAA;AAAA,UACD;AAAA;AAAA;AAAA,IACD,GACD;AAAA,IACA,4CAAC,SAAM,GAAG,YACT;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,MAAO;AAAA,QACP,SAAU;AAAA,QAEV;AAAA;AAAA,YAAC;AAAA;AAAA,cACA,YAAW;AAAA,cACX,WAAU;AAAA,cACV,OAAQ,aAAS,gBAAI,MAAO;AAAA,cAC5B,UAAW,CAAE,eAAgB;AAC5B,8BAAe,EAAE,OAAO,WAAW,CAAE;AAAA,cACtC;AAAA,cACA,kBAAa,gBAAI,gBAAiB;AAAA,cAClC,iBAAc,gBAAI,YAAa;AAAA,cAC/B,8BAA4B;AAAA;AAAA,UAC7B;AAAA,UACE,eACD,4CAAC,UAAK,WAAU,yCACb,uBACH;AAAA;AAAA;AAAA,IAEF,GACD;AAAA,KACD;AAEF;",
6
- "names": ["coreStore", "blockEditorStore", "clsx", "ToolsPanel", "ToolsPanelItem", "stripHTML", "WCTextareaControl"]
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport {\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tButton,\n\tCheckboxControl as WCCheckboxControl,\n\tTextControl,\n\tTextareaControl as WCTextareaControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { external } from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst preventDefault = ( event ) => event.preventDefault();\n\nexport default function HomeEdit( { attributes, setAttributes, context } ) {\n\tconst {\n\t\thomeUrl,\n\t\tonNavigateToEntityRecord,\n\t\tfrontPageId,\n\t\tfrontPageTemplateId,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, getDefaultTemplateId, canUser } =\n\t\t\tselect( coreStore );\n\n\t\t// Site index.\n\t\tconst baseUrl = getEntityRecord( 'root', '__unstableBase' )?.home;\n\n\t\t// Front-page data (only available if the user can read site settings).\n\t\tconst canReadSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} );\n\t\tconst site = canReadSettings ? getEntityRecord( 'root', 'site' ) : null;\n\t\tconst resolvedFrontPageId =\n\t\t\tsite?.show_on_front === 'page' ? site?.page_on_front : null;\n\n\t\t// When no specific front page is set, fall back to the front-page template.\n\t\tconst resolvedFrontPageTemplateId = ! resolvedFrontPageId\n\t\t\t? getDefaultTemplateId( { slug: 'front-page' } )\n\t\t\t: null;\n\n\t\treturn {\n\t\t\thomeUrl: baseUrl,\n\t\t\tonNavigateToEntityRecord:\n\t\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t\t.onNavigateToEntityRecord,\n\t\t\tfrontPageId: resolvedFrontPageId,\n\t\t\tfrontPageTemplateId: resolvedFrontPageTemplateId,\n\t\t};\n\t}, [] );\n\n\tconst { textColor, backgroundColor, style } = context;\n\tconst { label, opensInNewTab, description } = attributes;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( 'wp-block-navigation-item', {\n\t\t\t'has-text-color': !! textColor || !! style?.color?.text,\n\t\t\t[ `has-${ textColor }-color` ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || !! style?.color?.background,\n\t\t\t[ `has-${ backgroundColor }-background-color` ]: !! backgroundColor,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: style?.color?.text,\n\t\t\tbackgroundColor: style?.color?.background,\n\t\t},\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"content\">\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tlabel: '',\n\t\t\t\t\t\t\topensInNewTab: false,\n\t\t\t\t\t\t\tdescription: '',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! label }\n\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { label: '' } ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\tvalue={ label ? stripHTML( label ) : '' }\n\t\t\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! opensInNewTab }\n\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { opensInNewTab: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<WCCheckboxControl\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tchecked={ opensInNewTab }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { opensInNewTab: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ onNavigateToEntityRecord &&\n\t\t\t\t\t\t( frontPageId || frontPageTemplateId ) && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tif ( frontPageId ) {\n\t\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\t\tpostId: frontPageId,\n\t\t\t\t\t\t\t\t\t\t\tpostType: 'page',\n\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\t\tpostId: frontPageTemplateId,\n\t\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t\t\t\t} );\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\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tclassName=\"navigation-link-to__action-button\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t{ homeUrl && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\ticonPosition=\"right\"\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tclassName=\"navigation-link-to__action-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'View' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! description }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { description: '' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<WCTextareaControl\n\t\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdescription: descriptionValue,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<a\n\t\t\t\t\tclassName=\"wp-block-home-link__content wp-block-navigation-item__content\"\n\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\tonClick={ preventDefault }\n\t\t\t\t>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\tclassName=\"wp-block-home-link__label\"\n\t\t\t\t\t\tvalue={ label ?? __( 'Home' ) }\n\t\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\taria-label={ __( 'Home link text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add label…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t/>\n\t\t\t\t\t{ description && (\n\t\t\t\t\t\t<span className=\"wp-block-navigation-item__description\">\n\t\t\t\t\t\t\t{ description }\n\t\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A,UACD;AAAA;AAAA;AAAA,IACD,GACD;AAAA,IACA,4CAAC,SAAM,GAAG,YACT;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,MAAO;AAAA,QACP,SAAU;AAAA,QAEV;AAAA;AAAA,YAAC;AAAA;AAAA,cACA,YAAW;AAAA,cACX,WAAU;AAAA,cACV,OAAQ,aAAS,gBAAI,MAAO;AAAA,cAC5B,UAAW,CAAE,eAAgB;AAC5B,8BAAe,EAAE,OAAO,WAAW,CAAE;AAAA,cACtC;AAAA,cACA,kBAAa,gBAAI,gBAAiB;AAAA,cAClC,iBAAc,gBAAI,YAAa;AAAA,cAC/B,8BAA4B;AAAA;AAAA,UAC7B;AAAA,UACE,eACD,4CAAC,UAAK,WAAU,yCACb,uBACH;AAAA;AAAA;AAAA,IAEF,GACD;AAAA,KACD;AAEF;",
6
+ "names": ["coreStore", "blockEditorStore", "clsx", "ToolsPanel", "ToolsPanelItem", "stripHTML", "WCCheckboxControl", "WCTextareaControl"]
7
7
  }
@@ -83,7 +83,9 @@ function CustomInserterModal({ onClose, value, onChange }) {
83
83
  return icons.filter((icon) => {
84
84
  const iconName = (0, import_search_patterns.normalizeSearchInput)(icon.name);
85
85
  const iconLabel = (0, import_search_patterns.normalizeSearchInput)(icon.label);
86
- return iconName.includes(input) || iconLabel.includes(input);
86
+ return iconName.includes(input) || iconLabel.includes(input) || (icon.keywords ?? []).some(
87
+ (keyword) => (0, import_search_patterns.normalizeSearchInput)(keyword).includes(input)
88
+ );
87
89
  });
88
90
  }
89
91
  return icons;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/icon/components/custom-inserter/index.jsx"],
4
- "sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { Modal, SearchControl, Spinner } from '@wordpress/components';\nimport { Stack, Tabs } from '@wordpress/ui';\nimport { useState, useMemo } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport IconGrid from './icon-grid';\nimport { normalizeSearchInput } from '../../../utils/search-patterns';\n\nexport default function CustomInserterModal( { onClose, value, onChange } ) {\n\tconst [ searchInput, setSearchInput ] = useState( '' );\n\tconst [ currentCollection, setCurrentCollection ] = useState( null );\n\n\tconst debouncedSetSearchInput = useDebounce( setSearchInput, 300 );\n\n\tconst collections = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreDataStore ).getEntityRecords(\n\t\t\t\t'root',\n\t\t\t\t'iconCollection'\n\t\t\t),\n\t\t[]\n\t);\n\n\t// Default to the collection the selected icon belongs to, otherwise the\n\t// first collection.\n\tconst selectedCollection = value?.split( '/' )[ 0 ];\n\tconst collectionSlug =\n\t\tcurrentCollection ??\n\t\t( collections?.some( ( { slug } ) => slug === selectedCollection )\n\t\t\t? selectedCollection\n\t\t\t: collections?.[ 0 ]?.slug ) ??\n\t\tnull;\n\n\tconst { icons, hasResolvedIcons } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( collectionSlug === null ) {\n\t\t\t\treturn { icons: null, hasResolvedIcons: false };\n\t\t\t}\n\t\t\tconst query =\n\t\t\t\tcollectionSlug === '' ? {} : { collection: collectionSlug };\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreDataStore );\n\t\t\treturn {\n\t\t\t\ticons: getEntityRecords( 'root', 'icon', query ),\n\t\t\t\thasResolvedIcons: hasFinishedResolution( 'getEntityRecords', [\n\t\t\t\t\t'root',\n\t\t\t\t\t'icon',\n\t\t\t\t\tquery,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ collectionSlug ]\n\t);\n\n\tconst filteredIcons = useMemo( () => {\n\t\tif ( ! icons ) {\n\t\t\treturn [];\n\t\t}\n\t\tif ( searchInput ) {\n\t\t\tconst input = normalizeSearchInput( searchInput );\n\t\t\treturn icons.filter( ( icon ) => {\n\t\t\t\tconst iconName = normalizeSearchInput( icon.name );\n\t\t\t\tconst iconLabel = normalizeSearchInput( icon.label );\n\n\t\t\t\treturn (\n\t\t\t\t\ticonName.includes( input ) || iconLabel.includes( input )\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\n\t\treturn icons;\n\t}, [ searchInput, icons ] );\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"wp-block-icon__inserter-modal\"\n\t\t\ttitle={ __( 'Icon library' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\tisFullScreen\n\t\t>\n\t\t\t<Tabs.Root\n\t\t\t\tclassName=\"wp-block-icon__inserter\"\n\t\t\t\torientation=\"vertical\"\n\t\t\t\tvalue={ collectionSlug }\n\t\t\t\tonValueChange={ setCurrentCollection }\n\t\t\t>\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\tgap=\"lg\"\n\t\t\t\t\tclassName=\"wp-block-icon__inserter-sidebar\"\n\t\t\t\t>\n\t\t\t\t\t<SearchControl\n\t\t\t\t\t\tvalue={ searchInput }\n\t\t\t\t\t\tonChange={ debouncedSetSearchInput }\n\t\t\t\t\t/>\n\t\t\t\t\t<Tabs.List>\n\t\t\t\t\t\t<Tabs.Tab value=\"\">{ __( 'All' ) }</Tabs.Tab>\n\t\t\t\t\t\t{ collections?.map( ( collection ) => (\n\t\t\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\t\t\tkey={ collection.slug }\n\t\t\t\t\t\t\t\tvalue={ collection.slug }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ collection.label }\n\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Tabs.List>\n\t\t\t\t</Stack>\n\t\t\t\t{ [ { slug: '' }, ...( collections ?? [] ) ].map(\n\t\t\t\t\t( collection ) => (\n\t\t\t\t\t\t<Tabs.Panel\n\t\t\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t\t\tkey={ collection.slug }\n\t\t\t\t\t\t\tvalue={ collection.slug }\n\t\t\t\t\t\t\tclassName=\"wp-block-icon__inserter-panel\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ ! hasResolvedIcons ? (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName=\"wp-block-icon__inserter-loading\"\n\t\t\t\t\t\t\t\t\trole=\"status\"\n\t\t\t\t\t\t\t\t\taria-label={ __( 'Loading…' ) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<IconGrid\n\t\t\t\t\t\t\t\t\ticons={ filteredIcons }\n\t\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Tabs.Panel>\n\t\t\t\t\t)\n\t\t\t\t) }\n\t\t\t</Tabs.Root>\n\t\t</Modal>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmB;AACnB,wBAA8C;AAC9C,gBAA4B;AAC5B,qBAAkC;AAClC,qBAA4B;AAC5B,kBAA0B;AAC1B,uBAAuC;AACvC,uBAAqB;AACrB,6BAAqC;AAqFhC;AAnFU,SAAR,oBAAsC,EAAE,SAAS,OAAO,SAAS,GAAI;AAC3E,QAAM,CAAE,aAAa,cAAe,QAAI,yBAAU,EAAG;AACrD,QAAM,CAAE,mBAAmB,oBAAqB,QAAI,yBAAU,IAAK;AAEnE,QAAM,8BAA0B,4BAAa,gBAAgB,GAAI;AAEjE,QAAM,kBAAc;AAAA,IACnB,CAAE,WACD,OAAQ,iBAAAA,KAAc,EAAE;AAAA,MACvB;AAAA,MACA;AAAA,IACD;AAAA,IACD,CAAC;AAAA,EACF;AAIA,QAAM,qBAAqB,OAAO,MAAO,GA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AEhB;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,WAAU;AAAA,gBACV,KAAI;AAAA,gBACJ,WAAU;AAAA,gBAEV;AAAA;AAAA,oBAAC;AAAA;AAAA,sBACA,OAAQ;AAAA,sBACR,UAAW;AAAA;AAAA,kBACZ;AAAA,kBACA,6CAAC,eAAK,MAAL,EACA;AAAA,gEAAC,eAAK,KAAL,EAAS,OAAM,IAAK,8BAAI,KAAM,GAAG;AAAA,oBAChC,aAAa,IAAK,CAAE,eACrB;AAAA,sBAAC,eAAK;AAAA,sBAAL;AAAA,wBAEA,OAAQ,WAAW;AAAA,wBAEjB,qBAAW;AAAA;AAAA,sBAHP,WAAW;AAAA,oBAIlB,CACC;AAAA,qBACH;AAAA;AAAA;AAAA,YACD;AAAA,YACE,CAAE,EAAE,MAAM,GAAG,GAAG,GAAK,eAAe,CAAC,CAAI,EAAE;AAAA,cAC5C,CAAE,eACD;AAAA,gBAAC,eAAK;AAAA,gBAAL;AAAA,kBACA,UAAW;AAAA,kBAEX,OAAQ,WAAW;AAAA,kBACnB,WAAU;AAAA,kBAER,WAAE,mBACH;AAAA,oBAAC;AAAA;AAAA,sBACA,WAAU;AAAA,sBACV,MAAK;AAAA,sBACL,kBAAa,gBAAI,UAAW;AAAA,sBAE5B,sDAAC,6BAAQ;AAAA;AAAA,kBACV,IAEA;AAAA,oBAAC,iBAAAC;AAAA,oBAAA;AAAA,sBACA,OAAQ;AAAA,sBACR;AAAA,sBACA;AAAA;AAAA,kBACD;AAAA;AAAA,gBAjBK,WAAW;AAAA,cAmBlB;AAAA,YAEF;AAAA;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
4
+ "sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { Modal, SearchControl, Spinner } from '@wordpress/components';\nimport { Stack, Tabs } from '@wordpress/ui';\nimport { useState, useMemo } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport IconGrid from './icon-grid';\nimport { normalizeSearchInput } from '../../../utils/search-patterns';\n\nexport default function CustomInserterModal( { onClose, value, onChange } ) {\n\tconst [ searchInput, setSearchInput ] = useState( '' );\n\tconst [ currentCollection, setCurrentCollection ] = useState( null );\n\n\tconst debouncedSetSearchInput = useDebounce( setSearchInput, 300 );\n\n\tconst collections = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreDataStore ).getEntityRecords(\n\t\t\t\t'root',\n\t\t\t\t'iconCollection'\n\t\t\t),\n\t\t[]\n\t);\n\n\t// Default to the collection the selected icon belongs to, otherwise the\n\t// first collection.\n\tconst selectedCollection = value?.split( '/' )[ 0 ];\n\tconst collectionSlug =\n\t\tcurrentCollection ??\n\t\t( collections?.some( ( { slug } ) => slug === selectedCollection )\n\t\t\t? selectedCollection\n\t\t\t: collections?.[ 0 ]?.slug ) ??\n\t\tnull;\n\n\tconst { icons, hasResolvedIcons } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( collectionSlug === null ) {\n\t\t\t\treturn { icons: null, hasResolvedIcons: false };\n\t\t\t}\n\t\t\tconst query =\n\t\t\t\tcollectionSlug === '' ? {} : { collection: collectionSlug };\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreDataStore );\n\t\t\treturn {\n\t\t\t\ticons: getEntityRecords( 'root', 'icon', query ),\n\t\t\t\thasResolvedIcons: hasFinishedResolution( 'getEntityRecords', [\n\t\t\t\t\t'root',\n\t\t\t\t\t'icon',\n\t\t\t\t\tquery,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ collectionSlug ]\n\t);\n\n\tconst filteredIcons = useMemo( () => {\n\t\tif ( ! icons ) {\n\t\t\treturn [];\n\t\t}\n\t\tif ( searchInput ) {\n\t\t\tconst input = normalizeSearchInput( searchInput );\n\t\t\treturn icons.filter( ( icon ) => {\n\t\t\t\tconst iconName = normalizeSearchInput( icon.name );\n\t\t\t\tconst iconLabel = normalizeSearchInput( icon.label );\n\n\t\t\t\treturn (\n\t\t\t\t\ticonName.includes( input ) ||\n\t\t\t\t\ticonLabel.includes( input ) ||\n\t\t\t\t\t( icon.keywords ?? [] ).some( ( keyword ) =>\n\t\t\t\t\t\tnormalizeSearchInput( keyword ).includes( input )\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\n\t\treturn icons;\n\t}, [ searchInput, icons ] );\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"wp-block-icon__inserter-modal\"\n\t\t\ttitle={ __( 'Icon library' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\tisFullScreen\n\t\t>\n\t\t\t<Tabs.Root\n\t\t\t\tclassName=\"wp-block-icon__inserter\"\n\t\t\t\torientation=\"vertical\"\n\t\t\t\tvalue={ collectionSlug }\n\t\t\t\tonValueChange={ setCurrentCollection }\n\t\t\t>\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\tgap=\"lg\"\n\t\t\t\t\tclassName=\"wp-block-icon__inserter-sidebar\"\n\t\t\t\t>\n\t\t\t\t\t<SearchControl\n\t\t\t\t\t\tvalue={ searchInput }\n\t\t\t\t\t\tonChange={ debouncedSetSearchInput }\n\t\t\t\t\t/>\n\t\t\t\t\t<Tabs.List>\n\t\t\t\t\t\t<Tabs.Tab value=\"\">{ __( 'All' ) }</Tabs.Tab>\n\t\t\t\t\t\t{ collections?.map( ( collection ) => (\n\t\t\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\t\t\tkey={ collection.slug }\n\t\t\t\t\t\t\t\tvalue={ collection.slug }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ collection.label }\n\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Tabs.List>\n\t\t\t\t</Stack>\n\t\t\t\t{ [ { slug: '' }, ...( collections ?? [] ) ].map(\n\t\t\t\t\t( collection ) => (\n\t\t\t\t\t\t<Tabs.Panel\n\t\t\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t\t\tkey={ collection.slug }\n\t\t\t\t\t\t\tvalue={ collection.slug }\n\t\t\t\t\t\t\tclassName=\"wp-block-icon__inserter-panel\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ ! hasResolvedIcons ? (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName=\"wp-block-icon__inserter-loading\"\n\t\t\t\t\t\t\t\t\trole=\"status\"\n\t\t\t\t\t\t\t\t\taria-label={ __( 'Loading…' ) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<IconGrid\n\t\t\t\t\t\t\t\t\ticons={ filteredIcons }\n\t\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Tabs.Panel>\n\t\t\t\t\t)\n\t\t\t\t) }\n\t\t\t</Tabs.Root>\n\t\t</Modal>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmB;AACnB,wBAA8C;AAC9C,gBAA4B;AAC5B,qBAAkC;AAClC,qBAA4B;AAC5B,kBAA0B;AAC1B,uBAAuC;AACvC,uBAAqB;AACrB,6BAAqC;AAyFhC;AAvFU,SAAR,oBAAsC,EAAE,SAAS,OAAO,SAAS,GAAI;AAC3E,QAAM,CAAE,aAAa,cAAe,QAAI,yBAAU,EAAG;AACrD,QAAM,CAAE,mBAAmB,oBAAqB,QAAI,yBAAU,IAAK;AAEnE,QAAM,8BAA0B,4BAAa,gBAAgB,GAAI;AAEjE,QAAM,kBAAc;AAAA,IACnB,CAAE,WACD,OAAQ,iBAAAA,KAAc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;",
6
6
  "names": ["coreDataStore", "IconGrid"]
7
7
  }
@@ -39,6 +39,7 @@ var import_i18n = require("@wordpress/i18n");
39
39
  var import_components = require("@wordpress/components");
40
40
  var import_icons = require("@wordpress/icons");
41
41
  var import_block_editor = require("@wordpress/block-editor");
42
+ var import_blocks = require("@wordpress/blocks");
42
43
  var import_element = require("@wordpress/element");
43
44
  var import_primitives = require("@wordpress/primitives");
44
45
  var import_data = require("@wordpress/data");
@@ -47,6 +48,7 @@ var import_hooks = require("../utils/hooks.cjs");
47
48
  var import_html_renderer = __toESM(require("../utils/html-renderer.cjs"));
48
49
  var import_components2 = require("./components/index.cjs");
49
50
  var import_jsx_runtime = require("react/jsx-runtime");
51
+ var ICON_NAME_REGEX = /^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?\/[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?$/;
50
52
  var IconPlaceholder = ({ className, style }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
51
53
  import_primitives.SVG,
52
54
  {
@@ -71,10 +73,41 @@ var IconPlaceholder = ({ className, style }) => /* @__PURE__ */ (0, import_jsx_r
71
73
  ]
72
74
  }
73
75
  );
74
- function Edit({ attributes, setAttributes }) {
75
- const { icon, ariaLabel, flipHorizontal, flipVertical, rotation } = attributes;
76
+ function Edit({ attributes, setAttributes, isSelected, context }) {
77
+ const {
78
+ icon,
79
+ ariaLabel,
80
+ flipHorizontal,
81
+ flipVertical,
82
+ rotation,
83
+ metadata
84
+ } = attributes;
76
85
  const [isInserterOpen, setInserterOpen] = (0, import_element.useState)(false);
77
86
  const isContentOnlyMode = (0, import_block_editor.useBlockEditingMode)() === "contentOnly";
87
+ const { isIconBindingReadOnly = false, iconBindingReadOnlyMessage } = (0, import_data.useSelect)(
88
+ (select) => {
89
+ if (!isSelected) {
90
+ return {};
91
+ }
92
+ const iconBinding = metadata?.bindings?.icon;
93
+ const blockBindingsSource = (0, import_blocks.getBlockBindingsSource)(
94
+ iconBinding?.source
95
+ );
96
+ return {
97
+ isIconBindingReadOnly: !!iconBinding && !blockBindingsSource?.canUserEditValue?.({
98
+ select,
99
+ context,
100
+ args: iconBinding.args
101
+ }),
102
+ iconBindingReadOnlyMessage: blockBindingsSource?.label ? (0, import_i18n.sprintf)(
103
+ /* translators: %s: Label of the bindings source. */
104
+ (0, import_i18n.__)("Connected to %s"),
105
+ blockBindingsSource.label
106
+ ) : (0, import_i18n.__)("Connected to dynamic data")
107
+ };
108
+ },
109
+ [context, isSelected, metadata?.bindings?.icon]
110
+ );
78
111
  const colorProps = (0, import_block_editor.__experimentalUseColorProps)(attributes);
79
112
  const spacingProps = (0, import_block_editor.__experimentalGetSpacingClassesAndStyles)({
80
113
  style: {
@@ -87,8 +120,14 @@ function Edit({ attributes, setAttributes }) {
87
120
  const dimensionsProps = (0, import_block_editor.getDimensionsClassesAndStyles)(attributes);
88
121
  const selectedIcon = (0, import_data.useSelect)(
89
122
  (select) => {
90
- const { getEntityRecord } = select(import_core_data.store);
91
- return icon ? getEntityRecord("root", "icon", icon) : null;
123
+ if (typeof icon !== "string" || !ICON_NAME_REGEX.test(icon)) {
124
+ return null;
125
+ }
126
+ return select(import_core_data.store).getEntityRecord(
127
+ "root",
128
+ "icon",
129
+ icon
130
+ );
92
131
  },
93
132
  [icon]
94
133
  );
@@ -98,6 +137,7 @@ function Edit({ attributes, setAttributes }) {
98
137
  "is-flip-vertical": flipVertical
99
138
  };
100
139
  const rotationStyle = rotation ? { rotate: `${rotation}deg` } : {};
140
+ const iconToolbarButtonLabel = icon ? (0, import_i18n.__)("Replace") : (0, import_i18n.__)("Choose icon");
101
141
  const blockControls = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
102
142
  icon && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_block_editor.BlockControls, { group: "block", children: [
103
143
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -137,10 +177,14 @@ function Edit({ attributes, setAttributes }) {
137
177
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
138
178
  import_components.ToolbarButton,
139
179
  {
180
+ disabled: isIconBindingReadOnly,
181
+ label: isIconBindingReadOnly ? iconBindingReadOnlyMessage : void 0,
182
+ showTooltip: isIconBindingReadOnly,
183
+ "aria-label": isIconBindingReadOnly ? iconToolbarButtonLabel : void 0,
140
184
  onClick: () => {
141
185
  setInserterOpen(true);
142
186
  },
143
- children: icon ? (0, import_i18n.__)("Replace") : (0, import_i18n.__)("Choose icon")
187
+ children: iconToolbarButtonLabel
144
188
  }
145
189
  ),
146
190
  isContentOnlyMode && icon && // Add some extra controls for content attributes when content only mode is active.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/icon/edit.jsx"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tTextControl,\n\tToolbarButton,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\tflipHorizontal as flipHorizontalIcon,\n\tflipVertical as flipVerticalIcon,\n\trotateRight,\n} from '@wordpress/icons';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tuseBlockEditingMode,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetSpacingClassesAndStyles as useSpacingProps,\n\tgetDimensionsClassesAndStyles as useDimensionsProps,\n} from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport { SVG, Rect, Path } from '@wordpress/primitives';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport HtmlRenderer from '../utils/html-renderer';\nimport { CustomInserterModal } from './components';\n\nconst IconPlaceholder = ( { className, style } ) => (\n\t<SVG\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"none\"\n\t\tfill=\"none\"\n\t\taria-hidden=\"true\"\n\t\tclassName={ clsx( 'wp-block-icon__placeholder', className ) }\n\t\tstyle={ style }\n\t>\n\t\t<Rect width=\"60\" height=\"60\" fill=\"currentColor\" fillOpacity={ 0.1 } />\n\t\t<Path\n\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeOpacity={ 0.25 }\n\t\t\td=\"M60 60 0 0\"\n\t\t/>\n\t</SVG>\n);\n\nexport function Edit( { attributes, setAttributes } ) {\n\tconst { icon, ariaLabel, flipHorizontal, flipVertical, rotation } =\n\t\tattributes;\n\n\tconst [ isInserterOpen, setInserterOpen ] = useState( false );\n\n\tconst isContentOnlyMode = useBlockEditingMode() === 'contentOnly';\n\n\tconst colorProps = useColorProps( attributes );\n\t// Only padding is applied to the inner SVG element, matching the front\n\t// end. The margin support is serialized to the block wrapper instead.\n\tconst spacingProps = useSpacingProps( {\n\t\tstyle: {\n\t\t\tspacing: {\n\t\t\t\tpadding: attributes.style?.spacing?.padding,\n\t\t\t},\n\t\t},\n\t} );\n\tconst borderProps = useBorderProps( attributes );\n\tconst dimensionsProps = useDimensionsProps( attributes );\n\n\tconst selectedIcon = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreDataStore );\n\t\t\treturn icon ? getEntityRecord( 'root', 'icon', icon ) : null;\n\t\t},\n\t\t[ icon ]\n\t);\n\n\tconst iconToDisplay = selectedIcon?.content || '';\n\n\tconst flipClasses = {\n\t\t'is-flip-horizontal': flipHorizontal,\n\t\t'is-flip-vertical': flipVertical,\n\t};\n\n\tconst rotationStyle = rotation ? { rotate: `${ rotation }deg` } : {};\n\n\tconst blockControls = (\n\t\t<>\n\t\t\t{ icon && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ flipHorizontalIcon }\n\t\t\t\t\t\tlabel={ __( 'Flip horizontal' ) }\n\t\t\t\t\t\tisPressed={ flipHorizontal }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tflipHorizontal: ! flipHorizontal,\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<ToolbarButton\n\t\t\t\t\t\ticon={ flipVerticalIcon }\n\t\t\t\t\t\tlabel={ __( 'Flip vertical' ) }\n\t\t\t\t\t\tisPressed={ flipVertical }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tflipVertical: ! flipVertical,\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<ToolbarButton\n\t\t\t\t\t\ticon={ rotateRight }\n\t\t\t\t\t\tlabel={ __( 'Rotate' ) }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\trotation: ( ( rotation || 0 ) + 90 ) % 360,\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</BlockControls>\n\t\t\t) }\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetInserterOpen( true );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ icon ? __( 'Replace' ) : __( 'Choose icon' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t\t{ isContentOnlyMode && icon && (\n\t\t\t\t\t// Add some extra controls for content attributes when content only mode is active.\n\t\t\t\t\t// With content only mode active, the inspector is hidden, so users need another way\n\t\t\t\t\t// to edit these attributes.\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\ticon=\"\"\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: ToolbarButton,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\tclassName: 'is-alternate',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttext={ __( 'Label' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ () => (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tclassName=\"wp-block-icon__toolbar-content\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\t\t\tvalue={ ariaLabel || '' }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tariaLabel: value,\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\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Briefly describe the icon to help screen reader users. Leave blank for decorative icons.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst inspectorControls = icon && (\n\t\t<>\n\t\t\t<InspectorControls group=\"settings\">\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tariaLabel: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! ariaLabel }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { ariaLabel: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Briefly describe the icon to help screen reader users. Leave blank for decorative icons.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ ariaLabel || '' }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { ariaLabel: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...useBlockProps() }>\n\t\t\t\t{ iconToDisplay ? (\n\t\t\t\t\t<HtmlRenderer\n\t\t\t\t\t\thtml={ iconToDisplay }\n\t\t\t\t\t\twrapperProps={ {\n\t\t\t\t\t\t\tclassName: clsx(\n\t\t\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t\t\tspacingProps.className,\n\t\t\t\t\t\t\t\tdimensionsProps.className,\n\t\t\t\t\t\t\t\tflipClasses\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t...colorProps.style,\n\t\t\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t\t\t...dimensionsProps.style,\n\t\t\t\t\t\t\t\t...rotationStyle,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<IconPlaceholder\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t\tspacingProps.className,\n\t\t\t\t\t\t\tdimensionsProps.className,\n\t\t\t\t\t\t\tflipClasses\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t\t...dimensionsProps.style,\n\t\t\t\t\t\t\t...rotationStyle,\n\t\t\t\t\t\t\theight: 'auto',\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ isInserterOpen && (\n\t\t\t\t<CustomInserterModal\n\t\t\t\t\tonClose={ () => setInserterOpen( false ) }\n\t\t\t\t\tvalue={ attributes.icon }\n\t\t\t\t\tonChange={ ( name ) => {\n\t\t\t\t\t\tsetAttributes( { icon: name } );\n\t\t\t\t\t\tsetInserterOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Edit;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAmB;AACnB,wBAMO;AACP,mBAIO;AACP,0BASO;AACP,qBAAyB;AACzB,wBAAgC;AAChC,kBAA0B;AAC1B,uBAAuC;AACvC,mBAA+C;AAC/C,2BAAyB;AACzB,IAAAA,qBAAoC;AAGnC;AADD,IAAM,kBAAkB,CAAE,EAAE,WAAW,MAAM,MAC5C;AAAA,EAAC;AAAA;AAAA,IACA,OAAM;AAAA,IACN,SAAQ;AAAA,IACR,qBAAoB;AAAA,IACpB,MAAK;AAAA,IACL,eAAY;AAAA,IACZ,eAAY,YAAAC,SAAM,8BAA8B,SAAU;AAAA,IAC1D;AAAA,IAEA;AAAA,kDAAC,0BAAK,OAAM,MAAK,QAAO,MAAK,MAAK,gBAAe,aAAc,KAAM;AAAA,MACrE;AAAA,QAAC;AAAA;AAAA,UACA,cAAa;AAAA,UACb,QAAO;AAAA,UACP,eAAgB;AAAA,UAChB,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ACtB,wBAAe,EAAE,MAAM,KAAK,CAAE;AAC9B,0BAAiB,KAAM;AAAA,QACxB;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;AAEA,IAAO,eAAQ;",
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tTextControl,\n\tToolbarButton,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\tflipHorizontal as flipHorizontalIcon,\n\tflipVertical as flipVerticalIcon,\n\trotateRight,\n} from '@wordpress/icons';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tuseBlockEditingMode,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetSpacingClassesAndStyles as useSpacingProps,\n\tgetDimensionsClassesAndStyles as useDimensionsProps,\n} from '@wordpress/block-editor';\nimport { getBlockBindingsSource } from '@wordpress/blocks';\nimport { useState } from '@wordpress/element';\nimport { SVG, Rect, Path } from '@wordpress/primitives';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport HtmlRenderer from '../utils/html-renderer';\nimport { CustomInserterModal } from './components';\n\n// Matches the icon name pattern accepted by /wp/v2/icons/<name> REST route.\nconst ICON_NAME_REGEX =\n\t/^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?\\/[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?$/;\n\nconst IconPlaceholder = ( { className, style } ) => (\n\t<SVG\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"none\"\n\t\tfill=\"none\"\n\t\taria-hidden=\"true\"\n\t\tclassName={ clsx( 'wp-block-icon__placeholder', className ) }\n\t\tstyle={ style }\n\t>\n\t\t<Rect width=\"60\" height=\"60\" fill=\"currentColor\" fillOpacity={ 0.1 } />\n\t\t<Path\n\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeOpacity={ 0.25 }\n\t\t\td=\"M60 60 0 0\"\n\t\t/>\n\t</SVG>\n);\n\nexport function Edit( { attributes, setAttributes, isSelected, context } ) {\n\tconst {\n\t\ticon,\n\t\tariaLabel,\n\t\tflipHorizontal,\n\t\tflipVertical,\n\t\trotation,\n\t\tmetadata,\n\t} = attributes;\n\n\tconst [ isInserterOpen, setInserterOpen ] = useState( false );\n\n\tconst isContentOnlyMode = useBlockEditingMode() === 'contentOnly';\n\tconst { isIconBindingReadOnly = false, iconBindingReadOnlyMessage } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tif ( ! isSelected ) {\n\t\t\t\t\treturn {};\n\t\t\t\t}\n\n\t\t\t\tconst iconBinding = metadata?.bindings?.icon;\n\t\t\t\tconst blockBindingsSource = getBlockBindingsSource(\n\t\t\t\t\ticonBinding?.source\n\t\t\t\t);\n\n\t\t\t\treturn {\n\t\t\t\t\tisIconBindingReadOnly:\n\t\t\t\t\t\t!! iconBinding &&\n\t\t\t\t\t\t! blockBindingsSource?.canUserEditValue?.( {\n\t\t\t\t\t\t\tselect,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\targs: iconBinding.args,\n\t\t\t\t\t\t} ),\n\t\t\t\t\ticonBindingReadOnlyMessage: blockBindingsSource?.label\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: Label of the bindings source. */\n\t\t\t\t\t\t\t\t__( 'Connected to %s' ),\n\t\t\t\t\t\t\t\tblockBindingsSource.label\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: __( 'Connected to dynamic data' ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ context, isSelected, metadata?.bindings?.icon ]\n\t\t);\n\n\tconst colorProps = useColorProps( attributes );\n\t// Only padding is applied to the inner SVG element, matching the front\n\t// end. The margin support is serialized to the block wrapper instead.\n\tconst spacingProps = useSpacingProps( {\n\t\tstyle: {\n\t\t\tspacing: {\n\t\t\t\tpadding: attributes.style?.spacing?.padding,\n\t\t\t},\n\t\t},\n\t} );\n\tconst borderProps = useBorderProps( attributes );\n\tconst dimensionsProps = useDimensionsProps( attributes );\n\n\tconst selectedIcon = useSelect(\n\t\t( select ) => {\n\t\t\tif ( typeof icon !== 'string' || ! ICON_NAME_REGEX.test( icon ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn select( coreDataStore ).getEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'icon',\n\t\t\t\ticon\n\t\t\t);\n\t\t},\n\t\t[ icon ]\n\t);\n\n\tconst iconToDisplay = selectedIcon?.content || '';\n\n\tconst flipClasses = {\n\t\t'is-flip-horizontal': flipHorizontal,\n\t\t'is-flip-vertical': flipVertical,\n\t};\n\n\tconst rotationStyle = rotation ? { rotate: `${ rotation }deg` } : {};\n\tconst iconToolbarButtonLabel = icon ? __( 'Replace' ) : __( 'Choose icon' );\n\n\tconst blockControls = (\n\t\t<>\n\t\t\t{ icon && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ flipHorizontalIcon }\n\t\t\t\t\t\tlabel={ __( 'Flip horizontal' ) }\n\t\t\t\t\t\tisPressed={ flipHorizontal }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tflipHorizontal: ! flipHorizontal,\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<ToolbarButton\n\t\t\t\t\t\ticon={ flipVerticalIcon }\n\t\t\t\t\t\tlabel={ __( 'Flip vertical' ) }\n\t\t\t\t\t\tisPressed={ flipVertical }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tflipVertical: ! flipVertical,\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<ToolbarButton\n\t\t\t\t\t\ticon={ rotateRight }\n\t\t\t\t\t\tlabel={ __( 'Rotate' ) }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\trotation: ( ( rotation || 0 ) + 90 ) % 360,\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</BlockControls>\n\t\t\t) }\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tdisabled={ isIconBindingReadOnly }\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tisIconBindingReadOnly\n\t\t\t\t\t\t\t? iconBindingReadOnlyMessage\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tshowTooltip={ isIconBindingReadOnly }\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tisIconBindingReadOnly\n\t\t\t\t\t\t\t? iconToolbarButtonLabel\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetInserterOpen( true );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ iconToolbarButtonLabel }\n\t\t\t\t</ToolbarButton>\n\t\t\t\t{ isContentOnlyMode && icon && (\n\t\t\t\t\t// Add some extra controls for content attributes when content only mode is active.\n\t\t\t\t\t// With content only mode active, the inspector is hidden, so users need another way\n\t\t\t\t\t// to edit these attributes.\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\ticon=\"\"\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: ToolbarButton,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\tclassName: 'is-alternate',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttext={ __( 'Label' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ () => (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tclassName=\"wp-block-icon__toolbar-content\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\t\t\tvalue={ ariaLabel || '' }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tariaLabel: value,\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\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Briefly describe the icon to help screen reader users. Leave blank for decorative icons.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst inspectorControls = icon && (\n\t\t<>\n\t\t\t<InspectorControls group=\"settings\">\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tariaLabel: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! ariaLabel }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { ariaLabel: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Briefly describe the icon to help screen reader users. Leave blank for decorative icons.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ ariaLabel || '' }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { ariaLabel: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...useBlockProps() }>\n\t\t\t\t{ iconToDisplay ? (\n\t\t\t\t\t<HtmlRenderer\n\t\t\t\t\t\thtml={ iconToDisplay }\n\t\t\t\t\t\twrapperProps={ {\n\t\t\t\t\t\t\tclassName: clsx(\n\t\t\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t\t\tspacingProps.className,\n\t\t\t\t\t\t\t\tdimensionsProps.className,\n\t\t\t\t\t\t\t\tflipClasses\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t...colorProps.style,\n\t\t\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t\t\t...dimensionsProps.style,\n\t\t\t\t\t\t\t\t...rotationStyle,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<IconPlaceholder\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t\tspacingProps.className,\n\t\t\t\t\t\t\tdimensionsProps.className,\n\t\t\t\t\t\t\tflipClasses\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t\t...dimensionsProps.style,\n\t\t\t\t\t\t\t...rotationStyle,\n\t\t\t\t\t\t\theight: 'auto',\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ isInserterOpen && (\n\t\t\t\t<CustomInserterModal\n\t\t\t\t\tonClose={ () => setInserterOpen( false ) }\n\t\t\t\t\tvalue={ attributes.icon }\n\t\t\t\t\tonChange={ ( name ) => {\n\t\t\t\t\t\tsetAttributes( { icon: name } );\n\t\t\t\t\t\tsetInserterOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Edit;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAA4B;AAC5B,wBAMO;AACP,mBAIO;AACP,0BASO;AACP,oBAAuC;AACvC,qBAAyB;AACzB,wBAAgC;AAChC,kBAA0B;AAC1B,uBAAuC;AACvC,mBAA+C;AAC/C,2BAAyB;AACzB,IAAAA,qBAAoC;AAOnC;AAJD,IAAM,kBACL;AAED,IAAM,kBAAkB,CAAE,EAAE,WAAW,MAAM,MAC5C;AAAA,EAAC;AAAA;AAAA,IACA,OAAM;AAAA,IACN,SAAQ;AAAA,IACR,qBAAoB;AAAA,IACpB,MAAK;AAAA,IACL,eAAY;AAAA,IACZ,eAAY,YAAAC,SAAM,8BAA8B,SAAU;AAAA,IAC1D;AAAA,IAEA;AAAA,kDAAC,0BAAK,OAAM,MAAK,QAAO,MAAK,MAAK,gBAAe,aAAc,KAAM;AAAA,MACrE;AAAA,QAAC;AAAA;AAAA,UACA,cAAa;AAAA,UACb,QAAO;AAAA,UACP,eAAgB;AAAA,UAChB,GAAE;AAAA;AAAA,MACH;AAAA;AAAA;AACD;AAGM,SAAS,KAAM,EAAE,YAAY,e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eAAW,YAAAV;AAAA,YACV,WAAW;AAAA,YACX,YAAY;AAAA,YACZ,aAAa;AAAA,YACb,gBAAgB;AAAA,YAChB;AAAA,UACD;AAAA,UACA,OAAO;AAAA,YACN,GAAG,WAAW;AAAA,YACd,GAAG,YAAY;AAAA,YACf,GAAG,aAAa;AAAA,YAChB,GAAG,gBAAgB;AAAA,YACnB,GAAG;AAAA,UACJ;AAAA,QACD;AAAA;AAAA,IACD,IAEA;AAAA,MAAC;AAAA;AAAA,QACA,eAAY,YAAAA;AAAA,UACX,YAAY;AAAA,UACZ,aAAa;AAAA,UACb,gBAAgB;AAAA,UAChB;AAAA,QACD;AAAA,QACA,OAAQ;AAAA,UACP,GAAG,YAAY;AAAA,UACf,GAAG,aAAa;AAAA,UAChB,GAAG,gBAAgB;AAAA,UACnB,GAAG;AAAA,UACH,QAAQ;AAAA,QACT;AAAA;AAAA,IACD,GAEF;AAAA,IACE,kBACD;AAAA,MAAC;AAAA;AAAA,QACA,SAAU,MAAM,gBAAiB,KAAM;AAAA,QACvC,OAAQ,WAAW;AAAA,QACnB,UAAW,CAAE,SAAU;AACtB,wBAAe,EAAE,MAAM,KAAK,CAAE;AAC9B,0BAAiB,KAAM;AAAA,QACxB;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;AAEA,IAAO,eAAQ;",
6
6
  "names": ["import_components", "clsx", "useColorProps", "useSpacingProps", "useBorderProps", "useDimensionsProps", "coreDataStore", "flipHorizontalIcon", "flipVerticalIcon", "ToolsPanel", "ToolsPanelItem", "HtmlRenderer"]
7
7
  }
@@ -58,7 +58,6 @@ var import_utils = require("./utils.cjs");
58
58
  var import_jsx_runtime = require("react/jsx-runtime");
59
59
  var {
60
60
  DimensionsTool,
61
- isDefaultBlockStyleState,
62
61
  ResolutionTool,
63
62
  mediaEditKey,
64
63
  mediaSideloadFromUrlKey
@@ -508,19 +507,22 @@ function Image({
508
507
  );
509
508
  const lightboxChecked = !!lightbox?.enabled || !lightbox && !!lightboxSetting?.enabled;
510
509
  const dropdownMenuProps = (0, import_hooks.useToolsPanelDropdownMenuProps)();
511
- const selectedStyleState = (0, import_data.useSelect)(
510
+ const { selectedStyleState, hasSelectedStyleState } = (0, import_data.useSelect)(
512
511
  (select) => {
513
512
  if (!isSingleSelected) {
514
- return void 0;
513
+ return {
514
+ selectedStyleState: void 0,
515
+ hasSelectedStyleState: false
516
+ };
515
517
  }
516
- const { getSelectedBlockStyleState } = (0, import_lock_unlock.unlock)(
517
- select(import_block_editor.store)
518
- );
519
- return getSelectedBlockStyleState(clientId);
518
+ const { getSelectedBlockStyleState, hasSelectedBlockStyleState } = select(import_block_editor.store);
519
+ return {
520
+ selectedStyleState: getSelectedBlockStyleState(clientId),
521
+ hasSelectedStyleState: hasSelectedBlockStyleState(clientId)
522
+ };
520
523
  },
521
524
  [clientId, isSingleSelected]
522
525
  );
523
- const hasSelectedStyleState = !isDefaultBlockStyleState(selectedStyleState);
524
526
  const selectedStyleStateKey = (0, import_style_state.getStyleStateKey)(selectedStyleState);
525
527
  const activeWidth = (0, import_style_state.getActiveDimensionValue)({
526
528
  attributes,