@wordpress/block-editor 12.20.0 → 12.21.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 (471) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-actions/index.js +45 -32
  3. package/build/components/block-actions/index.js.map +1 -1
  4. package/build/components/block-bindings-toolbar-indicator/index.js +25 -0
  5. package/build/components/block-bindings-toolbar-indicator/index.js.map +1 -0
  6. package/build/components/block-edit/context.js +2 -1
  7. package/build/components/block-edit/context.js.map +1 -1
  8. package/build/components/block-edit/index.js +8 -3
  9. package/build/components/block-edit/index.js.map +1 -1
  10. package/build/components/block-inspector/index.js +5 -4
  11. package/build/components/block-inspector/index.js.map +1 -1
  12. package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
  13. package/build/components/block-list/block-list-item.native.js +1 -1
  14. package/build/components/block-list/block-list-item.native.js.map +1 -1
  15. package/build/components/block-list/block-outline.native.js +23 -7
  16. package/build/components/block-list/block-outline.native.js.map +1 -1
  17. package/build/components/block-list/block-selection-button.native.js.map +1 -1
  18. package/build/components/block-list/block.native.js +0 -3
  19. package/build/components/block-list/block.native.js.map +1 -1
  20. package/build/components/block-list/use-block-props/index.js +8 -1
  21. package/build/components/block-list/use-block-props/index.js.map +1 -1
  22. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
  23. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  24. package/build/components/block-mover/index.native.js.map +1 -1
  25. package/build/components/block-popover/cover.js +68 -0
  26. package/build/components/block-popover/cover.js.map +1 -0
  27. package/build/components/block-popover/drop-zone.js +2 -3
  28. package/build/components/block-popover/drop-zone.js.map +1 -1
  29. package/build/components/block-popover/index.js +1 -19
  30. package/build/components/block-popover/index.js.map +1 -1
  31. package/build/components/block-preview/index.js +2 -1
  32. package/build/components/block-preview/index.js.map +1 -1
  33. package/build/components/block-removal-warning-modal/index.js +2 -4
  34. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  35. package/build/components/block-rename/modal.js.map +1 -1
  36. package/build/components/block-settings-menu/block-settings-dropdown.js +12 -10
  37. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  38. package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  39. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  40. package/build/components/block-toolbar/index.js +21 -10
  41. package/build/components/block-toolbar/index.js.map +1 -1
  42. package/build/components/block-toolbar/shuffle.js +89 -0
  43. package/build/components/block-toolbar/shuffle.js.map +1 -0
  44. package/build/components/block-toolbar/use-has-block-toolbar.js +43 -0
  45. package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
  46. package/build/components/block-tools/block-selection-button.js +5 -1
  47. package/build/components/block-tools/block-selection-button.js.map +1 -1
  48. package/build/components/block-tools/empty-block-inserter.js +2 -5
  49. package/build/components/block-tools/empty-block-inserter.js.map +1 -1
  50. package/build/components/block-tools/index.js +9 -26
  51. package/build/components/block-tools/index.js.map +1 -1
  52. package/build/components/block-tools/use-show-block-tools.js +60 -0
  53. package/build/components/block-tools/use-show-block-tools.js.map +1 -0
  54. package/build/components/caption/index.native.js.map +1 -1
  55. package/build/components/child-layout-control/index.js.map +1 -1
  56. package/build/components/color-palette/control.js.map +1 -1
  57. package/build/components/colors-gradients/control.js +1 -1
  58. package/build/components/colors-gradients/control.js.map +1 -1
  59. package/build/components/global-styles/border-panel.js +21 -8
  60. package/build/components/global-styles/border-panel.js.map +1 -1
  61. package/build/components/global-styles/color-panel.js +1 -1
  62. package/build/components/global-styles/color-panel.js.map +1 -1
  63. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  64. package/build/components/global-styles/index.js +6 -0
  65. package/build/components/global-styles/index.js.map +1 -1
  66. package/build/components/global-styles/shadow-panel-components.js +80 -23
  67. package/build/components/global-styles/shadow-panel-components.js.map +1 -1
  68. package/build/components/global-styles/typography-utils.js +7 -5
  69. package/build/components/global-styles/typography-utils.js.map +1 -1
  70. package/build/components/global-styles/use-global-styles-output.js +15 -15
  71. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  72. package/build/components/global-styles/utils.js +1 -1
  73. package/build/components/global-styles/utils.js.map +1 -1
  74. package/build/components/grid-visualizer/grid-item-resizer.js +77 -0
  75. package/build/components/grid-visualizer/grid-item-resizer.js.map +1 -0
  76. package/build/components/grid-visualizer/grid-visualizer.js +81 -0
  77. package/build/components/grid-visualizer/grid-visualizer.js.map +1 -0
  78. package/build/components/grid-visualizer/index.js +20 -0
  79. package/build/components/grid-visualizer/index.js.map +1 -0
  80. package/build/components/grid-visualizer/utils.js +10 -0
  81. package/build/components/grid-visualizer/utils.js.map +1 -0
  82. package/build/components/iframe/index.js +61 -16
  83. package/build/components/iframe/index.js.map +1 -1
  84. package/build/components/index.native.js +7 -0
  85. package/build/components/index.native.js.map +1 -1
  86. package/build/components/inner-blocks/use-nested-settings-update.js +8 -2
  87. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  88. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  89. package/build/components/inserter/menu.js +9 -3
  90. package/build/components/inserter/menu.js.map +1 -1
  91. package/build/components/inserter/menu.native.js.map +1 -1
  92. package/build/components/inserter/mobile-tab-navigation.js +1 -1
  93. package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
  94. package/build/components/inserter/search-results.js +3 -2
  95. package/build/components/inserter/search-results.js.map +1 -1
  96. package/build/components/inserter/tabs.js +2 -1
  97. package/build/components/inserter/tabs.js.map +1 -1
  98. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  99. package/build/components/inspector-controls-tabs/index.js +1 -1
  100. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  101. package/build/components/inspector-controls-tabs/styles-tab.js +1 -1
  102. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  103. package/build/components/link-control/link-preview.js +4 -1
  104. package/build/components/link-control/link-preview.js.map +1 -1
  105. package/build/components/link-control/search-input.js.map +1 -1
  106. package/build/components/list-view/block-select-button.js +10 -2
  107. package/build/components/list-view/block-select-button.js.map +1 -1
  108. package/build/components/list-view/branch.js.map +1 -1
  109. package/build/components/list-view/drop-indicator.js.map +1 -1
  110. package/build/components/list-view/index.js.map +1 -1
  111. package/build/components/list-view/use-clipboard-handler.js +2 -1
  112. package/build/components/list-view/use-clipboard-handler.js.map +1 -1
  113. package/build/components/panel-color-settings/index.js.map +1 -1
  114. package/build/components/provider/index.js.map +1 -1
  115. package/build/components/resizable-box-popover/index.js +3 -5
  116. package/build/components/resizable-box-popover/index.js.map +1 -1
  117. package/build/components/responsive-block-control/index.js +1 -1
  118. package/build/components/responsive-block-control/index.js.map +1 -1
  119. package/build/components/rich-text/index.js +46 -26
  120. package/build/components/rich-text/index.js.map +1 -1
  121. package/build/components/rich-text/use-enter.js +3 -0
  122. package/build/components/rich-text/use-enter.js.map +1 -1
  123. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  124. package/build/components/url-popover/index.js +3 -3
  125. package/build/components/url-popover/index.js.map +1 -1
  126. package/build/components/writing-flow/use-clipboard-handler.js +2 -1
  127. package/build/components/writing-flow/use-clipboard-handler.js.map +1 -1
  128. package/build/components/writing-flow/utils.js +23 -6
  129. package/build/components/writing-flow/utils.js.map +1 -1
  130. package/build/hooks/background.js.map +1 -1
  131. package/build/hooks/block-hooks.js +34 -8
  132. package/build/hooks/block-hooks.js.map +1 -1
  133. package/build/hooks/border.js +6 -4
  134. package/build/hooks/border.js.map +1 -1
  135. package/build/hooks/dimensions.js +3 -4
  136. package/build/hooks/dimensions.js.map +1 -1
  137. package/build/hooks/font-size.js +6 -7
  138. package/build/hooks/font-size.js.map +1 -1
  139. package/build/hooks/index.js +1 -1
  140. package/build/hooks/index.js.map +1 -1
  141. package/build/hooks/layout-child.js +39 -0
  142. package/build/hooks/layout-child.js.map +1 -1
  143. package/build/hooks/layout.js +11 -4
  144. package/build/hooks/layout.js.map +1 -1
  145. package/build/hooks/line-height.js.map +1 -1
  146. package/build/hooks/spacing-visualizer.js +115 -0
  147. package/build/hooks/spacing-visualizer.js.map +1 -0
  148. package/build/hooks/use-bindings-attributes.js +171 -48
  149. package/build/hooks/use-bindings-attributes.js.map +1 -1
  150. package/build/hooks/use-typography-props.js +1 -2
  151. package/build/hooks/use-typography-props.js.map +1 -1
  152. package/build/layouts/grid.js +6 -2
  153. package/build/layouts/grid.js.map +1 -1
  154. package/build/private-apis.js +7 -3
  155. package/build/private-apis.js.map +1 -1
  156. package/build/store/actions.js +42 -12
  157. package/build/store/actions.js.map +1 -1
  158. package/build/store/private-actions.js +29 -55
  159. package/build/store/private-actions.js.map +1 -1
  160. package/build/store/private-selectors.js +0 -8
  161. package/build/store/private-selectors.js.map +1 -1
  162. package/build/store/reducer.js +3 -20
  163. package/build/store/reducer.js.map +1 -1
  164. package/build/store/selectors.js +27 -15
  165. package/build/store/selectors.js.map +1 -1
  166. package/build/utils/calculate-scale.js +17 -0
  167. package/build/utils/calculate-scale.js.map +1 -0
  168. package/build-module/components/block-actions/index.js +45 -32
  169. package/build-module/components/block-actions/index.js.map +1 -1
  170. package/build-module/components/block-bindings-toolbar-indicator/index.js +18 -0
  171. package/build-module/components/block-bindings-toolbar-indicator/index.js.map +1 -0
  172. package/build-module/components/block-edit/context.js +1 -0
  173. package/build-module/components/block-edit/context.js.map +1 -1
  174. package/build-module/components/block-edit/index.js +9 -4
  175. package/build-module/components/block-edit/index.js.map +1 -1
  176. package/build-module/components/block-inspector/index.js +6 -5
  177. package/build-module/components/block-inspector/index.js.map +1 -1
  178. package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
  179. package/build-module/components/block-list/block-list-item.native.js +1 -1
  180. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  181. package/build-module/components/block-list/block-outline.native.js +23 -7
  182. package/build-module/components/block-list/block-outline.native.js.map +1 -1
  183. package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
  184. package/build-module/components/block-list/block.native.js +0 -3
  185. package/build-module/components/block-list/block.native.js.map +1 -1
  186. package/build-module/components/block-list/use-block-props/index.js +9 -2
  187. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  188. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
  189. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  190. package/build-module/components/block-mover/index.native.js.map +1 -1
  191. package/build-module/components/block-popover/cover.js +60 -0
  192. package/build-module/components/block-popover/cover.js.map +1 -0
  193. package/build-module/components/block-popover/drop-zone.js +2 -3
  194. package/build-module/components/block-popover/drop-zone.js.map +1 -1
  195. package/build-module/components/block-popover/index.js +1 -19
  196. package/build-module/components/block-popover/index.js.map +1 -1
  197. package/build-module/components/block-preview/index.js +2 -1
  198. package/build-module/components/block-preview/index.js.map +1 -1
  199. package/build-module/components/block-removal-warning-modal/index.js +3 -5
  200. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  201. package/build-module/components/block-rename/modal.js.map +1 -1
  202. package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -10
  203. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  204. package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  205. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  206. package/build-module/components/block-toolbar/index.js +21 -11
  207. package/build-module/components/block-toolbar/index.js.map +1 -1
  208. package/build-module/components/block-toolbar/shuffle.js +82 -0
  209. package/build-module/components/block-toolbar/shuffle.js.map +1 -0
  210. package/build-module/components/block-toolbar/use-has-block-toolbar.js +36 -0
  211. package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
  212. package/build-module/components/block-tools/block-selection-button.js +5 -1
  213. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  214. package/build-module/components/block-tools/empty-block-inserter.js +2 -5
  215. package/build-module/components/block-tools/empty-block-inserter.js.map +1 -1
  216. package/build-module/components/block-tools/index.js +9 -26
  217. package/build-module/components/block-tools/index.js.map +1 -1
  218. package/build-module/components/block-tools/use-show-block-tools.js +54 -0
  219. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -0
  220. package/build-module/components/caption/index.native.js.map +1 -1
  221. package/build-module/components/child-layout-control/index.js.map +1 -1
  222. package/build-module/components/color-palette/control.js.map +1 -1
  223. package/build-module/components/colors-gradients/control.js +1 -1
  224. package/build-module/components/colors-gradients/control.js.map +1 -1
  225. package/build-module/components/global-styles/border-panel.js +22 -10
  226. package/build-module/components/global-styles/border-panel.js.map +1 -1
  227. package/build-module/components/global-styles/color-panel.js +1 -1
  228. package/build-module/components/global-styles/color-panel.js.map +1 -1
  229. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  230. package/build-module/components/global-styles/index.js +1 -1
  231. package/build-module/components/global-styles/index.js.map +1 -1
  232. package/build-module/components/global-styles/shadow-panel-components.js +82 -24
  233. package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
  234. package/build-module/components/global-styles/typography-utils.js +7 -5
  235. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  236. package/build-module/components/global-styles/use-global-styles-output.js +16 -16
  237. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  238. package/build-module/components/global-styles/utils.js +2 -2
  239. package/build-module/components/global-styles/utils.js.map +1 -1
  240. package/build-module/components/grid-visualizer/grid-item-resizer.js +69 -0
  241. package/build-module/components/grid-visualizer/grid-item-resizer.js.map +1 -0
  242. package/build-module/components/grid-visualizer/grid-visualizer.js +73 -0
  243. package/build-module/components/grid-visualizer/grid-visualizer.js.map +1 -0
  244. package/build-module/components/grid-visualizer/index.js +3 -0
  245. package/build-module/components/grid-visualizer/index.js.map +1 -0
  246. package/build-module/components/grid-visualizer/utils.js +4 -0
  247. package/build-module/components/grid-visualizer/utils.js.map +1 -0
  248. package/build-module/components/iframe/index.js +61 -16
  249. package/build-module/components/iframe/index.js.map +1 -1
  250. package/build-module/components/index.native.js +1 -1
  251. package/build-module/components/index.native.js.map +1 -1
  252. package/build-module/components/inner-blocks/use-nested-settings-update.js +8 -2
  253. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  254. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  255. package/build-module/components/inserter/menu.js +9 -3
  256. package/build-module/components/inserter/menu.js.map +1 -1
  257. package/build-module/components/inserter/menu.native.js.map +1 -1
  258. package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
  259. package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
  260. package/build-module/components/inserter/search-results.js +3 -2
  261. package/build-module/components/inserter/search-results.js.map +1 -1
  262. package/build-module/components/inserter/tabs.js +2 -1
  263. package/build-module/components/inserter/tabs.js.map +1 -1
  264. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  265. package/build-module/components/inspector-controls-tabs/index.js +1 -1
  266. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  267. package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -2
  268. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  269. package/build-module/components/link-control/link-preview.js +5 -2
  270. package/build-module/components/link-control/link-preview.js.map +1 -1
  271. package/build-module/components/link-control/search-input.js.map +1 -1
  272. package/build-module/components/list-view/block-select-button.js +11 -3
  273. package/build-module/components/list-view/block-select-button.js.map +1 -1
  274. package/build-module/components/list-view/branch.js.map +1 -1
  275. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  276. package/build-module/components/list-view/index.js.map +1 -1
  277. package/build-module/components/list-view/use-clipboard-handler.js +3 -2
  278. package/build-module/components/list-view/use-clipboard-handler.js.map +1 -1
  279. package/build-module/components/panel-color-settings/index.js.map +1 -1
  280. package/build-module/components/provider/index.js.map +1 -1
  281. package/build-module/components/resizable-box-popover/index.js +3 -5
  282. package/build-module/components/resizable-box-popover/index.js.map +1 -1
  283. package/build-module/components/responsive-block-control/index.js +1 -1
  284. package/build-module/components/responsive-block-control/index.js.map +1 -1
  285. package/build-module/components/rich-text/index.js +47 -28
  286. package/build-module/components/rich-text/index.js.map +1 -1
  287. package/build-module/components/rich-text/use-enter.js +3 -0
  288. package/build-module/components/rich-text/use-enter.js.map +1 -1
  289. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  290. package/build-module/components/url-popover/index.js +3 -3
  291. package/build-module/components/url-popover/index.js.map +1 -1
  292. package/build-module/components/writing-flow/use-clipboard-handler.js +3 -2
  293. package/build-module/components/writing-flow/use-clipboard-handler.js.map +1 -1
  294. package/build-module/components/writing-flow/utils.js +22 -7
  295. package/build-module/components/writing-flow/utils.js.map +1 -1
  296. package/build-module/hooks/background.js.map +1 -1
  297. package/build-module/hooks/block-hooks.js +34 -8
  298. package/build-module/hooks/block-hooks.js.map +1 -1
  299. package/build-module/hooks/border.js +7 -5
  300. package/build-module/hooks/border.js.map +1 -1
  301. package/build-module/hooks/dimensions.js +1 -2
  302. package/build-module/hooks/dimensions.js.map +1 -1
  303. package/build-module/hooks/font-size.js +7 -8
  304. package/build-module/hooks/font-size.js.map +1 -1
  305. package/build-module/hooks/index.js +1 -1
  306. package/build-module/hooks/index.js.map +1 -1
  307. package/build-module/hooks/layout-child.js +39 -0
  308. package/build-module/hooks/layout-child.js.map +1 -1
  309. package/build-module/hooks/layout.js +11 -4
  310. package/build-module/hooks/layout.js.map +1 -1
  311. package/build-module/hooks/line-height.js.map +1 -1
  312. package/build-module/hooks/spacing-visualizer.js +106 -0
  313. package/build-module/hooks/spacing-visualizer.js.map +1 -0
  314. package/build-module/hooks/use-bindings-attributes.js +172 -49
  315. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  316. package/build-module/hooks/use-typography-props.js +2 -3
  317. package/build-module/hooks/use-typography-props.js.map +1 -1
  318. package/build-module/layouts/grid.js +6 -2
  319. package/build-module/layouts/grid.js.map +1 -1
  320. package/build-module/private-apis.js +7 -3
  321. package/build-module/private-apis.js.map +1 -1
  322. package/build-module/store/actions.js +42 -12
  323. package/build-module/store/actions.js.map +1 -1
  324. package/build-module/store/private-actions.js +29 -54
  325. package/build-module/store/private-actions.js.map +1 -1
  326. package/build-module/store/private-selectors.js +0 -6
  327. package/build-module/store/private-selectors.js.map +1 -1
  328. package/build-module/store/reducer.js +3 -20
  329. package/build-module/store/reducer.js.map +1 -1
  330. package/build-module/store/selectors.js +23 -13
  331. package/build-module/store/selectors.js.map +1 -1
  332. package/build-module/utils/calculate-scale.js +11 -0
  333. package/build-module/utils/calculate-scale.js.map +1 -0
  334. package/build-style/content-rtl.css +8 -2
  335. package/build-style/content.css +8 -2
  336. package/build-style/default-editor-styles-rtl.css +1 -0
  337. package/build-style/default-editor-styles.css +1 -0
  338. package/build-style/style-rtl.css +113 -22
  339. package/build-style/style.css +113 -22
  340. package/package.json +31 -31
  341. package/src/components/block-actions/index.js +57 -47
  342. package/src/components/block-bindings-toolbar-indicator/index.js +20 -0
  343. package/src/components/block-bindings-toolbar-indicator/style.scss +14 -0
  344. package/src/components/block-draggable/test/index.native.js +2 -2
  345. package/src/components/block-edit/context.js +1 -0
  346. package/src/components/block-edit/index.js +5 -1
  347. package/src/components/block-inspector/index.js +7 -5
  348. package/src/components/block-list/block-invalid-warning.native.js +1 -1
  349. package/src/components/block-list/block-list-item.native.js +1 -1
  350. package/src/components/block-list/block-outline.native.js +36 -21
  351. package/src/components/block-list/block-selection-button.native.js +1 -3
  352. package/src/components/block-list/block.native.js +0 -3
  353. package/src/components/block-list/content.scss +5 -1
  354. package/src/components/block-list/test/block-outline.native.js +255 -0
  355. package/src/components/block-list/use-block-props/index.js +12 -2
  356. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -7
  357. package/src/components/block-mover/index.native.js +1 -1
  358. package/src/components/block-popover/cover.js +63 -0
  359. package/src/components/block-popover/drop-zone.js +3 -4
  360. package/src/components/block-popover/index.js +1 -28
  361. package/src/components/block-preview/index.js +3 -1
  362. package/src/components/block-removal-warning-modal/index.js +5 -19
  363. package/src/components/block-rename/modal.js +1 -1
  364. package/src/components/block-settings-menu/block-settings-dropdown.js +12 -9
  365. package/src/components/block-switcher/block-transformations-menu.native.js +1 -1
  366. package/src/components/block-toolbar/block-toolbar-menu.native.js +2 -2
  367. package/src/components/block-toolbar/index.js +19 -15
  368. package/src/components/block-toolbar/shuffle.js +93 -0
  369. package/src/components/block-toolbar/use-has-block-toolbar.js +49 -0
  370. package/src/components/block-tools/block-selection-button.js +4 -0
  371. package/src/components/block-tools/empty-block-inserter.js +3 -6
  372. package/src/components/block-tools/index.js +13 -36
  373. package/src/components/block-tools/use-show-block-tools.js +73 -0
  374. package/src/components/caption/index.native.js +1 -1
  375. package/src/components/child-layout-control/index.js +1 -1
  376. package/src/components/color-palette/control.js +1 -1
  377. package/src/components/colors-gradients/control.js +1 -1
  378. package/src/components/colors-gradients/test/control.js +2 -2
  379. package/src/components/contrast-checker/test/index.js +10 -10
  380. package/src/components/default-block-appender/content.scss +5 -2
  381. package/src/components/global-styles/border-panel.js +35 -24
  382. package/src/components/global-styles/color-panel.js +1 -1
  383. package/src/components/global-styles/image-settings-panel.js +1 -1
  384. package/src/components/global-styles/index.js +5 -1
  385. package/src/components/global-styles/shadow-panel-components.js +92 -23
  386. package/src/components/global-styles/style.scss +33 -10
  387. package/src/components/global-styles/test/typography-utils.js +231 -81
  388. package/src/components/global-styles/typography-utils.js +10 -7
  389. package/src/components/global-styles/use-global-styles-output.js +14 -16
  390. package/src/components/global-styles/utils.js +2 -8
  391. package/src/components/grid-visualizer/grid-item-resizer.js +100 -0
  392. package/src/components/grid-visualizer/grid-visualizer.js +81 -0
  393. package/src/components/grid-visualizer/index.js +2 -0
  394. package/src/components/grid-visualizer/style.scss +33 -0
  395. package/src/components/grid-visualizer/utils.js +5 -0
  396. package/src/components/iframe/index.js +78 -31
  397. package/src/components/index.native.js +1 -0
  398. package/src/components/inner-blocks/use-nested-settings-update.js +12 -2
  399. package/src/components/inserter/media-tab/media-preview.js +1 -1
  400. package/src/components/inserter/menu.js +10 -4
  401. package/src/components/inserter/menu.native.js +3 -3
  402. package/src/components/inserter/mobile-tab-navigation.js +1 -1
  403. package/src/components/inserter/search-results.js +2 -1
  404. package/src/components/inserter/style.scss +10 -0
  405. package/src/components/inserter/tabs.js +2 -1
  406. package/src/components/inspector-controls/block-support-tools-panel.js +2 -2
  407. package/src/components/inspector-controls-tabs/index.js +1 -1
  408. package/src/components/inspector-controls-tabs/styles-tab.js +2 -2
  409. package/src/components/line-height-control/test/index.js +1 -1
  410. package/src/components/link-control/link-preview.js +9 -2
  411. package/src/components/link-control/search-input.js +1 -1
  412. package/src/components/link-control/style.scss +9 -0
  413. package/src/components/list-view/block-select-button.js +16 -2
  414. package/src/components/list-view/branch.js +1 -1
  415. package/src/components/list-view/drop-indicator.js +1 -1
  416. package/src/components/list-view/index.js +1 -1
  417. package/src/components/list-view/style.scss +8 -0
  418. package/src/components/list-view/use-clipboard-handler.js +3 -2
  419. package/src/components/panel-color-settings/index.js +1 -1
  420. package/src/components/panel-color-settings/test/index.js +3 -3
  421. package/src/components/provider/index.js +1 -4
  422. package/src/components/resizable-box-popover/index.js +4 -6
  423. package/src/components/responsive-block-control/README.md +4 -4
  424. package/src/components/responsive-block-control/index.js +1 -1
  425. package/src/components/responsive-block-control/test/index.js +5 -5
  426. package/src/components/rich-text/index.js +76 -53
  427. package/src/components/rich-text/use-enter.js +4 -0
  428. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
  429. package/src/components/url-popover/index.js +5 -5
  430. package/src/components/url-popover/style.scss +1 -0
  431. package/src/components/writing-flow/use-clipboard-handler.js +3 -2
  432. package/src/components/writing-flow/utils.js +31 -16
  433. package/src/hooks/background.js +1 -1
  434. package/src/hooks/block-hooks.js +47 -9
  435. package/src/hooks/block-hooks.scss +6 -0
  436. package/src/hooks/border.js +16 -4
  437. package/src/hooks/dimensions.js +1 -2
  438. package/src/hooks/font-size.js +7 -12
  439. package/src/hooks/index.js +1 -0
  440. package/src/hooks/layout-child.js +38 -0
  441. package/src/hooks/layout.js +12 -1
  442. package/src/hooks/line-height.js +1 -1
  443. package/src/hooks/spacing-visualizer.js +126 -0
  444. package/src/hooks/{padding.scss → spacing.scss} +1 -1
  445. package/src/hooks/use-bindings-attributes.js +215 -65
  446. package/src/hooks/use-typography-props.js +2 -8
  447. package/src/layouts/grid.js +8 -3
  448. package/src/private-apis.js +6 -2
  449. package/src/store/actions.js +56 -18
  450. package/src/store/private-actions.js +34 -79
  451. package/src/store/private-selectors.js +0 -8
  452. package/src/store/reducer.js +2 -23
  453. package/src/store/selectors.js +41 -46
  454. package/src/store/test/actions.js +0 -4
  455. package/src/style.scss +3 -1
  456. package/src/utils/calculate-scale.js +20 -0
  457. package/build/hooks/margin.js +0 -86
  458. package/build/hooks/margin.js.map +0 -1
  459. package/build/hooks/padding.js +0 -78
  460. package/build/hooks/padding.js.map +0 -1
  461. package/build/utils/use-can-block-toolbar-be-focused.js +0 -46
  462. package/build/utils/use-can-block-toolbar-be-focused.js.map +0 -1
  463. package/build-module/hooks/margin.js +0 -78
  464. package/build-module/hooks/margin.js.map +0 -1
  465. package/build-module/hooks/padding.js +0 -70
  466. package/build-module/hooks/padding.js.map +0 -1
  467. package/build-module/utils/use-can-block-toolbar-be-focused.js +0 -40
  468. package/build-module/utils/use-can-block-toolbar-be-focused.js.map +0 -1
  469. package/src/hooks/margin.js +0 -91
  470. package/src/hooks/padding.js +0 -82
  471. package/src/utils/use-can-block-toolbar-be-focused.js +0 -48
