@wordpress/block-editor 12.20.0 → 12.22.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 (558) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/block-actions/index.js +47 -36
  3. package/build/components/block-actions/index.js.map +1 -1
  4. package/build/components/block-bindings-toolbar-indicator/index.js +25 -0
  5. package/build/components/block-bindings-toolbar-indicator/index.js.map +1 -0
  6. package/build/components/block-edit/context.js +2 -1
  7. package/build/components/block-edit/context.js.map +1 -1
  8. package/build/components/block-edit/index.js +8 -3
  9. package/build/components/block-edit/index.js.map +1 -1
  10. package/build/components/block-heading-level-dropdown/index.js +5 -5
  11. package/build/components/block-heading-level-dropdown/index.js.map +1 -1
  12. package/build/components/block-heading-level-dropdown/index.native.js +5 -4
  13. package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
  14. package/build/components/block-inspector/index.js +5 -4
  15. package/build/components/block-inspector/index.js.map +1 -1
  16. package/build/components/block-list/block-crash-boundary.native.js +49 -0
  17. package/build/components/block-list/block-crash-boundary.native.js.map +1 -0
  18. package/build/components/block-list/block-crash-warning.native.js +24 -0
  19. package/build/components/block-list/block-crash-warning.native.js.map +1 -0
  20. package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
  21. package/build/components/block-list/block-list-item.native.js +1 -1
  22. package/build/components/block-list/block-list-item.native.js.map +1 -1
  23. package/build/components/block-list/block-outline.native.js +23 -7
  24. package/build/components/block-list/block-outline.native.js.map +1 -1
  25. package/build/components/block-list/block-selection-button.native.js.map +1 -1
  26. package/build/components/block-list/block.native.js +7 -5
  27. package/build/components/block-list/block.native.js.map +1 -1
  28. package/build/components/block-list/use-block-props/index.js +8 -1
  29. package/build/components/block-list/use-block-props/index.js.map +1 -1
  30. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
  31. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  32. package/build/components/block-mover/index.native.js.map +1 -1
  33. package/build/components/block-popover/cover.js +68 -0
  34. package/build/components/block-popover/cover.js.map +1 -0
  35. package/build/components/block-popover/drop-zone.js +2 -3
  36. package/build/components/block-popover/drop-zone.js.map +1 -1
  37. package/build/components/block-popover/index.js +1 -19
  38. package/build/components/block-popover/index.js.map +1 -1
  39. package/build/components/block-preview/index.js +2 -1
  40. package/build/components/block-preview/index.js.map +1 -1
  41. package/build/components/block-removal-warning-modal/index.js +2 -4
  42. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  43. package/build/components/block-rename/modal.js.map +1 -1
  44. package/build/components/block-settings/container.native.js +2 -1
  45. package/build/components/block-settings/container.native.js.map +1 -1
  46. package/build/components/block-settings-menu/block-settings-dropdown.js +41 -39
  47. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  48. package/build/components/block-settings-menu-controls/index.js +1 -3
  49. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  50. package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  51. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  52. package/build/components/block-toolbar/index.js +24 -11
  53. package/build/components/block-toolbar/index.js.map +1 -1
  54. package/build/components/block-toolbar/shuffle.js +89 -0
  55. package/build/components/block-toolbar/shuffle.js.map +1 -0
  56. package/build/components/block-toolbar/use-has-block-toolbar.js +43 -0
  57. package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
  58. package/build/components/block-tools/block-selection-button.js +5 -1
  59. package/build/components/block-tools/block-selection-button.js.map +1 -1
  60. package/build/components/block-tools/empty-block-inserter.js +2 -5
  61. package/build/components/block-tools/empty-block-inserter.js.map +1 -1
  62. package/build/components/block-tools/index.js +9 -26
  63. package/build/components/block-tools/index.js.map +1 -1
  64. package/build/components/block-tools/use-show-block-tools.js +60 -0
  65. package/build/components/block-tools/use-show-block-tools.js.map +1 -0
  66. package/build/components/caption/index.native.js.map +1 -1
  67. package/build/components/child-layout-control/index.js +108 -11
  68. package/build/components/child-layout-control/index.js.map +1 -1
  69. package/build/components/color-palette/control.js.map +1 -1
  70. package/build/components/colors-gradients/control.js +1 -1
  71. package/build/components/colors-gradients/control.js.map +1 -1
  72. package/build/components/convert-to-group-buttons/toolbar.js +11 -0
  73. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
  74. package/build/components/global-styles/border-panel.js +21 -8
  75. package/build/components/global-styles/border-panel.js.map +1 -1
  76. package/build/components/global-styles/color-panel.js +1 -1
  77. package/build/components/global-styles/color-panel.js.map +1 -1
  78. package/build/components/global-styles/dimensions-panel.js +8 -33
  79. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  80. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  81. package/build/components/global-styles/index.js +6 -0
  82. package/build/components/global-styles/index.js.map +1 -1
  83. package/build/components/global-styles/shadow-panel-components.js +80 -23
  84. package/build/components/global-styles/shadow-panel-components.js.map +1 -1
  85. package/build/components/global-styles/typography-utils.js +7 -5
  86. package/build/components/global-styles/typography-utils.js.map +1 -1
  87. package/build/components/global-styles/use-global-styles-output.js +16 -16
  88. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  89. package/build/components/global-styles/utils.js +2 -4
  90. package/build/components/global-styles/utils.js.map +1 -1
  91. package/build/components/grid-visualizer/grid-item-resizer.js +77 -0
  92. package/build/components/grid-visualizer/grid-item-resizer.js.map +1 -0
  93. package/build/components/grid-visualizer/grid-visualizer.js +81 -0
  94. package/build/components/grid-visualizer/grid-visualizer.js.map +1 -0
  95. package/build/components/grid-visualizer/index.js +20 -0
  96. package/build/components/grid-visualizer/index.js.map +1 -0
  97. package/build/components/grid-visualizer/utils.js +10 -0
  98. package/build/components/grid-visualizer/utils.js.map +1 -0
  99. package/build/components/iframe/index.js +66 -17
  100. package/build/components/iframe/index.js.map +1 -1
  101. package/build/components/index.native.js +7 -0
  102. package/build/components/index.native.js.map +1 -1
  103. package/build/components/inner-blocks/use-nested-settings-update.js +8 -2
  104. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  105. package/build/components/inserter/block-patterns-explorer/index.js +3 -6
  106. package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
  107. package/build/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
  108. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  109. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  110. package/build/components/inserter/menu.native.js.map +1 -1
  111. package/build/components/inserter/mobile-tab-navigation.js +2 -2
  112. package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
  113. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  114. package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js +36 -0
  115. package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
  116. package/build/components/inspector-controls-tabs/index.js +1 -1
  117. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  118. package/build/components/inspector-controls-tabs/styles-tab.js +1 -1
  119. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  120. package/build/components/link-control/link-preview.js +4 -1
  121. package/build/components/link-control/link-preview.js.map +1 -1
  122. package/build/components/link-control/search-input.js.map +1 -1
  123. package/build/components/list-view/block-select-button.js +0 -2
  124. package/build/components/list-view/block-select-button.js.map +1 -1
  125. package/build/components/list-view/block.js +4 -11
  126. package/build/components/list-view/block.js.map +1 -1
  127. package/build/components/list-view/branch.js.map +1 -1
  128. package/build/components/list-view/drop-indicator.js.map +1 -1
  129. package/build/components/list-view/index.js.map +1 -1
  130. package/build/components/list-view/use-clipboard-handler.js +2 -1
  131. package/build/components/list-view/use-clipboard-handler.js.map +1 -1
  132. package/build/components/list-view/utils.js +5 -3
  133. package/build/components/list-view/utils.js.map +1 -1
  134. package/build/components/panel-color-settings/index.js.map +1 -1
  135. package/build/components/provider/index.js.map +1 -1
  136. package/build/components/resizable-box-popover/index.js +3 -5
  137. package/build/components/resizable-box-popover/index.js.map +1 -1
  138. package/build/components/responsive-block-control/index.js +1 -1
  139. package/build/components/responsive-block-control/index.js.map +1 -1
  140. package/build/components/rich-text/index.js +46 -26
  141. package/build/components/rich-text/index.js.map +1 -1
  142. package/build/components/rich-text/use-enter.js +3 -0
  143. package/build/components/rich-text/use-enter.js.map +1 -1
  144. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  145. package/build/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  146. package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
  147. package/build/components/url-popover/index.js +3 -3
  148. package/build/components/url-popover/index.js.map +1 -1
  149. package/build/components/use-moving-animation/index.js +4 -0
  150. package/build/components/use-moving-animation/index.js.map +1 -1
  151. package/build/components/warning/index.native.js +9 -4
  152. package/build/components/warning/index.native.js.map +1 -1
  153. package/build/components/writing-flow/use-clipboard-handler.js +2 -1
  154. package/build/components/writing-flow/use-clipboard-handler.js.map +1 -1
  155. package/build/components/writing-flow/utils.js +23 -6
  156. package/build/components/writing-flow/utils.js.map +1 -1
  157. package/build/hooks/anchor.js +7 -8
  158. package/build/hooks/anchor.js.map +1 -1
  159. package/build/hooks/background.js +39 -2
  160. package/build/hooks/background.js.map +1 -1
  161. package/build/hooks/block-hooks.js +34 -8
  162. package/build/hooks/block-hooks.js.map +1 -1
  163. package/build/hooks/border.js +6 -4
  164. package/build/hooks/border.js.map +1 -1
  165. package/build/hooks/dimensions.js +3 -4
  166. package/build/hooks/dimensions.js.map +1 -1
  167. package/build/hooks/font-size.js +6 -7
  168. package/build/hooks/font-size.js.map +1 -1
  169. package/build/hooks/index.js +3 -2
  170. package/build/hooks/index.js.map +1 -1
  171. package/build/hooks/layout-child.js +67 -6
  172. package/build/hooks/layout-child.js.map +1 -1
  173. package/build/hooks/layout.js +32 -14
  174. package/build/hooks/layout.js.map +1 -1
  175. package/build/hooks/line-height.js.map +1 -1
  176. package/build/hooks/position.js +1 -1
  177. package/build/hooks/position.js.map +1 -1
  178. package/build/hooks/spacing-visualizer.js +115 -0
  179. package/build/hooks/spacing-visualizer.js.map +1 -0
  180. package/build/hooks/use-bindings-attributes.js +171 -48
  181. package/build/hooks/use-bindings-attributes.js.map +1 -1
  182. package/build/hooks/use-typography-props.js +1 -2
  183. package/build/hooks/use-typography-props.js.map +1 -1
  184. package/build/layouts/grid.js +6 -2
  185. package/build/layouts/grid.js.map +1 -1
  186. package/build/private-apis.js +7 -3
  187. package/build/private-apis.js.map +1 -1
  188. package/build/private-apis.native.js +3 -1
  189. package/build/private-apis.native.js.map +1 -1
  190. package/build/store/actions.js +42 -12
  191. package/build/store/actions.js.map +1 -1
  192. package/build/store/private-actions.js +29 -55
  193. package/build/store/private-actions.js.map +1 -1
  194. package/build/store/private-selectors.js +0 -8
  195. package/build/store/private-selectors.js.map +1 -1
  196. package/build/store/reducer.js +34 -46
  197. package/build/store/reducer.js.map +1 -1
  198. package/build/store/selectors.js +27 -15
  199. package/build/store/selectors.js.map +1 -1
  200. package/build-module/components/block-actions/index.js +47 -36
  201. package/build-module/components/block-actions/index.js.map +1 -1
  202. package/build-module/components/block-bindings-toolbar-indicator/index.js +18 -0
  203. package/build-module/components/block-bindings-toolbar-indicator/index.js.map +1 -0
  204. package/build-module/components/block-edit/context.js +1 -0
  205. package/build-module/components/block-edit/context.js.map +1 -1
  206. package/build-module/components/block-edit/index.js +9 -4
  207. package/build-module/components/block-edit/index.js.map +1 -1
  208. package/build-module/components/block-heading-level-dropdown/index.js +5 -5
  209. package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
  210. package/build-module/components/block-heading-level-dropdown/index.native.js +5 -4
  211. package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
  212. package/build-module/components/block-inspector/index.js +6 -5
  213. package/build-module/components/block-inspector/index.js.map +1 -1
  214. package/build-module/components/block-list/block-crash-boundary.native.js +42 -0
  215. package/build-module/components/block-list/block-crash-boundary.native.js.map +1 -0
  216. package/build-module/components/block-list/block-crash-warning.native.js +15 -0
  217. package/build-module/components/block-list/block-crash-warning.native.js.map +1 -0
  218. package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
  219. package/build-module/components/block-list/block-list-item.native.js +1 -1
  220. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  221. package/build-module/components/block-list/block-outline.native.js +23 -7
  222. package/build-module/components/block-list/block-outline.native.js.map +1 -1
  223. package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
  224. package/build-module/components/block-list/block.native.js +7 -5
  225. package/build-module/components/block-list/block.native.js.map +1 -1
  226. package/build-module/components/block-list/use-block-props/index.js +9 -2
  227. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  228. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
  229. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  230. package/build-module/components/block-mover/index.native.js.map +1 -1
  231. package/build-module/components/block-popover/cover.js +60 -0
  232. package/build-module/components/block-popover/cover.js.map +1 -0
  233. package/build-module/components/block-popover/drop-zone.js +2 -3
  234. package/build-module/components/block-popover/drop-zone.js.map +1 -1
  235. package/build-module/components/block-popover/index.js +1 -19
  236. package/build-module/components/block-popover/index.js.map +1 -1
  237. package/build-module/components/block-preview/index.js +2 -1
  238. package/build-module/components/block-preview/index.js.map +1 -1
  239. package/build-module/components/block-removal-warning-modal/index.js +3 -5
  240. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  241. package/build-module/components/block-rename/modal.js.map +1 -1
  242. package/build-module/components/block-settings/container.native.js +3 -2
  243. package/build-module/components/block-settings/container.native.js.map +1 -1
  244. package/build-module/components/block-settings-menu/block-settings-dropdown.js +42 -40
  245. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  246. package/build-module/components/block-settings-menu-controls/index.js +1 -3
  247. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  248. package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  249. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  250. package/build-module/components/block-toolbar/index.js +24 -12
  251. package/build-module/components/block-toolbar/index.js.map +1 -1
  252. package/build-module/components/block-toolbar/shuffle.js +82 -0
  253. package/build-module/components/block-toolbar/shuffle.js.map +1 -0
  254. package/build-module/components/block-toolbar/use-has-block-toolbar.js +36 -0
  255. package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
  256. package/build-module/components/block-tools/block-selection-button.js +5 -1
  257. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  258. package/build-module/components/block-tools/empty-block-inserter.js +2 -5
  259. package/build-module/components/block-tools/empty-block-inserter.js.map +1 -1
  260. package/build-module/components/block-tools/index.js +9 -26
  261. package/build-module/components/block-tools/index.js.map +1 -1
  262. package/build-module/components/block-tools/use-show-block-tools.js +54 -0
  263. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -0
  264. package/build-module/components/caption/index.native.js.map +1 -1
  265. package/build-module/components/child-layout-control/index.js +109 -12
  266. package/build-module/components/child-layout-control/index.js.map +1 -1
  267. package/build-module/components/color-palette/control.js.map +1 -1
  268. package/build-module/components/colors-gradients/control.js +1 -1
  269. package/build-module/components/colors-gradients/control.js.map +1 -1
  270. package/build-module/components/convert-to-group-buttons/toolbar.js +12 -1
  271. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
  272. package/build-module/components/global-styles/border-panel.js +22 -10
  273. package/build-module/components/global-styles/border-panel.js.map +1 -1
  274. package/build-module/components/global-styles/color-panel.js +1 -1
  275. package/build-module/components/global-styles/color-panel.js.map +1 -1
  276. package/build-module/components/global-styles/dimensions-panel.js +9 -34
  277. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  278. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  279. package/build-module/components/global-styles/index.js +1 -1
  280. package/build-module/components/global-styles/index.js.map +1 -1
  281. package/build-module/components/global-styles/shadow-panel-components.js +82 -24
  282. package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
  283. package/build-module/components/global-styles/typography-utils.js +7 -5
  284. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  285. package/build-module/components/global-styles/use-global-styles-output.js +17 -17
  286. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  287. package/build-module/components/global-styles/utils.js +2 -4
  288. package/build-module/components/global-styles/utils.js.map +1 -1
  289. package/build-module/components/grid-visualizer/grid-item-resizer.js +69 -0
  290. package/build-module/components/grid-visualizer/grid-item-resizer.js.map +1 -0
  291. package/build-module/components/grid-visualizer/grid-visualizer.js +73 -0
  292. package/build-module/components/grid-visualizer/grid-visualizer.js.map +1 -0
  293. package/build-module/components/grid-visualizer/index.js +3 -0
  294. package/build-module/components/grid-visualizer/index.js.map +1 -0
  295. package/build-module/components/grid-visualizer/utils.js +4 -0
  296. package/build-module/components/grid-visualizer/utils.js.map +1 -0
  297. package/build-module/components/iframe/index.js +66 -17
  298. package/build-module/components/iframe/index.js.map +1 -1
  299. package/build-module/components/index.native.js +1 -1
  300. package/build-module/components/index.native.js.map +1 -1
  301. package/build-module/components/inner-blocks/use-nested-settings-update.js +8 -2
  302. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  303. package/build-module/components/inserter/block-patterns-explorer/index.js +3 -6
  304. package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
  305. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
  306. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  307. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  308. package/build-module/components/inserter/menu.native.js.map +1 -1
  309. package/build-module/components/inserter/mobile-tab-navigation.js +2 -2
  310. package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
  311. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  312. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js +28 -0
  313. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
  314. package/build-module/components/inspector-controls-tabs/index.js +1 -1
  315. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  316. package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -2
  317. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  318. package/build-module/components/link-control/link-preview.js +5 -2
  319. package/build-module/components/link-control/link-preview.js.map +1 -1
  320. package/build-module/components/link-control/search-input.js.map +1 -1
  321. package/build-module/components/list-view/block-select-button.js +0 -2
  322. package/build-module/components/list-view/block-select-button.js.map +1 -1
  323. package/build-module/components/list-view/block.js +6 -13
  324. package/build-module/components/list-view/block.js.map +1 -1
  325. package/build-module/components/list-view/branch.js.map +1 -1
  326. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  327. package/build-module/components/list-view/index.js.map +1 -1
  328. package/build-module/components/list-view/use-clipboard-handler.js +3 -2
  329. package/build-module/components/list-view/use-clipboard-handler.js.map +1 -1
  330. package/build-module/components/list-view/utils.js +2 -1
  331. package/build-module/components/list-view/utils.js.map +1 -1
  332. package/build-module/components/panel-color-settings/index.js.map +1 -1
  333. package/build-module/components/provider/index.js.map +1 -1
  334. package/build-module/components/resizable-box-popover/index.js +3 -5
  335. package/build-module/components/resizable-box-popover/index.js.map +1 -1
  336. package/build-module/components/responsive-block-control/index.js +1 -1
  337. package/build-module/components/responsive-block-control/index.js.map +1 -1
  338. package/build-module/components/rich-text/index.js +47 -28
  339. package/build-module/components/rich-text/index.js.map +1 -1
  340. package/build-module/components/rich-text/use-enter.js +3 -0
  341. package/build-module/components/rich-text/use-enter.js.map +1 -1
  342. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  343. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  344. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
  345. package/build-module/components/url-popover/index.js +3 -3
  346. package/build-module/components/url-popover/index.js.map +1 -1
  347. package/build-module/components/use-moving-animation/index.js +4 -0
  348. package/build-module/components/use-moving-animation/index.js.map +1 -1
  349. package/build-module/components/warning/index.native.js +9 -4
  350. package/build-module/components/warning/index.native.js.map +1 -1
  351. package/build-module/components/writing-flow/use-clipboard-handler.js +3 -2
  352. package/build-module/components/writing-flow/use-clipboard-handler.js.map +1 -1
  353. package/build-module/components/writing-flow/utils.js +22 -7
  354. package/build-module/components/writing-flow/utils.js.map +1 -1
  355. package/build-module/hooks/anchor.js +8 -9
  356. package/build-module/hooks/anchor.js.map +1 -1
  357. package/build-module/hooks/background.js +38 -1
  358. package/build-module/hooks/background.js.map +1 -1
  359. package/build-module/hooks/block-hooks.js +34 -8
  360. package/build-module/hooks/block-hooks.js.map +1 -1
  361. package/build-module/hooks/border.js +7 -5
  362. package/build-module/hooks/border.js.map +1 -1
  363. package/build-module/hooks/dimensions.js +1 -2
  364. package/build-module/hooks/dimensions.js.map +1 -1
  365. package/build-module/hooks/font-size.js +7 -8
  366. package/build-module/hooks/font-size.js.map +1 -1
  367. package/build-module/hooks/index.js +3 -2
  368. package/build-module/hooks/index.js.map +1 -1
  369. package/build-module/hooks/layout-child.js +67 -6
  370. package/build-module/hooks/layout-child.js.map +1 -1
  371. package/build-module/hooks/layout.js +32 -14
  372. package/build-module/hooks/layout.js.map +1 -1
  373. package/build-module/hooks/line-height.js.map +1 -1
  374. package/build-module/hooks/position.js +1 -1
  375. package/build-module/hooks/position.js.map +1 -1
  376. package/build-module/hooks/spacing-visualizer.js +106 -0
  377. package/build-module/hooks/spacing-visualizer.js.map +1 -0
  378. package/build-module/hooks/use-bindings-attributes.js +172 -49
  379. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  380. package/build-module/hooks/use-typography-props.js +2 -3
  381. package/build-module/hooks/use-typography-props.js.map +1 -1
  382. package/build-module/layouts/grid.js +6 -2
  383. package/build-module/layouts/grid.js.map +1 -1
  384. package/build-module/private-apis.js +7 -3
  385. package/build-module/private-apis.js.map +1 -1
  386. package/build-module/private-apis.native.js +3 -1
  387. package/build-module/private-apis.native.js.map +1 -1
  388. package/build-module/store/actions.js +42 -12
  389. package/build-module/store/actions.js.map +1 -1
  390. package/build-module/store/private-actions.js +29 -54
  391. package/build-module/store/private-actions.js.map +1 -1
  392. package/build-module/store/private-selectors.js +0 -6
  393. package/build-module/store/private-selectors.js.map +1 -1
  394. package/build-module/store/reducer.js +34 -46
  395. package/build-module/store/reducer.js.map +1 -1
  396. package/build-module/store/selectors.js +23 -13
  397. package/build-module/store/selectors.js.map +1 -1
  398. package/build-style/content-rtl.css +22 -2
  399. package/build-style/content.css +22 -2
  400. package/build-style/default-editor-styles-rtl.css +1 -0
  401. package/build-style/default-editor-styles.css +1 -0
  402. package/build-style/style-rtl.css +106 -27
  403. package/build-style/style.css +106 -27
  404. package/package.json +31 -31
  405. package/src/components/block-actions/index.js +59 -55
  406. package/src/components/block-bindings-toolbar-indicator/index.js +20 -0
  407. package/src/components/block-bindings-toolbar-indicator/style.scss +16 -0
  408. package/src/components/block-draggable/test/index.native.js +2 -2
  409. package/src/components/block-edit/context.js +1 -0
  410. package/src/components/block-edit/index.js +5 -1
  411. package/src/components/block-heading-level-dropdown/README.md +5 -5
  412. package/src/components/block-heading-level-dropdown/index.js +5 -5
  413. package/src/components/block-heading-level-dropdown/index.native.js +5 -4
  414. package/src/components/block-inspector/index.js +7 -5
  415. package/src/components/block-list/block-crash-boundary.native.js +43 -0
  416. package/src/components/block-list/block-crash-warning.native.js +19 -0
  417. package/src/components/block-list/block-invalid-warning.native.js +1 -1
  418. package/src/components/block-list/block-list-item.native.js +1 -1
  419. package/src/components/block-list/block-outline.native.js +36 -21
  420. package/src/components/block-list/block-selection-button.native.js +1 -3
  421. package/src/components/block-list/block.native.js +14 -10
  422. package/src/components/block-list/content.scss +21 -1
  423. package/src/components/block-list/test/block-outline.native.js +255 -0
  424. package/src/components/block-list/use-block-props/index.js +12 -2
  425. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -7
  426. package/src/components/block-mover/index.native.js +1 -1
  427. package/src/components/block-popover/cover.js +63 -0
  428. package/src/components/block-popover/drop-zone.js +3 -4
  429. package/src/components/block-popover/index.js +1 -28
  430. package/src/components/block-preview/index.js +3 -1
  431. package/src/components/block-removal-warning-modal/index.js +5 -19
  432. package/src/components/block-rename/modal.js +1 -1
  433. package/src/components/block-settings/container.native.js +5 -1
  434. package/src/components/block-settings-menu/block-settings-dropdown.js +53 -65
  435. package/src/components/block-settings-menu-controls/README.md +0 -9
  436. package/src/components/block-settings-menu-controls/index.js +1 -6
  437. package/src/components/block-switcher/block-transformations-menu.native.js +1 -1
  438. package/src/components/block-toolbar/block-toolbar-menu.native.js +2 -2
  439. package/src/components/block-toolbar/index.js +22 -16
  440. package/src/components/block-toolbar/shuffle.js +93 -0
  441. package/src/components/block-toolbar/test/index.native.js +1 -7
  442. package/src/components/block-toolbar/use-has-block-toolbar.js +49 -0
  443. package/src/components/block-tools/block-selection-button.js +4 -0
  444. package/src/components/block-tools/empty-block-inserter.js +3 -6
  445. package/src/components/block-tools/index.js +13 -36
  446. package/src/components/block-tools/use-show-block-tools.js +73 -0
  447. package/src/components/caption/index.native.js +1 -1
  448. package/src/components/child-layout-control/index.js +148 -36
  449. package/src/components/color-palette/control.js +1 -1
  450. package/src/components/colors-gradients/control.js +1 -1
  451. package/src/components/colors-gradients/test/control.js +2 -2
  452. package/src/components/contrast-checker/test/index.js +10 -10
  453. package/src/components/convert-to-group-buttons/toolbar.js +13 -1
  454. package/src/components/default-block-appender/content.scss +5 -2
  455. package/src/components/global-styles/border-panel.js +35 -24
  456. package/src/components/global-styles/color-panel.js +1 -1
  457. package/src/components/global-styles/dimensions-panel.js +9 -34
  458. package/src/components/global-styles/image-settings-panel.js +1 -1
  459. package/src/components/global-styles/index.js +5 -1
  460. package/src/components/global-styles/shadow-panel-components.js +92 -23
  461. package/src/components/global-styles/style.scss +33 -10
  462. package/src/components/global-styles/test/typography-utils.js +231 -81
  463. package/src/components/global-styles/test/use-global-styles-output.js +31 -0
  464. package/src/components/global-styles/typography-utils.js +10 -7
  465. package/src/components/global-styles/use-global-styles-output.js +17 -17
  466. package/src/components/global-styles/utils.js +2 -26
  467. package/src/components/grid-visualizer/grid-item-resizer.js +100 -0
  468. package/src/components/grid-visualizer/grid-visualizer.js +81 -0
  469. package/src/components/grid-visualizer/index.js +2 -0
  470. package/src/components/grid-visualizer/style.scss +33 -0
  471. package/src/components/grid-visualizer/utils.js +5 -0
  472. package/src/components/iframe/index.js +89 -26
  473. package/src/components/index.native.js +1 -0
  474. package/src/components/inner-blocks/use-nested-settings-update.js +12 -2
  475. package/src/components/inserter/block-patterns-explorer/index.js +2 -9
  476. package/src/components/inserter/block-patterns-explorer/pattern-list.js +7 -1
  477. package/src/components/inserter/media-tab/media-preview.js +1 -1
  478. package/src/components/inserter/menu.native.js +3 -3
  479. package/src/components/inserter/mobile-tab-navigation.js +2 -2
  480. package/src/components/inserter/style.scss +10 -0
  481. package/src/components/inspector-controls/block-support-tools-panel.js +2 -2
  482. package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +31 -0
  483. package/src/components/inspector-controls-tabs/index.js +1 -1
  484. package/src/components/inspector-controls-tabs/styles-tab.js +2 -2
  485. package/src/components/line-height-control/test/index.js +1 -1
  486. package/src/components/link-control/link-preview.js +9 -2
  487. package/src/components/link-control/search-input.js +1 -1
  488. package/src/components/link-control/style.scss +9 -5
  489. package/src/components/list-view/block-select-button.js +0 -2
  490. package/src/components/list-view/block.js +12 -21
  491. package/src/components/list-view/branch.js +1 -1
  492. package/src/components/list-view/drop-indicator.js +1 -1
  493. package/src/components/list-view/index.js +1 -1
  494. package/src/components/list-view/style.scss +34 -16
  495. package/src/components/list-view/use-clipboard-handler.js +3 -2
  496. package/src/components/list-view/utils.js +4 -1
  497. package/src/components/panel-color-settings/index.js +1 -1
  498. package/src/components/panel-color-settings/test/index.js +3 -3
  499. package/src/components/provider/index.js +1 -4
  500. package/src/components/resizable-box-popover/index.js +4 -6
  501. package/src/components/responsive-block-control/README.md +4 -4
  502. package/src/components/responsive-block-control/index.js +1 -1
  503. package/src/components/responsive-block-control/test/index.js +5 -5
  504. package/src/components/rich-text/README.md +6 -0
  505. package/src/components/rich-text/index.js +76 -53
  506. package/src/components/rich-text/use-enter.js +4 -0
  507. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
  508. package/src/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  509. package/src/components/url-popover/index.js +5 -5
  510. package/src/components/url-popover/style.scss +1 -0
  511. package/src/components/use-moving-animation/index.js +1 -0
  512. package/src/components/warning/index.native.js +19 -15
  513. package/src/components/writing-flow/use-clipboard-handler.js +3 -2
  514. package/src/components/writing-flow/utils.js +31 -16
  515. package/src/hooks/anchor.js +41 -61
  516. package/src/hooks/background.js +49 -4
  517. package/src/hooks/block-hooks.js +47 -9
  518. package/src/hooks/block-hooks.scss +6 -0
  519. package/src/hooks/border.js +16 -4
  520. package/src/hooks/dimensions.js +1 -2
  521. package/src/hooks/font-size.js +7 -12
  522. package/src/hooks/index.js +3 -0
  523. package/src/hooks/layout-child.js +82 -8
  524. package/src/hooks/layout.js +34 -19
  525. package/src/hooks/line-height.js +1 -1
  526. package/src/hooks/position.js +1 -1
  527. package/src/hooks/spacing-visualizer.js +126 -0
  528. package/src/hooks/{padding.scss → spacing.scss} +1 -1
  529. package/src/hooks/test/__snapshots__/anchor.native.js.snap +7 -0
  530. package/src/hooks/test/anchor.native.js +32 -0
  531. package/src/hooks/use-bindings-attributes.js +215 -65
  532. package/src/hooks/use-typography-props.js +2 -8
  533. package/src/layouts/grid.js +8 -3
  534. package/src/private-apis.js +6 -2
  535. package/src/private-apis.native.js +2 -0
  536. package/src/store/actions.js +56 -18
  537. package/src/store/private-actions.js +34 -79
  538. package/src/store/private-selectors.js +0 -8
  539. package/src/store/reducer.js +43 -64
  540. package/src/store/selectors.js +41 -46
  541. package/src/store/test/actions.js +0 -4
  542. package/src/style.scss +3 -1
  543. package/tsconfig.json +1 -0
  544. package/build/hooks/margin.js +0 -86
  545. package/build/hooks/margin.js.map +0 -1
  546. package/build/hooks/padding.js +0 -78
  547. package/build/hooks/padding.js.map +0 -1
  548. package/build/utils/use-can-block-toolbar-be-focused.js +0 -46
  549. package/build/utils/use-can-block-toolbar-be-focused.js.map +0 -1
  550. package/build-module/hooks/margin.js +0 -78
  551. package/build-module/hooks/margin.js.map +0 -1
  552. package/build-module/hooks/padding.js +0 -70
  553. package/build-module/hooks/padding.js.map +0 -1
  554. package/build-module/utils/use-can-block-toolbar-be-focused.js +0 -40
  555. package/build-module/utils/use-can-block-toolbar-be-focused.js.map +0 -1
  556. package/src/hooks/margin.js +0 -91
  557. package/src/hooks/padding.js +0 -82
  558. package/src/utils/use-can-block-toolbar-be-focused.js +0 -48
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.BACKGROUND_SUPPORT_KEY = void 0;
8
8
  exports.BackgroundImagePanel = BackgroundImagePanel;
