@wordpress/block-editor 12.18.2 → 12.19.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 (870) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/autocompleters/block.js +1 -2
  3. package/build/autocompleters/block.js.map +1 -1
  4. package/build/autocompleters/link.js +1 -2
  5. package/build/autocompleters/link.js.map +1 -1
  6. package/build/components/alignment-control/ui.js +1 -2
  7. package/build/components/alignment-control/ui.js.map +1 -1
  8. package/build/components/autocomplete/index.js +1 -2
  9. package/build/components/autocomplete/index.js.map +1 -1
  10. package/build/components/block-alignment-control/constants.js +2 -4
  11. package/build/components/block-alignment-control/constants.js.map +1 -1
  12. package/build/components/block-alignment-control/ui.js +1 -2
  13. package/build/components/block-alignment-control/ui.js.map +1 -1
  14. package/build/components/block-alignment-control/ui.native.js +1 -2
  15. package/build/components/block-alignment-control/ui.native.js.map +1 -1
  16. package/build/components/block-alignment-matrix-control/index.js +1 -2
  17. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  18. package/build/components/block-breadcrumb/index.js +1 -2
  19. package/build/components/block-breadcrumb/index.js.map +1 -1
  20. package/build/components/block-canvas/index.js +1 -2
  21. package/build/components/block-canvas/index.js.map +1 -1
  22. package/build/components/block-caption/index.native.js +1 -2
  23. package/build/components/block-caption/index.native.js.map +1 -1
  24. package/build/components/block-card/index.js +1 -2
  25. package/build/components/block-card/index.js.map +1 -1
  26. package/build/components/block-compare/index.js +1 -2
  27. package/build/components/block-compare/index.js.map +1 -1
  28. package/build/components/block-context/index.js +1 -2
  29. package/build/components/block-context/index.js.map +1 -1
  30. package/build/components/block-controls/groups.js +1 -2
  31. package/build/components/block-controls/groups.js.map +1 -1
  32. package/build/components/block-controls/index.js +1 -2
  33. package/build/components/block-controls/index.js.map +1 -1
  34. package/build/components/block-draggable/dropping-insertion-point.native.js +2 -2
  35. package/build/components/block-draggable/dropping-insertion-point.native.js.map +1 -1
  36. package/build/components/block-draggable/index.js +1 -2
  37. package/build/components/block-draggable/index.js.map +1 -1
  38. package/build/components/block-draggable/index.native.js +3 -4
  39. package/build/components/block-draggable/index.native.js.map +1 -1
  40. package/build/components/block-edit/context.js +4 -8
  41. package/build/components/block-edit/context.js.map +1 -1
  42. package/build/components/block-edit/edit.js +1 -2
  43. package/build/components/block-edit/edit.js.map +1 -1
  44. package/build/components/block-edit/edit.native.js +1 -2
  45. package/build/components/block-edit/edit.native.js.map +1 -1
  46. package/build/components/block-full-height-alignment-control/index.js +1 -2
  47. package/build/components/block-full-height-alignment-control/index.js.map +1 -1
  48. package/build/components/block-icon/index.js +1 -2
  49. package/build/components/block-icon/index.js.map +1 -1
  50. package/build/components/block-icon/index.native.js +1 -2
  51. package/build/components/block-icon/index.native.js.map +1 -1
  52. package/build/components/block-info-slot-fill/index.js +1 -2
  53. package/build/components/block-info-slot-fill/index.js.map +1 -1
  54. package/build/components/block-inspector/index.js +11 -9
  55. package/build/components/block-inspector/index.js.map +1 -1
  56. package/build/components/block-list/block-crash-boundary.js +1 -2
  57. package/build/components/block-list/block-crash-boundary.js.map +1 -1
  58. package/build/components/block-list/block-html.js +1 -2
  59. package/build/components/block-list/block-html.js.map +1 -1
  60. package/build/components/block-list/block-list-context.native.js +1 -2
  61. package/build/components/block-list/block-list-context.native.js.map +1 -1
  62. package/build/components/block-list/block-list-item-cell.native.js +1 -2
  63. package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
  64. package/build/components/block-list/block-list-item.native.js +1 -2
  65. package/build/components/block-list/block-list-item.native.js.map +1 -1
  66. package/build/components/block-list/block-outline.native.js +1 -2
  67. package/build/components/block-list/block-outline.native.js.map +1 -1
  68. package/build/components/block-list/block-selection-button.native.js +1 -2
  69. package/build/components/block-list/block-selection-button.native.js.map +1 -1
  70. package/build/components/block-list/block.js +32 -21
  71. package/build/components/block-list/block.js.map +1 -1
  72. package/build/components/block-list/block.native.js +7 -6
  73. package/build/components/block-list/block.native.js.map +1 -1
  74. package/build/components/block-list/grid-item.native.js +1 -2
  75. package/build/components/block-list/grid-item.native.js.map +1 -1
  76. package/build/components/block-list/index.js +19 -9
  77. package/build/components/block-list/index.js.map +1 -1
  78. package/build/components/block-list/insertion-point.native.js +1 -2
  79. package/build/components/block-list/insertion-point.native.js.map +1 -1
  80. package/build/components/block-list/layout.js +2 -4
  81. package/build/components/block-list/layout.js.map +1 -1
  82. package/build/components/block-list/private-block-context.js +1 -2
  83. package/build/components/block-list/private-block-context.js.map +1 -1
  84. package/build/components/block-list/subdirectory-icon.js +1 -2
  85. package/build/components/block-list/subdirectory-icon.js.map +1 -1
  86. package/build/components/block-list/use-block-props/index.js +8 -1
  87. package/build/components/block-list/use-block-props/index.js.map +1 -1
  88. package/build/components/block-list/use-scroll-upon-insertion.native.js +1 -2
  89. package/build/components/block-list/use-scroll-upon-insertion.native.js.map +1 -1
  90. package/build/components/block-list-appender/index.js +5 -52
  91. package/build/components/block-list-appender/index.js.map +1 -1
  92. package/build/components/block-media-update-progress/index.native.js +11 -22
  93. package/build/components/block-media-update-progress/index.native.js.map +1 -1
  94. package/build/components/block-mover/button.js +2 -4
  95. package/build/components/block-mover/button.js.map +1 -1
  96. package/build/components/block-mover/index.js +1 -2
  97. package/build/components/block-mover/index.js.map +1 -1
  98. package/build/components/block-mover/index.native.js +3 -6
  99. package/build/components/block-mover/index.native.js.map +1 -1
  100. package/build/components/block-mover/mover-description.native.js +0 -2
  101. package/build/components/block-mover/mover-description.native.js.map +1 -1
  102. package/build/components/block-navigation/dropdown.js +1 -2
  103. package/build/components/block-navigation/dropdown.js.map +1 -1
  104. package/build/components/block-pattern-setup/constants.js +1 -2
  105. package/build/components/block-pattern-setup/constants.js.map +1 -1
  106. package/build/components/block-pattern-setup/index.js +1 -2
  107. package/build/components/block-pattern-setup/index.js.map +1 -1
  108. package/build/components/block-pattern-setup/setup-toolbar.js +1 -2
  109. package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  110. package/build/components/block-pattern-setup/use-patterns-setup.js +1 -2
  111. package/build/components/block-pattern-setup/use-patterns-setup.js.map +1 -1
  112. package/build/components/block-patterns-list/index.js +1 -2
  113. package/build/components/block-patterns-list/index.js.map +1 -1
  114. package/build/components/block-popover/drop-zone.js +1 -2
  115. package/build/components/block-popover/drop-zone.js.map +1 -1
  116. package/build/components/block-popover/inbetween.js +2 -4
  117. package/build/components/block-popover/inbetween.js.map +1 -1
  118. package/build/components/block-popover/index.js +1 -2
  119. package/build/components/block-popover/index.js.map +1 -1
  120. package/build/components/block-popover/use-popover-scroll.js +1 -2
  121. package/build/components/block-popover/use-popover-scroll.js.map +1 -1
  122. package/build/components/block-preview/auto.js +2 -1
  123. package/build/components/block-preview/auto.js.map +1 -1
  124. package/build/components/block-preview/index.js +1 -2
  125. package/build/components/block-preview/index.js.map +1 -1
  126. package/build/components/block-removal-warning-modal/index.js +4 -2
  127. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  128. package/build/components/block-settings/button.native.js +1 -2
  129. package/build/components/block-settings/button.native.js.map +1 -1
  130. package/build/components/block-settings/container.native.js +1 -2
  131. package/build/components/block-settings/container.native.js.map +1 -1
  132. package/build/components/block-settings/index.native.js +2 -2
  133. package/build/components/block-settings/index.native.js.map +1 -1
  134. package/build/components/block-settings-menu/block-html-convert-button.js +1 -2
  135. package/build/components/block-settings-menu/block-html-convert-button.js.map +1 -1
  136. package/build/components/block-settings-menu/block-mode-toggle.js +1 -2
  137. package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  138. package/build/components/block-settings-menu/block-settings-dropdown.js +1 -2
  139. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  140. package/build/components/block-settings-menu/block-settings-menu-first-item.js +1 -2
  141. package/build/components/block-settings-menu/block-settings-menu-first-item.js.map +1 -1
  142. package/build/components/block-settings-menu/index.js +1 -2
  143. package/build/components/block-settings-menu/index.js.map +1 -1
  144. package/build/components/block-settings-menu-controls/index.js +1 -2
  145. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  146. package/build/components/block-styles/index.js +1 -2
  147. package/build/components/block-styles/index.js.map +1 -1
  148. package/build/components/block-styles/index.native.js +1 -2
  149. package/build/components/block-styles/index.native.js.map +1 -1
  150. package/build/components/block-styles/preview.native.js +1 -2
  151. package/build/components/block-styles/preview.native.js.map +1 -1
  152. package/build/components/block-switcher/block-transformations-menu.js +1 -2
  153. package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
  154. package/build/components/block-switcher/block-transformations-menu.native.js +1 -2
  155. package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  156. package/build/components/block-switcher/block-variation-transformations.js +1 -2
  157. package/build/components/block-switcher/block-variation-transformations.js.map +1 -1
  158. package/build/components/block-switcher/index.js +13 -11
  159. package/build/components/block-switcher/index.js.map +1 -1
  160. package/build/components/block-switcher/pattern-transformations-menu.js +1 -2
  161. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  162. package/build/components/block-switcher/use-transformed-patterns.js +1 -2
  163. package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
  164. package/build/components/block-title/use-block-display-title.js +21 -28
  165. package/build/components/block-title/use-block-display-title.js.map +1 -1
  166. package/build/components/block-toolbar/block-name-context.js +1 -2
  167. package/build/components/block-toolbar/block-name-context.js.map +1 -1
  168. package/build/components/block-toolbar/block-toolbar-last-item.js +1 -2
  169. package/build/components/block-toolbar/block-toolbar-last-item.js.map +1 -1
  170. package/build/components/block-toolbar/block-toolbar-menu.native.js +1 -2
  171. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  172. package/build/components/block-tools/block-selection-button.js +20 -18
  173. package/build/components/block-tools/block-selection-button.js.map +1 -1
  174. package/build/components/block-tools/index.js +4 -12
  175. package/build/components/block-tools/index.js.map +1 -1
  176. package/build/components/block-tools/insertion-point.js +1 -2
  177. package/build/components/block-tools/insertion-point.js.map +1 -1
  178. package/build/components/block-tools/zoom-out-mode-inserters.js +1 -2
  179. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  180. package/build/components/block-types-list/index.js +1 -2
  181. package/build/components/block-types-list/index.js.map +1 -1
  182. package/build/components/block-variation-picker/index.js +1 -2
  183. package/build/components/block-variation-picker/index.js.map +1 -1
  184. package/build/components/block-variation-picker/index.native.js +1 -2
  185. package/build/components/block-variation-picker/index.native.js.map +1 -1
  186. package/build/components/block-variation-transforms/index.js +1 -2
  187. package/build/components/block-variation-transforms/index.js.map +1 -1
  188. package/build/components/block-vertical-alignment-control/icons.js +5 -10
  189. package/build/components/block-vertical-alignment-control/icons.js.map +1 -1
  190. package/build/components/block-vertical-alignment-control/ui.js +1 -2
  191. package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
  192. package/build/components/button-block-appender/index.js +2 -4
  193. package/build/components/button-block-appender/index.js.map +1 -1
  194. package/build/components/button-block-appender/index.native.js +1 -2
  195. package/build/components/button-block-appender/index.native.js.map +1 -1
  196. package/build/components/caption/index.native.js +1 -2
  197. package/build/components/caption/index.native.js.map +1 -1
  198. package/build/components/color-palette/index.js +1 -2
  199. package/build/components/color-palette/index.js.map +1 -1
  200. package/build/components/color-palette/with-color-context.js +1 -2
  201. package/build/components/color-palette/with-color-context.js.map +1 -1
  202. package/build/components/color-style-selector/index.js +1 -2
  203. package/build/components/color-style-selector/index.js.map +1 -1
  204. package/build/components/colors/index.js +2 -2
  205. package/build/components/colors/index.js.map +1 -1
  206. package/build/components/colors-gradients/control.js +1 -3
  207. package/build/components/colors-gradients/control.js.map +1 -1
  208. package/build/components/colors-gradients/panel-color-gradient-settings.js +1 -2
  209. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  210. package/build/components/contrast-checker/index.js +1 -2
  211. package/build/components/contrast-checker/index.js.map +1 -1
  212. package/build/components/contrast-checker/index.native.js +1 -2
  213. package/build/components/contrast-checker/index.native.js.map +1 -1
  214. package/build/components/convert-to-group-buttons/toolbar.js +1 -2
  215. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
  216. package/build/components/default-block-appender/index.js +31 -40
  217. package/build/components/default-block-appender/index.js.map +1 -1
  218. package/build/components/default-block-appender/index.native.js +1 -2
  219. package/build/components/default-block-appender/index.native.js.map +1 -1
  220. package/build/components/dimensions-tool/aspect-ratio-tool.js +2 -2
  221. package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
  222. package/build/components/dimensions-tool/index.js +1 -2
  223. package/build/components/dimensions-tool/index.js.map +1 -1
  224. package/build/components/duotone-control/index.js +1 -2
  225. package/build/components/duotone-control/index.js.map +1 -1
  226. package/build/components/editable-text/index.js +1 -2
  227. package/build/components/editable-text/index.js.map +1 -1
  228. package/build/components/floating-toolbar/index.native.js +1 -2
  229. package/build/components/floating-toolbar/index.native.js.map +1 -1
  230. package/build/components/floating-toolbar/nav-up-icon.js +1 -2
  231. package/build/components/floating-toolbar/nav-up-icon.js.map +1 -1
  232. package/build/components/font-sizes/font-size-picker.js +1 -2
  233. package/build/components/font-sizes/font-size-picker.js.map +1 -1
  234. package/build/components/global-styles/border-panel.js +56 -8
  235. package/build/components/global-styles/border-panel.js.map +1 -1
  236. package/build/components/global-styles/color-panel.native.js +1 -2
  237. package/build/components/global-styles/color-panel.native.js.map +1 -1
  238. package/build/components/global-styles/context.js +2 -4
  239. package/build/components/global-styles/context.js.map +1 -1
  240. package/build/components/global-styles/get-global-styles-changes.js +2 -4
  241. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  242. package/build/components/global-styles/index.js +2 -15
  243. package/build/components/global-styles/index.js.map +1 -1
  244. package/build/components/global-styles/shadow-panel-components.js +133 -0
  245. package/build/components/global-styles/shadow-panel-components.js.map +1 -0
  246. package/build/components/global-styles/typography-panel.js +6 -7
  247. package/build/components/global-styles/typography-panel.js.map +1 -1
  248. package/build/components/global-styles/use-global-styles-output.js +1 -1
  249. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  250. package/build/components/global-styles/utils.js +38 -14
  251. package/build/components/global-styles/utils.js.map +1 -1
  252. package/build/components/iframe/index.js +1 -2
  253. package/build/components/iframe/index.js.map +1 -1
  254. package/build/components/image-editor/constants.js +3 -6
  255. package/build/components/image-editor/constants.js.map +1 -1
  256. package/build/components/image-link-destinations/index.native.js +1 -2
  257. package/build/components/image-link-destinations/index.native.js.map +1 -1
  258. package/build/components/index.js +2 -2
  259. package/build/components/index.js.map +1 -1
  260. package/build/components/index.native.js +2 -2
  261. package/build/components/index.native.js.map +1 -1
  262. package/build/components/inner-blocks/button-block-appender.js +1 -2
  263. package/build/components/inner-blocks/button-block-appender.js.map +1 -1
  264. package/build/components/inner-blocks/constants.native.js +1 -2
  265. package/build/components/inner-blocks/constants.native.js.map +1 -1
  266. package/build/components/inner-blocks/default-block-appender.js +1 -2
  267. package/build/components/inner-blocks/default-block-appender.js.map +1 -1
  268. package/build/components/inner-blocks/index.js +33 -30
  269. package/build/components/inner-blocks/index.js.map +1 -1
  270. package/build/components/inner-blocks/index.native.js +2 -6
  271. package/build/components/inner-blocks/index.native.js.map +1 -1
  272. package/build/components/inner-blocks/use-inner-block-template-sync.js +2 -3
  273. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  274. package/build/components/inner-blocks/warning-max-depth-exceeded.native.js +1 -2
  275. package/build/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
  276. package/build/components/inner-blocks/with-client-id.js +1 -2
  277. package/build/components/inner-blocks/with-client-id.js.map +1 -1
  278. package/build/components/inserter/block-patterns-explorer/index.js +1 -2
  279. package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
  280. package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +1 -2
  281. package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
  282. package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -2
  283. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  284. package/build/components/inserter/block-patterns-tab/index.js +1 -2
  285. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  286. package/build/components/inserter/block-patterns-tab/patterns-filter.js +4 -4
  287. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  288. package/build/components/inserter/block-patterns-tab/utils.js +5 -9
  289. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
  290. package/build/components/inserter/block-types-tab.js +1 -2
  291. package/build/components/inserter/block-types-tab.js.map +1 -1
  292. package/build/components/inserter/block-types-tab.native.js +1 -2
  293. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  294. package/build/components/inserter/hooks/use-block-type-impressions.native.js +1 -2
  295. package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  296. package/build/components/inserter/hooks/use-block-types-state.js +1 -2
  297. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  298. package/build/components/inserter/hooks/use-insertion-point.js +1 -2
  299. package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
  300. package/build/components/inserter/hooks/use-patterns-state.js +1 -2
  301. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  302. package/build/components/inserter/index.js +2 -4
  303. package/build/components/inserter/index.js.map +1 -1
  304. package/build/components/inserter/index.native.js +1 -2
  305. package/build/components/inserter/index.native.js.map +1 -1
  306. package/build/components/inserter/library.js +1 -2
  307. package/build/components/inserter/library.js.map +1 -1
  308. package/build/components/inserter/media-tab/media-list.js +1 -2
  309. package/build/components/inserter/media-tab/media-list.js.map +1 -1
  310. package/build/components/inserter/media-tab/media-tab.js +1 -2
  311. package/build/components/inserter/media-tab/media-tab.js.map +1 -1
  312. package/build/components/inserter/menu.js +1 -2
  313. package/build/components/inserter/menu.js.map +1 -1
  314. package/build/components/inserter/menu.native.js +1 -2
  315. package/build/components/inserter/menu.native.js.map +1 -1
  316. package/build/components/inserter/no-results.js +1 -2
  317. package/build/components/inserter/no-results.js.map +1 -1
  318. package/build/components/inserter/no-results.native.js +1 -2
  319. package/build/components/inserter/no-results.native.js.map +1 -1
  320. package/build/components/inserter/panel.js +1 -2
  321. package/build/components/inserter/panel.js.map +1 -1
  322. package/build/components/inserter/preview-panel.js +1 -2
  323. package/build/components/inserter/preview-panel.js.map +1 -1
  324. package/build/components/inserter/quick-inserter.js +3 -2
  325. package/build/components/inserter/quick-inserter.js.map +1 -1
  326. package/build/components/inserter/reusable-blocks-tab.native.js +1 -2
  327. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  328. package/build/components/inserter/search-items.js +0 -1
  329. package/build/components/inserter/search-items.js.map +1 -1
  330. package/build/components/inserter/search-results.js +1 -2
  331. package/build/components/inserter/search-results.js.map +1 -1
  332. package/build/components/inserter/search-results.native.js +1 -2
  333. package/build/components/inserter/search-results.native.js.map +1 -1
  334. package/build/components/inserter/tabs.js +1 -2
  335. package/build/components/inserter/tabs.js.map +1 -1
  336. package/build/components/inserter/tabs.native.js +1 -2
  337. package/build/components/inserter/tabs.native.js.map +1 -1
  338. package/build/components/inserter/tips.js +1 -2
  339. package/build/components/inserter/tips.js.map +1 -1
  340. package/build/components/inserter-button/index.native.js +1 -2
  341. package/build/components/inserter-button/index.native.js.map +1 -1
  342. package/build/components/inserter-button/sparkles.js +1 -2
  343. package/build/components/inserter-button/sparkles.js.map +1 -1
  344. package/build/components/inserter-draggable-blocks/index.js +11 -2
  345. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  346. package/build/components/inserter-list-item/index.js +1 -2
  347. package/build/components/inserter-list-item/index.js.map +1 -1
  348. package/build/components/inserter-listbox/context.js +1 -2
  349. package/build/components/inserter-listbox/context.js.map +1 -1
  350. package/build/components/inserter-listbox/group.js +1 -2
  351. package/build/components/inserter-listbox/group.js.map +1 -1
  352. package/build/components/inserter-listbox/index.js +1 -2
  353. package/build/components/inserter-listbox/index.js.map +1 -1
  354. package/build/components/inserter-listbox/item.js +1 -2
  355. package/build/components/inserter-listbox/item.js.map +1 -1
  356. package/build/components/inserter-listbox/row.js +1 -2
  357. package/build/components/inserter-listbox/row.js.map +1 -1
  358. package/build/components/inserter-menu-extension/index.js +1 -2
  359. package/build/components/inserter-menu-extension/index.js.map +1 -1
  360. package/build/components/inspector-controls/groups.js +1 -2
  361. package/build/components/inspector-controls/groups.js.map +1 -1
  362. package/build/components/inspector-controls/index.js +1 -2
  363. package/build/components/inspector-controls/index.js.map +1 -1
  364. package/build/components/inspector-controls-tabs/advanced-controls-panel.js +3 -4
  365. package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -1
  366. package/build/components/inspector-controls-tabs/position-controls-panel.js +1 -2
  367. package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  368. package/build/components/inspector-controls-tabs/settings-tab.js +1 -2
  369. package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  370. package/build/components/inspector-controls-tabs/styles-tab.js +6 -6
  371. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  372. package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +1 -2
  373. package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -1
  374. package/build/components/inspector-controls-tabs/utils.js +3 -6
  375. package/build/components/inspector-controls-tabs/utils.js.map +1 -1
  376. package/build/components/justify-content-control/ui.js +1 -2
  377. package/build/components/justify-content-control/ui.js.map +1 -1
  378. package/build/components/keyboard-shortcuts/index.js +1 -2
  379. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  380. package/build/components/line-height-control/index.js +1 -2
  381. package/build/components/line-height-control/index.js.map +1 -1
  382. package/build/components/line-height-control/utils.js +4 -8
  383. package/build/components/line-height-control/utils.js.map +1 -1
  384. package/build/components/link-control/constants.js +7 -14
  385. package/build/components/link-control/constants.js.map +1 -1
  386. package/build/components/link-control/index.js +2 -16
  387. package/build/components/link-control/index.js.map +1 -1
  388. package/build/components/link-control/link-preview.js +13 -15
  389. package/build/components/link-control/link-preview.js.map +1 -1
  390. package/build/components/link-control/search-create-button.js +1 -2
  391. package/build/components/link-control/search-create-button.js.map +1 -1
  392. package/build/components/link-control/search-input.js +1 -2
  393. package/build/components/link-control/search-input.js.map +1 -1
  394. package/build/components/link-control/search-item.js +1 -2
  395. package/build/components/link-control/search-item.js.map +1 -1
  396. package/build/components/link-control/settings-drawer.js +1 -2
  397. package/build/components/link-control/settings-drawer.js.map +1 -1
  398. package/build/components/link-control/settings.js +1 -2
  399. package/build/components/link-control/settings.js.map +1 -1
  400. package/build/components/link-control/use-create-page.js +0 -1
  401. package/build/components/link-control/use-create-page.js.map +1 -1
  402. package/build/components/link-control/use-rich-url-data.js +1 -2
  403. package/build/components/link-control/use-rich-url-data.js.map +1 -1
  404. package/build/components/link-control/viewer-slot.js +1 -2
  405. package/build/components/link-control/viewer-slot.js.map +1 -1
  406. package/build/components/list-view/appender.js +1 -2
  407. package/build/components/list-view/appender.js.map +1 -1
  408. package/build/components/list-view/block-contents.js +1 -2
  409. package/build/components/list-view/block-contents.js.map +1 -1
  410. package/build/components/list-view/block-select-button.js +1 -2
  411. package/build/components/list-view/block-select-button.js.map +1 -1
  412. package/build/components/list-view/block.js +33 -28
  413. package/build/components/list-view/block.js.map +1 -1
  414. package/build/components/list-view/branch.js +1 -2
  415. package/build/components/list-view/branch.js.map +1 -1
  416. package/build/components/list-view/context.js +1 -2
  417. package/build/components/list-view/context.js.map +1 -1
  418. package/build/components/list-view/index.js +20 -17
  419. package/build/components/list-view/index.js.map +1 -1
  420. package/build/components/list-view/leaf.js +1 -2
  421. package/build/components/list-view/leaf.js.map +1 -1
  422. package/build/components/list-view/use-clipboard-handler.js +159 -0
  423. package/build/components/list-view/use-clipboard-handler.js.map +1 -0
  424. package/build/components/list-view/use-list-view-drop-zone.js +1 -2
  425. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  426. package/build/components/list-view/utils.js +4 -4
  427. package/build/components/list-view/utils.js.map +1 -1
  428. package/build/components/media-placeholder/index.js +1 -2
  429. package/build/components/media-placeholder/index.js.map +1 -1
  430. package/build/components/media-placeholder/index.native.js +1 -2
  431. package/build/components/media-placeholder/index.native.js.map +1 -1
  432. package/build/components/media-replace-flow/index.js +1 -2
  433. package/build/components/media-replace-flow/index.js.map +1 -1
  434. package/build/components/media-replace-flow/index.native.js +1 -2
  435. package/build/components/media-replace-flow/index.native.js.map +1 -1
  436. package/build/components/media-upload/check.js +1 -2
  437. package/build/components/media-upload/check.js.map +1 -1
  438. package/build/components/media-upload/constants.native.js +8 -16
  439. package/build/components/media-upload/constants.native.js.map +1 -1
  440. package/build/components/media-upload/index.js +1 -2
  441. package/build/components/media-upload/index.js.map +1 -1
  442. package/build/components/media-upload/index.native.js +1 -2
  443. package/build/components/media-upload/index.native.js.map +1 -1
  444. package/build/components/media-upload-progress/constants.js +6 -12
  445. package/build/components/media-upload-progress/constants.js.map +1 -1
  446. package/build/components/media-upload-progress/index.native.js +1 -2
  447. package/build/components/media-upload-progress/index.native.js.map +1 -1
  448. package/build/components/multi-selection-inspector/index.js +1 -2
  449. package/build/components/multi-selection-inspector/index.js.map +1 -1
  450. package/build/components/navigable-toolbar/index.js +5 -2
  451. package/build/components/navigable-toolbar/index.js.map +1 -1
  452. package/build/components/observe-typing/index.js +1 -2
  453. package/build/components/observe-typing/index.js.map +1 -1
  454. package/build/components/panel-color-settings/index.js +1 -2
  455. package/build/components/panel-color-settings/index.js.map +1 -1
  456. package/build/components/plain-text/index.js +1 -2
  457. package/build/components/plain-text/index.js.map +1 -1
  458. package/build/components/provider/block-refs-provider.js +1 -2
  459. package/build/components/provider/block-refs-provider.js.map +1 -1
  460. package/build/components/provider/index.js +3 -5
  461. package/build/components/provider/index.js.map +1 -1
  462. package/build/components/provider/index.native.js +2 -4
  463. package/build/components/provider/index.native.js.map +1 -1
  464. package/build/components/provider/with-registry-provider.js +1 -2
  465. package/build/components/provider/with-registry-provider.js.map +1 -1
  466. package/build/components/publish-date-time-picker/index.js +1 -2
  467. package/build/components/publish-date-time-picker/index.js.map +1 -1
  468. package/build/components/responsive-block-control/index.js +3 -7
  469. package/build/components/responsive-block-control/index.js.map +1 -1
  470. package/build/components/rich-text/embed-handler-picker.native.js +1 -2
  471. package/build/components/rich-text/embed-handler-picker.native.js.map +1 -1
  472. package/build/components/rich-text/format-edit.js +1 -2
  473. package/build/components/rich-text/format-edit.js.map +1 -1
  474. package/build/components/rich-text/format-toolbar/index.js +1 -2
  475. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  476. package/build/components/rich-text/format-toolbar/index.native.js +1 -2
  477. package/build/components/rich-text/format-toolbar/index.native.js.map +1 -1
  478. package/build/components/rich-text/format-toolbar-container.js +1 -2
  479. package/build/components/rich-text/format-toolbar-container.js.map +1 -1
  480. package/build/components/rich-text/format-toolbar-container.native.js +1 -2
  481. package/build/components/rich-text/format-toolbar-container.native.js.map +1 -1
  482. package/build/components/rich-text/index.js +6 -7
  483. package/build/components/rich-text/index.js.map +1 -1
  484. package/build/components/rich-text/index.native.js +1 -2
  485. package/build/components/rich-text/index.native.js.map +1 -1
  486. package/build/components/rich-text/multiline.js +1 -2
  487. package/build/components/rich-text/multiline.js.map +1 -1
  488. package/build/components/rich-text/native/index.native.js +1 -6
  489. package/build/components/rich-text/native/index.native.js.map +1 -1
  490. package/build/components/rich-text/native/toolbar-button-with-options.native.js +1 -2
  491. package/build/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -1
  492. package/build/components/skip-to-selected-block/index.js +1 -2
  493. package/build/components/skip-to-selected-block/index.js.map +1 -1
  494. package/build/components/spacing-sizes-control/index.js +3 -1
  495. package/build/components/spacing-sizes-control/index.js.map +1 -1
  496. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
  497. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  498. package/build/components/spacing-sizes-control/utils.js +5 -10
  499. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  500. package/build/components/tool-selector/index.js +1 -2
  501. package/build/components/tool-selector/index.js.map +1 -1
  502. package/build/components/typewriter/index.js +1 -2
  503. package/build/components/typewriter/index.js.map +1 -1
  504. package/build/components/ungroup-button/index.native.js +1 -2
  505. package/build/components/ungroup-button/index.native.js.map +1 -1
  506. package/build/components/unsupported-block-details/index.native.js +1 -2
  507. package/build/components/unsupported-block-details/index.native.js.map +1 -1
  508. package/build/components/url-input/button.js +1 -2
  509. package/build/components/url-input/button.js.map +1 -1
  510. package/build/components/url-input/index.js +1 -2
  511. package/build/components/url-input/index.js.map +1 -1
  512. package/build/components/url-popover/image-url-input-ui.js +18 -8
  513. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  514. package/build/components/url-popover/index.js +5 -5
  515. package/build/components/url-popover/index.js.map +1 -1
  516. package/build/components/use-block-drop-zone/index.js +15 -5
  517. package/build/components/use-block-drop-zone/index.js.map +1 -1
  518. package/build/components/use-flash-editable-blocks/index.js +60 -0
  519. package/build/components/use-flash-editable-blocks/index.js.map +1 -0
  520. package/build/components/use-moving-animation/index.js +1 -2
  521. package/build/components/use-moving-animation/index.js.map +1 -1
  522. package/build/components/use-on-block-drop/index.js +4 -4
  523. package/build/components/use-on-block-drop/index.js.map +1 -1
  524. package/build/components/use-settings/index.js +3 -162
  525. package/build/components/use-settings/index.js.map +1 -1
  526. package/build/components/video-player/gridicon-play.native.js +1 -2
  527. package/build/components/video-player/gridicon-play.native.js.map +1 -1
  528. package/build/components/video-player/index.native.js +2 -4
  529. package/build/components/video-player/index.native.js.map +1 -1
  530. package/build/components/warning/index.js +1 -2
  531. package/build/components/warning/index.js.map +1 -1
  532. package/build/components/warning/index.native.js +1 -2
  533. package/build/components/warning/index.native.js.map +1 -1
  534. package/build/components/writing-flow/index.js +1 -2
  535. package/build/components/writing-flow/index.js.map +1 -1
  536. package/build/components/writing-flow/use-clipboard-handler.js +3 -48
  537. package/build/components/writing-flow/use-clipboard-handler.js.map +1 -1
  538. package/build/components/writing-flow/use-drag-selection.js +13 -2
  539. package/build/components/writing-flow/use-drag-selection.js.map +1 -1
  540. package/build/components/writing-flow/utils.js +86 -0
  541. package/build/components/writing-flow/utils.js.map +1 -0
  542. package/build/hooks/align.js +1 -2
  543. package/build/hooks/align.js.map +1 -1
  544. package/build/hooks/align.native.js +2 -2
  545. package/build/hooks/align.native.js.map +1 -1
  546. package/build/hooks/anchor.js +1 -2
  547. package/build/hooks/anchor.js.map +1 -1
  548. package/build/hooks/aria-label.js +1 -2
  549. package/build/hooks/aria-label.js.map +1 -1
  550. package/build/hooks/background.js +52 -14
  551. package/build/hooks/background.js.map +1 -1
  552. package/build/hooks/block-hooks.js +1 -2
  553. package/build/hooks/block-hooks.js.map +1 -1
  554. package/build/hooks/block-renaming.js +1 -2
  555. package/build/hooks/block-renaming.js.map +1 -1
  556. package/build/hooks/border.js +42 -7
  557. package/build/hooks/border.js.map +1 -1
  558. package/build/hooks/color.js +4 -6
  559. package/build/hooks/color.js.map +1 -1
  560. package/build/hooks/content-lock-ui.js +1 -2
  561. package/build/hooks/content-lock-ui.js.map +1 -1
  562. package/build/hooks/custom-class-name.js +1 -2
  563. package/build/hooks/custom-class-name.js.map +1 -1
  564. package/build/hooks/custom-class-name.native.js +1 -2
  565. package/build/hooks/custom-class-name.native.js.map +1 -1
  566. package/build/hooks/dimensions.js +5 -10
  567. package/build/hooks/dimensions.js.map +1 -1
  568. package/build/hooks/duotone.js +1 -3
  569. package/build/hooks/duotone.js.map +1 -1
  570. package/build/hooks/font-family.js +2 -4
  571. package/build/hooks/font-family.js.map +1 -1
  572. package/build/hooks/font-size.js +25 -31
  573. package/build/hooks/font-size.js.map +1 -1
  574. package/build/hooks/index.js +2 -2
  575. package/build/hooks/index.js.map +1 -1
  576. package/build/hooks/layout-child.js +1 -2
  577. package/build/hooks/layout-child.js.map +1 -1
  578. package/build/hooks/layout.js +2 -4
  579. package/build/hooks/layout.js.map +1 -1
  580. package/build/hooks/line-height.js +1 -2
  581. package/build/hooks/line-height.js.map +1 -1
  582. package/build/hooks/position.js +1 -2
  583. package/build/hooks/position.js.map +1 -1
  584. package/build/hooks/style.js +3 -8
  585. package/build/hooks/style.js.map +1 -1
  586. package/build/hooks/typography.js +4 -6
  587. package/build/hooks/typography.js.map +1 -1
  588. package/build/hooks/typography.native.js +3 -6
  589. package/build/hooks/typography.native.js.map +1 -1
  590. package/build/hooks/use-bindings-attributes.js +10 -9
  591. package/build/hooks/use-bindings-attributes.js.map +1 -1
  592. package/build/layouts/constrained.js +1 -2
  593. package/build/layouts/constrained.js.map +1 -1
  594. package/build/layouts/definitions.js +1 -2
  595. package/build/layouts/definitions.js.map +1 -1
  596. package/build/layouts/flex.js +1 -2
  597. package/build/layouts/flex.js.map +1 -1
  598. package/build/layouts/flow.js +1 -2
  599. package/build/layouts/flow.js.map +1 -1
  600. package/build/layouts/grid.js +1 -2
  601. package/build/layouts/grid.js.map +1 -1
  602. package/build/private-apis.js +8 -5
  603. package/build/private-apis.js.map +1 -1
  604. package/build/private-apis.native.js +3 -4
  605. package/build/private-apis.native.js.map +1 -1
  606. package/build/store/actions.js +2 -4
  607. package/build/store/actions.js.map +1 -1
  608. package/build/store/constants.js +1 -2
  609. package/build/store/constants.js.map +1 -1
  610. package/build/store/defaults.js +2 -4
  611. package/build/store/defaults.js.map +1 -1
  612. package/build/store/defaults.native.js +1 -2
  613. package/build/store/defaults.native.js.map +1 -1
  614. package/build/store/get-block-settings.js +180 -0
  615. package/build/store/get-block-settings.js.map +1 -0
  616. package/build/store/index.js +4 -6
  617. package/build/store/index.js.map +1 -1
  618. package/build/store/private-actions.js +37 -3
  619. package/build/store/private-actions.js.map +1 -1
  620. package/build/store/private-selectors.js +55 -29
  621. package/build/store/private-selectors.js.map +1 -1
  622. package/build/store/reducer.js +27 -6
  623. package/build/store/reducer.js.map +1 -1
  624. package/build/store/selectors.js +98 -102
  625. package/build/store/selectors.js.map +1 -1
  626. package/build/store/undo-ignore.js +1 -2
  627. package/build/store/undo-ignore.js.map +1 -1
  628. package/build/utils/selection.js +1 -2
  629. package/build/utils/selection.js.map +1 -1
  630. package/build/utils/transform-styles/index.js +3 -4
  631. package/build/utils/transform-styles/index.js.map +1 -1
  632. package/build-module/components/block-breadcrumb/index.js +0 -1
  633. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  634. package/build-module/components/block-inspector/index.js +10 -7
  635. package/build-module/components/block-inspector/index.js.map +1 -1
  636. package/build-module/components/block-list/block.js +32 -20
  637. package/build-module/components/block-list/block.js.map +1 -1
  638. package/build-module/components/block-list/block.native.js +6 -4
  639. package/build-module/components/block-list/block.native.js.map +1 -1
  640. package/build-module/components/block-list/index.js +18 -7
  641. package/build-module/components/block-list/index.js.map +1 -1
  642. package/build-module/components/block-list/use-block-props/index.js +8 -1
  643. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  644. package/build-module/components/block-list-appender/index.js +5 -51
  645. package/build-module/components/block-list-appender/index.js.map +1 -1
  646. package/build-module/components/block-mover/mover-description.native.js +0 -2
  647. package/build-module/components/block-mover/mover-description.native.js.map +1 -1
  648. package/build-module/components/block-popover/inbetween.js +0 -1
  649. package/build-module/components/block-popover/inbetween.js.map +1 -1
  650. package/build-module/components/block-preview/auto.js +2 -1
  651. package/build-module/components/block-preview/auto.js.map +1 -1
  652. package/build-module/components/block-removal-warning-modal/index.js +4 -2
  653. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  654. package/build-module/components/block-switcher/index.js +12 -9
  655. package/build-module/components/block-switcher/index.js.map +1 -1
  656. package/build-module/components/block-title/use-block-display-title.js +22 -28
  657. package/build-module/components/block-title/use-block-display-title.js.map +1 -1
  658. package/build-module/components/block-tools/block-selection-button.js +20 -17
  659. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  660. package/build-module/components/block-tools/index.js +2 -10
  661. package/build-module/components/block-tools/index.js.map +1 -1
  662. package/build-module/components/colors-gradients/control.js +0 -1
  663. package/build-module/components/colors-gradients/control.js.map +1 -1
  664. package/build-module/components/default-block-appender/index.js +30 -37
  665. package/build-module/components/default-block-appender/index.js.map +1 -1
  666. package/build-module/components/global-styles/border-panel.js +57 -9
  667. package/build-module/components/global-styles/border-panel.js.map +1 -1
  668. package/build-module/components/global-styles/get-global-styles-changes.js +2 -4
  669. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  670. package/build-module/components/global-styles/index.js +0 -1
  671. package/build-module/components/global-styles/index.js.map +1 -1
  672. package/build-module/components/global-styles/shadow-panel-components.js +121 -0
  673. package/build-module/components/global-styles/shadow-panel-components.js.map +1 -0
  674. package/build-module/components/global-styles/typography-panel.js +2 -3
  675. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  676. package/build-module/components/global-styles/use-global-styles-output.js +2 -2
  677. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  678. package/build-module/components/global-styles/utils.js +30 -1
  679. package/build-module/components/global-styles/utils.js.map +1 -1
  680. package/build-module/components/inner-blocks/index.js +33 -29
  681. package/build-module/components/inner-blocks/index.js.map +1 -1
  682. package/build-module/components/inner-blocks/index.native.js +1 -4
  683. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  684. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +2 -3
  685. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  686. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +4 -4
  687. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  688. package/build-module/components/inserter/block-patterns-tab/utils.js +2 -2
  689. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
  690. package/build-module/components/inserter/quick-inserter.js +3 -2
  691. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  692. package/build-module/components/inserter/search-items.js +0 -1
  693. package/build-module/components/inserter/search-items.js.map +1 -1
  694. package/build-module/components/inserter-draggable-blocks/index.js +12 -1
  695. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  696. package/build-module/components/inspector-controls-tabs/styles-tab.js +5 -4
  697. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  698. package/build-module/components/link-control/index.js +1 -14
  699. package/build-module/components/link-control/index.js.map +1 -1
  700. package/build-module/components/link-control/link-preview.js +16 -18
  701. package/build-module/components/link-control/link-preview.js.map +1 -1
  702. package/build-module/components/link-control/use-create-page.js +0 -1
  703. package/build-module/components/link-control/use-create-page.js.map +1 -1
  704. package/build-module/components/list-view/block.js +32 -26
  705. package/build-module/components/list-view/block.js.map +1 -1
  706. package/build-module/components/list-view/index.js +17 -11
  707. package/build-module/components/list-view/index.js.map +1 -1
  708. package/build-module/components/list-view/use-clipboard-handler.js +153 -0
  709. package/build-module/components/list-view/use-clipboard-handler.js.map +1 -0
  710. package/build-module/components/list-view/utils.js +4 -4
  711. package/build-module/components/list-view/utils.js.map +1 -1
  712. package/build-module/components/navigable-toolbar/index.js +5 -2
  713. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  714. package/build-module/components/provider/index.js +1 -1
  715. package/build-module/components/provider/index.js.map +1 -1
  716. package/build-module/components/responsive-block-control/index.js +3 -6
  717. package/build-module/components/responsive-block-control/index.js.map +1 -1
  718. package/build-module/components/rich-text/index.js +3 -1
  719. package/build-module/components/rich-text/index.js.map +1 -1
  720. package/build-module/components/rich-text/native/index.native.js +0 -4
  721. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  722. package/build-module/components/spacing-sizes-control/index.js +4 -2
  723. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  724. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
  725. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  726. package/build-module/components/url-popover/image-url-input-ui.js +21 -11
  727. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  728. package/build-module/components/url-popover/index.js +5 -4
  729. package/build-module/components/url-popover/index.js.map +1 -1
  730. package/build-module/components/use-block-drop-zone/index.js +15 -5
  731. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  732. package/build-module/components/use-flash-editable-blocks/index.js +53 -0
  733. package/build-module/components/use-flash-editable-blocks/index.js.map +1 -0
  734. package/build-module/components/use-on-block-drop/index.js +4 -4
  735. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  736. package/build-module/components/use-settings/index.js +3 -159
  737. package/build-module/components/use-settings/index.js.map +1 -1
  738. package/build-module/components/writing-flow/use-clipboard-handler.js +4 -49
  739. package/build-module/components/writing-flow/use-clipboard-handler.js.map +1 -1
  740. package/build-module/components/writing-flow/use-drag-selection.js +13 -2
  741. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
  742. package/build-module/components/writing-flow/utils.js +79 -0
  743. package/build-module/components/writing-flow/utils.js.map +1 -0
  744. package/build-module/hooks/background.js +48 -10
  745. package/build-module/hooks/background.js.map +1 -1
  746. package/build-module/hooks/border.js +38 -3
  747. package/build-module/hooks/border.js.map +1 -1
  748. package/build-module/hooks/duotone.js +0 -1
  749. package/build-module/hooks/duotone.js.map +1 -1
  750. package/build-module/hooks/font-size.js +23 -27
  751. package/build-module/hooks/font-size.js.map +1 -1
  752. package/build-module/hooks/style.js +3 -7
  753. package/build-module/hooks/style.js.map +1 -1
  754. package/build-module/hooks/use-bindings-attributes.js +8 -11
  755. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  756. package/build-module/private-apis.js +5 -1
  757. package/build-module/private-apis.js.map +1 -1
  758. package/build-module/store/get-block-settings.js +171 -0
  759. package/build-module/store/get-block-settings.js.map +1 -0
  760. package/build-module/store/private-actions.js +35 -3
  761. package/build-module/store/private-actions.js.map +1 -1
  762. package/build-module/store/private-selectors.js +42 -19
  763. package/build-module/store/private-selectors.js.map +1 -1
  764. package/build-module/store/reducer.js +24 -2
  765. package/build-module/store/reducer.js.map +1 -1
  766. package/build-module/store/selectors.js +65 -34
  767. package/build-module/store/selectors.js.map +1 -1
  768. package/build-style/content-rtl.css +23 -15
  769. package/build-style/content.css +23 -15
  770. package/build-style/style-rtl.css +66 -53
  771. package/build-style/style.css +66 -53
  772. package/package.json +31 -31
  773. package/src/components/block-canvas/style.scss +1 -1
  774. package/src/components/block-card/style.scss +3 -1
  775. package/src/components/block-controls/README.md +2 -2
  776. package/src/components/block-inspector/index.js +11 -9
  777. package/src/components/block-list/block.js +45 -20
  778. package/src/components/block-list/block.native.js +7 -4
  779. package/src/components/block-list/content.scss +23 -28
  780. package/src/components/block-list/index.js +49 -25
  781. package/src/components/block-list/use-block-props/index.js +8 -0
  782. package/src/components/block-list-appender/index.js +7 -74
  783. package/src/components/block-mover/style.scss +4 -3
  784. package/src/components/block-preview/auto.js +2 -1
  785. package/src/components/block-removal-warning-modal/index.js +17 -10
  786. package/src/components/block-switcher/index.js +22 -13
  787. package/src/components/block-title/test/index.js +86 -85
  788. package/src/components/block-title/use-block-display-title.js +25 -36
  789. package/src/components/block-toolbar/style.scss +8 -1
  790. package/src/components/block-tools/block-selection-button.js +23 -26
  791. package/src/components/block-tools/index.js +2 -12
  792. package/src/components/colors-gradients/control.js +0 -1
  793. package/src/components/default-block-appender/index.js +26 -38
  794. package/src/components/default-block-appender/test/index.js +24 -16
  795. package/src/components/font-sizes/README.MD +0 -9
  796. package/src/components/global-styles/border-panel.js +72 -1
  797. package/src/components/global-styles/get-global-styles-changes.js +2 -8
  798. package/src/components/global-styles/index.js +0 -1
  799. package/src/components/global-styles/shadow-panel-components.js +125 -0
  800. package/src/components/global-styles/style.scss +8 -9
  801. package/src/components/global-styles/test/get-global-styles-changes.js +3 -3
  802. package/src/components/global-styles/test/use-global-styles-output.js +1 -1
  803. package/src/components/global-styles/test/utils.js +86 -0
  804. package/src/components/global-styles/typography-panel.js +1 -2
  805. package/src/components/global-styles/use-global-styles-output.js +5 -1
  806. package/src/components/global-styles/utils.js +36 -0
  807. package/src/components/inner-blocks/index.js +31 -32
  808. package/src/components/inner-blocks/index.native.js +3 -9
  809. package/src/components/inner-blocks/use-inner-block-template-sync.js +1 -3
  810. package/src/components/inserter/block-patterns-tab/patterns-filter.js +4 -10
  811. package/src/components/inserter/block-patterns-tab/utils.js +2 -2
  812. package/src/components/inserter/quick-inserter.js +4 -2
  813. package/src/components/inserter/style.scss +3 -13
  814. package/src/components/inserter-draggable-blocks/index.js +12 -1
  815. package/src/components/inspector-controls-tabs/styles-tab.js +4 -2
  816. package/src/components/link-control/index.js +1 -20
  817. package/src/components/link-control/link-preview.js +19 -24
  818. package/src/components/link-control/style.scss +5 -11
  819. package/src/components/link-control/test/index.js +11 -90
  820. package/src/components/list-view/block.js +49 -41
  821. package/src/components/list-view/index.js +22 -9
  822. package/src/components/list-view/use-clipboard-handler.js +199 -0
  823. package/src/components/list-view/utils.js +4 -4
  824. package/src/components/media-replace-flow/style.scss +1 -1
  825. package/src/components/media-replace-flow/test/index.js +1 -1
  826. package/src/components/navigable-toolbar/index.js +8 -4
  827. package/src/components/provider/index.js +1 -1
  828. package/src/components/responsive-block-control/index.js +3 -5
  829. package/src/components/rich-text/index.js +3 -1
  830. package/src/components/spacing-sizes-control/index.js +2 -1
  831. package/src/components/url-input/style.scss +4 -2
  832. package/src/components/url-popover/image-url-input-ui.js +22 -10
  833. package/src/components/url-popover/index.js +75 -69
  834. package/src/components/url-popover/style.scss +12 -21
  835. package/src/components/use-block-drop-zone/index.js +17 -3
  836. package/src/components/use-flash-editable-blocks/index.js +62 -0
  837. package/src/components/use-on-block-drop/index.js +11 -4
  838. package/src/components/use-settings/index.js +9 -232
  839. package/src/components/writing-flow/use-clipboard-handler.js +6 -78
  840. package/src/components/writing-flow/use-drag-selection.js +12 -3
  841. package/src/components/writing-flow/utils.js +103 -0
  842. package/src/hooks/background.js +53 -8
  843. package/src/hooks/border.js +47 -6
  844. package/src/hooks/font-size.js +33 -33
  845. package/src/hooks/style.js +5 -9
  846. package/src/hooks/test/background.js +50 -0
  847. package/src/hooks/test/font-size.js +164 -0
  848. package/src/hooks/use-bindings-attributes.js +8 -18
  849. package/src/private-apis.js +4 -0
  850. package/src/store/get-block-settings.js +225 -0
  851. package/src/store/private-actions.js +44 -2
  852. package/src/store/private-selectors.js +53 -38
  853. package/src/store/reducer.js +29 -1
  854. package/src/store/selectors.js +74 -48
  855. package/src/store/test/get-block-settings.js +90 -0
  856. package/src/store/test/private-actions.js +18 -0
  857. package/src/store/test/private-selectors.js +19 -0
  858. package/src/store/test/reducer.js +19 -0
  859. package/build/components/global-styles/effects-panel.js +0 -219
  860. package/build/components/global-styles/effects-panel.js.map +0 -1
  861. package/build/hooks/effects.js +0 -66
  862. package/build/hooks/effects.js.map +0 -1
  863. package/build-module/components/global-styles/effects-panel.js +0 -210
  864. package/build-module/components/global-styles/effects-panel.js.map +0 -1
  865. package/build-module/hooks/effects.js +0 -51
  866. package/build-module/hooks/effects.js.map +0 -1
  867. package/src/components/global-styles/effects-panel.js +0 -244
  868. package/src/components/use-settings/test/index.js +0 -141
  869. package/src/hooks/effects.js +0 -57
  870. package/src/hooks/test/effects.js +0 -39
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useFlashEditableBlocks = useFlashEditableBlocks;
7
+ var _compose = require("@wordpress/compose");
8
+ var _data = require("@wordpress/data");
9
+ var _store = require("../../store");
10
+ var _lockUnlock = require("../../lock-unlock");
11
+ /**
12
+ * WordPress dependencies
13
+ */
14
+
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+
19
+ function useFlashEditableBlocks({
20
+ clientId = '',
21
+ isEnabled = true
22
+ } = {}) {
23
+ const {
24
+ getEnabledClientIdsTree
25
+ } = (0, _lockUnlock.unlock)((0, _data.useSelect)(_store.store));
26
+ return (0, _compose.useRefEffect)(element => {
27
+ if (!isEnabled) {
28
+ return;
29
+ }
30
+ const flashEditableBlocks = () => {
31
+ getEnabledClientIdsTree(clientId).forEach(({
32
+ clientId: id
33
+ }) => {
34
+ const block = element.querySelector(`[data-block="${id}"]`);
35
+ if (!block) {
36
+ return;
37
+ }
38
+ block.classList.remove('has-editable-outline');
39
+ // Force reflow to trigger the animation.
40
+ // eslint-disable-next-line no-unused-expressions
41
+ block.offsetWidth;
42
+ block.classList.add('has-editable-outline');
43
+ });
44
+ };
45
+ const handleClick = event => {
46
+ const shouldFlash = event.target === element || event.target.classList.contains('is-root-container');
47
+ if (!shouldFlash) {
48
+ return;
49
+ }
50
+ if (event.defaultPrevented) {
51
+ return;
52
+ }
53
+ event.preventDefault();
54
+ flashEditableBlocks();
55
+ };
56
+ element.addEventListener('click', handleClick);
57
+ return () => element.removeEventListener('click', handleClick);
58
+ }, [isEnabled]);
59
+ }
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_compose","require","_data","_store","_lockUnlock","useFlashEditableBlocks","clientId","isEnabled","getEnabledClientIdsTree","unlock","useSelect","blockEditorStore","useRefEffect","element","flashEditableBlocks","forEach","id","block","querySelector","classList","remove","offsetWidth","add","handleClick","event","shouldFlash","target","contains","defaultPrevented","preventDefault","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/use-flash-editable-blocks/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport function useFlashEditableBlocks( {\n\tclientId = '',\n\tisEnabled = true,\n} = {} ) {\n\tconst { getEnabledClientIdsTree } = unlock( useSelect( blockEditorStore ) );\n\n\treturn useRefEffect(\n\t\t( element ) => {\n\t\t\tif ( ! isEnabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst flashEditableBlocks = () => {\n\t\t\t\tgetEnabledClientIdsTree( clientId ).forEach(\n\t\t\t\t\t( { clientId: id } ) => {\n\t\t\t\t\t\tconst block = element.querySelector(\n\t\t\t\t\t\t\t`[data-block=\"${ id }\"]`\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( ! block ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tblock.classList.remove( 'has-editable-outline' );\n\t\t\t\t\t\t// Force reflow to trigger the animation.\n\t\t\t\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\t\t\t\tblock.offsetWidth;\n\t\t\t\t\t\tblock.classList.add( 'has-editable-outline' );\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t};\n\n\t\t\tconst handleClick = ( event ) => {\n\t\t\t\tconst shouldFlash =\n\t\t\t\t\tevent.target === element ||\n\t\t\t\t\tevent.target.classList.contains( 'is-root-container' );\n\t\t\t\tif ( ! shouldFlash ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tevent.preventDefault();\n\t\t\t\tflashEditableBlocks();\n\t\t\t};\n\n\t\t\telement.addEventListener( 'click', handleClick );\n\t\t\treturn () => element.removeEventListener( 'click', handleClick );\n\t\t},\n\t\t[ isEnabled ]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIO,SAASI,sBAAsBA,CAAE;EACvCC,QAAQ,GAAG,EAAE;EACbC,SAAS,GAAG;AACb,CAAC,GAAG,CAAC,CAAC,EAAG;EACR,MAAM;IAAEC;EAAwB,CAAC,GAAG,IAAAC,kBAAM,EAAE,IAAAC,eAAS,EAAEC,YAAiB,CAAE,CAAC;EAE3E,OAAO,IAAAC,qBAAY,EAChBC,OAAO,IAAM;IACd,IAAK,CAAEN,SAAS,EAAG;MAClB;IACD;IAEA,MAAMO,mBAAmB,GAAGA,CAAA,KAAM;MACjCN,uBAAuB,CAAEF,QAAS,CAAC,CAACS,OAAO,CAC1C,CAAE;QAAET,QAAQ,EAAEU;MAAG,CAAC,KAAM;QACvB,MAAMC,KAAK,GAAGJ,OAAO,CAACK,aAAa,CACjC,gBAAgBF,EAAI,IACtB,CAAC;QACD,IAAK,CAAEC,KAAK,EAAG;UACd;QACD;QACAA,KAAK,CAACE,SAAS,CAACC,MAAM,CAAE,sBAAuB,CAAC;QAChD;QACA;QACAH,KAAK,CAACI,WAAW;QACjBJ,KAAK,CAACE,SAAS,CAACG,GAAG,CAAE,sBAAuB,CAAC;MAC9C,CACD,CAAC;IACF,CAAC;IAED,MAAMC,WAAW,GAAKC,KAAK,IAAM;MAChC,MAAMC,WAAW,GAChBD,KAAK,CAACE,MAAM,KAAKb,OAAO,IACxBW,KAAK,CAACE,MAAM,CAACP,SAAS,CAACQ,QAAQ,CAAE,mBAAoB,CAAC;MACvD,IAAK,CAAEF,WAAW,EAAG;QACpB;MACD;MACA,IAAKD,KAAK,CAACI,gBAAgB,EAAG;QAC7B;MACD;MACAJ,KAAK,CAACK,cAAc,CAAC,CAAC;MACtBf,mBAAmB,CAAC,CAAC;IACtB,CAAC;IAEDD,OAAO,CAACiB,gBAAgB,CAAE,OAAO,EAAEP,WAAY,CAAC;IAChD,OAAO,MAAMV,OAAO,CAACkB,mBAAmB,CAAE,OAAO,EAAER,WAAY,CAAC;EACjE,CAAC,EACD,CAAEhB,SAAS,CACZ,CAAC;AACF"}
@@ -152,6 +152,5 @@ function useMovingAnimation({
152
152
  }, [previous, prevRect, clientId, isTyping, getGlobalBlockCount, isBlockSelected, isFirstMultiSelectedBlock, isBlockMultiSelected, isAncestorMultiSelected]);
153
153
  return ref;
154
154
  }
155
- var _default = useMovingAnimation;
156
- exports.default = _default;
155
+ var _default = exports.default = useMovingAnimation;
157
156
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_web","require","_element","_dom","_data","_store","BLOCK_ANIMATION_THRESHOLD","getAbsolutePosition","element","top","offsetTop","left","offsetLeft","useMovingAnimation","triggerAnimationOnChange","clientId","ref","useRef","isTyping","getGlobalBlockCount","isBlockSelected","isFirstMultiSelectedBlock","isBlockMultiSelected","isAncestorMultiSelected","useSelect","blockEditorStore","previous","prevRect","useMemo","current","getBoundingClientRect","useLayoutEffect","scrollContainer","getScrollContainer","isSelected","adjustScrolling","preserveScrollPosition","blockRect","diff","scrollTop","disableAnimation","window","matchMedia","matches","isPartOfSelection","zIndex","controller","Controller","x","y","config","mass","tension","friction","onChange","value","Math","round","finishedMoving","style","transformOrigin","transform","undefined","destination","start","from","stop","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/use-moving-animation/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Controller } from '@react-spring/web';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\nfunction getAbsolutePosition( element ) {\n\treturn {\n\t\ttop: element.offsetTop,\n\t\tleft: element.offsetLeft,\n\t};\n}\n\n/**\n * Hook used to compute the styles required to move a div into a new position.\n *\n * The way this animation works is the following:\n * - It first renders the element as if there was no animation.\n * - It takes a snapshot of the position of the block to use it\n * as a destination point for the animation.\n * - It restores the element to the previous position using a CSS transform\n * - It uses the \"resetAnimation\" flag to reset the animation\n * from the beginning in order to animate to the new destination point.\n *\n * @param {Object} $1 Options\n * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.\n * @param {string} $1.clientId\n */\nfunction useMovingAnimation( { triggerAnimationOnChange, clientId } ) {\n\tconst ref = useRef();\n\tconst {\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t} = useSelect( blockEditorStore );\n\n\t// Whenever the trigger changes, we need to take a snapshot of the current\n\t// position of the block to use it as a destination point for the animation.\n\tconst { previous, prevRect } = useMemo(\n\t\t() => ( {\n\t\t\tprevious: ref.current && getAbsolutePosition( ref.current ),\n\t\t\tprevRect: ref.current && ref.current.getBoundingClientRect(),\n\t\t} ),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ triggerAnimationOnChange ]\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previous || ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst scrollContainer = getScrollContainer( ref.current );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst adjustScrolling =\n\t\t\tisSelected || isFirstMultiSelectedBlock( clientId );\n\n\t\tfunction preserveScrollPosition() {\n\t\t\tif ( adjustScrolling && prevRect ) {\n\t\t\t\tconst blockRect = ref.current.getBoundingClientRect();\n\t\t\t\tconst diff = blockRect.top - prevRect.top;\n\n\t\t\t\tif ( diff ) {\n\t\t\t\t\tscrollContainer.scrollTop += diff;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// We disable the animation if the user has a preference for reduced\n\t\t// motion, if the user is typing (insertion by Enter), or if the block\n\t\t// count exceeds the threshold (insertion caused all the blocks that\n\t\t// follow to animate).\n\t\t// To do: consider enableing the _moving_ animation even for large\n\t\t// posts, while only disabling the _insertion_ animation?\n\t\tconst disableAnimation =\n\t\t\twindow.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||\n\t\t\tisTyping() ||\n\t\t\tgetGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;\n\n\t\tif ( disableAnimation ) {\n\t\t\t// If the animation is disabled and the scroll needs to be adjusted,\n\t\t\t// just move directly to the final scroll position.\n\t\t\tpreserveScrollPosition();\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPartOfSelection =\n\t\t\tisSelected ||\n\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\tisAncestorMultiSelected( clientId );\n\t\t// Make sure the other blocks move under the selected block(s).\n\t\tconst zIndex = isPartOfSelection ? '1' : '';\n\n\t\tconst controller = new Controller( {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tconfig: { mass: 5, tension: 2000, friction: 200 },\n\t\t\tonChange( { value } ) {\n\t\t\t\tif ( ! ref.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet { x, y } = value;\n\t\t\t\tx = Math.round( x );\n\t\t\t\ty = Math.round( y );\n\t\t\t\tconst finishedMoving = x === 0 && y === 0;\n\t\t\t\tref.current.style.transformOrigin = 'center center';\n\t\t\t\tref.current.style.transform = finishedMoving\n\t\t\t\t\t? null // Set to `null` to explicitly remove the transform.\n\t\t\t\t\t: `translate3d(${ x }px,${ y }px,0)`;\n\t\t\t\tref.current.style.zIndex = zIndex;\n\t\t\t\tpreserveScrollPosition();\n\t\t\t},\n\t\t} );\n\n\t\tref.current.style.transform = undefined;\n\t\tconst destination = getAbsolutePosition( ref.current );\n\n\t\tconst x = Math.round( previous.left - destination.left );\n\t\tconst y = Math.round( previous.top - destination.top );\n\n\t\tcontroller.start( { x: 0, y: 0, from: { x, y } } );\n\n\t\treturn () => {\n\t\t\tcontroller.stop();\n\t\t};\n\t}, [\n\t\tprevious,\n\t\tprevRect,\n\t\tclientId,\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t] );\n\n\treturn ref;\n}\n\nexport default useMovingAnimation;\n"],"mappings":";;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,MAAMK,yBAAyB,GAAG,GAAG;AAErC,SAASC,mBAAmBA,CAAEC,OAAO,EAAG;EACvC,OAAO;IACNC,GAAG,EAAED,OAAO,CAACE,SAAS;IACtBC,IAAI,EAAEH,OAAO,CAACI;EACf,CAAC;AACF;;AAEA;AACA;AACA;AACA;A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M;QACjCT,sBAAsB,CAAC,CAAC;MACzB;IACD,CAAE,CAAC;IAEHpB,GAAG,CAACa,OAAO,CAAC8B,KAAK,CAACE,SAAS,GAAGC,SAAS;IACvC,MAAMC,WAAW,GAAGxD,mBAAmB,CAAES,GAAG,CAACa,OAAQ,CAAC;IAEtD,MAAMmB,CAAC,GAAGQ,IAAI,CAACC,KAAK,CAAE/B,QAAQ,CAACf,IAAI,GAAGoD,WAAW,CAACpD,IAAK,CAAC;IACxD,MAAMsC,CAAC,GAAGO,IAAI,CAACC,KAAK,CAAE/B,QAAQ,CAACjB,GAAG,GAAGsD,WAAW,CAACtD,GAAI,CAAC;IAEtDqC,UAAU,CAACkB,KAAK,CAAE;MAAEhB,CAAC,EAAE,CAAC;MAAEC,CAAC,EAAE,CAAC;MAAEgB,IAAI,EAAE;QAAEjB,CAAC;QAAEC;MAAE;IAAE,CAAE,CAAC;IAElD,OAAO,MAAM;MACZH,UAAU,CAACoB,IAAI,CAAC,CAAC;IAClB,CAAC;EACF,CAAC,EAAE,CACFxC,QAAQ,EACRC,QAAQ,EACRZ,QAAQ,EACRG,QAAQ,EACRC,mBAAmB,EACnBC,eAAe,EACfC,yBAAyB,EACzBC,oBAAoB,EACpBC,uBAAuB,CACtB,CAAC;EAEH,OAAOP,GAAG;AACX;AAAC,IAAAmD,QAAA,GAEctD,kBAAkB;AAAAuD,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_web","require","_element","_dom","_data","_store","BLOCK_ANIMATION_THRESHOLD","getAbsolutePosition","element","top","offsetTop","left","offsetLeft","useMovingAnimation","triggerAnimationOnChange","clientId","ref","useRef","isTyping","getGlobalBlockCount","isBlockSelected","isFirstMultiSelectedBlock","isBlockMultiSelected","isAncestorMultiSelected","useSelect","blockEditorStore","previous","prevRect","useMemo","current","getBoundingClientRect","useLayoutEffect","scrollContainer","getScrollContainer","isSelected","adjustScrolling","preserveScrollPosition","blockRect","diff","scrollTop","disableAnimation","window","matchMedia","matches","isPartOfSelection","zIndex","controller","Controller","x","y","config","mass","tension","friction","onChange","value","Math","round","finishedMoving","style","transformOrigin","transform","undefined","destination","start","from","stop","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/use-moving-animation/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Controller } from '@react-spring/web';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\nfunction getAbsolutePosition( element ) {\n\treturn {\n\t\ttop: element.offsetTop,\n\t\tleft: element.offsetLeft,\n\t};\n}\n\n/**\n * Hook used to compute the styles required to move a div into a new position.\n *\n * The way this animation works is the following:\n * - It first renders the element as if there was no animation.\n * - It takes a snapshot of the position of the block to use it\n * as a destination point for the animation.\n * - It restores the element to the previous position using a CSS transform\n * - It uses the \"resetAnimation\" flag to reset the animation\n * from the beginning in order to animate to the new destination point.\n *\n * @param {Object} $1 Options\n * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.\n * @param {string} $1.clientId\n */\nfunction useMovingAnimation( { triggerAnimationOnChange, clientId } ) {\n\tconst ref = useRef();\n\tconst {\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t} = useSelect( blockEditorStore );\n\n\t// Whenever the trigger changes, we need to take a snapshot of the current\n\t// position of the block to use it as a destination point for the animation.\n\tconst { previous, prevRect } = useMemo(\n\t\t() => ( {\n\t\t\tprevious: ref.current && getAbsolutePosition( ref.current ),\n\t\t\tprevRect: ref.current && ref.current.getBoundingClientRect(),\n\t\t} ),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ triggerAnimationOnChange ]\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previous || ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst scrollContainer = getScrollContainer( ref.current );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst adjustScrolling =\n\t\t\tisSelected || isFirstMultiSelectedBlock( clientId );\n\n\t\tfunction preserveScrollPosition() {\n\t\t\tif ( adjustScrolling && prevRect ) {\n\t\t\t\tconst blockRect = ref.current.getBoundingClientRect();\n\t\t\t\tconst diff = blockRect.top - prevRect.top;\n\n\t\t\t\tif ( diff ) {\n\t\t\t\t\tscrollContainer.scrollTop += diff;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// We disable the animation if the user has a preference for reduced\n\t\t// motion, if the user is typing (insertion by Enter), or if the block\n\t\t// count exceeds the threshold (insertion caused all the blocks that\n\t\t// follow to animate).\n\t\t// To do: consider enableing the _moving_ animation even for large\n\t\t// posts, while only disabling the _insertion_ animation?\n\t\tconst disableAnimation =\n\t\t\twindow.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||\n\t\t\tisTyping() ||\n\t\t\tgetGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;\n\n\t\tif ( disableAnimation ) {\n\t\t\t// If the animation is disabled and the scroll needs to be adjusted,\n\t\t\t// just move directly to the final scroll position.\n\t\t\tpreserveScrollPosition();\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPartOfSelection =\n\t\t\tisSelected ||\n\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\tisAncestorMultiSelected( clientId );\n\t\t// Make sure the other blocks move under the selected block(s).\n\t\tconst zIndex = isPartOfSelection ? '1' : '';\n\n\t\tconst controller = new Controller( {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tconfig: { mass: 5, tension: 2000, friction: 200 },\n\t\t\tonChange( { value } ) {\n\t\t\t\tif ( ! ref.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet { x, y } = value;\n\t\t\t\tx = Math.round( x );\n\t\t\t\ty = Math.round( y );\n\t\t\t\tconst finishedMoving = x === 0 && y === 0;\n\t\t\t\tref.current.style.transformOrigin = 'center center';\n\t\t\t\tref.current.style.transform = finishedMoving\n\t\t\t\t\t? null // Set to `null` to explicitly remove the transform.\n\t\t\t\t\t: `translate3d(${ x }px,${ y }px,0)`;\n\t\t\t\tref.current.style.zIndex = zIndex;\n\t\t\t\tpreserveScrollPosition();\n\t\t\t},\n\t\t} );\n\n\t\tref.current.style.transform = undefined;\n\t\tconst destination = getAbsolutePosition( ref.current );\n\n\t\tconst x = Math.round( previous.left - destination.left );\n\t\tconst y = Math.round( previous.top - destination.top );\n\n\t\tcontroller.start( { x: 0, y: 0, from: { x, y } } );\n\n\t\treturn () => {\n\t\t\tcontroller.stop();\n\t\t};\n\t}, [\n\t\tprevious,\n\t\tprevRect,\n\t\tclientId,\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t] );\n\n\treturn ref;\n}\n\nexport default useMovingAnimation;\n"],"mappings":";;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,MAAMK,yBAAyB,GAAG,GAAG;AAErC,SAASC,mBAAmBA,CAAEC,OAAO,EAAG;EACvC,OAAO;IACNC,GAAG,EAAED,OAAO,CAACE,SAAS;IACtBC,IAAI,EAAEH,OAAO,CAACI;EACf,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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C,CAAC;MACzB;IACD,CAAE,CAAC;IAEHpB,GAAG,CAACa,OAAO,CAAC8B,KAAK,CAACE,SAAS,GAAGC,SAAS;IACvC,MAAMC,WAAW,GAAGxD,mBAAmB,CAAES,GAAG,CAACa,OAAQ,CAAC;IAEtD,MAAMmB,CAAC,GAAGQ,IAAI,CAACC,KAAK,CAAE/B,QAAQ,CAACf,IAAI,GAAGoD,WAAW,CAACpD,IAAK,CAAC;IACxD,MAAMsC,CAAC,GAAGO,IAAI,CAACC,KAAK,CAAE/B,QAAQ,CAACjB,GAAG,GAAGsD,WAAW,CAACtD,GAAI,CAAC;IAEtDqC,UAAU,CAACkB,KAAK,CAAE;MAAEhB,CAAC,EAAE,CAAC;MAAEC,CAAC,EAAE,CAAC;MAAEgB,IAAI,EAAE;QAAEjB,CAAC;QAAEC;MAAE;IAAE,CAAE,CAAC;IAElD,OAAO,MAAM;MACZH,UAAU,CAACoB,IAAI,CAAC,CAAC;IAClB,CAAC;EACF,CAAC,EAAE,CACFxC,QAAQ,EACRC,QAAQ,EACRZ,QAAQ,EACRG,QAAQ,EACRC,mBAAmB,EACnBC,eAAe,EACfC,yBAAyB,EACzBC,oBAAoB,EACpBC,uBAAuB,CACtB,CAAC;EAEH,OAAOP,GAAG;AACX;AAAC,IAAAmD,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcxD,kBAAkB"}
@@ -184,7 +184,6 @@ function useOnBlockDrop(targetRootClientId, targetBlockIndex, options = {}) {
184
184
  isGroupable
185
185
  } = (0, _data.useSelect)(_store.store);
186
186
  const {
187
- getBlockType,
188
187
  getGroupingBlockName
189
188
  } = (0, _data.useSelect)(_blocks.store);
190
189
  const {
@@ -197,6 +196,7 @@ function useOnBlockDrop(targetRootClientId, targetBlockIndex, options = {}) {
197
196
  } = (0, _data.useDispatch)(_store.store);
198
197
  const registry = (0, _data.useRegistry)();
199
198
  const insertOrReplaceBlocks = (0, _element.useCallback)((blocks, updateSelection = true, initialPosition = 0, clientIdsToReplace = []) => {
199
+ if (!Array.isArray(blocks)) blocks = [blocks];
200
200
  const clientIds = getBlockOrder(targetRootClientId);
201
201
  const clientId = clientIds[targetBlockIndex];
202
202
  const blocksClientIds = blocks.map(block => block.clientId);
@@ -216,11 +216,11 @@ function useOnBlockDrop(targetRootClientId, targetBlockIndex, options = {}) {
216
216
  const areAllImages = blocks.every(block => {
217
217
  return block.name === 'core/image';
218
218
  });
219
- const galleryBlock = !!getBlockType('core/gallery');
219
+ const galleryBlock = canInsertBlockType('core/gallery', targetRootClientId);
220
220
  const wrappedBlocks = (0, _blocks.createBlock)(areAllImages && galleryBlock ? 'core/gallery' : getGroupingBlockName(), {
221
221
  layout: {
222
222
  type: 'flex',
223
- flexWrap: areAllImages ? null : 'nowrap'
223
+ flexWrap: areAllImages && galleryBlock ? null : 'nowrap'
224
224
  }
225
225
  }, groupInnerBlocks);
226
226
  // Need to make sure both the target block and the block being dragged are replaced
@@ -229,7 +229,7 @@ function useOnBlockDrop(targetRootClientId, targetBlockIndex, options = {}) {
229
229
  } else {
230
230
  insertBlocks(blocks, targetBlockIndex, targetRootClientId, updateSelection, initialPosition);
231
231
  }
232
- }, [getBlockOrder, targetRootClientId, targetBlockIndex, operation, replaceBlocks, getBlock, nearestSide, getBlockType, getGroupingBlockName, insertBlocks]);
232
+ }, [getBlockOrder, targetRootClientId, targetBlockIndex, isGroupable, operation, replaceBlocks, getBlock, nearestSide, canInsertBlockType, getGroupingBlockName, insertBlocks]);
233
233
  const moveBlocks = (0, _element.useCallback)((sourceClientIds, sourceRootClientId, insertIndex) => {
234
234
  if (operation === 'replace') {
235
235
  const sourceBlocks = getBlocksByClientId(sourceClientIds);
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_blocks","_data","_dom","_store","parseDropEvent","event","result","srcRootClientId","srcClientIds","srcIndex","type","blocks","dataTransfer","Object","assign","JSON","parse","getData","err","onBlockDrop","targetRootClientId","targetBlockIndex","getBlockIndex","getClientIdsOfDescendants","moveBlocks","insertOrReplaceBlocks","clearSelectedBlock","operation","getBlock","sourceRootClientId","sourceClientIds","dropType","blocksToInsert","map","block","cloneBlock","sourceBlockIndex","includes","some","id","clientId","isAtSameLevel","draggedBlockCount","length","insertIndex","onFilesDrop","getSettings","updateBlockAttributes","canInsertBlockType","files","mediaUpload","transformation","findTransform","getBlockTransforms","transform","blockName","isMatch","onHTMLDrop","HTML","pasteHandler","mode","useOnBlockDrop","options","nearestSide","getBlockOrder","getBlocksByClientId","isGroupable","useSelect","blockEditorStore","getBlockType","getGroupingBlockName","blocksStore","insertBlocks","moveBlocksToPosition","replaceBlocks","removeBlocks","useDispatch","registry","useRegistry","useCallback","updateSelection","initialPosition","clientIdsToReplace","clientIds","blocksClientIds","areGroupableBlocks","undefined","targetBlock","push","unshift","groupInnerBlocks","createBlock","name","attributes","innerBlocks","areAllImages","every","galleryBlock","wrappedBlocks","layout","flexWrap","sourceBlocks","targetBlockClientIds","targetBlockClientId","batch","_onDrop","_onFilesDrop","_onHTMLDrop","getFilesFromDataTransfer","html"],"sources":["@wordpress/block-editor/src/components/use-on-block-drop/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport {\n\tcloneBlock,\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tpasteHandler,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('react').SyntheticEvent} SyntheticEvent */\n/** @typedef {import('./types').WPDropOperation} WPDropOperation */\n\n/**\n * Retrieve the data for a block drop event.\n *\n * @param {SyntheticEvent} event The drop event.\n *\n * @return {Object} An object with block drag and drop data.\n */\nexport function parseDropEvent( event ) {\n\tlet result = {\n\t\tsrcRootClientId: null,\n\t\tsrcClientIds: null,\n\t\tsrcIndex: null,\n\t\ttype: null,\n\t\tblocks: null,\n\t};\n\n\tif ( ! event.dataTransfer ) {\n\t\treturn result;\n\t}\n\n\ttry {\n\t\tresult = Object.assign(\n\t\t\tresult,\n\t\t\tJSON.parse( event.dataTransfer.getData( 'wp-blocks' ) )\n\t\t);\n\t} catch ( err ) {\n\t\treturn result;\n\t}\n\n\treturn result;\n}\n\n/**\n * A function that returns an event handler function for block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Function} getBlockIndex A function that gets the index of a block.\n * @param {Function} getClientIdsOfDescendants A function that gets the client ids of descendant blocks.\n * @param {Function} moveBlocks A function that moves blocks.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n * @param {Function} clearSelectedBlock A function that clears block selection.\n * @param {string} operation The type of operation to perform on drop. Could be `insert` or `replace` or `group`.\n * @param {Function} getBlock A function that returns a block given its client id.\n * @return {Function} The event handler for a block drop event.\n */\nexport function onBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\tgetBlockIndex,\n\tgetClientIdsOfDescendants,\n\tmoveBlocks,\n\tinsertOrReplaceBlocks,\n\tclearSelectedBlock,\n\toperation,\n\tgetBlock\n) {\n\treturn ( event ) => {\n\t\tconst {\n\t\t\tsrcRootClientId: sourceRootClientId,\n\t\t\tsrcClientIds: sourceClientIds,\n\t\t\ttype: dropType,\n\t\t\tblocks,\n\t\t} = parseDropEvent( event );\n\n\t\t// If the user is inserting a block.\n\t\tif ( dropType === 'inserter' ) {\n\t\t\tclearSelectedBlock();\n\t\t\tconst blocksToInsert = blocks.map( ( block ) =>\n\t\t\t\tcloneBlock( block )\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocksToInsert, true, null );\n\t\t}\n\n\t\t// If the user is moving a block.\n\t\tif ( dropType === 'block' ) {\n\t\t\tconst sourceBlockIndex = getBlockIndex( sourceClientIds[ 0 ] );\n\n\t\t\t// If the user is dropping to the same position, return early.\n\t\t\tif (\n\t\t\t\tsourceRootClientId === targetRootClientId &&\n\t\t\t\tsourceBlockIndex === targetBlockIndex\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is attempting to drop a block within its own\n\t\t\t// nested blocks, return early as this would create infinite\n\t\t\t// recursion.\n\t\t\tif (\n\t\t\t\tsourceClientIds.includes( targetRootClientId ) ||\n\t\t\t\tgetClientIdsOfDescendants( sourceClientIds ).some(\n\t\t\t\t\t( id ) => id === targetRootClientId\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is dropping a block over another block, replace both blocks\n\t\t\t// with a group block containing them\n\t\t\tif ( operation === 'group' ) {\n\t\t\t\tconst blocksToInsert = sourceClientIds.map( ( clientId ) =>\n\t\t\t\t\tgetBlock( clientId )\n\t\t\t\t);\n\t\t\t\tinsertOrReplaceBlocks(\n\t\t\t\t\tblocksToInsert,\n\t\t\t\t\ttrue,\n\t\t\t\t\tnull,\n\t\t\t\t\tsourceClientIds\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isAtSameLevel = sourceRootClientId === targetRootClientId;\n\t\t\tconst draggedBlockCount = sourceClientIds.length;\n\n\t\t\t// If the block is kept at the same level and moved downwards,\n\t\t\t// subtract to take into account that the blocks being dragged\n\t\t\t// were removed from the block list above the insertion point.\n\t\t\tconst insertIndex =\n\t\t\t\tisAtSameLevel && sourceBlockIndex < targetBlockIndex\n\t\t\t\t\t? targetBlockIndex - draggedBlockCount\n\t\t\t\t\t: targetBlockIndex;\n\n\t\t\tmoveBlocks( sourceClientIds, sourceRootClientId, insertIndex );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related file drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {Function} getSettings A function that gets the block editor settings.\n * @param {Function} updateBlockAttributes A function that updates a block's attributes.\n * @param {Function} canInsertBlockType A function that returns checks whether a block type can be inserted.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related file drop event.\n */\nexport function onFilesDrop(\n\ttargetRootClientId,\n\tgetSettings,\n\tupdateBlockAttributes,\n\tcanInsertBlockType,\n\tinsertOrReplaceBlocks\n) {\n\treturn ( files ) => {\n\t\tif ( ! getSettings().mediaUpload ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst transformation = findTransform(\n\t\t\tgetBlockTransforms( 'from' ),\n\t\t\t( transform ) =>\n\t\t\t\ttransform.type === 'files' &&\n\t\t\t\tcanInsertBlockType( transform.blockName, targetRootClientId ) &&\n\t\t\t\ttransform.isMatch( files )\n\t\t);\n\n\t\tif ( transformation ) {\n\t\t\tconst blocks = transformation.transform(\n\t\t\t\tfiles,\n\t\t\t\tupdateBlockAttributes\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related HTML drop events.\n *\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related HTML drop event.\n */\nexport function onHTMLDrop( insertOrReplaceBlocks ) {\n\treturn ( HTML ) => {\n\t\tconst blocks = pasteHandler( { HTML, mode: 'BLOCKS' } );\n\n\t\tif ( blocks.length ) {\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A React hook for handling block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Object} options The optional options.\n * @param {WPDropOperation} [options.operation] The type of operation to perform on drop. Could be `insert` or `replace` for now.\n *\n * @return {Function} A function to be passed to the onDrop handler.\n */\nexport default function useOnBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\toptions = {}\n) {\n\tconst { operation = 'insert', nearestSide = 'right' } = options;\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tgetBlockOrder,\n\t\tgetBlocksByClientId,\n\t\tgetSettings,\n\t\tgetBlock,\n\t\tisGroupable,\n\t} = useSelect( blockEditorStore );\n\tconst { getBlockType, getGroupingBlockName } = useSelect( blocksStore );\n\tconst {\n\t\tinsertBlocks,\n\t\tmoveBlocksToPosition,\n\t\tupdateBlockAttributes,\n\t\tclearSelectedBlock,\n\t\treplaceBlocks,\n\t\tremoveBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\tconst insertOrReplaceBlocks = useCallback(\n\t\t(\n\t\t\tblocks,\n\t\t\tupdateSelection = true,\n\t\t\tinitialPosition = 0,\n\t\t\tclientIdsToReplace = []\n\t\t) => {\n\t\t\tconst clientIds = getBlockOrder( targetRootClientId );\n\t\t\tconst clientId = clientIds[ targetBlockIndex ];\n\t\t\tconst blocksClientIds = blocks.map( ( block ) => block.clientId );\n\t\t\tconst areGroupableBlocks = isGroupable( [\n\t\t\t\t...blocksClientIds,\n\t\t\t\tclientId,\n\t\t\t] );\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\treplaceBlocks( clientId, blocks, undefined, initialPosition );\n\t\t\t} else if ( operation === 'group' && areGroupableBlocks ) {\n\t\t\t\tconst targetBlock = getBlock( clientId );\n\t\t\t\tif ( nearestSide === 'left' ) {\n\t\t\t\t\tblocks.push( targetBlock );\n\t\t\t\t} else {\n\t\t\t\t\tblocks.unshift( targetBlock );\n\t\t\t\t}\n\n\t\t\t\tconst groupInnerBlocks = blocks.map( ( block ) => {\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\tblock.innerBlocks\n\t\t\t\t\t);\n\t\t\t\t} );\n\n\t\t\t\tconst areAllImages = blocks.every( ( block ) => {\n\t\t\t\t\treturn block.name === 'core/image';\n\t\t\t\t} );\n\n\t\t\t\tconst galleryBlock = !! getBlockType( 'core/gallery' );\n\n\t\t\t\tconst wrappedBlocks = createBlock(\n\t\t\t\t\tareAllImages && galleryBlock\n\t\t\t\t\t\t? 'core/gallery'\n\t\t\t\t\t\t: getGroupingBlockName(),\n\t\t\t\t\t{\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\ttype: 'flex',\n\t\t\t\t\t\t\tflexWrap: areAllImages ? null : 'nowrap',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tgroupInnerBlocks\n\t\t\t\t);\n\t\t\t\t// Need to make sure both the target block and the block being dragged are replaced\n\t\t\t\t// otherwise the dragged block will be duplicated.\n\t\t\t\treplaceBlocks(\n\t\t\t\t\t[ clientId, ...clientIdsToReplace ],\n\t\t\t\t\twrappedBlocks,\n\t\t\t\t\tundefined,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tinsertBlocks(\n\t\t\t\t\tblocks,\n\t\t\t\t\ttargetBlockIndex,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tupdateSelection,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tgetBlockOrder,\n\t\t\ttargetRootClientId,\n\t\t\ttargetBlockIndex,\n\t\t\toperation,\n\t\t\treplaceBlocks,\n\t\t\tgetBlock,\n\t\t\tnearestSide,\n\t\t\tgetBlockType,\n\t\t\tgetGroupingBlockName,\n\t\t\tinsertBlocks,\n\t\t]\n\t);\n\n\tconst moveBlocks = useCallback(\n\t\t( sourceClientIds, sourceRootClientId, insertIndex ) => {\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\tconst sourceBlocks = getBlocksByClientId( sourceClientIds );\n\t\t\t\tconst targetBlockClientIds =\n\t\t\t\t\tgetBlockOrder( targetRootClientId );\n\t\t\t\tconst targetBlockClientId =\n\t\t\t\t\ttargetBlockClientIds[ targetBlockIndex ];\n\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t// Remove the source blocks.\n\t\t\t\t\tremoveBlocks( sourceClientIds, false );\n\t\t\t\t\t// Replace the target block with the source blocks.\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\ttargetBlockClientId,\n\t\t\t\t\t\tsourceBlocks,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t0\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\tsourceClientIds,\n\t\t\t\t\tsourceRootClientId,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tinsertIndex\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\toperation,\n\t\t\tgetBlockOrder,\n\t\t\tgetBlocksByClientId,\n\t\t\tmoveBlocksToPosition,\n\t\t\tregistry,\n\t\t\tremoveBlocks,\n\t\t\treplaceBlocks,\n\t\t\ttargetBlockIndex,\n\t\t\ttargetRootClientId,\n\t\t]\n\t);\n\n\tconst _onDrop = onBlockDrop(\n\t\ttargetRootClientId,\n\t\ttargetBlockIndex,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tmoveBlocks,\n\t\tinsertOrReplaceBlocks,\n\t\tclearSelectedBlock,\n\t\toperation,\n\t\tgetBlock\n\t);\n\tconst _onFilesDrop = onFilesDrop(\n\t\ttargetRootClientId,\n\t\tgetSettings,\n\t\tupdateBlockAttributes,\n\t\tcanInsertBlockType,\n\t\tinsertOrReplaceBlocks\n\t);\n\tconst _onHTMLDrop = onHTMLDrop( insertOrReplaceBlocks );\n\n\treturn ( event ) => {\n\t\tconst files = getFilesFromDataTransfer( event.dataTransfer );\n\t\tconst html = event.dataTransfer.getData( 'text/html' );\n\n\t\t/**\n\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t */\n\t\tif ( html ) {\n\t\t\t_onHTMLDrop( html );\n\t\t} else if ( files.length ) {\n\t\t\t_onFilesDrop( files );\n\t\t} else {\n\t\t\t_onDrop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AC;AACF"}
1
+ {"version":3,"names":["_element","require","_blocks","_data","_dom","_store","parseDropEvent","event","result","srcRootClientId","srcClientIds","srcIndex","type","blocks","dataTransfer","Object","assign","JSON","parse","getData","err","onBlockDrop","targetRootClientId","targetBlockIndex","getBlockIndex","getClientIdsOfDescendants","moveBlocks","insertOrReplaceBlocks","clearSelectedBlock","operation","getBlock","sourceRootClientId","sourceClientIds","dropType","blocksToInsert","map","block","cloneBlock","sourceBlockIndex","includes","some","id","clientId","isAtSameLevel","draggedBlockCount","length","insertIndex","onFilesDrop","getSettings","updateBlockAttributes","canInsertBlockType","files","mediaUpload","transformation","findTransform","getBlockTransforms","transform","blockName","isMatch","onHTMLDrop","HTML","pasteHandler","mode","useOnBlockDrop","options","nearestSide","getBlockOrder","getBlocksByClientId","isGroupable","useSelect","blockEditorStore","getGroupingBlockName","blocksStore","insertBlocks","moveBlocksToPosition","replaceBlocks","removeBlocks","useDispatch","registry","useRegistry","useCallback","updateSelection","initialPosition","clientIdsToReplace","Array","isArray","clientIds","blocksClientIds","areGroupableBlocks","undefined","targetBlock","push","unshift","groupInnerBlocks","createBlock","name","attributes","innerBlocks","areAllImages","every","galleryBlock","wrappedBlocks","layout","flexWrap","sourceBlocks","targetBlockClientIds","targetBlockClientId","batch","_onDrop","_onFilesDrop","_onHTMLDrop","getFilesFromDataTransfer","html"],"sources":["@wordpress/block-editor/src/components/use-on-block-drop/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport {\n\tcloneBlock,\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tpasteHandler,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('react').SyntheticEvent} SyntheticEvent */\n/** @typedef {import('./types').WPDropOperation} WPDropOperation */\n\n/**\n * Retrieve the data for a block drop event.\n *\n * @param {SyntheticEvent} event The drop event.\n *\n * @return {Object} An object with block drag and drop data.\n */\nexport function parseDropEvent( event ) {\n\tlet result = {\n\t\tsrcRootClientId: null,\n\t\tsrcClientIds: null,\n\t\tsrcIndex: null,\n\t\ttype: null,\n\t\tblocks: null,\n\t};\n\n\tif ( ! event.dataTransfer ) {\n\t\treturn result;\n\t}\n\n\ttry {\n\t\tresult = Object.assign(\n\t\t\tresult,\n\t\t\tJSON.parse( event.dataTransfer.getData( 'wp-blocks' ) )\n\t\t);\n\t} catch ( err ) {\n\t\treturn result;\n\t}\n\n\treturn result;\n}\n\n/**\n * A function that returns an event handler function for block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Function} getBlockIndex A function that gets the index of a block.\n * @param {Function} getClientIdsOfDescendants A function that gets the client ids of descendant blocks.\n * @param {Function} moveBlocks A function that moves blocks.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n * @param {Function} clearSelectedBlock A function that clears block selection.\n * @param {string} operation The type of operation to perform on drop. Could be `insert` or `replace` or `group`.\n * @param {Function} getBlock A function that returns a block given its client id.\n * @return {Function} The event handler for a block drop event.\n */\nexport function onBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\tgetBlockIndex,\n\tgetClientIdsOfDescendants,\n\tmoveBlocks,\n\tinsertOrReplaceBlocks,\n\tclearSelectedBlock,\n\toperation,\n\tgetBlock\n) {\n\treturn ( event ) => {\n\t\tconst {\n\t\t\tsrcRootClientId: sourceRootClientId,\n\t\t\tsrcClientIds: sourceClientIds,\n\t\t\ttype: dropType,\n\t\t\tblocks,\n\t\t} = parseDropEvent( event );\n\n\t\t// If the user is inserting a block.\n\t\tif ( dropType === 'inserter' ) {\n\t\t\tclearSelectedBlock();\n\t\t\tconst blocksToInsert = blocks.map( ( block ) =>\n\t\t\t\tcloneBlock( block )\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocksToInsert, true, null );\n\t\t}\n\n\t\t// If the user is moving a block.\n\t\tif ( dropType === 'block' ) {\n\t\t\tconst sourceBlockIndex = getBlockIndex( sourceClientIds[ 0 ] );\n\n\t\t\t// If the user is dropping to the same position, return early.\n\t\t\tif (\n\t\t\t\tsourceRootClientId === targetRootClientId &&\n\t\t\t\tsourceBlockIndex === targetBlockIndex\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is attempting to drop a block within its own\n\t\t\t// nested blocks, return early as this would create infinite\n\t\t\t// recursion.\n\t\t\tif (\n\t\t\t\tsourceClientIds.includes( targetRootClientId ) ||\n\t\t\t\tgetClientIdsOfDescendants( sourceClientIds ).some(\n\t\t\t\t\t( id ) => id === targetRootClientId\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is dropping a block over another block, replace both blocks\n\t\t\t// with a group block containing them\n\t\t\tif ( operation === 'group' ) {\n\t\t\t\tconst blocksToInsert = sourceClientIds.map( ( clientId ) =>\n\t\t\t\t\tgetBlock( clientId )\n\t\t\t\t);\n\t\t\t\tinsertOrReplaceBlocks(\n\t\t\t\t\tblocksToInsert,\n\t\t\t\t\ttrue,\n\t\t\t\t\tnull,\n\t\t\t\t\tsourceClientIds\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isAtSameLevel = sourceRootClientId === targetRootClientId;\n\t\t\tconst draggedBlockCount = sourceClientIds.length;\n\n\t\t\t// If the block is kept at the same level and moved downwards,\n\t\t\t// subtract to take into account that the blocks being dragged\n\t\t\t// were removed from the block list above the insertion point.\n\t\t\tconst insertIndex =\n\t\t\t\tisAtSameLevel && sourceBlockIndex < targetBlockIndex\n\t\t\t\t\t? targetBlockIndex - draggedBlockCount\n\t\t\t\t\t: targetBlockIndex;\n\n\t\t\tmoveBlocks( sourceClientIds, sourceRootClientId, insertIndex );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related file drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {Function} getSettings A function that gets the block editor settings.\n * @param {Function} updateBlockAttributes A function that updates a block's attributes.\n * @param {Function} canInsertBlockType A function that returns checks whether a block type can be inserted.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related file drop event.\n */\nexport function onFilesDrop(\n\ttargetRootClientId,\n\tgetSettings,\n\tupdateBlockAttributes,\n\tcanInsertBlockType,\n\tinsertOrReplaceBlocks\n) {\n\treturn ( files ) => {\n\t\tif ( ! getSettings().mediaUpload ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst transformation = findTransform(\n\t\t\tgetBlockTransforms( 'from' ),\n\t\t\t( transform ) =>\n\t\t\t\ttransform.type === 'files' &&\n\t\t\t\tcanInsertBlockType( transform.blockName, targetRootClientId ) &&\n\t\t\t\ttransform.isMatch( files )\n\t\t);\n\n\t\tif ( transformation ) {\n\t\t\tconst blocks = transformation.transform(\n\t\t\t\tfiles,\n\t\t\t\tupdateBlockAttributes\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related HTML drop events.\n *\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related HTML drop event.\n */\nexport function onHTMLDrop( insertOrReplaceBlocks ) {\n\treturn ( HTML ) => {\n\t\tconst blocks = pasteHandler( { HTML, mode: 'BLOCKS' } );\n\n\t\tif ( blocks.length ) {\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A React hook for handling block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Object} options The optional options.\n * @param {WPDropOperation} [options.operation] The type of operation to perform on drop. Could be `insert` or `replace` for now.\n *\n * @return {Function} A function to be passed to the onDrop handler.\n */\nexport default function useOnBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\toptions = {}\n) {\n\tconst { operation = 'insert', nearestSide = 'right' } = options;\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tgetBlockOrder,\n\t\tgetBlocksByClientId,\n\t\tgetSettings,\n\t\tgetBlock,\n\t\tisGroupable,\n\t} = useSelect( blockEditorStore );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\n\tconst {\n\t\tinsertBlocks,\n\t\tmoveBlocksToPosition,\n\t\tupdateBlockAttributes,\n\t\tclearSelectedBlock,\n\t\treplaceBlocks,\n\t\tremoveBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\tconst insertOrReplaceBlocks = useCallback(\n\t\t(\n\t\t\tblocks,\n\t\t\tupdateSelection = true,\n\t\t\tinitialPosition = 0,\n\t\t\tclientIdsToReplace = []\n\t\t) => {\n\t\t\tif ( ! Array.isArray( blocks ) ) blocks = [ blocks ];\n\n\t\t\tconst clientIds = getBlockOrder( targetRootClientId );\n\t\t\tconst clientId = clientIds[ targetBlockIndex ];\n\t\t\tconst blocksClientIds = blocks.map( ( block ) => block.clientId );\n\t\t\tconst areGroupableBlocks = isGroupable( [\n\t\t\t\t...blocksClientIds,\n\t\t\t\tclientId,\n\t\t\t] );\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\treplaceBlocks( clientId, blocks, undefined, initialPosition );\n\t\t\t} else if ( operation === 'group' && areGroupableBlocks ) {\n\t\t\t\tconst targetBlock = getBlock( clientId );\n\t\t\t\tif ( nearestSide === 'left' ) {\n\t\t\t\t\tblocks.push( targetBlock );\n\t\t\t\t} else {\n\t\t\t\t\tblocks.unshift( targetBlock );\n\t\t\t\t}\n\n\t\t\t\tconst groupInnerBlocks = blocks.map( ( block ) => {\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\tblock.innerBlocks\n\t\t\t\t\t);\n\t\t\t\t} );\n\n\t\t\t\tconst areAllImages = blocks.every( ( block ) => {\n\t\t\t\t\treturn block.name === 'core/image';\n\t\t\t\t} );\n\n\t\t\t\tconst galleryBlock = canInsertBlockType(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\ttargetRootClientId\n\t\t\t\t);\n\n\t\t\t\tconst wrappedBlocks = createBlock(\n\t\t\t\t\tareAllImages && galleryBlock\n\t\t\t\t\t\t? 'core/gallery'\n\t\t\t\t\t\t: getGroupingBlockName(),\n\t\t\t\t\t{\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\ttype: 'flex',\n\t\t\t\t\t\t\tflexWrap:\n\t\t\t\t\t\t\t\tareAllImages && galleryBlock ? null : 'nowrap',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tgroupInnerBlocks\n\t\t\t\t);\n\t\t\t\t// Need to make sure both the target block and the block being dragged are replaced\n\t\t\t\t// otherwise the dragged block will be duplicated.\n\t\t\t\treplaceBlocks(\n\t\t\t\t\t[ clientId, ...clientIdsToReplace ],\n\t\t\t\t\twrappedBlocks,\n\t\t\t\t\tundefined,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tinsertBlocks(\n\t\t\t\t\tblocks,\n\t\t\t\t\ttargetBlockIndex,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tupdateSelection,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tgetBlockOrder,\n\t\t\ttargetRootClientId,\n\t\t\ttargetBlockIndex,\n\t\t\tisGroupable,\n\t\t\toperation,\n\t\t\treplaceBlocks,\n\t\t\tgetBlock,\n\t\t\tnearestSide,\n\t\t\tcanInsertBlockType,\n\t\t\tgetGroupingBlockName,\n\t\t\tinsertBlocks,\n\t\t]\n\t);\n\n\tconst moveBlocks = useCallback(\n\t\t( sourceClientIds, sourceRootClientId, insertIndex ) => {\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\tconst sourceBlocks = getBlocksByClientId( sourceClientIds );\n\t\t\t\tconst targetBlockClientIds =\n\t\t\t\t\tgetBlockOrder( targetRootClientId );\n\t\t\t\tconst targetBlockClientId =\n\t\t\t\t\ttargetBlockClientIds[ targetBlockIndex ];\n\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t// Remove the source blocks.\n\t\t\t\t\tremoveBlocks( sourceClientIds, false );\n\t\t\t\t\t// Replace the target block with the source blocks.\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\ttargetBlockClientId,\n\t\t\t\t\t\tsourceBlocks,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t0\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\tsourceClientIds,\n\t\t\t\t\tsourceRootClientId,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tinsertIndex\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\toperation,\n\t\t\tgetBlockOrder,\n\t\t\tgetBlocksByClientId,\n\t\t\tmoveBlocksToPosition,\n\t\t\tregistry,\n\t\t\tremoveBlocks,\n\t\t\treplaceBlocks,\n\t\t\ttargetBlockIndex,\n\t\t\ttargetRootClientId,\n\t\t]\n\t);\n\n\tconst _onDrop = onBlockDrop(\n\t\ttargetRootClientId,\n\t\ttargetBlockIndex,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tmoveBlocks,\n\t\tinsertOrReplaceBlocks,\n\t\tclearSelectedBlock,\n\t\toperation,\n\t\tgetBlock\n\t);\n\tconst _onFilesDrop = onFilesDrop(\n\t\ttargetRootClientId,\n\t\tgetSettings,\n\t\tupdateBlockAttributes,\n\t\tcanInsertBlockType,\n\t\tinsertOrReplaceBlocks\n\t);\n\tconst _onHTMLDrop = onHTMLDrop( insertOrReplaceBlocks );\n\n\treturn ( event ) => {\n\t\tconst files = getFilesFromDataTransfer( event.dataTransfer );\n\t\tconst html = event.dataTransfer.getData( 'text/html' );\n\n\t\t/**\n\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t */\n\t\tif ( html ) {\n\t\t\t_onHTMLDrop( html );\n\t\t} else if ( files.length ) {\n\t\t\t_onFilesDrop( files );\n\t\t} else {\n\t\t\t_onDrop( event );\n\t\t}\n\t};\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAQA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAlBA;AACA;AACA;;AAaA;AACA;AACA;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,cAAcA,CAAEC,KAAK,EAAG;EACvC,IAAIC,MAAM,GAAG;IACZC,eAAe,EAAE,IAAI;IACrBC,YAAY,EAAE,IAAI;IAClBC,QAAQ,EAAE,IAAI;IACdC,IAAI,EAAE,IAAI;IACVC,MAAM,EAAE;EACT,CAAC;EAED,IAAK,CAAEN,KAAK,CAACO,YAAY,EAAG;IAC3B,OAAON,MAAM;EACd;EAEA,IAAI;IACHA,MAAM,GAAGO,MAAM,CAACC,MAAM,CACrBR,MAAM,EACNS,IAAI,CAACC,KAAK,CAAEX,KAAK,CAACO,YAAY,CAACK,OAAO,CAAE,WAAY,CAAE,CACvD,CAAC;EACF,CAAC,CAAC,OAAQC,GAAG,EAAG;IACf,OAAOZ,MAAM;EACd;EAEA,OAAOA,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASa,WAAWA,CAC1BC,kBAAkB,E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AMmF,WAAW,GAAGnD,UAAU,CAAEhC,qBAAsB,CAAC;EAEvD,OAASpB,KAAK,IAAM;IACnB,MAAM4C,KAAK,GAAG,IAAA4D,6BAAwB,EAAExG,KAAK,CAACO,YAAa,CAAC;IAC5D,MAAMkG,IAAI,GAAGzG,KAAK,CAACO,YAAY,CAACK,OAAO,CAAE,WAAY,CAAC;;IAEtD;AACF;AACA;AACA;IACE,IAAK6F,IAAI,EAAG;MACXF,WAAW,CAAEE,IAAK,CAAC;IACpB,CAAC,MAAM,IAAK7D,KAAK,CAACN,MAAM,EAAG;MAC1BgE,YAAY,CAAE1D,KAAM,CAAC;IACtB,CAAC,MAAM;MACNyD,OAAO,CAAErG,KAAM,CAAC;IACjB;EACD,CAAC;AACF"}
@@ -4,18 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.hasMergedOrigins = hasMergedOrigins;
8
- exports.mergeOrigins = mergeOrigins;
9
7
  exports.useSetting = useSetting;
10
8
  exports.useSettings = useSettings;
11
- var _blocks = require("@wordpress/blocks");
12
9
  var _data = require("@wordpress/data");
13
10
  var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
14
- var _element = require("@wordpress/element");
15
- var _hooks = require("@wordpress/hooks");
16
11
  var _blockEdit = require("../block-edit");
17
12
  var _store = require("../../store");
18
- var _object = require("../../utils/object");
13
+ var _lockUnlock = require("../../lock-unlock");
19
14
  /**
20
15
  * WordPress dependencies
21
16
  */
@@ -24,98 +19,6 @@ var _object = require("../../utils/object");
24
19
  * Internal dependencies
25
20
  */
26
21
 
27
- const blockedPaths = ['color', 'border', 'dimensions', 'typography', 'spacing'];
28
- const deprecatedFlags = {
29
- 'color.palette': settings => settings.colors,
30
- 'color.gradients': settings => settings.gradients,
31
- 'color.custom': settings => settings.disableCustomColors === undefined ? undefined : !settings.disableCustomColors,
32
- 'color.customGradient': settings => settings.disableCustomGradients === undefined ? undefined : !settings.disableCustomGradients,
33
- 'typography.fontSizes': settings => settings.fontSizes,
34
- 'typography.customFontSize': settings => settings.disableCustomFontSizes === undefined ? undefined : !settings.disableCustomFontSizes,
35
- 'typography.lineHeight': settings => settings.enableCustomLineHeight,
36
- 'spacing.units': settings => {
37
- if (settings.enableCustomUnits === undefined) {
38
- return;
39
- }
40
- if (settings.enableCustomUnits === true) {
41
- return ['px', 'em', 'rem', 'vh', 'vw', '%'];
42
- }
43
- return settings.enableCustomUnits;
44
- },
45
- 'spacing.padding': settings => settings.enableCustomSpacing
46
- };
47
- const prefixedFlags = {
48
- /*
49
- * These were only available in the plugin
50
- * and can be removed when the minimum WordPress version
51
- * for the plugin is 5.9.
52
- */
53
- 'border.customColor': 'border.color',
54
- 'border.customStyle': 'border.style',
55
- 'border.customWidth': 'border.width',
56
- 'typography.customFontStyle': 'typography.fontStyle',
57
- 'typography.customFontWeight': 'typography.fontWeight',
58
- 'typography.customLetterSpacing': 'typography.letterSpacing',
59
- 'typography.customTextDecorations': 'typography.textDecoration',
60
- 'typography.customTextTransforms': 'typography.textTransform',
61
- /*
62
- * These were part of WordPress 5.8 and we need to keep them.
63
- */
64
- 'border.customRadius': 'border.radius',
65
- 'spacing.customMargin': 'spacing.margin',
66
- 'spacing.customPadding': 'spacing.padding',
67
- 'typography.customLineHeight': 'typography.lineHeight'
68
- };
69
-
70
- /**
71
- * Remove `custom` prefixes for flags that did not land in 5.8.
72
- *
73
- * This provides continued support for `custom` prefixed properties. It will
74
- * be removed once third party devs have had sufficient time to update themes,
75
- * plugins, etc.
76
- *
77
- * @see https://github.com/WordPress/gutenberg/pull/34485
78
- *
79
- * @param {string} path Path to desired value in settings.
80
- * @return {string} The value for defined setting.
81
- */
82
- const removeCustomPrefixes = path => {
83
- return prefixedFlags[path] || path;
84
- };
85
-
86
- /**
87
- * For settings like `color.palette`, which have a value that is an object
88
- * with `default`, `theme`, `custom`, with field values that are arrays of
89
- * items, merge these three arrays into one and return it. The calculation
90
- * is memoized so that identical input values produce identical output.
91
- * @param {Object} value Object to merge
92
- * @return {Array} Array of merged items
93
- */
94
- function mergeOrigins(value) {
95
- let result = mergeCache.get(value);
96
- if (!result) {
97
- result = ['default', 'theme', 'custom'].flatMap(key => {
98
- var _value$key;
99
- return (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : [];
100
- });
101
- mergeCache.set(value, result);
102
- }
103
- return result;
104
- }
105
- const mergeCache = new WeakMap();
106
-
107
- /**
108
- * For settings like `color.palette`, which have a value that is an object
109
- * with `default`, `theme`, `custom`, with field values that are arrays of
110
- * items, see if any of the three origins have values.
111
- *
112
- * @param {Object} value Object to check
113
- * @return {boolean} Whether the object has values in any of the three origins
114
- */
115
- function hasMergedOrigins(value) {
116
- return ['default', 'theme', 'custom'].some(key => value?.[key]?.length);
117
- }
118
-
119
22
  /**
120
23
  * Hook that retrieves the given settings for the block instance in use.
121
24
  *
@@ -131,73 +34,11 @@ function hasMergedOrigins(value) {
131
34
  */
132
35
  function useSettings(...paths) {
133
36
  const {
134
- name: blockName,
135
37
  clientId = null
136
38
  } = (0, _blockEdit.useBlockEditContext)();
137
-
39
+ return (0, _data.useSelect)(select => (0, _lockUnlock.unlock)(select(_store.store)).getBlockSettings(clientId, ...paths),
138
40
  // eslint-disable-next-line react-hooks/exhaustive-deps
139
- paths = (0, _element.useMemo)(() => paths, paths);
140
- return (0, _data.useSelect)(select => {
141
- const candidates = clientId ? [clientId, ...select(_store.store).getBlockParents(clientId, /* ascending */true)].filter(candidateClientId => {
142
- const candidateBlockName = select(_store.store).getBlockName(candidateClientId);
143
- return (0, _blocks.hasBlockSupport)(candidateBlockName, '__experimentalSettings', false);
144
- }) : [];
145
- return paths.map(path => {
146
- if (blockedPaths.includes(path)) {
147
- // eslint-disable-next-line no-console
148
- console.warn('Top level useSetting paths are disabled. Please use a subpath to query the information needed.');
149
- return undefined;
150
- }
151
-
152
- // 0. Allow third parties to filter the block's settings at runtime.
153
- let result = (0, _hooks.applyFilters)('blockEditor.useSetting.before', undefined, path, clientId, blockName);
154
- if (undefined !== result) {
155
- return result;
156
- }
157
- const normalizedPath = removeCustomPrefixes(path);
158
-
159
- // 1. Take settings from the block instance or its ancestors.
160
- // Start from the current block and work our way up the ancestors.
161
- for (const candidateClientId of candidates) {
162
- var _getValueFromObjectPa;
163
- const candidateAtts = select(_store.store).getBlockAttributes(candidateClientId);
164
- result = (_getValueFromObjectPa = (0, _object.getValueFromObjectPath)(candidateAtts.settings?.blocks?.[blockName], normalizedPath)) !== null && _getValueFromObjectPa !== void 0 ? _getValueFromObjectPa : (0, _object.getValueFromObjectPath)(candidateAtts.settings, normalizedPath);
165
- if (result !== undefined) {
166
- // Stop the search for more distant ancestors and move on.
167
- break;
168
- }
169
- }
170
-
171
- // 2. Fall back to the settings from the block editor store (__experimentalFeatures).
172
- const settings = select(_store.store).getSettings();
173
- if (result === undefined && blockName) {
174
- result = (0, _object.getValueFromObjectPath)(settings.__experimentalFeatures?.blocks?.[blockName], normalizedPath);
175
- }
176
- if (result === undefined) {
177
- result = (0, _object.getValueFromObjectPath)(settings.__experimentalFeatures, normalizedPath);
178
- }
179
-
180
- // Return if the setting was found in either the block instance or the store.
181
- if (result !== undefined) {
182
- if (_blocks.__EXPERIMENTAL_PATHS_WITH_MERGE[normalizedPath]) {
183
- return mergeOrigins(result);
184
- }
185
- return result;
186
- }
187
-
188
- // 3. Otherwise, use deprecated settings.
189
- const deprecatedSettingsValue = deprecatedFlags[normalizedPath]?.(settings);
190
- if (deprecatedSettingsValue !== undefined) {
191
- return deprecatedSettingsValue;
192
- }
193
-
194
- // 4. Fallback for typography.dropCap:
195
- // This is only necessary to support typography.dropCap.
196
- // when __experimentalFeatures are not present (core without plugin).
197
- // To remove when __experimentalFeatures are ported to core.
198
- return normalizedPath === 'typography.dropCap' ? true : undefined;
199
- });
200
- }, [blockName, clientId, paths]);
41
+ [clientId, ...paths]);
201
42
  }
202
43
 
203
44
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_data","_deprecated","_interopRequireDefault","_element","_hooks","_blockEdit","_store","_object","blockedPaths","deprecatedFlags","settings","colors","gradients","disableCustomColors","undefined","disableCustomGradients","fontSizes","disableCustomFontSizes","enableCustomLineHeight","enableCustomUnits","enableCustomSpacing","prefixedFlags","removeCustomPrefixes","path","mergeOrigins","value","result","mergeCache","get","flatMap","key","_value$key","set","WeakMap","hasMergedOrigins","some","length","useSettings","paths","name","blockName","clientId","useBlockEditContext","useMemo","useSelect","select","candidates","blockEditorStore","getBlockParents","filter","candidateClientId","candidateBlockName","getBlockName","hasBlockSupport","map","includes","console","warn","applyFilters","normalizedPath","_getValueFromObjectPa","candidateAtts","getBlockAttributes","getValueFromObjectPath","blocks","getSettings","__experimentalFeatures","PATHS_WITH_MERGE","deprecatedSettingsValue","useSetting","deprecated","since","alternative","note"],"sources":["@wordpress/block-editor/src/components/use-settings/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_PATHS_WITH_MERGE as PATHS_WITH_MERGE,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { useMemo } from '@wordpress/element';\nimport { applyFilters } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\nimport { getValueFromObjectPath } from '../../utils/object';\n\nconst blockedPaths = [\n\t'color',\n\t'border',\n\t'dimensions',\n\t'typography',\n\t'spacing',\n];\n\nconst deprecatedFlags = {\n\t'color.palette': ( settings ) => settings.colors,\n\t'color.gradients': ( settings ) => settings.gradients,\n\t'color.custom': ( settings ) =>\n\t\tsettings.disableCustomColors === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomColors,\n\t'color.customGradient': ( settings ) =>\n\t\tsettings.disableCustomGradients === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomGradients,\n\t'typography.fontSizes': ( settings ) => settings.fontSizes,\n\t'typography.customFontSize': ( settings ) =>\n\t\tsettings.disableCustomFontSizes === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomFontSizes,\n\t'typography.lineHeight': ( settings ) => settings.enableCustomLineHeight,\n\t'spacing.units': ( settings ) => {\n\t\tif ( settings.enableCustomUnits === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( settings.enableCustomUnits === true ) {\n\t\t\treturn [ 'px', 'em', 'rem', 'vh', 'vw', '%' ];\n\t\t}\n\n\t\treturn settings.enableCustomUnits;\n\t},\n\t'spacing.padding': ( settings ) => settings.enableCustomSpacing,\n};\n\nconst prefixedFlags = {\n\t/*\n\t * These were only available in the plugin\n\t * and can be removed when the minimum WordPress version\n\t * for the plugin is 5.9.\n\t */\n\t'border.customColor': 'border.color',\n\t'border.customStyle': 'border.style',\n\t'border.customWidth': 'border.width',\n\t'typography.customFontStyle': 'typography.fontStyle',\n\t'typography.customFontWeight': 'typography.fontWeight',\n\t'typography.customLetterSpacing': 'typography.letterSpacing',\n\t'typography.customTextDecorations': 'typography.textDecoration',\n\t'typography.customTextTransforms': 'typography.textTransform',\n\t/*\n\t * These were part of WordPress 5.8 and we need to keep them.\n\t */\n\t'border.customRadius': 'border.radius',\n\t'spacing.customMargin': 'spacing.margin',\n\t'spacing.customPadding': 'spacing.padding',\n\t'typography.customLineHeight': 'typography.lineHeight',\n};\n\n/**\n * Remove `custom` prefixes for flags that did not land in 5.8.\n *\n * This provides continued support for `custom` prefixed properties. It will\n * be removed once third party devs have had sufficient time to update themes,\n * plugins, etc.\n *\n * @see https://github.com/WordPress/gutenberg/pull/34485\n *\n * @param {string} path Path to desired value in settings.\n * @return {string} The value for defined setting.\n */\nconst removeCustomPrefixes = ( path ) => {\n\treturn prefixedFlags[ path ] || path;\n};\n\n/**\n * For settings like `color.palette`, which have a value that is an object\n * with `default`, `theme`, `custom`, with field values that are arrays of\n * items, merge these three arrays into one and return it. The calculation\n * is memoized so that identical input values produce identical output.\n * @param {Object} value Object to merge\n * @return {Array} Array of merged items\n */\nexport function mergeOrigins( value ) {\n\tlet result = mergeCache.get( value );\n\tif ( ! result ) {\n\t\tresult = [ 'default', 'theme', 'custom' ].flatMap(\n\t\t\t( key ) => value[ key ] ?? []\n\t\t);\n\t\tmergeCache.set( value, result );\n\t}\n\treturn result;\n}\nconst mergeCache = new WeakMap();\n\n/**\n * For settings like `color.palette`, which have a value that is an object\n * with `default`, `theme`, `custom`, with field values that are arrays of\n * items, see if any of the three origins have values.\n *\n * @param {Object} value Object to check\n * @return {boolean} Whether the object has values in any of the three origins\n */\nexport function hasMergedOrigins( value ) {\n\treturn [ 'default', 'theme', 'custom' ].some(\n\t\t( key ) => value?.[ key ]?.length\n\t);\n}\n\n/**\n * Hook that retrieves the given settings for the block instance in use.\n *\n * It looks up the settings first in the block instance hierarchy.\n * If none are found, it'll look them up in the block editor settings.\n *\n * @param {string[]} paths The paths to the settings.\n * @return {any[]} Returns the values defined for the settings.\n * @example\n * ```js\n * const [ fixed, sticky ] = useSettings( 'position.fixed', 'position.sticky' );\n * ```\n */\nexport function useSettings( ...paths ) {\n\tconst { name: blockName, clientId = null } = useBlockEditContext();\n\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tpaths = useMemo( () => paths, paths );\n\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst candidates = clientId\n\t\t\t\t? [\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t...select( blockEditorStore ).getBlockParents(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t/* ascending */ true\n\t\t\t\t\t\t),\n\t\t\t\t ].filter( ( candidateClientId ) => {\n\t\t\t\t\t\tconst candidateBlockName =\n\t\t\t\t\t\t\tselect( blockEditorStore ).getBlockName(\n\t\t\t\t\t\t\t\tcandidateClientId\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\treturn hasBlockSupport(\n\t\t\t\t\t\t\tcandidateBlockName,\n\t\t\t\t\t\t\t'__experimentalSettings',\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t);\n\t\t\t\t } )\n\t\t\t\t: [];\n\n\t\t\treturn paths.map( ( path ) => {\n\t\t\t\tif ( blockedPaths.includes( path ) ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t'Top level useSetting paths are disabled. Please use a subpath to query the information needed.'\n\t\t\t\t\t);\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\t// 0. Allow third parties to filter the block's settings at runtime.\n\t\t\t\tlet result = applyFilters(\n\t\t\t\t\t'blockEditor.useSetting.before',\n\t\t\t\t\tundefined,\n\t\t\t\t\tpath,\n\t\t\t\t\tclientId,\n\t\t\t\t\tblockName\n\t\t\t\t);\n\n\t\t\t\tif ( undefined !== result ) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tconst normalizedPath = removeCustomPrefixes( path );\n\n\t\t\t\t// 1. Take settings from the block instance or its ancestors.\n\t\t\t\t// Start from the current block and work our way up the ancestors.\n\t\t\t\tfor ( const candidateClientId of candidates ) {\n\t\t\t\t\tconst candidateAtts =\n\t\t\t\t\t\tselect( blockEditorStore ).getBlockAttributes(\n\t\t\t\t\t\t\tcandidateClientId\n\t\t\t\t\t\t);\n\t\t\t\t\tresult =\n\t\t\t\t\t\tgetValueFromObjectPath(\n\t\t\t\t\t\t\tcandidateAtts.settings?.blocks?.[ blockName ],\n\t\t\t\t\t\t\tnormalizedPath\n\t\t\t\t\t\t) ??\n\t\t\t\t\t\tgetValueFromObjectPath(\n\t\t\t\t\t\t\tcandidateAtts.settings,\n\t\t\t\t\t\t\tnormalizedPath\n\t\t\t\t\t\t);\n\t\t\t\t\tif ( result !== undefined ) {\n\t\t\t\t\t\t// Stop the search for more distant ancestors and move on.\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// 2. Fall back to the settings from the block editor store (__experimentalFeatures).\n\t\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\t\t\tif ( result === undefined && blockName ) {\n\t\t\t\t\tresult = getValueFromObjectPath(\n\t\t\t\t\t\tsettings.__experimentalFeatures?.blocks?.[ blockName ],\n\t\t\t\t\t\tnormalizedPath\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif ( result === undefined ) {\n\t\t\t\t\tresult = getValueFromObjectPath(\n\t\t\t\t\t\tsettings.__experimentalFeatures,\n\t\t\t\t\t\tnormalizedPath\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Return if the setting was found in either the block instance or the store.\n\t\t\t\tif ( result !== undefined ) {\n\t\t\t\t\tif ( PATHS_WITH_MERGE[ normalizedPath ] ) {\n\t\t\t\t\t\treturn mergeOrigins( result );\n\t\t\t\t\t}\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\t// 3. Otherwise, use deprecated settings.\n\t\t\t\tconst deprecatedSettingsValue =\n\t\t\t\t\tdeprecatedFlags[ normalizedPath ]?.( settings );\n\t\t\t\tif ( deprecatedSettingsValue !== undefined ) {\n\t\t\t\t\treturn deprecatedSettingsValue;\n\t\t\t\t}\n\n\t\t\t\t// 4. Fallback for typography.dropCap:\n\t\t\t\t// This is only necessary to support typography.dropCap.\n\t\t\t\t// when __experimentalFeatures are not present (core without plugin).\n\t\t\t\t// To remove when __experimentalFeatures are ported to core.\n\t\t\t\treturn normalizedPath === 'typography.dropCap'\n\t\t\t\t\t? true\n\t\t\t\t\t: undefined;\n\t\t\t} );\n\t\t},\n\t\t[ blockName, clientId, paths ]\n\t);\n}\n\n/**\n * Hook that retrieves the given setting for the block instance in use.\n *\n * It looks up the setting first in the block instance hierarchy.\n * If none is found, it'll look it up in the block editor settings.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @deprecated 6.5.0 Use useSettings instead.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport function useSetting( path ) {\n\tdeprecated( 'wp.blockEditor.useSetting', {\n\t\tsince: '6.5',\n\t\talternative: 'wp.blockEditor.useSettings',\n\t\tnote: 'The new useSettings function can retrieve multiple settings at once, with better performance.',\n\t} );\n\n\tconst [ value ] = useSettings( path );\n\treturn value;\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAjBA;AACA;AACA;;AAUA;AACA;AACA;;AAKA,MAAMS,YAAY,GAAG,CACpB,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,SAAS,CACT;AAED,MAAMC,eAAe,GAAG;EACvB,eAAe,EAAIC,QAAQ,IAAMA,QAAQ,CAACC,MAAM;EAChD,iBAAiB,EAAID,QAAQ,IAAMA,QAAQ,CAACE,SAAS;EACrD,cAAc,EAAIF,QAAQ,IACzBA,QAAQ,CAACG,mBAAmB,KAAKC,SAAS,GACvCA,SAAS,GACT,CAAEJ,QAAQ,CAACG,mBAAmB;EAClC,sBAAsB,EAAIH,QAAQ,IACjCA,QAAQ,CAACK,sBAAsB,KAAKD,SAAS,GAC1CA,SAAS,GACT,CAAEJ,QAAQ,CAACK,sBAAsB;EACrC,sBAAsB,EAAIL,QAAQ,IAAMA,QAAQ,CAACM,SAAS;EAC1D,2BAA2B,EAAIN,QAAQ,IACtCA,QAAQ,CAACO,sBAAsB,KAAKH,SAAS,GAC1CA,SAAS,GACT,CAAEJ,QAAQ,CAACO,sBAAsB;EACrC,uBAAuB,EAAIP,QAAQ,IAAMA,QAAQ,CAACQ,sBAAsB;EACxE,eAAe,EAAIR,QAAQ,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3B,IAAKqD,uCAAgB,CAAER,cAAc,CAAE,EAAG;UACzC,OAAOnC,YAAY,CAAEE,MAAO,CAAC;QAC9B;QACA,OAAOA,MAAM;MACd;;MAEA;MACA,MAAM0C,uBAAuB,GAC5B3D,eAAe,CAAEkD,cAAc,CAAE,GAAIjD,QAAS,CAAC;MAChD,IAAK0D,uBAAuB,KAAKtD,SAAS,EAAG;QAC5C,OAAOsD,uBAAuB;MAC/B;;MAEA;MACA;MACA;MACA;MACA,OAAOT,cAAc,KAAK,oBAAoB,GAC3C,IAAI,GACJ7C,SAAS;IACb,CAAE,CAAC;EACJ,CAAC,EACD,CAAE0B,SAAS,EAAEC,QAAQ,EAAEH,KAAK,CAC7B,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS+B,UAAUA,CAAE9C,IAAI,EAAG;EAClC,IAAA+C,mBAAU,EAAE,2BAA2B,EAAE;IACxCC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE,4BAA4B;IACzCC,IAAI,EAAE;EACP,CAAE,CAAC;EAEH,MAAM,CAAEhD,KAAK,CAAE,GAAGY,WAAW,CAAEd,IAAK,CAAC;EACrC,OAAOE,KAAK;AACb"}
1
+ {"version":3,"names":["_data","require","_deprecated","_interopRequireDefault","_blockEdit","_store","_lockUnlock","useSettings","paths","clientId","useBlockEditContext","useSelect","select","unlock","blockEditorStore","getBlockSettings","useSetting","path","deprecated","since","alternative","note","value"],"sources":["@wordpress/block-editor/src/components/use-settings/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Hook that retrieves the given settings for the block instance in use.\n *\n * It looks up the settings first in the block instance hierarchy.\n * If none are found, it'll look them up in the block editor settings.\n *\n * @param {string[]} paths The paths to the settings.\n * @return {any[]} Returns the values defined for the settings.\n * @example\n * ```js\n * const [ fixed, sticky ] = useSettings( 'position.fixed', 'position.sticky' );\n * ```\n */\nexport function useSettings( ...paths ) {\n\tconst { clientId = null } = useBlockEditContext();\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getBlockSettings(\n\t\t\t\tclientId,\n\t\t\t\t...paths\n\t\t\t),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ clientId, ...paths ]\n\t);\n}\n\n/**\n * Hook that retrieves the given setting for the block instance in use.\n *\n * It looks up the setting first in the block instance hierarchy.\n * If none is found, it'll look it up in the block editor settings.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @deprecated 6.5.0 Use useSettings instead.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport function useSetting( path ) {\n\tdeprecated( 'wp.blockEditor.useSetting', {\n\t\tsince: '6.5',\n\t\talternative: 'wp.blockEditor.useSettings',\n\t\tnote: 'The new useSettings function can retrieve multiple settings at once, with better performance.',\n\t} );\n\n\tconst [ value ] = useSettings( path );\n\treturn value;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,WAAWA,CAAE,GAAGC,KAAK,EAAG;EACvC,MAAM;IAAEC,QAAQ,GAAG;EAAK,CAAC,GAAG,IAAAC,8BAAmB,EAAC,CAAC;EACjD,OAAO,IAAAC,eAAS,EACbC,MAAM,IACP,IAAAC,kBAAM,EAAED,MAAM,CAAEE,YAAiB,CAAE,CAAC,CAACC,gBAAgB,CACpDN,QAAQ,EACR,GAAGD,KACJ,CAAC;EACF;EACA,CAAEC,QAAQ,EAAE,GAAGD,KAAK,CACrB,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,UAAUA,CAAEC,IAAI,EAAG;EAClC,IAAAC,mBAAU,EAAE,2BAA2B,EAAE;IACxCC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE,4BAA4B;IACzCC,IAAI,EAAE;EACP,CAAE,CAAC;EAEH,MAAM,CAAEC,KAAK,CAAE,GAAGf,WAAW,CAAEU,IAAK,CAAC;EACrC,OAAOK,KAAK;AACb"}
@@ -9,12 +9,11 @@ var _components = require("@wordpress/components");
9
9
  /**
10
10
  * WordPress dependencies
11
11
  */
12
- var _default = (0, _react.createElement)(_components.SVG, {
12
+ var _default = exports.default = (0, _react.createElement)(_components.SVG, {
13
13
  viewBox: "0 0 24 24",
14
14
  xmlns: "http://www.w3.org/2000/svg"
15
15
  }, (0, _react.createElement)(_components.Path, {
16
16
  d: "M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm-2 14.5v-9l6 4.5z",
17
17
  fill: "white"
18
18
  }));
19
- exports.default = _default;
20
19
  //# sourceMappingURL=gridicon-play.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_default","_react","createElement","SVG","viewBox","xmlns","Path","d","fill","exports","default"],"sources":["@wordpress/block-editor/src/components/video-player/gridicon-play.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Path, SVG } from '@wordpress/components';\n\nexport default (\n\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Path\n\t\t\td=\"M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm-2 14.5v-9l6 4.5z\"\n\t\t\tfill=\"white\"\n\t\t/>\n\t</SVG>\n);\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAHA;AACA;AACA;AAFA,IAAAC,QAAA,GAMC,IAAAC,MAAA,CAAAC,aAAA,EAACJ,WAAA,CAAAK,GAAG;EAACC,OAAO,EAAC,WAAW;EAACC,KAAK,EAAC;AAA4B,GAC1D,IAAAJ,MAAA,CAAAC,aAAA,EAACJ,WAAA,CAAAQ,IAAI;EACJC,CAAC,EAAC,6DAA6D;EAC/DC,IAAI,EAAC;AAAO,CACZ,CACG,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAV,QAAA"}
1
+ {"version":3,"names":["_components","require","_default","exports","default","_react","createElement","SVG","viewBox","xmlns","Path","d","fill"],"sources":["@wordpress/block-editor/src/components/video-player/gridicon-play.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Path, SVG } from '@wordpress/components';\n\nexport default (\n\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Path\n\t\t\td=\"M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm-2 14.5v-9l6 4.5z\"\n\t\t\tfill=\"white\"\n\t\t/>\n\t</SVG>\n);\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAHA;AACA;AACA;AAFA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAMC,IAAAC,MAAA,CAAAC,aAAA,EAACN,WAAA,CAAAO,GAAG;EAACC,OAAO,EAAC,WAAW;EAACC,KAAK,EAAC;AAA4B,GAC1D,IAAAJ,MAAA,CAAAC,aAAA,EAACN,WAAA,CAAAU,IAAI;EACJC,CAAC,EAAC,6DAA6D;EAC/DC,IAAI,EAAC;AAAO,CACZ,CACG,CAAC"}
@@ -26,8 +26,7 @@ var _gridiconPlay = _interopRequireDefault(require("./gridicon-play"));
26
26
  */
27
27
 
28
28
  // Default Video ratio 16:9
29
- const VIDEO_ASPECT_RATIO = 16 / 9;
30
- exports.VIDEO_ASPECT_RATIO = VIDEO_ASPECT_RATIO;
29
+ const VIDEO_ASPECT_RATIO = exports.VIDEO_ASPECT_RATIO = 16 / 9;
31
30
  class Video extends _element.Component {
32
31
  constructor() {
33
32
  super(...arguments);
@@ -129,6 +128,5 @@ class Video extends _element.Component {
129
128
  })));
130
129
  }
131
130
  }
132
- var _default = Video;
133
- exports.default = _default;
131
+ var _default = exports.default = Video;
134
132
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_components","_i18n","_reactNative","_reactNativeVideo","_interopRequireDefault","_styles","_gridiconPlay","VIDEO_ASPECT_RATIO","exports","Video","Component","constructor","arguments","isIOS","Platform","OS","state","isFullScreen","videoContainerHeight","onPressPlay","bind","onVideoLayout","event","height","nativeEvent","layout","setState","player","presentFullscreenPlayer","source","props","uri","openURL","url","Linking","canOpenURL","then","supported","Alert","alert","__","window","console","warn","catch","err","error","render","isSelected","style","showPlayButton","_react","createElement","View","styles","videoContainer","default","ref","controls","ignoreSilentSwitch","paused","onLayout","onFullscreenPlayerWillPresent","onFullscreenPlayerDidDismiss","TouchableOpacity","disabled","onPress","overlayContainer","blackOverlay","Icon","icon","PlayIcon","playIcon","size","_default"],"sources":["@wordpress/block-editor/src/components/video-player/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { Icon } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * External dependencies\n */\nimport { View, TouchableOpacity, Platform, Linking, Alert } from 'react-native';\nimport { default as VideoPlayer } from 'react-native-video';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\nimport PlayIcon from './gridicon-play';\n\n// Default Video ratio 16:9\nexport const VIDEO_ASPECT_RATIO = 16 / 9;\n\nclass Video extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.isIOS = Platform.OS === 'ios';\n\t\tthis.state = {\n\t\t\tisFullScreen: false,\n\t\t\tvideoContainerHeight: 0,\n\t\t};\n\t\tthis.onPressPlay = this.onPressPlay.bind( this );\n\t\tthis.onVideoLayout = this.onVideoLayout.bind( this );\n\t}\n\n\tonVideoLayout( event ) {\n\t\tconst { height } = event.nativeEvent.layout;\n\t\tif ( height !== this.state.videoContainerHeight ) {\n\t\t\tthis.setState( { videoContainerHeight: height } );\n\t\t}\n\t}\n\n\tonPressPlay() {\n\t\tif ( this.isIOS ) {\n\t\t\tif ( this.player ) {\n\t\t\t\tthis.player.presentFullscreenPlayer();\n\t\t\t}\n\t\t} else {\n\t\t\tconst { source } = this.props;\n\t\t\tif ( source && source.uri ) {\n\t\t\t\tthis.openURL( source.uri );\n\t\t\t}\n\t\t}\n\t}\n\n\t// Tries opening the URL outside of the app\n\topenURL( url ) {\n\t\tLinking.canOpenURL( url )\n\t\t\t.then( ( supported ) => {\n\t\t\t\tif ( ! supported ) {\n\t\t\t\t\tAlert.alert(\n\t\t\t\t\t\t__( 'Problem opening the video' ),\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'No application can handle this request. Please install a Web browser.'\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\twindow.console.warn(\n\t\t\t\t\t\t'No application found that can open the video with URL: ' +\n\t\t\t\t\t\t\turl\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\treturn Linking.openURL( url );\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( ( err ) => {\n\t\t\t\tAlert.alert(\n\t\t\t\t\t__( 'Problem opening the video' ),\n\t\t\t\t\t__( 'An unknown error occurred. Please try again.' )\n\t\t\t\t);\n\t\t\t\twindow.console.error(\n\t\t\t\t\t'An error occurred while opening the video URL: ' + url,\n\t\t\t\t\terr\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\trender() {\n\t\tconst { isSelected, style } = this.props;\n\t\tconst { isFullScreen, videoContainerHeight } = this.state;\n\t\tconst showPlayButton = videoContainerHeight > 0;\n\n\t\treturn (\n\t\t\t<View style={ styles.videoContainer }>\n\t\t\t\t<VideoPlayer\n\t\t\t\t\t{ ...this.props }\n\t\t\t\t\tref={ ( ref ) => {\n\t\t\t\t\t\tthis.player = ref;\n\t\t\t\t\t} }\n\t\t\t\t\t// Using built-in player controls is messing up the layout on iOS.\n\t\t\t\t\t// So we are setting controls=false and adding a play button that\n\t\t\t\t\t// will trigger presentFullscreenPlayer()\n\t\t\t\t\tcontrols={ false }\n\t\t\t\t\tignoreSilentSwitch={ 'ignore' }\n\t\t\t\t\tpaused={ ! isFullScreen }\n\t\t\t\t\tonLayout={ this.onVideoLayout }\n\t\t\t\t\tonFullscreenPlayerWillPresent={ () => {\n\t\t\t\t\t\tthis.setState( { isFullScreen: true } );\n\t\t\t\t\t} }\n\t\t\t\t\tonFullscreenPlayerDidDismiss={ () => {\n\t\t\t\t\t\tthis.setState( { isFullScreen: false } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t{ showPlayButton && (\n\t\t\t\t\t// If we add the play icon as a subview to VideoPlayer then react-native-video decides to show control buttons\n\t\t\t\t\t// even if we set controls={ false }, so we are adding our play button as a sibling overlay view.\n\t\t\t\t\t<TouchableOpacity\n\t\t\t\t\t\tdisabled={ ! isSelected }\n\t\t\t\t\t\tonPress={ this.onPressPlay }\n\t\t\t\t\t\tstyle={ [ style, styles.overlayContainer ] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<View style={ styles.blackOverlay } />\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\ticon={ PlayIcon }\n\t\t\t\t\t\t\tstyle={ styles.playIcon }\n\t\t\t\t\t\t\tsize={ styles.playIcon.size }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TouchableOpacity>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nexport default Video;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAA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GAAG;MAClB;MACA;MACA;MACA;MAAA;MACAC,QAAQ,EAAG,KAAO;MAClBC,kBAAkB,EAAG,QAAU;MAC/BC,MAAM,EAAG,CAAE3C,YAAc;MACzB4C,QAAQ,EAAG,IAAI,CAACxC,aAAe;MAC/ByC,6BAA6B,EAAGA,CAAA,KAAM;QACrC,IAAI,CAACpC,QAAQ,CAAE;UAAET,YAAY,EAAE;QAAK,CAAE,CAAC;MACxC,CAAG;MACH8C,4BAA4B,EAAGA,CAAA,KAAM;QACpC,IAAI,CAACrC,QAAQ,CAAE;UAAET,YAAY,EAAE;QAAM,CAAE,CAAC;MACzC;IAAG,CACH,CAAC,EACAiC,cAAc;IACf;IACA;IACA,IAAAC,MAAA,CAAAC,aAAA,EAAClD,YAAA,CAAA8D,gBAAgB;MAChBC,QAAQ,EAAG,CAAEjB,UAAY;MACzBkB,OAAO,EAAG,IAAI,CAAC/C,WAAa;MAC5B8B,KAAK,EAAG,CAAEA,KAAK,EAAEK,eAAM,CAACa,gBAAgB;IAAI,GAE5C,IAAAhB,MAAA,CAAAC,aAAA,EAAClD,YAAA,CAAAmD,IAAI;MAACJ,KAAK,EAAGK,eAAM,CAACc;IAAc,CAAE,CAAC,EACtC,IAAAjB,MAAA,CAAAC,aAAA,EAACpD,WAAA,CAAAqE,IAAI;MACJC,IAAI,EAAGC,qBAAU;MACjBtB,KAAK,EAAGK,eAAM,CAACkB,QAAU;MACzBC,IAAI,EAAGnB,eAAM,CAACkB,QAAQ,CAACC;IAAM,CAC7B,CACgB,CAEd,CAAC;EAET;AACD;AAAC,IAAAC,QAAA,GAEcjE,KAAK;AAAAD,OAAA,CAAAgD,OAAA,GAAAkB,QAAA"}
1
+ {"version":3,"names":["_element","require","_components","_i18n","_reactNative","_reactNativeVideo","_interopRequireDefault","_styles","_gridiconPlay","VIDEO_ASPECT_RATIO","exports","Video","Component","constructor","arguments","isIOS","Platform","OS","state","isFullScreen","videoContainerHeight","onPressPlay","bind","onVideoLayout","event","height","nativeEvent","layout","setState","player","presentFullscreenPlayer","source","props","uri","openURL","url","Linking","canOpenURL","then","supported","Alert","alert","__","window","console","warn","catch","err","error","render","isSelected","style","showPlayButton","_react","createElement","View","styles","videoContainer","default","ref","controls","ignoreSilentSwitch","paused","onLayout","onFullscreenPlayerWillPresent","onFullscreenPlayerDidDismiss","TouchableOpacity","disabled","onPress","overlayContainer","blackOverlay","Icon","icon","PlayIcon","playIcon","size","_default"],"sources":["@wordpress/block-editor/src/components/video-player/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { Icon } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * External dependencies\n */\nimport { View, TouchableOpacity, Platform, Linking, Alert } from 'react-native';\nimport { default as VideoPlayer } from 'react-native-video';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\nimport PlayIcon from './gridicon-play';\n\n// Default Video ratio 16:9\nexport const VIDEO_ASPECT_RATIO = 16 / 9;\n\nclass Video extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.isIOS = Platform.OS === 'ios';\n\t\tthis.state = {\n\t\t\tisFullScreen: false,\n\t\t\tvideoContainerHeight: 0,\n\t\t};\n\t\tthis.onPressPlay = this.onPressPlay.bind( this );\n\t\tthis.onVideoLayout = this.onVideoLayout.bind( this );\n\t}\n\n\tonVideoLayout( event ) {\n\t\tconst { height } = event.nativeEvent.layout;\n\t\tif ( height !== this.state.videoContainerHeight ) {\n\t\t\tthis.setState( { videoContainerHeight: height } );\n\t\t}\n\t}\n\n\tonPressPlay() {\n\t\tif ( this.isIOS ) {\n\t\t\tif ( this.player ) {\n\t\t\t\tthis.player.presentFullscreenPlayer();\n\t\t\t}\n\t\t} else {\n\t\t\tconst { source } = this.props;\n\t\t\tif ( source && source.uri ) {\n\t\t\t\tthis.openURL( source.uri );\n\t\t\t}\n\t\t}\n\t}\n\n\t// Tries opening the URL outside of the app\n\topenURL( url ) {\n\t\tLinking.canOpenURL( url )\n\t\t\t.then( ( supported ) => {\n\t\t\t\tif ( ! supported ) {\n\t\t\t\t\tAlert.alert(\n\t\t\t\t\t\t__( 'Problem opening the video' ),\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'No application can handle this request. Please install a Web browser.'\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\twindow.console.warn(\n\t\t\t\t\t\t'No application found that can open the video with URL: ' +\n\t\t\t\t\t\t\turl\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\treturn Linking.openURL( url );\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( ( err ) => {\n\t\t\t\tAlert.alert(\n\t\t\t\t\t__( 'Problem opening the video' ),\n\t\t\t\t\t__( 'An unknown error occurred. Please try again.' )\n\t\t\t\t);\n\t\t\t\twindow.console.error(\n\t\t\t\t\t'An error occurred while opening the video URL: ' + url,\n\t\t\t\t\terr\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\trender() {\n\t\tconst { isSelected, style } = this.props;\n\t\tconst { isFullScreen, videoContainerHeight } = this.state;\n\t\tconst showPlayButton = videoContainerHeight > 0;\n\n\t\treturn (\n\t\t\t<View style={ styles.videoContainer }>\n\t\t\t\t<VideoPlayer\n\t\t\t\t\t{ ...this.props }\n\t\t\t\t\tref={ ( ref ) => {\n\t\t\t\t\t\tthis.player = ref;\n\t\t\t\t\t} }\n\t\t\t\t\t// Using built-in player controls is messing up the layout on iOS.\n\t\t\t\t\t// So we are setting controls=false and adding a play button that\n\t\t\t\t\t// will trigger presentFullscreenPlayer()\n\t\t\t\t\tcontrols={ false }\n\t\t\t\t\tignoreSilentSwitch={ 'ignore' }\n\t\t\t\t\tpaused={ ! isFullScreen }\n\t\t\t\t\tonLayout={ this.onVideoLayout }\n\t\t\t\t\tonFullscreenPlayerWillPresent={ () => {\n\t\t\t\t\t\tthis.setState( { isFullScreen: true } );\n\t\t\t\t\t} }\n\t\t\t\t\tonFullscreenPlayerDidDismiss={ () => {\n\t\t\t\t\t\tthis.setState( { isFullScreen: false } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t{ showPlayButton && (\n\t\t\t\t\t// If we add the play icon as a subview to VideoPlayer then react-native-video decides to show control buttons\n\t\t\t\t\t// even if we set controls={ false }, so we are adding our play button as a sibling overlay view.\n\t\t\t\t\t<TouchableOpacity\n\t\t\t\t\t\tdisabled={ ! isSelected }\n\t\t\t\t\t\tonPress={ this.onPressPlay }\n\t\t\t\t\t\tstyle={ [ style, styles.overlayContainer ] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<View style={ styles.blackOverlay } />\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\ticon={ PlayIcon }\n\t\t\t\t\t\t\tstyle={ styles.playIcon }\n\t\t\t\t\t\t\tsize={ styles.playIcon.size }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TouchableOpacity>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nexport default Video;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAKA,IAAAM,OAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,aAAA,GAAAF,sBAAA,CAAAL,OAAA;AAjBA;AACA;AACA;;AAKA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACO,MAAMQ,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,EAAE,GAAG,CAAC;AAExC,MAAME,KAAK,SAASC,kBAAS,CAAC;EAC7BC,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IACrB,IAAI,CAACC,KAAK,GAAGC,qBAAQ,CAACC,EAAE,KAAK,KAAK;IAClC,IAAI,CAACC,KAAK,GAAG;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,EAAG,CAAEjB,UAAY;MACzBkB,OAAO,EAAG,IAAI,CAAC/C,WAAa;MAC5B8B,KAAK,EAAG,CAAEA,KAAK,EAAEK,eAAM,CAACa,gBAAgB;IAAI,GAE5C,IAAAhB,MAAA,CAAAC,aAAA,EAAClD,YAAA,CAAAmD,IAAI;MAACJ,KAAK,EAAGK,eAAM,CAACc;IAAc,CAAE,CAAC,EACtC,IAAAjB,MAAA,CAAAC,aAAA,EAACpD,WAAA,CAAAqE,IAAI;MACJC,IAAI,EAAGC,qBAAU;MACjBtB,KAAK,EAAGK,eAAM,CAACkB,QAAU;MACzBC,IAAI,EAAGnB,eAAM,CAACkB,QAAQ,CAACC;IAAM,CAC7B,CACgB,CAEd,CAAC;EAET;AACD;AAAC,IAAAC,QAAA,GAAAlE,OAAA,CAAAgD,OAAA,GAEc/C,KAAK"}
@@ -59,6 +59,5 @@ function Warning({
59
59
  /**
60
60
  * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/warning/README.md
61
61
  */
62
- var _default = Warning;
63
- exports.default = _default;
62
+ var _default = exports.default = Warning;
64
63
  //# sourceMappingURL=index.js.map