@wordpress/block-editor 8.5.7 → 9.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 (462) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +5 -2
  3. package/build/components/block-alignment-control/constants.js +48 -0
  4. package/build/components/block-alignment-control/constants.js.map +1 -0
  5. package/build/components/block-alignment-control/ui.js +9 -40
  6. package/build/components/block-alignment-control/ui.js.map +1 -1
  7. package/build/components/block-alignment-control/ui.native.js +92 -0
  8. package/build/components/block-alignment-control/ui.native.js.map +1 -0
  9. package/build/components/block-alignment-matrix-control/index.js +1 -6
  10. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  11. package/build/components/block-content-overlay/index.js +5 -74
  12. package/build/components/block-content-overlay/index.js.map +1 -1
  13. package/build/components/block-draggable/draggable-chip.native.js +64 -0
  14. package/build/components/block-draggable/draggable-chip.native.js.map +1 -0
  15. package/build/components/block-draggable/dropping-insertion-point.native.js +157 -0
  16. package/build/components/block-draggable/dropping-insertion-point.native.js.map +1 -0
  17. package/build/components/block-draggable/index.native.js +484 -0
  18. package/build/components/block-draggable/index.native.js.map +1 -0
  19. package/build/components/block-draggable/use-scroll-when-dragging.native.js +130 -0
  20. package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -0
  21. package/build/components/block-list/block-list-context.native.js +195 -0
  22. package/build/components/block-list/block-list-context.native.js.map +1 -0
  23. package/build/components/block-list/block-list-item-cell.native.js +67 -0
  24. package/build/components/block-list/block-list-item-cell.native.js.map +1 -0
  25. package/build/components/block-list/block-list-item.native.js +12 -9
  26. package/build/components/block-list/block-list-item.native.js.map +1 -1
  27. package/build/components/block-list/block.native.js +29 -6
  28. package/build/components/block-list/block.native.js.map +1 -1
  29. package/build/components/block-list/index.native.js +75 -23
  30. package/build/components/block-list/index.native.js.map +1 -1
  31. package/build/components/block-list/use-block-props/index.js +8 -4
  32. package/build/components/block-list/use-block-props/index.js.map +1 -1
  33. package/build/components/block-list/use-block-props/use-block-class-names.js +1 -7
  34. package/build/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
  35. package/build/components/block-list/use-in-between-inserter.js +1 -1
  36. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  37. package/build/components/block-lock/modal.js +34 -4
  38. package/build/components/block-lock/modal.js.map +1 -1
  39. package/build/components/block-lock/toolbar.js +2 -1
  40. package/build/components/block-lock/toolbar.js.map +1 -1
  41. package/build/components/block-lock/use-block-lock.js +4 -1
  42. package/build/components/block-lock/use-block-lock.js.map +1 -1
  43. package/build/components/block-mobile-toolbar/index.native.js +9 -3
  44. package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
  45. package/build/components/block-mover/button.js +4 -4
  46. package/build/components/block-mover/button.js.map +1 -1
  47. package/build/components/block-mover/index.js +39 -65
  48. package/build/components/block-mover/index.js.map +1 -1
  49. package/build/components/block-mover/index.native.js +17 -4
  50. package/build/components/block-mover/index.native.js.map +1 -1
  51. package/build/components/block-navigation/dropdown.js +11 -5
  52. package/build/components/block-navigation/dropdown.js.map +1 -1
  53. package/build/components/block-popover/inbetween.js +191 -0
  54. package/build/components/block-popover/inbetween.js.map +1 -0
  55. package/build/components/block-popover/index.js +85 -0
  56. package/build/components/block-popover/index.js.map +1 -0
  57. package/build/components/{block-tools → block-popover}/use-popover-scroll.js +4 -1
  58. package/build/components/block-popover/use-popover-scroll.js.map +1 -0
  59. package/build/components/block-preview/index.js +1 -1
  60. package/build/components/block-preview/index.js.map +1 -1
  61. package/build/components/block-styles/index.js +1 -10
  62. package/build/components/block-styles/index.js.map +1 -1
  63. package/build/components/block-tools/back-compat.js +2 -2
  64. package/build/components/block-tools/back-compat.js.map +1 -1
  65. package/build/components/block-tools/block-selection-button.js +4 -2
  66. package/build/components/block-tools/block-selection-button.js.map +1 -1
  67. package/build/components/block-tools/index.js +5 -5
  68. package/build/components/block-tools/index.js.map +1 -1
  69. package/build/components/block-tools/insertion-point.js +14 -121
  70. package/build/components/block-tools/insertion-point.js.map +1 -1
  71. package/build/components/block-tools/selected-block-popover.js +216 -0
  72. package/build/components/block-tools/selected-block-popover.js.map +1 -0
  73. package/build/components/border-radius-control/input-controls.js +10 -3
  74. package/build/components/border-radius-control/input-controls.js.map +1 -1
  75. package/build/components/color-style-selector/index.js +9 -0
  76. package/build/components/color-style-selector/index.js.map +1 -1
  77. package/build/components/colors-gradients/dropdown.js +149 -44
  78. package/build/components/colors-gradients/dropdown.js.map +1 -1
  79. package/build/components/duotone-control/index.js +5 -1
  80. package/build/components/duotone-control/index.js.map +1 -1
  81. package/build/components/image-editor/use-save-image.js +3 -1
  82. package/build/components/image-editor/use-save-image.js.map +1 -1
  83. package/build/components/index.js +5 -23
  84. package/build/components/index.js.map +1 -1
  85. package/build/components/inserter/index.native.js +31 -9
  86. package/build/components/inserter/index.native.js.map +1 -1
  87. package/build/components/link-control/constants.js +11 -1
  88. package/build/components/link-control/constants.js.map +1 -1
  89. package/build/components/link-control/search-results.js +4 -3
  90. package/build/components/link-control/search-results.js.map +1 -1
  91. package/build/components/link-control/use-search-handler.js +4 -4
  92. package/build/components/link-control/use-search-handler.js.map +1 -1
  93. package/build/components/list-view/block.js +15 -15
  94. package/build/components/list-view/block.js.map +1 -1
  95. package/build/components/list-view/branch.js +9 -13
  96. package/build/components/list-view/branch.js.map +1 -1
  97. package/build/components/list-view/context.js +1 -4
  98. package/build/components/list-view/context.js.map +1 -1
  99. package/build/components/list-view/drop-indicator.js +0 -1
  100. package/build/components/list-view/drop-indicator.js.map +1 -1
  101. package/build/components/list-view/index.js +15 -32
  102. package/build/components/list-view/index.js.map +1 -1
  103. package/build/components/navigable-toolbar/index.js +12 -2
  104. package/build/components/navigable-toolbar/index.js.map +1 -1
  105. package/build/components/rich-text/format-toolbar-container.js +0 -1
  106. package/build/components/rich-text/format-toolbar-container.js.map +1 -1
  107. package/build/components/rich-text/index.js +1 -6
  108. package/build/components/rich-text/index.js.map +1 -1
  109. package/build/components/rich-text/index.native.js +0 -4
  110. package/build/components/rich-text/index.native.js.map +1 -1
  111. package/build/components/url-input/index.js +11 -4
  112. package/build/components/url-input/index.js.map +1 -1
  113. package/build/components/use-block-display-information/index.js +3 -1
  114. package/build/components/use-block-display-information/index.js.map +1 -1
  115. package/build/components/use-block-drop-zone/index.native.js +167 -0
  116. package/build/components/use-block-drop-zone/index.native.js.map +1 -0
  117. package/build/components/use-on-block-drop/index.native.js +95 -0
  118. package/build/components/use-on-block-drop/index.native.js.map +1 -0
  119. package/build/components/use-setting/index.js +42 -18
  120. package/build/components/use-setting/index.js.map +1 -1
  121. package/build/hooks/anchor.js.map +1 -1
  122. package/build/hooks/border.js +463 -44
  123. package/build/hooks/border.js.map +1 -1
  124. package/build/hooks/color-panel.js +14 -7
  125. package/build/hooks/color-panel.js.map +1 -1
  126. package/build/hooks/dimensions.js +2 -2
  127. package/build/hooks/dimensions.js.map +1 -1
  128. package/build/hooks/index.js +3 -1
  129. package/build/hooks/index.js.map +1 -1
  130. package/build/hooks/margin.js +64 -12
  131. package/build/hooks/margin.js.map +1 -1
  132. package/build/hooks/padding.js +60 -12
  133. package/build/hooks/padding.js.map +1 -1
  134. package/build/hooks/settings.js +32 -0
  135. package/build/hooks/settings.js.map +1 -0
  136. package/build/hooks/style.js +14 -13
  137. package/build/hooks/style.js.map +1 -1
  138. package/build/hooks/typography.js +6 -2
  139. package/build/hooks/typography.js.map +1 -1
  140. package/build/hooks/use-border-props.js +22 -32
  141. package/build/hooks/use-border-props.js.map +1 -1
  142. package/build/store/actions.js +14 -2
  143. package/build/store/actions.js.map +1 -1
  144. package/build/store/defaults.js +0 -1
  145. package/build/store/defaults.js.map +1 -1
  146. package/build/store/reducer.js +0 -26
  147. package/build/store/reducer.js.map +1 -1
  148. package/build/store/selectors.js +47 -15
  149. package/build/store/selectors.js.map +1 -1
  150. package/build-module/components/block-alignment-control/constants.js +36 -0
  151. package/build-module/components/block-alignment-control/constants.js.map +1 -0
  152. package/build-module/components/block-alignment-control/ui.js +4 -35
  153. package/build-module/components/block-alignment-control/ui.js.map +1 -1
  154. package/build-module/components/block-alignment-control/ui.native.js +78 -0
  155. package/build-module/components/block-alignment-control/ui.native.js.map +1 -0
  156. package/build-module/components/block-alignment-matrix-control/index.js +1 -6
  157. package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
  158. package/build-module/components/block-content-overlay/index.js +4 -70
  159. package/build-module/components/block-content-overlay/index.js.map +1 -1
  160. package/build-module/components/block-draggable/draggable-chip.native.js +50 -0
  161. package/build-module/components/block-draggable/draggable-chip.native.js.map +1 -0
  162. package/build-module/components/block-draggable/dropping-insertion-point.native.js +137 -0
  163. package/build-module/components/block-draggable/dropping-insertion-point.native.js.map +1 -0
  164. package/build-module/components/block-draggable/index.native.js +449 -0
  165. package/build-module/components/block-draggable/index.native.js.map +1 -0
  166. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +120 -0
  167. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -0
  168. package/build-module/components/block-list/block-list-context.native.js +179 -0
  169. package/build-module/components/block-list/block-list-context.native.js.map +1 -0
  170. package/build-module/components/block-list/block-list-item-cell.native.js +59 -0
  171. package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -0
  172. package/build-module/components/block-list/block-list-item.native.js +12 -9
  173. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  174. package/build-module/components/block-list/block.native.js +28 -6
  175. package/build-module/components/block-list/block.native.js.map +1 -1
  176. package/build-module/components/block-list/index.native.js +72 -23
  177. package/build-module/components/block-list/index.native.js.map +1 -1
  178. package/build-module/components/block-list/use-block-props/index.js +9 -5
  179. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  180. package/build-module/components/block-list/use-block-props/use-block-class-names.js +1 -7
  181. package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
  182. package/build-module/components/block-list/use-in-between-inserter.js +1 -1
  183. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  184. package/build-module/components/block-lock/modal.js +34 -5
  185. package/build-module/components/block-lock/modal.js.map +1 -1
  186. package/build-module/components/block-lock/toolbar.js +2 -1
  187. package/build-module/components/block-lock/toolbar.js.map +1 -1
  188. package/build-module/components/block-lock/use-block-lock.js +4 -1
  189. package/build-module/components/block-lock/use-block-lock.js.map +1 -1
  190. package/build-module/components/block-mobile-toolbar/index.native.js +8 -3
  191. package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
  192. package/build-module/components/block-mover/button.js +5 -5
  193. package/build-module/components/block-mover/button.js.map +1 -1
  194. package/build-module/components/block-mover/index.js +38 -63
  195. package/build-module/components/block-mover/index.js.map +1 -1
  196. package/build-module/components/block-mover/index.native.js +18 -5
  197. package/build-module/components/block-mover/index.native.js.map +1 -1
  198. package/build-module/components/block-navigation/dropdown.js +10 -5
  199. package/build-module/components/block-navigation/dropdown.js.map +1 -1
  200. package/build-module/components/block-popover/inbetween.js +173 -0
  201. package/build-module/components/block-popover/inbetween.js.map +1 -0
  202. package/build-module/components/block-popover/index.js +72 -0
  203. package/build-module/components/block-popover/index.js.map +1 -0
  204. package/build-module/components/{block-tools → block-popover}/use-popover-scroll.js +3 -1
  205. package/build-module/components/block-popover/use-popover-scroll.js.map +1 -0
  206. package/build-module/components/block-preview/index.js +1 -1
  207. package/build-module/components/block-preview/index.js.map +1 -1
  208. package/build-module/components/block-styles/index.js +1 -9
  209. package/build-module/components/block-styles/index.js.map +1 -1
  210. package/build-module/components/block-tools/back-compat.js +1 -1
  211. package/build-module/components/block-tools/back-compat.js.map +1 -1
  212. package/build-module/components/block-tools/block-selection-button.js +3 -2
  213. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  214. package/build-module/components/block-tools/index.js +3 -3
  215. package/build-module/components/block-tools/index.js.map +1 -1
  216. package/build-module/components/block-tools/insertion-point.js +16 -121
  217. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  218. package/build-module/components/block-tools/selected-block-popover.js +199 -0
  219. package/build-module/components/block-tools/selected-block-popover.js.map +1 -0
  220. package/build-module/components/border-radius-control/input-controls.js +11 -4
  221. package/build-module/components/border-radius-control/input-controls.js.map +1 -1
  222. package/build-module/components/color-style-selector/index.js +6 -0
  223. package/build-module/components/color-style-selector/index.js.map +1 -1
  224. package/build-module/components/colors-gradients/dropdown.js +151 -46
  225. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  226. package/build-module/components/duotone-control/index.js +4 -1
  227. package/build-module/components/duotone-control/index.js.map +1 -1
  228. package/build-module/components/image-editor/use-save-image.js +2 -1
  229. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  230. package/build-module/components/index.js +1 -3
  231. package/build-module/components/index.js.map +1 -1
  232. package/build-module/components/inserter/index.native.js +32 -11
  233. package/build-module/components/inserter/index.native.js.map +1 -1
  234. package/build-module/components/link-control/constants.js +5 -0
  235. package/build-module/components/link-control/constants.js.map +1 -1
  236. package/build-module/components/link-control/search-results.js +3 -4
  237. package/build-module/components/link-control/search-results.js.map +1 -1
  238. package/build-module/components/link-control/use-search-handler.js +5 -5
  239. package/build-module/components/link-control/use-search-handler.js.map +1 -1
  240. package/build-module/components/list-view/block.js +15 -16
  241. package/build-module/components/list-view/block.js.map +1 -1
  242. package/build-module/components/list-view/branch.js +9 -13
  243. package/build-module/components/list-view/branch.js.map +1 -1
  244. package/build-module/components/list-view/context.js +1 -4
  245. package/build-module/components/list-view/context.js.map +1 -1
  246. package/build-module/components/list-view/drop-indicator.js +0 -1
  247. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  248. package/build-module/components/list-view/index.js +15 -31
  249. package/build-module/components/list-view/index.js.map +1 -1
  250. package/build-module/components/navigable-toolbar/index.js +12 -2
  251. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  252. package/build-module/components/rich-text/format-toolbar-container.js +0 -1
  253. package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
  254. package/build-module/components/rich-text/index.js +1 -5
  255. package/build-module/components/rich-text/index.js.map +1 -1
  256. package/build-module/components/rich-text/index.native.js +0 -4
  257. package/build-module/components/rich-text/index.native.js.map +1 -1
  258. package/build-module/components/url-input/index.js +11 -4
  259. package/build-module/components/url-input/index.js.map +1 -1
  260. package/build-module/components/use-block-display-information/index.js +3 -1
  261. package/build-module/components/use-block-display-information/index.js.map +1 -1
  262. package/build-module/components/use-block-drop-zone/index.native.js +148 -0
  263. package/build-module/components/use-block-drop-zone/index.native.js.map +1 -0
  264. package/build-module/components/use-on-block-drop/index.native.js +83 -0
  265. package/build-module/components/use-on-block-drop/index.native.js.map +1 -0
  266. package/build-module/components/use-setting/index.js +43 -19
  267. package/build-module/components/use-setting/index.js.map +1 -1
  268. package/build-module/hooks/anchor.js.map +1 -1
  269. package/build-module/hooks/border.js +453 -44
  270. package/build-module/hooks/border.js.map +1 -1
  271. package/build-module/hooks/color-panel.js +11 -6
  272. package/build-module/hooks/color-panel.js.map +1 -1
  273. package/build-module/hooks/dimensions.js +5 -5
  274. package/build-module/hooks/dimensions.js.map +1 -1
  275. package/build-module/hooks/index.js +2 -1
  276. package/build-module/hooks/index.js.map +1 -1
  277. package/build-module/hooks/margin.js +61 -13
  278. package/build-module/hooks/margin.js.map +1 -1
  279. package/build-module/hooks/padding.js +57 -13
  280. package/build-module/hooks/padding.js.map +1 -1
  281. package/build-module/hooks/settings.js +29 -0
  282. package/build-module/hooks/settings.js.map +1 -0
  283. package/build-module/hooks/style.js +15 -14
  284. package/build-module/hooks/style.js.map +1 -1
  285. package/build-module/hooks/typography.js +6 -2
  286. package/build-module/hooks/typography.js.map +1 -1
  287. package/build-module/hooks/use-border-props.js +21 -30
  288. package/build-module/hooks/use-border-props.js.map +1 -1
  289. package/build-module/store/actions.js +14 -2
  290. package/build-module/store/actions.js.map +1 -1
  291. package/build-module/store/defaults.js +0 -1
  292. package/build-module/store/defaults.js.map +1 -1
  293. package/build-module/store/reducer.js +0 -24
  294. package/build-module/store/reducer.js.map +1 -1
  295. package/build-module/store/selectors.js +44 -15
  296. package/build-module/store/selectors.js.map +1 -1
  297. package/build-style/style-rtl.css +148 -410
  298. package/build-style/style.css +148 -410
  299. package/package.json +28 -28
  300. package/src/components/block-alignment-control/constants.js +45 -0
  301. package/src/components/block-alignment-control/ui.js +69 -109
  302. package/src/components/block-alignment-control/ui.native.js +86 -0
  303. package/src/components/block-alignment-matrix-control/index.js +1 -5
  304. package/src/components/block-content-overlay/index.js +9 -79
  305. package/src/components/block-content-overlay/style.scss +2 -11
  306. package/src/components/block-draggable/draggable-chip.native.js +49 -0
  307. package/src/components/block-draggable/dropping-insertion-point.native.js +181 -0
  308. package/src/components/block-draggable/dropping-insertion-point.native.scss +8 -0
  309. package/src/components/block-draggable/index.native.js +458 -0
  310. package/src/components/block-draggable/style.native.scss +19 -0
  311. package/src/components/block-draggable/use-scroll-when-dragging.native.js +135 -0
  312. package/src/components/block-list/block-list-context.native.js +175 -0
  313. package/src/components/block-list/block-list-item-cell.native.js +49 -0
  314. package/src/components/block-list/block-list-item.native.js +7 -11
  315. package/src/components/block-list/block.native.js +38 -8
  316. package/src/components/block-list/index.native.js +54 -13
  317. package/src/components/block-list/style.scss +7 -18
  318. package/src/components/block-list/test/block-list-context.native.js +253 -0
  319. package/src/components/block-list/test/fixtures/block-list-context.native.js +79 -0
  320. package/src/components/block-list/use-block-props/index.js +10 -5
  321. package/src/components/block-list/use-block-props/use-block-class-names.js +1 -11
  322. package/src/components/block-list/use-in-between-inserter.js +1 -1
  323. package/src/components/block-lock/modal.js +42 -3
  324. package/src/components/block-lock/toolbar.js +2 -2
  325. package/src/components/block-lock/use-block-lock.js +4 -1
  326. package/src/components/block-mobile-toolbar/index.native.js +8 -1
  327. package/src/components/block-mover/button.js +5 -7
  328. package/src/components/block-mover/index.js +37 -60
  329. package/src/components/block-mover/index.native.js +22 -6
  330. package/src/components/block-mover/stories/index.js +110 -0
  331. package/src/components/block-mover/style.scss +48 -138
  332. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +6 -0
  333. package/src/components/block-navigation/dropdown.js +12 -8
  334. package/src/components/block-popover/README.md +41 -0
  335. package/src/components/block-popover/inbetween.js +188 -0
  336. package/src/components/block-popover/index.js +75 -0
  337. package/src/components/block-popover/style.scss +28 -0
  338. package/src/components/{block-tools → block-popover}/use-popover-scroll.js +3 -1
  339. package/src/components/block-preview/index.js +1 -4
  340. package/src/components/block-styles/index.js +1 -12
  341. package/src/components/block-switcher/style.scss +2 -43
  342. package/src/components/block-toolbar/style.scss +0 -12
  343. package/src/components/block-tools/back-compat.js +1 -1
  344. package/src/components/block-tools/block-selection-button.js +3 -1
  345. package/src/components/block-tools/index.js +6 -4
  346. package/src/components/block-tools/insertion-point.js +19 -152
  347. package/src/components/block-tools/{block-popover.js → selected-block-popover.js} +24 -151
  348. package/src/components/block-tools/style.scss +12 -135
  349. package/src/components/border-radius-control/input-controls.js +16 -8
  350. package/src/components/border-radius-control/style.scss +7 -3
  351. package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
  352. package/src/components/color-style-selector/index.js +18 -9
  353. package/src/components/colors-gradients/dropdown.js +156 -62
  354. package/src/components/colors-gradients/style.scss +51 -23
  355. package/src/components/default-block-appender/style.scss +1 -2
  356. package/src/components/duotone-control/index.js +8 -1
  357. package/src/components/duotone-control/style.scss +1 -7
  358. package/src/components/gradients/README.md +29 -0
  359. package/src/components/image-editor/use-save-image.js +2 -1
  360. package/src/components/image-size-control/README.md +1 -1
  361. package/src/components/index.js +1 -3
  362. package/src/components/inserter/index.native.js +60 -25
  363. package/src/components/inserter/style.native.scss +25 -3
  364. package/src/components/inserter/style.scss +2 -1
  365. package/src/components/link-control/constants.js +11 -0
  366. package/src/components/link-control/search-results.js +4 -5
  367. package/src/components/link-control/use-search-handler.js +11 -5
  368. package/src/components/list-view/block.js +24 -34
  369. package/src/components/list-view/branch.js +10 -20
  370. package/src/components/list-view/context.js +1 -4
  371. package/src/components/list-view/drop-indicator.js +0 -1
  372. package/src/components/list-view/index.js +11 -41
  373. package/src/components/list-view/style.scss +2 -1
  374. package/src/components/navigable-toolbar/README.md +16 -0
  375. package/src/components/navigable-toolbar/index.js +12 -2
  376. package/src/components/preview-options/style.scss +0 -4
  377. package/src/components/rich-text/format-toolbar-container.js +0 -1
  378. package/src/components/rich-text/index.js +1 -3
  379. package/src/components/rich-text/index.native.js +0 -4
  380. package/src/components/rich-text/style.scss +2 -8
  381. package/src/components/url-input/index.js +9 -4
  382. package/src/components/use-block-display-information/index.js +2 -0
  383. package/src/components/use-block-drop-zone/index.native.js +173 -0
  384. package/src/components/use-on-block-drop/index.native.js +119 -0
  385. package/src/components/use-setting/index.js +57 -21
  386. package/src/hooks/anchor.js +1 -1
  387. package/src/hooks/border.js +429 -72
  388. package/src/hooks/color-panel.js +13 -9
  389. package/src/hooks/color.scss +0 -62
  390. package/src/hooks/dimensions.js +44 -38
  391. package/src/hooks/index.js +2 -1
  392. package/src/hooks/margin.js +64 -15
  393. package/src/hooks/padding.js +60 -15
  394. package/src/hooks/padding.scss +12 -0
  395. package/src/hooks/settings.js +32 -0
  396. package/src/hooks/style.js +25 -39
  397. package/src/hooks/test/settings.js +48 -0
  398. package/src/hooks/typography.js +2 -0
  399. package/src/hooks/use-border-props.js +15 -32
  400. package/src/store/actions.js +14 -2
  401. package/src/store/defaults.js +0 -1
  402. package/src/store/reducer.js +0 -21
  403. package/src/store/selectors.js +46 -15
  404. package/src/store/test/actions.js +0 -18
  405. package/src/store/test/reducer.js +0 -19
  406. package/src/store/test/selectors.js +17 -19
  407. package/src/style.scss +2 -3
  408. package/tsconfig.tsbuildinfo +1 -1
  409. package/build/components/block-mobile-toolbar/index.js +0 -42
  410. package/build/components/block-mobile-toolbar/index.js.map +0 -1
  411. package/build/components/block-tools/block-popover.js +0 -327
  412. package/build/components/block-tools/block-popover.js.map +0 -1
  413. package/build/components/block-tools/use-popover-scroll.js.map +0 -1
  414. package/build/components/border-style-control/index.js +0 -60
  415. package/build/components/border-style-control/index.js.map +0 -1
  416. package/build/components/colors-gradients/tools-panel-color-dropdown.js +0 -89
  417. package/build/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
  418. package/build/components/list-view/appender.js +0 -93
  419. package/build/components/list-view/appender.js.map +0 -1
  420. package/build/components/list-view/list-item.js +0 -62
  421. package/build/components/list-view/list-item.js.map +0 -1
  422. package/build/components/rich-text/use-caret-in-format.js +0 -43
  423. package/build/components/rich-text/use-caret-in-format.js.map +0 -1
  424. package/build/hooks/border-color.js +0 -302
  425. package/build/hooks/border-color.js.map +0 -1
  426. package/build/hooks/border-style.js +0 -96
  427. package/build/hooks/border-style.js.map +0 -1
  428. package/build/hooks/border-width.js +0 -162
  429. package/build/hooks/border-width.js.map +0 -1
  430. package/build-module/components/block-mobile-toolbar/index.js +0 -31
  431. package/build-module/components/block-mobile-toolbar/index.js.map +0 -1
  432. package/build-module/components/block-tools/block-popover.js +0 -306
  433. package/build-module/components/block-tools/block-popover.js.map +0 -1
  434. package/build-module/components/block-tools/use-popover-scroll.js.map +0 -1
  435. package/build-module/components/border-style-control/index.js +0 -50
  436. package/build-module/components/border-style-control/index.js.map +0 -1
  437. package/build-module/components/colors-gradients/tools-panel-color-dropdown.js +0 -75
  438. package/build-module/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
  439. package/build-module/components/list-view/appender.js +0 -76
  440. package/build-module/components/list-view/appender.js.map +0 -1
  441. package/build-module/components/list-view/list-item.js +0 -47
  442. package/build-module/components/list-view/list-item.js.map +0 -1
  443. package/build-module/components/rich-text/use-caret-in-format.js +0 -33
  444. package/build-module/components/rich-text/use-caret-in-format.js.map +0 -1
  445. package/build-module/hooks/border-color.js +0 -276
  446. package/build-module/hooks/border-color.js.map +0 -1
  447. package/build-module/hooks/border-style.js +0 -78
  448. package/build-module/hooks/border-style.js.map +0 -1
  449. package/build-module/hooks/border-width.js +0 -143
  450. package/build-module/hooks/border-width.js.map +0 -1
  451. package/src/components/block-alignment-matrix-control/style.scss +0 -10
  452. package/src/components/block-mobile-toolbar/index.js +0 -24
  453. package/src/components/block-mobile-toolbar/style.scss +0 -29
  454. package/src/components/border-style-control/index.js +0 -47
  455. package/src/components/border-style-control/style.scss +0 -18
  456. package/src/components/colors-gradients/tools-panel-color-dropdown.js +0 -85
  457. package/src/components/list-view/appender.js +0 -82
  458. package/src/components/list-view/list-item.js +0 -59
  459. package/src/components/rich-text/use-caret-in-format.js +0 -28
  460. package/src/hooks/border-color.js +0 -315
  461. package/src/hooks/border-style.js +0 -64
  462. package/src/hooks/border-width.js +0 -139
