@wordpress/block-editor 13.4.0 → 14.0.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 (331) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +11 -1
  3. package/build/components/block-breadcrumb/index.js +3 -1
  4. package/build/components/block-breadcrumb/index.js.map +1 -1
  5. package/build/components/block-draggable/index.js +2 -2
  6. package/build/components/block-draggable/index.js.map +1 -1
  7. package/build/components/block-list/use-block-props/use-block-refs.js +24 -32
  8. package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
  9. package/build/components/block-mover/index.js +1 -2
  10. package/build/components/block-mover/index.js.map +1 -1
  11. package/build/components/block-popover/cover.js +1 -1
  12. package/build/components/block-popover/cover.js.map +1 -1
  13. package/build/components/block-popover/inbetween.js +2 -2
  14. package/build/components/block-popover/inbetween.js.map +1 -1
  15. package/build/components/block-popover/index.js +2 -2
  16. package/build/components/block-popover/index.js.map +1 -1
  17. package/build/components/block-tools/block-selection-button.js +1 -2
  18. package/build/components/block-tools/block-selection-button.js.map +1 -1
  19. package/build/components/block-tools/index.js +1 -1
  20. package/build/components/block-tools/index.js.map +1 -1
  21. package/build/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  22. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  23. package/build/components/block-tools/zoom-out-mode-inserters.js +15 -16
  24. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  25. package/build/components/block-tools/zoom-out-toolbar.js +0 -1
  26. package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
  27. package/build/components/child-layout-control/index.js +3 -1
  28. package/build/components/child-layout-control/index.js.map +1 -1
  29. package/build/components/dimensions-tool/scale-tool.js +1 -0
  30. package/build/components/dimensions-tool/scale-tool.js.map +1 -1
  31. package/build/components/font-family/index.js +12 -0
  32. package/build/components/font-family/index.js.map +1 -1
  33. package/build/components/global-styles/background-panel.js +55 -51
  34. package/build/components/global-styles/background-panel.js.map +1 -1
  35. package/build/components/global-styles/image-settings-panel.js +1 -0
  36. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  37. package/build/components/global-styles/theme-file-uri-utils.js +0 -59
  38. package/build/components/global-styles/theme-file-uri-utils.js.map +1 -1
  39. package/build/components/global-styles/typography-panel.js +0 -1
  40. package/build/components/global-styles/typography-panel.js.map +1 -1
  41. package/build/components/global-styles/use-global-styles-output.js +58 -39
  42. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  43. package/build/components/global-styles/utils.js +96 -0
  44. package/build/components/global-styles/utils.js.map +1 -1
  45. package/build/components/grid/grid-item-movers.js +30 -26
  46. package/build/components/grid/grid-item-movers.js.map +1 -1
  47. package/build/components/grid/grid-item-resizer.js +14 -15
  48. package/build/components/grid/grid-item-resizer.js.map +1 -1
  49. package/build/components/grid/grid-visualizer.js +1 -1
  50. package/build/components/grid/grid-visualizer.js.map +1 -1
  51. package/build/components/grid/use-grid-layout-sync.js +56 -20
  52. package/build/components/grid/use-grid-layout-sync.js.map +1 -1
  53. package/build/components/iframe/index.js +4 -8
  54. package/build/components/iframe/index.js.map +1 -1
  55. package/build/components/inserter/category-tabs/index.js +29 -2
  56. package/build/components/inserter/category-tabs/index.js.map +1 -1
  57. package/build/components/inserter/menu.js +2 -2
  58. package/build/components/inserter/menu.js.map +1 -1
  59. package/build/components/line-height-control/index.js +0 -15
  60. package/build/components/line-height-control/index.js.map +1 -1
  61. package/build/components/link-control/search-input.js +0 -1
  62. package/build/components/link-control/search-input.js.map +1 -1
  63. package/build/components/media-replace-flow/index.js +3 -1
  64. package/build/components/media-replace-flow/index.js.map +1 -1
  65. package/build/components/resolution-tool/index.js +1 -0
  66. package/build/components/resolution-tool/index.js.map +1 -1
  67. package/build/components/skip-to-selected-block/index.js +4 -2
  68. package/build/components/skip-to-selected-block/index.js.map +1 -1
  69. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -6
  70. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  71. package/build/components/url-input/button.js +0 -1
  72. package/build/components/url-input/button.js.map +1 -1
  73. package/build/components/url-input/index.js +1 -11
  74. package/build/components/url-input/index.js.map +1 -1
  75. package/build/components/url-popover/link-editor.js +0 -1
  76. package/build/components/url-popover/link-editor.js.map +1 -1
  77. package/build/components/use-block-drop-zone/index.js +30 -4
  78. package/build/components/use-block-drop-zone/index.js.map +1 -1
  79. package/build/components/use-on-block-drop/index.js +3 -6
  80. package/build/components/use-on-block-drop/index.js.map +1 -1
  81. package/build/components/use-resize-canvas/index.js +1 -3
  82. package/build/components/use-resize-canvas/index.js.map +1 -1
  83. package/build/components/use-settings/index.js +2 -1
  84. package/build/components/use-settings/index.js.map +1 -1
  85. package/build/hooks/block-bindings.js +248 -36
  86. package/build/hooks/block-bindings.js.map +1 -1
  87. package/build/hooks/block-hooks.js +1 -0
  88. package/build/hooks/block-hooks.js.map +1 -1
  89. package/build/hooks/block-style-variation.js +2 -2
  90. package/build/hooks/block-style-variation.js.map +1 -1
  91. package/build/hooks/contrast-checker.js +6 -6
  92. package/build/hooks/contrast-checker.js.map +1 -1
  93. package/build/hooks/duotone.js +3 -3
  94. package/build/hooks/duotone.js.map +1 -1
  95. package/build/hooks/index.js +7 -1
  96. package/build/hooks/index.js.map +1 -1
  97. package/build/hooks/line-height.js +0 -1
  98. package/build/hooks/line-height.js.map +1 -1
  99. package/build/hooks/spacing-visualizer.js +1 -1
  100. package/build/hooks/spacing-visualizer.js.map +1 -1
  101. package/build/hooks/use-bindings-attributes.js +4 -0
  102. package/build/hooks/use-bindings-attributes.js.map +1 -1
  103. package/build/hooks/use-zoom-out.js +1 -1
  104. package/build/hooks/use-zoom-out.js.map +1 -1
  105. package/build/hooks/utils.js +20 -0
  106. package/build/hooks/utils.js.map +1 -1
  107. package/build/index.js +7 -0
  108. package/build/index.js.map +1 -1
  109. package/build/private-apis.js +0 -1
  110. package/build/private-apis.js.map +1 -1
  111. package/build/store/actions.js +9 -1
  112. package/build/store/actions.js.map +1 -1
  113. package/build/store/selectors.js +4 -4
  114. package/build/store/selectors.js.map +1 -1
  115. package/build/utils/get-editor-region.js +1 -1
  116. package/build/utils/get-editor-region.js.map +1 -1
  117. package/build/utils/get-px-from-css-unit.js +1 -1
  118. package/build/utils/get-px-from-css-unit.js.map +1 -1
  119. package/build-module/components/block-breadcrumb/index.js +4 -2
  120. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  121. package/build-module/components/block-draggable/index.js +3 -3
  122. package/build-module/components/block-draggable/index.js.map +1 -1
  123. package/build-module/components/block-list/use-block-props/use-block-refs.js +24 -34
  124. package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
  125. package/build-module/components/block-mover/index.js +1 -2
  126. package/build-module/components/block-mover/index.js.map +1 -1
  127. package/build-module/components/block-popover/cover.js +1 -1
  128. package/build-module/components/block-popover/cover.js.map +1 -1
  129. package/build-module/components/block-popover/inbetween.js +1 -1
  130. package/build-module/components/block-popover/inbetween.js.map +1 -1
  131. package/build-module/components/block-popover/index.js +1 -1
  132. package/build-module/components/block-popover/index.js.map +1 -1
  133. package/build-module/components/block-tools/block-selection-button.js +1 -2
  134. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  135. package/build-module/components/block-tools/index.js +1 -1
  136. package/build-module/components/block-tools/index.js.map +1 -1
  137. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  138. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  139. package/build-module/components/block-tools/zoom-out-mode-inserters.js +16 -17
  140. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  141. package/build-module/components/block-tools/zoom-out-toolbar.js +0 -1
  142. package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
  143. package/build-module/components/child-layout-control/index.js +3 -1
  144. package/build-module/components/child-layout-control/index.js.map +1 -1
  145. package/build-module/components/dimensions-tool/scale-tool.js +1 -0
  146. package/build-module/components/dimensions-tool/scale-tool.js.map +1 -1
  147. package/build-module/components/font-family/index.js +11 -0
  148. package/build-module/components/font-family/index.js.map +1 -1
  149. package/build-module/components/global-styles/background-panel.js +55 -51
  150. package/build-module/components/global-styles/background-panel.js.map +1 -1
  151. package/build-module/components/global-styles/image-settings-panel.js +1 -0
  152. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  153. package/build-module/components/global-styles/theme-file-uri-utils.js +0 -58
  154. package/build-module/components/global-styles/theme-file-uri-utils.js.map +1 -1
  155. package/build-module/components/global-styles/typography-panel.js +0 -1
  156. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  157. package/build-module/components/global-styles/use-global-styles-output.js +57 -38
  158. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  159. package/build-module/components/global-styles/utils.js +92 -0
  160. package/build-module/components/global-styles/utils.js.map +1 -1
  161. package/build-module/components/grid/grid-item-movers.js +30 -26
  162. package/build-module/components/grid/grid-item-movers.js.map +1 -1
  163. package/build-module/components/grid/grid-item-resizer.js +14 -15
  164. package/build-module/components/grid/grid-item-resizer.js.map +1 -1
  165. package/build-module/components/grid/grid-visualizer.js +1 -1
  166. package/build-module/components/grid/grid-visualizer.js.map +1 -1
  167. package/build-module/components/grid/use-grid-layout-sync.js +56 -20
  168. package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
  169. package/build-module/components/iframe/index.js +4 -8
  170. package/build-module/components/iframe/index.js.map +1 -1
  171. package/build-module/components/inserter/category-tabs/index.js +30 -3
  172. package/build-module/components/inserter/category-tabs/index.js.map +1 -1
  173. package/build-module/components/inserter/menu.js +2 -2
  174. package/build-module/components/inserter/menu.js.map +1 -1
  175. package/build-module/components/line-height-control/index.js +0 -14
  176. package/build-module/components/line-height-control/index.js.map +1 -1
  177. package/build-module/components/link-control/search-input.js +0 -1
  178. package/build-module/components/link-control/search-input.js.map +1 -1
  179. package/build-module/components/media-replace-flow/index.js +3 -1
  180. package/build-module/components/media-replace-flow/index.js.map +1 -1
  181. package/build-module/components/resolution-tool/index.js +1 -0
  182. package/build-module/components/resolution-tool/index.js.map +1 -1
  183. package/build-module/components/skip-to-selected-block/index.js +5 -3
  184. package/build-module/components/skip-to-selected-block/index.js.map +1 -1
  185. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -6
  186. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  187. package/build-module/components/url-input/button.js +0 -1
  188. package/build-module/components/url-input/button.js.map +1 -1
  189. package/build-module/components/url-input/index.js +1 -11
  190. package/build-module/components/url-input/index.js.map +1 -1
  191. package/build-module/components/url-popover/link-editor.js +0 -1
  192. package/build-module/components/url-popover/link-editor.js.map +1 -1
  193. package/build-module/components/use-block-drop-zone/index.js +30 -4
  194. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  195. package/build-module/components/use-on-block-drop/index.js +3 -6
  196. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  197. package/build-module/components/use-resize-canvas/index.js +1 -3
  198. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  199. package/build-module/components/use-settings/index.js +2 -1
  200. package/build-module/components/use-settings/index.js.map +1 -1
  201. package/build-module/hooks/block-bindings.js +253 -40
  202. package/build-module/hooks/block-bindings.js.map +1 -1
  203. package/build-module/hooks/block-hooks.js +1 -0
  204. package/build-module/hooks/block-hooks.js.map +1 -1
  205. package/build-module/hooks/block-style-variation.js +3 -3
  206. package/build-module/hooks/block-style-variation.js.map +1 -1
  207. package/build-module/hooks/contrast-checker.js +7 -7
  208. package/build-module/hooks/contrast-checker.js.map +1 -1
  209. package/build-module/hooks/duotone.js +4 -4
  210. package/build-module/hooks/duotone.js.map +1 -1
  211. package/build-module/hooks/index.js +2 -1
  212. package/build-module/hooks/index.js.map +1 -1
  213. package/build-module/hooks/line-height.js +0 -1
  214. package/build-module/hooks/line-height.js.map +1 -1
  215. package/build-module/hooks/spacing-visualizer.js +1 -1
  216. package/build-module/hooks/spacing-visualizer.js.map +1 -1
  217. package/build-module/hooks/use-bindings-attributes.js +3 -0
  218. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  219. package/build-module/hooks/use-zoom-out.js +1 -1
  220. package/build-module/hooks/use-zoom-out.js.map +1 -1
  221. package/build-module/hooks/utils.js +19 -0
  222. package/build-module/hooks/utils.js.map +1 -1
  223. package/build-module/index.js +1 -1
  224. package/build-module/index.js.map +1 -1
  225. package/build-module/private-apis.js +1 -2
  226. package/build-module/private-apis.js.map +1 -1
  227. package/build-module/store/actions.js +9 -1
  228. package/build-module/store/actions.js.map +1 -1
  229. package/build-module/store/selectors.js +4 -4
  230. package/build-module/store/selectors.js.map +1 -1
  231. package/build-module/utils/get-editor-region.js +1 -1
  232. package/build-module/utils/get-editor-region.js.map +1 -1
  233. package/build-module/utils/get-px-from-css-unit.js +1 -1
  234. package/build-module/utils/get-px-from-css-unit.js.map +1 -1
  235. package/build-style/content-rtl.css +5 -12
  236. package/build-style/content.css +5 -12
  237. package/build-style/default-editor-styles-rtl.css +3 -0
  238. package/build-style/default-editor-styles.css +3 -0
  239. package/build-style/style-rtl.css +88 -46
  240. package/build-style/style.css +88 -46
  241. package/package.json +31 -31
  242. package/src/autocompleters/style.scss +4 -0
  243. package/src/components/block-breadcrumb/index.js +4 -2
  244. package/src/components/block-canvas/style.scss +1 -0
  245. package/src/components/block-draggable/index.js +3 -3
  246. package/src/components/block-list/use-block-props/use-block-refs.js +27 -43
  247. package/src/components/block-mover/index.js +5 -2
  248. package/src/components/block-popover/cover.js +1 -1
  249. package/src/components/block-popover/inbetween.js +1 -1
  250. package/src/components/block-popover/index.js +1 -1
  251. package/src/components/block-tools/block-selection-button.js +1 -2
  252. package/src/components/block-tools/index.js +5 -6
  253. package/src/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  254. package/src/components/block-tools/zoom-out-mode-inserters.js +14 -18
  255. package/src/components/block-tools/zoom-out-toolbar.js +0 -1
  256. package/src/components/button-block-appender/content.scss +1 -1
  257. package/src/components/child-layout-control/index.js +2 -0
  258. package/src/components/color-palette/test/__snapshots__/control.js.snap +2 -2
  259. package/src/components/colors-gradients/test/control.js +3 -2
  260. package/src/components/dimensions-tool/scale-tool.js +1 -0
  261. package/src/components/font-family/README.md +8 -0
  262. package/src/components/font-family/index.js +16 -0
  263. package/src/components/font-family/stories/index.story.js +54 -0
  264. package/src/components/global-styles/background-panel.js +69 -61
  265. package/src/components/global-styles/image-settings-panel.js +1 -0
  266. package/src/components/global-styles/style.scss +0 -10
  267. package/src/components/global-styles/test/theme-file-uri-utils.js +1 -26
  268. package/src/components/global-styles/test/use-global-styles-output.js +49 -4
  269. package/src/components/global-styles/test/utils.js +120 -0
  270. package/src/components/global-styles/theme-file-uri-utils.js +0 -59
  271. package/src/components/global-styles/typography-panel.js +0 -1
  272. package/src/components/global-styles/use-global-styles-output.js +67 -48
  273. package/src/components/global-styles/utils.js +112 -0
  274. package/src/components/grid/grid-item-movers.js +46 -44
  275. package/src/components/grid/grid-item-resizer.js +11 -17
  276. package/src/components/grid/grid-visualizer.js +1 -1
  277. package/src/components/grid/style.scss +60 -10
  278. package/src/components/grid/use-grid-layout-sync.js +68 -14
  279. package/src/components/iframe/content.scss +2 -2
  280. package/src/components/iframe/index.js +3 -7
  281. package/src/components/inserter/category-tabs/index.js +35 -2
  282. package/src/components/inserter/menu.js +2 -2
  283. package/src/components/inserter/style.scss +16 -11
  284. package/src/components/inspector-controls/README.md +5 -0
  285. package/src/components/line-height-control/README.md +0 -8
  286. package/src/components/line-height-control/index.js +1 -21
  287. package/src/components/line-height-control/stories/index.story.js +0 -1
  288. package/src/components/line-height-control/test/index.js +1 -7
  289. package/src/components/link-control/search-input.js +0 -1
  290. package/src/components/media-replace-flow/README.md +7 -0
  291. package/src/components/media-replace-flow/index.js +3 -1
  292. package/src/components/resolution-tool/index.js +1 -0
  293. package/src/components/responsive-block-control/test/index.js +5 -1
  294. package/src/components/skip-to-selected-block/index.js +5 -3
  295. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -6
  296. package/src/components/tabbed-sidebar/style.scss +1 -19
  297. package/src/components/url-input/README.md +0 -5
  298. package/src/components/url-input/button.js +0 -1
  299. package/src/components/url-input/index.js +1 -15
  300. package/src/components/url-popover/link-editor.js +0 -1
  301. package/src/components/use-block-drop-zone/index.js +66 -14
  302. package/src/components/use-on-block-drop/index.js +1 -9
  303. package/src/components/use-resize-canvas/index.js +1 -3
  304. package/src/components/use-settings/index.js +2 -1
  305. package/src/hooks/block-bindings.js +303 -52
  306. package/src/hooks/block-bindings.scss +13 -2
  307. package/src/hooks/block-hooks.js +1 -0
  308. package/src/hooks/block-hooks.scss +1 -0
  309. package/src/hooks/block-style-variation.js +3 -3
  310. package/src/hooks/contrast-checker.js +7 -7
  311. package/src/hooks/duotone.js +4 -4
  312. package/src/hooks/index.js +2 -1
  313. package/src/hooks/line-height.js +0 -1
  314. package/src/hooks/spacing-visualizer.js +1 -1
  315. package/src/hooks/use-bindings-attributes.js +4 -0
  316. package/src/hooks/use-editor-wrapper-styles.native.scss +1 -0
  317. package/src/hooks/use-zoom-out.js +1 -1
  318. package/src/hooks/utils.js +14 -1
  319. package/src/index.js +1 -0
  320. package/src/private-apis.js +1 -2
  321. package/src/store/actions.js +13 -5
  322. package/src/store/selectors.js +4 -4
  323. package/src/style.scss +1 -1
  324. package/src/utils/get-editor-region.js +1 -1
  325. package/src/utils/get-px-from-css-unit.js +1 -1
  326. package/tsconfig.tsbuildinfo +1 -1
  327. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -30
  328. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
  329. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -23
  330. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
  331. package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -25
