@wordpress/block-library 11.0.0 → 11.1.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 (811) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +7 -7
  3. package/build/accordion/block.json +4 -1
  4. package/build/accordion-item/block.json +7 -1
  5. package/build/accordion-panel/block.json +9 -1
  6. package/build/archives/block.json +9 -0
  7. package/build/archives/edit.cjs.map +3 -3
  8. package/build/audio/block.json +8 -0
  9. package/build/audio/edit.cjs.map +3 -3
  10. package/build/avatar/hooks.cjs.map +2 -2
  11. package/build/breadcrumbs/block.json +3 -0
  12. package/build/breadcrumbs/edit.cjs.map +3 -3
  13. package/build/button/edit.cjs.map +2 -2
  14. package/build/buttons/block.json +9 -0
  15. package/build/categories/block.json +12 -1
  16. package/build/categories/edit.cjs.map +3 -3
  17. package/build/code/block.json +10 -0
  18. package/build/code/save.cjs.map +2 -2
  19. package/build/column/block.json +9 -0
  20. package/build/columns/block.json +9 -0
  21. package/build/comment-author-name/block.json +3 -0
  22. package/build/comment-content/block.json +5 -0
  23. package/build/comment-date/block.json +3 -0
  24. package/build/comment-edit-link/block.json +3 -0
  25. package/build/comment-reply-link/block.json +3 -0
  26. package/build/comment-template/hooks.cjs.map +2 -2
  27. package/build/comments/block.json +10 -0
  28. package/build/comments-pagination/block.json +3 -0
  29. package/build/comments-pagination-next/block.json +3 -0
  30. package/build/comments-pagination-numbers/block.json +3 -0
  31. package/build/comments-pagination-previous/block.json +6 -0
  32. package/build/comments-title/block.json +3 -0
  33. package/build/cover/edit/index.cjs +4 -1
  34. package/build/cover/edit/index.cjs.map +2 -2
  35. package/build/cover/edit/inspector-controls.cjs +52 -13
  36. package/build/cover/edit/inspector-controls.cjs.map +2 -2
  37. package/build/cover/transforms.cjs.map +2 -2
  38. package/build/details/block.json +12 -0
  39. package/build/details/index.cjs.map +2 -2
  40. package/build/embed/embed-controls.cjs.map +2 -2
  41. package/build/file/block.json +9 -0
  42. package/build/file/deprecated.cjs.map +2 -2
  43. package/build/file/edit.cjs.map +2 -2
  44. package/build/file/inspector.cjs.map +3 -3
  45. package/build/file/save.cjs.map +2 -2
  46. package/build/footnotes/block.json +10 -0
  47. package/build/footnotes/edit.cjs.map +2 -2
  48. package/build/gallery/block.json +9 -0
  49. package/build/gallery/dynamic-gallery.cjs.map +3 -3
  50. package/build/gallery/edit.cjs +65 -39
  51. package/build/gallery/edit.cjs.map +3 -3
  52. package/build/gallery/{flex-styles.cjs → gallery-styles.cjs} +31 -32
  53. package/build/gallery/gallery-styles.cjs.map +7 -0
  54. package/build/gallery/responsive-styles.cjs +27 -5
  55. package/build/gallery/responsive-styles.cjs.map +2 -2
  56. package/build/group/block.json +1 -0
  57. package/build/heading/block.json +11 -0
  58. package/build/heading/index.cjs.map +2 -2
  59. package/build/home-link/block.json +18 -0
  60. package/build/home-link/edit.cjs.map +3 -3
  61. package/build/html/modal.cjs +3 -6
  62. package/build/html/modal.cjs.map +2 -2
  63. package/build/image/edit.cjs.map +2 -2
  64. package/build/image/image.cjs +10 -8
  65. package/build/image/image.cjs.map +3 -3
  66. package/build/image/use-open-image-media-editor-modal.cjs +20 -0
  67. package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
  68. package/build/index.cjs.map +2 -2
  69. package/build/latest-comments/block.json +10 -0
  70. package/build/latest-comments/edit.cjs.map +3 -3
  71. package/build/latest-posts/block.json +10 -0
  72. package/build/latest-posts/edit.cjs.map +2 -2
  73. package/build/list/ordered-list-settings.cjs.map +3 -3
  74. package/build/list-item/hooks/use-enter.cjs.map +2 -2
  75. package/build/loginout/block.json +10 -0
  76. package/build/math/block.json +12 -0
  77. package/build/math/deprecated.cjs +29 -12
  78. package/build/math/deprecated.cjs.map +2 -2
  79. package/build/math/edit.cjs +67 -46
  80. package/build/math/edit.cjs.map +2 -2
  81. package/build/math/save.cjs +2 -2
  82. package/build/math/save.cjs.map +2 -2
  83. package/build/media-text/block.json +1 -0
  84. package/build/media-text/constants.cjs +3 -0
  85. package/build/media-text/constants.cjs.map +2 -2
  86. package/build/media-text/deprecated.cjs.map +2 -2
  87. package/build/media-text/edit.cjs +40 -0
  88. package/build/media-text/edit.cjs.map +3 -3
  89. package/build/media-text/image-fill.cjs.map +2 -2
  90. package/build/media-text/media-container.cjs +3 -3
  91. package/build/media-text/media-container.cjs.map +2 -2
  92. package/build/navigation/edit/index.cjs +1 -4
  93. package/build/navigation/edit/index.cjs.map +2 -2
  94. package/build/navigation/edit/menu-inspector-controls.cjs.map +2 -2
  95. package/build/navigation/edit/overlay-template-part-selector.cjs.map +3 -3
  96. package/build/navigation/edit/responsive-wrapper.cjs.map +2 -2
  97. package/build/navigation/edit/use-generate-default-navigation-title.cjs.map +2 -2
  98. package/build/navigation/view.cjs +2 -2
  99. package/build/navigation/view.cjs.map +2 -2
  100. package/build/navigation-link/edit.cjs.map +2 -2
  101. package/build/navigation-link/link-ui/page-creator.cjs.map +3 -3
  102. package/build/navigation-link/shared/controls.cjs.map +3 -3
  103. package/build/navigation-link/shared/invalid-draft-display.cjs.map +2 -2
  104. package/build/navigation-link/shared/use-link-preview.cjs +13 -13
  105. package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
  106. package/build/navigation-overlay-close/block.json +7 -0
  107. package/build/navigation-submenu/block.json +6 -0
  108. package/build/navigation-submenu/edit.cjs +9 -1
  109. package/build/navigation-submenu/edit.cjs.map +3 -3
  110. package/build/page-list/block.json +10 -0
  111. package/build/paragraph/block.json +1 -0
  112. package/build/paragraph/edit.cjs +1 -2
  113. package/build/paragraph/edit.cjs.map +2 -2
  114. package/build/paragraph/index.cjs +6 -0
  115. package/build/paragraph/index.cjs.map +3 -3
  116. package/build/playlist/block.json +1 -0
  117. package/build/playlist/edit.cjs +2 -1
  118. package/build/playlist/edit.cjs.map +3 -3
  119. package/build/post-author/edit.cjs.map +3 -3
  120. package/build/post-author-biography/block.json +4 -0
  121. package/build/post-author-name/block.json +5 -0
  122. package/build/post-author-name/edit.cjs.map +2 -2
  123. package/build/post-comments-count/block.json +3 -0
  124. package/build/post-comments-form/block.json +10 -0
  125. package/build/post-content/block.json +3 -0
  126. package/build/post-date/block.json +3 -0
  127. package/build/post-date/edit.cjs.map +2 -2
  128. package/build/post-excerpt/block.json +6 -0
  129. package/build/post-excerpt/edit.cjs.map +2 -2
  130. package/build/post-featured-image/edit.cjs +11 -9
  131. package/build/post-featured-image/edit.cjs.map +2 -2
  132. package/build/post-navigation-link/block.json +30 -0
  133. package/build/post-navigation-link/edit.cjs +13 -2
  134. package/build/post-navigation-link/edit.cjs.map +3 -3
  135. package/build/post-template/block.json +13 -1
  136. package/build/post-terms/block.json +6 -0
  137. package/build/post-time-to-read/block.json +6 -0
  138. package/build/post-time-to-read/edit.cjs.map +2 -2
  139. package/build/post-title/block.json +10 -0
  140. package/build/preformatted/block.json +7 -0
  141. package/build/pullquote/block.json +1 -0
  142. package/build/pullquote/deprecated.cjs.map +2 -2
  143. package/build/query/deprecated.cjs.map +2 -2
  144. package/build/query/edit/inspector-controls/index.cjs.map +3 -3
  145. package/build/query/edit/inspector-controls/order-control.cjs.map +3 -3
  146. package/build/query/edit/inspector-controls/sticky-control.cjs.map +3 -3
  147. package/build/query/view.cjs.map +2 -2
  148. package/build/query-no-results/block.json +10 -2
  149. package/build/query-pagination/block.json +3 -0
  150. package/build/query-pagination-next/block.json +3 -0
  151. package/build/query-pagination-numbers/block.json +3 -0
  152. package/build/query-pagination-previous/block.json +3 -0
  153. package/build/query-title/block.json +3 -0
  154. package/build/query-title/use-archive-label.cjs.map +2 -2
  155. package/build/query-total/block.json +6 -0
  156. package/build/quote/block.json +1 -0
  157. package/build/quote/deprecated.cjs.map +2 -2
  158. package/build/quote/transforms.cjs.map +2 -2
  159. package/build/read-more/block.json +6 -0
  160. package/build/rss/block.json +6 -0
  161. package/build/search/edit.cjs.map +3 -3
  162. package/build/separator/edit.cjs.map +3 -3
  163. package/build/site-tagline/block.json +8 -1
  164. package/build/site-title/block.json +7 -1
  165. package/build/social-links/block.json +3 -0
  166. package/build/social-links/edit.cjs +2 -3
  167. package/build/social-links/edit.cjs.map +3 -3
  168. package/build/tab-panel/block.json +25 -0
  169. package/build/tab-panel/controls.cjs.map +3 -3
  170. package/build/tab-panels/block.json +18 -1
  171. package/build/table/state.cjs.map +2 -2
  172. package/build/table-of-contents/block.json +7 -0
  173. package/build/table-of-contents/edit.cjs.map +3 -3
  174. package/build/table-of-contents/utils.cjs.map +2 -2
  175. package/build/tabs/block.json +24 -1
  176. package/build/tabs/use-tab-actions.cjs.map +2 -2
  177. package/build/tag-cloud/block.json +19 -0
  178. package/build/tag-cloud/edit.cjs.map +3 -3
  179. package/build/template-part/edit/advanced-controls.cjs.map +3 -3
  180. package/build/template-part/edit/import-controls.cjs.map +3 -3
  181. package/build/template-part/edit/index.cjs.map +2 -2
  182. package/build/template-part/edit/inner-blocks.cjs.map +2 -2
  183. package/build/template-part/edit/placeholder.cjs.map +2 -2
  184. package/build/template-part/edit/selection-modal.cjs.map +1 -1
  185. package/build/term-count/block.json +7 -0
  186. package/build/term-count/use-term-count.cjs.map +2 -2
  187. package/build/term-description/block.json +9 -0
  188. package/build/term-description/use-term-description.cjs.map +2 -2
  189. package/build/term-name/block.json +10 -0
  190. package/build/term-name/use-term-name.cjs.map +2 -2
  191. package/build/term-template/block.json +10 -1
  192. package/build/terms-query/edit/inspector-controls/index.cjs.map +2 -2
  193. package/build/terms-query/edit/inspector-controls/inherit-control.cjs.map +2 -2
  194. package/build/terms-query/edit/inspector-controls/order-control.cjs.map +3 -3
  195. package/build/terms-query/edit/inspector-controls/taxonomy-control.cjs.map +3 -3
  196. package/build/utils/hooks.cjs.map +2 -2
  197. package/build/utils/media-control.cjs +5 -1
  198. package/build/utils/media-control.cjs.map +2 -2
  199. package/build/utils/poster-image.cjs.map +2 -2
  200. package/build/utils/search-patterns.cjs +7 -43
  201. package/build/utils/search-patterns.cjs.map +3 -3
  202. package/build/utils/style-state.cjs +4 -6
  203. package/build/utils/style-state.cjs.map +2 -2
  204. package/build/verse/block.json +1 -0
  205. package/build/video/block.json +6 -0
  206. package/build/video/edit-common-settings.cjs.map +3 -3
  207. package/build/video/edit.cjs +23 -15
  208. package/build/video/edit.cjs.map +3 -3
  209. package/build/video/index.cjs +0 -2
  210. package/build/video/index.cjs.map +3 -3
  211. package/build/video/save.cjs +5 -1
  212. package/build/video/save.cjs.map +3 -3
  213. package/build/video/tracks-editor.cjs.map +3 -3
  214. package/build-module/accordion/block.json +4 -1
  215. package/build-module/accordion-item/block.json +7 -1
  216. package/build-module/accordion-panel/block.json +9 -1
  217. package/build-module/archives/block.json +9 -0
  218. package/build-module/archives/edit.mjs +2 -2
  219. package/build-module/archives/edit.mjs.map +2 -2
  220. package/build-module/audio/block.json +8 -0
  221. package/build-module/audio/edit.mjs +2 -2
  222. package/build-module/audio/edit.mjs.map +2 -2
  223. package/build-module/avatar/hooks.mjs.map +2 -2
  224. package/build-module/breadcrumbs/block.json +3 -0
  225. package/build-module/breadcrumbs/edit.mjs +3 -3
  226. package/build-module/breadcrumbs/edit.mjs.map +2 -2
  227. package/build-module/button/edit.mjs.map +2 -2
  228. package/build-module/buttons/block.json +9 -0
  229. package/build-module/categories/block.json +12 -1
  230. package/build-module/categories/edit.mjs +2 -2
  231. package/build-module/categories/edit.mjs.map +2 -2
  232. package/build-module/code/block.json +10 -0
  233. package/build-module/code/save.mjs.map +2 -2
  234. package/build-module/column/block.json +9 -0
  235. package/build-module/columns/block.json +9 -0
  236. package/build-module/comment-author-name/block.json +3 -0
  237. package/build-module/comment-content/block.json +5 -0
  238. package/build-module/comment-date/block.json +3 -0
  239. package/build-module/comment-edit-link/block.json +3 -0
  240. package/build-module/comment-reply-link/block.json +3 -0
  241. package/build-module/comment-template/hooks.mjs.map +2 -2
  242. package/build-module/comments/block.json +10 -0
  243. package/build-module/comments-pagination/block.json +3 -0
  244. package/build-module/comments-pagination-next/block.json +3 -0
  245. package/build-module/comments-pagination-numbers/block.json +3 -0
  246. package/build-module/comments-pagination-previous/block.json +6 -0
  247. package/build-module/comments-title/block.json +3 -0
  248. package/build-module/cover/edit/index.mjs +4 -1
  249. package/build-module/cover/edit/index.mjs.map +2 -2
  250. package/build-module/cover/edit/inspector-controls.mjs +57 -14
  251. package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
  252. package/build-module/cover/transforms.mjs.map +2 -2
  253. package/build-module/details/block.json +12 -0
  254. package/build-module/details/index.mjs.map +2 -2
  255. package/build-module/embed/embed-controls.mjs.map +2 -2
  256. package/build-module/file/block.json +9 -0
  257. package/build-module/file/deprecated.mjs.map +2 -2
  258. package/build-module/file/edit.mjs.map +2 -2
  259. package/build-module/file/inspector.mjs +2 -2
  260. package/build-module/file/inspector.mjs.map +2 -2
  261. package/build-module/file/save.mjs.map +2 -2
  262. package/build-module/footnotes/block.json +10 -0
  263. package/build-module/footnotes/edit.mjs.map +2 -2
  264. package/build-module/gallery/block.json +9 -0
  265. package/build-module/gallery/dynamic-gallery.mjs +2 -2
  266. package/build-module/gallery/dynamic-gallery.mjs.map +2 -2
  267. package/build-module/gallery/edit.mjs +68 -42
  268. package/build-module/gallery/edit.mjs.map +2 -2
  269. package/build-module/gallery/{flex-styles.mjs → gallery-styles.mjs} +29 -30
  270. package/build-module/gallery/gallery-styles.mjs.map +7 -0
  271. package/build-module/gallery/responsive-styles.mjs +25 -4
  272. package/build-module/gallery/responsive-styles.mjs.map +2 -2
  273. package/build-module/group/block.json +1 -0
  274. package/build-module/heading/block.json +11 -0
  275. package/build-module/heading/index.mjs.map +2 -2
  276. package/build-module/home-link/block.json +18 -0
  277. package/build-module/home-link/edit.mjs +2 -2
  278. package/build-module/home-link/edit.mjs.map +2 -2
  279. package/build-module/html/modal.mjs +3 -6
  280. package/build-module/html/modal.mjs.map +2 -2
  281. package/build-module/image/edit.mjs.map +2 -2
  282. package/build-module/image/image.mjs +12 -10
  283. package/build-module/image/image.mjs.map +2 -2
  284. package/build-module/image/use-open-image-media-editor-modal.mjs +20 -0
  285. package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
  286. package/build-module/index.mjs.map +2 -2
  287. package/build-module/latest-comments/block.json +10 -0
  288. package/build-module/latest-comments/edit.mjs +2 -2
  289. package/build-module/latest-comments/edit.mjs.map +2 -2
  290. package/build-module/latest-posts/block.json +10 -0
  291. package/build-module/latest-posts/edit.mjs.map +2 -2
  292. package/build-module/list/ordered-list-settings.mjs +2 -2
  293. package/build-module/list/ordered-list-settings.mjs.map +2 -2
  294. package/build-module/list-item/hooks/use-enter.mjs.map +2 -2
  295. package/build-module/loginout/block.json +10 -0
  296. package/build-module/math/block.json +12 -0
  297. package/build-module/math/deprecated.mjs +29 -12
  298. package/build-module/math/deprecated.mjs.map +2 -2
  299. package/build-module/math/edit.mjs +68 -47
  300. package/build-module/math/edit.mjs.map +2 -2
  301. package/build-module/math/save.mjs +2 -2
  302. package/build-module/math/save.mjs.map +2 -2
  303. package/build-module/media-text/block.json +1 -0
  304. package/build-module/media-text/constants.mjs +2 -0
  305. package/build-module/media-text/constants.mjs.map +2 -2
  306. package/build-module/media-text/deprecated.mjs.map +2 -2
  307. package/build-module/media-text/edit.mjs +42 -1
  308. package/build-module/media-text/edit.mjs.map +2 -2
  309. package/build-module/media-text/image-fill.mjs.map +2 -2
  310. package/build-module/media-text/media-container.mjs +1 -1
  311. package/build-module/media-text/media-container.mjs.map +2 -2
  312. package/build-module/navigation/edit/index.mjs +1 -4
  313. package/build-module/navigation/edit/index.mjs.map +2 -2
  314. package/build-module/navigation/edit/menu-inspector-controls.mjs.map +2 -2
  315. package/build-module/navigation/edit/overlay-template-part-selector.mjs +2 -2
  316. package/build-module/navigation/edit/overlay-template-part-selector.mjs.map +2 -2
  317. package/build-module/navigation/edit/responsive-wrapper.mjs.map +2 -2
  318. package/build-module/navigation/edit/use-generate-default-navigation-title.mjs.map +2 -2
  319. package/build-module/navigation/view.mjs +2 -2
  320. package/build-module/navigation/view.mjs.map +2 -2
  321. package/build-module/navigation-link/edit.mjs.map +2 -2
  322. package/build-module/navigation-link/link-ui/page-creator.mjs +2 -2
  323. package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
  324. package/build-module/navigation-link/shared/controls.mjs +2 -2
  325. package/build-module/navigation-link/shared/controls.mjs.map +2 -2
  326. package/build-module/navigation-link/shared/invalid-draft-display.mjs.map +2 -2
  327. package/build-module/navigation-link/shared/use-link-preview.mjs +13 -13
  328. package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
  329. package/build-module/navigation-overlay-close/block.json +7 -0
  330. package/build-module/navigation-submenu/block.json +6 -0
  331. package/build-module/navigation-submenu/edit.mjs +11 -2
  332. package/build-module/navigation-submenu/edit.mjs.map +2 -2
  333. package/build-module/page-list/block.json +10 -0
  334. package/build-module/paragraph/block.json +1 -0
  335. package/build-module/paragraph/edit.mjs +1 -2
  336. package/build-module/paragraph/edit.mjs.map +2 -2
  337. package/build-module/paragraph/index.mjs +6 -0
  338. package/build-module/paragraph/index.mjs.map +2 -2
  339. package/build-module/playlist/block.json +1 -0
  340. package/build-module/playlist/edit.mjs +5 -4
  341. package/build-module/playlist/edit.mjs.map +2 -2
  342. package/build-module/post-author/edit.mjs +2 -2
  343. package/build-module/post-author/edit.mjs.map +2 -2
  344. package/build-module/post-author-biography/block.json +4 -0
  345. package/build-module/post-author-name/block.json +5 -0
  346. package/build-module/post-author-name/edit.mjs.map +2 -2
  347. package/build-module/post-comments-count/block.json +3 -0
  348. package/build-module/post-comments-form/block.json +10 -0
  349. package/build-module/post-content/block.json +3 -0
  350. package/build-module/post-date/block.json +3 -0
  351. package/build-module/post-date/edit.mjs.map +2 -2
  352. package/build-module/post-excerpt/block.json +6 -0
  353. package/build-module/post-excerpt/edit.mjs.map +2 -2
  354. package/build-module/post-featured-image/edit.mjs +11 -9
  355. package/build-module/post-featured-image/edit.mjs.map +2 -2
  356. package/build-module/post-navigation-link/block.json +30 -0
  357. package/build-module/post-navigation-link/edit.mjs +19 -5
  358. package/build-module/post-navigation-link/edit.mjs.map +2 -2
  359. package/build-module/post-template/block.json +13 -1
  360. package/build-module/post-terms/block.json +6 -0
  361. package/build-module/post-time-to-read/block.json +6 -0
  362. package/build-module/post-time-to-read/edit.mjs.map +2 -2
  363. package/build-module/post-title/block.json +10 -0
  364. package/build-module/preformatted/block.json +7 -0
  365. package/build-module/pullquote/block.json +1 -0
  366. package/build-module/pullquote/deprecated.mjs.map +2 -2
  367. package/build-module/query/deprecated.mjs.map +2 -2
  368. package/build-module/query/edit/inspector-controls/index.mjs +2 -2
  369. package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
  370. package/build-module/query/edit/inspector-controls/order-control.mjs +2 -2
  371. package/build-module/query/edit/inspector-controls/order-control.mjs.map +2 -2
  372. package/build-module/query/edit/inspector-controls/sticky-control.mjs +2 -2
  373. package/build-module/query/edit/inspector-controls/sticky-control.mjs.map +2 -2
  374. package/build-module/query/view.mjs.map +2 -2
  375. package/build-module/query-no-results/block.json +10 -2
  376. package/build-module/query-pagination/block.json +3 -0
  377. package/build-module/query-pagination-next/block.json +3 -0
  378. package/build-module/query-pagination-numbers/block.json +3 -0
  379. package/build-module/query-pagination-previous/block.json +3 -0
  380. package/build-module/query-title/block.json +3 -0
  381. package/build-module/query-title/use-archive-label.mjs.map +2 -2
  382. package/build-module/query-total/block.json +6 -0
  383. package/build-module/quote/block.json +1 -0
  384. package/build-module/quote/deprecated.mjs.map +2 -2
  385. package/build-module/quote/transforms.mjs.map +2 -2
  386. package/build-module/read-more/block.json +6 -0
  387. package/build-module/rss/block.json +6 -0
  388. package/build-module/search/edit.mjs +3 -3
  389. package/build-module/search/edit.mjs.map +2 -2
  390. package/build-module/separator/edit.mjs +5 -2
  391. package/build-module/separator/edit.mjs.map +2 -2
  392. package/build-module/site-tagline/block.json +8 -1
  393. package/build-module/site-title/block.json +7 -1
  394. package/build-module/social-links/block.json +3 -0
  395. package/build-module/social-links/edit.mjs +4 -5
  396. package/build-module/social-links/edit.mjs.map +2 -2
  397. package/build-module/tab-panel/block.json +25 -0
  398. package/build-module/tab-panel/controls.mjs +2 -2
  399. package/build-module/tab-panel/controls.mjs.map +2 -2
  400. package/build-module/tab-panels/block.json +18 -1
  401. package/build-module/table/state.mjs.map +2 -2
  402. package/build-module/table-of-contents/block.json +7 -0
  403. package/build-module/table-of-contents/edit.mjs +2 -2
  404. package/build-module/table-of-contents/edit.mjs.map +2 -2
  405. package/build-module/table-of-contents/utils.mjs.map +2 -2
  406. package/build-module/tabs/block.json +24 -1
  407. package/build-module/tabs/use-tab-actions.mjs.map +2 -2
  408. package/build-module/tag-cloud/block.json +19 -0
  409. package/build-module/tag-cloud/edit.mjs +2 -2
  410. package/build-module/tag-cloud/edit.mjs.map +2 -2
  411. package/build-module/template-part/edit/advanced-controls.mjs +5 -2
  412. package/build-module/template-part/edit/advanced-controls.mjs.map +2 -2
  413. package/build-module/template-part/edit/import-controls.mjs +2 -2
  414. package/build-module/template-part/edit/import-controls.mjs.map +2 -2
  415. package/build-module/template-part/edit/index.mjs.map +2 -2
  416. package/build-module/template-part/edit/inner-blocks.mjs.map +2 -2
  417. package/build-module/template-part/edit/placeholder.mjs.map +2 -2
  418. package/build-module/template-part/edit/selection-modal.mjs.map +1 -1
  419. package/build-module/term-count/block.json +7 -0
  420. package/build-module/term-count/use-term-count.mjs.map +2 -2
  421. package/build-module/term-description/block.json +9 -0
  422. package/build-module/term-description/use-term-description.mjs.map +2 -2
  423. package/build-module/term-name/block.json +10 -0
  424. package/build-module/term-name/use-term-name.mjs.map +2 -2
  425. package/build-module/term-template/block.json +10 -1
  426. package/build-module/terms-query/edit/inspector-controls/index.mjs.map +2 -2
  427. package/build-module/terms-query/edit/inspector-controls/inherit-control.mjs.map +2 -2
  428. package/build-module/terms-query/edit/inspector-controls/order-control.mjs +2 -2
  429. package/build-module/terms-query/edit/inspector-controls/order-control.mjs.map +2 -2
  430. package/build-module/terms-query/edit/inspector-controls/taxonomy-control.mjs +2 -2
  431. package/build-module/terms-query/edit/inspector-controls/taxonomy-control.mjs.map +2 -2
  432. package/build-module/utils/hooks.mjs.map +2 -2
  433. package/build-module/utils/media-control.mjs +5 -1
  434. package/build-module/utils/media-control.mjs.map +2 -2
  435. package/build-module/utils/poster-image.mjs.map +2 -2
  436. package/build-module/utils/search-patterns.mjs +7 -32
  437. package/build-module/utils/search-patterns.mjs.map +2 -2
  438. package/build-module/utils/style-state.mjs +6 -4
  439. package/build-module/utils/style-state.mjs.map +2 -2
  440. package/build-module/verse/block.json +1 -0
  441. package/build-module/video/block.json +6 -0
  442. package/build-module/video/edit-common-settings.mjs +2 -2
  443. package/build-module/video/edit-common-settings.mjs.map +2 -2
  444. package/build-module/video/edit.mjs +25 -16
  445. package/build-module/video/edit.mjs.map +2 -2
  446. package/build-module/video/index.mjs +0 -2
  447. package/build-module/video/index.mjs.map +2 -2
  448. package/build-module/video/save.mjs +7 -2
  449. package/build-module/video/save.mjs.map +2 -2
  450. package/build-module/video/tracks-editor.mjs +2 -2
  451. package/build-module/video/tracks-editor.mjs.map +2 -2
  452. package/build-style/button/style-rtl.css +2 -1
  453. package/build-style/button/style.css +2 -1
  454. package/build-style/columns/style-rtl.css +1 -1
  455. package/build-style/columns/style.css +1 -1
  456. package/build-style/comments/editor-rtl.css +1 -1
  457. package/build-style/comments/editor.css +1 -1
  458. package/build-style/comments/style-rtl.css +1 -1
  459. package/build-style/comments/style.css +1 -1
  460. package/build-style/common-rtl.css +1 -1
  461. package/build-style/common.css +1 -1
  462. package/build-style/cover/style-rtl.css +6 -0
  463. package/build-style/cover/style.css +6 -0
  464. package/build-style/editor-rtl.css +21 -7
  465. package/build-style/editor.css +21 -7
  466. package/build-style/embed/editor-rtl.css +2 -1
  467. package/build-style/embed/editor.css +2 -1
  468. package/build-style/gallery/style-rtl.css +1 -2
  469. package/build-style/gallery/style.css +1 -2
  470. package/build-style/image/editor-rtl.css +6 -0
  471. package/build-style/image/editor.css +6 -0
  472. package/build-style/image/style-rtl.css +6 -9
  473. package/build-style/image/style.css +6 -9
  474. package/build-style/math/editor-rtl.css +5 -0
  475. package/build-style/math/editor.css +5 -0
  476. package/build-style/navigation/editor-rtl.css +1 -0
  477. package/build-style/navigation/editor.css +1 -0
  478. package/build-style/navigation/style-rtl.css +19 -4
  479. package/build-style/navigation/style.css +19 -4
  480. package/build-style/navigation-link/editor-rtl.css +3 -1
  481. package/build-style/navigation-link/editor.css +3 -1
  482. package/build-style/navigation-overlay-close/style-rtl.css +1 -1
  483. package/build-style/navigation-overlay-close/style.css +1 -1
  484. package/build-style/navigation-submenu/editor-rtl.css +3 -1
  485. package/build-style/navigation-submenu/editor.css +3 -1
  486. package/build-style/post-navigation-link/style-rtl.css +3 -0
  487. package/build-style/post-navigation-link/style.css +3 -0
  488. package/build-style/post-title/style-rtl.css +2 -2
  489. package/build-style/post-title/style.css +2 -2
  490. package/build-style/query-pagination/editor-rtl.css +0 -3
  491. package/build-style/query-pagination/editor.css +0 -3
  492. package/build-style/search/theme-rtl.css +1 -1
  493. package/build-style/search/theme.css +1 -1
  494. package/build-style/style-rtl.css +47 -23
  495. package/build-style/style.css +47 -23
  496. package/build-style/tab-panel/style-rtl.css +2 -0
  497. package/build-style/tab-panel/style.css +2 -0
  498. package/build-style/theme-rtl.css +1 -1
  499. package/build-style/theme.css +1 -1
  500. package/build-style/verse/style-rtl.css +2 -1
  501. package/build-style/verse/style.css +2 -1
  502. package/package.json +42 -43
  503. package/src/accordion/README.md +3 -0
  504. package/src/accordion/block.json +4 -1
  505. package/src/accordion-item/README.md +5 -0
  506. package/src/accordion-item/block.json +7 -1
  507. package/src/accordion-panel/README.md +7 -0
  508. package/src/accordion-panel/block.json +9 -1
  509. package/src/archives/README.md +4 -0
  510. package/src/archives/block.json +9 -0
  511. package/src/archives/edit.jsx +2 -2
  512. package/src/audio/README.md +4 -0
  513. package/src/audio/block.json +8 -0
  514. package/src/audio/edit.jsx +2 -2
  515. package/src/avatar/hooks.js +2 -2
  516. package/src/breadcrumbs/README.md +2 -0
  517. package/src/breadcrumbs/block.json +3 -0
  518. package/src/breadcrumbs/edit.jsx +3 -3
  519. package/src/breadcrumbs/index.php +1 -1
  520. package/src/button/edit.jsx +1 -1
  521. package/src/button/style.scss +2 -2
  522. package/src/buttons/README.md +4 -0
  523. package/src/buttons/block.json +9 -0
  524. package/src/calendar/index.php +1 -1
  525. package/src/categories/README.md +6 -0
  526. package/src/categories/block.json +12 -1
  527. package/src/categories/edit.jsx +2 -2
  528. package/src/code/README.md +5 -0
  529. package/src/code/block.json +10 -0
  530. package/src/code/save.jsx +1 -1
  531. package/src/column/README.md +4 -0
  532. package/src/column/block.json +9 -0
  533. package/src/columns/README.md +4 -0
  534. package/src/columns/block.json +9 -0
  535. package/src/columns/style.scss +2 -3
  536. package/src/comment-author-name/README.md +2 -0
  537. package/src/comment-author-name/block.json +3 -0
  538. package/src/comment-content/README.md +4 -0
  539. package/src/comment-content/block.json +5 -0
  540. package/src/comment-date/README.md +2 -0
  541. package/src/comment-date/block.json +3 -0
  542. package/src/comment-edit-link/README.md +2 -0
  543. package/src/comment-edit-link/block.json +3 -0
  544. package/src/comment-reply-link/README.md +2 -0
  545. package/src/comment-reply-link/block.json +3 -0
  546. package/src/comment-template/hooks.js +1 -1
  547. package/src/comments/README.md +5 -0
  548. package/src/comments/block.json +10 -0
  549. package/src/comments/style.scss +1 -1
  550. package/src/comments-pagination/README.md +2 -0
  551. package/src/comments-pagination/block.json +3 -0
  552. package/src/comments-pagination-next/README.md +2 -0
  553. package/src/comments-pagination-next/block.json +3 -0
  554. package/src/comments-pagination-numbers/README.md +2 -0
  555. package/src/comments-pagination-numbers/block.json +3 -0
  556. package/src/comments-pagination-previous/README.md +2 -0
  557. package/src/comments-pagination-previous/block.json +6 -0
  558. package/src/comments-title/README.md +2 -0
  559. package/src/comments-title/block.json +3 -0
  560. package/src/common.scss +1 -2
  561. package/src/cover/edit/index.jsx +5 -2
  562. package/src/cover/edit/inspector-controls.jsx +66 -15
  563. package/src/cover/style.scss +10 -0
  564. package/src/cover/test/{edit.jsdom.test.js → edit.browser.test.js} +122 -147
  565. package/src/cover/transforms.js +3 -3
  566. package/src/details/README.md +7 -0
  567. package/src/details/block.json +12 -0
  568. package/src/details/index.js +1 -1
  569. package/src/embed/editor.scss +2 -2
  570. package/src/embed/embed-controls.jsx +2 -2
  571. package/src/file/README.md +4 -0
  572. package/src/file/block.json +9 -0
  573. package/src/file/deprecated.jsx +3 -3
  574. package/src/file/edit.jsx +5 -3
  575. package/src/file/inspector.jsx +3 -3
  576. package/src/file/save.jsx +2 -2
  577. package/src/footnotes/README.md +5 -0
  578. package/src/footnotes/block.json +10 -0
  579. package/src/footnotes/edit.jsx +1 -1
  580. package/src/gallery/README.md +4 -0
  581. package/src/gallery/block.json +9 -0
  582. package/src/gallery/dynamic-gallery.jsx +4 -4
  583. package/src/gallery/edit.jsx +122 -70
  584. package/src/gallery/gallery-styles.js +117 -0
  585. package/src/gallery/index.php +181 -67
  586. package/src/gallery/responsive-styles.js +59 -5
  587. package/src/gallery/test/edit.jsdom.test.js +71 -3
  588. package/src/gallery/test/responsive-styles.js +59 -5
  589. package/src/group/README.md +1 -0
  590. package/src/group/block.json +1 -0
  591. package/src/heading/README.md +6 -0
  592. package/src/heading/block.json +11 -0
  593. package/src/heading/index.js +2 -2
  594. package/src/home-link/README.md +5 -0
  595. package/src/home-link/block.json +18 -0
  596. package/src/home-link/edit.jsx +2 -2
  597. package/src/html/modal.jsx +0 -3
  598. package/src/icon/index.php +9 -0
  599. package/src/image/edit.jsx +1 -1
  600. package/src/image/editor.scss +8 -0
  601. package/src/image/image.jsx +20 -18
  602. package/src/image/index.php +10 -4
  603. package/src/image/style.scss +1 -0
  604. package/src/image/test/use-open-image-media-editor-modal.jsdom.test.js +140 -1
  605. package/src/image/use-open-image-media-editor-modal.js +37 -0
  606. package/src/index.jsx +1 -1
  607. package/src/latest-comments/README.md +5 -0
  608. package/src/latest-comments/block.json +10 -0
  609. package/src/latest-comments/edit.jsx +2 -2
  610. package/src/latest-posts/README.md +5 -0
  611. package/src/latest-posts/block.json +10 -0
  612. package/src/latest-posts/edit.jsx +1 -1
  613. package/src/list/ordered-list-settings.jsx +2 -2
  614. package/src/list-item/hooks/use-enter.js +1 -1
  615. package/src/loginout/README.md +5 -0
  616. package/src/loginout/block.json +10 -0
  617. package/src/math/README.md +7 -2
  618. package/src/math/block.json +12 -0
  619. package/src/math/deprecated.jsx +38 -12
  620. package/src/math/edit.jsx +49 -20
  621. package/src/math/editor.scss +5 -0
  622. package/src/math/save.jsx +20 -4
  623. package/src/media-text/README.md +1 -0
  624. package/src/media-text/block.json +1 -0
  625. package/src/media-text/constants.js +1 -0
  626. package/src/media-text/deprecated.jsx +3 -3
  627. package/src/media-text/edit.jsx +48 -3
  628. package/src/media-text/image-fill.js +2 -2
  629. package/src/media-text/media-container.jsx +1 -1
  630. package/src/navigation/edit/index.jsx +3 -5
  631. package/src/navigation/edit/menu-inspector-controls.jsx +2 -2
  632. package/src/navigation/edit/overlay-template-part-selector.jsx +3 -3
  633. package/src/navigation/edit/responsive-wrapper.jsx +1 -1
  634. package/src/navigation/edit/use-generate-default-navigation-title.js +2 -2
  635. package/src/navigation/editor.scss +1 -0
  636. package/src/navigation/index.php +12 -0
  637. package/src/navigation/style.scss +41 -5
  638. package/src/navigation/test/use-navigation-menu.jsdom.test.js +6 -28
  639. package/src/navigation/test/view.jsdom.test.js +23 -0
  640. package/src/navigation/view.js +9 -6
  641. package/src/navigation-link/edit.jsx +1 -1
  642. package/src/navigation-link/editor.scss +6 -1
  643. package/src/navigation-link/link-ui/page-creator.jsx +2 -2
  644. package/src/navigation-link/shared/controls.jsx +2 -2
  645. package/src/navigation-link/shared/invalid-draft-display.jsx +2 -2
  646. package/src/navigation-link/shared/test/use-link-preview.jsdom.test.js +22 -22
  647. package/src/navigation-link/shared/use-link-preview.js +15 -14
  648. package/src/navigation-link/test/__snapshots__/hooks.jsdom.test.js.snap +41 -11
  649. package/src/navigation-overlay-close/README.md +1 -0
  650. package/src/navigation-overlay-close/block.json +7 -0
  651. package/src/navigation-overlay-close/style.scss +1 -1
  652. package/src/navigation-submenu/README.md +7 -0
  653. package/src/navigation-submenu/block.json +6 -0
  654. package/src/navigation-submenu/edit.jsx +12 -2
  655. package/src/navigation-submenu/editor.scss +6 -1
  656. package/src/navigation-submenu/index.php +11 -0
  657. package/src/page-list/README.md +5 -0
  658. package/src/page-list/block.json +10 -0
  659. package/src/paragraph/README.md +1 -0
  660. package/src/paragraph/block.json +1 -0
  661. package/src/paragraph/edit.jsx +2 -4
  662. package/src/paragraph/index.js +7 -0
  663. package/src/pattern/index.php +2 -2
  664. package/src/playlist/README.md +1 -0
  665. package/src/playlist/block.json +1 -0
  666. package/src/playlist/edit.jsx +6 -4
  667. package/src/playlist-track/test/edit.jsdom.test.jsx +2 -3
  668. package/src/post-author/edit.jsx +2 -2
  669. package/src/post-author-biography/README.md +3 -0
  670. package/src/post-author-biography/block.json +4 -0
  671. package/src/post-author-name/README.md +4 -0
  672. package/src/post-author-name/block.json +5 -0
  673. package/src/post-author-name/edit.jsx +1 -1
  674. package/src/post-comments-count/README.md +2 -0
  675. package/src/post-comments-count/block.json +3 -0
  676. package/src/post-comments-form/README.md +5 -0
  677. package/src/post-comments-form/block.json +10 -0
  678. package/src/post-content/README.md +3 -0
  679. package/src/post-content/block.json +3 -0
  680. package/src/post-date/README.md +2 -0
  681. package/src/post-date/block.json +3 -0
  682. package/src/post-date/edit.jsx +2 -2
  683. package/src/post-excerpt/README.md +5 -0
  684. package/src/post-excerpt/block.json +6 -0
  685. package/src/post-excerpt/edit.jsx +1 -1
  686. package/src/post-featured-image/edit.jsx +13 -11
  687. package/src/post-navigation-link/README.md +12 -0
  688. package/src/post-navigation-link/block.json +30 -0
  689. package/src/post-navigation-link/edit.jsx +27 -6
  690. package/src/post-navigation-link/index.php +94 -5
  691. package/src/post-navigation-link/style.scss +2 -0
  692. package/src/post-template/README.md +7 -0
  693. package/src/post-template/block.json +13 -1
  694. package/src/post-terms/README.md +5 -0
  695. package/src/post-terms/block.json +6 -0
  696. package/src/post-time-to-read/README.md +5 -0
  697. package/src/post-time-to-read/block.json +6 -0
  698. package/src/post-time-to-read/edit.jsx +2 -2
  699. package/src/post-title/README.md +5 -0
  700. package/src/post-title/block.json +10 -0
  701. package/src/post-title/style.scss +2 -3
  702. package/src/preformatted/README.md +6 -0
  703. package/src/preformatted/block.json +7 -0
  704. package/src/pullquote/README.md +1 -0
  705. package/src/pullquote/block.json +1 -0
  706. package/src/pullquote/deprecated.jsx +1 -1
  707. package/src/query/deprecated.jsx +1 -1
  708. package/src/query/edit/inspector-controls/index.jsx +4 -4
  709. package/src/query/edit/inspector-controls/order-control.jsx +2 -2
  710. package/src/query/edit/inspector-controls/sticky-control.jsx +2 -2
  711. package/src/query/view.js +6 -9
  712. package/src/query-no-results/README.md +7 -0
  713. package/src/query-no-results/block.json +10 -2
  714. package/src/query-pagination/README.md +2 -0
  715. package/src/query-pagination/block.json +3 -0
  716. package/src/query-pagination/editor.scss +0 -3
  717. package/src/query-pagination-next/README.md +2 -0
  718. package/src/query-pagination-next/block.json +3 -0
  719. package/src/query-pagination-numbers/README.md +2 -0
  720. package/src/query-pagination-numbers/block.json +3 -0
  721. package/src/query-pagination-previous/README.md +2 -0
  722. package/src/query-pagination-previous/block.json +3 -0
  723. package/src/query-title/README.md +2 -0
  724. package/src/query-title/block.json +3 -0
  725. package/src/query-title/use-archive-label.js +1 -1
  726. package/src/query-total/README.md +5 -0
  727. package/src/query-total/block.json +6 -0
  728. package/src/quote/README.md +1 -0
  729. package/src/quote/block.json +1 -0
  730. package/src/quote/deprecated.jsx +2 -2
  731. package/src/quote/transforms.js +3 -3
  732. package/src/read-more/README.md +5 -0
  733. package/src/read-more/block.json +6 -0
  734. package/src/rss/README.md +5 -0
  735. package/src/rss/block.json +6 -0
  736. package/src/search/edit.jsx +6 -6
  737. package/src/search/theme.scss +1 -1
  738. package/src/separator/edit.jsx +7 -4
  739. package/src/site-tagline/README.md +6 -0
  740. package/src/site-tagline/block.json +8 -1
  741. package/src/site-title/README.md +5 -0
  742. package/src/site-title/block.json +7 -1
  743. package/src/social-links/README.md +2 -0
  744. package/src/social-links/block.json +3 -0
  745. package/src/social-links/edit.jsx +4 -5
  746. package/src/tab-panel/README.md +9 -0
  747. package/src/tab-panel/block.json +25 -0
  748. package/src/tab-panel/controls.jsx +2 -2
  749. package/src/tab-panel/style.scss +5 -2
  750. package/src/tab-panels/README.md +7 -0
  751. package/src/tab-panels/block.json +18 -1
  752. package/src/table/state.js +1 -1
  753. package/src/table-of-contents/README.md +6 -0
  754. package/src/table-of-contents/block.json +7 -0
  755. package/src/table-of-contents/edit.jsx +6 -6
  756. package/src/table-of-contents/utils.ts +2 -2
  757. package/src/tabs/README.md +9 -0
  758. package/src/tabs/block.json +24 -1
  759. package/src/tabs/use-tab-actions.js +1 -1
  760. package/src/tag-cloud/README.md +9 -0
  761. package/src/tag-cloud/block.json +19 -0
  762. package/src/tag-cloud/edit.jsx +2 -2
  763. package/src/template-part/edit/advanced-controls.jsx +5 -2
  764. package/src/template-part/edit/import-controls.jsx +2 -2
  765. package/src/template-part/edit/index.jsx +2 -2
  766. package/src/template-part/edit/inner-blocks.jsx +1 -1
  767. package/src/template-part/edit/placeholder.jsx +2 -2
  768. package/src/template-part/edit/selection-modal.jsx +1 -1
  769. package/src/term-count/README.md +6 -0
  770. package/src/term-count/block.json +7 -0
  771. package/src/term-count/use-term-count.js +1 -1
  772. package/src/term-description/README.md +5 -0
  773. package/src/term-description/block.json +9 -0
  774. package/src/term-description/use-term-description.js +1 -1
  775. package/src/term-name/README.md +5 -0
  776. package/src/term-name/block.json +10 -0
  777. package/src/term-name/index.php +1 -1
  778. package/src/term-name/use-term-name.js +1 -1
  779. package/src/term-template/README.md +5 -0
  780. package/src/term-template/block.json +10 -1
  781. package/src/terms-query/edit/inspector-controls/index.jsx +2 -2
  782. package/src/terms-query/edit/inspector-controls/inherit-control.jsx +1 -1
  783. package/src/terms-query/edit/inspector-controls/order-control.jsx +2 -2
  784. package/src/terms-query/edit/inspector-controls/taxonomy-control.jsx +2 -2
  785. package/src/utils/hooks.js +1 -1
  786. package/src/utils/media-control.jsx +16 -10
  787. package/src/utils/poster-image.jsx +2 -2
  788. package/src/utils/search-patterns.js +9 -53
  789. package/src/utils/style-state.js +6 -4
  790. package/src/utils/test/{search-patterns.js → search-patterns.jsdom.test.js} +1 -22
  791. package/src/utils/test/waveform-player.jsdom.test.jsx +36 -38
  792. package/src/utils/test/{waveform-utils.jsdom.test.js → waveform-utils.browser.test.js} +64 -44
  793. package/src/verse/README.md +1 -0
  794. package/src/verse/block.json +1 -0
  795. package/src/verse/style.scss +2 -2
  796. package/src/video/README.md +7 -0
  797. package/src/video/block.json +6 -0
  798. package/src/video/edit-common-settings.jsx +3 -3
  799. package/src/video/edit.jsx +56 -51
  800. package/src/video/index.js +0 -2
  801. package/src/video/save.jsx +10 -1
  802. package/src/video/tracks-editor.jsx +2 -2
  803. package/build/gallery/flex-styles.cjs.map +0 -7
  804. package/build/video/variations.cjs +0 -75
  805. package/build/video/variations.cjs.map +0 -7
  806. package/build-module/gallery/flex-styles.mjs.map +0 -7
  807. package/build-module/video/variations.mjs +0 -50
  808. package/build-module/video/variations.mjs.map +0 -7
  809. package/src/gallery/flex-styles.js +0 -99
  810. package/src/video/test/variations.js +0 -63
  811. package/src/video/variations.js +0 -62
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/navigation-link/edit.jsx"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport { createBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP } from '@wordpress/url';\nimport { useState, useEffect, useRef, useCallback } from '@wordpress/element';\nimport { VisuallyHidden } from '@wordpress/ui';\nimport { link as linkIcon, addSubmenu } from '@wordpress/icons';\nimport { useMergeRefs, useInstanceId } from '@wordpress/compose';\nimport { getColors } from '../navigation/edit/utils';\nimport {\n\tControls,\n\tLinkUI,\n\tuseEntityBinding,\n\tgetInvalidLinkHelpText,\n\tuseHandleLinkChange,\n\tuseIsInvalidLink,\n\tInvalidDraftDisplay,\n\tuseEnableLinkStatusValidation,\n\tuseIsDraggingWithin,\n\tselectLabelText,\n} from './shared';\n\nconst DEFAULT_BLOCK = { name: 'core/navigation-link' };\nconst NESTING_BLOCK_NAMES = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n];\n\nfunction getMissingText( type ) {\n\tlet missingText = '';\n\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\t\t/* translators: label for missing post in navigation link block */\n\t\t\tmissingText = __( 'Select post' );\n\t\t\tbreak;\n\t\tcase 'page':\n\t\t\t/* translators: label for missing page in navigation link block */\n\t\t\tmissingText = __( 'Select page' );\n\t\t\tbreak;\n\t\tcase 'category':\n\t\t\t/* translators: label for missing category in navigation link block */\n\t\t\tmissingText = __( 'Select category' );\n\t\t\tbreak;\n\t\tcase 'tag':\n\t\t\t/* translators: label for missing tag in navigation link block */\n\t\t\tmissingText = __( 'Select tag' );\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t/* translators: label for missing values in navigation link block */\n\t\t\tmissingText = __( 'Add link' );\n\t}\n\n\treturn missingText;\n}\n\nexport default function NavigationLinkEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { id, label, type, url, description, kind, metadata } = attributes;\n\tconst { maxNestingLevel } = context;\n\n\tconst {\n\t\treplaceBlock,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tselectBlock,\n\t} = useDispatch( blockEditorStore );\n\t// Have the link editing ui open on mount when lacking a url and selected.\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( isSelected && ! url );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add label…' );\n\tconst ref = useRef();\n\tconst linkUIref = useRef();\n\t// A link is \"new\" only if it has an undefined label\n\t// After the link is created, even if no label is provided, it's set to an empty string.\n\tconst isNewLink = useRef( label === undefined );\n\t// Track whether we should focus the submenu appender when closing the link UI\n\tconst shouldSelectSubmenuAppenderOnClose = useRef( false );\n\n\tconst {\n\t\tisAtMaxNesting,\n\t\tisTopLevelLink,\n\t\tisParentOfSelectedBlock,\n\t\thasChildren,\n\t\tparentBlockClientId,\n\t\tisSubmenu,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst parentBlockName = getBlockName( rootClientId );\n\t\t\tconst isTopLevel = parentBlockName === 'core/navigation';\n\t\t\tconst rootNavigationClientId = isTopLevel\n\t\t\t\t? rootClientId\n\t\t\t\t: getBlockParentsByBlockName(\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t'core/navigation'\n\t\t\t\t )[ 0 ];\n\n\t\t\t// Get the immediate parent - if it's a submenu, use it; otherwise use the navigation block\n\t\t\tconst parentBlockId =\n\t\t\t\tparentBlockName === 'core/navigation-submenu'\n\t\t\t\t\t? rootClientId\n\t\t\t\t\t: rootNavigationClientId;\n\n\t\t\treturn {\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, NESTING_BLOCK_NAMES )\n\t\t\t\t\t\t.length >= maxNestingLevel,\n\t\t\t\tisTopLevelLink: isTopLevel,\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\thasChildren: !! getBlockCount( clientId ),\n\t\t\t\tparentBlockClientId: parentBlockId,\n\t\t\t\tisSubmenu: parentBlockName === 'core/navigation-submenu',\n\t\t\t};\n\t\t},\n\t\t[ clientId, maxNestingLevel ]\n\t);\n\n\tconst validateLinkStatus = useEnableLinkStatusValidation( clientId );\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\n\t// URL binding logic\n\tconst { hasUrlBinding, isBoundEntityAvailable, entityRecord } =\n\t\tuseEntityBinding( {\n\t\t\tclientId,\n\t\t\tattributes,\n\t\t} );\n\n\tconst handleLinkChange = useHandleLinkChange( {\n\t\tclientId,\n\t\tattributes,\n\t\tsetAttributes,\n\t\tallowTextUpdate: true,\n\t} );\n\n\tconst [ isInvalid, isDraft ] = useIsInvalidLink(\n\t\tkind,\n\t\ttype,\n\t\tid,\n\t\tvalidateLinkStatus\n\t);\n\n\t/**\n\t * Transform to submenu block.\n\t */\n\tconst transformToSubmenu = useCallback( () => {\n\t\tlet innerBlocks = getBlocks( clientId );\n\t\tif ( innerBlocks.length === 0 ) {\n\t\t\tinnerBlocks = [ createBlock( 'core/navigation-link' ) ];\n\t\t\tselectBlock( innerBlocks[ 0 ].clientId );\n\t\t}\n\t\tconst newSubmenu = createBlock(\n\t\t\t'core/navigation-submenu',\n\t\t\tattributes,\n\t\t\tinnerBlocks\n\t\t);\n\t\treplaceBlock( clientId, newSubmenu );\n\t}, [ getBlocks, clientId, selectBlock, replaceBlock, attributes ] );\n\n\t// On mount, if this is a new link without a URL and it's selected,\n\t// select the parent block (submenu or navigation) instead to keep the appender visible.\n\t// This helps us return focus to the appender if the user closes the link ui without creating a link.\n\t// If we leave focus on this block, then when we close the link without creating a link, focus will\n\t// be lost during the new block selection process.\n\tuseEffect( () => {\n\t\tif ( isNewLink.current && isSelected ) {\n\t\t\tselectBlock( parentBlockClientId );\n\t\t}\n\t}, [] ); // eslint-disable-line react-hooks/exhaustive-deps\n\n\tuseEffect( () => {\n\t\t// If block has inner blocks, transform to Submenu.\n\t\tif ( hasChildren ) {\n\t\t\t// This side-effect should not create an undo level as those should\n\t\t\t// only be created via user interactions.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\ttransformToSubmenu();\n\t\t}\n\t}, [\n\t\thasChildren,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\ttransformToSubmenu,\n\t] );\n\n\t// Handle link UI when a new link is created\n\tuseEffect( () => {\n\t\t// We know if a link was just created from our link UI if\n\t\t// 1. isNewLink.current is true\n\t\t// 2. url has a value\n\t\t// 3. isLinkOpen is true\n\t\tif ( ! isNewLink.current || ! url || ! isLinkOpen ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Ensure this only runs once\n\t\tisNewLink.current = false;\n\n\t\t// We just created a link and the block is now selected.\n\t\t// If the label looks like a URL, focus and select the label text.\n\t\tif ( isURL( prependHTTP( label ) ) && /^.+\\.[a-z]+/.test( label ) ) {\n\t\t\t// Focus and select the label text.\n\t\t\tselectLabelText( ref );\n\t\t} else {\n\t\t\t// If the link was just created, we want to select the block so the inspector controls\n\t\t\t// are accurate.\n\t\t\tselectBlock( clientId, null );\n\n\t\t\t// Edge case: When the created link is the first child of a submenu, the focus will have\n\t\t\t// originated from the add submenu toolbar button. In this case, we need to return focus\n\t\t\t// to the submenu appender if the user closes the link ui using the keyboard.\n\t\t\t// Check if this is the first and only child of a newly created submenu.\n\t\t\tif ( isSubmenu ) {\n\t\t\t\tconst parentBlocks = getBlocks( parentBlockClientId );\n\t\t\t\t// If this is the only child, then this is a new submenu.\n\t\t\t\t// Set the flag to select the submenu appender when the link ui is closed.\n\t\t\t\tif (\n\t\t\t\t\tparentBlocks.length === 1 &&\n\t\t\t\t\tparentBlocks[ 0 ].clientId === clientId\n\t\t\t\t) {\n\t\t\t\t\tshouldSelectSubmenuAppenderOnClose.current = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [ url, isLinkOpen, isNewLink, label ] );\n\n\t/**\n\t * Removes the current link if set.\n\t */\n\tfunction removeLink() {\n\t\t// Reset all attributes that comprise the link.\n\t\t// It is critical that all attributes are reset\n\t\t// to their default values otherwise this may\n\t\t// in advertently trigger side effects because\n\t\t// the values will have \"changed\".\n\t\tsetAttributes( {\n\t\t\turl: undefined,\n\t\t\tlabel: undefined,\n\t\t\tid: undefined,\n\t\t\tkind: undefined,\n\t\t\ttype: undefined,\n\t\t\topensInNewTab: false,\n\t\t} );\n\n\t\t// Close the link editing UI.\n\t\tsetIsLinkOpen( false );\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, ! isTopLevelLink );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\t// Required to prevent the command center from opening,\n\t\t\t// as it shares the CMD+K shortcut.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/59845.\n\t\t\tevent.preventDefault();\n\t\t\t// If this link is a child of a parent submenu item, the parent submenu item event will also open, closing this popover\n\t\t\tevent.stopPropagation();\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}\n\n\tconst instanceId = useInstanceId( NavigationLinkEdit );\n\tconst hasMissingEntity = hasUrlBinding && ! isBoundEntityAvailable;\n\tconst missingEntityDescriptionId = hasMissingEntity\n\t\t? sprintf( 'navigation-link-edit-%d-desc', instanceId )\n\t\t: undefined;\n\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, listItemRef ] ),\n\t\tclassName: clsx( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasChildren,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName( 'background-color', backgroundColor ) ]:\n\t\t\t\t!! backgroundColor,\n\t\t} ),\n\t\t'aria-describedby': missingEntityDescriptionId,\n\t\t'aria-invalid': hasMissingEntity,\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: 'remove-outline', // Remove the outline from the inner blocks container.\n\t\t},\n\t\t{\n\t\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\t\tdirectInsert: true,\n\t\t\trenderAppender: false,\n\t\t}\n\t);\n\n\tconst needsValidLink =\n\t\t( ! url && ! ( hasUrlBinding && isBoundEntityAvailable ) ) ||\n\t\tisInvalid ||\n\t\tisDraft ||\n\t\t( hasUrlBinding && ! isBoundEntityAvailable );\n\n\tif ( needsValidLink ) {\n\t\tblockProps.onClick = () => {\n\t\t\tsetIsLinkOpen( true );\n\t\t};\n\t}\n\n\tconst classes = clsx( 'wp-block-navigation-item__content', {\n\t\t'wp-block-navigation-link__placeholder': needsValidLink,\n\t} );\n\n\tconst missingText = getMissingText( type );\n\tconst invalidLinkHelpText = getInvalidLinkHelpText();\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! isAtMaxNesting && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"submenu\"\n\t\t\t\t\t\t\ticon={ addSubmenu }\n\t\t\t\t\t\t\ttitle={ __( 'Add submenu' ) }\n\t\t\t\t\t\t\tonClick={ transformToSubmenu }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls group=\"content\">\n\t\t\t\t<Controls\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ hasMissingEntity && (\n\t\t\t\t\t<VisuallyHidden id={ missingEntityDescriptionId }>\n\t\t\t\t\t\t{ invalidLinkHelpText }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t) }\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<a className={ classes }>\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t{ ! url && ! metadata?.bindings?.url ? (\n\t\t\t\t\t\t<div className=\"wp-block-navigation-link__placeholder-text\">\n\t\t\t\t\t\t\t<span>{ missingText }</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isInvalid && ! isDraft && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: labelValue,\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\t\t\t\t\t__unstableOnSplitAtEnd={\n\t\t\t\t\t\t\t\t\t\t\tinsertBlocksAfter\n\t\t\t\t\t\t\t\t\t\t\t\t? () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'core/navigation-link'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t'Navigation link text'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ description && (\n\t\t\t\t\t\t\t\t\t\t<span className=\"wp-block-navigation-item__description\">\n\t\t\t\t\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ( isInvalid || isDraft ) && (\n\t\t\t\t\t\t\t\t<InvalidDraftDisplay\n\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\tisInvalid={ isInvalid }\n\t\t\t\t\t\t\t\t\tisDraft={ isDraft }\n\t\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-link__label\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isLinkOpen && (\n\t\t\t\t\t\t<LinkUI\n\t\t\t\t\t\t\tref={ linkUIref }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tlink={ attributes }\n\t\t\t\t\t\t\tentity={ {\n\t\t\t\t\t\t\t\tentityRecord,\n\t\t\t\t\t\t\t\thasBinding: hasUrlBinding,\n\t\t\t\t\t\t\t\tisEntityAvailable: isBoundEntityAvailable,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( false );\n\t\t\t\t\t\t\t\t// If there is no link and no binding, remove the auto-inserted block.\n\t\t\t\t\t\t\t\t// This avoids empty blocks which can provided a poor UX.\n\t\t\t\t\t\t\t\t// Don't remove if binding exists (even if entity is unavailable) so user can fix it.\n\t\t\t\t\t\t\t\t// `onReplace` is undefined when the block can't be removed.\n\t\t\t\t\t\t\t\tif ( ! url && ! hasUrlBinding && onReplace ) {\n\t\t\t\t\t\t\t\t\tonReplace( [] );\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// Edge case: If this is the first child of a new submenu, focus the submenu's appender\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tshouldSelectSubmenuAppenderOnClose.current\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tshouldSelectSubmenuAppenderOnClose.current = false;\n\n\t\t\t\t\t\t\t\t\t// The appender is the next sibling in the DOM after the current block\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\tlistItemRef.current?.nextElementSibling\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tconst appenderButton =\n\t\t\t\t\t\t\t\t\t\t\tlistItemRef.current.nextElementSibling.querySelector(\n\t\t\t\t\t\t\t\t\t\t\t\t'.block-editor-button-block-appender'\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tif ( appenderButton ) {\n\t\t\t\t\t\t\t\t\t\t\tappenderButton.focus();\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} }\n\t\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\t\tonRemove={ removeLink }\n\t\t\t\t\t\t\tonChange={ handleLinkChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</a>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],
5
- "mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,mBAAmB;AAC5B,SAAS,WAAW,mBAAmB;AACvC,SAAS,eAAe,oBAAoB;AAC5C,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,IAAI,eAAe;AAC5B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,OACM;AACP,SAAS,OAAO,mBAAmB;AACnC,SAAS,UAAU,WAAW,QAAQ,mBAAmB;AACzD,SAAS,sBAAsB;AAC/B,SAAS,QAAQ,UAAU,kBAAkB;AAC7C,SAAS,cAAc,qBAAqB;AAC5C,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAwUH,SA2CI,UA1CH,KADD;AAtUJ,IAAM,gBAAgB,EAAE,MAAM,uBAAuB;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ACA,MAAO;AAAA,YACP,QAAS;AAAA,cACR;AAAA,cACA,YAAY;AAAA,cACZ,mBAAmB;AAAA,YACpB;AAAA,YACA,SAAU,MAAM;AACf,4BAAe,KAAM;AAKrB,kBAAK,CAAE,OAAO,CAAE,iBAAiB,WAAY;AAC5C,0BAAW,CAAC,CAAE;AACd;AAAA,cACD;AAGA,kBACC,mCAAmC,SAClC;AACD,mDAAmC,UAAU;AAG7C,oBACC,YAAY,SAAS,oBACpB;AACD,wBAAM,iBACL,YAAY,QAAQ,mBAAmB;AAAA,oBACtC;AAAA,kBACD;AACD,sBAAK,gBAAiB;AACrB,mCAAe,MAAM;AAAA,kBACtB;AAAA,gBACD;AAAA,cACD;AAAA,YACD;AAAA,YACA,QAAS;AAAA,YACT,UAAW;AAAA,YACX,UAAW;AAAA;AAAA,QACZ;AAAA,SAEF;AAAA,MACA,oBAAC,SAAM,GAAG,kBAAmB;AAAA,OAC9B;AAAA,KACD;AAEF;",
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport { createBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP } from '@wordpress/url';\nimport { useState, useEffect, useRef, useCallback } from '@wordpress/element';\nimport { VisuallyHidden } from '@wordpress/ui';\nimport { link as linkIcon, addSubmenu } from '@wordpress/icons';\nimport { useMergeRefs, useInstanceId } from '@wordpress/compose';\nimport { getColors } from '../navigation/edit/utils';\nimport {\n\tControls,\n\tLinkUI,\n\tuseEntityBinding,\n\tgetInvalidLinkHelpText,\n\tuseHandleLinkChange,\n\tuseIsInvalidLink,\n\tInvalidDraftDisplay,\n\tuseEnableLinkStatusValidation,\n\tuseIsDraggingWithin,\n\tselectLabelText,\n} from './shared';\n\nconst DEFAULT_BLOCK = { name: 'core/navigation-link' };\nconst NESTING_BLOCK_NAMES = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n];\n\nfunction getMissingText( type ) {\n\tlet missingText = '';\n\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\t\t/* translators: label for missing post in navigation link block */\n\t\t\tmissingText = __( 'Select post' );\n\t\t\tbreak;\n\t\tcase 'page':\n\t\t\t/* translators: label for missing page in navigation link block */\n\t\t\tmissingText = __( 'Select page' );\n\t\t\tbreak;\n\t\tcase 'category':\n\t\t\t/* translators: label for missing category in navigation link block */\n\t\t\tmissingText = __( 'Select category' );\n\t\t\tbreak;\n\t\tcase 'tag':\n\t\t\t/* translators: label for missing tag in navigation link block */\n\t\t\tmissingText = __( 'Select tag' );\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t/* translators: label for missing values in navigation link block */\n\t\t\tmissingText = __( 'Add link' );\n\t}\n\n\treturn missingText;\n}\n\nexport default function NavigationLinkEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { id, label, type, url, description, kind, metadata } = attributes;\n\tconst { maxNestingLevel } = context;\n\n\tconst {\n\t\treplaceBlock,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tselectBlock,\n\t} = useDispatch( blockEditorStore );\n\t// Have the link editing ui open on mount when lacking a url and selected.\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( isSelected && ! url );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add label…' );\n\tconst ref = useRef();\n\tconst linkUIref = useRef();\n\t// A link is \"new\" only if it has an undefined label\n\t// After the link is created, even if no label is provided, it's set to an empty string.\n\tconst isNewLink = useRef( label === undefined );\n\t// Track whether we should focus the submenu appender when closing the link UI\n\tconst shouldSelectSubmenuAppenderOnClose = useRef( false );\n\n\tconst {\n\t\tisAtMaxNesting,\n\t\tisTopLevelLink,\n\t\tisParentOfSelectedBlock,\n\t\thasChildren,\n\t\tparentBlockClientId,\n\t\tisSubmenu,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst parentBlockName = getBlockName( rootClientId );\n\t\t\tconst isTopLevel = parentBlockName === 'core/navigation';\n\t\t\tconst rootNavigationClientId = isTopLevel\n\t\t\t\t? rootClientId\n\t\t\t\t: getBlockParentsByBlockName(\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t'core/navigation'\n\t\t\t\t\t)[ 0 ];\n\n\t\t\t// Get the immediate parent - if it's a submenu, use it; otherwise use the navigation block\n\t\t\tconst parentBlockId =\n\t\t\t\tparentBlockName === 'core/navigation-submenu'\n\t\t\t\t\t? rootClientId\n\t\t\t\t\t: rootNavigationClientId;\n\n\t\t\treturn {\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, NESTING_BLOCK_NAMES )\n\t\t\t\t\t\t.length >= maxNestingLevel,\n\t\t\t\tisTopLevelLink: isTopLevel,\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\thasChildren: !! getBlockCount( clientId ),\n\t\t\t\tparentBlockClientId: parentBlockId,\n\t\t\t\tisSubmenu: parentBlockName === 'core/navigation-submenu',\n\t\t\t};\n\t\t},\n\t\t[ clientId, maxNestingLevel ]\n\t);\n\n\tconst validateLinkStatus = useEnableLinkStatusValidation( clientId );\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\n\t// URL binding logic\n\tconst { hasUrlBinding, isBoundEntityAvailable, entityRecord } =\n\t\tuseEntityBinding( {\n\t\t\tclientId,\n\t\t\tattributes,\n\t\t} );\n\n\tconst handleLinkChange = useHandleLinkChange( {\n\t\tclientId,\n\t\tattributes,\n\t\tsetAttributes,\n\t\tallowTextUpdate: true,\n\t} );\n\n\tconst [ isInvalid, isDraft ] = useIsInvalidLink(\n\t\tkind,\n\t\ttype,\n\t\tid,\n\t\tvalidateLinkStatus\n\t);\n\n\t/**\n\t * Transform to submenu block.\n\t */\n\tconst transformToSubmenu = useCallback( () => {\n\t\tlet innerBlocks = getBlocks( clientId );\n\t\tif ( innerBlocks.length === 0 ) {\n\t\t\tinnerBlocks = [ createBlock( 'core/navigation-link' ) ];\n\t\t\tselectBlock( innerBlocks[ 0 ].clientId );\n\t\t}\n\t\tconst newSubmenu = createBlock(\n\t\t\t'core/navigation-submenu',\n\t\t\tattributes,\n\t\t\tinnerBlocks\n\t\t);\n\t\treplaceBlock( clientId, newSubmenu );\n\t}, [ getBlocks, clientId, selectBlock, replaceBlock, attributes ] );\n\n\t// On mount, if this is a new link without a URL and it's selected,\n\t// select the parent block (submenu or navigation) instead to keep the appender visible.\n\t// This helps us return focus to the appender if the user closes the link ui without creating a link.\n\t// If we leave focus on this block, then when we close the link without creating a link, focus will\n\t// be lost during the new block selection process.\n\tuseEffect( () => {\n\t\tif ( isNewLink.current && isSelected ) {\n\t\t\tselectBlock( parentBlockClientId );\n\t\t}\n\t}, [] ); // eslint-disable-line react-hooks/exhaustive-deps\n\n\tuseEffect( () => {\n\t\t// If block has inner blocks, transform to Submenu.\n\t\tif ( hasChildren ) {\n\t\t\t// This side-effect should not create an undo level as those should\n\t\t\t// only be created via user interactions.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\ttransformToSubmenu();\n\t\t}\n\t}, [\n\t\thasChildren,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\ttransformToSubmenu,\n\t] );\n\n\t// Handle link UI when a new link is created\n\tuseEffect( () => {\n\t\t// We know if a link was just created from our link UI if\n\t\t// 1. isNewLink.current is true\n\t\t// 2. url has a value\n\t\t// 3. isLinkOpen is true\n\t\tif ( ! isNewLink.current || ! url || ! isLinkOpen ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Ensure this only runs once\n\t\tisNewLink.current = false;\n\n\t\t// We just created a link and the block is now selected.\n\t\t// If the label looks like a URL, focus and select the label text.\n\t\tif ( isURL( prependHTTP( label ) ) && /^.+\\.[a-z]+/.test( label ) ) {\n\t\t\t// Focus and select the label text.\n\t\t\tselectLabelText( ref );\n\t\t} else {\n\t\t\t// If the link was just created, we want to select the block so the inspector controls\n\t\t\t// are accurate.\n\t\t\tselectBlock( clientId, null );\n\n\t\t\t// Edge case: When the created link is the first child of a submenu, the focus will have\n\t\t\t// originated from the add submenu toolbar button. In this case, we need to return focus\n\t\t\t// to the submenu appender if the user closes the link ui using the keyboard.\n\t\t\t// Check if this is the first and only child of a newly created submenu.\n\t\t\tif ( isSubmenu ) {\n\t\t\t\tconst parentBlocks = getBlocks( parentBlockClientId );\n\t\t\t\t// If this is the only child, then this is a new submenu.\n\t\t\t\t// Set the flag to select the submenu appender when the link ui is closed.\n\t\t\t\tif (\n\t\t\t\t\tparentBlocks.length === 1 &&\n\t\t\t\t\tparentBlocks[ 0 ].clientId === clientId\n\t\t\t\t) {\n\t\t\t\t\tshouldSelectSubmenuAppenderOnClose.current = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [ url, isLinkOpen, isNewLink, label ] );\n\n\t/**\n\t * Removes the current link if set.\n\t */\n\tfunction removeLink() {\n\t\t// Reset all attributes that comprise the link.\n\t\t// It is critical that all attributes are reset\n\t\t// to their default values otherwise this may\n\t\t// in advertently trigger side effects because\n\t\t// the values will have \"changed\".\n\t\tsetAttributes( {\n\t\t\turl: undefined,\n\t\t\tlabel: undefined,\n\t\t\tid: undefined,\n\t\t\tkind: undefined,\n\t\t\ttype: undefined,\n\t\t\topensInNewTab: false,\n\t\t} );\n\n\t\t// Close the link editing UI.\n\t\tsetIsLinkOpen( false );\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, ! isTopLevelLink );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\t// Required to prevent the command center from opening,\n\t\t\t// as it shares the CMD+K shortcut.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/59845.\n\t\t\tevent.preventDefault();\n\t\t\t// If this link is a child of a parent submenu item, the parent submenu item event will also open, closing this popover\n\t\t\tevent.stopPropagation();\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}\n\n\tconst instanceId = useInstanceId( NavigationLinkEdit );\n\tconst hasMissingEntity = hasUrlBinding && ! isBoundEntityAvailable;\n\tconst missingEntityDescriptionId = hasMissingEntity\n\t\t? sprintf( 'navigation-link-edit-%d-desc', instanceId )\n\t\t: undefined;\n\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, listItemRef ] ),\n\t\tclassName: clsx( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasChildren,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName( 'background-color', backgroundColor ) ]:\n\t\t\t\t!! backgroundColor,\n\t\t} ),\n\t\t'aria-describedby': missingEntityDescriptionId,\n\t\t'aria-invalid': hasMissingEntity,\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: 'remove-outline', // Remove the outline from the inner blocks container.\n\t\t},\n\t\t{\n\t\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\t\tdirectInsert: true,\n\t\t\trenderAppender: false,\n\t\t}\n\t);\n\n\tconst needsValidLink =\n\t\t( ! url && ! ( hasUrlBinding && isBoundEntityAvailable ) ) ||\n\t\tisInvalid ||\n\t\tisDraft ||\n\t\t( hasUrlBinding && ! isBoundEntityAvailable );\n\n\tif ( needsValidLink ) {\n\t\tblockProps.onClick = () => {\n\t\t\tsetIsLinkOpen( true );\n\t\t};\n\t}\n\n\tconst classes = clsx( 'wp-block-navigation-item__content', {\n\t\t'wp-block-navigation-link__placeholder': needsValidLink,\n\t} );\n\n\tconst missingText = getMissingText( type );\n\tconst invalidLinkHelpText = getInvalidLinkHelpText();\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! isAtMaxNesting && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"submenu\"\n\t\t\t\t\t\t\ticon={ addSubmenu }\n\t\t\t\t\t\t\ttitle={ __( 'Add submenu' ) }\n\t\t\t\t\t\t\tonClick={ transformToSubmenu }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls group=\"content\">\n\t\t\t\t<Controls\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ hasMissingEntity && (\n\t\t\t\t\t<VisuallyHidden id={ missingEntityDescriptionId }>\n\t\t\t\t\t\t{ invalidLinkHelpText }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t) }\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<a className={ classes }>\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t{ ! url && ! metadata?.bindings?.url ? (\n\t\t\t\t\t\t<div className=\"wp-block-navigation-link__placeholder-text\">\n\t\t\t\t\t\t\t<span>{ missingText }</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isInvalid && ! isDraft && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: labelValue,\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\t\t\t\t\t__unstableOnSplitAtEnd={\n\t\t\t\t\t\t\t\t\t\t\tinsertBlocksAfter\n\t\t\t\t\t\t\t\t\t\t\t\t? () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'core/navigation-link'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t'Navigation link text'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ description && (\n\t\t\t\t\t\t\t\t\t\t<span className=\"wp-block-navigation-item__description\">\n\t\t\t\t\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ( isInvalid || isDraft ) && (\n\t\t\t\t\t\t\t\t<InvalidDraftDisplay\n\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\tisInvalid={ isInvalid }\n\t\t\t\t\t\t\t\t\tisDraft={ isDraft }\n\t\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-link__label\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isLinkOpen && (\n\t\t\t\t\t\t<LinkUI\n\t\t\t\t\t\t\tref={ linkUIref }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tlink={ attributes }\n\t\t\t\t\t\t\tentity={ {\n\t\t\t\t\t\t\t\tentityRecord,\n\t\t\t\t\t\t\t\thasBinding: hasUrlBinding,\n\t\t\t\t\t\t\t\tisEntityAvailable: isBoundEntityAvailable,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( false );\n\t\t\t\t\t\t\t\t// If there is no link and no binding, remove the auto-inserted block.\n\t\t\t\t\t\t\t\t// This avoids empty blocks which can provided a poor UX.\n\t\t\t\t\t\t\t\t// Don't remove if binding exists (even if entity is unavailable) so user can fix it.\n\t\t\t\t\t\t\t\t// `onReplace` is undefined when the block can't be removed.\n\t\t\t\t\t\t\t\tif ( ! url && ! hasUrlBinding && onReplace ) {\n\t\t\t\t\t\t\t\t\tonReplace( [] );\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// Edge case: If this is the first child of a new submenu, focus the submenu's appender\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tshouldSelectSubmenuAppenderOnClose.current\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tshouldSelectSubmenuAppenderOnClose.current = false;\n\n\t\t\t\t\t\t\t\t\t// The appender is the next sibling in the DOM after the current block\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\tlistItemRef.current?.nextElementSibling\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tconst appenderButton =\n\t\t\t\t\t\t\t\t\t\t\tlistItemRef.current.nextElementSibling.querySelector(\n\t\t\t\t\t\t\t\t\t\t\t\t'.block-editor-button-block-appender'\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tif ( appenderButton ) {\n\t\t\t\t\t\t\t\t\t\t\tappenderButton.focus();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\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B;AAAA,oBACtC;AAAA,kBACD;AACD,sBAAK,gBAAiB;AACrB,mCAAe,MAAM;AAAA,kBACtB;AAAA,gBACD;AAAA,cACD;AAAA,YACD;AAAA,YACA,QAAS;AAAA,YACT,UAAW;AAAA,YACX,UAAW;AAAA;AAAA,QACZ;AAAA,SAEF;AAAA,MACA,oBAAC,SAAM,GAAG,kBAAmB;AAAA,OAC9B;AAAA,KACD;AAEF;",
6
6
  "names": []