@@ -18,15 +18,11 @@ var _components = require("@wordpress/components");
18
18
 
19
19
  var _compose = require("@wordpress/compose");
20
20
 
21
- var _i18n = require("@wordpress/i18n");
22
-
23
21
  var _inserter = _interopRequireDefault(require("../inserter"));
24
22
 
25
23
  var _store = require("../../store");
26
24
 
27
- var _useBlockRefs = require("../block-list/use-block-props/use-block-refs");
28
-
29
- var _usePopoverScroll = require("./use-popover-scroll");
25
+ var _inbetween = _interopRequireDefault(require("../block-popover/inbetween"));
30
26
 
31
27
  /**
32
28
  * External dependencies
@@ -96,87 +92,8 @@ function InsertionPointPopover(_ref) {
96
92
  isInserterShown: insertionPoint === null || insertionPoint === void 0 ? void 0 : insertionPoint.__unstableWithInserter
97
93
  };
98
94
  }, []);
99
- const previousElement = (0, _useBlockRefs.__unstableUseBlockElement)(previousClientId);
100
- const nextElement = (0, _useBlockRefs.__unstableUseBlockElement)(nextClientId);
101
95
  const isVertical = orientation === 'vertical';
102
- const style = (0, _element.useMemo)(() => {
103
- if (!previousElement && !nextElement) {
104
- return {};
105
- }
106
-
107
- const previousRect = previousElement ? previousElement.getBoundingClientRect() : null;
108
- const nextRect = nextElement ? nextElement.getBoundingClientRect() : null;
109
-
110
- if (isVertical) {
111
- return {
112
- width: previousElement ? previousElement.offsetWidth : nextElement.offsetWidth,
113
- height: nextRect && previousRect ? nextRect.top - previousRect.bottom : 0
114
- };
115
- }
116
-
117
- let width = 0;
118
-
119
- if (previousRect && nextRect) {
120
- width = (0, _i18n.isRTL)() ? previousRect.left - nextRect.right : nextRect.left - previousRect.right;
121
- }
122
-
123
- return {
124
- width,
125
- height: previousElement ? previousElement.offsetHeight : nextElement.offsetHeight
126
- };
127
- }, [previousElement, nextElement]);
128
- const getAnchorRect = (0, _element.useCallback)(() => {
129
- if (!previousElement && !nextElement) {
130
- return {};
131
- }
132
-
133
- const {
134
- ownerDocument
135
- } = previousElement || nextElement;
136
- const previousRect = previousElement ? previousElement.getBoundingClientRect() : null;
137
- const nextRect = nextElement ? nextElement.getBoundingClientRect() : null;
138
-
139
- if (isVertical) {
140
- if ((0, _i18n.isRTL)()) {
141
- return {
142
- top: previousRect ? previousRect.bottom : nextRect.top,
143
- left: previousRect ? previousRect.right : nextRect.right,
144
- right: previousRect ? previousRect.left : nextRect.left,
145
- bottom: nextRect ? nextRect.top : previousRect.bottom,
146
- ownerDocument
147
- };
148
- }
149
-
150
- return {
151
- top: previousRect ? previousRect.bottom : nextRect.top,
152
- left: previousRect ? previousRect.left : nextRect.left,
153
- right: previousRect ? previousRect.right : nextRect.right,
154
- bottom: nextRect ? nextRect.top : previousRect.bottom,
155
- ownerDocument
156
- };
157
- }
158
-
159
- if ((0, _i18n.isRTL)()) {
160
- return {
161
- top: previousRect ? previousRect.top : nextRect.top,
162
- left: previousRect ? previousRect.left : nextRect.right,
163
- right: nextRect ? nextRect.right : previousRect.left,
164
- bottom: previousRect ? previousRect.bottom : nextRect.bottom,
165
- ownerDocument
166
- };
167
- }
168
-
169
- return {
170
- top: previousRect ? previousRect.top : nextRect.top,
171
- left: previousRect ? previousRect.right : nextRect.left,
172
- right: nextRect ? nextRect.left : previousRect.right,
173
- bottom: previousRect ? previousRect.bottom : nextRect.bottom,
174
- ownerDocument
175
- };
176
- }, [previousElement, nextElement]);
177
- const popoverScrollRef = (0, _usePopoverScroll.usePopoverScroll)(__unstableContentRef);
178
96
  const disableMotion = (0, _compose.useReducedMotion)();
179
- const className = (0, _classnames.default)('block-editor-block-list__insertion-point', 'is-' + orientation);
180
97
 
181
98
  function onClick(event) {
182
99
  if (event.target === ref.current && nextClientId) {
@@ -198,12 +115,9 @@ function InsertionPointPopover(_ref) {
198
115
  if (event.target === ref.current && !openRef.current) {
199
116
  hideInsertionPoint();
200
117
  }
201
- } // Only show the in-between inserter between blocks, so when there's a
202
- // previous and a next element.
118
+ } // Define animation variants for the line element.
203
119
 
204
120
 
205
- const showInsertionPointInserter = previousElement && nextElement && isInserterShown; // Define animation variants for the line element.
206
-
207
121
  const horizontalLine = {
208
122
  start: {
209
123
  width: 0,
@@ -255,7 +169,7 @@ function InsertionPointPopover(_ref) {
255
169
  opacity: 1,
256
170
  borderRadius: '2px',
257
171
  transition: {
258
- delay: showInsertionPointInserter ? 0.4 : 0
172
+ delay: isInserterShown ? 0.4 : 0
259
173
  }
260
174
  },
261
175
  hover: { ...(!isVertical ? horizontalLine.hover : verticalLine.hover),
@@ -277,27 +191,12 @@ function InsertionPointPopover(_ref) {
277
191
  }
278
192
  }
279
193
  };
280
- /* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
281
- // While ideally it would be enough to capture the
282
- // bubbling focus event from the Inserter, due to the
283
- // characteristics of click focusing of `button`s in
284
- // Firefox and Safari, it is not reliable.
285
- //
286
- // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
287
-
288
- return (0, _element.createElement)(_components.Popover, {
289
- ref: popoverScrollRef,
290
- noArrow: true,
291
- animate: false,
292
- getAnchorRect: getAnchorRect,
293
- focusOnMount: false,
294
- className: "block-editor-block-list__insertion-point-popover" // Render in the old slot if needed for backward compatibility,
295
- // otherwise render in place (not in the the default popover slot).
296
- ,
297
- __unstableSlotName: __unstablePopoverSlot || null // Forces a remount of the popover when its position changes
298
- // This makes sure the popover doesn't animate from its previous position.
299
- ,
300
- key: nextClientId + '--' + rootClientId
194
+ const className = (0, _classnames.default)('block-editor-block-list__insertion-point', 'is-' + orientation);
195
+ return (0, _element.createElement)(_inbetween.default, {
196
+ previousClientId: previousClientId,
197
+ nextClientId: nextClientId,
198
+ __unstablePopoverSlot: __unstablePopoverSlot,
199
+ __unstableContentRef: __unstableContentRef
301
200
  }, (0, _element.createElement)(_components.__unstableMotion.div, {
302
201
  layout: !disableMotion,
303
202
  initial: disableMotion ? 'rest' : 'start',
@@ -310,14 +209,13 @@ function InsertionPointPopover(_ref) {
310
209
  onClick: onClick,
311
210
  onFocus: onFocus,
312
211
  className: (0, _classnames.default)(className, {
313
- 'is-with-inserter': showInsertionPointInserter
212
+ 'is-with-inserter': isInserterShown
314
213
  }),
315
- onHoverEnd: maybeHideInserterPoint,
316
- style: style
214
+ onHoverEnd: maybeHideInserterPoint
317
215
  }, (0, _element.createElement)(_components.__unstableMotion.div, {
318
216
  variants: lineVariants,
319
217
  className: "block-editor-block-list__insertion-point-indicator"
320
- }), showInsertionPointInserter && (0, _element.createElement)(_components.__unstableMotion.div, {
218
+ }), isInserterShown && (0, _element.createElement)(_components.__unstableMotion.div, {
321
219
  variants: inserterVariants,
322
220
  className: (0, _classnames.default)('block-editor-block-list__insertion-point-inserter')
323
221
  }, (0, _element.createElement)(_inserter.default, {
@@ -332,23 +230,18 @@ function InsertionPointPopover(_ref) {
332
230
  openRef.current = false;
333
231
  }
334
232
  }))));
335
- /* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
336
233
  }
337
234
 
338
235
  function InsertionPoint(_ref2) {
339
236
  let {
340
237
  children,
341
- __unstablePopoverSlot,
342
- __unstableContentRef
238
+ ...props
343
239
  } = _ref2;
344
240
  const isVisible = (0, _data.useSelect)(select => {
345
241
  return select(_store.store).isBlockInsertionPointVisible();
346
242
  }, []);
347
243
  return (0, _element.createElement)(InsertionPointOpenRef.Provider, {
348
244
  value: (0, _element.useRef)(false)
349
- }, isVisible && (0, _element.createElement)(InsertionPointPopover, {
350
- __unstablePopoverSlot: __unstablePopoverSlot,
351
- __unstableContentRef: __unstableContentRef
352
- }), children);
245
+ }, isVisible && (0, _element.createElement)(InsertionPointPopover, props), children);
353
246
  }
354
247
  //# sourceMappingURL=insertion-point.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/insertion-point.js"],"names":["InsertionPointOpenRef","InsertionPointPopover","__unstablePopoverSlot","__unstableContentRef","selectBlock","hideInsertionPoint","blockEditorStore","openRef","ref","orientation","previousClientId","nextClientId","rootClientId","isInserterShown","select","getBlockOrder","getBlockListSettings","getBlockInsertionPoint","isBlockBeingDragged","getPreviousBlockClientId","getNextBlockClientId","insertionPoint","order","length","_previousClientId","index","_nextClientId","__unstableWithInserter","previousElement","nextElement","isVertical","style","previousRect","getBoundingClientRect","nextRect","width","offsetWidth","height","top","bottom","left","right","offsetHeight","getAnchorRect","ownerDocument","popoverScrollRef","disableMotion","className","onClick","event","target","current","onFocus","maybeHideInserterPoint","showInsertionPointInserter","horizontalLine","start","x","rest","hover","verticalLine","y","lineVariants","opacity","borderRadius","transition","delay","inserterVariants","scale","isOpen","InsertionPoint","children","isVisible","isBlockInsertionPointVisible"],"mappings":";;;;;;;;;;AASA;;AANA;;AAKA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAMO,MAAMA,qBAAqB,GAAG,6BAA9B;;;AAEP,SAASC,qBAAT,OAGI;AAAA,MAH4B;AAC/BC,IAAAA,qBAD+B;AAE/BC,IAAAA;AAF+B,GAG5B;AACH,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,MAAsC,uBAAaC,YAAb,CAA5C;AACA,QAAMC,OAAO,GAAG,yBAAYP,qBAAZ,CAAhB;AACA,QAAMQ,GAAG,GAAG,sBAAZ;AACA,QAAM;AACLC,IAAAA,WADK;AAELC,IAAAA,gBAFK;AAGLC,IAAAA,YAHK;AAILC,IAAAA,YAJK;AAKLC,IAAAA;AALK,MAMF,qBAAaC,MAAF,IAAc;AAAA;;AAC5B,UAAM;AACLC,MAAAA,aADK;AAELC,MAAAA,oBA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H,QAAMqE,SAAS,GAAG,qBAAa1D,MAAF,IAAc;AAC1C,WAAOA,MAAM,CAAER,YAAF,CAAN,CAA2BmE,4BAA3B,EAAP;AACA,GAFiB,EAEf,EAFe,CAAlB;AAIA,SACC,4BAAC,qBAAD,CAAuB,QAAvB;AAAgC,IAAA,KAAK,EAAG,qBAAQ,KAAR;AAAxC,KACGD,SAAS,IACV,4BAAC,qBAAD;AACC,IAAA,qBAAqB,EAAGtE,qBADzB;AAEC,IAAA,oBAAoB,EAAGC;AAFxB,IAFF,EAOGoE,QAPH,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseCallback,\n\tuseRef,\n\tuseMemo,\n\tcreateContext,\n\tuseContext,\n} from '@wordpress/element';\nimport { Popover, __unstableMotion as motion } from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport { store as blockEditorStore } from '../../store';\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { usePopoverScroll } from './use-popover-scroll';\n\nexport const InsertionPointOpenRef = createContext();\n\nfunction InsertionPointPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst { selectBlock, hideInsertionPoint } = useDispatch( blockEditorStore );\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst ref = useRef();\n\tconst {\n\t\torientation,\n\t\tpreviousClientId,\n\t\tnextClientId,\n\t\trootClientId,\n\t\tisInserterShown,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockOrder,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockInsertionPoint,\n\t\t\tisBlockBeingDragged,\n\t\t\tgetPreviousBlockClientId,\n\t\t\tgetNextBlockClientId,\n\t\t} = select( blockEditorStore );\n\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet _previousClientId = order[ insertionPoint.index - 1 ];\n\t\tlet _nextClientId = order[ insertionPoint.index ];\n\n\t\twhile ( isBlockBeingDragged( _previousClientId ) ) {\n\t\t\t_previousClientId = getPreviousBlockClientId( _previousClientId );\n\t\t}\n\n\t\twhile ( isBlockBeingDragged( _nextClientId ) ) {\n\t\t\t_nextClientId = getNextBlockClientId( _nextClientId );\n\t\t}\n\n\t\treturn {\n\t\t\tpreviousClientId: _previousClientId,\n\t\t\tnextClientId: _nextClientId,\n\t\t\torientation:\n\t\t\t\tgetBlockListSettings( insertionPoint.rootClientId )\n\t\t\t\t\t?.orientation || 'vertical',\n\t\t\trootClientId: insertionPoint.rootClientId,\n\t\t\tisInserterShown: insertionPoint?.__unstableWithInserter,\n\t\t};\n\t}, [] );\n\tconst previousElement = useBlockElement( previousClientId );\n\tconst nextElement = useBlockElement( nextClientId );\n\tconst isVertical = orientation === 'vertical';\n\tconst style = useMemo( () => {\n\t\tif ( ! previousElement && ! nextElement ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst previousRect = previousElement\n\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t: null;\n\t\tconst nextRect = nextElement\n\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t: null;\n\n\t\tif ( isVertical ) {\n\t\t\treturn {\n\t\t\t\twidth: previousElement\n\t\t\t\t\t? previousElement.offsetWidth\n\t\t\t\t\t: nextElement.offsetWidth,\n\t\t\t\theight:\n\t\t\t\t\tnextRect && previousRect\n\t\t\t\t\t\t? nextRect.top - previousRect.bottom\n\t\t\t\t\t\t: 0,\n\t\t\t};\n\t\t}\n\n\t\tlet width = 0;\n\t\tif ( previousRect && nextRect ) {\n\t\t\twidth = isRTL()\n\t\t\t\t? previousRect.left - nextRect.right\n\t\t\t\t: nextRect.left - previousRect.right;\n\t\t}\n\n\t\treturn {\n\t\t\twidth,\n\t\t\theight: previousElement\n\t\t\t\t? previousElement.offsetHeight\n\t\t\t\t: nextElement.offsetHeight,\n\t\t};\n\t}, [ previousElement, nextElement ] );\n\n\tconst getAnchorRect = useCallback( () => {\n\t\tif ( ! previousElement && ! nextElement ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst { ownerDocument } = previousElement || nextElement;\n\n\t\tconst previousRect = previousElement\n\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t: null;\n\t\tconst nextRect = nextElement\n\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t: null;\n\n\t\tif ( isVertical ) {\n\t\t\tif ( isRTL() ) {\n\t\t\t\treturn {\n\t\t\t\t\ttop: previousRect ? previousRect.bottom : nextRect.top,\n\t\t\t\t\tleft: previousRect ? previousRect.right : nextRect.right,\n\t\t\t\t\tright: previousRect ? previousRect.left : nextRect.left,\n\t\t\t\t\tbottom: nextRect ? nextRect.top : previousRect.bottom,\n\t\t\t\t\townerDocument,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttop: previousRect ? previousRect.bottom : nextRect.top,\n\t\t\t\tleft: previousRect ? previousRect.left : nextRect.left,\n\t\t\t\tright: previousRect ? previousRect.right : nextRect.right,\n\t\t\t\tbottom: nextRect ? nextRect.top : previousRect.bottom,\n\t\t\t\townerDocument,\n\t\t\t};\n\t\t}\n\n\t\tif ( isRTL() ) {\n\t\t\treturn {\n\t\t\t\ttop: previousRect ? previousRect.top : nextRect.top,\n\t\t\t\tleft: previousRect ? previousRect.left : nextRect.right,\n\t\t\t\tright: nextRect ? nextRect.right : previousRect.left,\n\t\t\t\tbottom: previousRect ? previousRect.bottom : nextRect.bottom,\n\t\t\t\townerDocument,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\ttop: previousRect ? previousRect.top : nextRect.top,\n\t\t\tleft: previousRect ? previousRect.right : nextRect.left,\n\t\t\tright: nextRect ? nextRect.left : previousRect.right,\n\t\t\tbottom: previousRect ? previousRect.bottom : nextRect.bottom,\n\t\t\townerDocument,\n\t\t};\n\t}, [ previousElement, nextElement ] );\n\n\tconst popoverScrollRef = usePopoverScroll( __unstableContentRef );\n\tconst disableMotion = useReducedMotion();\n\n\tconst className = classnames(\n\t\t'block-editor-block-list__insertion-point',\n\t\t'is-' + orientation\n\t);\n\n\tfunction onClick( event ) {\n\t\tif ( event.target === ref.current && nextClientId ) {\n\t\t\tselectBlock( nextClientId, -1 );\n\t\t}\n\t}\n\n\tfunction onFocus( event ) {\n\t\t// Only handle click on the wrapper specifically, and not an event\n\t\t// bubbled from the inserter itself.\n\t\tif ( event.target !== ref.current ) {\n\t\t\topenRef.current = true;\n\t\t}\n\t}\n\n\tfunction maybeHideInserterPoint( event ) {\n\t\t// Only hide the inserter if it's triggered on the wrapper,\n\t\t// and the inserter is not open.\n\t\tif ( event.target === ref.current && ! openRef.current ) {\n\t\t\thideInsertionPoint();\n\t\t}\n\t}\n\n\t// Only show the in-between inserter between blocks, so when there's a\n\t// previous and a next element.\n\tconst showInsertionPointInserter =\n\t\tpreviousElement && nextElement && isInserterShown;\n\n\t// Define animation variants for the line element.\n\tconst horizontalLine = {\n\t\tstart: {\n\t\t\twidth: 0,\n\t\t\ttop: '50%',\n\t\t\tbottom: '50%',\n\t\t\tx: 0,\n\t\t},\n\t\trest: {\n\t\t\twidth: 4,\n\t\t\ttop: 0,\n\t\t\tbottom: 0,\n\t\t\tx: -2,\n\t\t},\n\t\thover: {\n\t\t\twidth: 4,\n\t\t\ttop: 0,\n\t\t\tbottom: 0,\n\t\t\tx: -2,\n\t\t},\n\t};\n\tconst verticalLine = {\n\t\tstart: {\n\t\t\theight: 0,\n\t\t\tleft: '50%',\n\t\t\tright: '50%',\n\t\t\ty: 0,\n\t\t},\n\t\trest: {\n\t\t\theight: 4,\n\t\t\tleft: 0,\n\t\t\tright: 0,\n\t\t\ty: -2,\n\t\t},\n\t\thover: {\n\t\t\theight: 4,\n\t\t\tleft: 0,\n\t\t\tright: 0,\n\t\t\ty: -2,\n\t\t},\n\t};\n\tconst lineVariants = {\n\t\t// Initial position starts from the center and invisible.\n\t\tstart: {\n\t\t\t...( ! isVertical ? horizontalLine.start : verticalLine.start ),\n\t\t\topacity: 0,\n\t\t},\n\t\t// The line expands to fill the container. If the inserter is visible it\n\t\t// is delayed so it appears orchestrated.\n\t\trest: {\n\t\t\t...( ! isVertical ? horizontalLine.rest : verticalLine.rest ),\n\t\t\topacity: 1,\n\t\t\tborderRadius: '2px',\n\t\t\ttransition: { delay: showInsertionPointInserter ? 0.4 : 0 },\n\t\t},\n\t\thover: {\n\t\t\t...( ! isVertical ? horizontalLine.hover : verticalLine.hover ),\n\t\t\topacity: 1,\n\t\t\tborderRadius: '2px',\n\t\t\ttransition: { delay: 0.4 },\n\t\t},\n\t};\n\n\tconst inserterVariants = {\n\t\tstart: {\n\t\t\tscale: disableMotion ? 1 : 0,\n\t\t},\n\t\trest: {\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: 0.2 },\n\t\t},\n\t};\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n\t// While ideally it would be enough to capture the\n\t// bubbling focus event from the Inserter, due to the\n\t// characteristics of click focusing of `button`s in\n\t// Firefox and Safari, it is not reliable.\n\t//\n\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\treturn (\n\t\t<Popover\n\t\t\tref={ popoverScrollRef }\n\t\t\tnoArrow\n\t\t\tanimate={ false }\n\t\t\tgetAnchorRect={ getAnchorRect }\n\t\t\tfocusOnMount={ false }\n\t\t\tclassName=\"block-editor-block-list__insertion-point-popover\"\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot || null }\n\t\t\t// Forces a remount of the popover when its position changes\n\t\t\t// This makes sure the popover doesn't animate from its previous position.\n\t\t\tkey={ nextClientId + '--' + rootClientId }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tlayout={ ! disableMotion }\n\t\t\t\tinitial={ disableMotion ? 'rest' : 'start' }\n\t\t\t\tanimate=\"rest\"\n\t\t\t\twhileHover=\"hover\"\n\t\t\t\twhileTap=\"pressed\"\n\t\t\t\texit=\"start\"\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tclassName={ classnames( className, {\n\t\t\t\t\t'is-with-inserter': showInsertionPointInserter,\n\t\t\t\t} ) }\n\t\t\t\tonHoverEnd={ maybeHideInserterPoint }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ lineVariants }\n\t\t\t\t\tclassName=\"block-editor-block-list__insertion-point-indicator\"\n\t\t\t\t/>\n\t\t\t\t{ showInsertionPointInserter && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tvariants={ inserterVariants }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-block-list__insertion-point-inserter'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tclientId={ nextClientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t\tonToggle={ ( isOpen ) => {\n\t\t\t\t\t\t\t\topenRef.current = isOpen;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonSelectOrClose={ () => {\n\t\t\t\t\t\t\t\topenRef.current = false;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</motion.div>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t</Popover>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n}\n\nexport default function InsertionPoint( {\n\tchildren,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst isVisible = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).isBlockInsertionPointVisible();\n\t}, [] );\n\n\treturn (\n\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t{ isVisible && (\n\t\t\t\t<InsertionPointPopover\n\t\t\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ children }\n\t\t</InsertionPointOpenRef.Provider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/insertion-point.js"],"names":["InsertionPointOpenRef","InsertionPointPopover","__unstablePopoverSlot","__unstableContentRef","selectBlock","hideInsertionPoint","blockEditorStore","openRef","ref","orientation","previousClientId","nextClientId","rootClientId","isInserterShown","select","getBlockOrder","getBlockListSettings","getBlockInsertionPoint","isBlockBeingDragged","getPreviousBlockClientId","getNextBlockClientId","insertionPoint","order","length","_previousClientId","index","_nextClientId","__unstableWithInserter","isVertical","disableMotion","onClick","event","target","current","onFocus","maybeHideInserterPoint","horizontalLine","start","width","top","bottom","x","rest","hover","verticalLine","height","left","right","y","lineVariants","opacity","borderRadius","transition","delay","inserterVariants","scale","className","isOpen","InsertionPoint","children","props","isVisible","isBlockInsertionPointVisible"],"mappings":";;;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAKO,MAAMA,qBAAqB,GAAG,6BAA9B;;;AAEP,SAASC,qBAAT,OAGI;AAAA,MAH4B;AAC/BC,IAAAA,qBAD+B;AAE/BC,IAAAA;AAF+B,GAG5B;AACH,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,MAAsC,uBAAaC,YAAb,CAA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D;AACC,IAAA,QAAQ,EAAC,eADV;AAEC,IAAA,QAAQ,EAAG3C,YAFZ;AAGC,IAAA,YAAY,EAAGC,YAHhB;AAIC,IAAA,qBAAqB,MAJtB;AAKC,IAAA,QAAQ,EAAK6C,MAAF,IAAc;AACxBlD,MAAAA,OAAO,CAAC0B,OAAR,GAAkBwB,MAAlB;AACA,KAPF;AAQC,IAAA,eAAe,EAAG,MAAM;AACvBlD,MAAAA,OAAO,CAAC0B,OAAR,GAAkB,KAAlB;AACA;AAVF,IAND,CArBF,CAND,CADD;AAmDA;;AAEc,SAASyB,cAAT,QAAkD;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAY,OAAGC;AAAf,GAAyB;AAChE,QAAMC,SAAS,GAAG,qBAAa/C,MAAF,IAAc;AAC1C,WAAOA,MAAM,CAAER,YAAF,CAAN,CAA2BwD,4BAA3B,EAAP;AACA,GAFiB,EAEf,EAFe,CAAlB;AAIA,SACC,4BAAC,qBAAD,CAAuB,QAAvB;AAAgC,IAAA,KAAK,EAAG,qBAAQ,KAAR;AAAxC,KACGD,SAAS,IAAI,4BAAC,qBAAD,EAA4BD,KAA5B,CADhB,EAEGD,QAFH,CADD;AAMA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRef, createContext, useContext } from '@wordpress/element';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport { store as blockEditorStore } from '../../store';\nimport BlockPopoverInbetween from '../block-popover/inbetween';\n\nexport const InsertionPointOpenRef = createContext();\n\nfunction InsertionPointPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst { selectBlock, hideInsertionPoint } = useDispatch( blockEditorStore );\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst ref = useRef();\n\tconst {\n\t\torientation,\n\t\tpreviousClientId,\n\t\tnextClientId,\n\t\trootClientId,\n\t\tisInserterShown,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockOrder,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockInsertionPoint,\n\t\t\tisBlockBeingDragged,\n\t\t\tgetPreviousBlockClientId,\n\t\t\tgetNextBlockClientId,\n\t\t} = select( blockEditorStore );\n\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet _previousClientId = order[ insertionPoint.index - 1 ];\n\t\tlet _nextClientId = order[ insertionPoint.index ];\n\n\t\twhile ( isBlockBeingDragged( _previousClientId ) ) {\n\t\t\t_previousClientId = getPreviousBlockClientId( _previousClientId );\n\t\t}\n\n\t\twhile ( isBlockBeingDragged( _nextClientId ) ) {\n\t\t\t_nextClientId = getNextBlockClientId( _nextClientId );\n\t\t}\n\n\t\treturn {\n\t\t\tpreviousClientId: _previousClientId,\n\t\t\tnextClientId: _nextClientId,\n\t\t\torientation:\n\t\t\t\tgetBlockListSettings( insertionPoint.rootClientId )\n\t\t\t\t\t?.orientation || 'vertical',\n\t\t\trootClientId: insertionPoint.rootClientId,\n\t\t\tisInserterShown: insertionPoint?.__unstableWithInserter,\n\t\t};\n\t}, [] );\n\tconst isVertical = orientation === 'vertical';\n\n\tconst disableMotion = useReducedMotion();\n\n\tfunction onClick( event ) {\n\t\tif ( event.target === ref.current && nextClientId ) {\n\t\t\tselectBlock( nextClientId, -1 );\n\t\t}\n\t}\n\n\tfunction onFocus( event ) {\n\t\t// Only handle click on the wrapper specifically, and not an event\n\t\t// bubbled from the inserter itself.\n\t\tif ( event.target !== ref.current ) {\n\t\t\topenRef.current = true;\n\t\t}\n\t}\n\n\tfunction maybeHideInserterPoint( event ) {\n\t\t// Only hide the inserter if it's triggered on the wrapper,\n\t\t// and the inserter is not open.\n\t\tif ( event.target === ref.current && ! openRef.current ) {\n\t\t\thideInsertionPoint();\n\t\t}\n\t}\n\n\t// Define animation variants for the line element.\n\tconst horizontalLine = {\n\t\tstart: {\n\t\t\twidth: 0,\n\t\t\ttop: '50%',\n\t\t\tbottom: '50%',\n\t\t\tx: 0,\n\t\t},\n\t\trest: {\n\t\t\twidth: 4,\n\t\t\ttop: 0,\n\t\t\tbottom: 0,\n\t\t\tx: -2,\n\t\t},\n\t\thover: {\n\t\t\twidth: 4,\n\t\t\ttop: 0,\n\t\t\tbottom: 0,\n\t\t\tx: -2,\n\t\t},\n\t};\n\tconst verticalLine = {\n\t\tstart: {\n\t\t\theight: 0,\n\t\t\tleft: '50%',\n\t\t\tright: '50%',\n\t\t\ty: 0,\n\t\t},\n\t\trest: {\n\t\t\theight: 4,\n\t\t\tleft: 0,\n\t\t\tright: 0,\n\t\t\ty: -2,\n\t\t},\n\t\thover: {\n\t\t\theight: 4,\n\t\t\tleft: 0,\n\t\t\tright: 0,\n\t\t\ty: -2,\n\t\t},\n\t};\n\tconst lineVariants = {\n\t\t// Initial position starts from the center and invisible.\n\t\tstart: {\n\t\t\t...( ! isVertical ? horizontalLine.start : verticalLine.start ),\n\t\t\topacity: 0,\n\t\t},\n\t\t// The line expands to fill the container. If the inserter is visible it\n\t\t// is delayed so it appears orchestrated.\n\t\trest: {\n\t\t\t...( ! isVertical ? horizontalLine.rest : verticalLine.rest ),\n\t\t\topacity: 1,\n\t\t\tborderRadius: '2px',\n\t\t\ttransition: { delay: isInserterShown ? 0.4 : 0 },\n\t\t},\n\t\thover: {\n\t\t\t...( ! isVertical ? horizontalLine.hover : verticalLine.hover ),\n\t\t\topacity: 1,\n\t\t\tborderRadius: '2px',\n\t\t\ttransition: { delay: 0.4 },\n\t\t},\n\t};\n\n\tconst inserterVariants = {\n\t\tstart: {\n\t\t\tscale: disableMotion ? 1 : 0,\n\t\t},\n\t\trest: {\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: 0.2 },\n\t\t},\n\t};\n\n\tconst className = classnames(\n\t\t'block-editor-block-list__insertion-point',\n\t\t'is-' + orientation\n\t);\n\n\treturn (\n\t\t<BlockPopoverInbetween\n\t\t\tpreviousClientId={ previousClientId }\n\t\t\tnextClientId={ nextClientId }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tlayout={ ! disableMotion }\n\t\t\t\tinitial={ disableMotion ? 'rest' : 'start' }\n\t\t\t\tanimate=\"rest\"\n\t\t\t\twhileHover=\"hover\"\n\t\t\t\twhileTap=\"pressed\"\n\t\t\t\texit=\"start\"\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tclassName={ classnames( className, {\n\t\t\t\t\t'is-with-inserter': isInserterShown,\n\t\t\t\t} ) }\n\t\t\t\tonHoverEnd={ maybeHideInserterPoint }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ lineVariants }\n\t\t\t\t\tclassName=\"block-editor-block-list__insertion-point-indicator\"\n\t\t\t\t/>\n\t\t\t\t{ isInserterShown && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tvariants={ inserterVariants }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-block-list__insertion-point-inserter'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tclientId={ nextClientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t\tonToggle={ ( isOpen ) => {\n\t\t\t\t\t\t\t\topenRef.current = isOpen;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonSelectOrClose={ () => {\n\t\t\t\t\t\t\t\topenRef.current = false;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</motion.div>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t</BlockPopoverInbetween>\n\t);\n}\n\nexport default function InsertionPoint( { children, ...props } ) {\n\tconst isVisible = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).isBlockInsertionPointVisible();\n\t}, [] );\n\n\treturn (\n\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t{ isVisible && <InsertionPointPopover { ...props } /> }\n\t\t\t{ children }\n\t\t</InsertionPointOpenRef.Provider>\n\t);\n}\n"]}
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = WrappedBlockPopover;
9
+
10
+ var _element = require("@wordpress/element");
11
+
12
+ var _lodash = require("lodash");
13
+
14
+ var _classnames = _interopRequireDefault(require("classnames"));
15
+
16
+ var _blocks = require("@wordpress/blocks");
17
+
18
+ var _data = require("@wordpress/data");
19
+
20
+ var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
21
+
22
+ var _compose = require("@wordpress/compose");
23
+
24
+ var _blockSelectionButton = _interopRequireDefault(require("./block-selection-button"));
25
+
26
+ var _blockContextualToolbar = _interopRequireDefault(require("./block-contextual-toolbar"));
27
+
28
+ var _store = require("../../store");
29
+
30
+ var _blockPopover = _interopRequireDefault(require("../block-popover"));
31
+
32
+ /**
33
+ * External dependencies
34
+ */
35
+
36
+ /**
37
+ * WordPress dependencies
38
+ */
39
+
40
+ /**
41
+ * Internal dependencies
42
+ */
43
+ function selector(select) {
44
+ const {
45
+ isNavigationMode,
46
+ isMultiSelecting,
47
+ hasMultiSelection,
48
+ isTyping,
49
+ getSettings,
50
+ getLastMultiSelectedBlockClientId
51
+ } = select(_store.store);
52
+ return {
53
+ isNavigationMode: isNavigationMode(),
54
+ isMultiSelecting: isMultiSelecting(),
55
+ isTyping: isTyping(),
56
+ hasFixedToolbar: getSettings().hasFixedToolbar,
57
+ lastClientId: hasMultiSelection() ? getLastMultiSelectedBlockClientId() : null
58
+ };
59
+ }
60
+
61
+ function SelectedBlockPopover(_ref) {
62
+ let {
63
+ clientId,
64
+ rootClientId,
65
+ isEmptyDefaultBlock,
66
+ capturingClientId,
67
+ __unstablePopoverSlot,
68
+ __unstableContentRef
69
+ } = _ref;
70
+ const {
71
+ isNavigationMode,
72
+ isMultiSelecting,
73
+ isTyping,
74
+ hasFixedToolbar,
75
+ lastClientId
76
+ } = (0, _data.useSelect)(selector, []);
77
+ const isInsertionPointVisible = (0, _data.useSelect)(select => {
78
+ const {
79
+ isBlockInsertionPointVisible,
80
+ getBlockInsertionPoint,
81
+ getBlockOrder
82
+ } = select(_store.store);
83
+
84
+ if (!isBlockInsertionPointVisible()) {
85
+ return false;
86
+ }
87
+
88
+ const insertionPoint = getBlockInsertionPoint();
89
+ const order = getBlockOrder(insertionPoint.rootClientId);
90
+ return order[insertionPoint.index] === clientId;
91
+ }, [clientId]);
92
+ const isLargeViewport = (0, _compose.useViewportMatch)('medium');
93
+ const isToolbarForced = (0, _element.useRef)(false);
94
+ const {
95
+ stopTyping
96
+ } = (0, _data.useDispatch)(_store.store);
97
+ const showEmptyBlockSideInserter = !isTyping && !isNavigationMode && isEmptyDefaultBlock;
98
+ const shouldShowBreadcrumb = isNavigationMode;
99
+ const shouldShowContextualToolbar = !isNavigationMode && !hasFixedToolbar && isLargeViewport && !isMultiSelecting && !showEmptyBlockSideInserter && !isTyping;
100
+ const canFocusHiddenToolbar = !isNavigationMode && !shouldShowContextualToolbar && !hasFixedToolbar && !isEmptyDefaultBlock;
101
+ (0, _keyboardShortcuts.useShortcut)('core/block-editor/focus-toolbar', () => {
102
+ isToolbarForced.current = true;
103
+ stopTyping(true);
104
+ }, {
105
+ isDisabled: !canFocusHiddenToolbar
106
+ });
107
+ (0, _element.useEffect)(() => {
108
+ isToolbarForced.current = false;
109
+ }); // Stores the active toolbar item index so the block toolbar can return focus
110
+ // to it when re-mounting.
111
+
112
+ const initialToolbarItemIndexRef = (0, _element.useRef)();
113
+
114
+ if (!shouldShowBreadcrumb && !shouldShowContextualToolbar) {
115
+ return null;
116
+ }
117
+
118
+ return (0, _element.createElement)(_blockPopover.default, {
119
+ clientId: capturingClientId || clientId,
120
+ bottomClientId: lastClientId,
121
+ className: (0, _classnames.default)('block-editor-block-list__block-popover', {
122
+ 'is-insertion-point-visible': isInsertionPointVisible
123
+ }),
124
+ __unstablePopoverSlot: __unstablePopoverSlot,
125
+ __unstableContentRef: __unstableContentRef
126
+ }, shouldShowContextualToolbar && (0, _element.createElement)(_blockContextualToolbar.default // If the toolbar is being shown because of being forced
127
+ // it should focus the toolbar right after the mount.
128
+ , {
129
+ focusOnMount: isToolbarForced.current,
130
+ __experimentalInitialIndex: initialToolbarItemIndexRef.current,
131
+ __experimentalOnIndexChange: index => {
132
+ initialToolbarItemIndexRef.current = index;
133
+ } // Resets the index whenever the active block changes so
134
+ // this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
135
+ ,
136
+ key: clientId
137
+ }), shouldShowBreadcrumb && (0, _element.createElement)(_blockSelectionButton.default, {
138
+ clientId: clientId,
139
+ rootClientId: rootClientId
140
+ }));
141
+ }
142
+
143
+ function wrapperSelector(select) {
144
+ const {
145
+ getSelectedBlockClientId,
146
+ getFirstMultiSelectedBlockClientId,
147
+ getBlockRootClientId,
148
+ getBlock,
149
+ getBlockParents,
150
+ __experimentalGetBlockListSettingsForBlocks
151
+ } = select(_store.store);
152
+ const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();
153
+
154
+ if (!clientId) {
155
+ return;
156
+ }
157
+
158
+ const {
159
+ name,
160
+ attributes = {}
161
+ } = getBlock(clientId) || {};
162
+ const blockParentsClientIds = getBlockParents(clientId); // Get Block List Settings for all ancestors of the current Block clientId.
163
+
164
+ const parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(blockParentsClientIds); // Get the clientId of the topmost parent with the capture toolbars setting.
165
+
166
+
167
+ const capturingClientId = (0, _lodash.find)(blockParentsClientIds, parentClientId => {
168
+ var _parentBlockListSetti;
169
+
170
+ return (_parentBlockListSetti = parentBlockListSettings[parentClientId]) === null || _parentBlockListSetti === void 0 ? void 0 : _parentBlockListSetti.__experimentalCaptureToolbars;
171
+ });
172
+ return {
173
+ clientId,
174
+ rootClientId: getBlockRootClientId(clientId),
175
+ name,
176
+ isEmptyDefaultBlock: name && (0, _blocks.isUnmodifiedDefaultBlock)({
177
+ name,
178
+ attributes
179
+ }),
180
+ capturingClientId
181
+ };
182
+ }
183
+
184
+ function WrappedBlockPopover(_ref2) {
185
+ let {
186
+ __unstablePopoverSlot,
187
+ __unstableContentRef
188
+ } = _ref2;
189
+ const selected = (0, _data.useSelect)(wrapperSelector, []);
190
+
191
+ if (!selected) {
192
+ return null;
193
+ }
194
+
195
+ const {
196
+ clientId,
197
+ rootClientId,
198
+ name,
199
+ isEmptyDefaultBlock,
200
+ capturingClientId
201
+ } = selected;
202
+
203
+ if (!name) {
204
+ return null;
205
+ }
206
+
207
+ return (0, _element.createElement)(SelectedBlockPopover, {
208
+ clientId: clientId,
209
+ rootClientId: rootClientId,
210
+ isEmptyDefaultBlock: isEmptyDefaultBlock,
211
+ capturingClientId: capturingClientId,
212
+ __unstablePopoverSlot: __unstablePopoverSlot,
213
+ __unstableContentRef: __unstableContentRef
214
+ });
215
+ }
216
+ //# sourceMappingURL=selected-block-popover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/selected-block-popover.js"],"names":["selector","select","isNavigationMode","isMultiSelecting","hasMultiSelection","isTyping","getSettings","getLastMultiSelectedBlockClientId","blockEditorStore","hasFixedToolbar","lastClientId","SelectedBlockPopover","clientId","rootClientId","isEmptyDefaultBlock","capturingClientId","__unstablePopoverSlot","__unstableContentRef","isInsertionPointVisible","isBlockInsertionPointVisible","getBlockInsertionPoint","getBlockOrder","insertionPoint","order","index","isLargeViewport","isToolbarForced","stopTyping","showEmptyBlockSideInserter","shouldShowBreadcrumb","shouldShowContextualToolbar","canFocusHiddenToolbar","current","isDisabled","initialToolbarItemIndexRef","wrapperSelector","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlockRootClientId","getBlock","getBlockParents","__experimentalGetBlockListSettingsForBlocks","name","attributes","blockParentsClientIds","parentBlockListSettings","parentClientId","__experimentalCaptureToolbars","WrappedBlockPopover","selected"],"mappings":";;;;;;;;;AASA;;AANA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;AAMA,SAASA,QAAT,CAAmBC,MAAnB,EAA4B;AAC3B,QAAM;AACLC,IAAAA,gBADK;AAELC,IAAAA,gBAFK;AAGLC,IAAAA,iBAHK;AAILC,IAAAA,QAJK;AAKLC,IAAAA,WALK;AAMLC,IAAAA;AANK,MAOFN,MAAM,CAAEO,YAAF,CAPV;AAQA,SAAO;AACNN,IAAAA,gBAAgB,EAAEA,gBAAgB,EAD5B;AAENC,IAAAA,gBAAgB,EAAEA,gBAAgB,EAF5B;AAGNE,IAAAA,QAAQ,EAAEA,QAAQ,EAHZ;AAINI,IAAAA,eAAe,EAAEH,WAAW,GAAGG,eAJzB;AAKNC,IAAAA,YAAY,EAAEN,iBAAiB,KAC5BG,iCAAiC,EADL,GAE5B;AAPG,GAAP;AASA;;AAED,SAASI,oBAAT,OAOI;AAAA,MAP2B;AAC9BC,IAAAA,QAD8B;AAE9BC,IAAAA,YAF8B;AAG9BC,IAAAA,mBAH8B;AAI9BC,IAAAA,iBAJ8B;AAK9BC,IAAAA,qBAL8B;AAM9BC,IAAAA;AAN8B,GAO3B;AACH,QAAM;AACLf,IAAAA,gBADK;AAELC,IAAAA,gBAFK;AAGLE,IAAAA,QAHK;AAILI,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,oBAAoB,EAAGC;AANxB,IADD;AAUA","sourcesContent":["/**\n * External dependencies\n */\nimport { find } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockSelectionButton from './block-selection-button';\nimport BlockContextualToolbar from './block-contextual-toolbar';\nimport { store as blockEditorStore } from '../../store';\nimport BlockPopover from '../block-popover';\n\nfunction selector( select ) {\n\tconst {\n\t\tisNavigationMode,\n\t\tisMultiSelecting,\n\t\thasMultiSelection,\n\t\tisTyping,\n\t\tgetSettings,\n\t\tgetLastMultiSelectedBlockClientId,\n\t} = select( blockEditorStore );\n\treturn {\n\t\tisNavigationMode: isNavigationMode(),\n\t\tisMultiSelecting: isMultiSelecting(),\n\t\tisTyping: isTyping(),\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tlastClientId: hasMultiSelection()\n\t\t\t? getLastMultiSelectedBlockClientId()\n\t\t\t: null,\n\t};\n}\n\nfunction SelectedBlockPopover( {\n\tclientId,\n\trootClientId,\n\tisEmptyDefaultBlock,\n\tcapturingClientId,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst {\n\t\tisNavigationMode,\n\t\tisMultiSelecting,\n\t\tisTyping,\n\t\thasFixedToolbar,\n\t\tlastClientId,\n\t} = useSelect( selector, [] );\n\tconst isInsertionPointVisible = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tif ( ! isBlockInsertionPointVisible() ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\t\t\treturn order[ insertionPoint.index ] === clientId;\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isToolbarForced = useRef( false );\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\n\tconst showEmptyBlockSideInserter =\n\t\t! isTyping && ! isNavigationMode && isEmptyDefaultBlock;\n\tconst shouldShowBreadcrumb = isNavigationMode;\n\tconst shouldShowContextualToolbar =\n\t\t! isNavigationMode &&\n\t\t! hasFixedToolbar &&\n\t\tisLargeViewport &&\n\t\t! isMultiSelecting &&\n\t\t! showEmptyBlockSideInserter &&\n\t\t! isTyping;\n\tconst canFocusHiddenToolbar =\n\t\t! isNavigationMode &&\n\t\t! shouldShowContextualToolbar &&\n\t\t! hasFixedToolbar &&\n\t\t! isEmptyDefaultBlock;\n\n\tuseShortcut(\n\t\t'core/block-editor/focus-toolbar',\n\t\t() => {\n\t\t\tisToolbarForced.current = true;\n\t\t\tstopTyping( true );\n\t\t},\n\t\t{\n\t\t\tisDisabled: ! canFocusHiddenToolbar,\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tisToolbarForced.current = false;\n\t} );\n\n\t// Stores the active toolbar item index so the block toolbar can return focus\n\t// to it when re-mounting.\n\tconst initialToolbarItemIndexRef = useRef();\n\n\tif ( ! shouldShowBreadcrumb && ! shouldShowContextualToolbar ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ capturingClientId || clientId }\n\t\t\tbottomClientId={ lastClientId }\n\t\t\tclassName={ classnames( 'block-editor-block-list__block-popover', {\n\t\t\t\t'is-insertion-point-visible': isInsertionPointVisible,\n\t\t\t} ) }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t>\n\t\t\t{ shouldShowContextualToolbar && (\n\t\t\t\t<BlockContextualToolbar\n\t\t\t\t\t// If the toolbar is being shown because of being forced\n\t\t\t\t\t// it should focus the toolbar right after the mount.\n\t\t\t\t\tfocusOnMount={ isToolbarForced.current }\n\t\t\t\t\t__experimentalInitialIndex={\n\t\t\t\t\t\tinitialToolbarItemIndexRef.current\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalOnIndexChange={ ( index ) => {\n\t\t\t\t\t\tinitialToolbarItemIndexRef.current = index;\n\t\t\t\t\t} }\n\t\t\t\t\t// Resets the index whenever the active block changes so\n\t\t\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\t\t\tkey={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ shouldShowBreadcrumb && (\n\t\t\t\t<BlockSelectionButton\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</BlockPopover>\n\t);\n}\n\nfunction wrapperSelector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetBlockRootClientId,\n\t\tgetBlock,\n\t\tgetBlockParents,\n\t\t__experimentalGetBlockListSettingsForBlocks,\n\t} = select( blockEditorStore );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\tif ( ! clientId ) {\n\t\treturn;\n\t}\n\n\tconst { name, attributes = {} } = getBlock( clientId ) || {};\n\tconst blockParentsClientIds = getBlockParents( clientId );\n\n\t// Get Block List Settings for all ancestors of the current Block clientId.\n\tconst parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(\n\t\tblockParentsClientIds\n\t);\n\n\t// Get the clientId of the topmost parent with the capture toolbars setting.\n\tconst capturingClientId = find(\n\t\tblockParentsClientIds,\n\t\t( parentClientId ) =>\n\t\t\tparentBlockListSettings[ parentClientId ]\n\t\t\t\t?.__experimentalCaptureToolbars\n\t);\n\n\treturn {\n\t\tclientId,\n\t\trootClientId: getBlockRootClientId( clientId ),\n\t\tname,\n\t\tisEmptyDefaultBlock:\n\t\t\tname && isUnmodifiedDefaultBlock( { name, attributes } ),\n\t\tcapturingClientId,\n\t};\n}\n\nexport default function WrappedBlockPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst selected = useSelect( wrapperSelector, [] );\n\n\tif ( ! selected ) {\n\t\treturn null;\n\t}\n\n\tconst {\n\t\tclientId,\n\t\trootClientId,\n\t\tname,\n\t\tisEmptyDefaultBlock,\n\t\tcapturingClientId,\n\t} = selected;\n\n\tif ( ! name ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SelectedBlockPopover\n\t\t\tclientId={ clientId }\n\t\t\trootClientId={ rootClientId }\n\t\t\tisEmptyDefaultBlock={ isEmptyDefaultBlock }\n\t\t\tcapturingClientId={ capturingClientId }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t/>\n\t);\n}\n"]}
@@ -49,17 +49,24 @@ function BoxInputControls(_ref) {
49
49
  bottomLeft: valuesProp,
50
50
  bottomRight: valuesProp
51
51
  }; // Controls are wrapped in tooltips as visible labels aren't desired here.