9
- exports.coordsToBackgroundPosition = exports.backgroundPositionToCoords = exports.IMAGE_BACKGROUND_TYPE = void 0;
9
+ exports.default = exports.coordsToBackgroundPosition = exports.backgroundPositionToCoords = exports.IMAGE_BACKGROUND_TYPE = void 0;
10
10
  exports.getBackgroundImageClasses = getBackgroundImageClasses;
11
11
  exports.hasBackgroundImageValue = hasBackgroundImageValue;
12
12
  exports.hasBackgroundSizeValue = hasBackgroundSizeValue;
@@ -88,6 +88,38 @@ function hasBackgroundSupport(blockName, feature = 'any') {
88
88
  }
89
89
  return !!support?.[feature];
90
90
  }
91
+ function useBlockProps({
92
+ name,
93
+ style
94
+ }) {
95
+ if (!hasBackgroundSupport(name) || !style?.background?.backgroundImage) {
96
+ return;
97
+ }
98
+ const backgroundImage = style?.background?.backgroundImage;
99
+ let props;
100
+
101
+ // Set block background defaults.
102
+ if (backgroundImage?.source === 'file' && !!backgroundImage?.url) {
103
+ if (!style?.background?.backgroundSize) {
104
+ props = {
105
+ style: {
106
+ backgroundSize: 'cover'
107
+ }
108
+ };
109
+ }
110
+ if ('contain' === style?.background?.backgroundSize && !style?.background?.backgroundPosition) {
111
+ props = {
112
+ style: {
113
+ backgroundPosition: 'center'
114
+ }
115
+ };
116
+ }
117
+ }
118
+ if (!props) {
119
+ return;
120
+ }
121
+ return props;
122
+ }
91
123
 