7
7
  }
@@ -3,7 +3,7 @@ import {
3
3
  Button,
4
4
  TextControl,
5
5
  Notice,
6
- CheckboxControl,
6
+ CheckboxControl as WCCheckboxControl,
7
7
  __experimentalVStack as VStack,
8
8
  __experimentalHStack as HStack
9
9
  } from "@wordpress/components";
@@ -104,7 +104,7 @@ function LinkUIPageCreator({
104
104
  }
105
105
  ),
106
106
  /* @__PURE__ */ jsx(
107
- CheckboxControl,
107
+ WCCheckboxControl,
108
108
  {
109
109
  label: __("Publish"),
110
110
  help: __(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/navigation-link/link-ui/page-creator.jsx"],
4
- "sourcesContent": ["import {\n\tButton,\n\tTextControl,\n\tNotice,\n\tCheckboxControl,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState } from '@wordpress/element';\nimport DialogWrapper from './dialog-wrapper';\n\n/**\n * Component for creating new pages within the Navigation Link UI.\n *\n * @param {Object} props Component props.\n * @param {string} props.postType The post type to create.\n * @param {Function} props.onBack Callback when user wants to go back.\n * @param {Function} props.onPageCreated Callback when page is successfully created.\n * @param {string} [props.initialTitle] Initial title to pre-fill the form.\n */\nexport function LinkUIPageCreator( {\n\tpostType,\n\tonBack,\n\tonPageCreated,\n\tinitialTitle = '',\n} ) {\n\tconst [ title, setTitle ] = useState( initialTitle );\n\tconst [ shouldPublish, setShouldPublish ] = useState( true );\n\n\t// Check if the title is valid for submission\n\tconst isTitleValid = title.trim().length > 0;\n\n\t// Get the last created entity record (without ID) to track creation state\n\tconst { lastError, isSaving } = useSelect(\n\t\t( select ) => ( {\n\t\t\tlastError: select( coreStore ).getLastEntitySaveError(\n\t\t\t\t'postType',\n\t\t\t\tpostType\n\t\t\t),\n\t\t\tisSaving: select( coreStore ).isSavingEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType\n\t\t\t),\n\t\t} ),\n\t\t[ postType ]\n\t);\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tasync function createPage( event ) {\n\t\tevent.preventDefault();\n\t\tif ( isSaving || ! isTitleValid ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\ttitle,\n\t\t\t\t\tstatus: shouldPublish ? 'publish' : 'draft',\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tif ( savedRecord ) {\n\t\t\t\t// Create the page link object from the saved record\n\t\t\t\tconst pageLink = {\n\t\t\t\t\tid: savedRecord.id,\n\t\t\t\t\ttype: postType,\n\t\t\t\t\ttitle: decodeEntities( savedRecord.title.rendered ),\n\t\t\t\t\turl: savedRecord.link,\n\t\t\t\t\tkind: 'post-type',\n\t\t\t\t};\n\n\t\t\t\t// Show success notice\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: the name of the new page being created.\n\t\t\t\t\t\t__( '%s page created successfully.' ),\n\t\t\t\t\t\tdecodeEntities( savedRecord.title.rendered )\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'page-created-success',\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tonPageCreated( pageLink );\n\t\t\t}\n\t\t} catch {\n\t\t\t// Show error notice\n\t\t\tcreateErrorNotice(\n\t\t\t\t__( 'Failed to create page. Please try again.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'page-created-error',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\tconst isSubmitDisabled = isSaving || ! isTitleValid;\n\n\treturn (\n\t\t<DialogWrapper\n\t\t\tclassName=\"link-ui-page-creator\"\n\t\t\ttitle={ __( 'Create page' ) }\n\t\t\tdescription={ __( 'Create a new page to add to your Navigation.' ) }\n\t\t\tonBack={ onBack }\n\t\t>\n\t\t\t<VStack className=\"link-ui-page-creator__inner\" spacing={ 4 }>\n\t\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\tlabel={ __( 'Publish' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\"Turn off to save as a draft. Drafts won't appear on your site until published.\"\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tchecked={ shouldPublish }\n\t\t\t\t\t\t\tonChange={ setShouldPublish }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t{ lastError && (\n\t\t\t\t\t\t\t<Notice status=\"error\" isDismissible={ false }>\n\t\t\t\t\t\t\t\t{ lastError.message }\n\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<HStack spacing={ 2 } justify=\"flex-end\">\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\tonClick={ onBack }\n\t\t\t\t\t\t\t\tdisabled={ isSaving }\n\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\tisBusy={ isSaving }\n\t\t\t\t\t\t\t\taria-disabled={ isSubmitDisabled }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Create page' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</VStack>\n\t\t\t\t</form>\n\t\t\t</VStack>\n\t\t</DialogWrapper>\n\t);\n}\n"],
5
- "mappings": ";AAAA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,OAClB;AACP,SAAS,IAAI,eAAe;AAC5B,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,iBAAiB;AACnC,SAAS,SAAS,oBAAoB;AACtC,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB;AACzB,OAAO,mBAAmB;AA4GpB,cAsBA,YAtBA;AAjGC,SAAS,kBAAmB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAChB,GAAI;AACH,QAAM,CAAE,OAAO,QAAS,IAAI,SAAU,YAAa;AACnD,QAAM,CAAE,eAAe,gBAAiB,IAAI,SAAU,IAAK;AAG3D,QAAM,eAAe,MAAM,KAAK,EAAE,SAAS;AAG3C,QAAM,E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AAI,8CAA+C;AAAA,MACjE;AAAA,MAEA,8BAAC,UAAO,WAAU,+BAA8B,SAAU,GACzD,8BAAC,UAAK,UAAW,YAChB,+BAAC,UAAO,SAAU,GACjB;AAAA;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ,GAAI,OAAQ;AAAA,YACpB,UAAW;AAAA,YACX,aAAc,GAAI,UAAW;AAAA,YAC7B,OAAQ;AAAA;AAAA,QACT;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ,GAAI,SAAU;AAAA,YACtB,MAAO;AAAA,cACN;AAAA,YACD;AAAA,YACA,SAAU;AAAA,YACV,UAAW;AAAA;AAAA,QACZ;AAAA,QAEE,aACD,oBAAC,UAAO,QAAO,SAAQ,eAAgB,OACpC,oBAAU,SACb;AAAA,QAGD,qBAAC,UAAO,SAAU,GAAI,SAAQ,YAC7B;AAAA;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,SAAQ;AAAA,cACR,SAAU;AAAA,cACV,UAAW;AAAA,cACX,wBAAsB;AAAA,cAEpB,aAAI,QAAS;AAAA;AAAA,UAChB;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,QAAS;AAAA,cACT,iBAAgB;AAAA,cAEd,aAAI,aAAc;AAAA;AAAA,UACrB;AAAA,WACD;AAAA,SACD,GACD,GACD;AAAA;AAAA,EACD;AAEF;",
4
+ "sourcesContent": ["import {\n\tButton,\n\tTextControl,\n\tNotice,\n\tCheckboxControl as WCCheckboxControl,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState } from '@wordpress/element';\nimport DialogWrapper from './dialog-wrapper';\n\n/**\n * Component for creating new pages within the Navigation Link UI.\n *\n * @param {Object} props Component props.\n * @param {string} props.postType The post type to create.\n * @param {Function} props.onBack Callback when user wants to go back.\n * @param {Function} props.onPageCreated Callback when page is successfully created.\n * @param {string} [props.initialTitle] Initial title to pre-fill the form.\n */\nexport function LinkUIPageCreator( {\n\tpostType,\n\tonBack,\n\tonPageCreated,\n\tinitialTitle = '',\n} ) {\n\tconst [ title, setTitle ] = useState( initialTitle );\n\tconst [ shouldPublish, setShouldPublish ] = useState( true );\n\n\t// Check if the title is valid for submission\n\tconst isTitleValid = title.trim().length > 0;\n\n\t// Get the last created entity record (without ID) to track creation state\n\tconst { lastError, isSaving } = useSelect(\n\t\t( select ) => ( {\n\t\t\tlastError: select( coreStore ).getLastEntitySaveError(\n\t\t\t\t'postType',\n\t\t\t\tpostType\n\t\t\t),\n\t\t\tisSaving: select( coreStore ).isSavingEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType\n\t\t\t),\n\t\t} ),\n\t\t[ postType ]\n\t);\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tasync function createPage( event ) {\n\t\tevent.preventDefault();\n\t\tif ( isSaving || ! isTitleValid ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\ttitle,\n\t\t\t\t\tstatus: shouldPublish ? 'publish' : 'draft',\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tif ( savedRecord ) {\n\t\t\t\t// Create the page link object from the saved record\n\t\t\t\tconst pageLink = {\n\t\t\t\t\tid: savedRecord.id,\n\t\t\t\t\ttype: postType,\n\t\t\t\t\ttitle: decodeEntities( savedRecord.title.rendered ),\n\t\t\t\t\turl: savedRecord.link,\n\t\t\t\t\tkind: 'post-type',\n\t\t\t\t};\n\n\t\t\t\t// Show success notice\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: the name of the new page being created.\n\t\t\t\t\t\t__( '%s page created successfully.' ),\n\t\t\t\t\t\tdecodeEntities( savedRecord.title.rendered )\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'page-created-success',\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tonPageCreated( pageLink );\n\t\t\t}\n\t\t} catch {\n\t\t\t// Show error notice\n\t\t\tcreateErrorNotice(\n\t\t\t\t__( 'Failed to create page. Please try again.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'page-created-error',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\tconst isSubmitDisabled = isSaving || ! isTitleValid;\n\n\treturn (\n\t\t<DialogWrapper\n\t\t\tclassName=\"link-ui-page-creator\"\n\t\t\ttitle={ __( 'Create page' ) }\n\t\t\tdescription={ __( 'Create a new page to add to your Navigation.' ) }\n\t\t\tonBack={ onBack }\n\t\t>\n\t\t\t<VStack className=\"link-ui-page-creator__inner\" spacing={ 4 }>\n\t\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<WCCheckboxControl\n\t\t\t\t\t\t\tlabel={ __( 'Publish' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\"Turn off to save as a draft. Drafts won't appear on your site until published.\"\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tchecked={ shouldPublish }\n\t\t\t\t\t\t\tonChange={ setShouldPublish }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t{ lastError && (\n\t\t\t\t\t\t\t<Notice status=\"error\" isDismissible={ false }>\n\t\t\t\t\t\t\t\t{ lastError.message }\n\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<HStack spacing={ 2 } justify=\"flex-end\">\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\tonClick={ onBack }\n\t\t\t\t\t\t\t\tdisabled={ isSaving }\n\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\tisBusy={ isSaving }\n\t\t\t\t\t\t\t\taria-disabled={ isSubmitDisabled }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Create page' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</VStack>\n\t\t\t\t</form>\n\t\t\t</VStack>\n\t\t</DialogWrapper>\n\t);\n}\n"],
5
+ "mappings": ";AAAA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,mBAAmB;AAAA,EACnB,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,OAClB;AACP,SAAS,IAAI,eAAe;AAC5B,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,iBAAiB;AACnC,SAAS,SAAS,oBAAoB;AACtC,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB;AACzB,OAAO,mBAAmB;AA4GpB,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experimentalToolsPanel as ToolsPanel,
5
5
  __experimentalToolsPanelItem as ToolsPanelItem,
6
- CheckboxControl,
6
+ CheckboxControl as WCCheckboxControl,
7
7
  TextControl,
8
8
  TextareaControl as WCTextareaControl
9
9
  } from "@wordpress/components";
@@ -174,7 +174,7 @@ function Controls({
174
174
  onDeselect: () => setAttributes({ opensInNewTab: false }),
175
175
  isShownByDefault: true,
176
176
  children: /* @__PURE__ */ jsx(
177
- CheckboxControl,
177
+ WCCheckboxControl,
178
178
  {
179
179
  label: __("Open in new tab"),
180
180
  checked: opensInNewTab,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/navigation-link/shared/controls.jsx"],
4
- "sourcesContent": ["import {\n\tButton,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tCheckboxControl,\n\tTextControl,\n\tTextareaControl as WCTextareaControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { external } from '@wordpress/icons';\nimport { useToolsPanelDropdownMenuProps } from '../../utils/hooks';\nimport { useHandleLinkChange } from './use-handle-link-change';\nimport { useEntityBinding } from './use-entity-binding';\nimport { getSuggestionsQuery } from '../link-ui';\nimport { useLinkPreview } from './use-link-preview';\nimport { useIsInvalidLink } from './use-is-invalid-link';\nimport { unlock } from '../../lock-unlock';\n\nconst { LinkPicker, isHashLink, isRelativePath } = unlock(\n\tblockEditorPrivateApis\n);\n\n/**\n * Get a human-readable entity type name.\n *\n * @param {string} type - The entity type\n * @param {string} kind - The entity kind\n * @return {string} Human-readable entity type name\n */\nfunction getEntityTypeName( type, kind ) {\n\tif ( kind === 'post-type' ) {\n\t\tswitch ( type ) {\n\t\t\tcase 'post':\n\t\t\t\treturn __( 'post' );\n\t\t\tcase 'page':\n\t\t\t\treturn __( 'page' );\n\t\t\tdefault:\n\t\t\t\treturn type || __( 'post' );\n\t\t}\n\t}\n\tif ( kind === 'taxonomy' ) {\n\t\tswitch ( type ) {\n\t\t\tcase 'category':\n\t\t\t\treturn __( 'category' );\n\t\t\tcase 'tag':\n\t\t\t\treturn __( 'tag' );\n\t\t\tdefault:\n\t\t\t\treturn type || __( 'term' );\n\t\t}\n\t}\n\treturn type || __( 'item' );\n}\n\n/**\n * Shared Controls component for Navigation Link and Navigation Submenu blocks.\n *\n * This component provides the inspector controls (ToolsPanel) that are identical\n * between both navigation blocks.\n *\n * @param {Object} props - Component props\n * @param {Object} props.attributes - Block attributes\n * @param {Function} props.setAttributes - Function to update block attributes\n * @param {string} props.clientId - Block client ID\n * @param {boolean} props.isLinkEditable - Whether link editing should be allowed\n */\nexport function Controls( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tisLinkEditable = true,\n} ) {\n\tconst { label, url, description, rel, opensInNewTab } = attributes;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// Use the entity binding hook for UI state (help text, link preview, etc.)\n\tconst { hasUrlBinding, isBoundEntityAvailable, entityRecord } =\n\t\tuseEntityBinding( {\n\t\t\tclientId,\n\t\t\tattributes,\n\t\t} );\n\n\tconst [ isInvalid, isDraft ] = useIsInvalidLink(\n\t\tattributes.kind,\n\t\tattributes.type,\n\t\tentityRecord?.id,\n\t\thasUrlBinding\n\t);\n\n\tlet helpText = '';\n\n\tif ( isInvalid || ( hasUrlBinding && ! isBoundEntityAvailable ) ) {\n\t\t// Show invalid link help text for:\n\t\t// 1. Invalid post-type links (trashed/deleted posts/pages) - via useIsInvalidLink\n\t\t// 2. Missing bound taxonomy entities (deleted categories/tags) - useIsInvalidLink only checks post-types\n\t\thelpText = getInvalidLinkHelpText();\n\t} else if ( isDraft ) {\n\t\thelpText = getDraftHelpText( {\n\t\t\ttype: attributes.type,\n\t\t\tkind: attributes.kind,\n\t\t} );\n\t}\n\t// Get the link change handler with built-in binding management\n\tconst handleLinkChange = useHandleLinkChange( {\n\t\tclientId,\n\t\tattributes,\n\t\tsetAttributes,\n\t} );\n\n\tconst onNavigateToEntityRecord = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().onNavigateToEntityRecord,\n\t\t[]\n\t);\n\n\tconst homeUrl = useSelect( ( select ) => {\n\t\treturn select( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t?.home;\n\t}, [] );\n\n\tconst blockEditingMode = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlockEditingMode( clientId ),\n\t\t[ clientId ]\n\t);\n\n\tconst isContentOnly = blockEditingMode === 'contentOnly';\n\n\tconst preview = useLinkPreview( {\n\t\turl,\n\t\tentityRecord,\n\t\ttype: attributes.type,\n\t\thasBinding: hasUrlBinding,\n\t\tisEntityAvailable: isBoundEntityAvailable,\n\t} );\n\n\t// Check if URL is viewable (not hash link or other relative path like ./ or ../)\n\tconst isViewableUrl =\n\t\t!! url &&\n\t\t( ! isHashLink( url ) ||\n\t\t\t( isRelativePath( url ) && ! url.startsWith( '/' ) ) );\n\n\t// Construct full URL for viewing (prepend home URL for absolute paths starting with /)\n\tconst viewUrl =\n\t\tisViewableUrl && url.startsWith( '/' ) && homeUrl ? homeUrl + url : url;\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Settings' ) }\n\t\t\tresetAll={ () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tlabel: '',\n\t\t\t\t\turl: '',\n\t\t\t\t\tdescription: '',\n\t\t\t\t\trel: '',\n\t\t\t\t\topensInNewTab: false,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! label }\n\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { label: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\tvalue={ label ? stripHTML( label ) : '' }\n\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t} }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\n\t\t\t{ isLinkEditable && (\n\t\t\t\t<>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! url }\n\t\t\t\t\t\tlabel={ __( 'Link to' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\turl: undefined,\n\t\t\t\t\t\t\t\tid: undefined,\n\t\t\t\t\t\t\t\tkind: undefined,\n\t\t\t\t\t\t\t\ttype: undefined,\n\t\t\t\t\t\t\t} )\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<LinkPicker\n\t\t\t\t\t\t\tpreview={ preview }\n\t\t\t\t\t\t\tonSelect={ handleLinkChange }\n\t\t\t\t\t\t\tsuggestionsQuery={ getSuggestionsQuery(\n\t\t\t\t\t\t\t\tattributes.type,\n\t\t\t\t\t\t\t\tattributes.kind\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Link to' ) }\n\t\t\t\t\t\t\thelp={ helpText ? helpText : undefined }\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\n\t\t\t\t\t{ !! url &&\n\t\t\t\t\t\thasUrlBinding &&\n\t\t\t\t\t\tisBoundEntityAvailable &&\n\t\t\t\t\t\tentityRecord?.id &&\n\t\t\t\t\t\tattributes.kind === 'post-type' &&\n\t\t\t\t\t\tonNavigateToEntityRecord && (\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\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\tpostId: entityRecord.id,\n\t\t\t\t\t\t\t\t\t\tpostType: attributes.type,\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{ isViewableUrl && (\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={ viewUrl }\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</>\n\t\t\t) }\n\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! description }\n\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { description: '' } ) }\n\t\t\t\tisShownByDefault={ ! isContentOnly }\n\t\t\t>\n\t\t\t\t<WCTextareaControl\n\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\tsetAttributes( { description: descriptionValue } );\n\t\t\t\t\t} }\n\t\t\t\t\thelp={ __(\n\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) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! rel }\n\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { rel: '' } ) }\n\t\t\t\tisShownByDefault={ ! isContentOnly }\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t} }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'The relationship of the linked URL as space-separated link types.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t</ToolsPanel>\n\t);\n}\n/**\n * Returns help text for invalid links.\n *\n * @return {string} Error help text string (empty string if valid).\n */\nexport function getInvalidLinkHelpText() {\n\treturn __(\n\t\t'This link is invalid and will not appear on your site. Please update the link.'\n\t);\n}\n\n/**\n * Returns the help text for links to draft entities\n *\n * @param {Object} props - Function props\n * @param {string} props.type - The entity type\n * @param {string} props.kind - The entity kind\n * @return {string} Draft help text\n */\nfunction getDraftHelpText( { type, kind } ) {\n\tconst entityType = getEntityTypeName( type, kind );\n\treturn sprintf(\n\t\t/* translators: %1$s is the entity type (e.g., \"page\", \"post\", \"category\") */\n\t\t__(\n\t\t\t'This link is to a draft %1$s and will not appear on your site until the %1$s is published.'\n\t\t),\n\t\tentityType\n\t);\n}\n"],
5
- "mappings": ";AAAA;AAAA,EACC;AAAA,EACA,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,EAChC;AAAA,EACA;AAAA,EACA,mBAAmB;AAAA,OACb;AACP,SAAS,IAAI,eAAe;AAC5B,SAAS,uBAAuB,iBAAiB;AACjD;AAAA,EACC,eAAe;AAAA,EACf,SAAS;AAAA,OACH;AACP,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,gBAAgB;AACzB,SAAS,sCAAsC;AAC/C,SAAS,2BAA2B;AACpC,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,cAAc;AAqJnB,SAWA,UAXA,KAWA,YAXA;AAnJJ,IAAM,EAAE,YAAY,YAAY,eAAe,IAAI;AAAA,EAClD;AACD;AASA,SAAS,kBAAmB,MAAM,MAAO;AACxC,MAAK,SAAS,aAAc;AAC3B,YAAS,MAAO;AAAA,MACf,KAAK;AACJ,eAAO,GAAI,MAAO;AAAA,MACnB,KAAK;AACJ,eAAO,GAAI,MAAO;AAAA,MACnB;AACC,eAAO,QAAQ,GAAI,MAAO;AAAA,IAC5B;AAAA,EACD;AACA,MAAK,SAAS,YAAa;AAC1B,YAAS,MAAO;AAAA,MACf,KAAK;AACJ,eAAO,GAAI,UAAW;AAAA,MACvB,KAAK;AACJ,eAAO,GAAI,KAAM;AAAA,MAClB;AACC,eAAO,QAAQ,GAAI,MAAO;AAAA,IAC5B;AAAA,EACD;AACA,SAAO,QAAQ,GAAI,MAA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,gBAClD;AAAA,gBACA,MAAO;AAAA,kBACN;AAAA,gBACD;AAAA;AAAA,YACD;AAAA;AAAA,QACD;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACA,UAAW,MAAM,CAAC,CAAE;AAAA,YACpB,OAAQ,GAAI,eAAgB;AAAA,YAC5B,YAAa,MAAM,cAAe,EAAE,KAAK,GAAG,CAAE;AAAA,YAC9C,kBAAmB,CAAE;AAAA,YAErB;AAAA,cAAC;AAAA;AAAA,gBACA,OAAQ,GAAI,eAAgB;AAAA,gBAC5B,OAAQ,OAAO;AAAA,gBACf,UAAW,CAAE,aAAc;AAC1B,gCAAe,EAAE,KAAK,SAAS,CAAE;AAAA,gBAClC;AAAA,gBACA,cAAa;AAAA,gBACb,MAAO;AAAA,kBACN;AAAA,gBACD;AAAA;AAAA,YACD;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EACD;AAEF;AAMO,SAAS,yBAAyB;AACxC,SAAO;AAAA,IACN;AAAA,EACD;AACD;AAUA,SAAS,iBAAkB,EAAE,MAAM,KAAK,GAAI;AAC3C,QAAM,aAAa,kBAAmB,MAAM,IAAK;AACjD,SAAO;AAAA;AAAA,IAEN;AAAA,MACC;AAAA,IACD;AAAA,IACA;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["import {\n\tButton,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tCheckboxControl as WCCheckboxControl,\n\tTextControl,\n\tTextareaControl as WCTextareaControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { external } from '@wordpress/icons';\nimport { useToolsPanelDropdownMenuProps } from '../../utils/hooks';\nimport { useHandleLinkChange } from './use-handle-link-change';\nimport { useEntityBinding } from './use-entity-binding';\nimport { getSuggestionsQuery } from '../link-ui';\nimport { useLinkPreview } from './use-link-preview';\nimport { useIsInvalidLink } from './use-is-invalid-link';\nimport { unlock } from '../../lock-unlock';\n\nconst { LinkPicker, isHashLink, isRelativePath } = unlock(\n\tblockEditorPrivateApis\n);\n\n/**\n * Get a human-readable entity type name.\n *\n * @param {string} type - The entity type\n * @param {string} kind - The entity kind\n * @return {string} Human-readable entity type name\n */\nfunction getEntityTypeName( type, kind ) {\n\tif ( kind === 'post-type' ) {\n\t\tswitch ( type ) {\n\t\t\tcase 'post':\n\t\t\t\treturn __( 'post' );\n\t\t\tcase 'page':\n\t\t\t\treturn __( 'page' );\n\t\t\tdefault:\n\t\t\t\treturn type || __( 'post' );\n\t\t}\n\t}\n\tif ( kind === 'taxonomy' ) {\n\t\tswitch ( type ) {\n\t\t\tcase 'category':\n\t\t\t\treturn __( 'category' );\n\t\t\tcase 'tag':\n\t\t\t\treturn __( 'tag' );\n\t\t\tdefault:\n\t\t\t\treturn type || __( 'term' );\n\t\t}\n\t}\n\treturn type || __( 'item' );\n}\n\n/**\n * Shared Controls component for Navigation Link and Navigation Submenu blocks.\n *\n * This component provides the inspector controls (ToolsPanel) that are identical\n * between both navigation blocks.\n *\n * @param {Object} props - Component props\n * @param {Object} props.attributes - Block attributes\n * @param {Function} props.setAttributes - Function to update block attributes\n * @param {string} props.clientId - Block client ID\n * @param {boolean} props.isLinkEditable - Whether link editing should be allowed\n */\nexport function Controls( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tisLinkEditable = true,\n} ) {\n\tconst { label, url, description, rel, opensInNewTab } = attributes;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// Use the entity binding hook for UI state (help text, link preview, etc.)\n\tconst { hasUrlBinding, isBoundEntityAvailable, entityRecord } =\n\t\tuseEntityBinding( {\n\t\t\tclientId,\n\t\t\tattributes,\n\t\t} );\n\n\tconst [ isInvalid, isDraft ] = useIsInvalidLink(\n\t\tattributes.kind,\n\t\tattributes.type,\n\t\tentityRecord?.id,\n\t\thasUrlBinding\n\t);\n\n\tlet helpText = '';\n\n\tif ( isInvalid || ( hasUrlBinding && ! isBoundEntityAvailable ) ) {\n\t\t// Show invalid link help text for:\n\t\t// 1. Invalid post-type links (trashed/deleted posts/pages) - via useIsInvalidLink\n\t\t// 2. Missing bound taxonomy entities (deleted categories/tags) - useIsInvalidLink only checks post-types\n\t\thelpText = getInvalidLinkHelpText();\n\t} else if ( isDraft ) {\n\t\thelpText = getDraftHelpText( {\n\t\t\ttype: attributes.type,\n\t\t\tkind: attributes.kind,\n\t\t} );\n\t}\n\t// Get the link change handler with built-in binding management\n\tconst handleLinkChange = useHandleLinkChange( {\n\t\tclientId,\n\t\tattributes,\n\t\tsetAttributes,\n\t} );\n\n\tconst onNavigateToEntityRecord = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().onNavigateToEntityRecord,\n\t\t[]\n\t);\n\n\tconst homeUrl = useSelect( ( select ) => {\n\t\treturn select( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t?.home;\n\t}, [] );\n\n\tconst blockEditingMode = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlockEditingMode( clientId ),\n\t\t[ clientId ]\n\t);\n\n\tconst isContentOnly = blockEditingMode === 'contentOnly';\n\n\tconst preview = useLinkPreview( {\n\t\turl,\n\t\tentityRecord,\n\t\ttype: attributes.type,\n\t\thasBinding: hasUrlBinding,\n\t\tisEntityAvailable: isBoundEntityAvailable,\n\t} );\n\n\t// Check if URL is viewable (not hash link or other relative path like ./ or ../)\n\tconst isViewableUrl =\n\t\t!! url &&\n\t\t( ! isHashLink( url ) ||\n\t\t\t( isRelativePath( url ) && ! url.startsWith( '/' ) ) );\n\n\t// Construct full URL for viewing (prepend home URL for absolute paths starting with /)\n\tconst viewUrl =\n\t\tisViewableUrl && url.startsWith( '/' ) && homeUrl ? homeUrl + url : url;\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Settings' ) }\n\t\t\tresetAll={ () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tlabel: '',\n\t\t\t\t\turl: '',\n\t\t\t\t\tdescription: '',\n\t\t\t\t\trel: '',\n\t\t\t\t\topensInNewTab: false,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! label }\n\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { label: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\tvalue={ label ? stripHTML( label ) : '' }\n\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t} }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\n\t\t\t{ isLinkEditable && (\n\t\t\t\t<>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! url }\n\t\t\t\t\t\tlabel={ __( 'Link to' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\turl: undefined,\n\t\t\t\t\t\t\t\tid: undefined,\n\t\t\t\t\t\t\t\tkind: undefined,\n\t\t\t\t\t\t\t\ttype: undefined,\n\t\t\t\t\t\t\t} )\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<LinkPicker\n\t\t\t\t\t\t\tpreview={ preview }\n\t\t\t\t\t\t\tonSelect={ handleLinkChange }\n\t\t\t\t\t\t\tsuggestionsQuery={ getSuggestionsQuery(\n\t\t\t\t\t\t\t\tattributes.type,\n\t\t\t\t\t\t\t\tattributes.kind\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Link to' ) }\n\t\t\t\t\t\t\thelp={ helpText ? helpText : undefined }\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\n\t\t\t\t\t{ !! url &&\n\t\t\t\t\t\thasUrlBinding &&\n\t\t\t\t\t\tisBoundEntityAvailable &&\n\t\t\t\t\t\tentityRecord?.id &&\n\t\t\t\t\t\tattributes.kind === 'post-type' &&\n\t\t\t\t\t\tonNavigateToEntityRecord && (\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\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\tpostId: entityRecord.id,\n\t\t\t\t\t\t\t\t\t\tpostType: attributes.type,\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{ isViewableUrl && (\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={ viewUrl }\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</>\n\t\t\t) }\n\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! description }\n\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { description: '' } ) }\n\t\t\t\tisShownByDefault={ ! isContentOnly }\n\t\t\t>\n\t\t\t\t<WCTextareaControl\n\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\tsetAttributes( { description: descriptionValue } );\n\t\t\t\t\t} }\n\t\t\t\t\thelp={ __(\n\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) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! rel }\n\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { rel: '' } ) }\n\t\t\t\tisShownByDefault={ ! isContentOnly }\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t} }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'The relationship of the linked URL as space-separated link types.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t</ToolsPanel>\n\t);\n}\n/**\n * Returns help text for invalid links.\n *\n * @return {string} Error help text string (empty string if valid).\n */\nexport function getInvalidLinkHelpText() {\n\treturn __(\n\t\t'This link is invalid and will not appear on your site. Please update the link.'\n\t);\n}\n\n/**\n * Returns the help text for links to draft entities\n *\n * @param {Object} props - Function props\n * @param {string} props.type - The entity type\n * @param {string} props.kind - The entity kind\n * @return {string} Draft help text\n */\nfunction getDraftHelpText( { type, kind } ) {\n\tconst entityType = getEntityTypeName( type, kind );\n\treturn sprintf(\n\t\t/* translators: %1$s is the entity type (e.g., \"page\", \"post\", \"category\") */\n\t\t__(\n\t\t\t'This link is to a draft %1$s and will not appear on your site until the %1$s is published.'\n\t\t),\n\t\tentityType\n\t);\n}\n"],
5
+ "mappings": ";AAAA;AAAA,EACC;AAAA,EACA,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,EAChC,mBAAmB;AAAA,EACnB;AAAA,EACA,mBAAmB;AAAA,OACb;AACP,SAAS,IAAI,eAAe;AAC5B,SAAS,uBAAuB,iBAAiB;AACjD;AAAA,EACC,eAAe;AAAA,EACf,SAAS;AAAA,OACH;AACP,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,gBAAgB;AACzB,SAAS,sCAAsC;AAC/C,SAAS,2BAA2B;AACpC,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,cAAc;AAqJnB,SAWA,UAXA,KAWA,YAXA;AAnJJ,IAAM,EAAE,YAAY,YAAY,eAAe,IAAI;AAAA,EAClD;AACD;AASA,SAAS,kBAAmB,MAAM,MAAO;AACxC,MAAK,SAAS,aAAc;AAC3B,YAAS,MAA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../src/navigation-link/shared/invalid-draft-display.jsx"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Displays a label with an \"(Invalid)\" or \"(Draft)\" indicator for navigation links.\n *\n * @param {Object} props Component props.\n * @param {string} props.label The label text to display.\n * @param {boolean} props.isInvalid Whether the link is invalid (deleted or trashed).\n * @param {boolean} props.isDraft Whether the link is a draft.\n * @param {string} props.className Optional additional CSS class for the label element.\n *\n * @return {Element} The invalid/draft display component.\n */\nexport function InvalidDraftDisplay( {\n\tlabel,\n\tisInvalid,\n\tisDraft,\n\tclassName = 'wp-block-navigation-link__label',\n} ) {\n\t// Only render if the link is invalid or a draft.\n\tif ( ! isInvalid && ! isDraft ) {\n\t\treturn null;\n\t}\n\n\tconst statusText = isInvalid\n\t\t? /* translators: Indicating that the navigation link is Invalid. */\n\t\t __( 'Invalid' )\n\t\t: /* translators: Indicating that the navigation link is a Draft. */\n\t\t __( 'Draft' );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'wp-block-navigation-link__placeholder-text',\n\t\t\t\tclassName,\n\t\t\t\t{\n\t\t\t\t\t'is-invalid': isInvalid,\n\t\t\t\t\t'is-draft': isDraft,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t<span>\n\t\t\t\t{\n\t\t\t\t\t// Some attributes are stored in an escaped form. It's a legacy issue.\n\t\t\t\t\t// Ideally they would be stored in a raw, unescaped form.\n\t\t\t\t\t// Unescape is used here to \"recover\" the escaped characters\n\t\t\t\t\t// so they display without encoding.\n\t\t\t\t\t// See `updateAttributes` for more details.\n\t\t\t\t\t`${ decodeEntities( label ) } (${ statusText })`.trim()\n\t\t\t\t}\n\t\t\t</span>\n\t\t</div>\n\t);\n}\n"],
5
- "mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,UAAU;AACnB,SAAS,sBAAsB;AAyC5B;AA5BI,SAAS,oBAAqB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AACb,GAAI;AAEH,MAAK,CAAE,aAAa,CAAE,SAAU;AAC/B,WAAO;AAAA,EACR;AAEA,QAAM,aAAa;AAAA;AAAA,IAEhB,GAAI,SAAU;AAAA;AAAA;AAAA,IAEd,GAAI,OAAQ;AAAA;AAEf,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAY;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,UACC,cAAc;AAAA,UACd,YAAY;AAAA,QACb;AAAA,MACD;AAAA,MAEA,8BAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAOC,aAAI,eAAgB,KAAM,CAAE,KAAM,UAAW,IAAI,KAAK;AAAA,OAExD;AAAA;AAAA,EACD;AAEF;",
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Displays a label with an \"(Invalid)\" or \"(Draft)\" indicator for navigation links.\n *\n * @param {Object} props Component props.\n * @param {string} props.label The label text to display.\n * @param {boolean} props.isInvalid Whether the link is invalid (deleted or trashed).\n * @param {boolean} props.isDraft Whether the link is a draft.\n * @param {string} props.className Optional additional CSS class for the label element.\n *\n * @return {Element} The invalid/draft display component.\n */\nexport function InvalidDraftDisplay( {\n\tlabel,\n\tisInvalid,\n\tisDraft,\n\tclassName = 'wp-block-navigation-link__label',\n} ) {\n\t// Only render if the link is invalid or a draft.\n\tif ( ! isInvalid && ! isDraft ) {\n\t\treturn null;\n\t}\n\n\tconst statusText = isInvalid\n\t\t? /* translators: Indicating that the navigation link is Invalid. */\n\t\t\t__( 'Invalid' )\n\t\t: /* translators: Indicating that the navigation link is a Draft. */\n\t\t\t__( 'Draft' );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'wp-block-navigation-link__placeholder-text',\n\t\t\t\tclassName,\n\t\t\t\t{\n\t\t\t\t\t'is-invalid': isInvalid,\n\t\t\t\t\t'is-draft': isDraft,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t<span>\n\t\t\t\t{\n\t\t\t\t\t// Some attributes are stored in an escaped form. It's a legacy issue.\n\t\t\t\t\t// Ideally they would be stored in a raw, unescaped form.\n\t\t\t\t\t// Unescape is used here to \"recover\" the escaped characters\n\t\t\t\t\t// so they display without encoding.\n\t\t\t\t\t// See `updateAttributes` for more details.\n\t\t\t\t\t`${ decodeEntities( label ) } (${ statusText })`.trim()\n\t\t\t\t}\n\t\t\t</span>\n\t\t</div>\n\t);\n}\n"],
5
+ "mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,UAAU;AACnB,SAAS,sBAAsB;AAyC5B;AA5BI,SAAS,oBAAqB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AACb,GAAI;AAEH,MAAK,CAAE,aAAa,CAAE,SAAU;AAC/B,WAAO;AAAA,EACR;AAEA,QAAM,aAAa;AAAA;AAAA,IAEjB,GAAI,SAAU;AAAA;AAAA;AAAA,IAEd,GAAI,OAAQ;AAAA;AAEd,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAY;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,UACC,cAAc;AAAA,UACd,YAAY;AAAA,QACb;AAAA,MACD;AAAA,MAEA,8BAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAOC,aAAI,eAAgB,KAAM,CAAE,KAAM,UAAW,IAAI,KAAK;AAAA,OAExD;AAAA;AAAA,EACD;AAEF;",
6
6
  "names": []
7
7
  }
@@ -71,24 +71,24 @@ function computeBadges({
71
71
  if (isExternal) {
72
72
  badges.push({
73
73
  label: __("External link"),
74
- intent: "default"
74
+ intent: "none"
75
75
  });
76
76
  } else if (isHashLink(url)) {
77
77
  badges.push({
78
78
  label: __("Internal link"),
79
- intent: "default"
79
+ intent: "none"
80
80
  });
81
81
  } else if (isHomepage(url, homeUrl)) {
82
82
  badges.push({
83
83
  label: __("Homepage"),
84
- intent: "default"
84
+ intent: "none"
85
85
  });
86
86
  } else if (type && type !== "custom") {
87
- badges.push({ label: capitalize(type), intent: "default" });
87
+ badges.push({ label: capitalize(type), intent: "none" });
88
88
  } else {
89
89
  badges.push({
90
90
  label: __("Page"),
91
- intent: "default"
91
+ intent: "none"
92
92
  });
93
93
  }
94
94
  }
@@ -99,18 +99,18 @@ function computeBadges({
99
99
  __("Missing %s"),
100
100
  type
101
101
  ),
102
- intent: "error"
102
+ intent: "high"
103
103
  });
104
104
  } else if (!url) {
105
- badges.push({ label: __("No link selected"), intent: "error" });
105
+ badges.push({ label: __("No link selected"), intent: "high" });
106
106
  } else if (entityStatus) {
107
107
  const statusMap = {
108
- publish: { label: __("Published"), intent: "success" },
109
- future: { label: __("Scheduled"), intent: "warning" },
110
- draft: { label: __("Draft"), intent: "warning" },
111
- pending: { label: __("Pending"), intent: "warning" },
112
- private: { label: __("Private"), intent: "default" },
113
- trash: { label: __("Trash"), intent: "error" }
108
+ publish: { label: __("Published"), intent: "stable" },
109
+ future: { label: __("Scheduled"), intent: "informational" },
110
+ draft: { label: __("Draft"), intent: "low" },
111
+ pending: { label: __("Pending"), intent: "low" },
112
+ private: { label: __("Private"), intent: "informational" },
113
+ trash: { label: __("Trashed"), intent: "high" }
114
114
  };
115
115
  const badge = statusMap[entityStatus];
116
116
  if (badge) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/navigation-link/shared/use-link-preview.js"],
4
- "sourcesContent": ["import { __, sprintf } from '@wordpress/i18n';\nimport { safeDecodeURI } from '@wordpress/url';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { unlock } from '../../lock-unlock';\n\nconst { useRemoteUrlData, isHashLink, isRelativePath } = unlock(\n\tblockEditorPrivateApis\n);\n\n/**\n * Capitalize the first letter of a string.\n *\n * @param {string} str - The string to capitalize\n * @return {string} Capitalized string\n */\nfunction capitalize( str ) {\n\treturn str.charAt( 0 ).toUpperCase() + str.slice( 1 );\n}\n\n/**\n * Check if a URL points to the site homepage.\n * Handles protocol (http/https) and trailing slash variations.\n * Does not match subdomains unless they are the site URL.\n *\n * @param {string} url - The URL to check\n * @param {string} homeUrl - The WordPress site URL\n * @return {boolean} True if url is the homepage\n */\nexport function isHomepage( url, homeUrl ) {\n\tif ( url === '/' ) {\n\t\treturn true;\n\t}\n\tif ( ! url || ! homeUrl ) {\n\t\treturn false;\n\t}\n\ttry {\n\t\tconst urlParsed = new URL( url, homeUrl );\n\t\tconst homeParsed = new URL( homeUrl );\n\n\t\t// Same host, i.e. sub.homepage.com or homepage.com\n\t\tif ( urlParsed.hostname !== homeParsed.hostname ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Path must match site root (normalize trailing slash)\n\t\tconst urlPath = urlParsed.pathname.replace( /\\/$/, '' );\n\t\tconst homePath = homeParsed.pathname.replace( /\\/$/, '' );\n\n\t\treturn urlPath === homePath;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Compute display URL - strips site URL if internal, shows full URL if external.\n *\n * @param {Object} options - Parameters object\n * @param {string} options.linkUrl - The URL to process\n * @param {string} options.homeUrl - The WordPress site URL (required for internal/external detection)\n * @return {Object} Object with displayUrl and isExternal flag\n */\nexport function computeDisplayUrl( { linkUrl, homeUrl } = {} ) {\n\tif ( ! linkUrl ) {\n\t\treturn { displayUrl: '', isExternal: false };\n\t}\n\n\tlet displayUrl = safeDecodeURI( linkUrl );\n\tlet isExternal = false;\n\n\t// Check hash links and relative paths first - these are always internal\n\tif ( isRelativePath( linkUrl ) || isHashLink( linkUrl ) ) {\n\t\treturn { displayUrl, isExternal: false };\n\t}\n\n\t// Try to parse as a full URL to determine if it's actually external\n\t// This must happen before trusting the type attribute\n\ttry {\n\t\tconst parsedUrl = new URL( linkUrl );\n\t\t// Compare by host (not origin) so http/https to same site both count as internal\n\t\tconst siteHost = new URL( homeUrl ).host;\n\n\t\tif ( parsedUrl.host === siteHost ) {\n\t\t\t// Show only the pathname (and search/hash if present)\n\t\t\tlet path = parsedUrl.pathname + parsedUrl.search + parsedUrl.hash;\n\t\t\t// Remove trailing slash\n\t\t\tif ( path.endsWith( '/' ) && path.length > 1 ) {\n\t\t\t\tpath = path.slice( 0, -1 );\n\t\t\t}\n\t\t\tdisplayUrl = path;\n\t\t} else {\n\t\t\t// Different host - this is an external link\n\t\t\tisExternal = true;\n\t\t}\n\t} catch {\n\t\t// URL parsing failed - treat as external (e.g. no homeUrl, or URL without protocol)\n\t\tisExternal = true;\n\t}\n\n\treturn { displayUrl, isExternal };\n}\n\n/**\n * Compute badges for the link preview.\n *\n * @param {Object} options - Options object\n * @param {string} options.url - Link URL\n * @param {string} options.homeUrl - WordPress site URL (for homepage detection)\n * @param {string} options.type - Entity type (page, post, etc.)\n * @param {boolean} options.isExternal - Whether link is external\n * @param {string} options.entityStatus - Entity status (publish, draft, etc.)\n * @param {boolean} options.hasBinding - Whether link has entity binding\n * @param {boolean} options.isEntityAvailable - Whether bound entity exists\n * @return {Array} Array of badge objects with label and intent\n */\nexport function computeBadges( {\n\turl,\n\thomeUrl,\n\ttype,\n\tisExternal,\n\tentityStatus,\n\thasBinding,\n\tisEntityAvailable,\n} ) {\n\tconst badges = [];\n\t// Kind badge\n\tif ( url ) {\n\t\tif ( isExternal ) {\n\t\t\tbadges.push( {\n\t\t\t\tlabel: __( 'External link' ),\n\t\t\t\tintent: 'default',\n\t\t\t} );\n\t\t} else if ( isHashLink( url ) ) {\n\t\t\t// Hash links should be detected before type check\n\t\t\t// because they're not entity links even if type is set\n\t\t\tbadges.push( {\n\t\t\t\tlabel: __( 'Internal link' ),\n\t\t\t\tintent: 'default',\n\t\t\t} );\n\t\t} else if ( isHomepage( url, homeUrl ) ) {\n\t\t\tbadges.push( {\n\t\t\t\tlabel: __( 'Homepage' ),\n\t\t\t\tintent: 'default',\n\t\t\t} );\n\t\t} else if ( type && type !== 'custom' ) {\n\t\t\t// Show entity type badge (page, post, category, etc.)\n\t\t\t// but not 'custom' since that's just a manual link\n\t\t\tbadges.push( { label: capitalize( type ), intent: 'default' } );\n\t\t} else {\n\t\t\t// Internal link (not external, not hash, not entity)\n\t\t\tbadges.push( {\n\t\t\t\tlabel: __( 'Page' ),\n\t\t\t\tintent: 'default',\n\t\t\t} );\n\t\t}\n\t}\n\n\t// Status badge\n\tif ( hasBinding && ! isEntityAvailable ) {\n\t\tbadges.push( {\n\t\t\tlabel: sprintf(\n\t\t\t\t/* translators: %s is the entity type (e.g., \"page\", \"post\", \"category\") */\n\t\t\t\t__( 'Missing %s' ),\n\t\t\t\ttype\n\t\t\t),\n\t\t\tintent: 'error',\n\t\t} );\n\t} else if ( ! url ) {\n\t\tbadges.push( { label: __( 'No link selected' ), intent: 'error' } );\n\t} else if ( entityStatus ) {\n\t\tconst statusMap = {\n\t\t\tpublish: { label: __( 'Published' ), intent: 'success' },\n\t\t\tfuture: { label: __( 'Scheduled' ), intent: 'warning' },\n\t\t\tdraft: { label: __( 'Draft' ), intent: 'warning' },\n\t\t\tpending: { label: __( 'Pending' ), intent: 'warning' },\n\t\t\tprivate: { label: __( 'Private' ), intent: 'default' },\n\t\t\ttrash: { label: __( 'Trash' ), intent: 'error' },\n\t\t};\n\t\tconst badge = statusMap[ entityStatus ];\n\t\tif ( badge ) {\n\t\t\tbadges.push( badge );\n\t\t}\n\t}\n\n\treturn badges;\n}\n\n/**\n * Returns an entity record's display title: the rendered title, \"(no title)\"\n * for an untitled entity, or the record's name.\n *\n * @param {Object} entityRecord The entity record.\n * @return {string|undefined} The display title.\n */\nfunction getEntityTitle( entityRecord ) {\n\tconst title = entityRecord?.title;\n\n\t// Some entity types use a plain string for the title.\n\tif ( typeof title === 'string' ) {\n\t\treturn title;\n\t}\n\n\t// Posts and pages expose `title` as a { raw, rendered } object.\n\tif ( title && 'rendered' in title ) {\n\t\treturn title.rendered || __( '(no title)' );\n\t}\n\n\treturn entityRecord?.name;\n}\n\n/**\n * Hook to compute link preview data for display.\n *\n * This hook takes raw link data and entity information and computes\n * presentation-ready preview data including formatted title, URL, and badges.\n *\n * @param {Object} options - Options object\n * @param {string} options.url - Link URL\n * @param {string} options.type - Entity type (page, post, etc.)\n * @param {Object} options.entityRecord - Entity record\n * @param {boolean} options.hasBinding - Whether link has entity binding\n * @param {boolean} options.isEntityAvailable - Whether bound entity exists\n * @return {Object} Preview data object with title, url, image, and badges\n */\nexport function useLinkPreview( {\n\turl,\n\tentityRecord,\n\ttype,\n\thasBinding,\n\tisEntityAvailable,\n} ) {\n\t// Get the WordPress homepage URL from settings\n\tconst homeUrl = useSelect( ( select ) => {\n\t\treturn select( coreDataStore ).getEntityRecord(\n\t\t\t'root',\n\t\t\t'__unstableBase'\n\t\t)?.home;\n\t}, [] );\n\n\tconst title = getEntityTitle( entityRecord );\n\n\t// Fetch rich URL data if we don't have a title. Internal links should have passed a title.\n\tconst { richData } = useRemoteUrlData( title ? null : url );\n\n\t// Compute display URL and external flag\n\tconst { displayUrl, isExternal } = computeDisplayUrl( {\n\t\tlinkUrl: url,\n\t\thomeUrl,\n\t} );\n\n\tconst image = useSelect(\n\t\t( select ) => {\n\t\t\t// Only fetch for post-type entities with featured media\n\t\t\tif ( ! entityRecord?.featured_media ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst { getEntityRecord } = select( coreDataStore );\n\n\t\t\t// Get the media entity to fetch the image URL\n\t\t\tconst media = getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\tentityRecord.featured_media\n\t\t\t);\n\n\t\t\t// Return the thumbnail or medium size URL, fallback to source_url\n\t\t\treturn (\n\t\t\t\tmedia?.media_details?.sizes?.thumbnail?.source_url ||\n\t\t\t\tmedia?.media_details?.sizes?.medium?.source_url ||\n\t\t\t\tmedia?.source_url ||\n\t\t\t\tnull\n\t\t\t);\n\t\t},\n\t\t[ entityRecord?.featured_media ]\n\t);\n\n\t// Compute badges\n\tconst badges = computeBadges( {\n\t\turl,\n\t\thomeUrl,\n\t\ttype,\n\t\tisExternal,\n\t\tentityStatus: entityRecord?.status,\n\t\thasBinding,\n\t\tisEntityAvailable,\n\t} );\n\n\t// Get display title - use provided title, fallback to rich data, or URL\n\tconst displayTitle = url\n\t\t? title || richData?.title || safeDecodeURI( url )\n\t\t: __( 'Add link' );\n\n\treturn {\n\t\ttitle: displayTitle,\n\t\turl: displayUrl,\n\t\timage,\n\t\tbadges,\n\t};\n}\n"],
5
- "mappings": ";AAAA,SAAS,IAAI,eAAe;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,eAAe,8BAA8B;AACtD,SAAS,iBAAiB;AAC1B,SAAS,SAAS,qBAAqB;AACvC,SAAS,cAAc;AAEvB,IAAM,EAAE,kBAAkB,YAAY,eAAe,IAAI;AAAA,EACxD;AACD;AAQA,SAAS,WAAY,KAAM;AAC1B,SAAO,IAAI,OAAQ,CAAE,EAAE,YAAY,IAAI,IAAI,MAAO,CAAE;AACrD;AAWO,SAAS,WAAY,KAAK,SAAU;AAC1C,MAAK,QAAQ,KAAM;AAClB,WAAO;AAAA,EACR;AACA,MAAK,CAAE,OAAO,CAAE,SAAU;AACzB,WAAO;AAAA,EACR;AACA,MAAI;AACH,UAAM,YAAY,IAAI,IAAK,KAAK,OAAQ;AACxC,UAAM,aAAa,IAAI,IAAK,OAAQ;AAGpC,QAAK,UAAU,aAAa,WAAW,UAAW;AACjD,aAAO;AAAA,IACR;AAGA,UAAM,UAAU,UAAU,SAAS,QAAS,OAAO,EAAG;AACtD,UAAM,WAAW,WAAW,SAAS,QAAS,OAAO,EAAG;AAExD,WAAO,YAAY;AAAA,EACpB,QAAQ;AACP,WAAO;AAAA,EACR;AACD;AAUO,SAAS,kBAAmB,EAAE,SAAS,QAAQ,IAAI,CAAC,GAAI;AAC9D,MAAK,CAAE,SAAU;AAChB,WAAO,EAAE,YAAY,IAAI,YAAY,MAAM;AAAA,E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MAC9B;AAAA,MACA;AAAA,IACD,GAAG;AAAA,EACJ,GAAG,CAAC,CAAE;AAEN,QAAM,QAAQ,eAAgB,YAAa;AAG3C,QAAM,EAAE,SAAS,IAAI,iBAAkB,QAAQ,OAAO,GAAI;AAG1D,QAAM,EAAE,YAAY,WAAW,IAAI,kBAAmB;AAAA,IACrD,SAAS;AAAA,IACT;AAAA,EACD,CAAE;AAEF,QAAM,QAAQ;AAAA,IACb,CAAE,WAAY;AAEb,UAAK,CAAE,cAAc,gBAAiB;AACrC,eAAO;AAAA,MACR;AAEA,YAAM,EAAE,gBAAgB,IAAI,OAAQ,aAAc;AAGlD,YAAM,QAAQ;AAAA,QACb;AAAA,QACA;AAAA,QACA,aAAa;AAAA,MACd;AAGA,aACC,OAAO,eAAe,OAAO,WAAW,cACxC,OAAO,eAAe,OAAO,QAAQ,cACrC,OAAO,cACP;AAAA,IAEF;AAAA,IACA,CAAE,cAAc,cAAe;AAAA,EAChC;AAGA,QAAM,SAAS,cAAe;AAAA,IAC7B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc,cAAc;AAAA,IAC5B;AAAA,IACA;AAAA,EACD,CAAE;AAGF,QAAM,eAAe,MAClB,SAAS,UAAU,SAAS,cAAe,GAAI,IAC/C,GAAI,UAAW;AAElB,SAAO;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL;AAAA,IACA;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["import { __, sprintf } from '@wordpress/i18n';\nimport { safeDecodeURI } from '@wordpress/url';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { unlock } from '../../lock-unlock';\n\nconst { useRemoteUrlData, isHashLink, isRelativePath } = unlock(\n\tblockEditorPrivateApis\n);\n\n/**\n * Capitalize the first letter of a string.\n *\n * @param {string} str - The string to capitalize\n * @return {string} Capitalized string\n */\nfunction capitalize( str ) {\n\treturn str.charAt( 0 ).toUpperCase() + str.slice( 1 );\n}\n\n/**\n * Check if a URL points to the site homepage.\n * Handles protocol (http/https) and trailing slash variations.\n * Does not match subdomains unless they are the site URL.\n *\n * @param {string} url - The URL to check\n * @param {string} homeUrl - The WordPress site URL\n * @return {boolean} True if url is the homepage\n */\nexport function isHomepage( url, homeUrl ) {\n\tif ( url === '/' ) {\n\t\treturn true;\n\t}\n\tif ( ! url || ! homeUrl ) {\n\t\treturn false;\n\t}\n\ttry {\n\t\tconst urlParsed = new URL( url, homeUrl );\n\t\tconst homeParsed = new URL( homeUrl );\n\n\t\t// Same host, i.e. sub.homepage.com or homepage.com\n\t\tif ( urlParsed.hostname !== homeParsed.hostname ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Path must match site root (normalize trailing slash)\n\t\tconst urlPath = urlParsed.pathname.replace( /\\/$/, '' );\n\t\tconst homePath = homeParsed.pathname.replace( /\\/$/, '' );\n\n\t\treturn urlPath === homePath;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Compute display URL - strips site URL if internal, shows full URL if external.\n *\n * @param {Object} options - Parameters object\n * @param {string} options.linkUrl - The URL to process\n * @param {string} options.homeUrl - The WordPress site URL (required for internal/external detection)\n * @return {Object} Object with displayUrl and isExternal flag\n */\nexport function computeDisplayUrl( { linkUrl, homeUrl } = {} ) {\n\tif ( ! linkUrl ) {\n\t\treturn { displayUrl: '', isExternal: false };\n\t}\n\n\tlet displayUrl = safeDecodeURI( linkUrl );\n\tlet isExternal = false;\n\n\t// Check hash links and relative paths first - these are always internal\n\tif ( isRelativePath( linkUrl ) || isHashLink( linkUrl ) ) {\n\t\treturn { displayUrl, isExternal: false };\n\t}\n\n\t// Try to parse as a full URL to determine if it's actually external\n\t// This must happen before trusting the type attribute\n\ttry {\n\t\tconst parsedUrl = new URL( linkUrl );\n\t\t// Compare by host (not origin) so http/https to same site both count as internal\n\t\tconst siteHost = new URL( homeUrl ).host;\n\n\t\tif ( parsedUrl.host === siteHost ) {\n\t\t\t// Show only the pathname (and search/hash if present)\n\t\t\tlet path = parsedUrl.pathname + parsedUrl.search + parsedUrl.hash;\n\t\t\t// Remove trailing slash\n\t\t\tif ( path.endsWith( '/' ) && path.length > 1 ) {\n\t\t\t\tpath = path.slice( 0, -1 );\n\t\t\t}\n\t\t\tdisplayUrl = path;\n\t\t} else {\n\t\t\t// Different host - this is an external link\n\t\t\tisExternal = true;\n\t\t}\n\t} catch {\n\t\t// URL parsing failed - treat as external (e.g. no homeUrl, or URL without protocol)\n\t\tisExternal = true;\n\t}\n\n\treturn { displayUrl, isExternal };\n}\n\n/**\n * Compute badges for the link preview.\n *\n * @param {Object} options - Options object\n * @param {string} options.url - Link URL\n * @param {string} options.homeUrl - WordPress site URL (for homepage detection)\n * @param {string} options.type - Entity type (page, post, etc.)\n * @param {boolean} options.isExternal - Whether link is external\n * @param {string} options.entityStatus - Entity status (publish, draft, etc.)\n * @param {boolean} options.hasBinding - Whether link has entity binding\n * @param {boolean} options.isEntityAvailable - Whether bound entity exists\n * @return {Array} Array of badge objects with label and `@wordpress/ui`\n * `Badge` intent\n */\nexport function computeBadges( {\n\turl,\n\thomeUrl,\n\ttype,\n\tisExternal,\n\tentityStatus,\n\thasBinding,\n\tisEntityAvailable,\n} ) {\n\tconst badges = [];\n\t// Kind badge\n\tif ( url ) {\n\t\tif ( isExternal ) {\n\t\t\tbadges.push( {\n\t\t\t\tlabel: __( 'External link' ),\n\t\t\t\tintent: 'none',\n\t\t\t} );\n\t\t} else if ( isHashLink( url ) ) {\n\t\t\t// Hash links should be detected before type check\n\t\t\t// because they're not entity links even if type is set\n\t\t\tbadges.push( {\n\t\t\t\tlabel: __( 'Internal link' ),\n\t\t\t\tintent: 'none',\n\t\t\t} );\n\t\t} else if ( isHomepage( url, homeUrl ) ) {\n\t\t\tbadges.push( {\n\t\t\t\tlabel: __( 'Homepage' ),\n\t\t\t\tintent: 'none',\n\t\t\t} );\n\t\t} else if ( type && type !== 'custom' ) {\n\t\t\t// Show entity type badge (page, post, category, etc.)\n\t\t\t// but not 'custom' since that's just a manual link\n\t\t\tbadges.push( { label: capitalize( type ), intent: 'none' } );\n\t\t} else {\n\t\t\t// Internal link (not external, not hash, not entity)\n\t\t\tbadges.push( {\n\t\t\t\tlabel: __( 'Page' ),\n\t\t\t\tintent: 'none',\n\t\t\t} );\n\t\t}\n\t}\n\n\t// Status badge\n\tif ( hasBinding && ! isEntityAvailable ) {\n\t\tbadges.push( {\n\t\t\tlabel: sprintf(\n\t\t\t\t/* translators: %s is the entity type (e.g., \"page\", \"post\", \"category\") */\n\t\t\t\t__( 'Missing %s' ),\n\t\t\t\ttype\n\t\t\t),\n\t\t\tintent: 'high',\n\t\t} );\n\t} else if ( ! url ) {\n\t\tbadges.push( { label: __( 'No link selected' ), intent: 'high' } );\n\t} else if ( entityStatus ) {\n\t\tconst statusMap = {\n\t\t\tpublish: { label: __( 'Published' ), intent: 'stable' },\n\t\t\tfuture: { label: __( 'Scheduled' ), intent: 'informational' },\n\t\t\tdraft: { label: __( 'Draft' ), intent: 'low' },\n\t\t\tpending: { label: __( 'Pending' ), intent: 'low' },\n\t\t\tprivate: { label: __( 'Private' ), intent: 'informational' },\n\t\t\ttrash: { label: __( 'Trashed' ), intent: 'high' },\n\t\t};\n\t\tconst badge = statusMap[ entityStatus ];\n\t\tif ( badge ) {\n\t\t\tbadges.push( badge );\n\t\t}\n\t}\n\n\treturn badges;\n}\n\n/**\n * Returns an entity record's display title: the rendered title, \"(no title)\"\n * for an untitled entity, or the record's name.\n *\n * @param {Object} entityRecord The entity record.\n * @return {string|undefined} The display title.\n */\nfunction getEntityTitle( entityRecord ) {\n\tconst title = entityRecord?.title;\n\n\t// Some entity types use a plain string for the title.\n\tif ( typeof title === 'string' ) {\n\t\treturn title;\n\t}\n\n\t// Posts and pages expose `title` as a { raw, rendered } object.\n\tif ( title && 'rendered' in title ) {\n\t\treturn title.rendered || __( '(no title)' );\n\t}\n\n\treturn entityRecord?.name;\n}\n\n/**\n * Hook to compute link preview data for display.\n *\n * This hook takes raw link data and entity information and computes\n * presentation-ready preview data including formatted title, URL, and badges.\n *\n * @param {Object} options - Options object\n * @param {string} options.url - Link URL\n * @param {string} options.type - Entity type (page, post, etc.)\n * @param {Object} options.entityRecord - Entity record\n * @param {boolean} options.hasBinding - Whether link has entity binding\n * @param {boolean} options.isEntityAvailable - Whether bound entity exists\n * @return {Object} Preview data object with title, url, image, and badges\n */\nexport function useLinkPreview( {\n\turl,\n\tentityRecord,\n\ttype,\n\thasBinding,\n\tisEntityAvailable,\n} ) {\n\t// Get the WordPress homepage URL from settings\n\tconst homeUrl = useSelect( ( select ) => {\n\t\treturn select( coreDataStore ).getEntityRecord(\n\t\t\t'root',\n\t\t\t'__unstableBase'\n\t\t)?.home;\n\t}, [] );\n\n\tconst title = getEntityTitle( entityRecord );\n\n\t// Fetch rich URL data if we don't have a title. Internal links should have passed a title.\n\tconst { richData } = useRemoteUrlData( title ? null : url );\n\n\t// Compute display URL and external flag\n\tconst { displayUrl, isExternal } = computeDisplayUrl( {\n\t\tlinkUrl: url,\n\t\thomeUrl,\n\t} );\n\n\tconst image = useSelect(\n\t\t( select ) => {\n\t\t\t// Only fetch for post-type entities with featured media\n\t\t\tif ( ! entityRecord?.featured_media ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst { getEntityRecord } = select( coreDataStore );\n\n\t\t\t// Get the media entity to fetch the image URL\n\t\t\tconst media = getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\tentityRecord.featured_media\n\t\t\t);\n\n\t\t\t// Return the thumbnail or medium size URL, fallback to source_url\n\t\t\treturn (\n\t\t\t\tmedia?.media_details?.sizes?.thumbnail?.source_url ||\n\t\t\t\tmedia?.media_details?.sizes?.medium?.source_url ||\n\t\t\t\tmedia?.source_url ||\n\t\t\t\tnull\n\t\t\t);\n\t\t},\n\t\t[ entityRecord?.featured_media ]\n\t);\n\n\t// Compute badges\n\tconst badges = computeBadges( {\n\t\turl,\n\t\thomeUrl,\n\t\ttype,\n\t\tisExternal,\n\t\tentityStatus: entityRecord?.status,\n\t\thasBinding,\n\t\tisEntityAvailable,\n\t} );\n\n\t// Get display title - use provided title, fallback to rich data, or URL\n\tconst displayTitle = url\n\t\t? title || richData?.title || safeDecodeURI( url )\n\t\t: __( 'Add link' );\n\n\treturn {\n\t\ttitle: displayTitle,\n\t\turl: displayUrl,\n\t\timage,\n\t\tbadges,\n\t};\n}\n"],
5
+ "mappings": ";AAAA,SAAS,IAAI,eAAe;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,eAAe,8BAA8B;AACtD,SAAS,iBAAiB;AAC1B,SAAS,SAAS,qBAAqB;AACvC,SAAS,cAAc;AAEvB,IAAM,EAAE,kBAAkB,YAAY,eAAe,IAAI;AAAA,EACxD;AACD;AAQA,SAAS,WAAY,KAAM;AAC1B,SAAO,IAAI,OAAQ,CAAE,EAAE,YAAY,IAAI,IAAI,MAAO,CAAE;AACrD;AAWO,SAAS,WAAY,KAAK,SAAU;AAC1C,MAAK,QAAQ,KAAM;AAClB,WAAO;AAAA,EACR;AACA,MAAK,CAAE,OAAO,CAAE,SAAU;AACzB,WAAO;AAAA,EACR;AACA,MAAI;AACH,UAAM,YAAY,IAAI,IAAK,KAAK,OAAQ;AACxC,UAAM,aAAa,IAAI,IAAK,OAAQ;AAGpC,QAAK,UAAU,aAAa,WAAW,UAAW;AACjD,aAAO;AAAA,IACR;AAGA,UAAM,UAAU,UAAU,SAAS,QAAS,OAAO,EAAG;AACtD,UAAM,WAAW,WAAW,SAAS,QAAS,OAAO,EAAG;AAExD,WAAO,YAAY;AAAA,EACpB,QAAQ;AACP,WAAO;AAAA,EACR;AACD;AAUO,SAAS,kBAAmB,EAAE,SAAS,QAAQ,IAAI,CAAC,GAAI;AAC9D,MAAK,CAAE,SAAU;AAChB,WAAO,EAAE,YAAY,IAAI,YAAY,MAAM;AAAA,EAC5C;AAEA,MAAI,aAAa,cAA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A,IACD,GAAG;AAAA,EACJ,GAAG,CAAC,CAAE;AAEN,QAAM,QAAQ,eAAgB,YAAa;AAG3C,QAAM,EAAE,SAAS,IAAI,iBAAkB,QAAQ,OAAO,GAAI;AAG1D,QAAM,EAAE,YAAY,WAAW,IAAI,kBAAmB;AAAA,IACrD,SAAS;AAAA,IACT;AAAA,EACD,CAAE;AAEF,QAAM,QAAQ;AAAA,IACb,CAAE,WAAY;AAEb,UAAK,CAAE,cAAc,gBAAiB;AACrC,eAAO;AAAA,MACR;AAEA,YAAM,EAAE,gBAAgB,IAAI,OAAQ,aAAc;AAGlD,YAAM,QAAQ;AAAA,QACb;AAAA,QACA;AAAA,QACA,aAAa;AAAA,MACd;AAGA,aACC,OAAO,eAAe,OAAO,WAAW,cACxC,OAAO,eAAe,OAAO,QAAQ,cACrC,OAAO,cACP;AAAA,IAEF;AAAA,IACA,CAAE,cAAc,cAAe;AAAA,EAChC;AAGA,QAAM,SAAS,cAAe;AAAA,IAC7B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc,cAAc;AAAA,IAC5B;AAAA,IACA;AAAA,EACD,CAAE;AAGF,QAAM,eAAe,MAClB,SAAS,UAAU,SAAS,cAAe,GAAI,IAC/C,GAAI,UAAW;AAElB,SAAO;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL;AAAA,IACA;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -25,6 +25,13 @@
25
25
  "text": true
26
26
  }
27
27
  },
28
+ "shadow": true,
29
+ "__experimentalBorder": {
30
+ "color": true,
31
+ "radius": true,
32
+ "style": true,
33
+ "width": true
34
+ },
28
35
  "spacing": {
29
36
  "padding": true,
30
37
  "__experimentalDefaultControls": {
@@ -83,10 +83,16 @@
83
83
  "fontSize": true
84
84
  }
85
85
  },
86
+ "shadow": {
87
+ "__experimentalSkipSerialization": true
88
+ },
86
89
  "interactivity": {
87
90
  "clientNavigation": true
88
91
  }
89
92
  },
93
+ "selectors": {
94
+ "shadow": ".wp-block-navigation-submenu > .wp-block-navigation__submenu-container"
95
+ },
90
96
  "editorStyle": "wp-block-navigation-submenu-editor",
91
97
  "style": "wp-block-navigation-submenu"
92
98
  }
@@ -13,7 +13,8 @@ import {
13
13
  useBlockProps,
14
14
  useBlockEditingMode,
15
15
  store as blockEditorStore,
16
- getColorClassName
16
+ getColorClassName,
17
+ __experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles
17
18
  } from "@wordpress/block-editor";
18
19
  import { isURL, prependHTTP } from "@wordpress/url";
19
20
  import { useState, useEffect, useRef } from "@wordpress/element";
@@ -181,8 +182,16 @@ function NavigationSubmenuEdit({
181
182
  const allowedBlocks = parentCount >= maxNestingLevel ? ALLOWED_BLOCKS.filter(
182
183
  (blockName) => blockName !== "core/navigation-submenu"
183
184
  ) : ALLOWED_BLOCKS;
185
+ const shadowProps = getShadowClassesAndStyles(attributes);
184
186
  const navigationChildBlockProps = getNavigationChildBlockProps(innerBlocksColors);
185
- const innerBlocksProps = useInnerBlocksProps(navigationChildBlockProps, {
187
+ const submenuBlockProps = {
188
+ ...navigationChildBlockProps,
189
+ style: {
190
+ ...navigationChildBlockProps.style,
191
+ ...shadowProps.style
192
+ }
193
+ };
194
+ const innerBlocksProps = useInnerBlocksProps(submenuBlockProps, {
186
195
  allowedBlocks,
187
196
  defaultBlock: DEFAULT_BLOCK,
188
197
  directInsert: true,