52
+ // Tooltip rendering also requires the UnitControl to be wrapped. See:
53
+ // https://github.com/WordPress/gutenberg/pull/24966#issuecomment-685875026
52
54
 
53
55
  return (0, _element.createElement)("div", {
54
56
  className: "components-border-radius-control__input-controls-wrapper"
55
57
  }, Object.entries(CORNERS).map(_ref2 => {
56
58
  let [key, label] = _ref2;
57
- return (0, _element.createElement)(_components.__experimentalUnitControl, (0, _extends2.default)({}, props, {
58
- key: key,
59
+ return (0, _element.createElement)(_components.Tooltip, {
60
+ text: label,
61
+ position: "top",
62
+ key: key
63
+ }, (0, _element.createElement)("div", {
64
+ className: "components-border-radius-control__tooltip-wrapper"
65
+ }, (0, _element.createElement)(_components.__experimentalUnitControl, (0, _extends2.default)({}, props, {
59
66
  "aria-label": label,
60
67
  value: values[key],
61
68
  onChange: createHandleOnChange(key)
62
- }));
69
+ }))));
63
70
  }));
64
71
  }
65
72
  //# sourceMappingURL=input-controls.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/border-radius-control/input-controls.js"],"names":["CORNERS","topLeft","topRight","bottomLeft","bottomRight","BoxInputControls","onChange","values","valuesProp","props","createHandleOnChange","corner","next","undefined","Object","entries","map","key","label"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,MAAMA,OAAO,GAAG;AACfC,EAAAA,OAAO,EAAE,cAAI,UAAJ,CADM;AAEfC,EAAAA,QAAQ,EAAE,cAAI,WAAJ,CAFK;AAGfC,EAAAA,UAAU,EAAE,cAAI,aAAJ,CAHG;AAIfC,EAAAA,WAAW,EAAE,cAAI,cAAJ;AAJE,CAAhB;;AAOe,SAASC,gBAAT,OAIX;AAAA,MAJsC;AACzCC,IAAAA,QADyC;AAEzCC,IAAAA,MAAM,EAAEC,UAFiC;AAGzC,OAAGC;AAHsC,GAItC;;AACH,QAAMC,oBAAoB,GAAKC,MAAF,IAAgBC,IAAF,IAAY;AACtD,QAAK,CAAEN,QAAP,EAAkB;AACjB;AACA;;AAEDA,IAAAA,QAAQ,CAAE,EACT,GAAGC,MADM;AAET,OAAEI,MAAF,GAAYC,IAAI,GAAGA,IAAH,GAAUC;AAFjB,KAAF,CAAR;AAIA,GATD,CADG,CAYH;;;AACA,QAAMN,MAAM,GACX,OAAOC,UAAP,KAAsB,QAAtB,GACGA,UADH,GAEG;AACAP,IAAAA,OAAO,EAAEO,UADT;AAEAN,IAAAA,QAAQ,EAAEM,UAFV;AAGAL,IAAAA,UAAU,EAAEK,UAHZ;AAIAJ,IAAAA,WAAW,EAAEI;AAJb,GAHJ,CAbG,CAuBH;;AACA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGM,MAAM,CAACC,OAAP,CAAgBf,OAAhB,EAA0BgB,GAA1B,CAA+B;AAAA,QAAE,CAAEC,GAAF,EAAOC,KAAP,CAAF;AAAA,WAChC,4BAAC,qCAAD,6BACMT,KADN;AAEC,MAAA,GAAG,EAAGQ,GAFP;AAGC,oBAAaC,KAHd;AAIC,MAAA,KAAK,EAAGX,MAAM,CAAEU,GAAF,CAJf;AAKC,MAAA,QAAQ,EAAGP,oBAAoB,CAAEO,GAAF;AALhC,OADgC;AAAA,GAA/B,CADH,CADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalUnitControl as UnitControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nconst CORNERS = {\n\ttopLeft: __( 'Top left' ),\n\ttopRight: __( 'Top right' ),\n\tbottomLeft: __( 'Bottom left' ),\n\tbottomRight: __( 'Bottom right' ),\n};\n\nexport default function BoxInputControls( {\n\tonChange,\n\tvalues: valuesProp,\n\t...props\n} ) {\n\tconst createHandleOnChange = ( corner ) => ( next ) => {\n\t\tif ( ! onChange ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonChange( {\n\t\t\t...values,\n\t\t\t[ corner ]: next ? next : undefined,\n\t\t} );\n\t};\n\n\t// For shorthand style & backwards compatibility, handle flat string value.\n\tconst values =\n\t\ttypeof valuesProp !== 'string'\n\t\t\t? valuesProp\n\t\t\t: {\n\t\t\t\t\ttopLeft: valuesProp,\n\t\t\t\t\ttopRight: valuesProp,\n\t\t\t\t\tbottomLeft: valuesProp,\n\t\t\t\t\tbottomRight: valuesProp,\n\t\t\t };\n\n\t// Controls are wrapped in tooltips as visible labels aren't desired here.\n\treturn (\n\t\t<div className=\"components-border-radius-control__input-controls-wrapper\">\n\t\t\t{ Object.entries( CORNERS ).map( ( [ key, label ] ) => (\n\t\t\t\t<UnitControl\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tkey={ key }\n\t\t\t\t\taria-label={ label }\n\t\t\t\t\tvalue={ values[ key ] }\n\t\t\t\t\tonChange={ createHandleOnChange( key ) }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/border-radius-control/input-controls.js"],"names":["CORNERS","topLeft","topRight","bottomLeft","bottomRight","BoxInputControls","onChange","values","valuesProp","props","createHandleOnChange","corner","next","undefined","Object","entries","map","key","label"],"mappings":";;;;;;;;;;;;;AAGA;;AAIA;;AAPA;AACA;AACA;AAOA,MAAMA,OAAO,GAAG;AACfC,EAAAA,OAAO,EAAE,cAAI,UAAJ,CADM;AAEfC,EAAAA,QAAQ,EAAE,cAAI,WAAJ,CAFK;AAGfC,EAAAA,UAAU,EAAE,cAAI,aAAJ,CAHG;AAIfC,EAAAA,WAAW,EAAE,cAAI,cAAJ;AAJE,CAAhB;;AAOe,SAASC,gBAAT,OAIX;AAAA,MAJsC;AACzCC,IAAAA,QADyC;AAEzCC,IAAAA,MAAM,EAAEC,UAFiC;AAGzC,OAAGC;AAHsC,GAItC;;AACH,QAAMC,oBAAoB,GAAKC,MAAF,IAAgBC,IAAF,IAAY;AACtD,QAAK,CAAEN,QAAP,EAAkB;AACjB;AACA;;AAEDA,IAAAA,QAAQ,CAAE,EACT,GAAGC,MADM;AAET,OAAEI,MAAF,GAAYC,IAAI,GAAGA,IAAH,GAAUC;AAFjB,KAAF,CAAR;AAIA,GATD,CADG,CAYH;;;AACA,QAAMN,MAAM,GACX,OAAOC,UAAP,KAAsB,QAAtB,GACGA,UADH,GAEG;AACAP,IAAAA,OAAO,EAAEO,UADT;AAEAN,IAAAA,QAAQ,EAAEM,UAFV;AAGAL,IAAAA,UAAU,EAAEK,UAHZ;AAIAJ,IAAAA,WAAW,EAAEI;AAJb,GAHJ,CAbG,CAuBH;AACA;AACA;;AACA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGM,MAAM,CAACC,OAAP,CAAgBf,OAAhB,EAA0BgB,GAA1B,CAA+B;AAAA,QAAE,CAAEC,GAAF,EAAOC,KAAP,CAAF;AAAA,WAChC,4BAAC,mBAAD;AAAS,MAAA,IAAI,EAAGA,KAAhB;AAAwB,MAAA,QAAQ,EAAC,KAAjC;AAAuC,MAAA,GAAG,EAAGD;AAA7C,OACC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,qCAAD,6BACMR,KADN;AAEC,oBAAaS,KAFd;AAGC,MAAA,KAAK,EAAGX,MAAM,CAAEU,GAAF,CAHf;AAIC,MAAA,QAAQ,EAAGP,oBAAoB,CAAEO,GAAF;AAJhC,OADD,CADD,CADgC;AAAA,GAA/B,CADH,CADD;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUnitControl as UnitControl,\n\tTooltip,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nconst CORNERS = {\n\ttopLeft: __( 'Top left' ),\n\ttopRight: __( 'Top right' ),\n\tbottomLeft: __( 'Bottom left' ),\n\tbottomRight: __( 'Bottom right' ),\n};\n\nexport default function BoxInputControls( {\n\tonChange,\n\tvalues: valuesProp,\n\t...props\n} ) {\n\tconst createHandleOnChange = ( corner ) => ( next ) => {\n\t\tif ( ! onChange ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonChange( {\n\t\t\t...values,\n\t\t\t[ corner ]: next ? next : undefined,\n\t\t} );\n\t};\n\n\t// For shorthand style & backwards compatibility, handle flat string value.\n\tconst values =\n\t\ttypeof valuesProp !== 'string'\n\t\t\t? valuesProp\n\t\t\t: {\n\t\t\t\t\ttopLeft: valuesProp,\n\t\t\t\t\ttopRight: valuesProp,\n\t\t\t\t\tbottomLeft: valuesProp,\n\t\t\t\t\tbottomRight: valuesProp,\n\t\t\t };\n\n\t// Controls are wrapped in tooltips as visible labels aren't desired here.\n\t// Tooltip rendering also requires the UnitControl to be wrapped. See:\n\t// https://github.com/WordPress/gutenberg/pull/24966#issuecomment-685875026\n\treturn (\n\t\t<div className=\"components-border-radius-control__input-controls-wrapper\">\n\t\t\t{ Object.entries( CORNERS ).map( ( [ key, label ] ) => (\n\t\t\t\t<Tooltip text={ label } position=\"top\" key={ key }>\n\t\t\t\t\t<div className=\"components-border-radius-control__tooltip-wrapper\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\taria-label={ label }\n\t\t\t\t\t\t\tvalue={ values[ key ] }\n\t\t\t\t\t\t\tonChange={ createHandleOnChange( key ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</Tooltip>\n\t\t\t) ) }\n\t\t</div>\n\t);\n}\n"]}
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -13,6 +15,8 @@ var _i18n = require("@wordpress/i18n");
13
15
 