92
124
  /**
93
125
  * Resets the background image block support attributes. This can be used when disabling
@@ -356,7 +388,7 @@ function BackgroundSizePanelItem({
356
388
  // If the current value is `cover` and the repeat value is `undefined`, then
357
389
  // the toggle should be unchecked as the default state. Otherwise, the toggle
358
390
  // should reflect the current repeat value.
359
- const repeatCheckedValue = repeatValue === 'no-repeat' || currentValueForToggle === 'cover' && repeatValue === undefined ? false : true;
391
+ const repeatCheckedValue = !(repeatValue === 'no-repeat' || currentValueForToggle === 'cover' && repeatValue === undefined);
360
392
  const hasValue = hasBackgroundSizeValue(style);
361
393
  const resetAllFilter = (0, _element.useCallback)(previousValue => {
362
394
  return {
@@ -475,4 +507,9 @@ function BackgroundImagePanel(props) {
475
507
  ...props
476
508
  }));
477
509
  }
510
+ var _default = exports.default = {
511
+ useBlockProps,
512
+ attributeKeys: ['style'],
513
+ hasSupport: hasBackgroundSupport
514
+ };
478
515
  //# sourceMappingURL=background.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_blob","_blocks","_dom","_components","_data","_element","_i18n","_notices","_url","_inspectorControls","_mediaReplaceFlow","_useSettings","_utils","_store","BACKGROUND_SUPPORT_KEY","exports","IMAGE_BACKGROUND_TYPE","hasBackgroundImageValue","style","hasValue","background","backgroundImage","id","url","hasBackgroundSizeValue","backgroundPosition","undefined","backgroundSize","hasBackgroundSupport","blockName","feature","Platform","OS","support","getBlockSupport","backgroundRepeat","resetBackgroundImage","setAttributes","cleanEmptyObject","resetBackgroundSize","getBackgroundImageClasses","InspectorImagePreview","label","filename","imgUrl","imgLabel","getFilename","_react","createElement","__experimentalItemGroup","as","__experimentalHStack","justify","className","classnames","FlexItem","__experimentalTruncate","numberOfLines","VisuallyHidden","sprintf","__","BackgroundImagePanelItem","clientId","isShownByDefault","mediaUpload","useSelect","select","getBlockAttributes","getSettings","blockEditorStore","title","replaceContainerRef","useRef","createErrorNotice","useDispatch","noticesStore","onUploadError","message","type","onSelectMedia","media","newStyle","newAttributes","isBlobURL","media_type","source","onFilesDrop","filesList","allowedTypes","onFileChange","image","onError","resetAllFilter","useCallback","previousValue","__experimentalToolsPanelItem","onDeselect","panelId","ref","default","mediaId","mediaURL","accept","onSelect","name","variant","MenuItem","onClick","toggleButton","focus","tabbable","find","current","click","DropZone","backgroundSizeHelpText","value","coordsToBackgroundPosition","isNaN","x","y","backgroundPositionToCoords","split","map","v","parseFloat","BackgroundSizePanelItem","sizeValue","repeatValue","currentValueForToggle","repeatCheckedValue","updateBackgroundSize","next","nextRepeat","updateBackgroundPosition","toggleIsRepeated","__experimentalVStack","ToolsPanelItem","spacing","FocalPointPicker","__next40pxDefaultSize","onChange","__experimentalToggleGroupControl","size","isBlock","help","__experimentalToggleGroupControlOption","key","__experimentalUnitControl","ToggleControl","checked","BackgroundImagePanel","props","useSettings","showBackgroundSize","defaultControls","group"],"sources":["@wordpress/block-editor/src/hooks/background.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { focus } from '@wordpress/dom';\nimport {\n\tToggleControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalVStack as VStack,\n\tDropZone,\n\tFlexItem,\n\tFocalPointPicker,\n\tMenuItem,\n\tVisuallyHidden,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Platform, useCallback, useRef } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { getFilename } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport MediaReplaceFlow from '../components/media-replace-flow';\nimport { useSettings } from '../components/use-settings';\nimport { cleanEmptyObject } from './utils';\nimport { store as blockEditorStore } from '../store';\n\nexport const BACKGROUND_SUPPORT_KEY = 'background';\nexport const IMAGE_BACKGROUND_TYPE = 'image';\n\n/**\n * Checks if there is a current value in the background image block support\n * attributes.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether or not the block has a background image value set.\n */\nexport function hasBackgroundImageValue( style ) {\n\tconst hasValue =\n\t\t!! style?.background?.backgroundImage?.id ||\n\t\t!! style?.background?.backgroundImage?.url;\n\n\treturn hasValue;\n}\n\n/**\n * Checks if there is a current value in the background size block support\n * attributes. Background size values include background size as well\n * as background position.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether or not the block has a background size value set.\n */\nexport function hasBackgroundSizeValue( style ) {\n\treturn (\n\t\tstyle?.background?.backgroundPosition !== undefined ||\n\t\tstyle?.background?.backgroundSize !== undefined\n\t);\n}\n\n/**\n * Determine whether there is block support for background.\n *\n * @param {string} blockName Block name.\n * @param {string} feature Background image feature to check for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasBackgroundSupport( blockName, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( blockName, BACKGROUND_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn (\n\t\t\t!! support?.backgroundImage ||\n\t\t\t!! support?.backgroundSize ||\n\t\t\t!! support?.backgroundRepeat\n\t\t);\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\n/**\n * Resets the background image block support attributes. This can be used when disabling\n * the background image controls for a block via a `ToolsPanel`.\n *\n * @param {Object} style Style attribute.\n * @param {Function} setAttributes Function to set block's attributes.\n */\nexport function resetBackgroundImage( style = {}, setAttributes ) {\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundImage: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Resets the background size block support attributes. This can be used when disabling\n * the background size controls for a block via a `ToolsPanel`.\n *\n * @param {Object} style Style attribute.\n * @param {Function} setAttributes Function to set block's attributes.\n */\nfunction resetBackgroundSize( style = {}, setAttributes ) {\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundPosition: undefined,\n\t\t\t\tbackgroundRepeat: undefined,\n\t\t\t\tbackgroundSize: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Generates a CSS class name if an background image is set.\n *\n * @param {Object} style A block's style attribute.\n *\n * @return {string} CSS class name.\n */\nexport function getBackgroundImageClasses( style ) {\n\treturn hasBackgroundImageValue( style ) ? 'has-background' : '';\n}\n\nfunction InspectorImagePreview( { label, filename, url: imgUrl } ) {\n\tconst imgLabel = label || getFilename( imgUrl );\n\treturn (\n\t\t<ItemGroup as=\"span\">\n\t\t\t<HStack justify=\"flex-start\" as=\"span\">\n\t\t\t\t<span\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-hooks__background__inspector-image-indicator-wrapper',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-image': imgUrl,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\taria-hidden\n\t\t\t\t>\n\t\t\t\t\t{ imgUrl && (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__background__inspector-image-indicator\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tbackgroundImage: `url(${ imgUrl })`,\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</span>\n\t\t\t\t<FlexItem as=\"span\">\n\t\t\t\t\t<Truncate\n\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-hooks__background__inspector-media-replace-title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ imgLabel }\n\t\t\t\t\t</Truncate>\n\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t{ filename\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: file name */\n\t\t\t\t\t\t\t\t\t__( 'Selected image: %s' ),\n\t\t\t\t\t\t\t\t\tfilename\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __( 'No image selected' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</ItemGroup>\n\t);\n}\n\nfunction BackgroundImagePanelItem( {\n\tclientId,\n\tisShownByDefault,\n\tsetAttributes,\n} ) {\n\tconst { style, mediaUpload } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tstyle: getBlockAttributes( clientId )?.style,\n\t\t\t\tmediaUpload: getSettings().mediaUpload,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { id, title, url } = style?.background?.backgroundImage || {};\n\n\tconst replaceContainerRef = useRef();\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t};\n\n\tconst onSelectMedia = ( media ) => {\n\t\tif ( ! media || ! media.url ) {\n\t\t\tconst newStyle = {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundImage: undefined,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst newAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t};\n\n\t\t\tsetAttributes( newAttributes );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// For media selections originated from a file upload.\n\t\tif (\n\t\t\t( media.media_type &&\n\t\t\t\tmedia.media_type !== IMAGE_BACKGROUND_TYPE ) ||\n\t\t\t( ! media.media_type &&\n\t\t\t\tmedia.type &&\n\t\t\t\tmedia.type !== IMAGE_BACKGROUND_TYPE )\n\t\t) {\n\t\t\tonUploadError(\n\t\t\t\t__( 'Only images can be used as a background image.' )\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundImage: {\n\t\t\t\t\turl: media.url,\n\t\t\t\t\tid: media.id,\n\t\t\t\t\tsource: 'file',\n\t\t\t\t\ttitle: media.title || undefined,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\tconst newAttributes = {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t};\n\n\t\tsetAttributes( newAttributes );\n\t};\n\n\tconst onFilesDrop = ( filesList ) => {\n\t\tmediaUpload( {\n\t\t\tallowedTypes: [ 'image' ],\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonSelectMedia( image );\n\t\t\t},\n\t\t\tonError: onUploadError,\n\t\t} );\n\t};\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tstyle: {\n\t\t\t\t...previousValue.style,\n\t\t\t\tbackground: undefined,\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\tconst hasValue = hasBackgroundImageValue( style );\n\n\treturn (\n\t\t<ToolsPanelItem\n\t\t\tclassName=\"single-column\"\n\t\t\thasValue={ () => hasValue }\n\t\t\tlabel={ __( 'Background image' ) }\n\t\t\tonDeselect={ () => resetBackgroundImage( style, setAttributes ) }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tpanelId={ clientId }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"block-editor-hooks__background__inspector-media-replace-container\"\n\t\t\t\tref={ replaceContainerRef }\n\t\t\t>\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\tallowedTypes={ [ IMAGE_BACKGROUND_TYPE ] }\n\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\t\tname={\n\t\t\t\t\t\t<InspectorImagePreview\n\t\t\t\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\t\t\t\tfilename={ title }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t>\n\t\t\t\t\t{ hasValue && (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst [ toggleButton ] = focus.tabbable.find(\n\t\t\t\t\t\t\t\t\treplaceContainerRef.current\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t// Focus the toggle button and close the dropdown menu.\n\t\t\t\t\t\t\t\t// This ensures similar behaviour as to selecting an image, where the dropdown is\n\t\t\t\t\t\t\t\t// closed and focus is redirected to the dropdown toggle button.\n\t\t\t\t\t\t\t\ttoggleButton?.focus();\n\t\t\t\t\t\t\t\ttoggleButton?.click();\n\t\t\t\t\t\t\t\tresetBackgroundImage( style, setAttributes );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset ' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t) }\n\t\t\t\t</MediaReplaceFlow>\n\t\t\t\t<DropZone\n\t\t\t\t\tonFilesDrop={ onFilesDrop }\n\t\t\t\t\tlabel={ __( 'Drop to upload' ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</ToolsPanelItem>\n\t);\n}\n\nfunction backgroundSizeHelpText( value ) {\n\tif ( value === 'cover' || value === undefined ) {\n\t\treturn __( 'Image covers the space evenly.' );\n\t}\n\tif ( value === 'contain' ) {\n\t\treturn __( 'Image is contained without distortion.' );\n\t}\n\treturn __( 'Specify a fixed width.' );\n}\n\nexport const coordsToBackgroundPosition = ( value ) => {\n\tif ( ! value || ( isNaN( value.x ) && isNaN( value.y ) ) ) {\n\t\treturn undefined;\n\t}\n\n\tconst x = isNaN( value.x ) ? 0.5 : value.x;\n\tconst y = isNaN( value.y ) ? 0.5 : value.y;\n\n\treturn `${ x * 100 }% ${ y * 100 }%`;\n};\n\nexport const backgroundPositionToCoords = ( value ) => {\n\tif ( ! value ) {\n\t\treturn { x: undefined, y: undefined };\n\t}\n\n\tlet [ x, y ] = value.split( ' ' ).map( ( v ) => parseFloat( v ) / 100 );\n\tx = isNaN( x ) ? undefined : x;\n\ty = isNaN( y ) ? x : y;\n\n\treturn { x, y };\n};\n\nfunction BackgroundSizePanelItem( {\n\tclientId,\n\tisShownByDefault,\n\tsetAttributes,\n} ) {\n\tconst style = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId )?.style,\n\t\t[ clientId ]\n\t);\n\n\tconst sizeValue = style?.background?.backgroundSize;\n\tconst repeatValue = style?.background?.backgroundRepeat;\n\n\t// An `undefined` value is treated as `cover` by the toggle group control.\n\t// An empty string is treated as `auto` by the toggle group control. This\n\t// allows a user to select \"Size\" and then enter a custom value, with an\n\t// empty value being treated as `auto`.\n\tconst currentValueForToggle =\n\t\t( sizeValue !== undefined &&\n\t\t\tsizeValue !== 'cover' &&\n\t\t\tsizeValue !== 'contain' ) ||\n\t\tsizeValue === ''\n\t\t\t? 'auto'\n\t\t\t: sizeValue || 'cover';\n\n\t// If the current value is `cover` and the repeat value is `undefined`, then\n\t// the toggle should be unchecked as the default state. Otherwise, the toggle\n\t// should reflect the current repeat value.\n\tconst repeatCheckedValue =\n\t\trepeatValue === 'no-repeat' ||\n\t\t( currentValueForToggle === 'cover' && repeatValue === undefined )\n\t\t\t? false\n\t\t\t: true;\n\n\tconst hasValue = hasBackgroundSizeValue( style );\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tstyle: {\n\t\t\t\t...previousValue.style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...previousValue.style?.background,\n\t\t\t\t\tbackgroundRepeat: undefined,\n\t\t\t\t\tbackgroundSize: undefined,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\tconst updateBackgroundSize = ( next ) => {\n\t\t// When switching to 'contain' toggle the repeat off.\n\t\tlet nextRepeat = repeatValue;\n\n\t\tif ( next === 'contain' ) {\n\t\t\tnextRepeat = 'no-repeat';\n\t\t}\n\n\t\tif (\n\t\t\t( currentValueForToggle === 'cover' ||\n\t\t\t\tcurrentValueForToggle === 'contain' ) &&\n\t\t\tnext === 'auto'\n\t\t) {\n\t\t\tnextRepeat = undefined;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundRepeat: nextRepeat,\n\t\t\t\t\tbackgroundSize: next,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\tconst updateBackgroundPosition = ( next ) => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundPosition: coordsToBackgroundPosition( next ),\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundRepeat:\n\t\t\t\t\t\trepeatCheckedValue === true ? 'no-repeat' : undefined,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\treturn (\n\t\t<VStack\n\t\t\tas={ ToolsPanelItem }\n\t\t\tspacing={ 2 }\n\t\t\tclassName=\"single-column\"\n\t\t\thasValue={ () => hasValue }\n\t\t\tlabel={ __( 'Size' ) }\n\t\t\tonDeselect={ () => resetBackgroundSize( style, setAttributes ) }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tpanelId={ clientId }\n\t\t>\n\t\t\t<FocalPointPicker\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\turl={ style?.background?.backgroundImage?.url }\n\t\t\t\tvalue={ backgroundPositionToCoords(\n\t\t\t\t\tstyle?.background?.backgroundPosition\n\t\t\t\t) }\n\t\t\t\tonChange={ updateBackgroundPosition }\n\t\t\t/>\n\t\t\t<ToggleGroupControl\n\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\tvalue={ currentValueForToggle }\n\t\t\t\tonChange={ updateBackgroundSize }\n\t\t\t\tisBlock={ true }\n\t\t\t\thelp={ backgroundSizeHelpText( sizeValue ) }\n\t\t\t>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'cover' }\n\t\t\t\t\tvalue={ 'cover' }\n\t\t\t\t\tlabel={ __( 'Cover' ) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'contain' }\n\t\t\t\t\tvalue={ 'contain' }\n\t\t\t\t\tlabel={ __( 'Contain' ) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'fixed' }\n\t\t\t\t\tvalue={ 'auto' }\n\t\t\t\t\tlabel={ __( 'Fixed' ) }\n\t\t\t\t/>\n\t\t\t</ToggleGroupControl>\n\t\t\t{ sizeValue !== undefined &&\n\t\t\tsizeValue !== 'cover' &&\n\t\t\tsizeValue !== 'contain' ? (\n\t\t\t\t<UnitControl\n\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\tonChange={ updateBackgroundSize }\n\t\t\t\t\tvalue={ sizeValue }\n\t\t\t\t/>\n\t\t\t) : null }\n\t\t\t{ currentValueForToggle !== 'cover' && (\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Repeat' ) }\n\t\t\t\t\tchecked={ repeatCheckedValue }\n\t\t\t\t\tonChange={ toggleIsRepeated }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport function BackgroundImagePanel( props ) {\n\tconst [ backgroundImage, backgroundSize ] = useSettings(\n\t\t'background.backgroundImage',\n\t\t'background.backgroundSize'\n\t);\n\n\tif (\n\t\t! backgroundImage ||\n\t\t! hasBackgroundSupport( props.name, 'backgroundImage' )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst showBackgroundSize = !! (\n\t\tbackgroundSize && hasBackgroundSupport( props.name, 'backgroundSize' )\n\t);\n\n\tconst defaultControls = getBlockSupport( props.name, [\n\t\tBACKGROUND_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\treturn (\n\t\t<InspectorControls group=\"background\">\n\t\t\t<BackgroundImagePanelItem\n\t\t\t\tisShownByDefault={ defaultControls?.backgroundImage }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t\t{ showBackgroundSize && (\n\t\t\t\t<BackgroundSizePanelItem\n\t\t\t\t\tisShownByDefault={ defaultControls?.backgroundSize }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}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AK,CAAChD,IAAI,EAAE,gBAAiB,CAAC,CACtE;EAED,MAAMmD,eAAe,GAAG,IAAAzH,uBAAe,EAAEsH,KAAK,CAAChD,IAAI,EAAE,CACpD1F,sBAAsB,EACtB,+BAA+B,CAC9B,CAAC;EAEH,OACC,IAAAiC,MAAA,CAAAC,aAAA,EAACvC,kBAAA,CAAA0F,OAAiB;IAACyD,KAAK,EAAC;EAAY,GACpC,IAAA7G,MAAA,CAAAC,aAAA,EAACa,wBAAwB;IACxBE,gBAAgB,EAAG4F,eAAe,EAAEtI,eAAiB;IAAA,GAChDmI;EAAK,CACV,CAAC,EACAE,kBAAkB,IACnB,IAAA3G,MAAA,CAAAC,aAAA,EAAC8E,uBAAuB;IACvB/D,gBAAgB,EAAG4F,eAAe,EAAEhI,cAAgB;IAAA,GAC/C6H;EAAK,CACV,CAEgB,CAAC;AAEtB"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_blob","_blocks","_dom","_components","_data","_element","_i18n","_notices","_url","_inspectorControls","_mediaReplaceFlow","_useSettings","_utils","_store","BACKGROUND_SUPPORT_KEY","exports","IMAGE_BACKGROUND_TYPE","hasBackgroundImageValue","style","hasValue","background","backgroundImage","id","url","hasBackgroundSizeValue","backgroundPosition","undefined","backgroundSize","hasBackgroundSupport","blockName","feature","Platform","OS","support","getBlockSupport","backgroundRepeat","useBlockProps","name","props","source","resetBackgroundImage","setAttributes","cleanEmptyObject","resetBackgroundSize","getBackgroundImageClasses","InspectorImagePreview","label","filename","imgUrl","imgLabel","getFilename","_react","createElement","__experimentalItemGroup","as","__experimentalHStack","justify","className","classnames","FlexItem","__experimentalTruncate","numberOfLines","VisuallyHidden","sprintf","__","BackgroundImagePanelItem","clientId","isShownByDefault","mediaUpload","useSelect","select","getBlockAttributes","getSettings","blockEditorStore","title","replaceContainerRef","useRef","createErrorNotice","useDispatch","noticesStore","onUploadError","message","type","onSelectMedia","media","newStyle","newAttributes","isBlobURL","media_type","onFilesDrop","filesList","allowedTypes","onFileChange","image","onError","resetAllFilter","useCallback","previousValue","__experimentalToolsPanelItem","onDeselect","panelId","ref","default","mediaId","mediaURL","accept","onSelect","variant","MenuItem","onClick","toggleButton","focus","tabbable","find","current","click","DropZone","backgroundSizeHelpText","value","coordsToBackgroundPosition","isNaN","x","y","backgroundPositionToCoords","split","map","v","parseFloat","BackgroundSizePanelItem","sizeValue","repeatValue","currentValueForToggle","repeatCheckedValue","updateBackgroundSize","next","nextRepeat","updateBackgroundPosition","toggleIsRepeated","__experimentalVStack","ToolsPanelItem","spacing","FocalPointPicker","__next40pxDefaultSize","onChange","__experimentalToggleGroupControl","size","isBlock","help","__experimentalToggleGroupControlOption","key","__experimentalUnitControl","ToggleControl","checked","BackgroundImagePanel","useSettings","showBackgroundSize","defaultControls","group","_default","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/background.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { focus } from '@wordpress/dom';\nimport {\n\tToggleControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalVStack as VStack,\n\tDropZone,\n\tFlexItem,\n\tFocalPointPicker,\n\tMenuItem,\n\tVisuallyHidden,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Platform, useCallback, useRef } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { getFilename } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport MediaReplaceFlow from '../components/media-replace-flow';\nimport { useSettings } from '../components/use-settings';\nimport { cleanEmptyObject } from './utils';\nimport { store as blockEditorStore } from '../store';\n\nexport const BACKGROUND_SUPPORT_KEY = 'background';\nexport const IMAGE_BACKGROUND_TYPE = 'image';\n\n/**\n * Checks if there is a current value in the background image block support\n * attributes.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether or not the block has a background image value set.\n */\nexport function hasBackgroundImageValue( style ) {\n\tconst hasValue =\n\t\t!! style?.background?.backgroundImage?.id ||\n\t\t!! style?.background?.backgroundImage?.url;\n\n\treturn hasValue;\n}\n\n/**\n * Checks if there is a current value in the background size block support\n * attributes. Background size values include background size as well\n * as background position.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether or not the block has a background size value set.\n */\nexport function hasBackgroundSizeValue( style ) {\n\treturn (\n\t\tstyle?.background?.backgroundPosition !== undefined ||\n\t\tstyle?.background?.backgroundSize !== undefined\n\t);\n}\n\n/**\n * Determine whether there is block support for background.\n *\n * @param {string} blockName Block name.\n * @param {string} feature Background image feature to check for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasBackgroundSupport( blockName, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( blockName, BACKGROUND_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn (\n\t\t\t!! support?.backgroundImage ||\n\t\t\t!! support?.backgroundSize ||\n\t\t\t!! support?.backgroundRepeat\n\t\t);\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\nfunction useBlockProps( { name, style } ) {\n\tif (\n\t\t! hasBackgroundSupport( name ) ||\n\t\t! style?.background?.backgroundImage\n\t) {\n\t\treturn;\n\t}\n\n\tconst backgroundImage = style?.background?.backgroundImage;\n\tlet props;\n\n\t// Set block background defaults.\n\tif ( backgroundImage?.source === 'file' && !! backgroundImage?.url ) {\n\t\tif ( ! style?.background?.backgroundSize ) {\n\t\t\tprops = {\n\t\t\t\tstyle: {\n\t\t\t\t\tbackgroundSize: 'cover',\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tif (\n\t\t\t'contain' === style?.background?.backgroundSize &&\n\t\t\t! style?.background?.backgroundPosition\n\t\t) {\n\t\t\tprops = {\n\t\t\t\tstyle: {\n\t\t\t\t\tbackgroundPosition: 'center',\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t}\n\n\tif ( ! props ) {\n\t\treturn;\n\t}\n\n\treturn props;\n}\n\n/**\n * Resets the background image block support attributes. This can be used when disabling\n * the background image controls for a block via a `ToolsPanel`.\n *\n * @param {Object} style Style attribute.\n * @param {Function} setAttributes Function to set block's attributes.\n */\nexport function resetBackgroundImage( style = {}, setAttributes ) {\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundImage: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Resets the background size block support attributes. This can be used when disabling\n * the background size controls for a block via a `ToolsPanel`.\n *\n * @param {Object} style Style attribute.\n * @param {Function} setAttributes Function to set block's attributes.\n */\nfunction resetBackgroundSize( style = {}, setAttributes ) {\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundPosition: undefined,\n\t\t\t\tbackgroundRepeat: undefined,\n\t\t\t\tbackgroundSize: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Generates a CSS class name if an background image is set.\n *\n * @param {Object} style A block's style attribute.\n *\n * @return {string} CSS class name.\n */\nexport function getBackgroundImageClasses( style ) {\n\treturn hasBackgroundImageValue( style ) ? 'has-background' : '';\n}\n\nfunction InspectorImagePreview( { label, filename, url: imgUrl } ) {\n\tconst imgLabel = label || getFilename( imgUrl );\n\treturn (\n\t\t<ItemGroup as=\"span\">\n\t\t\t<HStack justify=\"flex-start\" as=\"span\">\n\t\t\t\t<span\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-hooks__background__inspector-image-indicator-wrapper',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-image': imgUrl,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\taria-hidden\n\t\t\t\t>\n\t\t\t\t\t{ imgUrl && (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__background__inspector-image-indicator\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tbackgroundImage: `url(${ imgUrl })`,\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</span>\n\t\t\t\t<FlexItem as=\"span\">\n\t\t\t\t\t<Truncate\n\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-hooks__background__inspector-media-replace-title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ imgLabel }\n\t\t\t\t\t</Truncate>\n\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t{ filename\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: file name */\n\t\t\t\t\t\t\t\t\t__( 'Selected image: %s' ),\n\t\t\t\t\t\t\t\t\tfilename\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __( 'No image selected' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</ItemGroup>\n\t);\n}\n\nfunction BackgroundImagePanelItem( {\n\tclientId,\n\tisShownByDefault,\n\tsetAttributes,\n} ) {\n\tconst { style, mediaUpload } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tstyle: getBlockAttributes( clientId )?.style,\n\t\t\t\tmediaUpload: getSettings().mediaUpload,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { id, title, url } = style?.background?.backgroundImage || {};\n\n\tconst replaceContainerRef = useRef();\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t};\n\n\tconst onSelectMedia = ( media ) => {\n\t\tif ( ! media || ! media.url ) {\n\t\t\tconst newStyle = {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundImage: undefined,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst newAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t};\n\n\t\t\tsetAttributes( newAttributes );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// For media selections originated from a file upload.\n\t\tif (\n\t\t\t( media.media_type &&\n\t\t\t\tmedia.media_type !== IMAGE_BACKGROUND_TYPE ) ||\n\t\t\t( ! media.media_type &&\n\t\t\t\tmedia.type &&\n\t\t\t\tmedia.type !== IMAGE_BACKGROUND_TYPE )\n\t\t) {\n\t\t\tonUploadError(\n\t\t\t\t__( 'Only images can be used as a background image.' )\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundImage: {\n\t\t\t\t\turl: media.url,\n\t\t\t\t\tid: media.id,\n\t\t\t\t\tsource: 'file',\n\t\t\t\t\ttitle: media.title || undefined,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\tconst newAttributes = {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t};\n\n\t\tsetAttributes( newAttributes );\n\t};\n\n\tconst onFilesDrop = ( filesList ) => {\n\t\tmediaUpload( {\n\t\t\tallowedTypes: [ 'image' ],\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonSelectMedia( image );\n\t\t\t},\n\t\t\tonError: onUploadError,\n\t\t} );\n\t};\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tstyle: {\n\t\t\t\t...previousValue.style,\n\t\t\t\tbackground: undefined,\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\tconst hasValue = hasBackgroundImageValue( style );\n\n\treturn (\n\t\t<ToolsPanelItem\n\t\t\tclassName=\"single-column\"\n\t\t\thasValue={ () => hasValue }\n\t\t\tlabel={ __( 'Background image' ) }\n\t\t\tonDeselect={ () => resetBackgroundImage( style, setAttributes ) }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tpanelId={ clientId }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"block-editor-hooks__background__inspector-media-replace-container\"\n\t\t\t\tref={ replaceContainerRef }\n\t\t\t>\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\tallowedTypes={ [ IMAGE_BACKGROUND_TYPE ] }\n\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\t\tname={\n\t\t\t\t\t\t<InspectorImagePreview\n\t\t\t\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\t\t\t\tfilename={ title }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t>\n\t\t\t\t\t{ hasValue && (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst [ toggleButton ] = focus.tabbable.find(\n\t\t\t\t\t\t\t\t\treplaceContainerRef.current\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t// Focus the toggle button and close the dropdown menu.\n\t\t\t\t\t\t\t\t// This ensures similar behaviour as to selecting an image, where the dropdown is\n\t\t\t\t\t\t\t\t// closed and focus is redirected to the dropdown toggle button.\n\t\t\t\t\t\t\t\ttoggleButton?.focus();\n\t\t\t\t\t\t\t\ttoggleButton?.click();\n\t\t\t\t\t\t\t\tresetBackgroundImage( style, setAttributes );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset ' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t) }\n\t\t\t\t</MediaReplaceFlow>\n\t\t\t\t<DropZone\n\t\t\t\t\tonFilesDrop={ onFilesDrop }\n\t\t\t\t\tlabel={ __( 'Drop to upload' ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</ToolsPanelItem>\n\t);\n}\n\nfunction backgroundSizeHelpText( value ) {\n\tif ( value === 'cover' || value === undefined ) {\n\t\treturn __( 'Image covers the space evenly.' );\n\t}\n\tif ( value === 'contain' ) {\n\t\treturn __( 'Image is contained without distortion.' );\n\t}\n\treturn __( 'Specify a fixed width.' );\n}\n\nexport const coordsToBackgroundPosition = ( value ) => {\n\tif ( ! value || ( isNaN( value.x ) && isNaN( value.y ) ) ) {\n\t\treturn undefined;\n\t}\n\n\tconst x = isNaN( value.x ) ? 0.5 : value.x;\n\tconst y = isNaN( value.y ) ? 0.5 : value.y;\n\n\treturn `${ x * 100 }% ${ y * 100 }%`;\n};\n\nexport const backgroundPositionToCoords = ( value ) => {\n\tif ( ! value ) {\n\t\treturn { x: undefined, y: undefined };\n\t}\n\n\tlet [ x, y ] = value.split( ' ' ).map( ( v ) => parseFloat( v ) / 100 );\n\tx = isNaN( x ) ? undefined : x;\n\ty = isNaN( y ) ? x : y;\n\n\treturn { x, y };\n};\n\nfunction BackgroundSizePanelItem( {\n\tclientId,\n\tisShownByDefault,\n\tsetAttributes,\n} ) {\n\tconst style = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId )?.style,\n\t\t[ clientId ]\n\t);\n\n\tconst sizeValue = style?.background?.backgroundSize;\n\tconst repeatValue = style?.background?.backgroundRepeat;\n\n\t// An `undefined` value is treated as `cover` by the toggle group control.\n\t// An empty string is treated as `auto` by the toggle group control. This\n\t// allows a user to select \"Size\" and then enter a custom value, with an\n\t// empty value being treated as `auto`.\n\tconst currentValueForToggle =\n\t\t( sizeValue !== undefined &&\n\t\t\tsizeValue !== 'cover' &&\n\t\t\tsizeValue !== 'contain' ) ||\n\t\tsizeValue === ''\n\t\t\t? 'auto'\n\t\t\t: sizeValue || 'cover';\n\n\t// If the current value is `cover` and the repeat value is `undefined`, then\n\t// the toggle should be unchecked as the default state. Otherwise, the toggle\n\t// should reflect the current repeat value.\n\tconst repeatCheckedValue = ! (\n\t\trepeatValue === 'no-repeat' ||\n\t\t( currentValueForToggle === 'cover' && repeatValue === undefined )\n\t);\n\n\tconst hasValue = hasBackgroundSizeValue( style );\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tstyle: {\n\t\t\t\t...previousValue.style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...previousValue.style?.background,\n\t\t\t\t\tbackgroundRepeat: undefined,\n\t\t\t\t\tbackgroundSize: undefined,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\tconst updateBackgroundSize = ( next ) => {\n\t\t// When switching to 'contain' toggle the repeat off.\n\t\tlet nextRepeat = repeatValue;\n\n\t\tif ( next === 'contain' ) {\n\t\t\tnextRepeat = 'no-repeat';\n\t\t}\n\n\t\tif (\n\t\t\t( currentValueForToggle === 'cover' ||\n\t\t\t\tcurrentValueForToggle === 'contain' ) &&\n\t\t\tnext === 'auto'\n\t\t) {\n\t\t\tnextRepeat = undefined;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundRepeat: nextRepeat,\n\t\t\t\t\tbackgroundSize: next,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\tconst updateBackgroundPosition = ( next ) => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundPosition: coordsToBackgroundPosition( next ),\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundRepeat:\n\t\t\t\t\t\trepeatCheckedValue === true ? 'no-repeat' : undefined,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\treturn (\n\t\t<VStack\n\t\t\tas={ ToolsPanelItem }\n\t\t\tspacing={ 2 }\n\t\t\tclassName=\"single-column\"\n\t\t\thasValue={ () => hasValue }\n\t\t\tlabel={ __( 'Size' ) }\n\t\t\tonDeselect={ () => resetBackgroundSize( style, setAttributes ) }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tpanelId={ clientId }\n\t\t>\n\t\t\t<FocalPointPicker\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\turl={ style?.background?.backgroundImage?.url }\n\t\t\t\tvalue={ backgroundPositionToCoords(\n\t\t\t\t\tstyle?.background?.backgroundPosition\n\t\t\t\t) }\n\t\t\t\tonChange={ updateBackgroundPosition }\n\t\t\t/>\n\t\t\t<ToggleGroupControl\n\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\tvalue={ currentValueForToggle }\n\t\t\t\tonChange={ updateBackgroundSize }\n\t\t\t\tisBlock\n\t\t\t\thelp={ backgroundSizeHelpText( sizeValue ) }\n\t\t\t>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'cover' }\n\t\t\t\t\tvalue={ 'cover' }\n\t\t\t\t\tlabel={ __( 'Cover' ) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'contain' }\n\t\t\t\t\tvalue={ 'contain' }\n\t\t\t\t\tlabel={ __( 'Contain' ) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'fixed' }\n\t\t\t\t\tvalue={ 'auto' }\n\t\t\t\t\tlabel={ __( 'Fixed' ) }\n\t\t\t\t/>\n\t\t\t</ToggleGroupControl>\n\t\t\t{ sizeValue !== undefined &&\n\t\t\tsizeValue !== 'cover' &&\n\t\t\tsizeValue !== 'contain' ? (\n\t\t\t\t<UnitControl\n\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\tonChange={ updateBackgroundSize }\n\t\t\t\t\tvalue={ sizeValue }\n\t\t\t\t/>\n\t\t\t) : null }\n\t\t\t{ currentValueForToggle !== 'cover' && (\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Repeat' ) }\n\t\t\t\t\tchecked={ repeatCheckedValue }\n\t\t\t\t\tonChange={ toggleIsRepeated }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport function BackgroundImagePanel( props ) {\n\tconst [ backgroundImage, backgroundSize ] = useSettings(\n\t\t'background.backgroundImage',\n\t\t'background.backgroundSize'\n\t);\n\n\tif (\n\t\t! backgroundImage ||\n\t\t! hasBackgroundSupport( props.name, 'backgroundImage' )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst showBackgroundSize = !! (\n\t\tbackgroundSize && hasBackgroundSupport( props.name, 'backgroundSize' )\n\t);\n\n\tconst defaultControls = getBlockSupport( props.name, [\n\t\tBACKGROUND_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\treturn (\n\t\t<InspectorControls group=\"background\">\n\t\t\t<BackgroundImagePanelItem\n\t\t\t\tisShownByDefault={ defaultControls?.backgroundImage }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t\t{ showBackgroundSize && (\n\t\t\t\t<BackgroundSizePanelItem\n\t\t\t\t\tisShownByDefault={ defaultControls?.backgroundSize }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n\nexport default {\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport: hasBackgroundSupport,\n};\n"],"mappings":";;;;;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAgBA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,IAAA,GAAAT,OAAA;AAKA,IAAAU,kBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,iBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,YAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AAxCA;AACA;AACA;;AAGA;AACA;AACA;;AA0BA;AACA;AACA;;AAOO,MAAMe,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,YAAY;AAC3C,MAAME,qBAAqB,GAAAD,OAAA,CAAAC,qBAAA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KAAK,CAACD,IAAI,EAAE,gBAAiB,CAAC,CACtE;EAED,MAAMuH,eAAe,GAAG,IAAA1H,uBAAe,EAAEI,KAAK,CAACD,IAAI,EAAE,CACpDvB,sBAAsB,EACtB,+BAA+B,CAC9B,CAAC;EAEH,OACC,IAAAqC,MAAA,CAAAC,aAAA,EAAC3C,kBAAA,CAAA6F,OAAiB;IAACuD,KAAK,EAAC;EAAY,GACpC,IAAA1G,MAAA,CAAAC,aAAA,EAACa,wBAAwB;IACxBE,gBAAgB,EAAGyF,eAAe,EAAEvI,eAAiB;IAAA,GAChDiB;EAAK,CACV,CAAC,EACAqH,kBAAkB,IACnB,IAAAxG,MAAA,CAAAC,aAAA,EAAC4E,uBAAuB;IACvB7D,gBAAgB,EAAGyF,eAAe,EAAEjI,cAAgB;IAAA,GAC/CW;EAAK,CACV,CAEgB,CAAC;AAEtB;AAAC,IAAAwH,QAAA,GAAA/I,OAAA,CAAAuF,OAAA,GAEc;EACdlE,aAAa;EACb2H,aAAa,EAAE,CAAE,OAAO,CAAE;EAC1BC,UAAU,EAAEpI;AACb,CAAC"}
@@ -23,31 +23,40 @@ var _store = require("../store");
23
23
  const EMPTY_OBJECT = {};
24
24
  function BlockHooksControlPure({
25
25
  name,
26
- clientId
26
+ clientId,
27
+ metadata: {
28
+ ignoredHookedBlocks = []
29
+ } = {}
27
30
  }) {
28
31
  const blockTypes = (0, _data.useSelect)(select => select(_blocks.store).getBlockTypes(), []);
32
+
33
+ // A hooked block added via a filter will not be exposed through a block
34
+ // type's `blockHooks` property; however, if the containing layout has been
35
+ // modified, it will be present in the anchor block's `ignoredHookedBlocks`
36
+ // metadata.
29
37
  const hookedBlocksForCurrentBlock = (0, _element.useMemo)(() => blockTypes?.filter(({
38
+ name: blockName,
30
39
  blockHooks
31
- }) => blockHooks && name in blockHooks), [blockTypes, name]);
40
+ }) => blockHooks && name in blockHooks || ignoredHookedBlocks.includes(blockName)), [blockTypes, name, ignoredHookedBlocks]);
32
41
  const {
33
42
  blockIndex,
34
43
  rootClientId,
35
44
  innerBlocksLength
36
45
  } = (0, _data.useSelect)(select => {
37
46
  const {
38
- getBlock,
47
+ getBlocks,
39
48
  getBlockIndex,
40
49
  getBlockRootClientId
41
50
  } = select(_store.store);
42
51
  return {
43
52
  blockIndex: getBlockIndex(clientId),
44
- innerBlocksLength: getBlock(clientId)?.innerBlocks?.length,
53
+ innerBlocksLength: getBlocks(clientId)?.length,
45
54
  rootClientId: getBlockRootClientId(clientId)
46
55
  };
47
56
  }, [clientId]);
48
57
  const hookedBlockClientIds = (0, _data.useSelect)(select => {
49
58
  const {
50
- getBlock,
59
+ getBlocks,
51
60
  getGlobalBlockCount
52
61
  } = select(_store.store);
53
62
  const _hookedBlockClientIds = hookedBlocksForCurrentBlock.reduce((clientIds, block) => {
@@ -64,14 +73,20 @@ function BlockHooksControlPure({
64
73
  // Any of the current block's siblings (with the right block type) qualifies
65
74
  // as a hooked block (inserted `before` or `after` the current one), as the block
66
75
  // might've been automatically inserted and then moved around a bit by the user.
67
- candidates = getBlock(rootClientId)?.innerBlocks;
76
+ candidates = getBlocks(rootClientId);
68
77
  break;
69
78
  case 'first_child':
70
79
  case 'last_child':
71
80
  // Any of the current block's child blocks (with the right block type) qualifies
72
81
  // as a hooked first or last child block, as the block might've been automatically
73
82
  // inserted and then moved around a bit by the user.
74
- candidates = getBlock(clientId).innerBlocks;
83
+ candidates = getBlocks(clientId);
84
+ break;
85
+ case undefined:
86
+ // If we haven't found a blockHooks field with a relative position for the hooked
87
+ // block, it means that it was added by a filter. In this case, we look for the block
88
+ // both among the current block's siblings and its children.
89
+ candidates = [...getBlocks(rootClientId), ...getBlocks(clientId)];
75
90
  break;
76
91
  }
77
92
  const hookedBlock = candidates?.find(candidate => candidate.name === block.name);
@@ -127,13 +142,23 @@ function BlockHooksControlPure({
127
142
  // Insert as a child of the current block.
128
143
  false);
129
144
  break;
145
+ case undefined:
146
+ // If we do not know the relative position, it is because the block was
147
+ // added via a filter. In this case, we default to inserting it after the
148
+ // current block.
149
+ insertBlock(block, blockIndex + 1, rootClientId,
150
+ // Insert as a child of the current block's parent
151
+ false);
152
+ break;
130
153
  }
131
154
  };
132
155
  return (0, _react.createElement)(_components2.InspectorControls, null, (0, _react.createElement)(_components.PanelBody, {
133
156
  className: "block-editor-hooks__block-hooks",
134
157
  title: (0, _i18n.__)('Plugins'),
135
158
  initialOpen: true
136
- }, Object.keys(groupedHookedBlocks).map(vendor => {
159
+ }, (0, _react.createElement)("p", {
160
+ className: "block-editor-hooks__block-hooks-helptext"
161
+ }, (0, _i18n.__)('Manage the inclusion of blocks added automatically by plugins.')), Object.keys(groupedHookedBlocks).map(vendor => {
137
162
  return (0, _react.createElement)(_element.Fragment, {
138
163
  key: vendor
139
164
  }, (0, _react.createElement)("h3", null, vendor), groupedHookedBlocks[vendor].map(block => {
@@ -163,6 +188,7 @@ function BlockHooksControlPure({
163
188
  }
164
189
  var _default = exports.default = {
165
190
  edit: BlockHooksControlPure,
191
+ attributeKeys: ['metadata'],
166
192
  hasSupport() {
167
193
  return true;
168
194
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_element","_components","_blocks","_data","_components2","_store","EMPTY_OBJECT","BlockHooksControlPure","name","clientId","blockTypes","useSelect","select","blocksStore","getBlockTypes","hookedBlocksForCurrentBlock","useMemo","filter","blockHooks","blockIndex","rootClientId","innerBlocksLength","getBlock","getBlockIndex","getBlockRootClientId","blockEditorStore","innerBlocks","length","hookedBlockClientIds","getGlobalBlockCount","_hookedBlockClientIds","reduce","clientIds","block","relativePosition","candidates","hookedBlock","find","candidate","Object","values","insertBlock","removeBlock","useDispatch","groupedHookedBlocks","groups","namespace","split","push","insertBlockIntoDesignatedLocation","_react","createElement","InspectorControls","PanelBody","className","title","__","initialOpen","keys","map","vendor","Fragment","key","checked","ToggleControl","label","__experimentalHStack","justify","BlockIcon","icon","onChange","createBlock","_default","exports","default","edit","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/block-hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Fragment, useMemo } from '@wordpress/element';\nimport {\n\t__experimentalHStack as HStack,\n\tPanelBody,\n\tToggleControl,\n} from '@wordpress/components';\nimport { createBlock, store as blocksStore } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { BlockIcon, InspectorControls } from '../components';\nimport { store as blockEditorStore } from '../store';\n\nconst EMPTY_OBJECT = {};\n\nfunction BlockHooksControlPure( { name, clientId } ) {\n\tconst blockTypes = useSelect(\n\t\t( select ) => select( blocksStore ).getBlockTypes(),\n\t\t[]\n\t);\n\n\tconst hookedBlocksForCurrentBlock = useMemo(\n\t\t() =>\n\t\t\tblockTypes?.filter(\n\t\t\t\t( { blockHooks } ) => blockHooks && name in blockHooks\n\t\t\t),\n\t\t[ blockTypes, name ]\n\t);\n\n\tconst { blockIndex, rootClientId, innerBlocksLength } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getBlockIndex, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\tinnerBlocksLength: getBlock( clientId )?.innerBlocks?.length,\n\t\t\t\trootClientId: getBlockRootClientId( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst hookedBlockClientIds = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getGlobalBlockCount } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\tconst _hookedBlockClientIds = hookedBlocksForCurrentBlock.reduce(\n\t\t\t\t( clientIds, block ) => {\n\t\t\t\t\t// If the block doesn't exist anywhere in the block tree,\n\t\t\t\t\t// we know that we have to set the toggle to disabled.\n\t\t\t\t\tif ( getGlobalBlockCount( block.name ) === 0 ) {\n\t\t\t\t\t\treturn clientIds;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst relativePosition = block?.blockHooks?.[ name ];\n\t\t\t\t\tlet candidates;\n\n\t\t\t\t\tswitch ( relativePosition ) {\n\t\t\t\t\t\tcase 'before':\n\t\t\t\t\t\tcase 'after':\n\t\t\t\t\t\t\t// Any of the current block's siblings (with the right block type) qualifies\n\t\t\t\t\t\t\t// as a hooked block (inserted `before` or `after` the current one), as the block\n\t\t\t\t\t\t\t// might've been automatically inserted and then moved around a bit by the user.\n\t\t\t\t\t\t\tcandidates = getBlock( rootClientId )?.innerBlocks;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase 'first_child':\n\t\t\t\t\t\tcase 'last_child':\n\t\t\t\t\t\t\t// Any of the current block's child blocks (with the right block type) qualifies\n\t\t\t\t\t\t\t// as a hooked first or last child block, as the block might've been automatically\n\t\t\t\t\t\t\t// inserted and then moved around a bit by the user.\n\t\t\t\t\t\t\tcandidates = getBlock( clientId ).innerBlocks;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst hookedBlock = candidates?.find(\n\t\t\t\t\t\t( candidate ) => candidate.name === block.name\n\t\t\t\t\t);\n\n\t\t\t\t\t// If the block exists in the designated location, we consider it hooked\n\t\t\t\t\t// and show the toggle as enabled.\n\t\t\t\t\tif ( hookedBlock ) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...clientIds,\n\t\t\t\t\t\t\t[ block.name ]: hookedBlock.clientId,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\t// If no hooked block was found in any of its designated locations,\n\t\t\t\t\t// we set the toggle to disabled.\n\t\t\t\t\treturn clientIds;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\n\t\t\tif ( Object.values( _hookedBlockClientIds ).length > 0 ) {\n\t\t\t\treturn _hookedBlockClientIds;\n\t\t\t}\n\n\t\t\treturn EMPTY_OBJECT;\n\t\t},\n\t\t[ hookedBlocksForCurrentBlock, name, clientId, rootClientId ]\n\t);\n\n\tconst { insertBlock, removeBlock } = useDispatch( blockEditorStore );\n\n\tif ( ! hookedBlocksForCurrentBlock.length ) {\n\t\treturn null;\n\t}\n\n\t// Group by block namespace (i.e. prefix before the slash).\n\tconst groupedHookedBlocks = hookedBlocksForCurrentBlock.reduce(\n\t\t( groups, block ) => {\n\t\t\tconst [ namespace ] = block.name.split( '/' );\n\t\t\tif ( ! groups[ namespace ] ) {\n\t\t\t\tgroups[ namespace ] = [];\n\t\t\t}\n\t\t\tgroups[ namespace ].push( block );\n\t\t\treturn groups;\n\t\t},\n\t\t{}\n\t);\n\n\tconst insertBlockIntoDesignatedLocation = ( block, relativePosition ) => {\n\t\tswitch ( relativePosition ) {\n\t\t\tcase 'before':\n\t\t\tcase 'after':\n\t\t\t\tinsertBlock(\n\t\t\t\t\tblock,\n\t\t\t\t\trelativePosition === 'after' ? blockIndex + 1 : blockIndex,\n\t\t\t\t\trootClientId, // Insert as a child of the current block's parent\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase 'first_child':\n\t\t\tcase 'last_child':\n\t\t\t\tinsertBlock(\n\t\t\t\t\tblock,\n\t\t\t\t\t// TODO: It'd be great if insertBlock() would accept negative indices for insertion.\n\t\t\t\t\trelativePosition === 'first_child' ? 0 : innerBlocksLength,\n\t\t\t\t\tclientId, // Insert as a child of the current block.\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t}\n\t};\n\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<PanelBody\n\t\t\t\tclassName=\"block-editor-hooks__block-hooks\"\n\t\t\t\ttitle={ __( 'Plugins' ) }\n\t\t\t\tinitialOpen={ true }\n\t\t\t>\n\t\t\t\t{ Object.keys( groupedHookedBlocks ).map( ( vendor ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Fragment key={ vendor }>\n\t\t\t\t\t\t\t<h3>{ vendor }</h3>\n\t\t\t\t\t\t\t{ groupedHookedBlocks[ vendor ].map( ( block ) => {\n\t\t\t\t\t\t\t\tconst checked =\n\t\t\t\t\t\t\t\t\tblock.name in hookedBlockClientIds;\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\tchecked={ checked }\n\t\t\t\t\t\t\t\t\t\tkey={ block.title }\n\t\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t\t\t\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\t\t\t\t\t\t\t\ticon={ block.icon }\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<span>{ block.title }</span>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\t\t\tif ( ! checked ) {\n\t\t\t\t\t\t\t\t\t\t\t\t// Create and insert block.\n\t\t\t\t\t\t\t\t\t\t\t\tconst relativePosition =\n\t\t\t\t\t\t\t\t\t\t\t\t\tblock.blockHooks[ name ];\n\t\t\t\t\t\t\t\t\t\t\t\tinsertBlockIntoDesignatedLocation(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcreateBlock( block.name ),\n\t\t\t\t\t\t\t\t\t\t\t\t\trelativePosition\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\treturn;\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t// Remove block.\n\t\t\t\t\t\t\t\t\t\t\tremoveBlock(\n\t\t\t\t\t\t\t\t\t\t\t\thookedBlockClientIds[\n\t\t\t\t\t\t\t\t\t\t\t\t\tblock.name\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\tfalse\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t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C;QACF;MAAG,CACH,CAAC;IAEJ,CAAE,CACO,CAAC;EAEb,CAAE,CACQ,CACO,CAAC;AAEtB;AAAC,IAAAgE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc;EACdC,IAAI,EAAEpE,qBAAqB;EAC3BqE,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC"}
1
+ {"version":3,"names":["_i18n","require","_element","_components","_blocks","_data","_components2","_store","EMPTY_OBJECT","BlockHooksControlPure","name","clientId","metadata","ignoredHookedBlocks","blockTypes","useSelect","select","blocksStore","getBlockTypes","hookedBlocksForCurrentBlock","useMemo","filter","blockName","blockHooks","includes","blockIndex","rootClientId","innerBlocksLength","getBlocks","getBlockIndex","getBlockRootClientId","blockEditorStore","length","hookedBlockClientIds","getGlobalBlockCount","_hookedBlockClientIds","reduce","clientIds","block","relativePosition","candidates","undefined","hookedBlock","find","candidate","Object","values","insertBlock","removeBlock","useDispatch","groupedHookedBlocks","groups","namespace","split","push","insertBlockIntoDesignatedLocation","_react","createElement","InspectorControls","PanelBody","className","title","__","initialOpen","keys","map","vendor","Fragment","key","checked","ToggleControl","label","__experimentalHStack","justify","BlockIcon","icon","onChange","createBlock","_default","exports","default","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/block-hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Fragment, useMemo } from '@wordpress/element';\nimport {\n\t__experimentalHStack as HStack,\n\tPanelBody,\n\tToggleControl,\n} from '@wordpress/components';\nimport { createBlock, store as blocksStore } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { BlockIcon, InspectorControls } from '../components';\nimport { store as blockEditorStore } from '../store';\n\nconst EMPTY_OBJECT = {};\n\nfunction BlockHooksControlPure( {\n\tname,\n\tclientId,\n\tmetadata: { ignoredHookedBlocks = [] } = {},\n} ) {\n\tconst blockTypes = useSelect(\n\t\t( select ) => select( blocksStore ).getBlockTypes(),\n\t\t[]\n\t);\n\n\t// A hooked block added via a filter will not be exposed through a block\n\t// type's `blockHooks` property; however, if the containing layout has been\n\t// modified, it will be present in the anchor block's `ignoredHookedBlocks`\n\t// metadata.\n\tconst hookedBlocksForCurrentBlock = useMemo(\n\t\t() =>\n\t\t\tblockTypes?.filter(\n\t\t\t\t( { name: blockName, blockHooks } ) =>\n\t\t\t\t\t( blockHooks && name in blockHooks ) ||\n\t\t\t\t\tignoredHookedBlocks.includes( blockName )\n\t\t\t),\n\t\t[ blockTypes, name, ignoredHookedBlocks ]\n\t);\n\n\tconst { blockIndex, rootClientId, innerBlocksLength } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlocks, getBlockIndex, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\tinnerBlocksLength: getBlocks( clientId )?.length,\n\t\t\t\trootClientId: getBlockRootClientId( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst hookedBlockClientIds = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlocks, getGlobalBlockCount } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\tconst _hookedBlockClientIds = hookedBlocksForCurrentBlock.reduce(\n\t\t\t\t( clientIds, block ) => {\n\t\t\t\t\t// If the block doesn't exist anywhere in the block tree,\n\t\t\t\t\t// we know that we have to set the toggle to disabled.\n\t\t\t\t\tif ( getGlobalBlockCount( block.name ) === 0 ) {\n\t\t\t\t\t\treturn clientIds;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst relativePosition = block?.blockHooks?.[ name ];\n\t\t\t\t\tlet candidates;\n\n\t\t\t\t\tswitch ( relativePosition ) {\n\t\t\t\t\t\tcase 'before':\n\t\t\t\t\t\tcase 'after':\n\t\t\t\t\t\t\t// Any of the current block's siblings (with the right block type) qualifies\n\t\t\t\t\t\t\t// as a hooked block (inserted `before` or `after` the current one), as the block\n\t\t\t\t\t\t\t// might've been automatically inserted and then moved around a bit by the user.\n\t\t\t\t\t\t\tcandidates = getBlocks( rootClientId );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase 'first_child':\n\t\t\t\t\t\tcase 'last_child':\n\t\t\t\t\t\t\t// Any of the current block's child blocks (with the right block type) qualifies\n\t\t\t\t\t\t\t// as a hooked first or last child block, as the block might've been automatically\n\t\t\t\t\t\t\t// inserted and then moved around a bit by the user.\n\t\t\t\t\t\t\tcandidates = getBlocks( clientId );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase undefined:\n\t\t\t\t\t\t\t// If we haven't found a blockHooks field with a relative position for the hooked\n\t\t\t\t\t\t\t// block, it means that it was added by a filter. In this case, we look for the block\n\t\t\t\t\t\t\t// both among the current block's siblings and its children.\n\t\t\t\t\t\t\tcandidates = [\n\t\t\t\t\t\t\t\t...getBlocks( rootClientId ),\n\t\t\t\t\t\t\t\t...getBlocks( clientId ),\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst hookedBlock = candidates?.find(\n\t\t\t\t\t\t( candidate ) => candidate.name === block.name\n\t\t\t\t\t);\n\n\t\t\t\t\t// If the block exists in the designated location, we consider it hooked\n\t\t\t\t\t// and show the toggle as enabled.\n\t\t\t\t\tif ( hookedBlock ) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...clientIds,\n\t\t\t\t\t\t\t[ block.name ]: hookedBlock.clientId,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\t// If no hooked block was found in any of its designated locations,\n\t\t\t\t\t// we set the toggle to disabled.\n\t\t\t\t\treturn clientIds;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\n\t\t\tif ( Object.values( _hookedBlockClientIds ).length > 0 ) {\n\t\t\t\treturn _hookedBlockClientIds;\n\t\t\t}\n\n\t\t\treturn EMPTY_OBJECT;\n\t\t},\n\t\t[ hookedBlocksForCurrentBlock, name, clientId, rootClientId ]\n\t);\n\n\tconst { insertBlock, removeBlock } = useDispatch( blockEditorStore );\n\n\tif ( ! hookedBlocksForCurrentBlock.length ) {\n\t\treturn null;\n\t}\n\n\t// Group by block namespace (i.e. prefix before the slash).\n\tconst groupedHookedBlocks = hookedBlocksForCurrentBlock.reduce(\n\t\t( groups, block ) => {\n\t\t\tconst [ namespace ] = block.name.split( '/' );\n\t\t\tif ( ! groups[ namespace ] ) {\n\t\t\t\tgroups[ namespace ] = [];\n\t\t\t}\n\t\t\tgroups[ namespace ].push( block );\n\t\t\treturn groups;\n\t\t},\n\t\t{}\n\t);\n\n\tconst insertBlockIntoDesignatedLocation = ( block, relativePosition ) => {\n\t\tswitch ( relativePosition ) {\n\t\t\tcase 'before':\n\t\t\tcase 'after':\n\t\t\t\tinsertBlock(\n\t\t\t\t\tblock,\n\t\t\t\t\trelativePosition === 'after' ? blockIndex + 1 : blockIndex,\n\t\t\t\t\trootClientId, // Insert as a child of the current block's parent\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase 'first_child':\n\t\t\tcase 'last_child':\n\t\t\t\tinsertBlock(\n\t\t\t\t\tblock,\n\t\t\t\t\t// TODO: It'd be great if insertBlock() would accept negative indices for insertion.\n\t\t\t\t\trelativePosition === 'first_child' ? 0 : innerBlocksLength,\n\t\t\t\t\tclientId, // Insert as a child of the current block.\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase undefined:\n\t\t\t\t// If we do not know the relative position, it is because the block was\n\t\t\t\t// added via a filter. In this case, we default to inserting it after the\n\t\t\t\t// current block.\n\t\t\t\tinsertBlock(\n\t\t\t\t\tblock,\n\t\t\t\t\tblockIndex + 1,\n\t\t\t\t\trootClientId, // Insert as a child of the current block's parent\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t}\n\t};\n\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<PanelBody\n\t\t\t\tclassName=\"block-editor-hooks__block-hooks\"\n\t\t\t\ttitle={ __( 'Plugins' ) }\n\t\t\t\tinitialOpen\n\t\t\t>\n\t\t\t\t<p className=\"block-editor-hooks__block-hooks-helptext\">\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Manage the inclusion of blocks added automatically by plugins.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t\t{ Object.keys( groupedHookedBlocks ).map( ( vendor ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Fragment key={ vendor }>\n\t\t\t\t\t\t\t<h3>{ vendor }</h3>\n\t\t\t\t\t\t\t{ groupedHookedBlocks[ vendor ].map( ( block ) => {\n\t\t\t\t\t\t\t\tconst checked =\n\t\t\t\t\t\t\t\t\tblock.name in hookedBlockClientIds;\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\tchecked={ checked }\n\t\t\t\t\t\t\t\t\t\tkey={ block.title }\n\t\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t\t\t\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\t\t\t\t\t\t\t\ticon={ block.icon }\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<span>{ block.title }</span>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\t\t\tif ( ! checked ) {\n\t\t\t\t\t\t\t\t\t\t\t\t// Create and insert block.\n\t\t\t\t\t\t\t\t\t\t\t\tconst relativePosition =\n\t\t\t\t\t\t\t\t\t\t\t\t\tblock.blockHooks[ name ];\n\t\t\t\t\t\t\t\t\t\t\t\tinsertBlockIntoDesignatedLocation(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcreateBlock( block.name ),\n\t\t\t\t\t\t\t\t\t\t\t\t\trelativePosition\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\treturn;\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t// Remove block.\n\t\t\t\t\t\t\t\t\t\t\tremoveBlock(\n\t\t\t\t\t\t\t\t\t\t\t\thookedBlockClientIds[\n\t\t\t\t\t\t\t\t\t\t\t\t\tblock.name\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\tfalse\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/>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n}\n\nexport default {\n\tedit: BlockHooksControlPure,\n\tattributeKeys: [ 'metadata' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAjBA;AACA;AACA;;AAWA;AACA;AACA;;AAIA,MAAMO,YAAY,GAAG,CAAC,CAAC;AAEvB,SAASC,qBAAqBA,CAAE;EAC/BC,IAAI;EACJC,QAAQ;EACRC,QAAQ,EAAE;IAAEC,mBAAmB,GAAG;EAAG,CAAC,GAAG,CAAC;AAC3C,CAAC,EAAG;EACH,MAAMC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EAC7BC,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC"}
@@ -8,11 +8,11 @@ exports.BORDER_SUPPORT_KEY = void 0;
8
8
  exports.BorderPanel = BorderPanel;
9
9
  exports.default = exports.SHADOW_SUPPORT_KEY = void 0;
10
10
  exports.getBorderClasses = getBorderClasses;
11
- exports.getBorderPanelLabel = getBorderPanelLabel;
12
11
  exports.getMultiOriginColor = void 0;
13
12
  exports.hasBorderSupport = hasBorderSupport;
14
13
  exports.hasShadowSupport = hasShadowSupport;
15
14
  exports.removeBorderAttribute = removeBorderAttribute;
15
+ exports.useBorderPanelLabel = useBorderPanelLabel;
16
16
  var _react = require("react");
17
17
  var _classnames = _interopRequireDefault(require("classnames"));
18
18
  var _blocks = require("@wordpress/blocks");
@@ -217,14 +217,16 @@ function hasBorderSupport(blockName, feature = 'any') {
217
217
  function hasShadowSupport(blockName) {
218
218
  return (0, _blocks.hasBlockSupport)(blockName, SHADOW_SUPPORT_KEY);
219
219
  }
220
- function getBorderPanelLabel({
220
+ function useBorderPanelLabel({
221
221
  blockName,
222
222
  hasBorderControl,
223
223
  hasShadowControl
224
224
  } = {}) {
225
+ const settings = (0, _utils.useBlockSettings)(blockName);
226
+ const controls = (0, _globalStyles.useHasBorderPanelControls)(settings);
225
227
  if (!hasBorderControl && !hasShadowControl && blockName) {
226
- hasBorderControl = hasBorderSupport(blockName);
227
- hasShadowControl = hasShadowSupport(blockName);
228
+ hasBorderControl = controls?.hasBorderColor || controls?.hasBorderStyle || controls?.hasBorderWidth || controls?.hasBorderRadius;
229
+ hasShadowControl = controls?.hasShadow;
228
230
  }
229
231
  if (hasBorderControl && hasShadowControl) {
230
232
  return (0, _i18n.__)('Border & Shadow');
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_blocks","_components","_element","_hooks","_data","_colors","_inspectorControls","_useMultipleOriginColorsAndGradients","_utils","_globalStyles","_store","_i18n","BORDER_SUPPORT_KEY","exports","SHADOW_SUPPORT_KEY","getColorByProperty","colors","property","value","matchedColor","some","origin","color","getMultiOriginColor","namedColor","customColor","colorObject","undefined","getColorSlugFromVariable","exec","styleToAttributes","style","hasSplitBorders","border","borderColor","borderColorValue","borderColorSlug","startsWith","substring","length","updatedStyle","cleanEmptyObject","attributesToStyle","attributes","BordersInspectorControl","label","children","resetAllFilter","attributesResetAllFilter","useCallback","existingStyle","_react","createElement","default","group","BorderPanel","clientId","name","setAttributes","settings","isEnabled","useHasBorderPanel","selector","select","blockEditorStore","getBlockAttributes","useSelect","useMemo","onChange","newStyle","defaultControls","getBlockSupport","as","panelId","hasBorderSupport","blockName","feature","Platform","OS","support","radius","width","hasShadowSupport","hasBlockSupport","getBorderPanelLabel","hasBorderControl","hasShadowControl","__","removeBorderAttribute","attribute","addAttributes","type","addSaveProps","props","blockNameOrType","shouldSkipSerialization","borderClasses","getBorderClasses","newClassName","classnames","className","borderColorClass","getColorClassName","useBlockProps","useMultipleOriginColorsAndGradients","borderTopColor","top","borderRightColor","right","borderBottomColor","bottom","borderLeftColor","left","extraStyles","_default","attributeKeys","hasSupport","addFilter"],"sources":["@wordpress/block-editor/src/hooks/border.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport, getBlockSupport } from '@wordpress/blocks';\nimport { __experimentalHasSplitBorders as hasSplitBorders } from '@wordpress/components';\nimport { Platform, useCallback, useMemo } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { getColorClassName } from '../components/colors';\nimport InspectorControls from '../components/inspector-controls';\nimport useMultipleOriginColorsAndGradients from '../components/colors-gradients/use-multiple-origin-colors-and-gradients';\nimport { cleanEmptyObject, shouldSkipSerialization } from './utils';\nimport {\n\tuseHasBorderPanel,\n\tBorderPanel as StylesBorderPanel,\n} from '../components/global-styles';\nimport { store as blockEditorStore } from '../store';\nimport { __ } from '@wordpress/i18n';\n\nexport const BORDER_SUPPORT_KEY = '__experimentalBorder';\nexport const SHADOW_SUPPORT_KEY = 'shadow';\n\nconst getColorByProperty = ( colors, property, value ) => {\n\tlet matchedColor;\n\n\tcolors.some( ( origin ) =>\n\t\torigin.colors.some( ( color ) => {\n\t\t\tif ( color[ property ] === value ) {\n\t\t\t\tmatchedColor = color;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t} )\n\t);\n\n\treturn matchedColor;\n};\n\nexport const getMultiOriginColor = ( { colors, namedColor, customColor } ) => {\n\t// Search each origin (default, theme, or user) for matching color by name.\n\tif ( namedColor ) {\n\t\tconst colorObject = getColorByProperty( colors, 'slug', namedColor );\n\t\tif ( colorObject ) {\n\t\t\treturn colorObject;\n\t\t}\n\t}\n\n\t// Skip if no custom color or matching named color.\n\tif ( ! customColor ) {\n\t\treturn { color: undefined };\n\t}\n\n\t// Attempt to find color via custom color value or build new object.\n\tconst colorObject = getColorByProperty( colors, 'color', customColor );\n\treturn colorObject ? colorObject : { color: customColor };\n};\n\nfunction getColorSlugFromVariable( value ) {\n\tconst namedColor = /var:preset\\|color\\|(.+)/.exec( value );\n\tif ( namedColor && namedColor[ 1 ] ) {\n\t\treturn namedColor[ 1 ];\n\t}\n\treturn null;\n}\n\nfunction styleToAttributes( style ) {\n\tif ( hasSplitBorders( style?.border ) ) {\n\t\treturn {\n\t\t\tstyle,\n\t\t\tborderColor: undefined,\n\t\t};\n\t}\n\n\tconst borderColorValue = style?.border?.color;\n\tconst borderColorSlug = borderColorValue?.startsWith( 'var:preset|color|' )\n\t\t? borderColorValue.substring( 'var:preset|color|'.length )\n\t\t: undefined;\n\tconst updatedStyle = { ...style };\n\tupdatedStyle.border = {\n\t\t...updatedStyle.border,\n\t\tcolor: borderColorSlug ? undefined : borderColorValue,\n\t};\n\treturn {\n\t\tstyle: cleanEmptyObject( updatedStyle ),\n\t\tborderColor: borderColorSlug,\n\t};\n}\n\nfunction attributesToStyle( attributes ) {\n\tif ( hasSplitBorders( attributes.style?.border ) ) {\n\t\treturn attributes.style;\n\t}\n\treturn {\n\t\t...attributes.style,\n\t\tborder: {\n\t\t\t...attributes.style?.border,\n\t\t\tcolor: attributes.borderColor\n\t\t\t\t? 'var:preset|color|' + attributes.borderColor\n\t\t\t\t: attributes.style?.border?.color,\n\t\t},\n\t};\n}\n\nfunction BordersInspectorControl( { label, children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributesToStyle( attributes );\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\t...styleToAttributes( updatedStyle ),\n\t\t\t};\n\t\t},\n\t\t[ resetAllFilter ]\n\t);\n\n\treturn (\n\t\t<InspectorControls\n\t\t\tgroup=\"border\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t\tlabel={ label }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function BorderPanel( { clientId, name, setAttributes, settings } ) {\n\tconst isEnabled = useHasBorderPanel( settings );\n\tfunction selector( select ) {\n\t\tconst { style, borderColor } =\n\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId ) || {};\n\t\treturn { style, borderColor };\n\t}\n\tconst { style, borderColor } = useSelect( selector, [ clientId ] );\n\tconst value = useMemo( () => {\n\t\treturn attributesToStyle( { style, borderColor } );\n\t}, [ style, borderColor ] );\n\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( styleToAttributes( newStyle ) );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultControls = {\n\t\t...getBlockSupport( name, [\n\t\t\tBORDER_SUPPORT_KEY,\n\t\t\t'__experimentalDefaultControls',\n\t\t] ),\n\t\t...getBlockSupport( name, [\n\t\t\tSHADOW_SUPPORT_KEY,\n\t\t\t'__experimentalDefaultControls',\n\t\t] ),\n\t};\n\n\treturn (\n\t\t<StylesBorderPanel\n\t\t\tas={ BordersInspectorControl }\n\t\t\tpanelId={ clientId }\n\t\t\tsettings={ settings }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tdefaultControls={ defaultControls }\n\t\t/>\n\t);\n}\n\n/**\n * Determine whether there is block support for border properties.\n *\n * @param {string} blockName Block name.\n * @param {string} feature Border feature to check support for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasBorderSupport( blockName, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( blockName, BORDER_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn !! (\n\t\t\tsupport?.color ||\n\t\t\tsupport?.radius ||\n\t\t\tsupport?.width ||\n\t\t\tsupport?.style\n\t\t);\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\n/**\n * Determine whether there is block support for shadow properties.\n *\n * @param {string} blockName Block name.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasShadowSupport( blockName ) {\n\treturn hasBlockSupport( blockName, SHADOW_SUPPORT_KEY );\n}\n\nexport function getBorderPanelLabel( {\n\tblockName,\n\thasBorderControl,\n\thasShadowControl,\n} = {} ) {\n\tif ( ! hasBorderControl && ! hasShadowControl && blockName ) {\n\t\thasBorderControl = hasBorderSupport( blockName );\n\t\thasShadowControl = hasShadowSupport( blockName );\n\t}\n\n\tif ( hasBorderControl && hasShadowControl ) {\n\t\treturn __( 'Border & Shadow' );\n\t}\n\n\tif ( hasShadowControl ) {\n\t\treturn __( 'Shadow' );\n\t}\n\n\treturn __( 'Border' );\n}\n\n/**\n * Returns a new style object where the specified border attribute has been\n * removed.\n *\n * @param {Object} style Styles from block attributes.\n * @param {string} attribute The border style attribute to clear.\n *\n * @return {Object} Style object with the specified attribute removed.\n */\nexport function removeBorderAttribute( style, attribute ) {\n\treturn cleanEmptyObject( {\n\t\t...style,\n\t\tborder: {\n\t\t\t...style?.border,\n\t\t\t[ attribute ]: undefined,\n\t\t},\n\t} );\n}\n\n/**\n * Filters registered block settings, extending attributes to include\n * `borderColor` if needed.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Updated block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBorderSupport( settings, 'color' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify default value if needed.\n\tif ( settings.attributes.borderColor ) {\n\t\treturn settings;\n\t}\n\n\t// Add new borderColor attribute to block settings.\n\treturn {\n\t\t...settings,\n\t\tattributes: {\n\t\t\t...settings.attributes,\n\t\t\tborderColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t},\n\t};\n}\n\n/**\n * Override props assigned to save component to inject border color.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object|string} blockNameOrType Block type definition.\n * @param {Object} attributes Block's attributes.\n *\n * @return {Object} Filtered props to apply to save element.\n */\nfunction addSaveProps( props, blockNameOrType, attributes ) {\n\tif (\n\t\t! hasBorderSupport( blockNameOrType, 'color' ) ||\n\t\tshouldSkipSerialization( blockNameOrType, BORDER_SUPPORT_KEY, 'color' )\n\t) {\n\t\treturn props;\n\t}\n\n\tconst borderClasses = getBorderClasses( attributes );\n\tconst newClassName = classnames( props.className, borderClasses );\n\n\t// If we are clearing the last of the previous classes in `className`\n\t// set it to `undefined` to avoid rendering empty DOM attributes.\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Generates a CSS class name consisting of all the applicable border color\n * classes given the current block attributes.\n *\n * @param {Object} attributes Block's attributes.\n *\n * @return {string} CSS class name.\n */\nexport function getBorderClasses( attributes ) {\n\tconst { borderColor, style } = attributes;\n\tconst borderColorClass = getColorClassName( 'border-color', borderColor );\n\n\treturn classnames( {\n\t\t'has-border-color': borderColor || style?.border?.color,\n\t\t[ borderColorClass ]: !! borderColorClass,\n\t} );\n}\n\nfunction useBlockProps( { name, borderColor, style } ) {\n\tconst { colors } = useMultipleOriginColorsAndGradients();\n\n\tif (\n\t\t! hasBorderSupport( name, 'color' ) ||\n\t\tshouldSkipSerialization( name, BORDER_SUPPORT_KEY, 'color' )\n\t) {\n\t\treturn {};\n\t}\n\n\tconst { color: borderColorValue } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: borderColor,\n\t} );\n\tconst { color: borderTopColor } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: getColorSlugFromVariable( style?.border?.top?.color ),\n\t} );\n\tconst { color: borderRightColor } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: getColorSlugFromVariable( style?.border?.right?.color ),\n\t} );\n\n\tconst { color: borderBottomColor } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: getColorSlugFromVariable( style?.border?.bottom?.color ),\n\t} );\n\tconst { color: borderLeftColor } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: getColorSlugFromVariable( style?.border?.left?.color ),\n\t} );\n\n\tconst extraStyles = {\n\t\tborderTopColor: borderTopColor || borderColorValue,\n\t\tborderRightColor: borderRightColor || borderColorValue,\n\t\tborderBottomColor: borderBottomColor || borderColorValue,\n\t\tborderLeftColor: borderLeftColor || borderColorValue,\n\t};\n\n\treturn addSaveProps(\n\t\t{ style: cleanEmptyObject( extraStyles ) || {} },\n\t\tname,\n\t\t{ borderColor, style }\n\t);\n}\n\nexport default {\n\tuseBlockProps,\n\taddSaveProps,\n\tattributeKeys: [ 'borderColor', 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBorderSupport( name, 'color' );\n\t},\n};\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/border/addAttributes',\n\taddAttributes\n);\n"],"mappings":";;;;;;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,G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,IAAIxE,gBAAgB;IACtD0E,iBAAiB,EAAEA,iBAAiB,IAAI1E,gBAAgB;IACxD4E,eAAe,EAAEA,eAAe,IAAI5E;EACrC,CAAC;EAED,OAAOyD,YAAY,CAClB;IAAE7D,KAAK,EAAE,IAAAU,uBAAgB,EAAEwE,WAAY,CAAC,IAAI,CAAC;EAAE,CAAC,EAChDxD,IAAI,EACJ;IAAEvB,WAAW;IAAEH;EAAM,CACtB,CAAC;AACF;AAAC,IAAAmF,QAAA,GAAArG,OAAA,CAAAwC,OAAA,GAEc;EACdkD,aAAa;EACbX,YAAY;EACZuB,aAAa,EAAE,CAAE,aAAa,EAAE,OAAO,CAAE;EACzCC,UAAUA,CAAE3D,IAAI,EAAG;IAClB,OAAOiB,gBAAgB,CAAEjB,IAAI,EAAE,OAAQ,CAAC;EACzC;AACD,CAAC;AAED,IAAA4D,gBAAS,EACR,0BAA0B,EAC1B,2BAA2B,EAC3B3B,aACD,CAAC"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_blocks","_components","_element","_hooks","_data","_colors","_inspectorControls","_useMultipleOriginColorsAndGradients","_utils","_globalStyles","_store","_i18n","BORDER_SUPPORT_KEY","exports","SHADOW_SUPPORT_KEY","getColorByProperty","colors","property","value","matchedColor","some","origin","color","getMultiOriginColor","namedColor","customColor","colorObject","undefined","getColorSlugFromVariable","exec","styleToAttributes","style","hasSplitBorders","border","borderColor","borderColorValue","borderColorSlug","startsWith","substring","length","updatedStyle","cleanEmptyObject","attributesToStyle","attributes","BordersInspectorControl","label","children","resetAllFilter","attributesResetAllFilter","useCallback","existingStyle","_react","createElement","default","group","BorderPanel","clientId","name","setAttributes","settings","isEnabled","useHasBorderPanel","selector","select","blockEditorStore","getBlockAttributes","useSelect","useMemo","onChange","newStyle","defaultControls","getBlockSupport","as","panelId","hasBorderSupport","blockName","feature","Platform","OS","support","radius","width","hasShadowSupport","hasBlockSupport","useBorderPanelLabel","hasBorderControl","hasShadowControl","useBlockSettings","controls","useHasBorderPanelControls","hasBorderColor","hasBorderStyle","hasBorderWidth","hasBorderRadius","hasShadow","__","removeBorderAttribute","attribute","addAttributes","type","addSaveProps","props","blockNameOrType","shouldSkipSerialization","borderClasses","getBorderClasses","newClassName","classnames","className","borderColorClass","getColorClassName","useBlockProps","useMultipleOriginColorsAndGradients","borderTopColor","top","borderRightColor","right","borderBottomColor","bottom","borderLeftColor","left","extraStyles","_default","attributeKeys","hasSupport","addFilter"],"sources":["@wordpress/block-editor/src/hooks/border.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport, getBlockSupport } from '@wordpress/blocks';\nimport { __experimentalHasSplitBorders as hasSplitBorders } from '@wordpress/components';\nimport { Platform, useCallback, useMemo } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { getColorClassName } from '../components/colors';\nimport InspectorControls from '../components/inspector-controls';\nimport useMultipleOriginColorsAndGradients from '../components/colors-gradients/use-multiple-origin-colors-and-gradients';\nimport {\n\tcleanEmptyObject,\n\tshouldSkipSerialization,\n\tuseBlockSettings,\n} from './utils';\nimport {\n\tuseHasBorderPanel,\n\tuseHasBorderPanelControls,\n\tBorderPanel as StylesBorderPanel,\n} from '../components/global-styles';\nimport { store as blockEditorStore } from '../store';\nimport { __ } from '@wordpress/i18n';\n\nexport const BORDER_SUPPORT_KEY = '__experimentalBorder';\nexport const SHADOW_SUPPORT_KEY = 'shadow';\n\nconst getColorByProperty = ( colors, property, value ) => {\n\tlet matchedColor;\n\n\tcolors.some( ( origin ) =>\n\t\torigin.colors.some( ( color ) => {\n\t\t\tif ( color[ property ] === value ) {\n\t\t\t\tmatchedColor = color;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t} )\n\t);\n\n\treturn matchedColor;\n};\n\nexport const getMultiOriginColor = ( { colors, namedColor, customColor } ) => {\n\t// Search each origin (default, theme, or user) for matching color by name.\n\tif ( namedColor ) {\n\t\tconst colorObject = getColorByProperty( colors, 'slug', namedColor );\n\t\tif ( colorObject ) {\n\t\t\treturn colorObject;\n\t\t}\n\t}\n\n\t// Skip if no custom color or matching named color.\n\tif ( ! customColor ) {\n\t\treturn { color: undefined };\n\t}\n\n\t// Attempt to find color via custom color value or build new object.\n\tconst colorObject = getColorByProperty( colors, 'color', customColor );\n\treturn colorObject ? colorObject : { color: customColor };\n};\n\nfunction getColorSlugFromVariable( value ) {\n\tconst namedColor = /var:preset\\|color\\|(.+)/.exec( value );\n\tif ( namedColor && namedColor[ 1 ] ) {\n\t\treturn namedColor[ 1 ];\n\t}\n\treturn null;\n}\n\nfunction styleToAttributes( style ) {\n\tif ( hasSplitBorders( style?.border ) ) {\n\t\treturn {\n\t\t\tstyle,\n\t\t\tborderColor: undefined,\n\t\t};\n\t}\n\n\tconst borderColorValue = style?.border?.color;\n\tconst borderColorSlug = borderColorValue?.startsWith( 'var:preset|color|' )\n\t\t? borderColorValue.substring( 'var:preset|color|'.length )\n\t\t: undefined;\n\tconst updatedStyle = { ...style };\n\tupdatedStyle.border = {\n\t\t...updatedStyle.border,\n\t\tcolor: borderColorSlug ? undefined : borderColorValue,\n\t};\n\treturn {\n\t\tstyle: cleanEmptyObject( updatedStyle ),\n\t\tborderColor: borderColorSlug,\n\t};\n}\n\nfunction attributesToStyle( attributes ) {\n\tif ( hasSplitBorders( attributes.style?.border ) ) {\n\t\treturn attributes.style;\n\t}\n\treturn {\n\t\t...attributes.style,\n\t\tborder: {\n\t\t\t...attributes.style?.border,\n\t\t\tcolor: attributes.borderColor\n\t\t\t\t? 'var:preset|color|' + attributes.borderColor\n\t\t\t\t: attributes.style?.border?.color,\n\t\t},\n\t};\n}\n\nfunction BordersInspectorControl( { label, children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributesToStyle( attributes );\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\t...styleToAttributes( updatedStyle ),\n\t\t\t};\n\t\t},\n\t\t[ resetAllFilter ]\n\t);\n\n\treturn (\n\t\t<InspectorControls\n\t\t\tgroup=\"border\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t\tlabel={ label }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function BorderPanel( { clientId, name, setAttributes, settings } ) {\n\tconst isEnabled = useHasBorderPanel( settings );\n\tfunction selector( select ) {\n\t\tconst { style, borderColor } =\n\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId ) || {};\n\t\treturn { style, borderColor };\n\t}\n\tconst { style, borderColor } = useSelect( selector, [ clientId ] );\n\tconst value = useMemo( () => {\n\t\treturn attributesToStyle( { style, borderColor } );\n\t}, [ style, borderColor ] );\n\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( styleToAttributes( newStyle ) );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultControls = {\n\t\t...getBlockSupport( name, [\n\t\t\tBORDER_SUPPORT_KEY,\n\t\t\t'__experimentalDefaultControls',\n\t\t] ),\n\t\t...getBlockSupport( name, [\n\t\t\tSHADOW_SUPPORT_KEY,\n\t\t\t'__experimentalDefaultControls',\n\t\t] ),\n\t};\n\n\treturn (\n\t\t<StylesBorderPanel\n\t\t\tas={ BordersInspectorControl }\n\t\t\tpanelId={ clientId }\n\t\t\tsettings={ settings }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tdefaultControls={ defaultControls }\n\t\t/>\n\t);\n}\n\n/**\n * Determine whether there is block support for border properties.\n *\n * @param {string} blockName Block name.\n * @param {string} feature Border feature to check support for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasBorderSupport( blockName, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( blockName, BORDER_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn !! (\n\t\t\tsupport?.color ||\n\t\t\tsupport?.radius ||\n\t\t\tsupport?.width ||\n\t\t\tsupport?.style\n\t\t);\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\n/**\n * Determine whether there is block support for shadow properties.\n *\n * @param {string} blockName Block name.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasShadowSupport( blockName ) {\n\treturn hasBlockSupport( blockName, SHADOW_SUPPORT_KEY );\n}\n\nexport function useBorderPanelLabel( {\n\tblockName,\n\thasBorderControl,\n\thasShadowControl,\n} = {} ) {\n\tconst settings = useBlockSettings( blockName );\n\tconst controls = useHasBorderPanelControls( settings );\n\n\tif ( ! hasBorderControl && ! hasShadowControl && blockName ) {\n\t\thasBorderControl =\n\t\t\tcontrols?.hasBorderColor ||\n\t\t\tcontrols?.hasBorderStyle ||\n\t\t\tcontrols?.hasBorderWidth ||\n\t\t\tcontrols?.hasBorderRadius;\n\t\thasShadowControl = controls?.hasShadow;\n\t}\n\n\tif ( hasBorderControl && hasShadowControl ) {\n\t\treturn __( 'Border & Shadow' );\n\t}\n\n\tif ( hasShadowControl ) {\n\t\treturn __( 'Shadow' );\n\t}\n\n\treturn __( 'Border' );\n}\n\n/**\n * Returns a new style object where the specified border attribute has been\n * removed.\n *\n * @param {Object} style Styles from block attributes.\n * @param {string} attribute The border style attribute to clear.\n *\n * @return {Object} Style object with the specified attribute removed.\n */\nexport function removeBorderAttribute( style, attribute ) {\n\treturn cleanEmptyObject( {\n\t\t...style,\n\t\tborder: {\n\t\t\t...style?.border,\n\t\t\t[ attribute ]: undefined,\n\t\t},\n\t} );\n}\n\n/**\n * Filters registered block settings, extending attributes to include\n * `borderColor` if needed.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Updated block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBorderSupport( settings, 'color' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify default value if needed.\n\tif ( settings.attributes.borderColor ) {\n\t\treturn settings;\n\t}\n\n\t// Add new borderColor attribute to block settings.\n\treturn {\n\t\t...settings,\n\t\tattributes: {\n\t\t\t...settings.attributes,\n\t\t\tborderColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t},\n\t};\n}\n\n/**\n * Override props assigned to save component to inject border color.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object|string} blockNameOrType Block type definition.\n * @param {Object} attributes Block's attributes.\n *\n * @return {Object} Filtered props to apply to save element.\n */\nfunction addSaveProps( props, blockNameOrType, attributes ) {\n\tif (\n\t\t! hasBorderSupport( blockNameOrType, 'color' ) ||\n\t\tshouldSkipSerialization( blockNameOrType, BORDER_SUPPORT_KEY, 'color' )\n\t) {\n\t\treturn props;\n\t}\n\n\tconst borderClasses = getBorderClasses( attributes );\n\tconst newClassName = classnames( props.className, borderClasses );\n\n\t// If we are clearing the last of the previous classes in `className`\n\t// set it to `undefined` to avoid rendering empty DOM attributes.\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Generates a CSS class name consisting of all the applicable border color\n * classes given the current block attributes.\n *\n * @param {Object} attributes Block's attributes.\n *\n * @return {string} CSS class name.\n */\nexport function getBorderClasses( attributes ) {\n\tconst { borderColor, style } = attributes;\n\tconst borderColorClass = getColorClassName( 'border-color', borderColor );\n\n\treturn classnames( {\n\t\t'has-border-color': borderColor || style?.border?.color,\n\t\t[ borderColorClass ]: !! borderColorClass,\n\t} );\n}\n\nfunction useBlockProps( { name, borderColor, style } ) {\n\tconst { colors } = useMultipleOriginColorsAndGradients();\n\n\tif (\n\t\t! hasBorderSupport( name, 'color' ) ||\n\t\tshouldSkipSerialization( name, BORDER_SUPPORT_KEY, 'color' )\n\t) {\n\t\treturn {};\n\t}\n\n\tconst { color: borderColorValue } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: borderColor,\n\t} );\n\tconst { color: borderTopColor } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: getColorSlugFromVariable( style?.border?.top?.color ),\n\t} );\n\tconst { color: borderRightColor } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: getColorSlugFromVariable( style?.border?.right?.color ),\n\t} );\n\n\tconst { color: borderBottomColor } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: getColorSlugFromVariable( style?.border?.bottom?.color ),\n\t} );\n\tconst { color: borderLeftColor } = getMultiOriginColor( {\n\t\tcolors,\n\t\tnamedColor: getColorSlugFromVariable( style?.border?.left?.color ),\n\t} );\n\n\tconst extraStyles = {\n\t\tborderTopColor: borderTopColor || borderColorValue,\n\t\tborderRightColor: borderRightColor || borderColorValue,\n\t\tborderBottomColor: borderBottomColor || borderColorValue,\n\t\tborderLeftColor: borderLeftColor || borderColorValue,\n\t};\n\n\treturn addSaveProps(\n\t\t{ style: cleanEmptyObject( extraStyles ) || {} },\n\t\tname,\n\t\t{ borderColor, style }\n\t);\n}\n\nexport default {\n\tuseBlockProps,\n\taddSaveProps,\n\tattributeKeys: [ 'borderColor', 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBorderSupport( name, 'color' );\n\t},\n};\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/border/addAttributes',\n\taddAttributes\n);\n"],"mappings":";;;;;;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,kBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,oCAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,M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AgB;IACtDkF,iBAAiB,EAAEA,iBAAiB,IAAIlF,gBAAgB;IACxDoF,eAAe,EAAEA,eAAe,IAAIpF;EACrC,CAAC;EAED,OAAOiE,YAAY,CAClB;IAAErE,KAAK,EAAE,IAAAU,uBAAgB,EAAEgF,WAAY,CAAC,IAAI,CAAC;EAAE,CAAC,EAChDhE,IAAI,EACJ;IAAEvB,WAAW;IAAEH;EAAM,CACtB,CAAC;AACF;AAAC,IAAA2F,QAAA,GAAA7G,OAAA,CAAAwC,OAAA,GAEc;EACd0D,aAAa;EACbX,YAAY;EACZuB,aAAa,EAAE,CAAE,aAAa,EAAE,OAAO,CAAE;EACzCC,UAAUA,CAAEnE,IAAI,EAAG;IAClB,OAAOiB,gBAAgB,CAAEjB,IAAI,EAAE,OAAQ,CAAC;EACzC;AACD,CAAC;AAED,IAAAoE,gBAAS,EACR,0BAA0B,EAC1B,2BAA2B,EAC3B3B,aACD,CAAC"}
@@ -17,8 +17,7 @@ var _blocks = require("@wordpress/blocks");
17
17
  var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
18
18
  var _inspectorControls = _interopRequireDefault(require("../components/inspector-controls"));
19
19
  var _globalStyles = require("../components/global-styles");
20
- var _margin = require("./margin");
21
- var _padding = require("./padding");
20
+ var _spacingVisualizer = require("./spacing-visualizer");
22
21
  var _store = require("../store");
23
22
  var _lockUnlock = require("../lock-unlock");
24
23
  var _utils = require("./utils");
@@ -101,11 +100,11 @@ function DimensionsPanel({
101
100
  onChange: onChange,
102
101
  defaultControls: defaultControls,
103
102
  onVisualize: setVisualizedProperty
104
- }), !!settings?.spacing?.padding && (0, _react.createElement)(_padding.PaddingVisualizer, {
103
+ }), !!settings?.spacing?.padding && (0, _react.createElement)(_spacingVisualizer.PaddingVisualizer, {
105
104
  forceShow: visualizedProperty === 'padding',
106
105
  clientId: clientId,
107
106
  value: value
108
- }), !!settings?.spacing?.margin && (0, _react.createElement)(_margin.MarginVisualizer, {
107
+ }), !!settings?.spacing?.margin && (0, _react.createElement)(_spacingVisualizer.MarginVisualizer, {
109
108
  forceShow: visualizedProperty === 'margin',
110
109
  clientId: clientId,
111
110
  value: value