@wordpress/block-editor 13.4.0 → 14.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (533) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +20 -15
  3. package/build/autocompleters/block.js +1 -1
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/components/block-breadcrumb/index.js +3 -1
  6. package/build/components/block-breadcrumb/index.js.map +1 -1
  7. package/build/components/block-draggable/index.js +2 -2
  8. package/build/components/block-draggable/index.js.map +1 -1
  9. package/build/components/block-list/use-block-props/index.js +2 -2
  10. package/build/components/block-list/use-block-props/index.js.map +1 -1
  11. package/build/components/block-list/use-block-props/use-block-refs.js +24 -32
  12. package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
  13. package/build/components/block-list/use-in-between-inserter.js +11 -4
  14. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  15. package/build/components/block-mover/index.js +1 -2
  16. package/build/components/block-mover/index.js.map +1 -1
  17. package/build/components/block-popover/cover.js +1 -1
  18. package/build/components/block-popover/cover.js.map +1 -1
  19. package/build/components/block-popover/inbetween.js +2 -2
  20. package/build/components/block-popover/inbetween.js.map +1 -1
  21. package/build/components/block-popover/index.js +2 -2
  22. package/build/components/block-popover/index.js.map +1 -1
  23. package/build/components/block-settings-menu/block-mode-toggle.js +28 -34
  24. package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  25. package/build/components/block-tools/block-selection-button.js +1 -2
  26. package/build/components/block-tools/block-selection-button.js.map +1 -1
  27. package/build/components/block-tools/index.js +1 -1
  28. package/build/components/block-tools/index.js.map +1 -1
  29. package/build/components/block-tools/insertion-point.js +14 -3
  30. package/build/components/block-tools/insertion-point.js.map +1 -1
  31. package/build/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  32. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  33. package/build/components/block-tools/use-show-block-tools.js +2 -1
  34. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  35. package/build/components/block-tools/zoom-out-mode-inserters.js +22 -19
  36. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  37. package/build/components/block-tools/zoom-out-toolbar.js +0 -1
  38. package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
  39. package/build/components/border-radius-control/index.js +1 -0
  40. package/build/components/border-radius-control/index.js.map +1 -1
  41. package/build/components/child-layout-control/index.js +3 -1
  42. package/build/components/child-layout-control/index.js.map +1 -1
  43. package/build/components/convert-to-group-buttons/index.js +1 -1
  44. package/build/components/convert-to-group-buttons/index.js.map +1 -1
  45. package/build/components/date-format-picker/index.js +2 -0
  46. package/build/components/date-format-picker/index.js.map +1 -1
  47. package/build/components/dimensions-tool/scale-tool.js +1 -0
  48. package/build/components/dimensions-tool/scale-tool.js.map +1 -1
  49. package/build/components/font-appearance-control/index.js +3 -0
  50. package/build/components/font-appearance-control/index.js.map +1 -1
  51. package/build/components/font-family/index.js +15 -0
  52. package/build/components/font-family/index.js.map +1 -1
  53. package/build/components/global-styles/background-panel.js +153 -77
  54. package/build/components/global-styles/background-panel.js.map +1 -1
  55. package/build/components/global-styles/get-global-styles-changes.js +3 -1
  56. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  57. package/build/components/global-styles/hooks.js +0 -7
  58. package/build/components/global-styles/hooks.js.map +1 -1
  59. package/build/components/global-styles/image-settings-panel.js +1 -0
  60. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  61. package/build/components/global-styles/index.js +0 -6
  62. package/build/components/global-styles/index.js.map +1 -1
  63. package/build/components/global-styles/typography-panel.js +0 -1
  64. package/build/components/global-styles/typography-panel.js.map +1 -1
  65. package/build/components/global-styles/use-global-styles-output.js +59 -40
  66. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  67. package/build/components/global-styles/utils.js +80 -0
  68. package/build/components/global-styles/utils.js.map +1 -1
  69. package/build/components/grid/grid-item-movers.js +30 -26
  70. package/build/components/grid/grid-item-movers.js.map +1 -1
  71. package/build/components/grid/grid-item-resizer.js +14 -15
  72. package/build/components/grid/grid-item-resizer.js.map +1 -1
  73. package/build/components/grid/grid-visualizer.js +21 -6
  74. package/build/components/grid/grid-visualizer.js.map +1 -1
  75. package/build/components/grid/use-grid-layout-sync.js +56 -20
  76. package/build/components/grid/use-grid-layout-sync.js.map +1 -1
  77. package/build/components/height-control/index.js +1 -0
  78. package/build/components/height-control/index.js.map +1 -1
  79. package/build/components/iframe/index.js +2 -4
  80. package/build/components/iframe/index.js.map +1 -1
  81. package/build/components/image-editor/zoom-dropdown.js +11 -7
  82. package/build/components/image-editor/zoom-dropdown.js.map +1 -1
  83. package/build/components/inner-blocks/button-block-appender.js +8 -8
  84. package/build/components/inner-blocks/button-block-appender.js.map +1 -1
  85. package/build/components/inner-blocks/default-block-appender.js +7 -25
  86. package/build/components/inner-blocks/default-block-appender.js.map +1 -1
  87. package/build/components/inner-blocks/index.js +9 -11
  88. package/build/components/inner-blocks/index.js.map +1 -1
  89. package/build/components/inserter/category-tabs/index.js +29 -2
  90. package/build/components/inserter/category-tabs/index.js.map +1 -1
  91. package/build/components/inserter/library.js +4 -2
  92. package/build/components/inserter/library.js.map +1 -1
  93. package/build/components/inserter/menu.js +32 -14
  94. package/build/components/inserter/menu.js.map +1 -1
  95. package/build/components/inserter/quick-inserter.js +4 -0
  96. package/build/components/inserter/quick-inserter.js.map +1 -1
  97. package/build/components/line-height-control/index.js +3 -15
  98. package/build/components/line-height-control/index.js.map +1 -1
  99. package/build/components/link-control/search-input.js +0 -1
  100. package/build/components/link-control/search-input.js.map +1 -1
  101. package/build/components/media-placeholder/index.js +9 -4
  102. package/build/components/media-placeholder/index.js.map +1 -1
  103. package/build/components/media-replace-flow/index.js +3 -1
  104. package/build/components/media-replace-flow/index.js.map +1 -1
  105. package/build/components/media-upload/index.native.js +4 -1
  106. package/build/components/media-upload/index.native.js.map +1 -1
  107. package/build/components/multi-selection-inspector/index.js +12 -12
  108. package/build/components/multi-selection-inspector/index.js.map +1 -1
  109. package/build/components/resolution-tool/index.js +1 -0
  110. package/build/components/resolution-tool/index.js.map +1 -1
  111. package/build/components/skip-to-selected-block/index.js +4 -2
  112. package/build/components/skip-to-selected-block/index.js.map +1 -1
  113. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -8
  114. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  115. package/build/components/text-alignment-control/index.js +13 -8
  116. package/build/components/text-alignment-control/index.js.map +1 -1
  117. package/build/components/text-decoration-control/index.js +13 -8
  118. package/build/components/text-decoration-control/index.js.map +1 -1
  119. package/build/components/text-transform-control/index.js +13 -8
  120. package/build/components/text-transform-control/index.js.map +1 -1
  121. package/build/components/url-input/button.js +0 -1
  122. package/build/components/url-input/button.js.map +1 -1
  123. package/build/components/url-input/index.js +1 -11
  124. package/build/components/url-input/index.js.map +1 -1
  125. package/build/components/url-popover/image-url-input-ui.js +2 -0
  126. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  127. package/build/components/url-popover/link-editor.js +0 -1
  128. package/build/components/url-popover/link-editor.js.map +1 -1
  129. package/build/components/use-block-drop-zone/index.js +42 -4
  130. package/build/components/use-block-drop-zone/index.js.map +1 -1
  131. package/build/components/use-on-block-drop/index.js +3 -6
  132. package/build/components/use-on-block-drop/index.js.map +1 -1
  133. package/build/components/use-resize-canvas/index.js +1 -3
  134. package/build/components/use-resize-canvas/index.js.map +1 -1
  135. package/build/components/use-settings/index.js +2 -1
  136. package/build/components/use-settings/index.js.map +1 -1
  137. package/build/components/writing-mode-control/index.js +13 -8
  138. package/build/components/writing-mode-control/index.js.map +1 -1
  139. package/build/hooks/background.js +19 -23
  140. package/build/hooks/background.js.map +1 -1
  141. package/build/hooks/block-bindings.js +209 -39
  142. package/build/hooks/block-bindings.js.map +1 -1
  143. package/build/hooks/block-hooks.js +1 -0
  144. package/build/hooks/block-hooks.js.map +1 -1
  145. package/build/hooks/block-style-variation.js +2 -2
  146. package/build/hooks/block-style-variation.js.map +1 -1
  147. package/build/hooks/contrast-checker.js +6 -6
  148. package/build/hooks/contrast-checker.js.map +1 -1
  149. package/build/hooks/duotone.js +3 -3
  150. package/build/hooks/duotone.js.map +1 -1
  151. package/build/hooks/index.js +7 -1
  152. package/build/hooks/index.js.map +1 -1
  153. package/build/hooks/line-height.js +0 -1
  154. package/build/hooks/line-height.js.map +1 -1
  155. package/build/hooks/spacing-visualizer.js +1 -1
  156. package/build/hooks/spacing-visualizer.js.map +1 -1
  157. package/build/hooks/use-bindings-attributes.js +4 -0
  158. package/build/hooks/use-bindings-attributes.js.map +1 -1
  159. package/build/hooks/use-zoom-out.js +1 -1
  160. package/build/hooks/use-zoom-out.js.map +1 -1
  161. package/build/hooks/utils.js +20 -0
  162. package/build/hooks/utils.js.map +1 -1
  163. package/build/index.js +7 -0
  164. package/build/index.js.map +1 -1
  165. package/build/layouts/constrained.js +1 -0
  166. package/build/layouts/constrained.js.map +1 -1
  167. package/build/layouts/flex.js +2 -0
  168. package/build/layouts/flex.js.map +1 -1
  169. package/build/layouts/grid.js +3 -0
  170. package/build/layouts/grid.js.map +1 -1
  171. package/build/private-apis.js +3 -2
  172. package/build/private-apis.js.map +1 -1
  173. package/build/store/actions.js +9 -1
  174. package/build/store/actions.js.map +1 -1
  175. package/build/store/private-selectors.js +30 -0
  176. package/build/store/private-selectors.js.map +1 -1
  177. package/build/store/reducer.js +10 -1
  178. package/build/store/reducer.js.map +1 -1
  179. package/build/store/selectors.js +4 -4
  180. package/build/store/selectors.js.map +1 -1
  181. package/build/utils/block-bindings.js +112 -0
  182. package/build/utils/block-bindings.js.map +1 -0
  183. package/build/utils/get-editor-region.js +1 -1
  184. package/build/utils/get-editor-region.js.map +1 -1
  185. package/build/utils/get-px-from-css-unit.js +1 -1
  186. package/build/utils/get-px-from-css-unit.js.map +1 -1
  187. package/build-module/autocompleters/block.js +1 -1
  188. package/build-module/autocompleters/block.js.map +1 -1
  189. package/build-module/components/block-breadcrumb/index.js +4 -2
  190. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  191. package/build-module/components/block-draggable/index.js +3 -3
  192. package/build-module/components/block-draggable/index.js.map +1 -1
  193. package/build-module/components/block-list/use-block-props/index.js +2 -2
  194. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  195. package/build-module/components/block-list/use-block-props/use-block-refs.js +24 -34
  196. package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
  197. package/build-module/components/block-list/use-in-between-inserter.js +11 -4
  198. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  199. package/build-module/components/block-mover/index.js +1 -2
  200. package/build-module/components/block-mover/index.js.map +1 -1
  201. package/build-module/components/block-popover/cover.js +1 -1
  202. package/build-module/components/block-popover/cover.js.map +1 -1
  203. package/build-module/components/block-popover/inbetween.js +1 -1
  204. package/build-module/components/block-popover/inbetween.js.map +1 -1
  205. package/build-module/components/block-popover/index.js +1 -1
  206. package/build-module/components/block-popover/index.js.map +1 -1
  207. package/build-module/components/block-settings-menu/block-mode-toggle.js +29 -34
  208. package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  209. package/build-module/components/block-tools/block-selection-button.js +1 -2
  210. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  211. package/build-module/components/block-tools/index.js +1 -1
  212. package/build-module/components/block-tools/index.js.map +1 -1
  213. package/build-module/components/block-tools/insertion-point.js +14 -3
  214. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  215. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  216. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  217. package/build-module/components/block-tools/use-show-block-tools.js +2 -1
  218. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  219. package/build-module/components/block-tools/zoom-out-mode-inserters.js +23 -20
  220. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  221. package/build-module/components/block-tools/zoom-out-toolbar.js +0 -1
  222. package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
  223. package/build-module/components/border-radius-control/index.js +1 -0
  224. package/build-module/components/border-radius-control/index.js.map +1 -1
  225. package/build-module/components/child-layout-control/index.js +3 -1
  226. package/build-module/components/child-layout-control/index.js.map +1 -1
  227. package/build-module/components/convert-to-group-buttons/index.js +1 -1
  228. package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
  229. package/build-module/components/date-format-picker/index.js +2 -0
  230. package/build-module/components/date-format-picker/index.js.map +1 -1
  231. package/build-module/components/dimensions-tool/scale-tool.js +1 -0
  232. package/build-module/components/dimensions-tool/scale-tool.js.map +1 -1
  233. package/build-module/components/font-appearance-control/index.js +3 -0
  234. package/build-module/components/font-appearance-control/index.js.map +1 -1
  235. package/build-module/components/font-family/index.js +14 -0
  236. package/build-module/components/font-family/index.js.map +1 -1
  237. package/build-module/components/global-styles/background-panel.js +156 -80
  238. package/build-module/components/global-styles/background-panel.js.map +1 -1
  239. package/build-module/components/global-styles/get-global-styles-changes.js +3 -1
  240. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  241. package/build-module/components/global-styles/hooks.js +0 -6
  242. package/build-module/components/global-styles/hooks.js.map +1 -1
  243. package/build-module/components/global-styles/image-settings-panel.js +1 -0
  244. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  245. package/build-module/components/global-styles/index.js +1 -1
  246. package/build-module/components/global-styles/index.js.map +1 -1
  247. package/build-module/components/global-styles/typography-panel.js +0 -1
  248. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  249. package/build-module/components/global-styles/use-global-styles-output.js +61 -42
  250. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  251. package/build-module/components/global-styles/utils.js +77 -0
  252. package/build-module/components/global-styles/utils.js.map +1 -1
  253. package/build-module/components/grid/grid-item-movers.js +30 -26
  254. package/build-module/components/grid/grid-item-movers.js.map +1 -1
  255. package/build-module/components/grid/grid-item-resizer.js +14 -15
  256. package/build-module/components/grid/grid-item-resizer.js.map +1 -1
  257. package/build-module/components/grid/grid-visualizer.js +21 -6
  258. package/build-module/components/grid/grid-visualizer.js.map +1 -1
  259. package/build-module/components/grid/use-grid-layout-sync.js +56 -20
  260. package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
  261. package/build-module/components/height-control/index.js +1 -0
  262. package/build-module/components/height-control/index.js.map +1 -1
  263. package/build-module/components/iframe/index.js +2 -4
  264. package/build-module/components/iframe/index.js.map +1 -1
  265. package/build-module/components/image-editor/zoom-dropdown.js +12 -8
  266. package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
  267. package/build-module/components/inner-blocks/button-block-appender.js +7 -6
  268. package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
  269. package/build-module/components/inner-blocks/default-block-appender.js +6 -23
  270. package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
  271. package/build-module/components/inner-blocks/index.js +9 -11
  272. package/build-module/components/inner-blocks/index.js.map +1 -1
  273. package/build-module/components/inserter/category-tabs/index.js +30 -3
  274. package/build-module/components/inserter/category-tabs/index.js.map +1 -1
  275. package/build-module/components/inserter/library.js +4 -2
  276. package/build-module/components/inserter/library.js.map +1 -1
  277. package/build-module/components/inserter/menu.js +32 -14
  278. package/build-module/components/inserter/menu.js.map +1 -1
  279. package/build-module/components/inserter/quick-inserter.js +5 -1
  280. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  281. package/build-module/components/line-height-control/index.js +3 -14
  282. package/build-module/components/line-height-control/index.js.map +1 -1
  283. package/build-module/components/link-control/search-input.js +0 -1
  284. package/build-module/components/link-control/search-input.js.map +1 -1
  285. package/build-module/components/media-placeholder/index.js +9 -4
  286. package/build-module/components/media-placeholder/index.js.map +1 -1
  287. package/build-module/components/media-replace-flow/index.js +3 -1
  288. package/build-module/components/media-replace-flow/index.js.map +1 -1
  289. package/build-module/components/media-upload/index.native.js +4 -1
  290. package/build-module/components/media-upload/index.native.js.map +1 -1
  291. package/build-module/components/multi-selection-inspector/index.js +12 -12
  292. package/build-module/components/multi-selection-inspector/index.js.map +1 -1
  293. package/build-module/components/resolution-tool/index.js +1 -0
  294. package/build-module/components/resolution-tool/index.js.map +1 -1
  295. package/build-module/components/skip-to-selected-block/index.js +5 -3
  296. package/build-module/components/skip-to-selected-block/index.js.map +1 -1
  297. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -8
  298. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  299. package/build-module/components/text-alignment-control/index.js +13 -8
  300. package/build-module/components/text-alignment-control/index.js.map +1 -1
  301. package/build-module/components/text-decoration-control/index.js +13 -8
  302. package/build-module/components/text-decoration-control/index.js.map +1 -1
  303. package/build-module/components/text-transform-control/index.js +13 -8
  304. package/build-module/components/text-transform-control/index.js.map +1 -1
  305. package/build-module/components/url-input/button.js +0 -1
  306. package/build-module/components/url-input/button.js.map +1 -1
  307. package/build-module/components/url-input/index.js +1 -11
  308. package/build-module/components/url-input/index.js.map +1 -1
  309. package/build-module/components/url-popover/image-url-input-ui.js +2 -0
  310. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  311. package/build-module/components/url-popover/link-editor.js +0 -1
  312. package/build-module/components/url-popover/link-editor.js.map +1 -1
  313. package/build-module/components/use-block-drop-zone/index.js +42 -4
  314. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  315. package/build-module/components/use-on-block-drop/index.js +3 -6
  316. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  317. package/build-module/components/use-resize-canvas/index.js +1 -3
  318. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  319. package/build-module/components/use-settings/index.js +2 -1
  320. package/build-module/components/use-settings/index.js.map +1 -1
  321. package/build-module/components/writing-mode-control/index.js +13 -8
  322. package/build-module/components/writing-mode-control/index.js.map +1 -1
  323. package/build-module/hooks/background.js +19 -23
  324. package/build-module/hooks/background.js.map +1 -1
  325. package/build-module/hooks/block-bindings.js +214 -43
  326. package/build-module/hooks/block-bindings.js.map +1 -1
  327. package/build-module/hooks/block-hooks.js +1 -0
  328. package/build-module/hooks/block-hooks.js.map +1 -1
  329. package/build-module/hooks/block-style-variation.js +3 -3
  330. package/build-module/hooks/block-style-variation.js.map +1 -1
  331. package/build-module/hooks/contrast-checker.js +7 -7
  332. package/build-module/hooks/contrast-checker.js.map +1 -1
  333. package/build-module/hooks/duotone.js +4 -4
  334. package/build-module/hooks/duotone.js.map +1 -1
  335. package/build-module/hooks/index.js +2 -1
  336. package/build-module/hooks/index.js.map +1 -1
  337. package/build-module/hooks/line-height.js +0 -1
  338. package/build-module/hooks/line-height.js.map +1 -1
  339. package/build-module/hooks/spacing-visualizer.js +1 -1
  340. package/build-module/hooks/spacing-visualizer.js.map +1 -1
  341. package/build-module/hooks/use-bindings-attributes.js +3 -0
  342. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  343. package/build-module/hooks/use-zoom-out.js +1 -1
  344. package/build-module/hooks/use-zoom-out.js.map +1 -1
  345. package/build-module/hooks/utils.js +19 -0
  346. package/build-module/hooks/utils.js.map +1 -1
  347. package/build-module/index.js +1 -1
  348. package/build-module/index.js.map +1 -1
  349. package/build-module/layouts/constrained.js +1 -0
  350. package/build-module/layouts/constrained.js.map +1 -1
  351. package/build-module/layouts/flex.js +2 -0
  352. package/build-module/layouts/flex.js.map +1 -1
  353. package/build-module/layouts/grid.js +3 -0
  354. package/build-module/layouts/grid.js.map +1 -1
  355. package/build-module/private-apis.js +4 -3
  356. package/build-module/private-apis.js.map +1 -1
  357. package/build-module/store/actions.js +9 -1
  358. package/build-module/store/actions.js.map +1 -1
  359. package/build-module/store/private-selectors.js +27 -0
  360. package/build-module/store/private-selectors.js.map +1 -1
  361. package/build-module/store/reducer.js +9 -1
  362. package/build-module/store/reducer.js.map +1 -1
  363. package/build-module/store/selectors.js +4 -4
  364. package/build-module/store/selectors.js.map +1 -1
  365. package/build-module/utils/block-bindings.js +105 -0
  366. package/build-module/utils/block-bindings.js.map +1 -0
  367. package/build-module/utils/get-editor-region.js +1 -1
  368. package/build-module/utils/get-editor-region.js.map +1 -1
  369. package/build-module/utils/get-px-from-css-unit.js +1 -1
  370. package/build-module/utils/get-px-from-css-unit.js.map +1 -1
  371. package/build-style/content-rtl.css +12 -26
  372. package/build-style/content.css +12 -26
  373. package/build-style/default-editor-styles-rtl.css +5 -2
  374. package/build-style/default-editor-styles.css +5 -2
  375. package/build-style/style-rtl.css +123 -83
  376. package/build-style/style.css +123 -83
  377. package/package.json +32 -32
  378. package/src/autocompleters/block.js +2 -1
  379. package/src/autocompleters/style.scss +4 -0
  380. package/src/components/block-breadcrumb/index.js +4 -2
  381. package/src/components/block-canvas/style.scss +1 -0
  382. package/src/components/block-draggable/index.js +3 -3
  383. package/src/components/block-list/content.scss +5 -13
  384. package/src/components/block-list/use-block-props/index.js +2 -2
  385. package/src/components/block-list/use-block-props/use-block-refs.js +27 -43
  386. package/src/components/block-list/use-in-between-inserter.js +17 -5
  387. package/src/components/block-mover/index.js +5 -2
  388. package/src/components/block-popover/cover.js +1 -1
  389. package/src/components/block-popover/inbetween.js +1 -1
  390. package/src/components/block-popover/index.js +1 -1
  391. package/src/components/block-settings-menu/block-mode-toggle.js +28 -31
  392. package/src/components/block-settings-menu/test/block-mode-toggle.js +26 -23
  393. package/src/components/block-tools/block-selection-button.js +1 -2
  394. package/src/components/block-tools/index.js +5 -6
  395. package/src/components/block-tools/insertion-point.js +11 -0
  396. package/src/components/block-tools/style.scss +1 -1
  397. package/src/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  398. package/src/components/block-tools/use-show-block-tools.js +4 -1
  399. package/src/components/block-tools/zoom-out-mode-inserters.js +21 -19
  400. package/src/components/block-tools/zoom-out-toolbar.js +0 -1
  401. package/src/components/block-variation-transforms/style.scss +1 -1
  402. package/src/components/border-radius-control/index.js +1 -0
  403. package/src/components/border-radius-control/style.scss +0 -10
  404. package/src/components/button-block-appender/content.scss +1 -1
  405. package/src/components/child-layout-control/index.js +2 -0
  406. package/src/components/color-palette/test/__snapshots__/control.js.snap +2 -2
  407. package/src/components/colors-gradients/test/control.js +3 -2
  408. package/src/components/convert-to-group-buttons/index.js +1 -1
  409. package/src/components/date-format-picker/index.js +2 -0
  410. package/src/components/dimensions-tool/scale-tool.js +1 -0
  411. package/src/components/font-appearance-control/index.js +3 -0
  412. package/src/components/font-family/README.md +17 -0
  413. package/src/components/font-family/index.js +19 -0
  414. package/src/components/font-family/stories/index.story.js +54 -0
  415. package/src/components/global-styles/background-panel.js +180 -93
  416. package/src/components/global-styles/get-global-styles-changes.js +4 -1
  417. package/src/components/global-styles/hooks.js +0 -5
  418. package/src/components/global-styles/image-settings-panel.js +1 -0
  419. package/src/components/global-styles/index.js +0 -1
  420. package/src/components/global-styles/style.scss +13 -12
  421. package/src/components/global-styles/test/use-global-styles-output.js +68 -7
  422. package/src/components/global-styles/test/utils.js +120 -0
  423. package/src/components/global-styles/typography-panel.js +0 -1
  424. package/src/components/global-styles/use-global-styles-output.js +71 -53
  425. package/src/components/global-styles/utils.js +90 -0
  426. package/src/components/grid/grid-item-movers.js +46 -44
  427. package/src/components/grid/grid-item-resizer.js +11 -17
  428. package/src/components/grid/grid-visualizer.js +23 -8
  429. package/src/components/grid/style.scss +60 -10
  430. package/src/components/grid/use-grid-layout-sync.js +68 -14
  431. package/src/components/height-control/index.js +1 -0
  432. package/src/components/iframe/content.scss +2 -2
  433. package/src/components/iframe/index.js +1 -3
  434. package/src/components/image-editor/zoom-dropdown.js +17 -9
  435. package/src/components/inner-blocks/button-block-appender.js +5 -7
  436. package/src/components/inner-blocks/default-block-appender.js +4 -23
  437. package/src/components/inner-blocks/index.js +10 -9
  438. package/src/components/inserter/category-tabs/index.js +35 -2
  439. package/src/components/inserter/library.js +2 -0
  440. package/src/components/inserter/menu.js +34 -29
  441. package/src/components/inserter/quick-inserter.js +4 -1
  442. package/src/components/inserter/style.scss +17 -12
  443. package/src/components/inserter-list-item/style.scss +1 -0
  444. package/src/components/inspector-controls/README.md +5 -0
  445. package/src/components/line-height-control/README.md +4 -5
  446. package/src/components/line-height-control/index.js +4 -21
  447. package/src/components/line-height-control/stories/index.story.js +0 -1
  448. package/src/components/line-height-control/test/index.js +1 -7
  449. package/src/components/link-control/search-input.js +0 -1
  450. package/src/components/link-control/style.scss +1 -1
  451. package/src/components/media-placeholder/index.js +12 -7
  452. package/src/components/media-replace-flow/README.md +7 -0
  453. package/src/components/media-replace-flow/index.js +3 -1
  454. package/src/components/media-upload/README.md +2 -0
  455. package/src/components/media-upload/index.native.js +2 -0
  456. package/src/components/multi-selection-inspector/index.js +8 -9
  457. package/src/components/resolution-tool/index.js +1 -0
  458. package/src/components/responsive-block-control/README.md +1 -0
  459. package/src/components/responsive-block-control/test/index.js +6 -1
  460. package/src/components/skip-to-selected-block/index.js +5 -3
  461. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +11 -10
  462. package/src/components/spacing-sizes-control/style.scss +16 -16
  463. package/src/components/tabbed-sidebar/style.scss +1 -19
  464. package/src/components/text-alignment-control/index.js +20 -8
  465. package/src/components/text-decoration-control/index.js +20 -8
  466. package/src/components/text-decoration-control/stories/index.story.js +0 -4
  467. package/src/components/text-transform-control/index.js +20 -8
  468. package/src/components/text-transform-control/stories/index.story.js +0 -4
  469. package/src/components/url-input/README.md +0 -5
  470. package/src/components/url-input/button.js +0 -1
  471. package/src/components/url-input/index.js +1 -15
  472. package/src/components/url-input/style.scss +2 -2
  473. package/src/components/url-popover/image-url-input-ui.js +2 -0
  474. package/src/components/url-popover/link-editor.js +0 -1
  475. package/src/components/use-block-drop-zone/index.js +86 -16
  476. package/src/components/use-on-block-drop/index.js +1 -9
  477. package/src/components/use-resize-canvas/index.js +1 -3
  478. package/src/components/use-settings/index.js +2 -1
  479. package/src/components/writing-mode-control/index.js +20 -8
  480. package/src/hooks/background.js +21 -27
  481. package/src/hooks/block-bindings.js +248 -54
  482. package/src/hooks/block-bindings.scss +13 -2
  483. package/src/hooks/block-hooks.js +1 -0
  484. package/src/hooks/block-hooks.scss +1 -0
  485. package/src/hooks/block-style-variation.js +3 -3
  486. package/src/hooks/contrast-checker.js +7 -7
  487. package/src/hooks/duotone.js +4 -4
  488. package/src/hooks/index.js +2 -1
  489. package/src/hooks/line-height.js +0 -1
  490. package/src/hooks/spacing-visualizer.js +1 -1
  491. package/src/hooks/test/background.js +60 -0
  492. package/src/hooks/use-bindings-attributes.js +4 -0
  493. package/src/hooks/use-editor-wrapper-styles.native.scss +1 -0
  494. package/src/hooks/use-zoom-out.js +1 -1
  495. package/src/hooks/utils.js +14 -1
  496. package/src/index.js +1 -0
  497. package/src/layouts/constrained.js +1 -0
  498. package/src/layouts/flex.js +2 -0
  499. package/src/layouts/grid.js +3 -0
  500. package/src/private-apis.js +3 -2
  501. package/src/store/actions.js +13 -5
  502. package/src/store/private-selectors.js +36 -0
  503. package/src/store/reducer.js +7 -0
  504. package/src/store/selectors.js +4 -4
  505. package/src/store/test/private-selectors.js +89 -0
  506. package/src/style.scss +1 -2
  507. package/src/utils/block-bindings.js +98 -0
  508. package/src/utils/get-editor-region.js +1 -1
  509. package/src/utils/get-px-from-css-unit.js +1 -1
  510. package/src/utils/test/transform-styles.js +49 -0
  511. package/tsconfig.tsbuildinfo +1 -1
  512. package/build/components/global-styles/theme-file-uri-utils.js +0 -80
  513. package/build/components/global-styles/theme-file-uri-utils.js.map +0 -1
  514. package/build/components/inner-blocks/with-client-id.js +0 -28
  515. package/build/components/inner-blocks/with-client-id.js.map +0 -1
  516. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -30
  517. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
  518. package/build/components/segmented-text-control/index.js +0 -63
  519. package/build/components/segmented-text-control/index.js.map +0 -1
  520. package/build-module/components/global-styles/theme-file-uri-utils.js +0 -73
  521. package/build-module/components/global-styles/theme-file-uri-utils.js.map +0 -1
  522. package/build-module/components/inner-blocks/with-client-id.js +0 -21
  523. package/build-module/components/inner-blocks/with-client-id.js.map +0 -1
  524. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -23
  525. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
  526. package/build-module/components/segmented-text-control/index.js +0 -58
  527. package/build-module/components/segmented-text-control/index.js.map +0 -1
  528. package/src/components/global-styles/test/theme-file-uri-utils.js +0 -66
  529. package/src/components/global-styles/theme-file-uri-utils.js +0 -77
  530. package/src/components/inner-blocks/with-client-id.js +0 -19
  531. package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -25
  532. package/src/components/segmented-text-control/index.js +0 -63
  533. package/src/components/segmented-text-control/style.scss +0 -15
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","cloneBlock","createBlock","findTransform","getBlockTransforms","pasteHandler","store","blocksStore","useDispatch","useSelect","useRegistry","getFilesFromDataTransfer","blockEditorStore","parseDropEvent","event","result","srcRootClientId","srcClientIds","srcIndex","type","blocks","dataTransfer","Object","assign","JSON","parse","getData","err","onBlockDrop","targetRootClientId","targetBlockIndex","getBlockIndex","getClientIdsOfDescendants","moveBlocks","insertOrReplaceBlocks","clearSelectedBlock","operation","getBlock","sourceRootClientId","sourceClientIds","dropType","blocksToInsert","map","block","sourceBlockIndex","includes","some","id","clientId","isAtSameLevel","draggedBlockCount","length","insertIndex","onFilesDrop","getSettings","updateBlockAttributes","canInsertBlockType","files","mediaUpload","transformation","transform","blockName","isMatch","onHTMLDrop","HTML","mode","useOnBlockDrop","options","nearestSide","getBlockOrder","getBlocksByClientId","isGroupable","getGroupingBlockName","insertBlocks","moveBlocksToPosition","replaceBlocks","removeBlocks","registry","updateSelection","initialPosition","clientIdsToReplace","Array","isArray","clientIds","blocksClientIds","areGroupableBlocks","undefined","targetBlock","push","unshift","groupInnerBlocks","name","attributes","innerBlocks","areAllImages","every","galleryBlock","wrappedBlocks","layout","flexWrap","sourceBlocks","targetBlockClientIds","targetBlockClientId","batch","_onDrop","_onFilesDrop","_onHTMLDrop","html"],"sources":["@wordpress/block-editor/src/components/use-on-block-drop/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport {\n\tcloneBlock,\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tpasteHandler,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('react').SyntheticEvent} SyntheticEvent */\n/** @typedef {import('./types').WPDropOperation} WPDropOperation */\n\n/**\n * Retrieve the data for a block drop event.\n *\n * @param {SyntheticEvent} event The drop event.\n *\n * @return {Object} An object with block drag and drop data.\n */\nexport function parseDropEvent( event ) {\n\tlet result = {\n\t\tsrcRootClientId: null,\n\t\tsrcClientIds: null,\n\t\tsrcIndex: null,\n\t\ttype: null,\n\t\tblocks: null,\n\t};\n\n\tif ( ! event.dataTransfer ) {\n\t\treturn result;\n\t}\n\n\ttry {\n\t\tresult = Object.assign(\n\t\t\tresult,\n\t\t\tJSON.parse( event.dataTransfer.getData( 'wp-blocks' ) )\n\t\t);\n\t} catch ( err ) {\n\t\treturn result;\n\t}\n\n\treturn result;\n}\n\n/**\n * A function that returns an event handler function for block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Function} getBlockIndex A function that gets the index of a block.\n * @param {Function} getClientIdsOfDescendants A function that gets the client ids of descendant blocks.\n * @param {Function} moveBlocks A function that moves blocks.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n * @param {Function} clearSelectedBlock A function that clears block selection.\n * @param {string} operation The type of operation to perform on drop. Could be `insert` or `replace` or `group`.\n * @param {Function} getBlock A function that returns a block given its client id.\n * @return {Function} The event handler for a block drop event.\n */\nexport function onBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\tgetBlockIndex,\n\tgetClientIdsOfDescendants,\n\tmoveBlocks,\n\tinsertOrReplaceBlocks,\n\tclearSelectedBlock,\n\toperation,\n\tgetBlock\n) {\n\treturn ( event ) => {\n\t\tconst {\n\t\t\tsrcRootClientId: sourceRootClientId,\n\t\t\tsrcClientIds: sourceClientIds,\n\t\t\ttype: dropType,\n\t\t\tblocks,\n\t\t} = parseDropEvent( event );\n\n\t\t// If the user is inserting a block.\n\t\tif ( dropType === 'inserter' ) {\n\t\t\tclearSelectedBlock();\n\t\t\tconst blocksToInsert = blocks.map( ( block ) =>\n\t\t\t\tcloneBlock( block )\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocksToInsert, true, null );\n\t\t}\n\n\t\t// If the user is moving a block.\n\t\tif ( dropType === 'block' ) {\n\t\t\tconst sourceBlockIndex = getBlockIndex( sourceClientIds[ 0 ] );\n\n\t\t\t// If the user is dropping to the same position, return early.\n\t\t\tif (\n\t\t\t\tsourceRootClientId === targetRootClientId &&\n\t\t\t\tsourceBlockIndex === targetBlockIndex\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is attempting to drop a block within its own\n\t\t\t// nested blocks, return early as this would create infinite\n\t\t\t// recursion.\n\t\t\tif (\n\t\t\t\tsourceClientIds.includes( targetRootClientId ) ||\n\t\t\t\tgetClientIdsOfDescendants( sourceClientIds ).some(\n\t\t\t\t\t( id ) => id === targetRootClientId\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is dropping a block over another block, replace both blocks\n\t\t\t// with a group block containing them\n\t\t\tif ( operation === 'group' ) {\n\t\t\t\tconst blocksToInsert = sourceClientIds.map( ( clientId ) =>\n\t\t\t\t\tgetBlock( clientId )\n\t\t\t\t);\n\t\t\t\tinsertOrReplaceBlocks(\n\t\t\t\t\tblocksToInsert,\n\t\t\t\t\ttrue,\n\t\t\t\t\tnull,\n\t\t\t\t\tsourceClientIds\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isAtSameLevel = sourceRootClientId === targetRootClientId;\n\t\t\tconst draggedBlockCount = sourceClientIds.length;\n\n\t\t\t// If the block is kept at the same level and moved downwards,\n\t\t\t// subtract to take into account that the blocks being dragged\n\t\t\t// were removed from the block list above the insertion point.\n\t\t\tconst insertIndex =\n\t\t\t\tisAtSameLevel && sourceBlockIndex < targetBlockIndex\n\t\t\t\t\t? targetBlockIndex - draggedBlockCount\n\t\t\t\t\t: targetBlockIndex;\n\n\t\t\tmoveBlocks( sourceClientIds, sourceRootClientId, insertIndex );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related file drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {Function} getSettings A function that gets the block editor settings.\n * @param {Function} updateBlockAttributes A function that updates a block's attributes.\n * @param {Function} canInsertBlockType A function that returns checks whether a block type can be inserted.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related file drop event.\n */\nexport function onFilesDrop(\n\ttargetRootClientId,\n\tgetSettings,\n\tupdateBlockAttributes,\n\tcanInsertBlockType,\n\tinsertOrReplaceBlocks\n) {\n\treturn ( files ) => {\n\t\tif ( ! getSettings().mediaUpload ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst transformation = findTransform(\n\t\t\tgetBlockTransforms( 'from' ),\n\t\t\t( transform ) =>\n\t\t\t\ttransform.type === 'files' &&\n\t\t\t\tcanInsertBlockType( transform.blockName, targetRootClientId ) &&\n\t\t\t\ttransform.isMatch( files )\n\t\t);\n\n\t\tif ( transformation ) {\n\t\t\tconst blocks = transformation.transform(\n\t\t\t\tfiles,\n\t\t\t\tupdateBlockAttributes\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related HTML drop events.\n *\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related HTML drop event.\n */\nexport function onHTMLDrop( insertOrReplaceBlocks ) {\n\treturn ( HTML ) => {\n\t\tconst blocks = pasteHandler( { HTML, mode: 'BLOCKS' } );\n\n\t\tif ( blocks.length ) {\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A React hook for handling block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Object} options The optional options.\n * @param {WPDropOperation} [options.operation] The type of operation to perform on drop. Could be `insert` or `replace` for now.\n *\n * @return {Function} A function to be passed to the onDrop handler.\n */\nexport default function useOnBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\toptions = {}\n) {\n\tconst { operation = 'insert', nearestSide = 'right' } = options;\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tgetBlockOrder,\n\t\tgetBlocksByClientId,\n\t\tgetSettings,\n\t\tgetBlock,\n\t\tisGroupable,\n\t} = useSelect( blockEditorStore );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\n\tconst {\n\t\tinsertBlocks,\n\t\tmoveBlocksToPosition,\n\t\tupdateBlockAttributes,\n\t\tclearSelectedBlock,\n\t\treplaceBlocks,\n\t\tremoveBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\tconst insertOrReplaceBlocks = useCallback(\n\t\t(\n\t\t\tblocks,\n\t\t\tupdateSelection = true,\n\t\t\tinitialPosition = 0,\n\t\t\tclientIdsToReplace = []\n\t\t) => {\n\t\t\tif ( ! Array.isArray( blocks ) ) {\n\t\t\t\tblocks = [ blocks ];\n\t\t\t}\n\n\t\t\tconst clientIds = getBlockOrder( targetRootClientId );\n\t\t\tconst clientId = clientIds[ targetBlockIndex ];\n\t\t\tconst blocksClientIds = blocks.map( ( block ) => block.clientId );\n\t\t\tconst areGroupableBlocks = isGroupable( [\n\t\t\t\t...blocksClientIds,\n\t\t\t\tclientId,\n\t\t\t] );\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\treplaceBlocks( clientId, blocks, undefined, initialPosition );\n\t\t\t} else if ( operation === 'group' && areGroupableBlocks ) {\n\t\t\t\tconst targetBlock = getBlock( clientId );\n\t\t\t\tif ( nearestSide === 'left' ) {\n\t\t\t\t\tblocks.push( targetBlock );\n\t\t\t\t} else {\n\t\t\t\t\tblocks.unshift( targetBlock );\n\t\t\t\t}\n\n\t\t\t\tconst groupInnerBlocks = blocks.map( ( block ) => {\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\tblock.innerBlocks\n\t\t\t\t\t);\n\t\t\t\t} );\n\n\t\t\t\tconst areAllImages = blocks.every( ( block ) => {\n\t\t\t\t\treturn block.name === 'core/image';\n\t\t\t\t} );\n\n\t\t\t\tconst galleryBlock = canInsertBlockType(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\ttargetRootClientId\n\t\t\t\t);\n\n\t\t\t\tconst wrappedBlocks = createBlock(\n\t\t\t\t\tareAllImages && galleryBlock\n\t\t\t\t\t\t? 'core/gallery'\n\t\t\t\t\t\t: getGroupingBlockName(),\n\t\t\t\t\t{\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\ttype: 'flex',\n\t\t\t\t\t\t\tflexWrap:\n\t\t\t\t\t\t\t\tareAllImages && galleryBlock ? null : 'nowrap',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tgroupInnerBlocks\n\t\t\t\t);\n\t\t\t\t// Need to make sure both the target block and the block being dragged are replaced\n\t\t\t\t// otherwise the dragged block will be duplicated.\n\t\t\t\treplaceBlocks(\n\t\t\t\t\t[ clientId, ...clientIdsToReplace ],\n\t\t\t\t\twrappedBlocks,\n\t\t\t\t\tundefined,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tinsertBlocks(\n\t\t\t\t\tblocks,\n\t\t\t\t\ttargetBlockIndex,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tupdateSelection,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tgetBlockOrder,\n\t\t\ttargetRootClientId,\n\t\t\ttargetBlockIndex,\n\t\t\tisGroupable,\n\t\t\toperation,\n\t\t\treplaceBlocks,\n\t\t\tgetBlock,\n\t\t\tnearestSide,\n\t\t\tcanInsertBlockType,\n\t\t\tgetGroupingBlockName,\n\t\t\tinsertBlocks,\n\t\t]\n\t);\n\n\tconst moveBlocks = useCallback(\n\t\t( sourceClientIds, sourceRootClientId, insertIndex ) => {\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\tconst sourceBlocks = getBlocksByClientId( sourceClientIds );\n\t\t\t\tconst targetBlockClientIds =\n\t\t\t\t\tgetBlockOrder( targetRootClientId );\n\t\t\t\tconst targetBlockClientId =\n\t\t\t\t\ttargetBlockClientIds[ targetBlockIndex ];\n\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t// Remove the source blocks.\n\t\t\t\t\tremoveBlocks( sourceClientIds, false );\n\t\t\t\t\t// Replace the target block with the source blocks.\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\ttargetBlockClientId,\n\t\t\t\t\t\tsourceBlocks,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t0\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\tsourceClientIds,\n\t\t\t\t\tsourceRootClientId,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tinsertIndex\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\toperation,\n\t\t\tgetBlockOrder,\n\t\t\tgetBlocksByClientId,\n\t\t\tmoveBlocksToPosition,\n\t\t\tregistry,\n\t\t\tremoveBlocks,\n\t\t\treplaceBlocks,\n\t\t\ttargetBlockIndex,\n\t\t\ttargetRootClientId,\n\t\t]\n\t);\n\n\tconst _onDrop = onBlockDrop(\n\t\ttargetRootClientId,\n\t\ttargetBlockIndex,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tmoveBlocks,\n\t\tinsertOrReplaceBlocks,\n\t\tclearSelectedBlock,\n\t\toperation,\n\t\tgetBlock\n\t);\n\tconst _onFilesDrop = onFilesDrop(\n\t\ttargetRootClientId,\n\t\tgetSettings,\n\t\tupdateBlockAttributes,\n\t\tcanInsertBlockType,\n\t\tinsertOrReplaceBlocks\n\t);\n\tconst _onHTMLDrop = onHTMLDrop( insertOrReplaceBlocks );\n\n\treturn ( event ) => {\n\t\tconst files = getFilesFromDataTransfer( event.dataTransfer );\n\t\tconst html = event.dataTransfer.getData( 'text/html' );\n\n\t\t/**\n\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t */\n\t\tif ( html ) {\n\t\t\t_onHTMLDrop( html );\n\t\t} else if ( files.length ) {\n\t\t\t_onFilesDrop( files );\n\t\t} else {\n\t\t\t_onDrop( event );\n\t\t}\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,oBAAoB;AAChD,SACCC,UAAU,EACVC,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,YAAY,EACZC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,wBAAwB,QAAQ,gBAAgB;;AAEzD;AACA;AACA;AACA,SAASL,KAAK,IAAIM,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAEC,KAAK,EAAG;EACvC,IAAIC,MAAM,GAAG;IACZC,eAAe,EAAE,IAAI;IACrBC,YAAY,EA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C;IACF;EACD,CAAC,EACD,CACChB,SAAS,EACTiC,aAAa,EACbC,mBAAmB,EACnBI,oBAAoB,EACpBG,QAAQ,EACRD,YAAY,EACZD,aAAa,EACb7C,gBAAgB,EAChBD,kBAAkB,CAEpB,CAAC;EAED,MAAM2E,OAAO,GAAG5E,WAAW,CAC1BC,kBAAkB,EAClBC,gBAAgB,EAChBC,aAAa,EACbC,yBAAyB,EACzBC,UAAU,EACVC,qBAAqB,EACrBC,kBAAkB,EAClBC,SAAS,EACTC,QACD,CAAC;EACD,MAAMoE,YAAY,GAAGpD,WAAW,CAC/BxB,kBAAkB,EAClByB,WAAW,EACXC,qBAAqB,EACrBC,kBAAkB,EAClBtB,qBACD,CAAC;EACD,MAAMwE,WAAW,GAAG3C,UAAU,CAAE7B,qBAAsB,CAAC;EAEvD,OAASpB,KAAK,IAAM;IACnB,MAAM2C,KAAK,GAAG9C,wBAAwB,CAAEG,KAAK,CAACO,YAAa,CAAC;IAC5D,MAAMsF,IAAI,GAAG7F,KAAK,CAACO,YAAY,CAACK,OAAO,CAAE,WAAY,CAAC;;IAEtD;AACF;AACA;AACA;IACE,IAAKiF,IAAI,EAAG;MACXD,WAAW,CAAEC,IAAK,CAAC;IACpB,CAAC,MAAM,IAAKlD,KAAK,CAACN,MAAM,EAAG;MAC1BsD,YAAY,CAAEhD,KAAM,CAAC;IACtB,CAAC,MAAM;MACN+C,OAAO,CAAE1F,KAAM,CAAC;IACjB;EACD,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","cloneBlock","createBlock","findTransform","getBlockTransforms","pasteHandler","store","blocksStore","useDispatch","useSelect","useRegistry","getFilesFromDataTransfer","blockEditorStore","parseDropEvent","event","result","srcRootClientId","srcClientIds","srcIndex","type","blocks","dataTransfer","Object","assign","JSON","parse","getData","err","onBlockDrop","targetRootClientId","targetBlockIndex","getBlockIndex","getClientIdsOfDescendants","moveBlocks","insertOrReplaceBlocks","clearSelectedBlock","operation","getBlock","sourceRootClientId","sourceClientIds","dropType","blocksToInsert","map","block","sourceBlockIndex","includes","some","id","clientId","isAtSameLevel","draggedBlockCount","length","insertIndex","onFilesDrop","getSettings","updateBlockAttributes","canInsertBlockType","files","mediaUpload","transformation","transform","blockName","isMatch","onHTMLDrop","HTML","mode","useOnBlockDrop","options","nearestSide","getBlockOrder","getBlocksByClientId","getGroupingBlockName","insertBlocks","moveBlocksToPosition","replaceBlocks","removeBlocks","registry","updateSelection","initialPosition","clientIdsToReplace","Array","isArray","clientIds","undefined","targetBlock","push","unshift","groupInnerBlocks","name","attributes","innerBlocks","areAllImages","every","galleryBlock","wrappedBlocks","layout","flexWrap","sourceBlocks","targetBlockClientIds","targetBlockClientId","batch","_onDrop","_onFilesDrop","_onHTMLDrop","html"],"sources":["@wordpress/block-editor/src/components/use-on-block-drop/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport {\n\tcloneBlock,\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tpasteHandler,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('react').SyntheticEvent} SyntheticEvent */\n/** @typedef {import('./types').WPDropOperation} WPDropOperation */\n\n/**\n * Retrieve the data for a block drop event.\n *\n * @param {SyntheticEvent} event The drop event.\n *\n * @return {Object} An object with block drag and drop data.\n */\nexport function parseDropEvent( event ) {\n\tlet result = {\n\t\tsrcRootClientId: null,\n\t\tsrcClientIds: null,\n\t\tsrcIndex: null,\n\t\ttype: null,\n\t\tblocks: null,\n\t};\n\n\tif ( ! event.dataTransfer ) {\n\t\treturn result;\n\t}\n\n\ttry {\n\t\tresult = Object.assign(\n\t\t\tresult,\n\t\t\tJSON.parse( event.dataTransfer.getData( 'wp-blocks' ) )\n\t\t);\n\t} catch ( err ) {\n\t\treturn result;\n\t}\n\n\treturn result;\n}\n\n/**\n * A function that returns an event handler function for block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Function} getBlockIndex A function that gets the index of a block.\n * @param {Function} getClientIdsOfDescendants A function that gets the client ids of descendant blocks.\n * @param {Function} moveBlocks A function that moves blocks.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n * @param {Function} clearSelectedBlock A function that clears block selection.\n * @param {string} operation The type of operation to perform on drop. Could be `insert` or `replace` or `group`.\n * @param {Function} getBlock A function that returns a block given its client id.\n * @return {Function} The event handler for a block drop event.\n */\nexport function onBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\tgetBlockIndex,\n\tgetClientIdsOfDescendants,\n\tmoveBlocks,\n\tinsertOrReplaceBlocks,\n\tclearSelectedBlock,\n\toperation,\n\tgetBlock\n) {\n\treturn ( event ) => {\n\t\tconst {\n\t\t\tsrcRootClientId: sourceRootClientId,\n\t\t\tsrcClientIds: sourceClientIds,\n\t\t\ttype: dropType,\n\t\t\tblocks,\n\t\t} = parseDropEvent( event );\n\n\t\t// If the user is inserting a block.\n\t\tif ( dropType === 'inserter' ) {\n\t\t\tclearSelectedBlock();\n\t\t\tconst blocksToInsert = blocks.map( ( block ) =>\n\t\t\t\tcloneBlock( block )\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocksToInsert, true, null );\n\t\t}\n\n\t\t// If the user is moving a block.\n\t\tif ( dropType === 'block' ) {\n\t\t\tconst sourceBlockIndex = getBlockIndex( sourceClientIds[ 0 ] );\n\n\t\t\t// If the user is dropping to the same position, return early.\n\t\t\tif (\n\t\t\t\tsourceRootClientId === targetRootClientId &&\n\t\t\t\tsourceBlockIndex === targetBlockIndex\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is attempting to drop a block within its own\n\t\t\t// nested blocks, return early as this would create infinite\n\t\t\t// recursion.\n\t\t\tif (\n\t\t\t\tsourceClientIds.includes( targetRootClientId ) ||\n\t\t\t\tgetClientIdsOfDescendants( sourceClientIds ).some(\n\t\t\t\t\t( id ) => id === targetRootClientId\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is dropping a block over another block, replace both blocks\n\t\t\t// with a group block containing them\n\t\t\tif ( operation === 'group' ) {\n\t\t\t\tconst blocksToInsert = sourceClientIds.map( ( clientId ) =>\n\t\t\t\t\tgetBlock( clientId )\n\t\t\t\t);\n\t\t\t\tinsertOrReplaceBlocks(\n\t\t\t\t\tblocksToInsert,\n\t\t\t\t\ttrue,\n\t\t\t\t\tnull,\n\t\t\t\t\tsourceClientIds\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isAtSameLevel = sourceRootClientId === targetRootClientId;\n\t\t\tconst draggedBlockCount = sourceClientIds.length;\n\n\t\t\t// If the block is kept at the same level and moved downwards,\n\t\t\t// subtract to take into account that the blocks being dragged\n\t\t\t// were removed from the block list above the insertion point.\n\t\t\tconst insertIndex =\n\t\t\t\tisAtSameLevel && sourceBlockIndex < targetBlockIndex\n\t\t\t\t\t? targetBlockIndex - draggedBlockCount\n\t\t\t\t\t: targetBlockIndex;\n\n\t\t\tmoveBlocks( sourceClientIds, sourceRootClientId, insertIndex );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related file drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {Function} getSettings A function that gets the block editor settings.\n * @param {Function} updateBlockAttributes A function that updates a block's attributes.\n * @param {Function} canInsertBlockType A function that returns checks whether a block type can be inserted.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related file drop event.\n */\nexport function onFilesDrop(\n\ttargetRootClientId,\n\tgetSettings,\n\tupdateBlockAttributes,\n\tcanInsertBlockType,\n\tinsertOrReplaceBlocks\n) {\n\treturn ( files ) => {\n\t\tif ( ! getSettings().mediaUpload ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst transformation = findTransform(\n\t\t\tgetBlockTransforms( 'from' ),\n\t\t\t( transform ) =>\n\t\t\t\ttransform.type === 'files' &&\n\t\t\t\tcanInsertBlockType( transform.blockName, targetRootClientId ) &&\n\t\t\t\ttransform.isMatch( files )\n\t\t);\n\n\t\tif ( transformation ) {\n\t\t\tconst blocks = transformation.transform(\n\t\t\t\tfiles,\n\t\t\t\tupdateBlockAttributes\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related HTML drop events.\n *\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related HTML drop event.\n */\nexport function onHTMLDrop( insertOrReplaceBlocks ) {\n\treturn ( HTML ) => {\n\t\tconst blocks = pasteHandler( { HTML, mode: 'BLOCKS' } );\n\n\t\tif ( blocks.length ) {\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A React hook for handling block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Object} options The optional options.\n * @param {WPDropOperation} [options.operation] The type of operation to perform on drop. Could be `insert` or `replace` for now.\n *\n * @return {Function} A function to be passed to the onDrop handler.\n */\nexport default function useOnBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\toptions = {}\n) {\n\tconst { operation = 'insert', nearestSide = 'right' } = options;\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tgetBlockOrder,\n\t\tgetBlocksByClientId,\n\t\tgetSettings,\n\t\tgetBlock,\n\t} = useSelect( blockEditorStore );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\n\tconst {\n\t\tinsertBlocks,\n\t\tmoveBlocksToPosition,\n\t\tupdateBlockAttributes,\n\t\tclearSelectedBlock,\n\t\treplaceBlocks,\n\t\tremoveBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\tconst insertOrReplaceBlocks = useCallback(\n\t\t(\n\t\t\tblocks,\n\t\t\tupdateSelection = true,\n\t\t\tinitialPosition = 0,\n\t\t\tclientIdsToReplace = []\n\t\t) => {\n\t\t\tif ( ! Array.isArray( blocks ) ) {\n\t\t\t\tblocks = [ blocks ];\n\t\t\t}\n\t\t\tconst clientIds = getBlockOrder( targetRootClientId );\n\t\t\tconst clientId = clientIds[ targetBlockIndex ];\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\treplaceBlocks( clientId, blocks, undefined, initialPosition );\n\t\t\t} else if ( operation === 'group' ) {\n\t\t\t\tconst targetBlock = getBlock( clientId );\n\t\t\t\tif ( nearestSide === 'left' ) {\n\t\t\t\t\tblocks.push( targetBlock );\n\t\t\t\t} else {\n\t\t\t\t\tblocks.unshift( targetBlock );\n\t\t\t\t}\n\n\t\t\t\tconst groupInnerBlocks = blocks.map( ( block ) => {\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\tblock.innerBlocks\n\t\t\t\t\t);\n\t\t\t\t} );\n\n\t\t\t\tconst areAllImages = blocks.every( ( block ) => {\n\t\t\t\t\treturn block.name === 'core/image';\n\t\t\t\t} );\n\n\t\t\t\tconst galleryBlock = canInsertBlockType(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\ttargetRootClientId\n\t\t\t\t);\n\n\t\t\t\tconst wrappedBlocks = createBlock(\n\t\t\t\t\tareAllImages && galleryBlock\n\t\t\t\t\t\t? 'core/gallery'\n\t\t\t\t\t\t: getGroupingBlockName(),\n\t\t\t\t\t{\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\ttype: 'flex',\n\t\t\t\t\t\t\tflexWrap:\n\t\t\t\t\t\t\t\tareAllImages && galleryBlock ? null : 'nowrap',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tgroupInnerBlocks\n\t\t\t\t);\n\t\t\t\t// Need to make sure both the target block and the block being dragged are replaced\n\t\t\t\t// otherwise the dragged block will be duplicated.\n\t\t\t\treplaceBlocks(\n\t\t\t\t\t[ clientId, ...clientIdsToReplace ],\n\t\t\t\t\twrappedBlocks,\n\t\t\t\t\tundefined,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tinsertBlocks(\n\t\t\t\t\tblocks,\n\t\t\t\t\ttargetBlockIndex,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tupdateSelection,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tgetBlockOrder,\n\t\t\ttargetRootClientId,\n\t\t\ttargetBlockIndex,\n\t\t\toperation,\n\t\t\treplaceBlocks,\n\t\t\tgetBlock,\n\t\t\tnearestSide,\n\t\t\tcanInsertBlockType,\n\t\t\tgetGroupingBlockName,\n\t\t\tinsertBlocks,\n\t\t]\n\t);\n\n\tconst moveBlocks = useCallback(\n\t\t( sourceClientIds, sourceRootClientId, insertIndex ) => {\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\tconst sourceBlocks = getBlocksByClientId( sourceClientIds );\n\t\t\t\tconst targetBlockClientIds =\n\t\t\t\t\tgetBlockOrder( targetRootClientId );\n\t\t\t\tconst targetBlockClientId =\n\t\t\t\t\ttargetBlockClientIds[ targetBlockIndex ];\n\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t// Remove the source blocks.\n\t\t\t\t\tremoveBlocks( sourceClientIds, false );\n\t\t\t\t\t// Replace the target block with the source blocks.\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\ttargetBlockClientId,\n\t\t\t\t\t\tsourceBlocks,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t0\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\tsourceClientIds,\n\t\t\t\t\tsourceRootClientId,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tinsertIndex\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\toperation,\n\t\t\tgetBlockOrder,\n\t\t\tgetBlocksByClientId,\n\t\t\tmoveBlocksToPosition,\n\t\t\tregistry,\n\t\t\tremoveBlocks,\n\t\t\treplaceBlocks,\n\t\t\ttargetBlockIndex,\n\t\t\ttargetRootClientId,\n\t\t]\n\t);\n\n\tconst _onDrop = onBlockDrop(\n\t\ttargetRootClientId,\n\t\ttargetBlockIndex,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tmoveBlocks,\n\t\tinsertOrReplaceBlocks,\n\t\tclearSelectedBlock,\n\t\toperation,\n\t\tgetBlock\n\t);\n\tconst _onFilesDrop = onFilesDrop(\n\t\ttargetRootClientId,\n\t\tgetSettings,\n\t\tupdateBlockAttributes,\n\t\tcanInsertBlockType,\n\t\tinsertOrReplaceBlocks\n\t);\n\tconst _onHTMLDrop = onHTMLDrop( insertOrReplaceBlocks );\n\n\treturn ( event ) => {\n\t\tconst files = getFilesFromDataTransfer( event.dataTransfer );\n\t\tconst html = event.dataTransfer.getData( 'text/html' );\n\n\t\t/**\n\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t */\n\t\tif ( html ) {\n\t\t\t_onHTMLDrop( html );\n\t\t} else if ( files.length ) {\n\t\t\t_onFilesDrop( files );\n\t\t} else {\n\t\t\t_onDrop( event );\n\t\t}\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,oBAAoB;AAChD,SACCC,UAAU,EACVC,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,YAAY,EACZC,KAAK,IAAIC,WAA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;MACF,CAAE,CAAC;IACJ,CAAC,MAAM;MACNV,oBAAoB,CACnBlC,eAAe,EACfD,kBAAkB,EAClBT,kBAAkB,EAClBuB,WACD,CAAC;IACF;EACD,CAAC,EACD,CACChB,SAAS,EACTiC,aAAa,EACbC,mBAAmB,EACnBG,oBAAoB,EACpBG,QAAQ,EACRD,YAAY,EACZD,aAAa,EACb5C,gBAAgB,EAChBD,kBAAkB,CAEpB,CAAC;EAED,MAAMwE,OAAO,GAAGzE,WAAW,CAC1BC,kBAAkB,EAClBC,gBAAgB,EAChBC,aAAa,EACbC,yBAAyB,EACzBC,UAAU,EACVC,qBAAqB,EACrBC,kBAAkB,EAClBC,SAAS,EACTC,QACD,CAAC;EACD,MAAMiE,YAAY,GAAGjD,WAAW,CAC/BxB,kBAAkB,EAClByB,WAAW,EACXC,qBAAqB,EACrBC,kBAAkB,EAClBtB,qBACD,CAAC;EACD,MAAMqE,WAAW,GAAGxC,UAAU,CAAE7B,qBAAsB,CAAC;EAEvD,OAASpB,KAAK,IAAM;IACnB,MAAM2C,KAAK,GAAG9C,wBAAwB,CAAEG,KAAK,CAACO,YAAa,CAAC;IAC5D,MAAMmF,IAAI,GAAG1F,KAAK,CAACO,YAAY,CAACK,OAAO,CAAE,WAAY,CAAC;;IAEtD;AACF;AACA;AACA;IACE,IAAK8E,IAAI,EAAG;MACXD,WAAW,CAAEC,IAAK,CAAC;IACpB,CAAC,MAAM,IAAK/C,KAAK,CAACN,MAAM,EAAG;MAC1BmD,YAAY,CAAE7C,KAAM,CAAC;IACtB,CAAC,MAAM;MACN4C,OAAO,CAAEvF,KAAM,CAAC;IACjB;EACD,CAAC;AACF","ignoreList":[]}
@@ -36,7 +36,7 @@ export default function useResizeCanvas(deviceType) {
36
36
  }
37
37
  return deviceWidth < actualWidth ? deviceWidth : actualWidth;
38
38
  };
39
- const marginValue = () => window.innerHeight < 800 ? 36 : 72;
39
+ const marginValue = () => window.innerHeight < 800 ? 36 : 64;
40
40
  const contentInlineStyles = device => {
41
41
  const height = device === 'Mobile' ? '768px' : '1024px';
42
42
  const marginVertical = marginValue() + 'px';
@@ -53,8 +53,6 @@ export default function useResizeCanvas(deviceType) {
53
53
  marginLeft: marginHorizontal,
54
54
  marginRight: marginHorizontal,
55
55
  height,
56
- borderRadius: '2px 2px 2px 2px',
57
- border: '1px solid #ddd',
58
56
  overflowY: 'auto'
59
57
  };
60
58
  default:
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useState","useResizeCanvas","deviceType","actualWidth","updateActualWidth","window","innerWidth","resizeListener","addEventListener","removeEventListener","getCanvasWidth","device","deviceWidth","marginValue","innerHeight","contentInlineStyles","height","marginVertical","marginHorizontal","width","marginTop","marginBottom","marginLeft","marginRight","borderRadius","border","overflowY"],"sources":["@wordpress/block-editor/src/components/use-resize-canvas/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * Function to resize the editor window.\n *\n * @param {string} deviceType Used for determining the size of the container (e.g. Desktop, Tablet, Mobile)\n *\n * @return {Object} Inline styles to be added to resizable container.\n */\nexport default function useResizeCanvas( deviceType ) {\n\tconst [ actualWidth, updateActualWidth ] = useState( window.innerWidth );\n\n\tuseEffect( () => {\n\t\tif ( deviceType === 'Desktop' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst resizeListener = () => updateActualWidth( window.innerWidth );\n\t\twindow.addEventListener( 'resize', resizeListener );\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener( 'resize', resizeListener );\n\t\t};\n\t}, [ deviceType ] );\n\n\tconst getCanvasWidth = ( device ) => {\n\t\tlet deviceWidth;\n\n\t\tswitch ( device ) {\n\t\t\tcase 'Tablet':\n\t\t\t\tdeviceWidth = 780;\n\t\t\t\tbreak;\n\t\t\tcase 'Mobile':\n\t\t\t\tdeviceWidth = 360;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn null;\n\t\t}\n\n\t\treturn deviceWidth < actualWidth ? deviceWidth : actualWidth;\n\t};\n\n\tconst marginValue = () => ( window.innerHeight < 800 ? 36 : 72 );\n\n\tconst contentInlineStyles = ( device ) => {\n\t\tconst height = device === 'Mobile' ? '768px' : '1024px';\n\t\tconst marginVertical = marginValue() + 'px';\n\t\tconst marginHorizontal = 'auto';\n\n\t\tswitch ( device ) {\n\t\t\tcase 'Tablet':\n\t\t\tcase 'Mobile':\n\t\t\t\treturn {\n\t\t\t\t\twidth: getCanvasWidth( device ),\n\t\t\t\t\t// Keeping margin styles separate to avoid warnings\n\t\t\t\t\t// when those props get overridden in the iframe component\n\t\t\t\t\tmarginTop: marginVertical,\n\t\t\t\t\tmarginBottom: marginVertical,\n\t\t\t\t\tmarginLeft: marginHorizontal,\n\t\t\t\t\tmarginRight: marginHorizontal,\n\t\t\t\t\theight,\n\t\t\t\t\tborderRadius: '2px 2px 2px 2px',\n\t\t\t\t\tborder: '1px solid #ddd',\n\t\t\t\t\toverflowY: 'auto',\n\t\t\t\t};\n\t\t\tdefault:\n\t\t\t\treturn {\n\t\t\t\t\tmarginLeft: marginHorizontal,\n\t\t\t\t\tmarginRight: marginHorizontal,\n\t\t\t\t};\n\t\t}\n\t};\n\n\treturn contentInlineStyles( deviceType );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,eAAeA,CAAEC,UAAU,EAAG;EACrD,MAAM,CAAEC,WAAW,EAAEC,iBAAiB,CAAE,GAAGJ,QAAQ,CAAEK,MAAM,CAACC,UAAW,CAAC;EAExEP,SAAS,CAAE,MAAM;IAChB,IAAKG,UAAU,KAAK,SAAS,EAAG;MAC/B;IACD;IAEA,MAAMK,cAAc,GAAGA,CAAA,KAAMH,iBAAiB,CAAEC,MAAM,CAACC,UAAW,CAAC;IACnED,MAAM,CAACG,gBAAgB,CAAE,QAAQ,EAAED,cAAe,CAAC;IAEnD,OAAO,M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","updateActualWidth","window","innerWidth","resizeListener","addEventListener","removeEventListener","getCanvasWidth","device","deviceWidth","marginValue","innerHeight","contentInlineStyles","height","marginVertical","marginHorizontal","width","marginTop","marginBottom","marginLeft","marginRight","overflowY"],"sources":["@wordpress/block-editor/src/components/use-resize-canvas/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * Function to resize the editor window.\n *\n * @param {string} deviceType Used for determining the size of the container (e.g. Desktop, Tablet, Mobile)\n *\n * @return {Object} Inline styles to be added to resizable container.\n */\nexport default function useResizeCanvas( deviceType ) {\n\tconst [ actualWidth, updateActualWidth ] = useState( window.innerWidth );\n\n\tuseEffect( () => {\n\t\tif ( deviceType === 'Desktop' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst resizeListener = () => updateActualWidth( window.innerWidth );\n\t\twindow.addEventListener( 'resize', resizeListener );\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener( 'resize', resizeListener );\n\t\t};\n\t}, [ deviceType ] );\n\n\tconst getCanvasWidth = ( device ) => {\n\t\tlet deviceWidth;\n\n\t\tswitch ( device ) {\n\t\t\tcase 'Tablet':\n\t\t\t\tdeviceWidth = 780;\n\t\t\t\tbreak;\n\t\t\tcase 'Mobile':\n\t\t\t\tdeviceWidth = 360;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn null;\n\t\t}\n\n\t\treturn deviceWidth < actualWidth ? deviceWidth : actualWidth;\n\t};\n\n\tconst marginValue = () => ( window.innerHeight < 800 ? 36 : 64 );\n\n\tconst contentInlineStyles = ( device ) => {\n\t\tconst height = device === 'Mobile' ? '768px' : '1024px';\n\t\tconst marginVertical = marginValue() + 'px';\n\t\tconst marginHorizontal = 'auto';\n\n\t\tswitch ( device ) {\n\t\t\tcase 'Tablet':\n\t\t\tcase 'Mobile':\n\t\t\t\treturn {\n\t\t\t\t\twidth: getCanvasWidth( device ),\n\t\t\t\t\t// Keeping margin styles separate to avoid warnings\n\t\t\t\t\t// when those props get overridden in the iframe component\n\t\t\t\t\tmarginTop: marginVertical,\n\t\t\t\t\tmarginBottom: marginVertical,\n\t\t\t\t\tmarginLeft: marginHorizontal,\n\t\t\t\t\tmarginRight: marginHorizontal,\n\t\t\t\t\theight,\n\t\t\t\t\toverflowY: 'auto',\n\t\t\t\t};\n\t\t\tdefault:\n\t\t\t\treturn {\n\t\t\t\t\tmarginLeft: marginHorizontal,\n\t\t\t\t\tmarginRight: marginHorizontal,\n\t\t\t\t};\n\t\t}\n\t};\n\n\treturn contentInlineStyles( deviceType );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,eAAeA,CAAEC,UAAU,EAAG;EACrD,MAAM,CAAEC,WAAW,EAAEC,iBAAiB,CAAE,GAAGJ,QAAQ,CAAEK,MAAM,CAACC,UAAW,CAAC;EAExEP,SAAS,CAAE,MAAM;IAChB,IAAKG,UAAU,KAAK,SAAS,EAAG;MAC/B;IACD;IAEA,MAAMK,cAAc,GAAGA,CAAA,KAAMH,iBAAiB,CAAEC,MAAM,CAACC,UAAW,CAAC;IACnED,MAAM,CAACG,gBAAgB,CAAE,QAAQ,EAAED,cAAe,CAAC;IAEnD,OAAO,MAAM;MACZF,MAAM,CAACI,mBAAmB,CAAE,QAAQ,EAAEF,cAAe,CAAC;IACvD,CAAC;EACF,CAAC,EAAE,CAAEL,UAAU,CAAG,CAAC;EAEnB,MAAMQ,cAAc,GAAKC,MAAM,IAAM;IACpC,IAAIC,WAAW;IAEf,QAASD,MAAM;MACd,KAAK,QAAQ;QACZC,WAAW,GAAG,GAAG;QACjB;MACD,KAAK,QAAQ;QACZA,WAAW,GAAG,GAAG;QACjB;MACD;QACC,OAAO,IAAI;IACb;IAEA,OAAOA,WAAW,GAAGT,WAAW,GAAGS,WAAW,GAAGT,WAAW;EAC7D,CAAC;EAED,MAAMU,WAAW,GAAGA,CAAA,KAAQR,MAAM,CAACS,WAAW,GAAG,GAAG,GAAG,EAAE,GAAG,EAAI;EAEhE,MAAMC,mBAAmB,GAAKJ,MAAM,IAAM;IACzC,MAAMK,MAAM,GAAGL,MAAM,KAAK,QAAQ,GAAG,OAAO,GAAG,QAAQ;IACvD,MAAMM,cAAc,GAAGJ,WAAW,CAAC,CAAC,GAAG,IAAI;IAC3C,MAAMK,gBAAgB,GAAG,MAAM;IAE/B,QAASP,MAAM;MACd,KAAK,QAAQ;MACb,KAAK,QAAQ;QACZ,OAAO;UACNQ,KAAK,EAAET,cAAc,CAAEC,MAAO,CAAC;UAC/B;UACA;UACAS,SAAS,EAAEH,cAAc;UACzBI,YAAY,EAAEJ,cAAc;UAC5BK,UAAU,EAAEJ,gBAAgB;UAC5BK,WAAW,EAAEL,gBAAgB;UAC7BF,MAAM;UACNQ,SAAS,EAAE;QACZ,CAAC;MACF;QACC,OAAO;UACNF,UAAU,EAAEJ,gBAAgB;UAC5BK,WAAW,EAAEL;QACd,CAAC;IACH;EACD,CAAC;EAED,OAAOH,mBAAmB,CAAEb,UAAW,CAAC;AACzC","ignoreList":[]}
@@ -39,9 +39,10 @@ export function useSettings(...paths) {
39
39
  * It looks up the setting first in the block instance hierarchy.
40
40
  * If none is found, it'll look it up in the block editor settings.
41
41
  *
42
+ * @deprecated 6.5.0 Use useSettings instead.
43
+ *
42
44
  * @param {string} path The path to the setting.
43
45
  * @return {any} Returns the value defined for the setting.
44
- * @deprecated 6.5.0 Use useSettings instead.
45
46
  * @example
46
47
  * ```js
47
48
  * const isEnabled = useSetting( 'typography.dropCap' );
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","deprecated","useBlockEditContext","store","blockEditorStore","unlock","useSettings","paths","clientId","select","getBlockSettings","useSetting","path","since","alternative","note","value"],"sources":["@wordpress/block-editor/src/components/use-settings/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Hook that retrieves the given settings for the block instance in use.\n *\n * It looks up the settings first in the block instance hierarchy.\n * If none are found, it'll look them up in the block editor settings.\n *\n * @param {string[]} paths The paths to the settings.\n * @return {any[]} Returns the values defined for the settings.\n * @example\n * ```js\n * const [ fixed, sticky ] = useSettings( 'position.fixed', 'position.sticky' );\n * ```\n */\nexport function useSettings( ...paths ) {\n\tconst { clientId = null } = useBlockEditContext();\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getBlockSettings(\n\t\t\t\tclientId,\n\t\t\t\t...paths\n\t\t\t),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ clientId, ...paths ]\n\t);\n}\n\n/**\n * Hook that retrieves the given setting for the block instance in use.\n *\n * It looks up the setting first in the block instance hierarchy.\n * If none is found, it'll look it up in the block editor settings.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @deprecated 6.5.0 Use useSettings instead.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport function useSetting( path ) {\n\tdeprecated( 'wp.blockEditor.useSetting', {\n\t\tsince: '6.5',\n\t\talternative: 'wp.blockEditor.useSettings',\n\t\tnote: 'The new useSettings function can retrieve multiple settings at once, with better performance.',\n\t} );\n\n\tconst [ value ] = useSettings( path );\n\treturn value;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAE,GAAGC,KAAK,EAAG;EACvC,MAAM;IAAEC,QAAQ,GAAG;EAAK,CAAC,GAAGN,mBAAmB,CAAC,CAAC;EACjD,OAAOF,SAAS,CACbS,MAAM,IACPJ,MAAM,CAAEI,MAAM,CAAEL,gBAAiB,CAAE,CAAC,CAACM,gBAAgB,CACpDF,QAAQ,EACR,GAAGD,KACJ,CAAC;EACF;EACA,CAAEC,QAAQ,EAAE,GAAGD,KAAK,CACrB,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,UAAUA,CAAEC,IAAI,EAAG;EAClCX,UAAU,CAAE,2BAA2B,EAAE;IACxCY,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE,4BAA4B;IACzCC,IAAI,EAAE;EACP,CAAE,CAAC;EAEH,MAAM,CAAEC,KAAK,CAAE,GAAGV,WAAW,CAAEM,IAAK,CAAC;EACrC,OAAOI,KAAK;AACb","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","deprecated","useBlockEditContext","store","blockEditorStore","unlock","useSettings","paths","clientId","select","getBlockSettings","useSetting","path","since","alternative","note","value"],"sources":["@wordpress/block-editor/src/components/use-settings/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Hook that retrieves the given settings for the block instance in use.\n *\n * It looks up the settings first in the block instance hierarchy.\n * If none are found, it'll look them up in the block editor settings.\n *\n * @param {string[]} paths The paths to the settings.\n * @return {any[]} Returns the values defined for the settings.\n * @example\n * ```js\n * const [ fixed, sticky ] = useSettings( 'position.fixed', 'position.sticky' );\n * ```\n */\nexport function useSettings( ...paths ) {\n\tconst { clientId = null } = useBlockEditContext();\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getBlockSettings(\n\t\t\t\tclientId,\n\t\t\t\t...paths\n\t\t\t),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ clientId, ...paths ]\n\t);\n}\n\n/**\n * Hook that retrieves the given setting for the block instance in use.\n *\n * It looks up the setting first in the block instance hierarchy.\n * If none is found, it'll look it up in the block editor settings.\n *\n * @deprecated 6.5.0 Use useSettings instead.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport function useSetting( path ) {\n\tdeprecated( 'wp.blockEditor.useSetting', {\n\t\tsince: '6.5',\n\t\talternative: 'wp.blockEditor.useSettings',\n\t\tnote: 'The new useSettings function can retrieve multiple settings at once, with better performance.',\n\t} );\n\n\tconst [ value ] = useSettings( path );\n\treturn value;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAE,GAAGC,KAAK,EAAG;EACvC,MAAM;IAAEC,QAAQ,GAAG;EAAK,CAAC,GAAGN,mBAAmB,CAAC,CAAC;EACjD,OAAOF,SAAS,CACbS,MAAM,IACPJ,MAAM,CAAEI,MAAM,CAAEL,gBAAiB,CAAE,CAAC,CAACM,gBAAgB,CACpDF,QAAQ,EACR,GAAGD,KACJ,CAAC;EACF;EACA,CAAEC,QAAQ,EAAE,GAAGD,KAAK,CACrB,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,UAAUA,CAAEC,IAAI,EAAG;EAClCX,UAAU,CAAE,2BAA2B,EAAE;IACxCY,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE,4BAA4B;IACzCC,IAAI,EAAE;EACP,CAAE,CAAC;EAEH,MAAM,CAAEC,KAAK,CAAE,GAAGV,WAAW,CAAEM,IAAK,CAAC;EACrC,OAAOI,KAAK;AACb","ignoreList":[]}
@@ -8,11 +8,7 @@ import clsx from 'clsx';
8
8
  */
9
9
  import { __, isRTL } from '@wordpress/i18n';
10
10
  import { textHorizontal, textVertical } from '@wordpress/icons';
11
-
12
- /**
13
- * Internal dependencies
14
- */
15
- import SegmentedTextControl from '../segmented-text-control';
11
+ import { __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon } from '@wordpress/components';
16
12
  import { jsx as _jsx } from "react/jsx-runtime";
17
13
  const WRITING_MODES = [{
18
14
  label: __('Horizontal'),
@@ -39,14 +35,23 @@ export default function WritingModeControl({
39
35
  value,
40
36
  onChange
41
37
  }) {
42
- return /*#__PURE__*/_jsx(SegmentedTextControl, {
38
+ return /*#__PURE__*/_jsx(ToggleGroupControl, {
39
+ isDeselectable: true,
40
+ __nextHasNoMarginBottom: true,
41
+ __next40pxDefaultSize: true,
43
42
  label: __('Orientation'),
44
- options: WRITING_MODES,
45
43
  className: clsx('block-editor-writing-mode-control', className),
46
44
  value: value,
47
45
  onChange: newValue => {
48
46
  onChange(newValue === value ? undefined : newValue);
49
- }
47
+ },
48
+ children: WRITING_MODES.map(option => {
49
+ return /*#__PURE__*/_jsx(ToggleGroupControlOptionIcon, {
50
+ value: option.value,
51
+ icon: option.icon,
52
+ label: option.label
53
+ }, option.value);
54
+ })
50
55
  });
51
56
  }
52
57
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","__","isRTL","textHorizontal","textVertical","SegmentedTextControl","jsx","_jsx","WRITING_MODES","label","value","icon","WritingModeControl","className","onChange","options","newValue","undefined"],"sources":["@wordpress/block-editor/src/components/writing-mode-control/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { textHorizontal, textVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SegmentedTextControl from '../segmented-text-control';\n\nconst WRITING_MODES = [\n\t{\n\t\tlabel: __( 'Horizontal' ),\n\t\tvalue: 'horizontal-tb',\n\t\ticon: textHorizontal,\n\t},\n\t{\n\t\tlabel: __( 'Vertical' ),\n\t\tvalue: isRTL() ? 'vertical-lr' : 'vertical-rl',\n\t\ticon: textVertical,\n\t},\n];\n\n/**\n * Control to facilitate writing mode selections.\n *\n * @param {Object} props Component props.\n * @param {string} props.className Class name to add to the control.\n * @param {string} props.value Currently selected writing mode.\n * @param {Function} props.onChange Handles change in the writing mode selection.\n *\n * @return {Element} Writing Mode control.\n */\nexport default function WritingModeControl( { className, value, onChange } ) {\n\treturn (\n\t\t<SegmentedTextControl\n\t\t\tlabel={ __( 'Orientation' ) }\n\t\t\toptions={ WRITING_MODES }\n\t\t\tclassName={ clsx( 'block-editor-writing-mode-control', className ) }\n\t\t\tvalue={ value }\n\t\t\tonChange={ ( newValue ) => {\n\t\t\t\tonChange( newValue === value ? undefined : newValue );\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,cAAc,EAAEC,YAAY,QAAQ,kBAAkB;;AAE/D;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,2BAA2B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE7D,MAAMC,aAAa,GAAG,CACrB;EACCC,KAAK,EAAER,EAAE,CAAE,YAAa,CAAC;EACzBS,KAAK,EAAE,eAAe;EACtBC,IAAI,EAAER;AACP,CAAC,EACD;EACCM,KAAK,EAAER,EAAE,CAAE,UAAW,CAAC;EACvBS,KAAK,EAAER,KAAK,CAAC,CAAC,GAAG,aAAa,GAAG,aAAa;EAC9CS,IAAI,EAAEP;AACP,CAAC,CACD;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASQ,kBAAkBA,CAAE;EAAEC,SAAS;EAAEH,KAAK;EAAEI;AAAS,CAAC,EAAG;EAC5E,oBACCP,IAAA,CAACF,oBAAoB;IACpBI,KAAK,EAAGR,EAAE,CAAE,aAAc,CAAG;IAC7Bc,OAAO,EAAGP,aAAe;IACzBK,SAAS,EAAGb,IAAI,CAAE,mCAAmC,EAAEa,SAAU,CAAG;IACpEH,KAAK,EAAGA,KAAO;IACfI,QAAQ,EAAKE,QAAQ,IAAM;MAC1BF,QAAQ,CAAEE,QAAQ,KAAKN,KAAK,GAAGO,SAAS,GAAGD,QAAS,CAAC;IACtD;EAAG,CACH,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["clsx","__","isRTL","textHorizontal","textVertical","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOptionIcon","ToggleGroupControlOptionIcon","jsx","_jsx","WRITING_MODES","label","value","icon","WritingModeControl","className","onChange","isDeselectable","__nextHasNoMarginBottom","__next40pxDefaultSize","newValue","undefined","children","map","option"],"sources":["@wordpress/block-editor/src/components/writing-mode-control/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { textHorizontal, textVertical } from '@wordpress/icons';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n} from '@wordpress/components';\n\nconst WRITING_MODES = [\n\t{\n\t\tlabel: __( 'Horizontal' ),\n\t\tvalue: 'horizontal-tb',\n\t\ticon: textHorizontal,\n\t},\n\t{\n\t\tlabel: __( 'Vertical' ),\n\t\tvalue: isRTL() ? 'vertical-lr' : 'vertical-rl',\n\t\ticon: textVertical,\n\t},\n];\n\n/**\n * Control to facilitate writing mode selections.\n *\n * @param {Object} props Component props.\n * @param {string} props.className Class name to add to the control.\n * @param {string} props.value Currently selected writing mode.\n * @param {Function} props.onChange Handles change in the writing mode selection.\n *\n * @return {Element} Writing Mode control.\n */\nexport default function WritingModeControl( { className, value, onChange } ) {\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\tisDeselectable\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Orientation' ) }\n\t\t\tclassName={ clsx( 'block-editor-writing-mode-control', className ) }\n\t\t\tvalue={ value }\n\t\t\tonChange={ ( newValue ) => {\n\t\t\t\tonChange( newValue === value ? undefined : newValue );\n\t\t\t} }\n\t\t>\n\t\t\t{ WRITING_MODES.map( ( option ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\tkey={ option.value }\n\t\t\t\t\t\tvalue={ option.value }\n\t\t\t\t\t\ticon={ option.icon }\n\t\t\t\t\t\tlabel={ option.label }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ToggleGroupControl>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,cAAc,EAAEC,YAAY,QAAQ,kBAAkB;AAC/D,SACCC,gCAAgC,IAAIC,kBAAkB,EACtDC,0CAA0C,IAAIC,4BAA4B,QACpE,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/B,MAAMC,aAAa,GAAG,CACrB;EACCC,KAAK,EAAEX,EAAE,CAAE,YAAa,CAAC;EACzBY,KAAK,EAAE,eAAe;EACtBC,IAAI,EAAEX;AACP,CAAC,EACD;EACCS,KAAK,EAAEX,EAAE,CAAE,UAAW,CAAC;EACvBY,KAAK,EAAEX,KAAK,CAAC,CAAC,GAAG,aAAa,GAAG,aAAa;EAC9CY,IAAI,EAAEV;AACP,CAAC,CACD;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASW,kBAAkBA,CAAE;EAAEC,SAAS;EAAEH,KAAK;EAAEI;AAAS,CAAC,EAAG;EAC5E,oBACCP,IAAA,CAACJ,kBAAkB;IAClBY,cAAc;IACdC,uBAAuB;IACvBC,qBAAqB;IACrBR,KAAK,EAAGX,EAAE,CAAE,aAAc,CAAG;IAC7Be,SAAS,EAAGhB,IAAI,CAAE,mCAAmC,EAAEgB,SAAU,CAAG;IACpEH,KAAK,EAAGA,KAAO;IACfI,QAAQ,EAAKI,QAAQ,IAAM;MAC1BJ,QAAQ,CAAEI,QAAQ,KAAKR,KAAK,GAAGS,SAAS,GAAGD,QAAS,CAAC;IACtD,CAAG;IAAAE,QAAA,EAEDZ,aAAa,CAACa,GAAG,CAAIC,MAAM,IAAM;MAClC,oBACCf,IAAA,CAACF,4BAA4B;QAE5BK,KAAK,EAAGY,MAAM,CAACZ,KAAO;QACtBC,IAAI,EAAGW,MAAM,CAACX,IAAM;QACpBF,KAAK,EAAGa,MAAM,CAACb;MAAO,GAHhBa,MAAM,CAACZ,KAIb,CAAC;IAEJ,CAAE;EAAC,CACgB,CAAC;AAEvB","ignoreList":[]}
@@ -12,13 +12,14 @@ import InspectorControls from '../components/inspector-controls';
12
12
  import { cleanEmptyObject } from './utils';
13
13
  import { store as blockEditorStore } from '../store';
14
14
  import { default as StylesBackgroundPanel, useHasBackgroundPanel, hasBackgroundImageValue } from '../components/global-styles/background-panel';
15
- import { globalStylesDataKey, globalStylesLinksDataKey } from '../store/private-keys';
15
+ import { globalStylesDataKey } from '../store/private-keys';
16
16
  import { jsx as _jsx } from "react/jsx-runtime";
17
17
  export const BACKGROUND_SUPPORT_KEY = 'background';
18
18
 
19
- // Initial control values where no block style is set.
20
- const BACKGROUND_DEFAULT_VALUES = {
21
- backgroundSize: 'cover'
19
+ // Initial control values.
20
+ export const BACKGROUND_BLOCK_DEFAULT_VALUES = {
21
+ backgroundSize: 'cover',
22
+ backgroundPosition: '50% 50%' // used only when backgroundSize is 'contain'.
22
23
  };
23
24
 
24
25
  /**
@@ -40,24 +41,21 @@ export function hasBackgroundSupport(blockName, feature = 'any') {
40
41
  return !!support?.[feature];
41
42
  }
42
43
  export function setBackgroundStyleDefaults(backgroundStyle) {
43
- if (!backgroundStyle) {
44
+ if (!backgroundStyle || !backgroundStyle?.backgroundImage?.url) {
44
45
  return;
45
46
  }
46
- const backgroundImage = backgroundStyle?.backgroundImage;
47
47
  let backgroundStylesWithDefaults;
48
48
 
49
49
  // Set block background defaults.
50
- if (!!backgroundImage?.url) {
51
- if (!backgroundStyle?.backgroundSize) {
52
- backgroundStylesWithDefaults = {
53
- backgroundSize: 'cover'
54
- };
55
- }
56
- if ('contain' === backgroundStyle?.backgroundSize && !backgroundStyle?.backgroundPosition) {
57
- backgroundStylesWithDefaults = {
58
- backgroundPosition: 'center'
59
- };
60
- }
50
+ if (!backgroundStyle?.backgroundSize) {
51
+ backgroundStylesWithDefaults = {
52
+ backgroundSize: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundSize
53
+ };
54
+ }
55
+ if ('contain' === backgroundStyle?.backgroundSize && !backgroundStyle?.backgroundPosition) {
56
+ backgroundStylesWithDefaults = {
57
+ backgroundPosition: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundPosition
58
+ };
61
59
  }
62
60
  return backgroundStylesWithDefaults;
63
61
  }
@@ -115,8 +113,7 @@ export function BackgroundImagePanel({
115
113
  }) {
116
114
  const {
117
115
  style,
118
- inheritedValue,
119
- _links
116
+ inheritedValue
120
117
  } = useSelect(select => {
121
118
  const {
122
119
  getBlockAttributes,
@@ -125,8 +122,8 @@ export function BackgroundImagePanel({
125
122
  const _settings = getSettings();
126
123
  return {
127
124
  style: getBlockAttributes(clientId)?.style,
128
- _links: _settings[globalStylesLinksDataKey],
129
125
  /*
126
+ * To ensure we pass down the right inherited values:
130
127
  * @TODO 1. Pass inherited value down to all block style controls,
131
128
  * See: packages/block-editor/src/hooks/style.js
132
129
  * @TODO 2. Add support for block style variations,
@@ -154,11 +151,10 @@ export function BackgroundImagePanel({
154
151
  inheritedValue: inheritedValue,
155
152
  as: BackgroundInspectorControl,
156
153
  panelId: clientId,
157
- defaultValues: BACKGROUND_DEFAULT_VALUES,
154
+ defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES,
158
155
  settings: updatedSettings,
159
156
  onChange: onChange,
160
- value: style,
161
- themeFileURIs: _links?.['wp:theme-file']
157
+ value: style
162
158
  });
163
159
  }
164
160
  export default {
@@ -1 +1 @@
1
- {"version":3,"names":["getBlockSupport","useSelect","useCallback","InspectorControls","cleanEmptyObject","store","blockEditorStore","default","StylesBackgroundPanel","useHasBackgroundPanel","hasBackgroundImageValue","globalStylesDataKey","globalStylesLinksDataKey","jsx","_jsx","BACKGROUND_SUPPORT_KEY","BACKGROUND_DEFAULT_VALUES","backgroundSize","hasBackgroundSupport","blockName","feature","support","backgroundImage","backgroundRepeat","setBackgroundStyleDefaults","backgroundStyle","backgroundStylesWithDefaults","url","backgroundPosition","useBlockProps","name","style","background","backgroundStyles","getBackgroundImageClasses","BackgroundInspectorControl","children","resetAllFilter","attributes","undefined","group","BackgroundImagePanel","clientId","setAttributes","settings","inheritedValue","_links","select","getBlockAttributes","getSettings","_settings","blocks","onChange","newStyle","updatedSettings","as","panelId","defaultValues","value","themeFileURIs","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/background.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport { cleanEmptyObject } from './utils';\nimport { store as blockEditorStore } from '../store';\nimport {\n\tdefault as StylesBackgroundPanel,\n\tuseHasBackgroundPanel,\n\thasBackgroundImageValue,\n} from '../components/global-styles/background-panel';\nimport {\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n} from '../store/private-keys';\n\nexport const BACKGROUND_SUPPORT_KEY = 'background';\n\n// Initial control values where no block style is set.\nconst BACKGROUND_DEFAULT_VALUES = {\n\tbackgroundSize: 'cover',\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\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\nexport function setBackgroundStyleDefaults( backgroundStyle ) {\n\tif ( ! backgroundStyle ) {\n\t\treturn;\n\t}\n\n\tconst backgroundImage = backgroundStyle?.backgroundImage;\n\tlet backgroundStylesWithDefaults;\n\n\t// Set block background defaults.\n\tif ( !! backgroundImage?.url ) {\n\t\tif ( ! backgroundStyle?.backgroundSize ) {\n\t\t\tbackgroundStylesWithDefaults = {\n\t\t\t\tbackgroundSize: 'cover',\n\t\t\t};\n\t\t}\n\n\t\tif (\n\t\t\t'contain' === backgroundStyle?.backgroundSize &&\n\t\t\t! backgroundStyle?.backgroundPosition\n\t\t) {\n\t\t\tbackgroundStylesWithDefaults = {\n\t\t\t\tbackgroundPosition: 'center',\n\t\t\t};\n\t\t}\n\t}\n\n\treturn backgroundStylesWithDefaults;\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 backgroundStyles = setBackgroundStyleDefaults( style?.background );\n\n\tif ( ! backgroundStyles ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tstyle: {\n\t\t\t...backgroundStyles,\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 BackgroundInspectorControl( { children } ) {\n\tconst resetAllFilter = useCallback( ( attributes ) => {\n\t\treturn {\n\t\t\t...attributes,\n\t\t\tstyle: {\n\t\t\t\t...attributes.style,\n\t\t\t\tbackground: undefined,\n\t\t\t},\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<InspectorControls group=\"background\" resetAllFilter={ resetAllFilter }>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function BackgroundImagePanel( {\n\tclientId,\n\tname,\n\tsetAttributes,\n\tsettings,\n} ) {\n\tconst { style, inheritedValue, _links } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst _settings = getSettings();\n\t\t\treturn {\n\t\t\t\tstyle: getBlockAttributes( clientId )?.style,\n\t\t\t\t_links: _settings[ globalStylesLinksDataKey ],\n\t\t\t\t/*\n\t\t\t\t * @TODO 1. Pass inherited value down to all block style controls,\n\t\t\t\t * See: packages/block-editor/src/hooks/style.js\n\t\t\t\t * @TODO 2. Add support for block style variations,\n\t\t\t\t * See implementation: packages/block-editor/src/hooks/block-style-variation.js\n\t\t\t\t */\n\t\t\t\tinheritedValue:\n\t\t\t\t\t_settings[ globalStylesDataKey ]?.blocks?.[ name ],\n\t\t\t};\n\t\t},\n\t\t[ clientId, name ]\n\t);\n\n\tif (\n\t\t! useHasBackgroundPanel( settings ) ||\n\t\t! hasBackgroundSupport( name, 'backgroundImage' )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst updatedSettings = {\n\t\t...settings,\n\t\tbackground: {\n\t\t\t...settings.background,\n\t\t\tbackgroundSize:\n\t\t\t\tsettings?.background?.backgroundSize &&\n\t\t\t\thasBackgroundSupport( name, 'backgroundSize' ),\n\t\t},\n\t};\n\n\treturn (\n\t\t<StylesBackgroundPanel\n\t\t\tinheritedValue={ inheritedValue }\n\t\t\tas={ BackgroundInspectorControl }\n\t\t\tpanelId={ clientId }\n\t\t\tdefaultValues={ BACKGROUND_DEFAULT_VALUES }\n\t\t\tsettings={ updatedSettings }\n\t\t\tonChange={ onChange }\n\t\t\tvalue={ style }\n\t\t\tthemeFileURIs={ _links?.[ 'wp:theme-file' ] }\n\t\t/>\n\t);\n}\n\nexport default {\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport: hasBackgroundSupport,\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,kCAAkC;AAChE,SAASC,gBAAgB,QAAQ,SAAS;AAC1C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SACCC,OAAO,IAAIC,qBAAqB,EAChCC,qBAAqB,EACrBC,uBAAuB,QACjB,8CAA8C;AACrD,SACCC,mBAAmB,EACnBC,wBAAwB,QAClB,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/B,OAAO,MAAMC,sBAAsB,GAAG,YA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M,GAAIrB,IAAI;IAClD,CAAC;EACF,CAAC,EACD,CAAEY,QAAQ,EAAEZ,IAAI,CACjB,CAAC;EAED,IACC,CAAErB,qBAAqB,CAAEmC,QAAS,CAAC,IACnC,CAAE1B,oBAAoB,CAAEY,IAAI,EAAE,iBAAkB,CAAC,EAChD;IACD,OAAO,IAAI;EACZ;EAEA,MAAMsB,QAAQ,GAAKC,QAAQ,IAAM;IAChCV,aAAa,CAAE;MACdZ,KAAK,EAAE3B,gBAAgB,CAAEiD,QAAS;IACnC,CAAE,CAAC;EACJ,CAAC;EAED,MAAMC,eAAe,GAAG;IACvB,GAAGV,QAAQ;IACXZ,UAAU,EAAE;MACX,GAAGY,QAAQ,CAACZ,UAAU;MACtBf,cAAc,EACb2B,QAAQ,EAAEZ,UAAU,EAAEf,cAAc,IACpCC,oBAAoB,CAAEY,IAAI,EAAE,gBAAiB;IAC/C;EACD,CAAC;EAED,oBACChB,IAAA,CAACN,qBAAqB;IACrBqC,cAAc,EAAGA,cAAgB;IACjCU,EAAE,EAAGpB,0BAA4B;IACjCqB,OAAO,EAAGd,QAAU;IACpBe,aAAa,EAAGzC,yBAA2B;IAC3C4B,QAAQ,EAAGU,eAAiB;IAC5BF,QAAQ,EAAGA,QAAU;IACrBM,KAAK,EAAG3B,KAAO;IACf4B,aAAa,EAAGb,MAAM,GAAI,eAAe;EAAI,CAC7C,CAAC;AAEJ;AAEA,eAAe;EACdjB,aAAa;EACb+B,aAAa,EAAE,CAAE,OAAO,CAAE;EAC1BC,UAAU,EAAE3C;AACb,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["getBlockSupport","useSelect","useCallback","InspectorControls","cleanEmptyObject","store","blockEditorStore","default","StylesBackgroundPanel","useHasBackgroundPanel","hasBackgroundImageValue","globalStylesDataKey","jsx","_jsx","BACKGROUND_SUPPORT_KEY","BACKGROUND_BLOCK_DEFAULT_VALUES","backgroundSize","backgroundPosition","hasBackgroundSupport","blockName","feature","support","backgroundImage","backgroundRepeat","setBackgroundStyleDefaults","backgroundStyle","url","backgroundStylesWithDefaults","useBlockProps","name","style","background","backgroundStyles","getBackgroundImageClasses","BackgroundInspectorControl","children","resetAllFilter","attributes","undefined","group","BackgroundImagePanel","clientId","setAttributes","settings","inheritedValue","select","getBlockAttributes","getSettings","_settings","blocks","onChange","newStyle","updatedSettings","as","panelId","defaultValues","value","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/background.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport { cleanEmptyObject } from './utils';\nimport { store as blockEditorStore } from '../store';\nimport {\n\tdefault as StylesBackgroundPanel,\n\tuseHasBackgroundPanel,\n\thasBackgroundImageValue,\n} from '../components/global-styles/background-panel';\nimport { globalStylesDataKey } from '../store/private-keys';\n\nexport const BACKGROUND_SUPPORT_KEY = 'background';\n\n// Initial control values.\nexport const BACKGROUND_BLOCK_DEFAULT_VALUES = {\n\tbackgroundSize: 'cover',\n\tbackgroundPosition: '50% 50%', // used only when backgroundSize is 'contain'.\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\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\nexport function setBackgroundStyleDefaults( backgroundStyle ) {\n\tif ( ! backgroundStyle || ! backgroundStyle?.backgroundImage?.url ) {\n\t\treturn;\n\t}\n\n\tlet backgroundStylesWithDefaults;\n\n\t// Set block background defaults.\n\tif ( ! backgroundStyle?.backgroundSize ) {\n\t\tbackgroundStylesWithDefaults = {\n\t\t\tbackgroundSize: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundSize,\n\t\t};\n\t}\n\n\tif (\n\t\t'contain' === backgroundStyle?.backgroundSize &&\n\t\t! backgroundStyle?.backgroundPosition\n\t) {\n\t\tbackgroundStylesWithDefaults = {\n\t\t\tbackgroundPosition:\n\t\t\t\tBACKGROUND_BLOCK_DEFAULT_VALUES.backgroundPosition,\n\t\t};\n\t}\n\treturn backgroundStylesWithDefaults;\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 backgroundStyles = setBackgroundStyleDefaults( style?.background );\n\n\tif ( ! backgroundStyles ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tstyle: {\n\t\t\t...backgroundStyles,\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 BackgroundInspectorControl( { children } ) {\n\tconst resetAllFilter = useCallback( ( attributes ) => {\n\t\treturn {\n\t\t\t...attributes,\n\t\t\tstyle: {\n\t\t\t\t...attributes.style,\n\t\t\t\tbackground: undefined,\n\t\t\t},\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<InspectorControls group=\"background\" resetAllFilter={ resetAllFilter }>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function BackgroundImagePanel( {\n\tclientId,\n\tname,\n\tsetAttributes,\n\tsettings,\n} ) {\n\tconst { style, inheritedValue } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst _settings = getSettings();\n\t\t\treturn {\n\t\t\t\tstyle: getBlockAttributes( clientId )?.style,\n\t\t\t\t/*\n\t\t\t\t * To ensure we pass down the right inherited values:\n\t\t\t\t * @TODO 1. Pass inherited value down to all block style controls,\n\t\t\t\t * See: packages/block-editor/src/hooks/style.js\n\t\t\t\t * @TODO 2. Add support for block style variations,\n\t\t\t\t * See implementation: packages/block-editor/src/hooks/block-style-variation.js\n\t\t\t\t */\n\t\t\t\tinheritedValue:\n\t\t\t\t\t_settings[ globalStylesDataKey ]?.blocks?.[ name ],\n\t\t\t};\n\t\t},\n\t\t[ clientId, name ]\n\t);\n\n\tif (\n\t\t! useHasBackgroundPanel( settings ) ||\n\t\t! hasBackgroundSupport( name, 'backgroundImage' )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst updatedSettings = {\n\t\t...settings,\n\t\tbackground: {\n\t\t\t...settings.background,\n\t\t\tbackgroundSize:\n\t\t\t\tsettings?.background?.backgroundSize &&\n\t\t\t\thasBackgroundSupport( name, 'backgroundSize' ),\n\t\t},\n\t};\n\n\treturn (\n\t\t<StylesBackgroundPanel\n\t\t\tinheritedValue={ inheritedValue }\n\t\t\tas={ BackgroundInspectorControl }\n\t\t\tpanelId={ clientId }\n\t\t\tdefaultValues={ BACKGROUND_BLOCK_DEFAULT_VALUES }\n\t\t\tsettings={ updatedSettings }\n\t\t\tonChange={ onChange }\n\t\t\tvalue={ style }\n\t\t/>\n\t);\n}\n\nexport default {\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport: hasBackgroundSupport,\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,OAAO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