@@ -0,0 +1,69 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { ResizableBox } from '@wordpress/components';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';
11
+ import BlockPopoverCover from '../block-popover/cover';
12
+ import { getComputedCSS } from './utils';
13
+ export function GridItemResizer({
14
+ clientId,
15
+ onChange
16
+ }) {
17
+ const blockElement = useBlockElement(clientId);
18
+ if (!blockElement) {
19
+ return null;
20
+ }
21
+ return createElement(BlockPopoverCover, {
22
+ className: "block-editor-grid-item-resizer",
23
+ clientId: clientId,
24
+ __unstablePopoverSlot: "block-toolbar"
25
+ }, createElement(ResizableBox, {
26
+ className: "block-editor-grid-item-resizer__box",
27
+ size: {
28
+ width: '100%',
29
+ height: '100%'
30
+ },
31
+ enable: {
32
+ bottom: true,
33
+ bottomLeft: false,
34
+ bottomRight: false,
35
+ left: false,
36
+ right: true,
37
+ top: false,
38
+ topLeft: false,
39
+ topRight: false
40
+ },
41
+ onResizeStop: (event, direction, boxElement) => {
42
+ const gridElement = blockElement.parentElement;
43
+ const columnGap = parseFloat(getComputedCSS(gridElement, 'column-gap'));
44
+ const rowGap = parseFloat(getComputedCSS(gridElement, 'row-gap'));
45
+ const gridColumnLines = getGridLines(getComputedCSS(gridElement, 'grid-template-columns'), columnGap);
46
+ const gridRowLines = getGridLines(getComputedCSS(gridElement, 'grid-template-rows'), rowGap);
47
+ const columnStart = getClosestLine(gridColumnLines, blockElement.offsetLeft);
48
+ const rowStart = getClosestLine(gridRowLines, blockElement.offsetTop);
49
+ const columnEnd = getClosestLine(gridColumnLines, blockElement.offsetLeft + boxElement.offsetWidth);
50
+ const rowEnd = getClosestLine(gridRowLines, blockElement.offsetTop + boxElement.offsetHeight);
51
+ onChange({
52
+ columnSpan: Math.max(columnEnd - columnStart, 1),
53
+ rowSpan: Math.max(rowEnd - rowStart, 1)
54
+ });
55
+ }
56
+ }));
57
+ }
58
+ function getGridLines(template, gap) {
59
+ const lines = [0];
60
+ for (const size of template.split(' ')) {
61
+ const line = parseFloat(size);
62
+ lines.push(lines[lines.length - 1] + line + gap);
63
+ }
64
+ return lines;
65
+ }
66
+ function getClosestLine(lines, position) {
67
+ return lines.reduce((closest, line, index) => Math.abs(line - position) < Math.abs(lines[closest] - position) ? index : closest, 0);
68
+ }
69
+ //# sourceMappingURL=grid-item-resizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ResizableBox","__unstableUseBlockElement","useBlockElement","BlockPopoverCover","getComputedCSS","GridItemResizer","clientId","onChange","blockElement","createElement","className","__unstablePopoverSlot","size","width","height","enable","bottom","bottomLeft","bottomRight","left","right","top","topLeft","topRight","onResizeStop","event","direction","boxElement","gridElement","parentElement","columnGap","parseFloat","rowGap","gridColumnLines","getGridLines","gridRowLines","columnStart","getClosestLine","offsetLeft","rowStart","offsetTop","columnEnd","offsetWidth","rowEnd","offsetHeight","columnSpan","Math","max","rowSpan","template","gap","lines","split","line","push","length","position","reduce","closest","index","abs"],"sources":["@wordpress/block-editor/src/components/grid-visualizer/grid-item-resizer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ResizableBox } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport BlockPopoverCover from '../block-popover/cover';\nimport { getComputedCSS } from './utils';\n\nexport function GridItemResizer( { clientId, onChange } ) {\n\tconst blockElement = useBlockElement( clientId );\n\tif ( ! blockElement ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<BlockPopoverCover\n\t\t\tclassName=\"block-editor-grid-item-resizer\"\n\t\t\tclientId={ clientId }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t>\n\t\t\t<ResizableBox\n\t\t\t\tclassName=\"block-editor-grid-item-resizer__box\"\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: '100%',\n\t\t\t\t\theight: '100%',\n\t\t\t\t} }\n\t\t\t\tenable={ {\n\t\t\t\t\tbottom: true,\n\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\tbottomRight: false,\n\t\t\t\t\tleft: false,\n\t\t\t\t\tright: true,\n\t\t\t\t\ttop: false,\n\t\t\t\t\ttopLeft: false,\n\t\t\t\t\ttopRight: false,\n\t\t\t\t} }\n\t\t\t\tonResizeStop={ ( event, direction, boxElement ) => {\n\t\t\t\t\tconst gridElement = blockElement.parentElement;\n\t\t\t\t\tconst columnGap = parseFloat(\n\t\t\t\t\t\tgetComputedCSS( gridElement, 'column-gap' )\n\t\t\t\t\t);\n\t\t\t\t\tconst rowGap = parseFloat(\n\t\t\t\t\t\tgetComputedCSS( gridElement, 'row-gap' )\n\t\t\t\t\t);\n\t\t\t\t\tconst gridColumnLines = getGridLines(\n\t\t\t\t\t\tgetComputedCSS( gridElement, 'grid-template-columns' ),\n\t\t\t\t\t\tcolumnGap\n\t\t\t\t\t);\n\t\t\t\t\tconst gridRowLines = getGridLines(\n\t\t\t\t\t\tgetComputedCSS( gridElement, 'grid-template-rows' ),\n\t\t\t\t\t\trowGap\n\t\t\t\t\t);\n\t\t\t\t\tconst columnStart = getClosestLine(\n\t\t\t\t\t\tgridColumnLines,\n\t\t\t\t\t\tblockElement.offsetLeft\n\t\t\t\t\t);\n\t\t\t\t\tconst rowStart = getClosestLine(\n\t\t\t\t\t\tgridRowLines,\n\t\t\t\t\t\tblockElement.offsetTop\n\t\t\t\t\t);\n\t\t\t\t\tconst columnEnd = getClosestLine(\n\t\t\t\t\t\tgridColumnLines,\n\t\t\t\t\t\tblockElement.offsetLeft + boxElement.offsetWidth\n\t\t\t\t\t);\n\t\t\t\t\tconst rowEnd = getClosestLine(\n\t\t\t\t\t\tgridRowLines,\n\t\t\t\t\t\tblockElement.offsetTop + boxElement.offsetHeight\n\t\t\t\t\t);\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\tcolumnSpan: Math.max( columnEnd - columnStart, 1 ),\n\t\t\t\t\t\trowSpan: Math.max( rowEnd - rowStart, 1 ),\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</BlockPopoverCover>\n\t);\n}\n\nfunction getGridLines( template, gap ) {\n\tconst lines = [ 0 ];\n\tfor ( const size of template.split( ' ' ) ) {\n\t\tconst line = parseFloat( size );\n\t\tlines.push( lines[ lines.length - 1 ] + line + gap );\n\t}\n\treturn lines;\n}\n\nfunction getClosestLine( lines, position ) {\n\treturn lines.reduce(\n\t\t( closest, line, index ) =>\n\t\t\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AAK,CAACM,MAAM,CAClB,CAAEC,OAAO,EAAEL,IAAI,EAAEM,KAAK,KACrBb,IAAI,CAACc,GAAG,CAAEP,IAAI,GAAGG,QAAS,CAAC,GAC3BV,IAAI,CAACc,GAAG,CAAET,KAAK,CAAEO,OAAO,CAAE,GAAGF,QAAS,CAAC,GACpCG,KAAK,GACLD,OAAO,EACX,CACD,CAAC;AACF"}
@@ -0,0 +1,73 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { useState, useEffect } from '@wordpress/element';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';
11
+ import BlockPopoverCover from '../block-popover/cover';
12
+ import { getComputedCSS } from './utils';
13
+ export function GridVisualizer({
14
+ clientId
15
+ }) {
16
+ const blockElement = useBlockElement(clientId);
17
+ if (!blockElement) {
18
+ return null;
19
+ }
20
+ return createElement(BlockPopoverCover, {
21
+ className: "block-editor-grid-visualizer",
22
+ clientId: clientId,
23
+ __unstablePopoverSlot: "block-toolbar"
24
+ }, createElement(GridVisualizerGrid, {
25
+ blockElement: blockElement
26
+ }));
27
+ }
28
+ function GridVisualizerGrid({
29
+ blockElement
30
+ }) {
31
+ const [gridInfo, setGridInfo] = useState(() => getGridInfo(blockElement));
32
+ useEffect(() => {
33
+ const observers = [];
34
+ for (const element of [blockElement, ...blockElement.children]) {
35
+ const observer = new window.ResizeObserver(() => {
36
+ setGridInfo(getGridInfo(blockElement));
37
+ });
38
+ observer.observe(element);
39
+ observers.push(observer);
40
+ }
41
+ return () => {
42
+ for (const observer of observers) {
43
+ observer.disconnect();
44
+ }
45
+ };
46
+ }, [blockElement]);
47
+ return createElement("div", {
48
+ className: "block-editor-grid-visualizer__grid",
49
+ style: gridInfo.style
50
+ }, Array.from({
51
+ length: gridInfo.numItems
52
+ }, (_, i) => createElement("div", {
53
+ key: i,
54
+ className: "block-editor-grid-visualizer__item"
55
+ })));
56
+ }
57
+ function getGridInfo(blockElement) {
58
+ const gridTemplateColumns = getComputedCSS(blockElement, 'grid-template-columns');
59
+ const gridTemplateRows = getComputedCSS(blockElement, 'grid-template-rows');
60
+ const numColumns = gridTemplateColumns.split(' ').length;
61
+ const numRows = gridTemplateRows.split(' ').length;
62
+ const numItems = numColumns * numRows;
63
+ return {
64
+ numItems,
65
+ style: {
66
+ gridTemplateColumns,
67
+ gridTemplateRows,
68
+ gap: getComputedCSS(blockElement, 'gap'),
69
+ padding: getComputedCSS(blockElement, 'padding')
70
+ }
71
+ };
72
+ }
73
+ //# sourceMappingURL=grid-visualizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useState","useEffect","__unstableUseBlockElement","useBlockElement","BlockPopoverCover","getComputedCSS","GridVisualizer","clientId","blockElement","createElement","className","__unstablePopoverSlot","GridVisualizerGrid","gridInfo","setGridInfo","getGridInfo","observers","element","children","observer","window","ResizeObserver","observe","push","disconnect","style","Array","from","length","numItems","_","i","key","gridTemplateColumns","gridTemplateRows","numColumns","split","numRows","gap","padding"],"sources":["@wordpress/block-editor/src/components/grid-visualizer/grid-visualizer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport BlockPopoverCover from '../block-popover/cover';\nimport { getComputedCSS } from './utils';\n\nexport function GridVisualizer( { clientId } ) {\n\tconst blockElement = useBlockElement( clientId );\n\tif ( ! blockElement ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<BlockPopoverCover\n\t\t\tclassName=\"block-editor-grid-visualizer\"\n\t\t\tclientId={ clientId }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t>\n\t\t\t<GridVisualizerGrid blockElement={ blockElement } />\n\t\t</BlockPopoverCover>\n\t);\n}\n\nfunction GridVisualizerGrid( { blockElement } ) {\n\tconst [ gridInfo, setGridInfo ] = useState( () =>\n\t\tgetGridInfo( blockElement )\n\t);\n\tuseEffect( () => {\n\t\tconst observers = [];\n\t\tfor ( const element of [ blockElement, ...blockElement.children ] ) {\n\t\t\tconst observer = new window.ResizeObserver( () => {\n\t\t\t\tsetGridInfo( getGridInfo( blockElement ) );\n\t\t\t} );\n\t\t\tobserver.observe( element );\n\t\t\tobservers.push( observer );\n\t\t}\n\t\treturn () => {\n\t\t\tfor ( const observer of observers ) {\n\t\t\t\tobserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [ blockElement ] );\n\treturn (\n\t\t<div\n\t\t\tclassName=\"block-editor-grid-visualizer__grid\"\n\t\t\tstyle={ gridInfo.style }\n\t\t>\n\t\t\t{ Array.from( { length: gridInfo.numItems }, ( _, i ) => (\n\t\t\t\t<div key={ i } className=\"block-editor-grid-visualizer__item\" />\n\t\t\t) ) }\n\t\t</div>\n\t);\n}\n\nfunction getGridInfo( blockElement ) {\n\tconst gridTemplateColumns = getComputedCSS(\n\t\tblockElement,\n\t\t'grid-template-columns'\n\t);\n\tconst gridTemplateRows = getComputedCSS(\n\t\tblockElement,\n\t\t'grid-template-rows'\n\t);\n\tconst numColumns = gridTemplateColumns.split( ' ' ).length;\n\tconst numRows = gridTemplateRows.split( ' ' ).length;\n\tconst numItems = numColumns * numRows;\n\treturn {\n\t\tnumItems,\n\t\tstyle: {\n\t\t\tgridTemplateColumns,\n\t\t\tgridTemplateRows,\n\t\t\tgap: getComputedCSS( blockElement, 'gap' ),\n\t\t\tpadding: getComputedCSS( blockElement, 'padding' ),\n\t\t},\n\t};\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;;AAExD;AACA;AACA;AACA,SAASC,yBAAyB,IAAIC,eAAe,QAAQ,8CAA8C;AAC3G,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,SAASC,cAAc,QAAQ,SAAS;AAExC,OAAO,SAASC,cAAcA,CAAE;EAA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B,aAAA;IAAKuB,GAAG,EAAGD,CAAG;IAACrB,SAAS,EAAC;EAAoC,CAAE,CAC9D,CACE,CAAC;AAER;AAEA,SAASK,WAAWA,CAAEP,YAAY,EAAG;EACpC,MAAMyB,mBAAmB,GAAG5B,cAAc,CACzCG,YAAY,EACZ,uBACD,CAAC;EACD,MAAM0B,gBAAgB,GAAG7B,cAAc,CACtCG,YAAY,EACZ,oBACD,CAAC;EACD,MAAM2B,UAAU,GAAGF,mBAAmB,CAACG,KAAK,CAAE,GAAI,CAAC,CAACR,MAAM;EAC1D,MAAMS,OAAO,GAAGH,gBAAgB,CAACE,KAAK,CAAE,GAAI,CAAC,CAACR,MAAM;EACpD,MAAMC,QAAQ,GAAGM,UAAU,GAAGE,OAAO;EACrC,OAAO;IACNR,QAAQ;IACRJ,KAAK,EAAE;MACNQ,mBAAmB;MACnBC,gBAAgB;MAChBI,GAAG,EAAEjC,cAAc,CAAEG,YAAY,EAAE,KAAM,CAAC;MAC1C+B,OAAO,EAAElC,cAAc,CAAEG,YAAY,EAAE,SAAU;IAClD;EACD,CAAC;AACF"}
@@ -0,0 +1,3 @@
1
+ export { GridVisualizer } from './grid-visualizer';
2
+ export { GridItemResizer } from './grid-item-resizer';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["GridVisualizer","GridItemResizer"],"sources":["@wordpress/block-editor/src/components/grid-visualizer/index.js"],"sourcesContent":["export { GridVisualizer } from './grid-visualizer';\nexport { GridItemResizer } from './grid-item-resizer';\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,mBAAmB;AAClD,SAASC,eAAe,QAAQ,qBAAqB"}
@@ -0,0 +1,4 @@
1
+ export function getComputedCSS(element, property) {
2
+ return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property);
3
+ }
4
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getComputedCSS","element","property","ownerDocument","defaultView","getComputedStyle","getPropertyValue"],"sources":["@wordpress/block-editor/src/components/grid-visualizer/utils.js"],"sourcesContent":["export function getComputedCSS( element, property ) {\n\treturn element.ownerDocument.defaultView\n\t\t.getComputedStyle( element )\n\t\t.getPropertyValue( property );\n}\n"],"mappings":"AAAA,OAAO,SAASA,cAAcA,CAAEC,OAAO,EAAEC,QAAQ,EAAG;EACnD,OAAOD,OAAO,CAACE,aAAa,CAACC,WAAW,CACtCC,gBAAgB,CAAEJ,OAAQ,CAAC,CAC3BK,gBAAgB,CAAEJ,QAAS,CAAC;AAC/B"}
@@ -20,6 +20,7 @@ import { useBlockSelectionClearer } from '../block-selection-clearer';
20
20
  import { useWritingFlow } from '../writing-flow';