@@ -9,6 +9,7 @@ var _element = require("@wordpress/element");
9
9
  var _compose = require("@wordpress/compose");
10
10
  var _store = require("../../store");
11
11
  var _utils = require("./utils");
12
+ var _object = require("../../utils/object");
12
13
  /**
13
14
  * WordPress dependencies
14
15
  */
@@ -38,7 +39,8 @@ function useGridLayoutSync({
38
39
  };
39
40
  }, [gridClientId]);
40
41
  const {
41
- getBlockAttributes
42
+ getBlockAttributes,
43
+ getBlockRootClientId
42
44
  } = (0, _data.useSelect)(_store.store);
43
45
  const {
44
46
  updateBlockAttributes,
@@ -46,6 +48,8 @@ function useGridLayoutSync({
46
48
  } = (0, _data.useDispatch)(_store.store);
47
49
  const selectedBlockRect = (0, _element.useMemo)(() => selectedBlockLayout ? new _utils.GridRect(selectedBlockLayout) : null, [selectedBlockLayout]);
48
50
  const previouslySelectedBlockRect = (0, _compose.usePrevious)(selectedBlockRect);
51
+ const previousIsManualPlacement = (0, _compose.usePrevious)(gridLayout.isManualPlacement);
52
+ const previousBlockOrder = (0, _compose.usePrevious)(blockOrder);
49
53
  (0, _element.useEffect)(() => {
50
54
  const updates = {};
51
55
  if (gridLayout.isManualPlacement) {
@@ -113,24 +117,56 @@ function useGridLayoutSync({
113
117
  }
114
118
  };
115
119
  }
120
+
121
+ // Unset grid layout attributes for blocks removed from the grid.
122
+ for (const clientId of previousBlockOrder !== null && previousBlockOrder !== void 0 ? previousBlockOrder : []) {
123
+ if (!blockOrder.includes(clientId)) {
124
+ var _attributes$style$lay2;
125
+ const rootClientId = getBlockRootClientId(clientId);
126
+
127
+ // Block was removed from the editor, so nothing to do.
128
+ if (rootClientId === null) {
129
+ continue;
130
+ }
131
+
132
+ // Check if the block is being moved to another grid.
133
+ // If so, do nothing and let the new grid parent handle
134
+ // the attributes.
135
+ const rootAttributes = getBlockAttributes(rootClientId);
136
+ if (rootAttributes?.layout?.type === 'grid') {
137
+ continue;
138
+ }
139
+ const attributes = getBlockAttributes(clientId);
140
+ const {
141
+ columnStart,
142
+ rowStart,
143
+ columnSpan,
144
+ rowSpan,
145
+ ...layout
146
+ } = (_attributes$style$lay2 = attributes.style?.layout) !== null && _attributes$style$lay2 !== void 0 ? _attributes$style$lay2 : {};
147
+ if (columnStart || rowStart || columnSpan || rowSpan) {
148
+ const hasEmptyLayoutAttribute = Object.keys(layout).length === 0;
149
+ updates[clientId] = (0, _object.setImmutably)(attributes, ['style', 'layout'], hasEmptyLayoutAttribute ? undefined : layout);
150
+ }
151
+ }
152
+ }
116
153
  } else {
117
- // When in auto mode, remove all of the columnStart and rowStart values.
118
- for (const clientId of blockOrder) {
119
- var _attributes$style$lay2;
120
- const attributes = getBlockAttributes(clientId);
121
- const {
122
- columnStart,
123
- rowStart,
124
- ...layout
125
- } = (_attributes$style$lay2 = attributes.style?.layout) !== null && _attributes$style$lay2 !== void 0 ? _attributes$style$lay2 : {};
126
- // Only update attributes if columnStart or rowStart are set.
127
- if (columnStart || rowStart) {
128
- updates[clientId] = {
129
- style: {
130
- ...attributes.style,
131
- layout
132
- }
133
- };
154
+ // Remove all of the columnStart and rowStart values
155
+ // when switching from manual to auto mode,
156
+ if (previousIsManualPlacement === true) {
157
+ for (const clientId of blockOrder) {
158
+ var _attributes$style$lay3;
159
+ const attributes = getBlockAttributes(clientId);
160
+ const {
161
+ columnStart,
162
+ rowStart,
163
+ ...layout
164
+ } = (_attributes$style$lay3 = attributes.style?.layout) !== null && _attributes$style$lay3 !== void 0 ? _attributes$style$lay3 : {};
165
+ // Only update attributes if columnStart or rowStart are set.
166
+ if (columnStart || rowStart) {
167
+ const hasEmptyLayoutAttribute = Object.keys(layout).length === 0;
168
+ updates[clientId] = (0, _object.setImmutably)(attributes, ['style', 'layout'], hasEmptyLayoutAttribute ? undefined : layout);
169
+ }
134
170
  }
135
171
  }
136
172
 
@@ -150,9 +186,9 @@ function useGridLayoutSync({
150
186
  }
151
187
  }, [
152
188
  // Actual deps to sync:
153
- gridClientId, gridLayout, blockOrder, previouslySelectedBlockRect,
189
+ gridClientId, gridLayout, previousBlockOrder, blockOrder, previouslySelectedBlockRect, previousIsManualPlacement,
154
190
  // These won't change, but the linter thinks they might:
155
- __unstableMarkNextChangeAsNotPersistent, getBlockAttributes, updateBlockAttributes]);
191
+ __unstableMarkNextChangeAsNotPersistent, getBlockAttributes, getBlockRootClientId, updateBlockAttributes]);
156
192
  }
157
193
 
158
194
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_compose","_store","_utils","useGridLayoutSync","clientId","gridClientId","gridLayout","blockOrder","selectedBlockLayout","useSelect","select","_getBlockAttributes$l","getBlockAttributes","getBlockOrder","blockEditorStore","selectedBlock","getSelectedBlock","layout","attributes","style","updateBlockAttributes","__unstableMarkNextChangeAsNotPersistent","useDispatch","selectedBlockRect","useMemo","GridRect","previouslySelectedBlockRect","usePrevious","useEffect","updates","isManualPlacement","occupiedRects","_getBlockAttributes$s","columnStart","rowStart","columnSpan","rowSpan","push","_attributes$style$lay","newColumnStart","newRowStart","placeBlock","columnCount","columnEnd","rowEnd","bottomMostRow","Math","max","map","r","rowCount","_attributes$style$lay2","undefined","Object","keys","length","gridColumnCount","blockColumnSpan","blockRowSpan","startColumn","startRow","row","column","candidateRect","some","intersectsRect"],"sources":["@wordpress/block-editor/src/components/grid/use-grid-layout-sync.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { GridRect } from './utils';\n\nexport function useGridLayoutSync( { clientId: gridClientId } ) {\n\tconst { gridLayout, blockOrder, selectedBlockLayout } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes, getBlockOrder } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst selectedBlock = select( blockEditorStore ).getSelectedBlock();\n\t\t\treturn {\n\t\t\t\tgridLayout: getBlockAttributes( gridClientId ).layout ?? {},\n\t\t\t\tblockOrder: getBlockOrder( gridClientId ),\n\t\t\t\tselectedBlockLayout: selectedBlock?.attributes.style?.layout,\n\t\t\t};\n\t\t},\n\t\t[ gridClientId ]\n\t);\n\n\tconst { getBlockAttributes } = useSelect( blockEditorStore );\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst selectedBlockRect = useMemo(\n\t\t() =>\n\t\t\tselectedBlockLayout ? new GridRect( selectedBlockLayout ) : null,\n\t\t[ selectedBlockLayout ]\n\t);\n\n\tconst previouslySelectedBlockRect = usePrevious( selectedBlockRect );\n\n\tuseEffect( () => {\n\t\tconst updates = {};\n\n\t\tif ( gridLayout.isManualPlacement ) {\n\t\t\tconst occupiedRects = [];\n\n\t\t\t// Respect the position of blocks that already have a columnStart and rowStart value.\n\t\t\tfor ( const clientId of blockOrder ) {\n\t\t\t\tconst {\n\t\t\t\t\tcolumnStart,\n\t\t\t\t\trowStart,\n\t\t\t\t\tcolumnSpan = 1,\n\t\t\t\t\trowSpan = 1,\n\t\t\t\t} = getBlockAttributes( clientId ).style?.layout ?? {};\n\t\t\t\tif ( ! columnStart || ! rowStart ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\toccupiedRects.push(\n\t\t\t\t\tnew GridRect( {\n\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\trowStart,\n\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\trowSpan,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// When in manual mode, ensure that every block has a columnStart and rowStart value.\n\t\t\tfor ( const clientId of blockOrder ) {\n\t\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\t\tconst {\n\t\t\t\t\tcolumnStart,\n\t\t\t\t\trowStart,\n\t\t\t\t\tcolumnSpan = 1,\n\t\t\t\t\trowSpan = 1,\n\t\t\t\t} = attributes.style?.layout ?? {};\n\t\t\t\tif ( columnStart && rowStart ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst [ newColumnStart, newRowStart ] = placeBlock(\n\t\t\t\t\toccupiedRects,\n\t\t\t\t\tgridLayout.columnCount,\n\t\t\t\t\tcolumnSpan,\n\t\t\t\t\trowSpan,\n\t\t\t\t\tpreviouslySelectedBlockRect?.columnEnd,\n\t\t\t\t\tpreviouslySelectedBlockRect?.rowEnd\n\t\t\t\t);\n\t\t\t\toccupiedRects.push(\n\t\t\t\t\tnew GridRect( {\n\t\t\t\t\t\tcolumnStart: newColumnStart,\n\t\t\t\t\t\trowStart: newRowStart,\n\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\trowSpan,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t\tupdates[ clientId ] = {\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\t...attributes.style,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t...attributes.style?.layout,\n\t\t\t\t\t\t\tcolumnStart: newColumnStart,\n\t\t\t\t\t\t\trowStart: newRowStart,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Ensure there's enough rows to fit all blocks.\n\t\t\tconst bottomMostRow = Math.max(\n\t\t\t\t...occupiedRects.map( ( r ) => r.rowEnd )\n\t\t\t);\n\t\t\tif (\n\t\t\t\t! gridLayout.rowCount ||\n\t\t\t\tgridLayout.rowCount < bottomMostRow\n\t\t\t) {\n\t\t\t\tupdates[ gridClientId ] = {\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...gridLayout,\n\t\t\t\t\t\trowCount: bottomMostRow,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t} else {\n\t\t\t// When in auto mode, remove all of the columnStart and rowStart values.\n\t\t\tfor ( const clientId of blockOrder ) {\n\t\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\t\tconst { columnStart, rowStart, ...layout } =\n\t\t\t\t\tattributes.style?.layout ?? {};\n\t\t\t\t// Only update attributes if columnStart or rowStart are set.\n\t\t\t\tif ( columnStart || rowStart ) {\n\t\t\t\t\tupdates[ clientId ] = {\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...attributes.style,\n\t\t\t\t\t\t\tlayout,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Remove row styles in auto mode\n\t\t\tif ( gridLayout.rowCount ) {\n\t\t\t\tupdates[ gridClientId ] = {\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...gridLayout,\n\t\t\t\t\t\trowCount: undefined,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tif ( Object.keys( updates ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateBlockAttributes(\n\t\t\t\tObject.keys( updates ),\n\t\t\t\tupdates,\n\t\t\t\t/* uniqueByBlock: */ true\n\t\t\t);\n\t\t}\n\t}, [\n\t\t// Actual deps to sync:\n\t\tgridClientId,\n\t\tgridLayout,\n\t\tblockOrder,\n\t\tpreviouslySelectedBlockRect,\n\t\t// These won't change, but the linter thinks they might:\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tgetBlockAttributes,\n\t\tupdateBlockAttributes,\n\t] );\n}\n\n/**\n * @param {GridRect[]} occupiedRects\n * @param {number} gridColumnCount\n * @param {number} blockColumnSpan\n * @param {number} blockRowSpan\n * @param {number?} startColumn\n * @param {number?} startRow\n */\nfunction placeBlock(\n\toccupiedRects,\n\tgridColumnCount,\n\tblockColumnSpan,\n\tblockRowSpan,\n\tstartColumn = 1,\n\tstartRow = 1\n) {\n\tfor ( let row = startRow; ; row++ ) {\n\t\tfor (\n\t\t\tlet column = row === startRow ? startColumn : 1;\n\t\t\tcolumn <= gridColumnCount;\n\t\t\tcolumn++\n\t\t) {\n\t\t\tconst candidateRect = new GridRect( {\n\t\t\t\tcolumnStart: column,\n\t\t\t\trowStart: row,\n\t\t\t\tcolumnSpan: blockColumnSpan,\n\t\t\t\trowSpan: blockRowSpan,\n\t\t\t} );\n\t\t\tif (\n\t\t\t\t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MAAM,EAAED,GAAG,CAAE;MACvB;IACD;EACD;AACD","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_element","_compose","_store","_utils","_object","useGridLayoutSync","clientId","gridClientId","gridLayout","blockOrder","selectedBlockLayout","useSelect","select","_getBlockAttributes$l","getBlockAttributes","getBlockOrder","blockEditorStore","selectedBlock","getSelectedBlock","layout","attributes","style","getBlockRootClientId","updateBlockAttributes","__unstableMarkNextChangeAsNotPersistent","useDispatch","selectedBlockRect","useMemo","GridRect","previouslySelectedBlockRect","usePrevious","previousIsManualPlacement","isManualPlacement","previousBlockOrder","useEffect","updates","occupiedRects","_getBlockAttributes$s","columnStart","rowStart","columnSpan","rowSpan","push","_attributes$style$lay","newColumnStart","newRowStart","placeBlock","columnCount","columnEnd","rowEnd","bottomMostRow","Math","max","map","r","rowCount","includes","_attributes$style$lay2","rootClientId","rootAttributes","type","hasEmptyLayoutAttribute","Object","keys","length","setImmutably","undefined","_attributes$style$lay3","gridColumnCount","blockColumnSpan","blockRowSpan","startColumn","startRow","row","column","candidateRect","some","intersectsRect"],"sources":["@wordpress/block-editor/src/components/grid/use-grid-layout-sync.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { GridRect } from './utils';\nimport { setImmutably } from '../../utils/object';\n\nexport function useGridLayoutSync( { clientId: gridClientId } ) {\n\tconst { gridLayout, blockOrder, selectedBlockLayout } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes, getBlockOrder } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst selectedBlock = select( blockEditorStore ).getSelectedBlock();\n\t\t\treturn {\n\t\t\t\tgridLayout: getBlockAttributes( gridClientId ).layout ?? {},\n\t\t\t\tblockOrder: getBlockOrder( gridClientId ),\n\t\t\t\tselectedBlockLayout: selectedBlock?.attributes.style?.layout,\n\t\t\t};\n\t\t},\n\t\t[ gridClientId ]\n\t);\n\n\tconst { getBlockAttributes, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst selectedBlockRect = useMemo(\n\t\t() =>\n\t\t\tselectedBlockLayout ? new GridRect( selectedBlockLayout ) : null,\n\t\t[ selectedBlockLayout ]\n\t);\n\n\tconst previouslySelectedBlockRect = usePrevious( selectedBlockRect );\n\tconst previousIsManualPlacement = usePrevious(\n\t\tgridLayout.isManualPlacement\n\t);\n\tconst previousBlockOrder = usePrevious( blockOrder );\n\n\tuseEffect( () => {\n\t\tconst updates = {};\n\n\t\tif ( gridLayout.isManualPlacement ) {\n\t\t\tconst occupiedRects = [];\n\n\t\t\t// Respect the position of blocks that already have a columnStart and rowStart value.\n\t\t\tfor ( const clientId of blockOrder ) {\n\t\t\t\tconst {\n\t\t\t\t\tcolumnStart,\n\t\t\t\t\trowStart,\n\t\t\t\t\tcolumnSpan = 1,\n\t\t\t\t\trowSpan = 1,\n\t\t\t\t} = getBlockAttributes( clientId ).style?.layout ?? {};\n\t\t\t\tif ( ! columnStart || ! rowStart ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\toccupiedRects.push(\n\t\t\t\t\tnew GridRect( {\n\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\trowStart,\n\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\trowSpan,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// When in manual mode, ensure that every block has a columnStart and rowStart value.\n\t\t\tfor ( const clientId of blockOrder ) {\n\t\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\t\tconst {\n\t\t\t\t\tcolumnStart,\n\t\t\t\t\trowStart,\n\t\t\t\t\tcolumnSpan = 1,\n\t\t\t\t\trowSpan = 1,\n\t\t\t\t} = attributes.style?.layout ?? {};\n\t\t\t\tif ( columnStart && rowStart ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst [ newColumnStart, newRowStart ] = placeBlock(\n\t\t\t\t\toccupiedRects,\n\t\t\t\t\tgridLayout.columnCount,\n\t\t\t\t\tcolumnSpan,\n\t\t\t\t\trowSpan,\n\t\t\t\t\tpreviouslySelectedBlockRect?.columnEnd,\n\t\t\t\t\tpreviouslySelectedBlockRect?.rowEnd\n\t\t\t\t);\n\t\t\t\toccupiedRects.push(\n\t\t\t\t\tnew GridRect( {\n\t\t\t\t\t\tcolumnStart: newColumnStart,\n\t\t\t\t\t\trowStart: newRowStart,\n\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\trowSpan,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t\tupdates[ clientId ] = {\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\t...attributes.style,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t...attributes.style?.layout,\n\t\t\t\t\t\t\tcolumnStart: newColumnStart,\n\t\t\t\t\t\t\trowStart: newRowStart,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Ensure there's enough rows to fit all blocks.\n\t\t\tconst bottomMostRow = Math.max(\n\t\t\t\t...occupiedRects.map( ( r ) => r.rowEnd )\n\t\t\t);\n\t\t\tif (\n\t\t\t\t! gridLayout.rowCount ||\n\t\t\t\tgridLayout.rowCount < bottomMostRow\n\t\t\t) {\n\t\t\t\tupdates[ gridClientId ] = {\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...gridLayout,\n\t\t\t\t\t\trowCount: bottomMostRow,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Unset grid layout attributes for blocks removed from the grid.\n\t\t\tfor ( const clientId of previousBlockOrder ?? [] ) {\n\t\t\t\tif ( ! blockOrder.includes( clientId ) ) {\n\t\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t\t\t// Block was removed from the editor, so nothing to do.\n\t\t\t\t\tif ( rootClientId === null ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Check if the block is being moved to another grid.\n\t\t\t\t\t// If so, do nothing and let the new grid parent handle\n\t\t\t\t\t// the attributes.\n\t\t\t\t\tconst rootAttributes = getBlockAttributes( rootClientId );\n\t\t\t\t\tif ( rootAttributes?.layout?.type === 'grid' ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\t\t\tconst {\n\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\trowStart,\n\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t...layout\n\t\t\t\t\t} = attributes.style?.layout ?? {};\n\n\t\t\t\t\tif ( columnStart || rowStart || columnSpan || rowSpan ) {\n\t\t\t\t\t\tconst hasEmptyLayoutAttribute =\n\t\t\t\t\t\t\tObject.keys( layout ).length === 0;\n\n\t\t\t\t\t\tupdates[ clientId ] = setImmutably(\n\t\t\t\t\t\t\tattributes,\n\t\t\t\t\t\t\t[ 'style', 'layout' ],\n\t\t\t\t\t\t\thasEmptyLayoutAttribute ? undefined : layout\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Remove all of the columnStart and rowStart values\n\t\t\t// when switching from manual to auto mode,\n\t\t\tif ( previousIsManualPlacement === true ) {\n\t\t\t\tfor ( const clientId of blockOrder ) {\n\t\t\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\t\t\tconst { columnStart, rowStart, ...layout } =\n\t\t\t\t\t\tattributes.style?.layout ?? {};\n\t\t\t\t\t// Only update attributes if columnStart or rowStart are set.\n\t\t\t\t\tif ( columnStart || rowStart ) {\n\t\t\t\t\t\tconst hasEmptyLayoutAttribute =\n\t\t\t\t\t\t\tObject.keys( layout ).length === 0;\n\n\t\t\t\t\t\tupdates[ clientId ] = setImmutably(\n\t\t\t\t\t\t\tattributes,\n\t\t\t\t\t\t\t[ 'style', 'layout' ],\n\t\t\t\t\t\t\thasEmptyLayoutAttribute ? undefined : layout\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Remove row styles in auto mode\n\t\t\tif ( gridLayout.rowCount ) {\n\t\t\t\tupdates[ gridClientId ] = {\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...gridLayout,\n\t\t\t\t\t\trowCount: undefined,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tif ( Object.keys( updates ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateBlockAttributes(\n\t\t\t\tObject.keys( updates ),\n\t\t\t\tupdates,\n\t\t\t\t/* uniqueByBlock: */ true\n\t\t\t);\n\t\t}\n\t}, [\n\t\t// Actual deps to sync:\n\t\tgridClientId,\n\t\tgridLayout,\n\t\tpreviousBlockOrder,\n\t\tblockOrder,\n\t\tpreviouslySelectedBlockRect,\n\t\tpreviousIsManualPlacement,\n\t\t// These won't change, but the linter thinks they might:\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tgetBlockAttributes,\n\t\tgetBlockRootClientId,\n\t\tupdateBlockAttributes,\n\t] );\n}\n\n/**\n * @param {GridRect[]} occupiedRects\n * @param {number} gridColumnCount\n * @param {number} blockColumnSpan\n * @param {number} blockRowSpan\n * @param {number?} startColumn\n * @param {number?} startRow\n */\nfunction placeBlock(\n\toccupiedRects,\n\tgridColumnCount,\n\tblockColumnSpan,\n\tblockRowSpan,\n\tstartColumn = 1,\n\tstartRow = 1\n) {\n\tfor ( let row = startRow; ; row++ ) {\n\t\tfor (\n\t\t\tlet column = row === startRow ? startColumn : 1;\n\t\t\tcolumn <= gridColumnCount;\n\t\t\tcolumn++\n\t\t) {\n\t\t\tconst candidateRect = new GridRect( {\n\t\t\t\tcolumnStart: column,\n\t\t\t\trowStart: row,\n\t\t\t\tcolumnSpan: blockColumnSpan,\n\t\t\t\trowSpan: blockRowSpan,\n\t\t\t} );\n\t\t\tif (\n\t\t\t\t! occupiedRects.some( ( r ) =>\n\t\t\t\t\tr.intersectsRect( candidateRect )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn [ column, row ];\n\t\t\t}\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAKA;AACA;AACA;;AAKO,SAASM,iBAAiBA,CAAE;EAAEC,QAAQ,EAAEC;AAAa,CAAC,EAAG;EAC/D,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAoB,CAAC,GAAG,IAAAC,eAAS,EAC9DC,MAAM,IAAM;IAAA,IAAAC,qBAAA;IACb,MAAM;MAAEC,kBAAkB;MAAEC;IAAc,CAAC,GAC1CH,MAAM,CAAEI,YAAiB,CAAC;IAC3B,MAAMC,aAAa,GAAGL,MAAM,CAAEI,YAAiB,CAAC,CAACE,gBAAgB,CAAC,CAAC;IACnE,OAAO;MACNV,UAAU,GAAAK,qBAAA,GAAEC,kBAAkB,CAAEP,YAAa,CAAC,CAACY,MAAM,cAAAN,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAAC;MAC3DJ,UAAU,EAAEM,aAAa,CAAER,YAAa,CAAC;MACzCG,mBAAmB,EAAEO,aAAa,EAAEG,UAAU,CAACC,KAAK,EAAEF;IACvD,CAAC;EACF,CAAC,EACD,CAAEZ,YAAY,CACf,CAAC;EAED,MAAM;IAAEO,kBAAkB;IAAEQ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AAIC,MAAM,GAAGD,GAAG,KAAKD,QAAQ,GAAGD,WAAW,GAAG,CAAC,EAC/CG,MAAM,IAAIN,eAAe,EACzBM,MAAM,EAAE,EACP;MACD,MAAMC,aAAa,GAAG,IAAI/C,eAAQ,CAAE;QACnCU,WAAW,EAAEoC,MAAM;QACnBnC,QAAQ,EAAEkC,GAAG;QACbjC,UAAU,EAAE6B,eAAe;QAC3B5B,OAAO,EAAE6B;MACV,CAAE,CAAC;MACH,IACC,CAAElC,aAAa,CAACwC,IAAI,CAAItB,CAAC,IACxBA,CAAC,CAACuB,cAAc,CAAEF,aAAc,CACjC,CAAC,EACA;QACD,OAAO,CAAED,MAAM,EAAED,GAAG,CAAE;MACvB;IACD;EACD;AACD","ignoreList":[]}
@@ -208,10 +208,8 @@ function Iframe({
208
208
  }, []);
209
209
  const isZoomedOut = scale !== 1;
210
210
  (0, _element.useEffect)(() => {
211
- if (!isZoomedOut) {
212
- prevContainerWidth.current = containerWidth;
213
- }
214
- }, [containerWidth, isZoomedOut]);
211
+ prevContainerWidth.current = containerWidth;
212
+ }, [containerWidth]);
215
213
  const disabledRef = (0, _compose.useDisabled)({
216
214
  isDisabled: !readonly
217
215
  });
@@ -261,7 +259,7 @@ function Iframe({
261
259
  return;
262
260
  }
263
261
  iframeDocument.documentElement.classList.add('is-zoomed-out');
264
- const maxWidth = 800;
262
+ const maxWidth = 750;
265
263
  iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-scale', scale === 'default' ? Math.min(containerWidth, maxWidth) / prevContainerWidth.current : scale);
266
264
  iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-frame-size', typeof frameSize === 'number' ? `${frameSize}px` : frameSize);
267
265
  iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-content-height', `${contentHeight}px`);
@@ -286,10 +284,8 @@ function Iframe({
286
284
  children: [shouldRenderFocusCaptureElements && before, /*#__PURE__*/(0, _jsxRuntime.jsx)("iframe", {
287
285
  ...props,
288
286
  style: {
289
- border: 0,
290
287
  ...props.style,
291
- height: props.style?.height,
292
- transition: 'all .3s'
288
+ height: props.style?.height
293
289
  },
294
290
  ref: (0, _compose.useMergeRefs)([ref, setRef]),
295
291
  tabIndex: tabIndex
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_i18n","_compose","_components","_data","_blockSelectionClearer","_writingFlow","_getCompatibilityStyles","_store","_jsxRuntime","bubbleEvent","event","Constructor","frame","init","key","contentDocument","defaultView","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","defaultPrevented","preventDefault","cancelled","dispatchEvent","useBubbleEvents","iframeDocument","useRefEffect","frameElement","html","documentElement","eventTypes","handlers","name","prototype","Object","getPrototypeOf","constructorName","constructor","window","addEventListener","removeEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","readonly","forwardedRef","ref","title","__","props","resolvedAssets","isPreviewMode","useSelect","select","getSettings","blockEditorStore","settings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","setIframeDocument","useState","prevContainerWidth","useRef","bodyClasses","setBodyClasses","clearerRef","useBlockSelectionClearer","before","writingFlowRef","after","useWritingFlow","contentResizeListener","height","contentHeight","useResizeObserver","containerResizeListener","width","containerWidth","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","classList","add","Array","from","body","filter","startsWith","dir","compatStyle","getCompatibilityStyles","getElementById","id","head","appendChild","cloneNode","console","warn","iframeWindowInnerHeight","setIframeWindowInnerHeight","iframeResizeRef","nodeWindow","innerHeight","onResize","windowInnerWidth","setWindowInnerWidth","windowResizeRef","innerWidth","isZoomedOut","useEffect","current","disabledRef","useDisabled","isDisabled","bodyRef","useMergeRefs","src","cleanup","useMemo","_src","URL","createObjectURL","Blob","revokeObjectURL","maxWidth","style","setProperty","Math","min","remove","removeProperty","shouldRenderFocusCaptureElements","iframe","jsxs","Fragment","jsx","border","transition","onKeyDown","currentTarget","target","stopPropagation","nativeEvent","KeyboardEvent","createPortal","className","clsx","__experimentalStyleProvider","document","IframeIfReady","isInitialised","__internalIsInitialized","_default","exports","default","forwardRef"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { getCompatibilityStyles } from './get-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( () => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst html = iframeDocument.documentElement;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\thtml.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\thtml.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\treadonly,\n\tforwardedRef: ref,\n\ttitle = __( 'Editor canvas' ),\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst settings = getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst prevContainerWidth = useRef();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst [ containerResizeListener, { width: containerWidth } ] =\n\t\tuseResizeObserver();\n\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tdocumentElement.classList.add( 'block-editor-iframe__html' );\n\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of getCompatibilityStyles() ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\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`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst [ iframeWindowInnerHeight, setIframeWindowInnerHeight ] = useState();\n\n\tconst iframeResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\tconst onResize = () => {\n\t\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst [ windowInnerWidth, setWindowInnerWidth ] = useState();\n\n\tconst windowResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\tconst onResize = () => {\n\t\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst isZoomedOut = scale !== 1;\n\n\tuseEffect( () => {\n\t\tif ( ! isZoomedOut ) {\n\t\t\tprevContainerWidth.current = containerWidth;\n\t\t}\n\t}, [ containerWidth, isZoomedOut ] );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tuseBubbleEvents( iframeDocument ),\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t\t// Avoid resize listeners when not needed, these will trigger\n\t\t// unnecessary re-renders when animating the iframe width, or when\n\t\t// expanding preview iframes.\n\t\tisZoomedOut ? iframeResizeRef : null,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>\n\t\t\thtml{\n\t\t\t\theight: auto !important;\n\t\t\t\tmin-height: 100%;\n\t\t\t}\n\t\t\t/* Lowest specificity to not override global styles */\n\t\t\t:where(body) {\n\t\t\t\tmargin: 0;\n\t\t\t\t/* Default background color in case zoom out mode background\n\t\t\t\tcolors the html element */\n\t\t\t\tbackground-color: white;\n\t\t\t}\n\t\t</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\tuseEffect( () => {\n\t\tif ( ! iframeDocument || ! isZoomedOut ) {\n\t\t\treturn;\n\t\t}\n\n\t\tiframeDocument.documentElement.classList.add( 'is-zoomed-out' );\n\n\t\tconst maxWidth = 800;\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-scale',\n\t\t\tscale === 'default'\n\t\t\t\t? Math.min( containerWidth, maxWidth ) /\n\t\t\t\t\t\tprevContainerWidth.current\n\t\t\t\t: scale\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-frame-size',\n\t\t\ttypeof frameSize === 'number' ? `${ frameSize }px` : frameSize\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-content-height',\n\t\t\t`${ contentHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-inner-height',\n\t\t\t`${ iframeWindowInnerHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-container-width',\n\t\t\t`${ containerWidth }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width',\n\t\t\t`${ prevContainerWidth.current }px`\n\t\t);\n\n\t\treturn () => {\n\t\t\tiframeDocument.documentElement.classList.remove( 'is-zoomed-out' );\n\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-scale'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-frame-size'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-content-height'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-inner-height'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-container-width'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width'\n\t\t\t);\n\t\t};\n\t}, [\n\t\tscale,\n\t\tframeSize,\n\t\tiframeDocument,\n\t\tiframeWindowInnerHeight,\n\t\tcontentHeight,\n\t\tcontainerWidth,\n\t\twindowInnerWidth,\n\t\tisZoomedOut,\n\t] );\n\n\t// Make sure to not render the before and after focusable div elements in view\n\t// mode. They're only needed to capture focus in edit mode.\n\tconst shouldRenderFocusCaptureElements = tabIndex >= 0 && ! isPreviewMode;\n\n\tconst iframe = (\n\t\t<>\n\t\t\t{ shouldRenderFocusCaptureElements && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\tborder: 0,\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: props.style?.height,\n\t\t\t\t\ttransition: 'all .3s',\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ title }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif ( props.onKeyDown ) {\n\t\t\t\t\t\tprops.onKeyDown( event );\n\t\t\t\t\t}\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\t// We should only stop propagation of the React event,\n\t\t\t\t\t\t// the native event should further bubble inside the\n\t\t\t\t\t\t// iframe to the document and window.\n\t\t\t\t\t\t// Alternatively, we could consider redispatching the\n\t\t\t\t\t\t// native event in the iframe.\n\t\t\t\t\t\tconst { stopPropagation } = event.nativeEvent;\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = () => {};\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = stopPropagation;\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t// We want to prevent React events from bubbling throught the iframe\n\t\t\t\t\t\t// we bubble these manually.\n\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ shouldRenderFocusCaptureElements && after }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-iframe__container\" ref={ windowResizeRef }>\n\t\t\t{ containerResizeListener }\n\t\t\t<div\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-iframe__scale-container',\n\t\t\t\t\tisZoomedOut && 'is-zoomed-out'\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-container-width':\n\t\t\t\t\t\tisZoomedOut && `${ containerWidth }px`,\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width':\n\t\t\t\t\t\tisZoomedOut && `${ prevContainerWidth.current }px`,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframe }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAQA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAMA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,sBAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,uBAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAAwD,IAAAU,WAAA,GAAAV,OAAA;AAhCxD;AACA;AACA;;AAGA;AACA;AACA;;AAmBA;AACA;AACA;;AAMA,SAASW,WAAWA,CAAEC,KAAK,EAAEC,WAAW,EAAEC,KAAK,EAAG;EACjD,MAAMC,IAAI,GAAG,CAAC,CAAC;EAEf,K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C;AACpD;AAAC,IAAAgH,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,mBAAU,EAAEN,aAAc,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_i18n","_compose","_components","_data","_blockSelectionClearer","_writingFlow","_getCompatibilityStyles","_store","_jsxRuntime","bubbleEvent","event","Constructor","frame","init","key","contentDocument","defaultView","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","defaultPrevented","preventDefault","cancelled","dispatchEvent","useBubbleEvents","iframeDocument","useRefEffect","frameElement","html","documentElement","eventTypes","handlers","name","prototype","Object","getPrototypeOf","constructorName","constructor","window","addEventListener","removeEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","readonly","forwardedRef","ref","title","__","props","resolvedAssets","isPreviewMode","useSelect","select","getSettings","blockEditorStore","settings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","setIframeDocument","useState","prevContainerWidth","useRef","bodyClasses","setBodyClasses","clearerRef","useBlockSelectionClearer","before","writingFlowRef","after","useWritingFlow","contentResizeListener","height","contentHeight","useResizeObserver","containerResizeListener","width","containerWidth","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","classList","add","Array","from","body","filter","startsWith","dir","compatStyle","getCompatibilityStyles","getElementById","id","head","appendChild","cloneNode","console","warn","iframeWindowInnerHeight","setIframeWindowInnerHeight","iframeResizeRef","nodeWindow","innerHeight","onResize","windowInnerWidth","setWindowInnerWidth","windowResizeRef","innerWidth","isZoomedOut","useEffect","current","disabledRef","useDisabled","isDisabled","bodyRef","useMergeRefs","src","cleanup","useMemo","_src","URL","createObjectURL","Blob","revokeObjectURL","maxWidth","style","setProperty","Math","min","remove","removeProperty","shouldRenderFocusCaptureElements","iframe","jsxs","Fragment","jsx","onKeyDown","currentTarget","target","stopPropagation","nativeEvent","KeyboardEvent","createPortal","className","clsx","__experimentalStyleProvider","document","IframeIfReady","isInitialised","__internalIsInitialized","_default","exports","default","forwardRef"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { getCompatibilityStyles } from './get-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( () => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst html = iframeDocument.documentElement;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\thtml.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\thtml.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\treadonly,\n\tforwardedRef: ref,\n\ttitle = __( 'Editor canvas' ),\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst settings = getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst prevContainerWidth = useRef();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst [ containerResizeListener, { width: containerWidth } ] =\n\t\tuseResizeObserver();\n\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tdocumentElement.classList.add( 'block-editor-iframe__html' );\n\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of getCompatibilityStyles() ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\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`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst [ iframeWindowInnerHeight, setIframeWindowInnerHeight ] = useState();\n\n\tconst iframeResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\tconst onResize = () => {\n\t\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst [ windowInnerWidth, setWindowInnerWidth ] = useState();\n\n\tconst windowResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\tconst onResize = () => {\n\t\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst isZoomedOut = scale !== 1;\n\n\tuseEffect( () => {\n\t\tprevContainerWidth.current = containerWidth;\n\t}, [ containerWidth ] );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tuseBubbleEvents( iframeDocument ),\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t\t// Avoid resize listeners when not needed, these will trigger\n\t\t// unnecessary re-renders when animating the iframe width, or when\n\t\t// expanding preview iframes.\n\t\tisZoomedOut ? iframeResizeRef : null,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>\n\t\t\thtml{\n\t\t\t\theight: auto !important;\n\t\t\t\tmin-height: 100%;\n\t\t\t}\n\t\t\t/* Lowest specificity to not override global styles */\n\t\t\t:where(body) {\n\t\t\t\tmargin: 0;\n\t\t\t\t/* Default background color in case zoom out mode background\n\t\t\t\tcolors the html element */\n\t\t\t\tbackground-color: white;\n\t\t\t}\n\t\t</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\tuseEffect( () => {\n\t\tif ( ! iframeDocument || ! isZoomedOut ) {\n\t\t\treturn;\n\t\t}\n\n\t\tiframeDocument.documentElement.classList.add( 'is-zoomed-out' );\n\n\t\tconst maxWidth = 750;\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-scale',\n\t\t\tscale === 'default'\n\t\t\t\t? Math.min( containerWidth, maxWidth ) /\n\t\t\t\t\t\tprevContainerWidth.current\n\t\t\t\t: scale\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-frame-size',\n\t\t\ttypeof frameSize === 'number' ? `${ frameSize }px` : frameSize\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-content-height',\n\t\t\t`${ contentHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-inner-height',\n\t\t\t`${ iframeWindowInnerHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-container-width',\n\t\t\t`${ containerWidth }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width',\n\t\t\t`${ prevContainerWidth.current }px`\n\t\t);\n\n\t\treturn () => {\n\t\t\tiframeDocument.documentElement.classList.remove( 'is-zoomed-out' );\n\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-scale'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-frame-size'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-content-height'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-inner-height'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-container-width'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width'\n\t\t\t);\n\t\t};\n\t}, [\n\t\tscale,\n\t\tframeSize,\n\t\tiframeDocument,\n\t\tiframeWindowInnerHeight,\n\t\tcontentHeight,\n\t\tcontainerWidth,\n\t\twindowInnerWidth,\n\t\tisZoomedOut,\n\t] );\n\n\t// Make sure to not render the before and after focusable div elements in view\n\t// mode. They're only needed to capture focus in edit mode.\n\tconst shouldRenderFocusCaptureElements = tabIndex >= 0 && ! isPreviewMode;\n\n\tconst iframe = (\n\t\t<>\n\t\t\t{ shouldRenderFocusCaptureElements && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: props.style?.height,\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ title }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif ( props.onKeyDown ) {\n\t\t\t\t\t\tprops.onKeyDown( event );\n\t\t\t\t\t}\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\t// We should only stop propagation of the React event,\n\t\t\t\t\t\t// the native event should further bubble inside the\n\t\t\t\t\t\t// iframe to the document and window.\n\t\t\t\t\t\t// Alternatively, we could consider redispatching the\n\t\t\t\t\t\t// native event in the iframe.\n\t\t\t\t\t\tconst { stopPropagation } = event.nativeEvent;\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = () => {};\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = stopPropagation;\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t// We want to prevent React events from bubbling throught the iframe\n\t\t\t\t\t\t// we bubble these manually.\n\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ shouldRenderFocusCaptureElements && after }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-iframe__container\" ref={ windowResizeRef }>\n\t\t\t{ containerResizeListener }\n\t\t\t<div\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-iframe__scale-container',\n\t\t\t\t\tisZoomedOut && 'is-zoomed-out'\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-container-width':\n\t\t\t\t\t\tisZoomedOut && `${ containerWidth }px`,\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width':\n\t\t\t\t\t\tisZoomedOut && `${ prevContainerWidth.current }px`,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframe }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAQA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAMA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,sBAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,uBAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAAwD,IAAAU,WAAA,GAAAV,OAAA;AAhCxD;AACA;AACA;;AAGA;AACA;AACA;;AAmBA;AACA;AACA;;AAMA,SAASW,WAAWA,CAAEC,KAAK,EAAEC,WAAW,EAAEC,KAAK,EAAG;EACjD,MAAMC,IAAI,GAAG,CAAC,CAAC;EAEf,KAAM,MAAMC,GAAG,IAAIJ,KAAK,EAAG;IAC1BG,IAAI,CAAEC,GAAG,CAAE,GAAGJ,KAAK,CAAEI,GAAG,CAAE;EAC3B;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAKJ,KAAK,Y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,CACI,CAAC;MAAA,CACX,CAAC,EACPlB,cAAc,CAACI,eAChB;IAAC,CACK,CAAC,EACP+G,gCAAgC,IAAIlE,KAAK;EAAA,CAC1C,CACF;EAED,oBACC,IAAAxE,WAAA,CAAA4I,IAAA;IAAKU,SAAS,EAAC,gCAAgC;IAACvG,GAAG,EAAGkE,eAAiB;IAAAxE,QAAA,GACpEqC,uBAAuB,eACzB,IAAA9E,WAAA,CAAA8I,GAAA;MACCQ,SAAS,EAAG,IAAAC,aAAI,EACf,sCAAsC,EACtCpC,WAAW,IAAI,eAChB,CAAG;MACHiB,KAAK,EAAG;QACP,mDAAmD,EAClDjB,WAAW,IAAK,GAAGnC,cAAgB,IAAG;QACvC,wDAAwD,EACvDmC,WAAW,IAAK,GAAGnD,kBAAkB,CAACqD,OAAS;MACjD,CAAG;MAAA5E,QAAA,EAEDkG;IAAM,CACJ,CAAC;EAAA,CACF,CAAC;AAER;AAEA,SAASe,aAAaA,CAAExG,KAAK,EAAEH,GAAG,EAAG;EACpC,MAAM4G,aAAa,GAAG,IAAAtG,eAAS,EAC5BC,MAAM,IACPA,MAAM,CAAEE,YAAiB,CAAC,CAACD,WAAW,CAAC,CAAC,CAACqG,uBAAuB,EACjE,EACD,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,oBAAO,IAAA3J,WAAA,CAAA8I,GAAA,EAACvG,MAAM;IAAA,GAAMW,KAAK;IAAGJ,YAAY,EAAGC;EAAK,CAAE,CAAC;AACpD;AAAC,IAAA8G,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,mBAAU,EAAEN,aAAc,CAAC","ignoreList":[]}
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ var _compose = require("@wordpress/compose");
7
8
  var _i18n = require("@wordpress/i18n");
8
9
  var _components = require("@wordpress/components");
9
10
  var _icons = require("@wordpress/icons");
@@ -26,6 +27,15 @@ function CategoryTabs({
26
27
  onSelectCategory,
27
28
  children
28
29
  }) {
30
+ // Copied from InterfaceSkeleton.
31
+ const ANIMATION_DURATION = 0.25;
32
+ const disableMotion = (0, _compose.useReducedMotion)();
33
+ const defaultTransition = {
34
+ type: 'tween',
35
+ duration: disableMotion ? 0 : ANIMATION_DURATION,
36
+ ease: [0.6, 0, 0.4, 1]
37
+ };
38
+ const previousSelectedCategory = (0, _compose.usePrevious)(selectedCategory);
29
39
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Tabs, {
30
40
  className: "block-editor-inserter__category-tabs",
31
41
  selectOnMove: false,
@@ -53,8 +63,25 @@ function CategoryTabs({
53
63
  }), categories.map(category => /*#__PURE__*/(0, _jsxRuntime.jsx)(Tabs.TabPanel, {
54
64
  tabId: category.name,
55
65
  focusable: false,
56
- className: "block-editor-inserter__category-panel",
57
- children: children
66
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__unstableMotion.div, {
67
+ className: "block-editor-inserter__category-panel",
68
+ initial: !previousSelectedCategory ? 'closed' : 'open',
69
+ animate: "open",
70
+ variants: {
71
+ open: {
72
+ transform: 'translateX( 0 )',
73
+ transitionEnd: {
74
+ zIndex: '1'
75
+ }
76
+ },
77
+ closed: {
78
+ transform: 'translateX( -100% )',
79
+ zIndex: '-1'
80
+ }
81
+ },
82
+ transition: defaultTransition,
83
+ children: children
84
+ })
58
85
  }, category.name))]
59
86
  });
60
87
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_icons","_lockUnlock","_jsxRuntime","Tabs","unlock","componentsPrivateApis","CategoryTabs","categories","selectedCategory","onSelectCategory","children","jsxs","className","selectOnMove","selectedTabId","name","orientation","onSelect","categoryId","find","category","jsx","TabList","map","Tab","tabId","label","undefined","__experimentalHStack","FlexBlock","Icon","icon","isRTL","chevronLeft","chevronRight","TabPanel","focusable","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/inserter/category-tabs/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { isRTL } from '@wordpress/i18n';\nimport {\n\t__experimentalHStack as HStack,\n\tFlexBlock,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { Icon, chevronRight, chevronLeft } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction CategoryTabs( {\n\tcategories,\n\tselectedCategory,\n\tonSelectCategory,\n\tchildren,\n} ) {\n\treturn (\n\t\t<Tabs\n\t\t\tclassName=\"block-editor-inserter__category-tabs\"\n\t\t\tselectOnMove={ false }\n\t\t\tselectedTabId={ selectedCategory ? selectedCategory.name : null }\n\t\t\torientation=\"vertical\"\n\t\t\tonSelect={ ( categoryId ) => {\n\t\t\t\t// Pass the full category object\n\t\t\t\tonSelectCategory(\n\t\t\t\t\tcategories.find(\n\t\t\t\t\t\t( category ) => category.name === categoryId\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} }\n\t\t>\n\t\t\t<Tabs.TabList className=\"block-editor-inserter__category-tablist\">\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\tkey={ category.name }\n\t\t\t\t\t\ttabId={ category.name }\n\t\t\t\t\t\tclassName=\"block-editor-inserter__category-tab\"\n\t\t\t\t\t\taria-label={ category.label }\n\t\t\t\t\t\taria-current={\n\t\t\t\t\t\t\tcategory === selectedCategory ? 'true' : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<HStack>\n\t\t\t\t\t\t\t<FlexBlock>{ category.label }</FlexBlock>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={ isRTL() ? chevronLeft : chevronRight }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t) ) }\n\t\t\t</Tabs.TabList>\n\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\tkey={ category.name }\n\t\t\t\t\ttabId={ category.name }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t\tclassName=\"block-editor-inserter__category-panel\"\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t) ) }\n\t\t</Tabs>\n\t);\n}\n\nexport default CategoryTabs;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AAA8C,IAAAI,WAAA,GAAAJ,OAAA;AAd9C;AACA;AACA;;AASA;AACA;AACA;;AAGA,MAAM;EAAEK;AAAK,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AAEhD,SAASC,YAAYA,CAAE;EACtBC,UAAU;EACVC,gBAAgB;EAChBC,gBAAgB;EAChBC;AACD,CAAC,EAAG;EACH,oBACC,IAAAR,WAAA,CAAAS,IAAA,EAACR,IAAI;IACJS,SAAS,EAAC,sCAAsC;IAChDC,YAAY,EAAG,KAAO;IACtBC,aAAa,EAAGN,gBAAgB,GAAGA,gBAAgB,CAACO,IAAI,GAAG,IAAM;IACjEC,WAAW,EAAC,UAAU;IACtBC,QAAQ,EAAKC,UAAU,IAAM;MAC5B;MACAT,gBAAgB,CACfF,UAAU,CAACY,IAAI,CACZC,QAAQ,IAAMA,QAAQ,CAACL,IAAI,KAAKG,UACnC,CACD,CAAC;IACF,CAAG;IAAAR,QAAA,gBAEH,IAAAR,WAAA,CAAAmB,GAAA,EAAClB,IAAI,CAACmB,OAAO;MAACV,SAAS,EAAC,yCAAyC;MAAAF,QAAA,EAC9DH,UAAU,CAACgB,GAAG,CAAIH,QAAQ,iBAC3B,IAAAlB,WAAA,CAAAmB,GAAA,EAAClB,IAAI,CAACqB,GAAG;QAERC,KAAK,EAAGL,QAAQ,CAACL,IAAM;QACvBH,SAAS,EAAC,qCAAqC;QAC/C,cAAaQ,QAAQ,CAACM,KAAO;QAC7B,gBACCN,QAAQ,KAAKZ,gBAAgB,GAAG,MAAM,GAAGmB,SACzC;QAAAjB,QAAA,eAED,IAAAR,WAAA,CAAAS,IAAA,EAACZ,WAAA,CAAA6B,oBAAM;UAAAlB,QAAA,gBACN,IAAAR,WAAA,CAAAmB,GAAA,EAACtB,WAAA,CAAA8B,SAAS;YAAAnB,QAAA,EAAGU,QAAQ,CAACM;UAAK,CAAa,CAAC,eACzC,IAAAxB,WAAA,CAAAmB,GAAA,EAACrB,MAAA,CAAA8B,IAAI;YACJC,IAAI,EAAG,IAAAC,WAAK,EAAC,CAAC,GAAGC,kBAAW,GAAGC;UAAc,CAC7C,CAAC;QAAA,CACK;MAAC,GAbHd,QAAQ,CAACL,IAcN,CACT;IAAC,CACU,CAAC,EACbR,UAAU,CAACgB,GAAG,CAAIH,QAAQ,iBAC3B,IAAAlB,WAAA,CAAAmB,GAAA,EAAClB,IAAI,CAACgC,QAAQ;MAEbV,KAAK,EAAGL,QAAQ,CAACL,IAAM;MACvBqB,SAAS,EAAG,KAAO;MACnBxB,SAAS,EAAC,uCAAuC;MAAAF,QAAA,EAE/CA;IAAQ,GALJU,QAAQ,CAACL,IAMD,CACd,CAAC;EAAA,CACE,CAAC;AAET;AAAC,IAAAsB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcjC,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["_compose","require","_i18n","_components","_icons","_lockUnlock","_jsxRuntime","Tabs","unlock","componentsPrivateApis","CategoryTabs","categories","selectedCategory","onSelectCategory","children","ANIMATION_DURATION","disableMotion","useReducedMotion","defaultTransition","type","duration","ease","previousSelectedCategory","usePrevious","jsxs","className","selectOnMove","selectedTabId","name","orientation","onSelect","categoryId","find","category","jsx","TabList","map","Tab","tabId","label","undefined","__experimentalHStack","FlexBlock","Icon","icon","isRTL","chevronLeft","chevronRight","TabPanel","focusable","__unstableMotion","div","initial","animate","variants","open","transform","transitionEnd","zIndex","closed","transition","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/inserter/category-tabs/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { usePrevious, useReducedMotion } from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\nimport {\n\t__experimentalHStack as HStack,\n\tFlexBlock,\n\tprivateApis as componentsPrivateApis,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { Icon, chevronRight, chevronLeft } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction CategoryTabs( {\n\tcategories,\n\tselectedCategory,\n\tonSelectCategory,\n\tchildren,\n} ) {\n\t// Copied from InterfaceSkeleton.\n\tconst ANIMATION_DURATION = 0.25;\n\tconst disableMotion = useReducedMotion();\n\tconst defaultTransition = {\n\t\ttype: 'tween',\n\t\tduration: disableMotion ? 0 : ANIMATION_DURATION,\n\t\tease: [ 0.6, 0, 0.4, 1 ],\n\t};\n\n\tconst previousSelectedCategory = usePrevious( selectedCategory );\n\n\treturn (\n\t\t<Tabs\n\t\t\tclassName=\"block-editor-inserter__category-tabs\"\n\t\t\tselectOnMove={ false }\n\t\t\tselectedTabId={ selectedCategory ? selectedCategory.name : null }\n\t\t\torientation=\"vertical\"\n\t\t\tonSelect={ ( categoryId ) => {\n\t\t\t\t// Pass the full category object\n\t\t\t\tonSelectCategory(\n\t\t\t\t\tcategories.find(\n\t\t\t\t\t\t( category ) => category.name === categoryId\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} }\n\t\t>\n\t\t\t<Tabs.TabList className=\"block-editor-inserter__category-tablist\">\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\tkey={ category.name }\n\t\t\t\t\t\ttabId={ category.name }\n\t\t\t\t\t\tclassName=\"block-editor-inserter__category-tab\"\n\t\t\t\t\t\taria-label={ category.label }\n\t\t\t\t\t\taria-current={\n\t\t\t\t\t\t\tcategory === selectedCategory ? 'true' : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<HStack>\n\t\t\t\t\t\t\t<FlexBlock>{ category.label }</FlexBlock>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={ isRTL() ? chevronLeft : chevronRight }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t) ) }\n\t\t\t</Tabs.TabList>\n\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\tkey={ category.name }\n\t\t\t\t\ttabId={ category.name }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"block-editor-inserter__category-panel\"\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\t! previousSelectedCategory ? 'closed' : 'open'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate=\"open\"\n\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\topen: {\n\t\t\t\t\t\t\t\ttransform: 'translateX( 0 )',\n\t\t\t\t\t\t\t\ttransitionEnd: {\n\t\t\t\t\t\t\t\t\tzIndex: '1',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tclosed: {\n\t\t\t\t\t\t\t\ttransform: 'translateX( -100% )',\n\t\t\t\t\t\t\t\tzIndex: '-1',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttransition={ defaultTransition }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</motion.div>\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t) ) }\n\t\t</Tabs>\n\t);\n}\n\nexport default Categ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AAE,qBAAqB;YAChCE,MAAM,EAAE;UACT;QACD,CAAG;QACHE,UAAU,EAAG1C,iBAAmB;QAAAJ,QAAA,EAE9BA;MAAQ,CACC;IAAC,GAzBPmB,QAAQ,CAACL,IA0BD,CACd,CAAC;EAAA,CACE,CAAC;AAET;AAAC,IAAAiC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcrD,YAAY","ignoreList":[]}
@@ -15,7 +15,7 @@ var _tips = _interopRequireDefault(require("./tips"));
15
15
  var _previewPanel = _interopRequireDefault(require("./preview-panel"));
16
16
  var _blockTypesTab = _interopRequireDefault(require("./block-types-tab"));
17
17
  var _blockPatternsTab = _interopRequireDefault(require("./block-patterns-tab"));
18
- var _patternCategoryPreviewPanel = require("./block-patterns-tab/pattern-category-preview-panel");
18
+ var _patternCategoryPreviews = require("./block-patterns-tab/pattern-category-previews");
19
19
  var _mediaTab = require("./media-tab");
20
20
  var _searchResults = _interopRequireDefault(require("./search-results"));
21
21
  var _useInsertionPoint = _interopRequireDefault(require("./hooks/use-insertion-point"));
@@ -158,7 +158,7 @@ function InserterMenu({
158
158
  onInsert: onInsertPattern,
159
159
  onSelectCategory: onClickPatternCategory,
160
160
  selectedCategory: selectedPatternCategory,
161
- children: showPatternPanel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_patternCategoryPreviewPanel.PatternCategoryPreviewPanel, {
161
+ children: showPatternPanel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_patternCategoryPreviews.PatternCategoryPreviews, {
162
162
  rootClientId: destinationRootClientId,
163
163
  onInsert: onInsertPattern,
164
164
  onHover: onHoverPattern,
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_components","_i18n","_compose","_data","_tips","_previewPanel","_blockTypesTab","_blockPatternsTab","_patternCategoryPreviewPanel","_mediaTab","_searchResults","_useInsertionPoint","_store","_tabbedSidebar","_useZoomOut","_jsxRuntime","NOOP","InserterMenu","rootClientId","clientId","isAppender","__experimentalInsertionIndex","onSelect","showInserterHelpPanel","showMostUsedBlocks","__experimentalFilterValue","shouldFocusBlock","onPatternCategorySelection","onClose","__experimentalInitialTab","__experimentalInitialCategory","ref","isZoomOutMode","useSelect","select","blockEditorStore","__unstableGetEditorMode","filterValue","setFilterValue","delayedFilterValue","useDebouncedInput","hoveredItem","setHoveredItem","useState","selectedPatternCategory","setSelectedPatternCategory","patternFilter","setPatternFilter","selectedMediaCategory","setSelectedMediaCategory","selectedTab","setSelectedTab","destinationRootClientId","onInsertBlocks","onToggleInsertionPoint","useInsertionPoint","insertionIndex","blockTypesTabRef","useRef","onInsert","useCallback","blocks","meta","shouldForceFocusBlock","_rootClientId","window","requestAnimationFrame","current","contains","ownerDocument","activeElement","querySelector","focus","onInsertPattern","patternName","onHover","item","onHoverPattern","onClickPatternCategory","patternCategory","filter","showPatternPanel","showMediaPanel","showZoomOut","__experimentalEnableZoomedOutPatternsTab","useZoomOut","inserterSearch","useMemo","jsxs","Fragment","children","jsx","SearchControl","__nextHasNoMarginBottom","className","onChange","value","label","__","placeholder","default","showBlockDirectory","prioritizePatterns","blocksTab","VisuallyHidden","as","patternsTab","onSelectCategory","selectedCategory","PatternCategoryPreviewPanel","category","showTitlesAsTooltip","mediaTab","MediaTab","MediaCategoryPanel","handleSetSelectedTab","tabsRef","useLayoutEffect","clsx","closeButtonLabel","tabs","name","title","panel","Popover","placement","offset","focusOnMount","animate","PrivateInserterMenu","exports","forwardRef","PublicInserterMenu","props","_default"],"sources":["@wordpress/block-editor/src/components/inserter/menu.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tforwardRef,\n\tuseState,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { VisuallyHidden, SearchControl, Popover } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDebouncedInput } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport Tips from './tips';\nimport InserterPreviewPanel from './preview-panel';\nimport BlockTypesTab from './block-types-tab';\nimport BlockPatternsTab from './block-patterns-tab';\nimport { PatternCategoryPreviewPanel } from './block-patterns-tab/pattern-category-preview-panel';\nimport { MediaTab, MediaCategoryPanel } from './media-tab';\nimport InserterSearchResults from './search-results';\nimport useInsertionPoint from './hooks/use-insertion-point';\nimport { store as blockEditorStore } from '../../store';\nimport TabbedSidebar from '../tabbed-sidebar';\nimport { useZoomOut } from '../../hooks/use-zoom-out';\n\nconst NOOP = () => {};\nfunction InserterMenu(\n\t{\n\t\trootClientId,\n\t\tclientId,\n\t\tisAppender,\n\t\t__experimentalInsertionIndex,\n\t\tonSelect,\n\t\tshowInserterHelpPanel,\n\t\tshowMostUsedBlocks,\n\t\t__experimentalFilterValue = '',\n\t\tshouldFocusBlock = true,\n\t\tonPatternCategorySelection,\n\t\tonClose,\n\t\t__experimentalInitialTab,\n\t\t__experimentalInitialCategory,\n\t},\n\tref\n) {\n\tconst isZoomOutMode = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',\n\t\t[]\n\t);\n\tconst [ filterValue, setFilterValue, delayedFilterValue ] =\n\t\tuseDebouncedInput( __experimentalFilterValue );\n\tconst [ hoveredItem, setHoveredItem ] = useState( null );\n\tconst [ selectedPatternCategory, setSelectedPatternCategory ] = useState(\n\t\t__experimentalInitialCategory\n\t);\n\tconst [ patternFilter, setPatternFilter ] = useState( 'all' );\n\tconst [ selectedMediaCategory, setSelectedMediaCategory ] =\n\t\tuseState( null );\n\tconst [ selectedTab, setSelectedTab ] = useState(\n\t\t__experimentalInitialTab\n\t);\n\n\tconst [ destinationRootClientId, onInsertBlocks, onToggleInsertionPoint ] =\n\t\tuseInsertionPoint( {\n\t\t\trootClientId,\n\t\t\tclientId,\n\t\t\tisAppender,\n\t\t\tinsertionIndex: __experimentalInsertionIndex,\n\t\t\tshouldFocusBlock,\n\t\t} );\n\tconst blockTypesTabRef = useRef();\n\n\tconst onInsert = useCallback(\n\t\t( blocks, meta, shouldForceFocusBlock, _rootClientId ) => {\n\t\t\tonInsertBlocks(\n\t\t\t\tblocks,\n\t\t\t\tmeta,\n\t\t\t\tshouldForceFocusBlock,\n\t\t\t\t_rootClientId\n\t\t\t);\n\t\t\tonSelect( blocks );\n\n\t\t\t// Check for focus loss due to filtering blocks by selected block type\n\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\tif (\n\t\t\t\t\t! shouldFocusBlock &&\n\t\t\t\t\t! blockTypesTabRef?.current.contains(\n\t\t\t\t\t\tref.current.ownerDocument.activeElement\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\t// There has been a focus loss, so focus the first button in the block types tab\n\t\t\t\t\tblockTypesTabRef?.current.querySelector( 'button' ).focus();\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\t[ onInsertBlocks, onSelect, shouldFocusBlock ]\n\t);\n\n\tconst onInsertPattern = useCallback(\n\t\t( blocks, patternName ) => {\n\t\t\tonInsertBlocks( blocks, { patternName } );\n\t\t\tonSelect();\n\t\t},\n\t\t[ onInsertBlocks, onSelect ]\n\t);\n\n\tconst onHover = useCallback(\n\t\t( item ) => {\n\t\t\tonToggleInsertionPoint( item );\n\t\t\tsetHoveredItem( item );\n\t\t},\n\t\t[ onToggleInsertionPoint, setHoveredItem ]\n\t);\n\n\tconst onHoverPattern = useCallback(\n\t\t( item ) => {\n\t\t\tonToggleInsertionPoint( !! item );\n\t\t},\n\t\t[ onToggleInsertionPoint ]\n\t);\n\n\tconst onClickPatternCategory = useCallback(\n\t\t( patternCategory, filter ) => {\n\t\t\tsetSelectedPatternCategory( patternCategory );\n\t\t\tsetPatternFilter( filter );\n\t\t\tonPatternCategorySelection?.();\n\t\t},\n\t\t[ setSelectedPatternCategory, onPatternCategorySelection ]\n\t);\n\n\tconst showPatternPanel =\n\t\tselectedTab === 'patterns' &&\n\t\t! delayedFilterValue &&\n\t\t!! selectedPatternCategory;\n\n\tconst showMediaPanel = selectedTab === 'media' && !! selectedMediaCategory;\n\n\tconst showZoomOut =\n\t\tshowPatternPanel && !! window.__experimentalEnableZoomedOutPatternsTab;\n\n\tuseZoomOut( showZoomOut );\n\n\tconst inserterSearch = useMemo( () => {\n\t\tif ( selectedTab === 'media' ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<SearchControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tclassName=\"block-editor-inserter__search\"\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tif ( hoveredItem ) {\n\t\t\t\t\t\t\tsetHoveredItem( null );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetFilterValue( value );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\tlabel={ __( 'Search for blocks and patterns' ) }\n\t\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t\t/>\n\t\t\t\t{ !! delayedFilterValue && (\n\t\t\t\t\t<InserterSearchResults\n\t\t\t\t\t\tfilterValue={ delayedFilterValue }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tonHoverPattern={ onHoverPattern }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisAppender={ isAppender }\n\t\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\t\t__experimentalInsertionIndex\n\t\t\t\t\t\t}\n\t\t\t\t\t\tshowBlockDirectory\n\t\t\t\t\t\tshouldFocusBlock={ shouldFocusBlock }\n\t\t\t\t\t\tprioritizePatterns={ selectedTab === 'patterns' }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}, [\n\t\tselectedTab,\n\t\thoveredItem,\n\t\tsetHoveredItem,\n\t\tsetFilterValue,\n\t\tfilterValue,\n\t\tdelayedFilterValue,\n\t\tonSelect,\n\t\tonHover,\n\t\tonHoverPattern,\n\t\tshouldFocusBlock,\n\t\tclientId,\n\t\trootClientId,\n\t\t__experimentalInsertionIndex,\n\t\tisAppender,\n\t] );\n\n\tconst blocksTab = useMemo( () => {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className=\"block-editor-inserter__block-list\">\n\t\t\t\t\t<BlockTypesTab\n\t\t\t\t\t\tref={ blockTypesTabRef }\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ showInserterHelpPanel && (\n\t\t\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t\t\t<VisuallyHidden as=\"h2\">\n\t\t\t\t\t\t\t{ __( 'A tip for using the block editor' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t<Tips />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonInsert,\n\t\tonHover,\n\t\tshowMostUsedBlocks,\n\t\tshowInserterHelpPanel,\n\t] );\n\n\tconst patternsTab = useMemo( () => {\n\t\treturn (\n\t\t\t<BlockPatternsTab\n\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\tonInsert={ onInsertPattern }\n\t\t\t\tonSelectCategory={ onClickPatternCategory }\n\t\t\t\tselectedCategory={ selectedPatternCategory }\n\t\t\t>\n\t\t\t\t{ showPatternPanel && (\n\t\t\t\t\t<PatternCategoryPreviewPanel\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsertPattern }\n\t\t\t\t\t\tonHover={ onHoverPattern }\n\t\t\t\t\t\tcategory={ selectedPatternCategory }\n\t\t\t\t\t\tpatternFilter={ patternFilter }\n\t\t\t\t\t\tshowTitlesAsTooltip\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockPatternsTab>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonHoverPattern,\n\t\tonInsertPattern,\n\t\tonClickPatternCategory,\n\t\tpatternFilter,\n\t\tselectedPatternCategory,\n\t\tshowPatternPanel,\n\t] );\n\n\tconst mediaTab = useMemo( () => {\n\t\treturn (\n\t\t\t<MediaTab\n\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\tselectedCategory={ selectedMediaCategory }\n\t\t\t\tonSelectCategory={ setSelectedMediaCategory }\n\t\t\t\tonInsert={ onInsert }\n\t\t\t>\n\t\t\t\t{ showMediaPanel && (\n\t\t\t\t\t<MediaCategoryPanel\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\tcategory={ selectedMediaCategory }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</MediaTab>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonInsert,\n\t\tselectedMediaCategory,\n\t\tsetSelectedMediaCategory,\n\t\tshowMediaPanel,\n\t] );\n\n\tconst handleSetSelectedTab = ( value ) => {\n\t\t// If no longer on patterns tab remove the category setting.\n\t\tif ( value !== 'patterns' ) {\n\t\t\tsetSelectedPatternCategory( null );\n\t\t}\n\t\tsetSelectedTab( value );\n\t};\n\n\t// Focus first active tab, if any\n\tconst tabsRef = useRef();\n\tuseLayoutEffect( () => {\n\t\tif ( tabsRef.current ) {\n\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\ttabsRef.current\n\t\t\t\t\t.querySelector( '[role=\"tab\"][aria-selected=\"true\"]' )\n\t\t\t\t\t?.focus();\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'block-editor-inserter__menu', {\n\t\t\t\t'show-panel': showPatternPanel || showMediaPanel,\n\t\t\t\t'is-zoom-out': isZoomOutMode,\n\t\t\t} ) }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t<div className=\"block-editor-inserter__main-area\">\n\t\t\t\t<TabbedSidebar\n\t\t\t\t\tref={ tabsRef }\n\t\t\t\t\tonSelect={ handleSetSelectedTab }\n\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\tselectedTab={ selectedTab }\n\t\t\t\t\tcloseButtonLabel={ __( 'Close block inserter' ) }\n\t\t\t\t\ttabs={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'blocks',\n\t\t\t\t\t\t\ttitle: __( 'Blocks' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ selectedTab === 'blocks' &&\n\t\t\t\t\t\t\t\t\t\t! delayedFilterValue &&\n\t\t\t\t\t\t\t\t\t\tblocksTab }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'patterns',\n\t\t\t\t\t\t\ttitle: __( 'Patterns' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ selectedTab === 'patterns' &&\n\t\t\t\t\t\t\t\t\t\t! delayedFilterValue &&\n\t\t\t\t\t\t\t\t\t\tpatternsTab }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'media',\n\t\t\t\t\t\t\ttitle: __( 'Media' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ mediaTab }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{ showInserterHelpPanel && hoveredItem && (\n\t\t\t\t<Popover\n\t\t\t\t\tclassName=\"block-editor-inserter__preview-container__popover\"\n\t\t\t\t\tplacement=\"right-start\"\n\t\t\t\t\toffset={ 16 }\n\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t\tanimate={ false }\n\t\t\t\t>\n\t\t\t\t\t<InserterPreviewPanel item={ hoveredItem } />\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport const PrivateInserterMenu = forwardRef( InserterMenu );\n\nfunction PublicInserterMenu( props, ref ) {\n\treturn (\n\t\t<PrivateInserterMenu\n\t\t\t{ ...props }\n\t\t\tonPatternCategorySelection={ NOOP }\n\t\t\tref={ ref }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( PublicInserterMenu );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAQA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,KAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,aAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,cAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,iBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,4BAAA,GAAAV,OAAA;AACA,IAAAW,SAAA,GAAAX,OAAA;AACA,IAAAY,cAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,kBAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,cAAA,GAAAhB,sBAAA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AGnC;MAAa,CAAE;IAAC,CACrC,CACT;EAAA,CACG,CAAC;AAER;AAEO,MAAMwF,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,IAAAE,mBAAU,EAAElH,YAAa,CAAC;AAE7D,SAASmH,kBAAkBA,CAAEC,KAAK,EAAEtG,GAAG,EAAG;EACzC,oBACC,IAAAhB,WAAA,CAAA4E,GAAA,EAACsC,mBAAmB;IAAA,GACdI,KAAK;IACV1G,0BAA0B,EAAGX,IAAM;IACnCe,GAAG,EAAGA;EAAK,CACX,CAAC;AAEJ;AAAC,IAAAuG,QAAA,GAAAJ,OAAA,CAAA9B,OAAA,GAEc,IAAA+B,mBAAU,EAAEC,kBAAmB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_components","_i18n","_compose","_data","_tips","_previewPanel","_blockTypesTab","_blockPatternsTab","_patternCategoryPreviews","_mediaTab","_searchResults","_useInsertionPoint","_store","_tabbedSidebar","_useZoomOut","_jsxRuntime","NOOP","InserterMenu","rootClientId","clientId","isAppender","__experimentalInsertionIndex","onSelect","showInserterHelpPanel","showMostUsedBlocks","__experimentalFilterValue","shouldFocusBlock","onPatternCategorySelection","onClose","__experimentalInitialTab","__experimentalInitialCategory","ref","isZoomOutMode","useSelect","select","blockEditorStore","__unstableGetEditorMode","filterValue","setFilterValue","delayedFilterValue","useDebouncedInput","hoveredItem","setHoveredItem","useState","selectedPatternCategory","setSelectedPatternCategory","patternFilter","setPatternFilter","selectedMediaCategory","setSelectedMediaCategory","selectedTab","setSelectedTab","destinationRootClientId","onInsertBlocks","onToggleInsertionPoint","useInsertionPoint","insertionIndex","blockTypesTabRef","useRef","onInsert","useCallback","blocks","meta","shouldForceFocusBlock","_rootClientId","window","requestAnimationFrame","current","contains","ownerDocument","activeElement","querySelector","focus","onInsertPattern","patternName","onHover","item","onHoverPattern","onClickPatternCategory","patternCategory","filter","showPatternPanel","showMediaPanel","showZoomOut","__experimentalEnableZoomedOutPatternsTab","useZoomOut","inserterSearch","useMemo","jsxs","Fragment","children","jsx","SearchControl","__nextHasNoMarginBottom","className","onChange","value","label","__","placeholder","default","showBlockDirectory","prioritizePatterns","blocksTab","VisuallyHidden","as","patternsTab","onSelectCategory","selectedCategory","PatternCategoryPreviews","category","showTitlesAsTooltip","mediaTab","MediaTab","MediaCategoryPanel","handleSetSelectedTab","tabsRef","useLayoutEffect","clsx","closeButtonLabel","tabs","name","title","panel","Popover","placement","offset","focusOnMount","animate","PrivateInserterMenu","exports","forwardRef","PublicInserterMenu","props","_default"],"sources":["@wordpress/block-editor/src/components/inserter/menu.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tforwardRef,\n\tuseState,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { VisuallyHidden, SearchControl, Popover } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDebouncedInput } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport Tips from './tips';\nimport InserterPreviewPanel from './preview-panel';\nimport BlockTypesTab from './block-types-tab';\nimport BlockPatternsTab from './block-patterns-tab';\nimport { PatternCategoryPreviews } from './block-patterns-tab/pattern-category-previews';\nimport { MediaTab, MediaCategoryPanel } from './media-tab';\nimport InserterSearchResults from './search-results';\nimport useInsertionPoint from './hooks/use-insertion-point';\nimport { store as blockEditorStore } from '../../store';\nimport TabbedSidebar from '../tabbed-sidebar';\nimport { useZoomOut } from '../../hooks/use-zoom-out';\n\nconst NOOP = () => {};\nfunction InserterMenu(\n\t{\n\t\trootClientId,\n\t\tclientId,\n\t\tisAppender,\n\t\t__experimentalInsertionIndex,\n\t\tonSelect,\n\t\tshowInserterHelpPanel,\n\t\tshowMostUsedBlocks,\n\t\t__experimentalFilterValue = '',\n\t\tshouldFocusBlock = true,\n\t\tonPatternCategorySelection,\n\t\tonClose,\n\t\t__experimentalInitialTab,\n\t\t__experimentalInitialCategory,\n\t},\n\tref\n) {\n\tconst isZoomOutMode = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',\n\t\t[]\n\t);\n\tconst [ filterValue, setFilterValue, delayedFilterValue ] =\n\t\tuseDebouncedInput( __experimentalFilterValue );\n\tconst [ hoveredItem, setHoveredItem ] = useState( null );\n\tconst [ selectedPatternCategory, setSelectedPatternCategory ] = useState(\n\t\t__experimentalInitialCategory\n\t);\n\tconst [ patternFilter, setPatternFilter ] = useState( 'all' );\n\tconst [ selectedMediaCategory, setSelectedMediaCategory ] =\n\t\tuseState( null );\n\tconst [ selectedTab, setSelectedTab ] = useState(\n\t\t__experimentalInitialTab\n\t);\n\n\tconst [ destinationRootClientId, onInsertBlocks, onToggleInsertionPoint ] =\n\t\tuseInsertionPoint( {\n\t\t\trootClientId,\n\t\t\tclientId,\n\t\t\tisAppender,\n\t\t\tinsertionIndex: __experimentalInsertionIndex,\n\t\t\tshouldFocusBlock,\n\t\t} );\n\tconst blockTypesTabRef = useRef();\n\n\tconst onInsert = useCallback(\n\t\t( blocks, meta, shouldForceFocusBlock, _rootClientId ) => {\n\t\t\tonInsertBlocks(\n\t\t\t\tblocks,\n\t\t\t\tmeta,\n\t\t\t\tshouldForceFocusBlock,\n\t\t\t\t_rootClientId\n\t\t\t);\n\t\t\tonSelect( blocks );\n\n\t\t\t// Check for focus loss due to filtering blocks by selected block type\n\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\tif (\n\t\t\t\t\t! shouldFocusBlock &&\n\t\t\t\t\t! blockTypesTabRef?.current.contains(\n\t\t\t\t\t\tref.current.ownerDocument.activeElement\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\t// There has been a focus loss, so focus the first button in the block types tab\n\t\t\t\t\tblockTypesTabRef?.current.querySelector( 'button' ).focus();\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\t[ onInsertBlocks, onSelect, shouldFocusBlock ]\n\t);\n\n\tconst onInsertPattern = useCallback(\n\t\t( blocks, patternName ) => {\n\t\t\tonInsertBlocks( blocks, { patternName } );\n\t\t\tonSelect();\n\t\t},\n\t\t[ onInsertBlocks, onSelect ]\n\t);\n\n\tconst onHover = useCallback(\n\t\t( item ) => {\n\t\t\tonToggleInsertionPoint( item );\n\t\t\tsetHoveredItem( item );\n\t\t},\n\t\t[ onToggleInsertionPoint, setHoveredItem ]\n\t);\n\n\tconst onHoverPattern = useCallback(\n\t\t( item ) => {\n\t\t\tonToggleInsertionPoint( !! item );\n\t\t},\n\t\t[ onToggleInsertionPoint ]\n\t);\n\n\tconst onClickPatternCategory = useCallback(\n\t\t( patternCategory, filter ) => {\n\t\t\tsetSelectedPatternCategory( patternCategory );\n\t\t\tsetPatternFilter( filter );\n\t\t\tonPatternCategorySelection?.();\n\t\t},\n\t\t[ setSelectedPatternCategory, onPatternCategorySelection ]\n\t);\n\n\tconst showPatternPanel =\n\t\tselectedTab === 'patterns' &&\n\t\t! delayedFilterValue &&\n\t\t!! selectedPatternCategory;\n\n\tconst showMediaPanel = selectedTab === 'media' && !! selectedMediaCategory;\n\n\tconst showZoomOut =\n\t\tshowPatternPanel && !! window.__experimentalEnableZoomedOutPatternsTab;\n\n\tuseZoomOut( showZoomOut );\n\n\tconst inserterSearch = useMemo( () => {\n\t\tif ( selectedTab === 'media' ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<SearchControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tclassName=\"block-editor-inserter__search\"\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tif ( hoveredItem ) {\n\t\t\t\t\t\t\tsetHoveredItem( null );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetFilterValue( value );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\tlabel={ __( 'Search for blocks and patterns' ) }\n\t\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t\t/>\n\t\t\t\t{ !! delayedFilterValue && (\n\t\t\t\t\t<InserterSearchResults\n\t\t\t\t\t\tfilterValue={ delayedFilterValue }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tonHoverPattern={ onHoverPattern }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisAppender={ isAppender }\n\t\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\t\t__experimentalInsertionIndex\n\t\t\t\t\t\t}\n\t\t\t\t\t\tshowBlockDirectory\n\t\t\t\t\t\tshouldFocusBlock={ shouldFocusBlock }\n\t\t\t\t\t\tprioritizePatterns={ selectedTab === 'patterns' }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}, [\n\t\tselectedTab,\n\t\thoveredItem,\n\t\tsetHoveredItem,\n\t\tsetFilterValue,\n\t\tfilterValue,\n\t\tdelayedFilterValue,\n\t\tonSelect,\n\t\tonHover,\n\t\tonHoverPattern,\n\t\tshouldFocusBlock,\n\t\tclientId,\n\t\trootClientId,\n\t\t__experimentalInsertionIndex,\n\t\tisAppender,\n\t] );\n\n\tconst blocksTab = useMemo( () => {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className=\"block-editor-inserter__block-list\">\n\t\t\t\t\t<BlockTypesTab\n\t\t\t\t\t\tref={ blockTypesTabRef }\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ showInserterHelpPanel && (\n\t\t\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t\t\t<VisuallyHidden as=\"h2\">\n\t\t\t\t\t\t\t{ __( 'A tip for using the block editor' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t<Tips />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonInsert,\n\t\tonHover,\n\t\tshowMostUsedBlocks,\n\t\tshowInserterHelpPanel,\n\t] );\n\n\tconst patternsTab = useMemo( () => {\n\t\treturn (\n\t\t\t<BlockPatternsTab\n\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\tonInsert={ onInsertPattern }\n\t\t\t\tonSelectCategory={ onClickPatternCategory }\n\t\t\t\tselectedCategory={ selectedPatternCategory }\n\t\t\t>\n\t\t\t\t{ showPatternPanel && (\n\t\t\t\t\t<PatternCategoryPreviews\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsertPattern }\n\t\t\t\t\t\tonHover={ onHoverPattern }\n\t\t\t\t\t\tcategory={ selectedPatternCategory }\n\t\t\t\t\t\tpatternFilter={ patternFilter }\n\t\t\t\t\t\tshowTitlesAsTooltip\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockPatternsTab>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonHoverPattern,\n\t\tonInsertPattern,\n\t\tonClickPatternCategory,\n\t\tpatternFilter,\n\t\tselectedPatternCategory,\n\t\tshowPatternPanel,\n\t] );\n\n\tconst mediaTab = useMemo( () => {\n\t\treturn (\n\t\t\t<MediaTab\n\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\tselectedCategory={ selectedMediaCategory }\n\t\t\t\tonSelectCategory={ setSelectedMediaCategory }\n\t\t\t\tonInsert={ onInsert }\n\t\t\t>\n\t\t\t\t{ showMediaPanel && (\n\t\t\t\t\t<MediaCategoryPanel\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\tcategory={ selectedMediaCategory }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</MediaTab>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonInsert,\n\t\tselectedMediaCategory,\n\t\tsetSelectedMediaCategory,\n\t\tshowMediaPanel,\n\t] );\n\n\tconst handleSetSelectedTab = ( value ) => {\n\t\t// If no longer on patterns tab remove the category setting.\n\t\tif ( value !== 'patterns' ) {\n\t\t\tsetSelectedPatternCategory( null );\n\t\t}\n\t\tsetSelectedTab( value );\n\t};\n\n\t// Focus first active tab, if any\n\tconst tabsRef = useRef();\n\tuseLayoutEffect( () => {\n\t\tif ( tabsRef.current ) {\n\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\ttabsRef.current\n\t\t\t\t\t.querySelector( '[role=\"tab\"][aria-selected=\"true\"]' )\n\t\t\t\t\t?.focus();\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'block-editor-inserter__menu', {\n\t\t\t\t'show-panel': showPatternPanel || showMediaPanel,\n\t\t\t\t'is-zoom-out': isZoomOutMode,\n\t\t\t} ) }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t<div className=\"block-editor-inserter__main-area\">\n\t\t\t\t<TabbedSidebar\n\t\t\t\t\tref={ tabsRef }\n\t\t\t\t\tonSelect={ handleSetSelectedTab }\n\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\tselectedTab={ selectedTab }\n\t\t\t\t\tcloseButtonLabel={ __( 'Close block inserter' ) }\n\t\t\t\t\ttabs={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'blocks',\n\t\t\t\t\t\t\ttitle: __( 'Blocks' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ selectedTab === 'blocks' &&\n\t\t\t\t\t\t\t\t\t\t! delayedFilterValue &&\n\t\t\t\t\t\t\t\t\t\tblocksTab }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'patterns',\n\t\t\t\t\t\t\ttitle: __( 'Patterns' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ selectedTab === 'patterns' &&\n\t\t\t\t\t\t\t\t\t\t! delayedFilterValue &&\n\t\t\t\t\t\t\t\t\t\tpatternsTab }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'media',\n\t\t\t\t\t\t\ttitle: __( 'Media' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ mediaTab }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{ showInserterHelpPanel && hoveredItem && (\n\t\t\t\t<Popover\n\t\t\t\t\tclassName=\"block-editor-inserter__preview-container__popover\"\n\t\t\t\t\tplacement=\"right-start\"\n\t\t\t\t\toffset={ 16 }\n\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t\tanimate={ false }\n\t\t\t\t>\n\t\t\t\t\t<InserterPreviewPanel item={ hoveredItem } />\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport const PrivateInserterMenu = forwardRef( InserterMenu );\n\nfunction PublicInserterMenu( props, ref ) {\n\treturn (\n\t\t<PrivateInserterMenu\n\t\t\t{ ...props }\n\t\t\tonPatternCategorySelection={ NOOP }\n\t\t\tref={ ref }\n\t\t/>\n\t);\n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