14
16
  var _keycodes = require("@wordpress/keycodes");
15
17
 
18
+ var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
19
+
16
20
  /**
17
21
  * WordPress dependencies
18
22
  */
@@ -89,6 +93,11 @@ const BlockColorsStyleSelector = _ref4 => {
89
93
  children,
90
94
  ...other
91
95
  } = _ref4;
96
+ (0, _deprecated.default)(`wp.blockEditor.BlockColorsStyleSelector`, {
97
+ alternative: 'block supports API',
98
+ since: '6.1',
99
+ version: '6.3'
100
+ });
92
101
  return (0, _element.createElement)(_components.Dropdown, {
93
102
  position: "bottom right",
94
103
  className: "block-library-colors-selector",
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/color-style-selector/index.js"],"names":["ColorSelectorSVGIcon","ColorSelectorIcon","style","className","renderToggleComponent","TextColor","BackgroundColor","onToggle","isOpen","openOnArrowDown","event","keyCode","DOWN","preventDefault","BlockColorsStyleSelector","children","other"],"mappings":";;;;;;;;;AAGA;;AAOA;;AACA;;AAXA;AACA;AACA;AAWA,MAAMA,oBAAoB,GAAG,MAC5B,4BAAC,eAAD;AAAK,EAAA,KAAK,EAAC,6B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,QAAQ,EAAC,cADV;AAEC,IAAA,SAAS,EAAC,+BAFX;AAGC,IAAA,gBAAgB,EAAC,wCAHlB;AAIC,IAAA,YAAY,EAAGZ,qBAAqB,CAAEY,KAAF,CAJrC;AAKC,IAAA,aAAa,EAAG,MAAMD;AALvB,IADgC;AAAA,CAAjC;;eAUeD,wB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarButton,\n\tDropdown,\n\tToolbarGroup,\n\tSVG,\n\tPath,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { DOWN } from '@wordpress/keycodes';\n\nconst ColorSelectorSVGIcon = () => (\n\t<SVG xmlns=\"https://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\">\n\t\t<Path d=\"M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z\" />\n\t</SVG>\n);\n\n/**\n * Color Selector Icon component.\n *\n * @param {Object} props Component properties.\n * @param {Object} props.style Style object.\n * @param {string} props.className Class name for component.\n *\n * @return {*} React Icon component.\n */\nconst ColorSelectorIcon = ( { style, className } ) => {\n\treturn (\n\t\t<div className=\"block-library-colors-selector__icon-container\">\n\t\t\t<div\n\t\t\t\tclassName={ `${ className } block-library-colors-selector__state-selection` }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t<ColorSelectorSVGIcon />\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\n/**\n * Renders the Colors Selector Toolbar with the icon button.\n *\n * @param {Object} props Component properties.\n * @param {Object} props.TextColor Text color component that wraps icon.\n * @param {Object} props.BackgroundColor Background color component that wraps icon.\n *\n * @return {*} React toggle button component.\n */\nconst renderToggleComponent = ( { TextColor, BackgroundColor } ) => ( {\n\tonToggle,\n\tisOpen,\n} ) => {\n\tconst openOnArrowDown = ( event ) => {\n\t\tif ( ! isOpen && event.keyCode === DOWN ) {\n\t\t\tevent.preventDefault();\n\t\t\tonToggle();\n\t\t}\n\t};\n\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"components-toolbar__control block-library-colors-selector__toggle\"\n\t\t\t\tlabel={ __( 'Open Colors Selector' ) }\n\t\t\t\tonClick={ onToggle }\n\t\t\t\tonKeyDown={ openOnArrowDown }\n\t\t\t\ticon={\n\t\t\t\t\t<BackgroundColor>\n\t\t\t\t\t\t<TextColor>\n\t\t\t\t\t\t\t<ColorSelectorIcon />\n\t\t\t\t\t\t</TextColor>\n\t\t\t\t\t</BackgroundColor>\n\t\t\t\t}\n\t\t\t/>\n\t\t</ToolbarGroup>\n\t);\n};\n\nconst BlockColorsStyleSelector = ( { children, ...other } ) => (\n\t<Dropdown\n\t\tposition=\"bottom right\"\n\t\tclassName=\"block-library-colors-selector\"\n\t\tcontentClassName=\"block-library-colors-selector__popover\"\n\t\trenderToggle={ renderToggleComponent( other ) }\n\t\trenderContent={ () => children }\n\t/>\n);\n\nexport default BlockColorsStyleSelector;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/color-style-selector/index.js"],"names":["ColorSelectorSVGIcon","ColorSelectorIcon","style","className","renderToggleComponent","TextColor","BackgroundColor","onToggle","isOpen","openOnArrowDown","event","keyCode","DOWN","preventDefault","BlockColorsStyleSelector","children","other","alternative","since","version"],"mappings":";;;;;;;;;;;AAGA;;AAOA;;AACA;;AACA;;AAZA;AACA;AACA;AAYA,MAAMA,oBAAoB,GAAG,M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AAGC;AAAf,GAA4B;AAC9D,2BAAa,yCAAb,EAAuD;AACtDC,IAAAA,WAAW,EAAE,oBADyC;AAEtDC,IAAAA,KAAK,EAAE,KAF+C;AAGtDC,IAAAA,OAAO,EAAE;AAH6C,GAAvD;AAMA,SACC,4BAAC,oBAAD;AACC,IAAA,QAAQ,EAAC,cADV;AAEC,IAAA,SAAS,EAAC,+BAFX;AAGC,IAAA,gBAAgB,EAAC,wCAHlB;AAIC,IAAA,YAAY,EAAGf,qBAAqB,CAAEY,KAAF,CAJrC;AAKC,IAAA,aAAa,EAAG,MAAMD;AALvB,IADD;AASA,CAhBD;;eAkBeD,wB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarButton,\n\tDropdown,\n\tToolbarGroup,\n\tSVG,\n\tPath,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { DOWN } from '@wordpress/keycodes';\nimport deprecated from '@wordpress/deprecated';\n\nconst ColorSelectorSVGIcon = () => (\n\t<SVG xmlns=\"https://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\">\n\t\t<Path d=\"M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z\" />\n\t</SVG>\n);\n\n/**\n * Color Selector Icon component.\n *\n * @param {Object} props Component properties.\n * @param {Object} props.style Style object.\n * @param {string} props.className Class name for component.\n *\n * @return {*} React Icon component.\n */\nconst ColorSelectorIcon = ( { style, className } ) => {\n\treturn (\n\t\t<div className=\"block-library-colors-selector__icon-container\">\n\t\t\t<div\n\t\t\t\tclassName={ `${ className } block-library-colors-selector__state-selection` }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t<ColorSelectorSVGIcon />\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\n/**\n * Renders the Colors Selector Toolbar with the icon button.\n *\n * @param {Object} props Component properties.\n * @param {Object} props.TextColor Text color component that wraps icon.\n * @param {Object} props.BackgroundColor Background color component that wraps icon.\n *\n * @return {*} React toggle button component.\n */\nconst renderToggleComponent = ( { TextColor, BackgroundColor } ) => ( {\n\tonToggle,\n\tisOpen,\n} ) => {\n\tconst openOnArrowDown = ( event ) => {\n\t\tif ( ! isOpen && event.keyCode === DOWN ) {\n\t\t\tevent.preventDefault();\n\t\t\tonToggle();\n\t\t}\n\t};\n\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"components-toolbar__control block-library-colors-selector__toggle\"\n\t\t\t\tlabel={ __( 'Open Colors Selector' ) }\n\t\t\t\tonClick={ onToggle }\n\t\t\t\tonKeyDown={ openOnArrowDown }\n\t\t\t\ticon={\n\t\t\t\t\t<BackgroundColor>\n\t\t\t\t\t\t<TextColor>\n\t\t\t\t\t\t\t<ColorSelectorIcon />\n\t\t\t\t\t\t</TextColor>\n\t\t\t\t\t</BackgroundColor>\n\t\t\t\t}\n\t\t\t/>\n\t\t</ToolbarGroup>\n\t);\n};\n\nconst BlockColorsStyleSelector = ( { children, ...other } ) => {\n\tdeprecated( `wp.blockEditor.BlockColorsStyleSelector`, {\n\t\talternative: 'block supports API',\n\t\tsince: '6.1',\n\t\tversion: '6.3',\n\t} );\n\n\treturn (\n\t\t<Dropdown\n\t\t\tposition=\"bottom right\"\n\t\t\tclassName=\"block-library-colors-selector\"\n\t\t\tcontentClassName=\"block-library-colors-selector__popover\"\n\t\t\trenderToggle={ renderToggleComponent( other ) }\n\t\t\trenderContent={ () => children }\n\t\t/>\n\t);\n};\n\nexport default BlockColorsStyleSelector;\n"]}