21
21
  import { getCompatibilityStyles } from './get-compatibility-styles';
22
22
  import { store as blockEditorStore } from '../../store';
23
+ import calculateScale from '../../utils/calculate-scale';
23
24
  function bubbleEvent(event, Constructor, frame) {
24
25
  const init = {};
25
26
  for (const key in event) {
@@ -92,21 +93,26 @@ function Iframe({
92
93
  contentRef,
93
94
  children,
94
95
  tabIndex = 0,
95
- scale = 1,
96
- frameSize = 0,
97
- expand = false,
96
+ shouldZoom = false,
98
97
  readonly,
99
98
  forwardedRef: ref,
99
+ title = __('Editor canvas'),
100
100
  ...props
101
101
  }) {
102
102
  const {
103
103
  resolvedAssets,
104
- isPreviewMode
104
+ isPreviewMode,
105
+ isZoomOutMode
105
106
  } = useSelect(select => {
106
- const settings = select(blockEditorStore).getSettings();
107
+ const {
108
+ getSettings,
109
+ __unstableGetEditorMode
110
+ } = select(blockEditorStore);
111
+ const settings = getSettings();
107
112
  return {
108
113
  resolvedAssets: settings.__unstableResolvedAssets,
109
- isPreviewMode: settings.__unstableIsPreviewMode
114
+ isPreviewMode: settings.__unstableIsPreviewMode,
115
+ isZoomOutMode: __unstableGetEditorMode() === 'zoom-out'
110
116
  };
111
117
  }, []);
112
118
  const {
@@ -118,8 +124,21 @@ function Iframe({
118
124
  const clearerRef = useBlockSelectionClearer();
119
125
  const [before, writingFlowRef, after] = useWritingFlow();
120
126
  const [contentResizeListener, {
121
- height: contentHeight
127
+ height: contentHeight,
128
+ width: contentWidth
122
129
  }] = useResizeObserver();
130
+
131
+ // When zoom-out mode is enabled, the iframe is scaled down to fit the
132
+ // content within the viewport.
133
+ // At 1000px wide, the iframe is scaled to 45%.
134
+ // At 400px wide, the iframe is scaled to 90%.
135
+ const scale = isZoomOutMode && shouldZoom ? calculateScale({
136
+ maxWidth: 1000,
137
+ minWidth: 400,
138
+ maxScale: 0.45,
139
+ minScale: 0.9
140
+ }, contentWidth) : 1;
141
+ const frameSize = isZoomOutMode ? 100 : 0;
123
142
  const setRef = useRefEffect(node => {
124
143
  node._load = () => {
125
144
  setIframeDocument(node.contentDocument);
@@ -138,6 +157,7 @@ function Iframe({
138
157
  documentElement
139
158
  } = contentDocument;
140
159
  iFrameDocument = contentDocument;
160
+ documentElement.classList.add('block-editor-iframe__html');
141
161
  clearerRef(documentElement);
142
162
 
143
163
  // Ideally ALL classes that are added through get_body_class should
@@ -179,7 +199,19 @@ function Iframe({
179
199
  <head>
180
200
  <meta charset="utf-8">
181
201
  <script>window.frameElement._load()</script>
182
- <style>html{height:auto!important;min-height:100%;}body{margin:0}</style>
202
+ <style>
203
+ html{
204
+ height: auto !important;
205
+ min-height: 100%;
206
+ }
207
+
208
+ body {
209
+ margin: 0;
210
+ /* Default background color in case zoom out mode background
211
+ colors the html element */
212
+ background: white;
213
+ }
214
+ </style>
183
215
  ${styles}
184
216
  ${scripts}
185
217
  </head>
@@ -199,15 +231,28 @@ function Iframe({
199
231
  // is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the
200
232
  // top or bottom margin is 0.55 / 2 ((1 - scale) / 2).
201
233
  const marginFromScaling = contentHeight * (1 - scale) / 2;
202
- return createElement(Fragment, null, tabIndex >= 0 && before, createElement("iframe", {
234
+ useEffect(() => {
235
+ if (iframeDocument && scale !== 1) {
236
+ iframeDocument.documentElement.style.transform = `scale( ${scale} )`;
237
+ iframeDocument.documentElement.style.marginTop = `${frameSize}px`;
238
+ iframeDocument.documentElement.style.marginBottom = `${-marginFromScaling * 2 + frameSize}px`;
239
+ return () => {
240
+ iframeDocument.documentElement.style.transform = '';
241
+ iframeDocument.documentElement.style.marginTop = '';
242
+ iframeDocument.documentElement.style.marginBottom = '';
243
+ };
244
+ }
245
+ }, [scale, frameSize, marginFromScaling, iframeDocument]);
246
+
247
+ // Make sure to not render the before and after focusable div elements in view
248
+ // mode. They're only needed to capture focus in edit mode.
249
+ const shouldRenderFocusCaptureElements = tabIndex >= 0 && !isPreviewMode;
250
+ return createElement(Fragment, null, shouldRenderFocusCaptureElements && before, createElement("iframe", {
203
251
  ...props,
204
252
  style: {
205
253
  border: 0,
206
254
  ...props.style,
207
- height: expand ? contentHeight : props.style?.height,
208
- marginTop: scale !== 1 ? -marginFromScaling + frameSize : props.style?.marginTop,
209
- marginBottom: scale !== 1 ? -marginFromScaling + frameSize : props.style?.marginBottom,
210
- transform: scale !== 1 ? `scale( ${scale} )` : props.style?.transform,
255
+ height: props.style?.height,
211
256
  transition: 'all .3s'
212
257
  },
213
258
  ref: useMergeRefs([ref, setRef]),
@@ -217,7 +262,7 @@ function Iframe({
217
262
  // content.
218
263
  ,
219
264
  src: src,
220
- title: __('Editor canvas'),
265
+ title: title,
221
266
  onKeyDown: event => {
222
267
  if (props.onKeyDown) {
223
268
  props.onKeyDown(event);
@@ -228,7 +273,7 @@ function Iframe({
228
273
  // though by doing so we also trigger another React event,
229
274
  // so we need to stop the propagation of this event to avoid
230
275
  // duplication.
231
- else if (event.currentTarget.ownerDocument !== event.target.ownerDocument) {
276
+ if (event.currentTarget.ownerDocument !== event.target.ownerDocument) {
232
277
  event.stopPropagation();
233
278
  bubbleEvent(event, window.KeyboardEvent, event.currentTarget);
234
279
  }
@@ -242,7 +287,7 @@ function Iframe({
242
287
  className: classnames('block-editor-iframe__body', 'editor-styles-wrapper', ...bodyClasses)
243
288
  }, contentResizeListener, createElement(StyleProvider, {
244
289
  document: iframeDocument
245
- }, children)), iframeDocument.documentElement)), tabIndex >= 0 && after);
290
+ }, children)), iframeDocument.documentElement)), shouldRenderFocusCaptureElements && after);
246
291
  }
247
292
  function IframeIfReady(props, ref) {
248
293
  const isInitialised = useSelect(select => select(blockEditorStore).getSettings().__internalIsInitialized, []);
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","useState","createPortal","forwardRef","useMemo","useEffect","__","useResizeObserver","useMergeRefs","useRefEffect","useDisabled","__experimentalStyleProvider","StyleProvider","useSelect","useBlockSelectionClearer","useWritingFlow","getCompatibilityStyles","store","blockEditorStore","bubbleEvent","event","Constructor","frame","init","key","contentDocument","defaultView","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","defaultPrevented","preventDefault","cancelled","dispatchEvent","useBubbleEvents","iframeDocument","frameElement","html","documentElement","eventTypes","handlers","name","prototype","Object","getPrototypeOf","constructorName","constructor","window","addEventListener","removeEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","expand","readonly","forwardedRef","ref","props","resolvedAssets","isPreviewMode","select","settings","getSettings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","setIframeDocument","bodyClasses","setBodyClasses","clearerRef","before","writingFlowRef","after","contentResizeListener","height","contentHeight","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","Array","from","body","classList","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","disabledRef","isDisabled","bodyRef","src","cleanup","_src","URL","createObjectURL","Blob","revokeObjectURL","marginFromScaling","createElement","Fragment","style","border","marginTop","marginBottom","transform","transition","title","onKeyDown","currentTarget","target","stopPropagation","KeyboardEvent","className","document","IframeIfReady","isInitialised","__internalIsInitialized"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\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\texpand = false,\n\treadonly,\n\tforwardedRef: ref,\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst settings = select( blockEditorStore ).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 [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\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\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 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] );\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>html{height:auto!important;min-height:100%;}body{margin:0}</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\t// We need to counter the margin created by scaling the iframe. If the scale\n\t// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the\n\t// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).\n\tconst marginFromScaling = ( contentHeight * ( 1 - scale ) ) / 2;\n\n\treturn (\n\t\t<>\n\t\t\t{ tabIndex >= 0 && 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: expand ? contentHeight : props.style?.height,\n\t\t\t\t\tmarginTop:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginTop,\n\t\t\t\t\tmarginBottom:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginBottom,\n\t\t\t\t\ttransform:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? `scale( ${ scale } )`\n\t\t\t\t\t\t\t: props.style?.transform,\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={ __( 'Editor canvas' ) }\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\telse if (\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\tevent.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={ classnames(\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{ tabIndex >= 0 && after }\n\t\t</>\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":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,QAAQ,EACRC,YAAY,EACZC,UAAU,EACVC,OAAO,EACPC,SAAS,QACH,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,iBAAiB,EACjBC,YAAY,EACZC,YAAY,EACZC,WAAW,QACL,oBAAoB;AAC3B,SAASC,2BAA2B,IAAIC,aAAa,QAAQ,uBAAuB;AACpF,SAASC,SAA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,OAAOjB,aAAA,CAAC/D,MAAM;IAAA,GAAMU,KAAK;IAAGF,YAAY,EAAGC;EAAK,CAAE,CAAC;AACpD;AAEA,eAAe9D,UAAU,CAAEoI,aAAc,CAAC"}
1
+ {"version":3,"names":["classnames","useState","createPortal","forwardRef","useMemo","useEffect","__","useResizeObserver","useMergeRefs","useRefEffect","useDisabled","__experimentalStyleProvider","StyleProvider","useSelect","useBlockSelectionClearer","useWritingFlow","getCompatibilityStyles","store","blockEditorStore","calculateScale","bubbleEvent","event","Constructor","frame","init","key","contentDocument","defaultView","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","defaultPrevented","preventDefault","cancelled","dispatchEvent","useBubbleEvents","iframeDocument","frameElement","html","documentElement","eventTypes","handlers","name","prototype","Object","getPrototypeOf","constructorName","constructor","window","addEventListener","removeEventListener","Iframe","contentRef","children","tabIndex","shouldZoom","readonly","forwardedRef","ref","title","props","resolvedAssets","isPreviewMode","isZoomOutMode","select","getSettings","__unstableGetEditorMode","settings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","setIframeDocument","bodyClasses","setBodyClasses","clearerRef","before","writingFlowRef","after","contentResizeListener","height","contentHeight","width","contentWidth","scale","maxWidth","minWidth","maxScale","minScale","frameSize","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","classList","add","Array","from","body","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","disabledRef","isDisabled","bodyRef","src","cleanup","_src","URL","createObjectURL","Blob","revokeObjectURL","marginFromScaling","style","transform","marginTop","marginBottom","shouldRenderFocusCaptureElements","createElement","Fragment","border","transition","onKeyDown","currentTarget","target","stopPropagation","KeyboardEvent","className","document","IframeIfReady","isInitialised","__internalIsInitialized"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\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';\nimport calculateScale from '../../utils/calculate-scale';\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\tshouldZoom = false,\n\treadonly,\n\tforwardedRef: ref,\n\ttitle = __( 'Editor canvas' ),\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode, isZoomOutMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, __unstableGetEditorMode } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst settings = getSettings();\n\t\t\treturn {\n\t\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t\t\tisZoomOutMode: __unstableGetEditorMode() === 'zoom-out',\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [\n\t\tcontentResizeListener,\n\t\t{ height: contentHeight, width: contentWidth },\n\t] = useResizeObserver();\n\n\t// When zoom-out mode is enabled, the iframe is scaled down to fit the\n\t// content within the viewport.\n\t// At 1000px wide, the iframe is scaled to 45%.\n\t// At 400px wide, the iframe is scaled to 90%.\n\tconst scale =\n\t\tisZoomOutMode && shouldZoom\n\t\t\t? calculateScale(\n\t\t\t\t\t{\n\t\t\t\t\t\tmaxWidth: 1000,\n\t\t\t\t\t\tminWidth: 400,\n\t\t\t\t\t\tmaxScale: 0.45,\n\t\t\t\t\t\tminScale: 0.9,\n\t\t\t\t\t},\n\t\t\t\t\tcontentWidth\n\t\t\t )\n\t\t\t: 1;\n\tconst frameSize = isZoomOutMode ? 100 : 0;\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 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] );\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\n\t\t\tbody {\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: 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\t// We need to counter the margin created by scaling the iframe. If the scale\n\t// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the\n\t// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).\n\tconst marginFromScaling = ( contentHeight * ( 1 - scale ) ) / 2;\n\n\tuseEffect( () => {\n\t\tif ( iframeDocument && scale !== 1 ) {\n\t\t\tiframeDocument.documentElement.style.transform = `scale( ${ scale } )`;\n\t\t\tiframeDocument.documentElement.style.marginTop = `${ frameSize }px`;\n\t\t\tiframeDocument.documentElement.style.marginBottom = `${\n\t\t\t\t-marginFromScaling * 2 + frameSize\n\t\t\t}px`;\n\t\t\treturn () => {\n\t\t\t\tiframeDocument.documentElement.style.transform = '';\n\t\t\t\tiframeDocument.documentElement.style.marginTop = '';\n\t\t\t\tiframeDocument.documentElement.style.marginBottom = '';\n\t\t\t};\n\t\t}\n\t}, [ scale, frameSize, marginFromScaling, iframeDocument ] );\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\treturn (\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\tevent.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={ classnames(\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\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":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,QAAQ,EACRC,YAAY,EACZC,UAAU,EACVC,OAAO,EACPC,SAAS,QACH,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,iBAAiB,EACjBC,YAAY,EACZC,YAAY,EACZC,WAAW,QACL,oBAAoB;AAC3B,SAASC,2BAA2B,IAAIC,aAAa,QAAQ,uBAAuB;AACpF,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,sBAAsB,QAAQ,4BAA4B;AACnE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,cAAc,MAAM,6BAA6B;AACxD,SAASC,WAAWA,CAAEC,KA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AAK,CAACuH,aACP,CAAC;MACF;IACD;EAAG,GAEDlG,cAAc,IACfxC,YAAY;EACX;EACA;EACA;EACAqI,aAAA;IACCvE,GAAG,EAAGyD,OAAS;IACfuB,SAAS,EAAGhJ,UAAU,CACrB,2BAA2B,EAC3B,uBAAuB,EACvB,GAAG+E,WACJ;EAAG,GAEDM,qBAAqB,EACvBkD,aAAA,CAAC3H,aAAa;IAACqI,QAAQ,EAAGvG;EAAgB,GACvCiB,QACY,CACV,CAAC,EACPjB,cAAc,CAACG,eAChB,CACM,CAAC,EACPyF,gCAAgC,IAAIlD,KACrC,CAAC;AAEL;AAEA,SAAS8D,aAAaA,CAAEhF,KAAK,EAAEF,GAAG,EAAG;EACpC,MAAMmF,aAAa,GAAGtI,SAAS,CAC5ByD,MAAM,IACPA,MAAM,CAAEpD,gBAAiB,CAAC,CAACqD,WAAW,CAAC,CAAC,CAAC6E,uBAAuB,EACjE,EACD,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,OAAOZ,aAAA,CAAC9E,MAAM;IAAA,GAAMS,KAAK;IAAGH,YAAY,EAAGC;EAAK,CAAE,CAAC;AACpD;AAEA,eAAe7D,UAAU,CAAE+I,aAAc,CAAC"}
@@ -21,7 +21,7 @@ export { default as MediaPlaceholder } from './media-placeholder';
21
21
  export { default as MediaUpload } from './media-upload';
22
22
  export { MEDIA_TYPE_IMAGE, MEDIA_TYPE_VIDEO, MEDIA_TYPE_AUDIO, MEDIA_TYPE_ANY } from './media-upload/constants';
23
23
  export { default as MediaUploadProgress } from './media-upload-progress';
24
- export { MEDIA_UPLOAD_STATE_UPLOADING, MEDIA_UPLOAD_STATE_SUCCEEDED, MEDIA_UPLOAD_STATE_FAILED, MEDIA_UPLOAD_STATE_RESET } from './media-upload-progress/constants';
24
+ export { MEDIA_UPLOAD_STATE_UPLOADING, MEDIA_UPLOAD_STATE_SUCCEEDED, MEDIA_UPLOAD_STATE_PAUSED, MEDIA_UPLOAD_STATE_FAILED, MEDIA_UPLOAD_STATE_RESET } from './media-upload-progress/constants';
25
25
  export { default as BlockMediaUpdateProgress } from './block-media-update-progress';
26
26
  export { default as URLInput } from './url-input';
27
27
  export { default as BlockInvalidWarning } from './block-list/block-invalid-warning';
@@ -1 +1 @@
1
- {"version":3,"names":["BlockAlignmentControl","BlockAlignmentToolbar","BlockContextProvider","default","BlockControls","BlockFormatControls","BlockEdit","useBlockEditContext","BlockIcon","BlockVerticalAlignmentToolbar","BlockVerticalAlignmentControl","AlignmentControl","AlignmentToolbar","InnerBlocks","useInnerBlocksProps","InspectorControls","InspectorAdvancedControls","JustifyToolbar","JustifyContentControl","LineHeightControl","HeadingLevelDropdown","PlainText","RichText","RichTextShortcut","RichTextToolbarButton","__unstableRichTextInputEvent","MediaReplaceFlow","MediaPlaceholder","MediaUpload","MEDIA_TYPE_IMAGE","MEDIA_TYPE_VIDEO","MEDIA_TYPE_AUDIO","MEDIA_TYPE_ANY","MediaUploadProgress","MEDIA_UPLOAD_STATE_UPLOADING","MEDIA_UPLOAD_STATE_SUCCEEDED","MEDIA_UPLOAD_STATE_FAILED","MEDIA_UPLOAD_STATE_RESET","BlockMediaUpdateProgress","URLInput","BlockInvalidWarning","BlockCaption","Caption","PanelColorSettings","__experimentalPanelColorGradientSettings","useSettings","useSetting","RecursionProvider","DeprecatedExperimentalRecursionProvider","__experimentalRecursionProvider","useHasRecursion","DeprecatedExperimentalUseHasRecursion","__experimentalUseHasRecursion","Warning","ContrastChecker","useMultipleOriginColorsAndGradients","UnsupportedBlockDetails","BottomSheetSettings","BlockSettingsButton","blockSettingsScreens","VideoPlayer","VIDEO_ASPECT_RATIO","getSpacingPresetCssVar","getCustomValueFromPreset","isValueSpacingPreset","BlockList","BlockMover","BlockToolbar","BlockVariationPicker","BlockStyles","DefaultBlockAppender","__unstableEditorStyles","Inserter","InserterButton","useBlockProps","FloatingToolbar","BlockEditorProvider"],"sources":["@wordpress/block-editor/src/components/index.native.js"],"sourcesContent":["// Block Creation Components.\nexport {\n\tBlockAlignmentControl,\n\tBlockAlignmentToolbar,\n} from './block-alignment-control';\nexport { BlockContextProvider } from './block-context';\nexport {\n\tdefault as BlockControls,\n\tBlockFormatControls,\n} from './block-controls';\nexport { default as BlockEdit, useBlockEditContext } from './block-edit';\nexport { default as BlockIcon } from './block-icon';\nexport {\n\tBlockVerticalAlignmentToolbar,\n\tBlockVerticalAlignmentControl,\n} from './block-vertical-alignment-control';\nexport * from './colors';\nexport * from './gradients';\nexport * from './font-sizes';\nexport { AlignmentControl, AlignmentToolbar } from './alignment-control';\nexport { default as InnerBlocks, useInnerBlocksProps } from './inner-blocks';\nexport {\n\tdefault as InspectorControls,\n\tInspectorAdvancedControls,\n} from './inspector-controls';\nexport {\n\tJustifyToolbar,\n\tJustifyContentControl,\n} from './justify-content-control';\nexport { default as LineHeightControl } from './line-height-control';\nexport { default as HeadingLevelDropdown } from './block-heading-level-dropdown';\nexport { default as PlainText } from './plain-text';\nexport {\n\tdefault as RichText,\n\tRichTextShortcut,\n\tRichTextToolbarButton,\n\t__unstableRichTextInputEvent,\n} from './rich-text';\nexport { default as MediaReplaceFlow } from './media-replace-flow';\nexport { default as MediaPlaceholder } from './media-placeholder';\nexport { default as MediaUpload } from './media-upload';\nexport {\n\tMEDIA_TYPE_IMAGE,\n\tMEDIA_TYPE_VIDEO,\n\tMEDIA_TYPE_AUDIO,\n\tMEDIA_TYPE_ANY,\n} from './media-upload/constants';\nexport { default as MediaUploadProgress } from './media-upload-progress';\nexport {\n\tMEDIA_UPLOAD_STATE_UPLOADING,\n\tMEDIA_UPLOAD_STATE_SUCCEEDED,\n\tMEDIA_UPLOAD_STATE_FAILED,\n\tMEDIA_UPLOAD_STATE_RESET,\n} from './media-upload-progress/constants';\nexport { default as BlockMediaUpdateProgress } from './block-media-update-progress';\nexport { default as URLInput } from './url-input';\nexport { default as BlockInvalidWarning } from './block-list/block-invalid-warning';\nexport { default as BlockCaption } from './block-caption';\nexport { default as Caption } from './caption';\nexport { default as PanelColorSettings } from './panel-color-settings';\nexport { default as __experimentalPanelColorGradientSettings } from './colors-gradients/panel-color-gradient-settings';\nexport { useSettings, default as useSetting } from './use-settings';\nexport {\n\tRecursionProvider,\n\tDeprecatedExperimentalRecursionProvider as __experimentalRecursionProvider,\n\tuseHasRecursion,\n\tDeprecatedExperimentalUseHasRecursion as __experimentalUseHasRecursion,\n} from './recursion-provider';\nexport { default as Warning } from './warning';\nexport { default as ContrastChecker } from './contrast-checker';\nexport { default as useMultipleOriginColorsAndGradients } from './colors-gradients/use-multiple-origin-colors-and-gradients';\nexport { default as UnsupportedBlockDetails } from './unsupported-block-details';\n\nexport {\n\tBottomSheetSettings,\n\tBlockSettingsButton,\n\tblockSettingsScreens,\n} from './block-settings';\nexport { default as VideoPlayer, VIDEO_ASPECT_RATIO } from './video-player';\n\nexport {\n\tgetSpacingPresetCssVar,\n\tgetCustomValueFromPreset,\n\tisValueSpacingPreset,\n} from './spacing-sizes-control/utils';\n// Content Related Components.\nexport { default as BlockList } from './block-list';\nexport { default as BlockMover } from './block-mover';\nexport { default as BlockToolbar } from './block-toolbar';\nexport { default as BlockVariationPicker } from './block-variation-picker';\nexport { default as BlockStyles } from './block-styles';\nexport { default as DefaultBlockAppender } from './default-block-appender';\nexport { default as __unstableEditorStyles } from './editor-styles';\nexport { default as Inserter } from './inserter';\nexport { default as InserterButton } from './inserter-button';\nexport { useBlockProps } from './block-list/use-block-props';\nexport { default as FloatingToolbar } from './floating-toolbar';\n\n// State Related Components.\nexport { default as BlockEditorProvider } from './provider';\n"],"mappings":"AAAA;AACA,SACCA,qBAAqB,EACrBC,qBAAqB,QACf,2BAA2B;AAClC,SAASC,oBAAoB,QAAQ,iBAAiB;AACtD,SACCC,OAAO,IAAIC,aAAa,EACxBC,mBAAmB,QACb,kBAAkB;AACzB,SAASF,OAAO,IAAIG,SAAS,EAAEC,mBAAmB,QAAQ,cAAc;AACxE,SAASJ,O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OAAO,IAAIyE,mBAAmB,QAAQ,YAAY"}
1
+ {"version":3,"names":["BlockAlignmentControl","BlockAlignmentToolbar","BlockContextProvider","default","BlockControls","BlockFormatControls","BlockEdit","useBlockEditContext","BlockIcon","BlockVerticalAlignmentToolbar","BlockVerticalAlignmentControl","AlignmentControl","AlignmentToolbar","InnerBlocks","useInnerBlocksProps","InspectorControls","InspectorAdvancedControls","JustifyToolbar","JustifyContentControl","LineHeightControl","HeadingLevelDropdown","PlainText","RichText","RichTextShortcut","RichTextToolbarButton","__unstableRichTextInputEvent","MediaReplaceFlow","MediaPlaceholder","MediaUpload","MEDIA_TYPE_IMAGE","MEDIA_TYPE_VIDEO","MEDIA_TYPE_AUDIO","MEDIA_TYPE_ANY","MediaUploadProgress","MEDIA_UPLOAD_STATE_UPLOADING","MEDIA_UPLOAD_STATE_SUCCEEDED","MEDIA_UPLOAD_STATE_PAUSED","MEDIA_UPLOAD_STATE_FAILED","MEDIA_UPLOAD_STATE_RESET","BlockMediaUpdateProgress","URLInput","BlockInvalidWarning","BlockCaption","Caption","PanelColorSettings","__experimentalPanelColorGradientSettings","useSettings","useSetting","RecursionProvider","DeprecatedExperimentalRecursionProvider","__experimentalRecursionProvider","useHasRecursion","DeprecatedExperimentalUseHasRecursion","__experimentalUseHasRecursion","Warning","ContrastChecker","useMultipleOriginColorsAndGradients","UnsupportedBlockDetails","BottomSheetSettings","BlockSettingsButton","blockSettingsScreens","VideoPlayer","VIDEO_ASPECT_RATIO","getSpacingPresetCssVar","getCustomValueFromPreset","isValueSpacingPreset","BlockList","BlockMover","BlockToolbar","BlockVariationPicker","BlockStyles","DefaultBlockAppender","__unstableEditorStyles","Inserter","InserterButton","useBlockProps","FloatingToolbar","BlockEditorProvider"],"sources":["@wordpress/block-editor/src/components/index.native.js"],"sourcesContent":["// Block Creation Components.\nexport {\n\tBlockAlignmentControl,\n\tBlockAlignmentToolbar,\n} from './block-alignment-control';\nexport { BlockContextProvider } from './block-context';\nexport {\n\tdefault as BlockControls,\n\tBlockFormatControls,\n} from './block-controls';\nexport { default as BlockEdit, useBlockEditContext } from './block-edit';\nexport { default as BlockIcon } from './block-icon';\nexport {\n\tBlockVerticalAlignmentToolbar,\n\tBlockVerticalAlignmentControl,\n} from './block-vertical-alignment-control';\nexport * from './colors';\nexport * from './gradients';\nexport * from './font-sizes';\nexport { AlignmentControl, AlignmentToolbar } from './alignment-control';\nexport { default as InnerBlocks, useInnerBlocksProps } from './inner-blocks';\nexport {\n\tdefault as InspectorControls,\n\tInspectorAdvancedControls,\n} from './inspector-controls';\nexport {\n\tJustifyToolbar,\n\tJustifyContentControl,\n} from './justify-content-control';\nexport { default as LineHeightControl } from './line-height-control';\nexport { default as HeadingLevelDropdown } from './block-heading-level-dropdown';\nexport { default as PlainText } from './plain-text';\nexport {\n\tdefault as RichText,\n\tRichTextShortcut,\n\tRichTextToolbarButton,\n\t__unstableRichTextInputEvent,\n} from './rich-text';\nexport { default as MediaReplaceFlow } from './media-replace-flow';\nexport { default as MediaPlaceholder } from './media-placeholder';\nexport { default as MediaUpload } from './media-upload';\nexport {\n\tMEDIA_TYPE_IMAGE,\n\tMEDIA_TYPE_VIDEO,\n\tMEDIA_TYPE_AUDIO,\n\tMEDIA_TYPE_ANY,\n} from './media-upload/constants';\nexport { default as MediaUploadProgress } from './media-upload-progress';\nexport {\n\tMEDIA_UPLOAD_STATE_UPLOADING,\n\tMEDIA_UPLOAD_STATE_SUCCEEDED,\n\tMEDIA_UPLOAD_STATE_PAUSED,\n\tMEDIA_UPLOAD_STATE_FAILED,\n\tMEDIA_UPLOAD_STATE_RESET,\n} from './media-upload-progress/constants';\nexport { default as BlockMediaUpdateProgress } from './block-media-update-progress';\nexport { default as URLInput } from './url-input';\nexport { default as BlockInvalidWarning } from './block-list/block-invalid-warning';\nexport { default as BlockCaption } from './block-caption';\nexport { default as Caption } from './caption';\nexport { default as PanelColorSettings } from './panel-color-settings';\nexport { default as __experimentalPanelColorGradientSettings } from './colors-gradients/panel-color-gradient-settings';\nexport { useSettings, default as useSetting } from './use-settings';\nexport {\n\tRecursionProvider,\n\tDeprecatedExperimentalRecursionProvider as __experimentalRecursionProvider,\n\tuseHasRecursion,\n\tDeprecatedExperimentalUseHasRecursion as __experimentalUseHasRecursion,\n} from './recursion-provider';\nexport { default as Warning } from './warning';\nexport { default as ContrastChecker } from './contrast-checker';\nexport { default as useMultipleOriginColorsAndGradients } from './colors-gradients/use-multiple-origin-colors-and-gradients';\nexport { default as UnsupportedBlockDetails } from './unsupported-block-details';\n\nexport {\n\tBottomSheetSettings,\n\tBlockSettingsButton,\n\tblockSettingsScreens,\n} from './block-settings';\nexport { default as VideoPlayer, VIDEO_ASPECT_RATIO } from './video-player';\n\nexport {\n\tgetSpacingPresetCssVar,\n\tgetCustomValueFromPreset,\n\tisValueSpacingPreset,\n} from './spacing-sizes-control/utils';\n// Content Related Components.\nexport { default as BlockList } from './block-list';\nexport { default as BlockMover } from './block-mover';\nexport { default as BlockToolbar } from './block-toolbar';\nexport { default as BlockVariationPicker } from './block-variation-picker';\nexport { default as BlockStyles } from './block-styles';\nexport { default as DefaultBlockAppender } from './default-block-appender';\nexport { default as __unstableEditorStyles } from './editor-styles';\nexport { default as Inserter } from './inserter';\nexport { default as InserterButton } from './inserter-button';\nexport { useBlockProps } from './block-list/use-block-props';\nexport { default as FloatingToolbar } from './floating-toolbar';\n\n// State Related Components.\nexport { default as BlockEditorProvider } from './provider';\n"],"mappings":"AAAA;AACA,SACCA,qBAAqB,EACrBC,qBAAqB,QACf,2BAA2B;AAClC,SAASC,oBAAoB,QAAQ,iBAAiB;AACtD,SACCC,OAAO,IAAIC,aAAa,EACxBC,mBAAmB,QACb,kBAAkB;AACzB,SAASF,OAAO,IAAIG,SAAS,EAAEC,mBAAmB,QAAQ,cAAc;AACxE,SAASJ,OAAO,IAAIK,SAAS,QAAQ,cAAc;AACnD,SACCC,6BAA6B,EAC7BC,6BAA6B,QACvB,oCAAoC;AAC3C,cAAc,UAAU;AACxB,c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
  * @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}.
38
38
  * @param {?WPDirectInsertBlock} defaultBlock The default block to insert: [ blockName, { blockAttributes } ].
39
- * @param {?Function|boolean} directInsert If a default block should be inserted directly by the appender.
39
+ * @param {?boolean} directInsert If a default block should be inserted directly by the appender.
40
40
  *
41
41
  * @param {?WPDirectInsertBlock} __experimentalDefaultBlock A deprecated prop for the default block to insert: [ blockName, { blockAttributes } ]. Use `defaultBlock` instead.
42
42
  *
43
- * @param {?Function|boolean} __experimentalDirectInsert A deprecated prop for whether a default block should be inserted directly by the appender. Use `directInsert` instead.
43
+ * @param {?boolean} __experimentalDirectInsert A deprecated prop for whether a default block should be inserted directly by the appender. Use `directInsert` instead.
44
44
  *
45
45
  * @param {string} [templateLock] The template lock specified for the inner
46
46
  * blocks component. (e.g. "all")
@@ -113,6 +113,12 @@ export default function useNestedSettingsUpdate(clientId, parentLock, allowedBlo
113
113
  if (directInsert !== undefined) {
114
114
  newSettings.directInsert = directInsert;
115
115
  }
116
+ if (newSettings.directInsert !== undefined && typeof newSettings.directInsert !== 'boolean') {
117
+ deprecated('Using `Function` as a `directInsert` argument', {
118
+ alternative: '`boolean` values',
119
+ since: '6.5'
120
+ });
121
+ }
116
122
 
117
123
  // Batch updates to block list settings to avoid triggering cascading renders
118
124
  // for each container block included in a tree and optimize initial render.
@@ -1 +1 @@
1
- {"version":3,"names":["useLayoutEffect","useMemo","useState","useDispatch","useRegistry","deprecated","isShallowEqual","store","blockEditorStore","getLayoutType","pendingSettingsUpdates","WeakMap","useShallowMemo","value","prevValue","setPrevValue","useNestedSettingsUpdate","clientId","parentLock","allowedBlocks","prioritizedInserterBlocks","defaultBlock","directInsert","__experimentalDefaultBlock","__experimentalDirectInsert","templateLock","captureToolbars","orientation","layout","updateBlockListSettings","registry","_allowedBlocks","_prioritizedInserterBlocks","_templateLock","undefined","newSettings","__experimentalCaptureToolbars","layoutType","type","getOrientation","alternative","since","version","get","set","push","window","queueMicrotask","length","batch","forEach","args"],"sources":["@wordpress/block-editor/src/components/inner-blocks/use-nested-settings-update.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useState } from '@wordpress/element';\nimport { useDispatch, useRegistry } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { getLayoutType } from '../../layouts';\n\n/** @typedef {import('../../selectors').WPDirectInsertBlock } WPDirectInsertBlock */\n\nconst pendingSettingsUpdates = new WeakMap();\n\nfunction useShallowMemo( value ) {\n\tconst [ prevValue, setPrevValue ] = useState( value );\n\tif ( ! isShallowEqual( prevValue, value ) ) {\n\t\tsetPrevValue( value );\n\t}\n\treturn prevValue;\n}\n\n/**\n * This hook is a side effect which updates the block-editor store when changes\n * happen to inner block settings. The given props are transformed into a\n * settings object, and if that is different from the current settings object in\n * the block-editor store, then the store is updated with the new settings which\n * came from props.\n *\n * @param {string} clientId The client ID of the block to update.\n * @param {string} parentLock\n * @param {string[]} allowedBlocks An array of block names which are permitted\n * in inner blocks.\n * @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}.\n * @param {?WPDirectInsertBlock} defaultBlock The default block to insert: [ blockName, { blockAttributes } ].\n * @param {?Function|boolean} directInsert If a default block should be inserted directly by the appender.\n *\n * @param {?WPDirectInsertBlock} __experimentalDefaultBlock A deprecated prop for the default block to insert: [ blockName, { blockAttributes } ]. Use `defaultBlock` instead.\n *\n * @param {?Function|boolean} __experimentalDirectInsert A deprecated prop for whether a default block should be inserted directly by the appender. Use `directInsert` instead.\n *\n * @param {string} [templateLock] The template lock specified for the inner\n * blocks component. (e.g. \"all\")\n * @param {boolean} captureToolbars Whether or children toolbars should be shown\n * in the inner blocks component rather than on\n * the child block.\n * @param {string} orientation The direction in which the block\n * should face.\n * @param {Object} layout The layout object for the block container.\n */\nexport default function useNestedSettingsUpdate(\n\tclientId,\n\tparentLock,\n\tallowedBlocks,\n\tprioritizedInserterBlocks,\n\tdefaultBlock,\n\tdirectInsert,\n\t__experimentalDefaultBlock,\n\t__experimentalDirectInsert,\n\ttemplateLock,\n\tcaptureToolbars,\n\torientation,\n\tlayout\n) {\n\t// Instead of adding a useSelect mapping here, please add to the useSelect\n\t// mapping in InnerBlocks! Every subscription impacts performance.\n\n\tconst { updateBlockListSettings } = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\t// Implementors often pass a new array on every render,\n\t// and the contents of the arrays are just strings, so the entire array\n\t// can be passed as dependencies but We need to include the length of the array,\n\t// otherwise if the arrays change length but the first elements are equal the comparison,\n\t// does not works as expected.\n\tconst _allowedBlocks = useShallowMemo( allowedBlocks );\n\n\tconst _prioritizedInserterBlocks = useMemo(\n\t\t() => prioritizedInserterBlocks,\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\tprioritizedInserterBlocks\n\t);\n\n\tconst _templateLock =\n\t\ttemplateLock === undefined || parentLock === 'contentOnly'\n\t\t\t? parentLock\n\t\t\t: templateLock;\n\n\tuseLayoutEffect( () => {\n\t\tconst newSettings = {\n\t\t\tallowedBlocks: _allowedBlocks,\n\t\t\tprioritizedInserterBlocks: _prioritizedInserterBlocks,\n\t\t\ttemplateLock: _templateLock,\n\t\t};\n\n\t\t// These values are not defined for RN, so only include them if they\n\t\t// are defined.\n\t\tif ( captureToolbars !== undefined ) {\n\t\t\tnewSettings.__experimentalCaptureToolbars = captureToolbars;\n\t\t}\n\n\t\t// Orientation depends on layout,\n\t\t// ideally the separate orientation prop should be deprecated.\n\t\tif ( orientation !== undefined ) {\n\t\t\tnewSettings.orientation = orientation;\n\t\t} else {\n\t\t\tconst layoutType = getLayoutType( layout?.type );\n\t\t\tnewSettings.orientation = layoutType.getOrientation( layout );\n\t\t}\n\n\t\tif ( __experimentalDefaultBlock !== undefined ) {\n\t\t\tdeprecated( '__experimentalDefaultBlock', {\n\t\t\t\talternative: 'defaultBlock',\n\t\t\t\tsince: '6.3',\n\t\t\t\tversion: '6.4',\n\t\t\t} );\n\t\t\tnewSettings.defaultBlock = __experimentalDefaultBlock;\n\t\t}\n\n\t\tif ( defaultBlock !== undefined ) {\n\t\t\tnewSettings.defaultBlock = defaultBlock;\n\t\t}\n\n\t\tif ( __experimentalDirectInsert !== undefined ) {\n\t\t\tdeprecated( '__experimentalDirectInsert', {\n\t\t\t\talternative: 'directInsert',\n\t\t\t\tsince: '6.3',\n\t\t\t\tversion: '6.4',\n\t\t\t} );\n\t\t\tnewSettings.directInsert = __experimentalDirectInsert;\n\t\t}\n\n\t\tif ( directInsert !== undefined ) {\n\t\t\tnewSettings.directInsert = directInsert;\n\t\t}\n\n\t\t// Batch updates to block list settings to avoid triggering cascading renders\n\t\t// for each container block included in a tree and optimize initial render.\n\t\t// To avoid triggering updateBlockListSettings for each container block\n\t\t// causing X re-renderings for X container blocks,\n\t\t// we batch all the updatedBlockListSettings in a single \"data\" batch\n\t\t// which results in a single re-render.\n\t\tif ( ! pendingSettingsUpdates.get( registry ) ) {\n\t\t\tpendingSettingsUpdates.set( registry, [] );\n\t\t}\n\t\tpendingSettingsUpdates\n\t\t\t.get( registry )\n\t\t\t.push( [ clientId, newSettings ] );\n\t\twindow.queueMicrotask( () => {\n\t\t\tif ( pendingSettingsUpdates.get( registry )?.length ) {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tpendingSettingsUpdates\n\t\t\t\t\t\t.get( registry )\n\t\t\t\t\t\t.forEach( ( args ) => {\n\t\t\t\t\t\t\tupdateBlockListSettings( ...args );\n\t\t\t\t\t\t} );\n\t\t\t\t\tpendingSettingsUpdates.set( registry, [] );\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}, [\n\t\tclientId,\n\t\t_allowedBlocks,\n\t\t_prioritizedInserterBlocks,\n\t\t_templateLock,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tupdateBlockListSettings,\n\t\tlayout,\n\t\tregistry,\n\t] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACvE,SAASC,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;AAC1D,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,OAAOC,cAAc,MAAM,6BAA6B;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,aAAa,QAAQ,eAAe;;AAE7C;;AAEA,MAAMC,sBAAsB,GAAG,IAAIC,OAAO,CAAC,CAAC;AAE5C,SAASC,cAAcA,CAAEC,KAAK,EAAG;EAChC,MAAM,CAAEC,SAAS,EAAEC,YAAY,CAAE,GAAGb,QAAQ,CAAEW,KAAM,CAAC;EACrD,IAAK,CAAEP,cAAc,CAAEQ,SAAS,EAAED,KAAM,CAAC,EAAG;IAC3CE,YAAY,CAAEF,KAAM,CAAC;EACtB;EACA,OAAOC,SAAS;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASE,uBAAuBA,CAC9CC,QAAQ,EACRC,UAAU,EACVC,aAAa,EACbC,yBAAyB,EACzBC,YAAY,EACZC,YAAY,EACZC,0BAA0B,EAC1BC,0BAA0B,EAC1BC,YAAY,EACZC,eAAe,EACfC,WAAW,EACXC,MAAM,EACL;EACD;EACA;;EAEA,MAAM;IAAEC;EAAwB,CAAC,GAAG1B,WAAW,CAAEK,gBAAiB,CAAC;EACnE,MAAMsB,QAAQ,GAAG1B,WAAW,CAAC,CAAC;;EAE9B;EACA;EACA;EACA;EACA;EACA,MAAM2B,cA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AY,KAAKY,SAAS,EAAG;MACjCC,WAAW,CAACb,YAAY,GAAGA,YAAY;IACxC;;IAEA;IACA;IACA;IACA;IACA;IACA;IACA,IAAK,CAAEZ,sBAAsB,CAACiC,GAAG,CAAEb,QAAS,CAAC,EAAG;MAC/CpB,sBAAsB,CAACkC,GAAG,CAAEd,QAAQ,EAAE,EAAG,CAAC;IAC3C;IACApB,sBAAsB,CACpBiC,GAAG,CAAEb,QAAS,CAAC,CACfe,IAAI,CAAE,CAAE5B,QAAQ,EAAEkB,WAAW,CAAG,CAAC;IACnCW,MAAM,CAACC,cAAc,CAAE,MAAM;MAC5B,IAAKrC,sBAAsB,CAACiC,GAAG,CAAEb,QAAS,CAAC,EAAEkB,MAAM,EAAG;QACrDlB,QAAQ,CAACmB,KAAK,CAAE,MAAM;UACrBvC,sBAAsB,CACpBiC,GAAG,CAAEb,QAAS,CAAC,CACfoB,OAAO,CAAIC,IAAI,IAAM;YACrBtB,uBAAuB,CAAE,GAAGsB,IAAK,CAAC;UACnC,CAAE,CAAC;UACJzC,sBAAsB,CAACkC,GAAG,CAAEd,QAAQ,EAAE,EAAG,CAAC;QAC3C,CAAE,CAAC;MACJ;IACD,CAAE,CAAC;EACJ,CAAC,EAAE,CACFb,QAAQ,EACRc,cAAc,EACdC,0BAA0B,EAC1BC,aAAa,EACbZ,YAAY,EACZC,YAAY,EACZC,0BAA0B,EAC1BC,0BAA0B,EAC1BE,eAAe,EACfC,WAAW,EACXE,uBAAuB,EACvBD,MAAM,EACNE,QAAQ,CACP,CAAC;AACJ"}
1
+ {"version":3,"names":["useLayoutEffect","useMemo","useState","useDispatch","useRegistry","deprecated","isShallowEqual","store","blockEditorStore","getLayoutType","pendingSettingsUpdates","WeakMap","useShallowMemo","value","prevValue","setPrevValue","useNestedSettingsUpdate","clientId","parentLock","allowedBlocks","prioritizedInserterBlocks","defaultBlock","directInsert","__experimentalDefaultBlock","__experimentalDirectInsert","templateLock","captureToolbars","orientation","layout","updateBlockListSettings","registry","_allowedBlocks","_prioritizedInserterBlocks","_templateLock","undefined","newSettings","__experimentalCaptureToolbars","layoutType","type","getOrientation","alternative","since","version","get","set","push","window","queueMicrotask","length","batch","forEach","args"],"sources":["@wordpress/block-editor/src/components/inner-blocks/use-nested-settings-update.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useState } from '@wordpress/element';\nimport { useDispatch, useRegistry } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { getLayoutType } from '../../layouts';\n\n/** @typedef {import('../../selectors').WPDirectInsertBlock } WPDirectInsertBlock */\n\nconst pendingSettingsUpdates = new WeakMap();\n\nfunction useShallowMemo( value ) {\n\tconst [ prevValue, setPrevValue ] = useState( value );\n\tif ( ! isShallowEqual( prevValue, value ) ) {\n\t\tsetPrevValue( value );\n\t}\n\treturn prevValue;\n}\n\n/**\n * This hook is a side effect which updates the block-editor store when changes\n * happen to inner block settings. The given props are transformed into a\n * settings object, and if that is different from the current settings object in\n * the block-editor store, then the store is updated with the new settings which\n * came from props.\n *\n * @param {string} clientId The client ID of the block to update.\n * @param {string} parentLock\n * @param {string[]} allowedBlocks An array of block names which are permitted\n * in inner blocks.\n * @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}.\n * @param {?WPDirectInsertBlock} defaultBlock The default block to insert: [ blockName, { blockAttributes } ].\n * @param {?boolean} directInsert If a default block should be inserted directly by the appender.\n *\n * @param {?WPDirectInsertBlock} __experimentalDefaultBlock A deprecated prop for the default block to insert: [ blockName, { blockAttributes } ]. Use `defaultBlock` instead.\n *\n * @param {?boolean} __experimentalDirectInsert A deprecated prop for whether a default block should be inserted directly by the appender. Use `directInsert` instead.\n *\n * @param {string} [templateLock] The template lock specified for the inner\n * blocks component. (e.g. \"all\")\n * @param {boolean} captureToolbars Whether or children toolbars should be shown\n * in the inner blocks component rather than on\n * the child block.\n * @param {string} orientation The direction in which the block\n * should face.\n * @param {Object} layout The layout object for the block container.\n */\nexport default function useNestedSettingsUpdate(\n\tclientId,\n\tparentLock,\n\tallowedBlocks,\n\tprioritizedInserterBlocks,\n\tdefaultBlock,\n\tdirectInsert,\n\t__experimentalDefaultBlock,\n\t__experimentalDirectInsert,\n\ttemplateLock,\n\tcaptureToolbars,\n\torientation,\n\tlayout\n) {\n\t// Instead of adding a useSelect mapping here, please add to the useSelect\n\t// mapping in InnerBlocks! Every subscription impacts performance.\n\n\tconst { updateBlockListSettings } = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\t// Implementors often pass a new array on every render,\n\t// and the contents of the arrays are just strings, so the entire array\n\t// can be passed as dependencies but We need to include the length of the array,\n\t// otherwise if the arrays change length but the first elements are equal the comparison,\n\t// does not works as expected.\n\tconst _allowedBlocks = useShallowMemo( allowedBlocks );\n\n\tconst _prioritizedInserterBlocks = useMemo(\n\t\t() => prioritizedInserterBlocks,\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\tprioritizedInserterBlocks\n\t);\n\n\tconst _templateLock =\n\t\ttemplateLock === undefined || parentLock === 'contentOnly'\n\t\t\t? parentLock\n\t\t\t: templateLock;\n\n\tuseLayoutEffect( () => {\n\t\tconst newSettings = {\n\t\t\tallowedBlocks: _allowedBlocks,\n\t\t\tprioritizedInserterBlocks: _prioritizedInserterBlocks,\n\t\t\ttemplateLock: _templateLock,\n\t\t};\n\n\t\t// These values are not defined for RN, so only include them if they\n\t\t// are defined.\n\t\tif ( captureToolbars !== undefined ) {\n\t\t\tnewSettings.__experimentalCaptureToolbars = captureToolbars;\n\t\t}\n\n\t\t// Orientation depends on layout,\n\t\t// ideally the separate orientation prop should be deprecated.\n\t\tif ( orientation !== undefined ) {\n\t\t\tnewSettings.orientation = orientation;\n\t\t} else {\n\t\t\tconst layoutType = getLayoutType( layout?.type );\n\t\t\tnewSettings.orientation = layoutType.getOrientation( layout );\n\t\t}\n\n\t\tif ( __experimentalDefaultBlock !== undefined ) {\n\t\t\tdeprecated( '__experimentalDefaultBlock', {\n\t\t\t\talternative: 'defaultBlock',\n\t\t\t\tsince: '6.3',\n\t\t\t\tversion: '6.4',\n\t\t\t} );\n\t\t\tnewSettings.defaultBlock = __experimentalDefaultBlock;\n\t\t}\n\n\t\tif ( defaultBlock !== undefined ) {\n\t\t\tnewSettings.defaultBlock = defaultBlock;\n\t\t}\n\n\t\tif ( __experimentalDirectInsert !== undefined ) {\n\t\t\tdeprecated( '__experimentalDirectInsert', {\n\t\t\t\talternative: 'directInsert',\n\t\t\t\tsince: '6.3',\n\t\t\t\tversion: '6.4',\n\t\t\t} );\n\t\t\tnewSettings.directInsert = __experimentalDirectInsert;\n\t\t}\n\n\t\tif ( directInsert !== undefined ) {\n\t\t\tnewSettings.directInsert = directInsert;\n\t\t}\n\n\t\tif (\n\t\t\tnewSettings.directInsert !== undefined &&\n\t\t\ttypeof newSettings.directInsert !== 'boolean'\n\t\t) {\n\t\t\tdeprecated( 'Using `Function` as a `directInsert` argument', {\n\t\t\t\talternative: '`boolean` values',\n\t\t\t\tsince: '6.5',\n\t\t\t} );\n\t\t}\n\n\t\t// Batch updates to block list settings to avoid triggering cascading renders\n\t\t// for each container block included in a tree and optimize initial render.\n\t\t// To avoid triggering updateBlockListSettings for each container block\n\t\t// causing X re-renderings for X container blocks,\n\t\t// we batch all the updatedBlockListSettings in a single \"data\" batch\n\t\t// which results in a single re-render.\n\t\tif ( ! pendingSettingsUpdates.get( registry ) ) {\n\t\t\tpendingSettingsUpdates.set( registry, [] );\n\t\t}\n\t\tpendingSettingsUpdates\n\t\t\t.get( registry )\n\t\t\t.push( [ clientId, newSettings ] );\n\t\twindow.queueMicrotask( () => {\n\t\t\tif ( pendingSettingsUpdates.get( registry )?.length ) {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tpendingSettingsUpdates\n\t\t\t\t\t\t.get( registry )\n\t\t\t\t\t\t.forEach( ( args ) => {\n\t\t\t\t\t\t\tupdateBlockListSettings( ...args );\n\t\t\t\t\t\t} );\n\t\t\t\t\tpendingSettingsUpdates.set( registry, [] );\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}, [\n\t\tclientId,\n\t\t_allowedBlocks,\n\t\t_prioritizedInserterBlocks,\n\t\t_templateLock,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tupdateBlockListSettings,\n\t\tlayout,\n\t\tregistry,\n\t] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACvE,SAASC,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;AAC1D,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,OAAOC,cAAc,MAAM,6BAA6B;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,aAAa,QAAQ,eAAe;;AAE7C;;AAEA,MAAMC,sBAAsB,GAAG,IAAIC,OAAO,CAAC,CAAC;AAE5C,SAASC,cAAcA,CAAEC,KAAK,EAAG;EAChC,MAAM,CAAEC,SAAS,EAAEC,YAAY,CAAE,GAAGb,QAAQ,CAAEW,KAAM,CAAC;EACrD,IAAK,CAAEP,cAAc,CAAEQ,SAAS,EAAED,KAAM,CAAC,EAAG;IAC3CE,YAAY,CAAEF,KAAM,CAAC;EACtB;EACA,OAAOC,SAAS;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASE,uBAAuBA,CAC9CC,QAAQ,EACRC,UAAU,EACVC,aAAa,EACbC,yBAAyB,EACzBC,YAAY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