@wordpress/block-editor 14.5.0 → 14.6.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 (431) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +0 -8
  3. package/build/autocompleters/block.js +13 -5
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/components/block-canvas/index.js +10 -0
  6. package/build/components/block-canvas/index.js.map +1 -1
  7. package/build/components/block-card/index.js +2 -2
  8. package/build/components/block-card/index.js.map +1 -1
  9. package/build/components/block-full-height-alignment-control/index.js +1 -1
  10. package/build/components/block-full-height-alignment-control/index.js.map +1 -1
  11. package/build/components/block-list/block.js +1 -1
  12. package/build/components/block-list/block.js.map +1 -1
  13. package/build/components/block-list/block.native.js +1 -7
  14. package/build/components/block-list/block.native.js.map +1 -1
  15. package/build/components/block-list/index.js +5 -5
  16. package/build/components/block-list/index.js.map +1 -1
  17. package/build/components/block-list/use-block-props/index.js +1 -2
  18. package/build/components/block-list/use-block-props/index.js.map +1 -1
  19. package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -3
  20. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  21. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -6
  22. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  23. package/build/components/block-list/use-in-between-inserter.js +1 -1
  24. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  25. package/build/components/block-patterns-paging/index.js +1 -1
  26. package/build/components/block-patterns-paging/index.js.map +1 -1
  27. package/build/components/block-popover/index.js +2 -45
  28. package/build/components/block-popover/index.js.map +1 -1
  29. package/build/components/block-preview/index.js +2 -2
  30. package/build/components/block-preview/index.js.map +1 -1
  31. package/build/components/block-settings-menu/block-settings-dropdown.js +5 -0
  32. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  33. package/build/components/block-settings-menu/index.js +4 -3
  34. package/build/components/block-settings-menu/index.js.map +1 -1
  35. package/build/components/block-toolbar/change-design.js +122 -0
  36. package/build/components/block-toolbar/change-design.js.map +1 -0
  37. package/build/components/block-toolbar/index.js +19 -7
  38. package/build/components/block-toolbar/index.js.map +1 -1
  39. package/build/components/block-tools/index.js +4 -10
  40. package/build/components/block-tools/index.js.map +1 -1
  41. package/build/components/block-tools/insertion-point.js +4 -3
  42. package/build/components/block-tools/insertion-point.js.map +1 -1
  43. package/build/components/block-tools/use-show-block-tools.js +3 -9
  44. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  45. package/build/components/block-tools/zoom-out-mode-inserters.js +20 -29
  46. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  47. package/build/components/block-variation-transforms/index.js +2 -2
  48. package/build/components/block-variation-transforms/index.js.map +1 -1
  49. package/build/components/block-vertical-alignment-control/ui.js +6 -10
  50. package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
  51. package/build/components/border-radius-control/linked-button.js +7 -10
  52. package/build/components/border-radius-control/linked-button.js.map +1 -1
  53. package/build/components/collab/block-comment-icon-slot.js +18 -0
  54. package/build/components/collab/block-comment-icon-slot.js.map +1 -0
  55. package/build/components/collab/block-comment-icon-toolbar-slot.js +18 -0
  56. package/build/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
  57. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
  58. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  59. package/build/components/convert-to-group-buttons/toolbar.js +4 -4
  60. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
  61. package/build/components/global-styles/color-panel.js +1 -4
  62. package/build/components/global-styles/color-panel.js.map +1 -1
  63. package/build/components/global-styles/use-global-styles-context.native.js +6 -0
  64. package/build/components/global-styles/use-global-styles-context.native.js.map +1 -1
  65. package/build/components/iframe/index.js +17 -22
  66. package/build/components/iframe/index.js.map +1 -1
  67. package/build/components/image-size-control/index.js +61 -20
  68. package/build/components/image-size-control/index.js.map +1 -1
  69. package/build/components/inner-blocks/index.js +9 -5
  70. package/build/components/inner-blocks/index.js.map +1 -1
  71. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +2 -2
  72. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  73. package/build/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  74. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  75. package/build/components/inserter/category-tabs/index.js +15 -2
  76. package/build/components/inserter/category-tabs/index.js.map +1 -1
  77. package/build/components/inserter/menu.js +4 -2
  78. package/build/components/inserter/menu.js.map +1 -1
  79. package/build/components/inserter-button/index.native.js +1 -1
  80. package/build/components/inserter-button/index.native.js.map +1 -1
  81. package/build/components/inspector-controls-tabs/index.js +0 -2
  82. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  83. package/build/components/inspector-controls-tabs/utils.js +3 -6
  84. package/build/components/inspector-controls-tabs/utils.js.map +1 -1
  85. package/build/components/link-control/link-preview.js +12 -9
  86. package/build/components/link-control/link-preview.js.map +1 -1
  87. package/build/components/list-view/appender.js +4 -3
  88. package/build/components/list-view/appender.js.map +1 -1
  89. package/build/components/list-view/branch.js +6 -5
  90. package/build/components/list-view/branch.js.map +1 -1
  91. package/build/components/list-view/index.js +1 -2
  92. package/build/components/list-view/index.js.map +1 -1
  93. package/build/components/provider/index.js +1 -1
  94. package/build/components/provider/index.js.map +1 -1
  95. package/build/components/rich-text/event-listeners/index.js +3 -1
  96. package/build/components/rich-text/event-listeners/index.js.map +1 -1
  97. package/build/components/rich-text/index.native.js +2 -6
  98. package/build/components/rich-text/index.native.js.map +1 -1
  99. package/build/components/spacing-sizes-control/index.js +2 -2
  100. package/build/components/spacing-sizes-control/index.js.map +1 -1
  101. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -3
  102. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  103. package/build/components/spacing-sizes-control/linked-button.js +1 -5
  104. package/build/components/spacing-sizes-control/linked-button.js.map +1 -1
  105. package/build/components/tool-selector/index.js +1 -4
  106. package/build/components/tool-selector/index.js.map +1 -1
  107. package/build/components/url-input/index.js +1 -1
  108. package/build/components/url-input/index.js.map +1 -1
  109. package/build/components/use-block-commands/index.js +1 -1
  110. package/build/components/use-block-commands/index.js.map +1 -1
  111. package/build/components/use-block-drop-zone/index.js +5 -5
  112. package/build/components/use-block-drop-zone/index.js.map +1 -1
  113. package/build/components/use-block-drop-zone/index.native.js +0 -1
  114. package/build/components/use-block-drop-zone/index.native.js.map +1 -1
  115. package/build/components/use-moving-animation/index.js +1 -3
  116. package/build/components/use-moving-animation/index.js.map +1 -1
  117. package/build/components/use-settings/index.js +1 -3
  118. package/build/components/use-settings/index.js.map +1 -1
  119. package/build/components/writing-flow/index.js +5 -3
  120. package/build/components/writing-flow/index.js.map +1 -1
  121. package/build/components/writing-flow/use-tab-nav.js +2 -3
  122. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  123. package/build/hooks/block-bindings.js +19 -8
  124. package/build/hooks/block-bindings.js.map +1 -1
  125. package/build/hooks/contrast-checker.js +0 -1
  126. package/build/hooks/contrast-checker.js.map +1 -1
  127. package/build/hooks/duotone.js +2 -2
  128. package/build/hooks/duotone.js.map +1 -1
  129. package/build/hooks/style.js +4 -1
  130. package/build/hooks/style.js.map +1 -1
  131. package/build/hooks/use-zoom-out.js +13 -22
  132. package/build/hooks/use-zoom-out.js.map +1 -1
  133. package/build/index.js +0 -7
  134. package/build/index.js.map +1 -1
  135. package/build/private-apis.js +6 -3
  136. package/build/private-apis.js.map +1 -1
  137. package/build/store/actions.js +2 -33
  138. package/build/store/actions.js.map +1 -1
  139. package/build/store/defaults.js +1 -1
  140. package/build/store/defaults.js.map +1 -1
  141. package/build/store/private-actions.js +57 -8
  142. package/build/store/private-actions.js.map +1 -1
  143. package/build/store/private-selectors.js +9 -21
  144. package/build/store/private-selectors.js.map +1 -1
  145. package/build/store/reducer.js +16 -6
  146. package/build/store/reducer.js.map +1 -1
  147. package/build/store/selectors.js +44 -7
  148. package/build/store/selectors.js.map +1 -1
  149. package/build/utils/dom.js +16 -1
  150. package/build/utils/dom.js.map +1 -1
  151. package/build/utils/get-font-styles-and-weights.js +1 -1
  152. package/build/utils/get-font-styles-and-weights.js.map +1 -1
  153. package/build/utils/transform-styles/index.js +4 -3
  154. package/build/utils/transform-styles/index.js.map +1 -1
  155. package/build-module/autocompleters/block.js +14 -6
  156. package/build-module/autocompleters/block.js.map +1 -1
  157. package/build-module/components/block-canvas/index.js +11 -1
  158. package/build-module/components/block-canvas/index.js.map +1 -1
  159. package/build-module/components/block-card/index.js +3 -3
  160. package/build-module/components/block-card/index.js.map +1 -1
  161. package/build-module/components/block-full-height-alignment-control/index.js +1 -1
  162. package/build-module/components/block-full-height-alignment-control/index.js.map +1 -1
  163. package/build-module/components/block-list/block.js +1 -1
  164. package/build-module/components/block-list/block.js.map +1 -1
  165. package/build-module/components/block-list/block.native.js +1 -7
  166. package/build-module/components/block-list/block.native.js.map +1 -1
  167. package/build-module/components/block-list/index.js +5 -5
  168. package/build-module/components/block-list/index.js.map +1 -1
  169. package/build-module/components/block-list/use-block-props/index.js +1 -2
  170. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  171. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -3
  172. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  173. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -6
  174. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  175. package/build-module/components/block-list/use-in-between-inserter.js +1 -1
  176. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  177. package/build-module/components/block-patterns-paging/index.js +1 -1
  178. package/build-module/components/block-patterns-paging/index.js.map +1 -1
  179. package/build-module/components/block-popover/index.js +2 -45
  180. package/build-module/components/block-popover/index.js.map +1 -1
  181. package/build-module/components/block-preview/index.js +2 -2
  182. package/build-module/components/block-preview/index.js.map +1 -1
  183. package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -0
  184. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  185. package/build-module/components/block-settings-menu/index.js +5 -4
  186. package/build-module/components/block-settings-menu/index.js.map +1 -1
  187. package/build-module/components/block-toolbar/change-design.js +114 -0
  188. package/build-module/components/block-toolbar/change-design.js.map +1 -0
  189. package/build-module/components/block-toolbar/index.js +19 -7
  190. package/build-module/components/block-toolbar/index.js.map +1 -1
  191. package/build-module/components/block-tools/index.js +4 -10
  192. package/build-module/components/block-tools/index.js.map +1 -1
  193. package/build-module/components/block-tools/insertion-point.js +4 -3
  194. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  195. package/build-module/components/block-tools/use-show-block-tools.js +3 -9
  196. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  197. package/build-module/components/block-tools/zoom-out-mode-inserters.js +20 -29
  198. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  199. package/build-module/components/block-variation-transforms/index.js +2 -2
  200. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  201. package/build-module/components/block-vertical-alignment-control/ui.js +6 -10
  202. package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
  203. package/build-module/components/border-radius-control/linked-button.js +8 -11
  204. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  205. package/build-module/components/collab/block-comment-icon-slot.js +11 -0
  206. package/build-module/components/collab/block-comment-icon-slot.js.map +1 -0
  207. package/build-module/components/collab/block-comment-icon-toolbar-slot.js +11 -0
  208. package/build-module/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
  209. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
  210. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  211. package/build-module/components/convert-to-group-buttons/toolbar.js +4 -4
  212. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
  213. package/build-module/components/global-styles/color-panel.js +2 -5
  214. package/build-module/components/global-styles/color-panel.js.map +1 -1
  215. package/build-module/components/global-styles/use-global-styles-context.native.js +6 -0
  216. package/build-module/components/global-styles/use-global-styles-context.native.js.map +1 -1
  217. package/build-module/components/iframe/index.js +17 -22
  218. package/build-module/components/iframe/index.js.map +1 -1
  219. package/build-module/components/image-size-control/index.js +62 -21
  220. package/build-module/components/image-size-control/index.js.map +1 -1
  221. package/build-module/components/inner-blocks/index.js +9 -5
  222. package/build-module/components/inner-blocks/index.js.map +1 -1
  223. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +2 -2
  224. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  225. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  226. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  227. package/build-module/components/inserter/category-tabs/index.js +15 -2
  228. package/build-module/components/inserter/category-tabs/index.js.map +1 -1
  229. package/build-module/components/inserter/menu.js +5 -3
  230. package/build-module/components/inserter/menu.js.map +1 -1
  231. package/build-module/components/inserter-button/index.native.js +1 -1
  232. package/build-module/components/inserter-button/index.native.js.map +1 -1
  233. package/build-module/components/inspector-controls-tabs/index.js +0 -2
  234. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  235. package/build-module/components/inspector-controls-tabs/utils.js +3 -6
  236. package/build-module/components/inspector-controls-tabs/utils.js.map +1 -1
  237. package/build-module/components/link-control/link-preview.js +13 -10
  238. package/build-module/components/link-control/link-preview.js.map +1 -1
  239. package/build-module/components/list-view/appender.js +4 -3
  240. package/build-module/components/list-view/appender.js.map +1 -1
  241. package/build-module/components/list-view/branch.js +7 -6
  242. package/build-module/components/list-view/branch.js.map +1 -1
  243. package/build-module/components/list-view/index.js +1 -2
  244. package/build-module/components/list-view/index.js.map +1 -1
  245. package/build-module/components/provider/index.js +1 -1
  246. package/build-module/components/provider/index.js.map +1 -1
  247. package/build-module/components/rich-text/event-listeners/index.js +4 -2
  248. package/build-module/components/rich-text/event-listeners/index.js.map +1 -1
  249. package/build-module/components/rich-text/index.native.js +2 -6
  250. package/build-module/components/rich-text/index.native.js.map +1 -1
  251. package/build-module/components/spacing-sizes-control/index.js +3 -3
  252. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  253. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
  254. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  255. package/build-module/components/spacing-sizes-control/linked-button.js +2 -6
  256. package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -1
  257. package/build-module/components/tool-selector/index.js +1 -4
  258. package/build-module/components/tool-selector/index.js.map +1 -1
  259. package/build-module/components/url-input/index.js +1 -1
  260. package/build-module/components/url-input/index.js.map +1 -1
  261. package/build-module/components/use-block-commands/index.js +1 -1
  262. package/build-module/components/use-block-commands/index.js.map +1 -1
  263. package/build-module/components/use-block-drop-zone/index.js +5 -5
  264. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  265. package/build-module/components/use-block-drop-zone/index.native.js +0 -1
  266. package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
  267. package/build-module/components/use-moving-animation/index.js +1 -3
  268. package/build-module/components/use-moving-animation/index.js.map +1 -1
  269. package/build-module/components/use-settings/index.js +1 -3
  270. package/build-module/components/use-settings/index.js.map +1 -1
  271. package/build-module/components/writing-flow/index.js +5 -3
  272. package/build-module/components/writing-flow/index.js.map +1 -1
  273. package/build-module/components/writing-flow/use-tab-nav.js +2 -3
  274. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  275. package/build-module/hooks/block-bindings.js +20 -9
  276. package/build-module/hooks/block-bindings.js.map +1 -1
  277. package/build-module/hooks/contrast-checker.js +0 -1
  278. package/build-module/hooks/contrast-checker.js.map +1 -1
  279. package/build-module/hooks/duotone.js +2 -2
  280. package/build-module/hooks/duotone.js.map +1 -1
  281. package/build-module/hooks/style.js +4 -1
  282. package/build-module/hooks/style.js.map +1 -1
  283. package/build-module/hooks/use-zoom-out.js +15 -23
  284. package/build-module/hooks/use-zoom-out.js.map +1 -1
  285. package/build-module/index.js +1 -1
  286. package/build-module/index.js.map +1 -1
  287. package/build-module/private-apis.js +7 -5
  288. package/build-module/private-apis.js.map +1 -1
  289. package/build-module/store/actions.js +2 -33
  290. package/build-module/store/actions.js.map +1 -1
  291. package/build-module/store/defaults.js +1 -1
  292. package/build-module/store/defaults.js.map +1 -1
  293. package/build-module/store/private-actions.js +54 -7
  294. package/build-module/store/private-actions.js.map +1 -1
  295. package/build-module/store/private-selectors.js +9 -20
  296. package/build-module/store/private-selectors.js.map +1 -1
  297. package/build-module/store/reducer.js +16 -6
  298. package/build-module/store/reducer.js.map +1 -1
  299. package/build-module/store/selectors.js +45 -8
  300. package/build-module/store/selectors.js.map +1 -1
  301. package/build-module/utils/dom.js +16 -1
  302. package/build-module/utils/dom.js.map +1 -1
  303. package/build-module/utils/get-font-styles-and-weights.js +2 -2
  304. package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
  305. package/build-module/utils/transform-styles/index.js +3 -2
  306. package/build-module/utils/transform-styles/index.js.map +1 -1
  307. package/build-style/content-rtl.css +9 -4
  308. package/build-style/content.css +9 -4
  309. package/build-style/style-rtl.css +33 -22
  310. package/build-style/style.css +33 -22
  311. package/build-types/utils/dom.d.ts.map +1 -1
  312. package/package.json +33 -32
  313. package/src/autocompleters/block.js +16 -7
  314. package/src/components/block-canvas/index.js +17 -1
  315. package/src/components/block-canvas/style.scss +2 -0
  316. package/src/components/block-card/index.js +3 -3
  317. package/src/components/block-full-height-alignment-control/index.js +1 -1
  318. package/src/components/block-inspector/style.scss +0 -6
  319. package/src/components/block-list/block.js +1 -2
  320. package/src/components/block-list/block.native.js +0 -4
  321. package/src/components/block-list/content.scss +1 -1
  322. package/src/components/block-list/index.js +4 -4
  323. package/src/components/block-list/use-block-props/index.js +0 -2
  324. package/src/components/block-list/use-block-props/use-focus-first-element.js +5 -3
  325. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +7 -20
  326. package/src/components/block-list/use-in-between-inserter.js +1 -1
  327. package/src/components/block-patterns-list/stories/fixtures.js +834 -0
  328. package/src/components/block-patterns-list/stories/index.story.js +81 -0
  329. package/src/components/block-patterns-list/style.scss +2 -0
  330. package/src/components/block-patterns-paging/index.js +1 -1
  331. package/src/components/block-popover/index.js +0 -62
  332. package/src/components/block-preview/index.js +2 -2
  333. package/src/components/block-settings-menu/block-settings-dropdown.js +4 -0
  334. package/src/components/block-settings-menu/index.js +3 -0
  335. package/src/components/block-toolbar/change-design.js +133 -0
  336. package/src/components/block-toolbar/index.js +25 -8
  337. package/src/components/block-toolbar/style.scss +16 -0
  338. package/src/components/block-tools/index.js +4 -17
  339. package/src/components/block-tools/insertion-point.js +4 -3
  340. package/src/components/block-tools/style.scss +0 -20
  341. package/src/components/block-tools/use-show-block-tools.js +0 -13
  342. package/src/components/block-tools/zoom-out-mode-inserters.js +25 -40
  343. package/src/components/block-variation-transforms/index.js +2 -2
  344. package/src/components/block-vertical-alignment-control/ui.js +11 -15
  345. package/src/components/border-radius-control/linked-button.js +9 -11
  346. package/src/components/collab/block-comment-icon-slot.js +12 -0
  347. package/src/components/collab/block-comment-icon-toolbar-slot.js +12 -0
  348. package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
  349. package/src/components/convert-to-group-buttons/toolbar.js +4 -4
  350. package/src/components/global-styles/color-panel.js +2 -10
  351. package/src/components/global-styles/test/use-global-styles-context.native.js +1 -0
  352. package/src/components/global-styles/use-global-styles-context.native.js +6 -0
  353. package/src/components/iframe/content.scss +4 -9
  354. package/src/components/iframe/index.js +31 -34
  355. package/src/components/iframe/style.scss +2 -3
  356. package/src/components/image-size-control/index.js +74 -43
  357. package/src/components/image-size-control/test/index.js +5 -63
  358. package/src/components/inner-blocks/index.js +12 -6
  359. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +2 -3
  360. package/src/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  361. package/src/components/inserter/category-tabs/index.js +16 -2
  362. package/src/components/inserter/menu.js +6 -4
  363. package/src/components/inserter/style.scss +13 -0
  364. package/src/components/inserter-button/index.native.js +1 -1
  365. package/src/components/inspector-controls-tabs/index.js +1 -6
  366. package/src/components/inspector-controls-tabs/utils.js +0 -3
  367. package/src/components/link-control/link-preview.js +15 -8
  368. package/src/components/link-control/test/index.js +63 -24
  369. package/src/components/list-view/appender.js +5 -6
  370. package/src/components/list-view/branch.js +8 -6
  371. package/src/components/list-view/index.js +1 -2
  372. package/src/components/provider/index.js +1 -3
  373. package/src/components/provider/test/experimental-provider.js +43 -1
  374. package/src/components/rich-text/event-listeners/index.js +4 -2
  375. package/src/components/rich-text/index.native.js +0 -2
  376. package/src/components/spacing-sizes-control/index.js +3 -3
  377. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
  378. package/src/components/spacing-sizes-control/linked-button.js +2 -12
  379. package/src/components/tool-selector/index.js +1 -5
  380. package/src/components/url-input/index.js +1 -1
  381. package/src/components/use-block-commands/index.js +1 -1
  382. package/src/components/use-block-drop-zone/index.js +5 -5
  383. package/src/components/use-block-drop-zone/index.native.js +0 -1
  384. package/src/components/use-moving-animation/index.js +0 -1
  385. package/src/components/use-settings/index.js +0 -1
  386. package/src/components/writing-flow/index.js +5 -3
  387. package/src/components/writing-flow/use-tab-nav.js +1 -2
  388. package/src/hooks/block-bindings.js +48 -31
  389. package/src/hooks/contrast-checker.js +0 -1
  390. package/src/hooks/duotone.js +2 -2
  391. package/src/hooks/style.js +7 -3
  392. package/src/hooks/use-zoom-out.js +14 -34
  393. package/src/index.js +0 -1
  394. package/src/private-apis.js +6 -3
  395. package/src/store/actions.js +3 -52
  396. package/src/store/defaults.js +2 -1
  397. package/src/store/private-actions.js +71 -8
  398. package/src/store/private-selectors.js +9 -19
  399. package/src/store/reducer.js +25 -11
  400. package/src/store/selectors.js +59 -8
  401. package/src/store/test/actions.js +41 -0
  402. package/src/store/test/reducer.js +23 -0
  403. package/src/utils/dom.js +22 -2
  404. package/src/utils/get-font-styles-and-weights.js +2 -2
  405. package/src/utils/transform-styles/index.js +3 -2
  406. package/tsconfig.tsbuildinfo +1 -1
  407. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -57
  408. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
  409. package/build/components/block-toolbar/shuffle.js +0 -110
  410. package/build/components/block-toolbar/shuffle.js.map +0 -1
  411. package/build/components/block-tools/zoom-out-popover.js +0 -58
  412. package/build/components/block-tools/zoom-out-popover.js.map +0 -1
  413. package/build/components/block-tools/zoom-out-toolbar.js +0 -132
  414. package/build/components/block-tools/zoom-out-toolbar.js.map +0 -1
  415. package/build/components/block-vertical-alignment-control/icons.js +0 -48
  416. package/build/components/block-vertical-alignment-control/icons.js.map +0 -1
  417. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -51
  418. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
  419. package/build-module/components/block-toolbar/shuffle.js +0 -103
  420. package/build-module/components/block-toolbar/shuffle.js.map +0 -1
  421. package/build-module/components/block-tools/zoom-out-popover.js +0 -49
  422. package/build-module/components/block-tools/zoom-out-popover.js.map +0 -1
  423. package/build-module/components/block-tools/zoom-out-toolbar.js +0 -124
  424. package/build-module/components/block-tools/zoom-out-toolbar.js.map +0 -1
  425. package/build-module/components/block-vertical-alignment-control/icons.js +0 -41
  426. package/build-module/components/block-vertical-alignment-control/icons.js.map +0 -1
  427. package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -65
  428. package/src/components/block-toolbar/shuffle.js +0 -111
  429. package/src/components/block-tools/zoom-out-popover.js +0 -47
  430. package/src/components/block-tools/zoom-out-toolbar.js +0 -135
  431. package/src/components/block-vertical-alignment-control/icons.js +0 -34
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useState","createPortal","forwardRef","useMemo","useEffect","useRef","__","useResizeObserver","useMergeRefs","useRefEffect","useDisabled","__experimentalStyleProvider","StyleProvider","useSelect","useBlockSelectionClearer","useWritingFlow","getCompatibilityStyles","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","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","readonly","forwardedRef","ref","title","props","resolvedAssets","isPreviewMode","select","getSettings","settings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","setIframeDocument","initialContainerWidth","bodyClasses","setBodyClasses","clearerRef","before","writingFlowRef","after","contentResizeListener","height","contentHeight","containerResizeListener","width","containerWidth","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","classList","add","Array","from","body","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","iframeWindowInnerHeight","setIframeWindowInnerHeight","iframeResizeRef","nodeWindow","innerHeight","onResize","windowInnerWidth","setWindowInnerWidth","windowResizeRef","innerWidth","isZoomedOut","current","disabledRef","isDisabled","bodyRef","src","cleanup","_src","URL","createObjectURL","Blob","revokeObjectURL","zoomOutAnimationClassnameRef","handleZoomOutAnimationClassname","clearTimeout","setTimeout","remove","maxWidth","style","setProperty","Math","min","parseInt","max","removeProperty","shouldRenderFocusCaptureElements","iframe","border","onKeyDown","currentTarget","target","stopPropagation","nativeEvent","KeyboardEvent","className","document","IframeIfReady","isInitialised","__internalIsInitialized"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { getCompatibilityStyles } from './get-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( () => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst html = iframeDocument.documentElement;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\thtml.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\thtml.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\treadonly,\n\tforwardedRef: ref,\n\ttitle = __( 'Editor canvas' ),\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst settings = getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst initialContainerWidth = useRef();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst [ containerResizeListener, { width: containerWidth } ] =\n\t\tuseResizeObserver();\n\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tdocumentElement.classList.add( 'block-editor-iframe__html' );\n\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of getCompatibilityStyles() ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst [ iframeWindowInnerHeight, setIframeWindowInnerHeight ] = useState();\n\n\tconst iframeResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\tconst onResize = () => {\n\t\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst [ windowInnerWidth, setWindowInnerWidth ] = useState();\n\n\tconst windowResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\tconst onResize = () => {\n\t\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst isZoomedOut = scale !== 1;\n\n\tuseEffect( () => {\n\t\tif ( ! isZoomedOut ) {\n\t\t\tinitialContainerWidth.current = containerWidth;\n\t\t}\n\t}, [ containerWidth, isZoomedOut ] );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tuseBubbleEvents( iframeDocument ),\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t\t// Avoid resize listeners when not needed, these will trigger\n\t\t// unnecessary re-renders when animating the iframe width, or when\n\t\t// expanding preview iframes.\n\t\tisZoomedOut ? iframeResizeRef : null,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>\n\t\t\thtml{\n\t\t\t\theight: auto !important;\n\t\t\t\tmin-height: 100%;\n\t\t\t}\n\t\t\t/* Lowest specificity to not override global styles */\n\t\t\t:where(body) {\n\t\t\t\tmargin: 0;\n\t\t\t\t/* Default background color in case zoom out mode background\n\t\t\t\tcolors the html element */\n\t\t\t\tbackground-color: white;\n\t\t\t}\n\t\t</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\tconst zoomOutAnimationClassnameRef = useRef( null );\n\tconst handleZoomOutAnimationClassname = () => {\n\t\tclearTimeout( zoomOutAnimationClassnameRef.current );\n\n\t\tiframeDocument.documentElement.classList.add( 'zoom-out-animation' );\n\n\t\tzoomOutAnimationClassnameRef.current = setTimeout( () => {\n\t\t\tiframeDocument.documentElement.classList.remove(\n\t\t\t\t'zoom-out-animation'\n\t\t\t);\n\t\t}, 400 ); // 400ms should match the animation speed used in components/iframe/content.scss\n\t};\n\n\t// Toggle zoom out CSS Classes only when zoom out mode changes. We could add these into the useEffect\n\t// that controls settings the CSS variables, but then we would need to do more work to ensure we're\n\t// only toggling these when the zoom out mode changes, as that useEffect is also triggered by a large\n\t// number of dependencies.\n\tuseEffect( () => {\n\t\tif ( ! iframeDocument || ! isZoomedOut ) {\n\t\t\treturn;\n\t\t}\n\n\t\thandleZoomOutAnimationClassname();\n\t\tiframeDocument.documentElement.classList.add( 'is-zoomed-out' );\n\n\t\treturn () => {\n\t\t\thandleZoomOutAnimationClassname();\n\t\t\tiframeDocument.documentElement.classList.remove( 'is-zoomed-out' );\n\t\t};\n\t}, [ iframeDocument, isZoomedOut ] );\n\n\t// Calculate the scaling and CSS variables for the zoom out canvas\n\tuseEffect( () => {\n\t\tif ( ! iframeDocument || ! isZoomedOut ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxWidth = 750;\n\t\t// Note: When we initialize the zoom out when the canvas is smaller (sidebars open),\n\t\t// initialContainerWidth will be smaller than the full page, and reflow will happen\n\t\t// when the canvas area becomes larger due to sidebars closing. This is a known but\n\t\t// minor divergence for now.\n\n\t\t// This scaling calculation has to happen within the JS because CSS calc() can\n\t\t// only divide and multiply by a unitless value. I.e. calc( 100px / 2 ) is valid\n\t\t// but calc( 100px / 2px ) is not.\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-scale',\n\t\t\tscale === 'default'\n\t\t\t\t? ( Math.min( containerWidth, maxWidth ) -\n\t\t\t\t\t\tparseInt( frameSize ) * 2 ) /\n\t\t\t\t\t\tMath.max(\n\t\t\t\t\t\t\tinitialContainerWidth.current,\n\t\t\t\t\t\t\tcontainerWidth\n\t\t\t\t\t\t)\n\t\t\t\t: scale\n\t\t);\n\n\t\t// frameSize has to be a px value for the scaling and frame size to be computed correctly.\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-frame-size',\n\t\t\ttypeof frameSize === 'number' ? `${ frameSize }px` : frameSize\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-content-height',\n\t\t\t`${ contentHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-inner-height',\n\t\t\t`${ iframeWindowInnerHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-container-width',\n\t\t\t`${ containerWidth }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-outer-container-width',\n\t\t\t`${ Math.max( initialContainerWidth.current, containerWidth ) }px`\n\t\t);\n\n\t\t// iframeDocument.documentElement.style.setProperty(\n\t\t// \t'--wp-block-editor-iframe-zoom-out-outer-container-width',\n\t\t// \t`${ Math.max( initialContainerWidth.current, containerWidth ) }px`\n\t\t// );\n\n\t\treturn () => {\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-scale'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-frame-size'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-content-height'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-inner-height'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-container-width'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-outer-container-width'\n\t\t\t);\n\t\t};\n\t}, [\n\t\tscale,\n\t\tframeSize,\n\t\tiframeDocument,\n\t\tiframeWindowInnerHeight,\n\t\tcontentHeight,\n\t\tcontainerWidth,\n\t\twindowInnerWidth,\n\t\tisZoomedOut,\n\t] );\n\n\t// Make sure to not render the before and after focusable div elements in view\n\t// mode. They're only needed to capture focus in edit mode.\n\tconst shouldRenderFocusCaptureElements = tabIndex >= 0 && ! isPreviewMode;\n\n\tconst iframe = (\n\t\t<>\n\t\t\t{ shouldRenderFocusCaptureElements && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: props.style?.height,\n\t\t\t\t\tborder: 0,\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ title }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif ( props.onKeyDown ) {\n\t\t\t\t\t\tprops.onKeyDown( event );\n\t\t\t\t\t}\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\t// We should only stop propagation of the React event,\n\t\t\t\t\t\t// the native event should further bubble inside the\n\t\t\t\t\t\t// iframe to the document and window.\n\t\t\t\t\t\t// Alternatively, we could consider redispatching the\n\t\t\t\t\t\t// native event in the iframe.\n\t\t\t\t\t\tconst { stopPropagation } = event.nativeEvent;\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = () => {};\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = stopPropagation;\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t// We want to prevent React events from bubbling throught the iframe\n\t\t\t\t\t\t// we bubble these manually.\n\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ shouldRenderFocusCaptureElements && after }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-iframe__container\" ref={ windowResizeRef }>\n\t\t\t{ containerResizeListener }\n\t\t\t<div\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-iframe__scale-container',\n\t\t\t\t\tisZoomedOut && 'is-zoomed-out'\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-outer-container-width':\n\t\t\t\t\t\tisZoomedOut &&\n\t\t\t\t\t\t`${ Math.max(\n\t\t\t\t\t\t\tinitialContainerWidth.current,\n\t\t\t\t\t\t\tcontainerWidth\n\t\t\t\t\t\t) }px`,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframe }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,QAAQ,EACRC,YAAY,EACZC,UAAU,EACVC,OAAO,EACPC,SAAS,EACTC,MAAM,QACA,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;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAExD,SAASC,WAAWA,CAAEC,KAAK,EAAEC,WAAW,EAAEC,KAAK,EAAG;EACjD,MAAMC,IAAI,GAAG,CAAC,CAAC;EAEf,KAAM,MAAMC,GAAG,IAAIJ,KAAK,EAAG;IAC1BG,IAAI,CAAEC,GAAG,CAAE,GAAGJ,KAAK,CAAEI,GAAG,CAAE;EAC3B;;EAEA;EACA;EACA;EACA;EACA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E7F,KAAK,EAAEF,GAAG,EAAG;EACpC,MAAMgG,aAAa,GAAGzJ,SAAS,CAC5B8D,MAAM,IACPA,MAAM,CAAEzD,gBAAiB,CAAC,CAAC0D,WAAW,CAAC,CAAC,CAAC2F,uBAAuB,EACjE,EACD,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,oBAAOlJ,IAAA,CAAC0C,MAAM;IAAA,GAAMU,KAAK;IAAGH,YAAY,EAAGC;EAAK,CAAE,CAAC;AACpD;AAEA,eAAepE,UAAU,CAAEmK,aAAc,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useState","createPortal","forwardRef","useMemo","useEffect","useRef","__","useResizeObserver","useMergeRefs","useRefEffect","useDisabled","__experimentalStyleProvider","StyleProvider","useSelect","useBlockSelectionClearer","useWritingFlow","getCompatibilityStyles","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","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","readonly","forwardedRef","ref","title","props","resolvedAssets","isPreviewMode","select","getSettings","settings","__unstableResolvedAssets","styles","scripts","setIframeDocument","initialContainerWidthRef","bodyClasses","setBodyClasses","clearerRef","before","writingFlowRef","after","contentResizeListener","height","contentHeight","containerResizeListener","width","containerWidth","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","classList","add","Array","from","body","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","iframeWindowInnerHeight","setIframeWindowInnerHeight","iframeResizeRef","nodeWindow","innerHeight","onResize","windowInnerWidth","setWindowInnerWidth","windowResizeRef","innerWidth","isZoomedOut","current","scaleContainerWidth","Math","max","disabledRef","isDisabled","bodyRef","src","cleanup","_src","URL","createObjectURL","Blob","revokeObjectURL","zoomOutAnimationClassnameRef","handleZoomOutAnimationClassname","clearTimeout","setTimeout","remove","maxWidth","style","setProperty","min","parseInt","removeProperty","shouldRenderFocusCaptureElements","iframe","border","onKeyDown","currentTarget","target","stopPropagation","nativeEvent","KeyboardEvent","className","document","IframeIfReady","isInitialised","__internalIsInitialized"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { getCompatibilityStyles } from './get-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( () => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst html = iframeDocument.documentElement;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\thtml.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\thtml.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\treadonly,\n\tforwardedRef: ref,\n\ttitle = __( 'Editor canvas' ),\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst settings = getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.isPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst initialContainerWidthRef = useRef( 0 );\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst [ containerResizeListener, { width: containerWidth } ] =\n\t\tuseResizeObserver();\n\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tdocumentElement.classList.add( 'block-editor-iframe__html' );\n\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of getCompatibilityStyles() ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst [ iframeWindowInnerHeight, setIframeWindowInnerHeight ] = useState();\n\n\tconst iframeResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\tconst onResize = () => {\n\t\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst [ windowInnerWidth, setWindowInnerWidth ] = useState();\n\n\tconst windowResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\tconst onResize = () => {\n\t\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst isZoomedOut = scale !== 1;\n\n\tuseEffect( () => {\n\t\tif ( ! isZoomedOut ) {\n\t\t\tinitialContainerWidthRef.current = containerWidth;\n\t\t}\n\t}, [ containerWidth, isZoomedOut ] );\n\n\tconst scaleContainerWidth = Math.max(\n\t\tinitialContainerWidthRef.current,\n\t\tcontainerWidth\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\t// Avoid resize listeners when not needed, these will trigger\n\t\t// unnecessary re-renders when animating the iframe width, or when\n\t\t// expanding preview iframes.\n\t\tisZoomedOut ? iframeResizeRef : null,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>\n\t\t\thtml{\n\t\t\t\theight: auto !important;\n\t\t\t\tmin-height: 100%;\n\t\t\t}\n\t\t\t/* Lowest specificity to not override global styles */\n\t\t\t:where(body) {\n\t\t\t\tmargin: 0;\n\t\t\t\t/* Default background color in case zoom out mode background\n\t\t\t\tcolors the html element */\n\t\t\t\tbackground-color: white;\n\t\t\t}\n\t\t</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\tconst zoomOutAnimationClassnameRef = useRef( null );\n\n\t// Toggle zoom out CSS Classes only when zoom out mode changes. We could add these into the useEffect\n\t// that controls settings the CSS variables, but then we would need to do more work to ensure we're\n\t// only toggling these when the zoom out mode changes, as that useEffect is also triggered by a large\n\t// number of dependencies.\n\tuseEffect( () => {\n\t\tif ( ! iframeDocument || ! isZoomedOut ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst handleZoomOutAnimationClassname = () => {\n\t\t\tclearTimeout( zoomOutAnimationClassnameRef.current );\n\n\t\t\tiframeDocument.documentElement.classList.add(\n\t\t\t\t'zoom-out-animation'\n\t\t\t);\n\n\t\t\tzoomOutAnimationClassnameRef.current = setTimeout( () => {\n\t\t\t\tiframeDocument.documentElement.classList.remove(\n\t\t\t\t\t'zoom-out-animation'\n\t\t\t\t);\n\t\t\t}, 400 ); // 400ms should match the animation speed used in components/iframe/content.scss\n\t\t};\n\n\t\thandleZoomOutAnimationClassname();\n\t\tiframeDocument.documentElement.classList.add( 'is-zoomed-out' );\n\n\t\treturn () => {\n\t\t\thandleZoomOutAnimationClassname();\n\t\t\tiframeDocument.documentElement.classList.remove( 'is-zoomed-out' );\n\t\t};\n\t}, [ iframeDocument, isZoomedOut ] );\n\n\t// Calculate the scaling and CSS variables for the zoom out canvas\n\tuseEffect( () => {\n\t\tif ( ! iframeDocument || ! isZoomedOut ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxWidth = 750;\n\t\t// Note: When we initialize the zoom out when the canvas is smaller (sidebars open),\n\t\t// initialContainerWidthRef will be smaller than the full page, and reflow will happen\n\t\t// when the canvas area becomes larger due to sidebars closing. This is a known but\n\t\t// minor divergence for now.\n\n\t\t// This scaling calculation has to happen within the JS because CSS calc() can\n\t\t// only divide and multiply by a unitless value. I.e. calc( 100px / 2 ) is valid\n\t\t// but calc( 100px / 2px ) is not.\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-scale',\n\t\t\tscale === 'auto-scaled'\n\t\t\t\t? ( Math.min( containerWidth, maxWidth ) -\n\t\t\t\t\t\tparseInt( frameSize ) * 2 ) /\n\t\t\t\t\t\tscaleContainerWidth\n\t\t\t\t: scale\n\t\t);\n\n\t\t// frameSize has to be a px value for the scaling and frame size to be computed correctly.\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-frame-size',\n\t\t\ttypeof frameSize === 'number' ? `${ frameSize }px` : frameSize\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-content-height',\n\t\t\t`${ contentHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-inner-height',\n\t\t\t`${ iframeWindowInnerHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-container-width',\n\t\t\t`${ containerWidth }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-scale-container-width',\n\t\t\t`${ scaleContainerWidth }px`\n\t\t);\n\n\t\treturn () => {\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-scale'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-frame-size'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-content-height'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-inner-height'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-container-width'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-scale-container-width'\n\t\t\t);\n\t\t};\n\t}, [\n\t\tscale,\n\t\tframeSize,\n\t\tiframeDocument,\n\t\tiframeWindowInnerHeight,\n\t\tcontentHeight,\n\t\tcontainerWidth,\n\t\twindowInnerWidth,\n\t\tisZoomedOut,\n\t\tscaleContainerWidth,\n\t] );\n\n\t// Make sure to not render the before and after focusable div elements in view\n\t// mode. They're only needed to capture focus in edit mode.\n\tconst shouldRenderFocusCaptureElements = tabIndex >= 0 && ! isPreviewMode;\n\n\tconst iframe = (\n\t\t<>\n\t\t\t{ shouldRenderFocusCaptureElements && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: props.style?.height,\n\t\t\t\t\tborder: 0,\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ title }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif ( props.onKeyDown ) {\n\t\t\t\t\t\tprops.onKeyDown( event );\n\t\t\t\t\t}\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\t// We should only stop propagation of the React event,\n\t\t\t\t\t\t// the native event should further bubble inside the\n\t\t\t\t\t\t// iframe to the document and window.\n\t\t\t\t\t\t// Alternatively, we could consider redispatching the\n\t\t\t\t\t\t// native event in the iframe.\n\t\t\t\t\t\tconst { stopPropagation } = event.nativeEvent;\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = () => {};\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = stopPropagation;\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t// We want to prevent React events from bubbling throught the iframe\n\t\t\t\t\t\t// we bubble these manually.\n\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ shouldRenderFocusCaptureElements && after }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-iframe__container\" ref={ windowResizeRef }>\n\t\t\t{ containerResizeListener }\n\t\t\t<div\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-iframe__scale-container',\n\t\t\t\t\tisZoomedOut && 'is-zoomed-out'\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-scale-container-width':\n\t\t\t\t\t\tisZoomedOut && `${ scaleContainerWidth }px`,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframe }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,QAAQ,EACRC,YAAY,EACZC,UAAU,EACVC,OAAO,EACPC,SAAS,EACTC,MAAM,QACA,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;AAAC,S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;MACC+I,SAAS,EAAGpK,IAAI,CACf,sCAAsC,EACtCiI,WAAW,IAAI,eAChB,CAAG;MACHqB,KAAK,EAAG;QACP,yDAAyD,EACxDrB,WAAW,IAAI,GAAIE,mBAAmB;MACxC,CAAG;MAAAlE,QAAA,EAED2F;IAAM,CACJ,CAAC;EAAA,CACF,CAAC;AAER;AAEA,SAASU,aAAaA,CAAE7F,KAAK,EAAEF,GAAG,EAAG;EACpC,MAAMgG,aAAa,GAAGzJ,SAAS,CAC5B8D,MAAM,IACPA,MAAM,CAAEzD,gBAAiB,CAAC,CAAC0D,WAAW,CAAC,CAAC,CAAC2F,uBAAuB,EACjE,EACD,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,oBAAOlJ,IAAA,CAAC0C,MAAM;IAAA,GAAMU,KAAK;IAAGH,YAAY,EAAGC;EAAK,CAAE,CAAC;AACpD;AAEA,eAAepE,UAAU,CAAEmK,aAAc,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { Button, ButtonGroup, SelectControl, __experimentalNumberControl as NumberControl, __experimentalHStack as HStack } from '@wordpress/components';
4
+ import { SelectControl, __experimentalNumberControl as NumberControl, __experimentalHStack as HStack, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption } from '@wordpress/components';
5
5
  import { __ } from '@wordpress/i18n';
6
6
 
7
7
  /**
@@ -11,6 +11,24 @@ import useDimensionHandler from './use-dimension-handler';
11
11
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
12
12
  const IMAGE_SIZE_PRESETS = [25, 50, 75, 100];
13
13
  const noop = () => {};
14
+
15
+ /**
16
+ * Get scaled width and height for the given scale.
17
+ *
18
+ * @param {number} scale The scale to get the scaled width and height for.
19
+ * @param {number} imageWidth The image width.
20
+ * @param {number} imageHeight The image height.
21
+ *
22
+ * @return {Object} The scaled width and height.
23
+ */
24
+ function getScaledWidthAndHeight(scale, imageWidth, imageHeight) {
25
+ const scaledWidth = Math.round(imageWidth * (scale / 100));
26
+ const scaledHeight = Math.round(imageHeight * (scale / 100));
27
+ return {
28
+ scaledWidth,
29
+ scaledHeight
30
+ };
31
+ }
14
32
  export default function ImageSizeControl({
15
33
  imageSizeHelp,
16
34
  imageWidth,
@@ -29,6 +47,35 @@ export default function ImageSizeControl({
29
47
  updateDimension,
30
48
  updateDimensions
31
49
  } = useDimensionHandler(height, width, imageHeight, imageWidth, onChange);
50
+
51
+ /**
52
+ * Updates the dimensions for the given scale.
53
+ * Handler for toggle group control change.
54
+ *
55
+ * @param {number} scale The scale to update the dimensions for.
56
+ */
57
+ const handleUpdateDimensions = scale => {
58
+ if (undefined === scale) {
59
+ updateDimensions();
60
+ return;
61
+ }
62
+ const {
63
+ scaledWidth,
64
+ scaledHeight
65
+ } = getScaledWidthAndHeight(scale, imageWidth, imageHeight);
66
+ updateDimensions(scaledHeight, scaledWidth);
67
+ };
68
+
69
+ /**
70
+ * Add the stored image preset value to toggle group control.
71
+ */
72
+ const selectedValue = IMAGE_SIZE_PRESETS.find(scale => {
73
+ const {
74
+ scaledWidth,
75
+ scaledHeight
76
+ } = getScaledWidthAndHeight(scale, imageWidth, imageHeight);
77
+ return currentWidth === scaledWidth && currentHeight === scaledHeight;
78
+ });
32
79
  return /*#__PURE__*/_jsxs(_Fragment, {
33
80
  children: [imageSizeOptions && imageSizeOptions.length > 0 && /*#__PURE__*/_jsx(SelectControl, {
34
81
  __nextHasNoMarginBottom: true,
@@ -58,26 +105,20 @@ export default function ImageSizeControl({
58
105
  onChange: value => updateDimension('height', value),
59
106
  size: "__unstable-large"
60
107
  })]
61
- }), /*#__PURE__*/_jsxs(HStack, {
62
- children: [/*#__PURE__*/_jsx(ButtonGroup, {
63
- "aria-label": __('Image size presets'),
64
- children: IMAGE_SIZE_PRESETS.map(scale => {
65
- const scaledWidth = Math.round(imageWidth * (scale / 100));
66
- const scaledHeight = Math.round(imageHeight * (scale / 100));
67
- const isCurrent = currentWidth === scaledWidth && currentHeight === scaledHeight;
68
- return /*#__PURE__*/_jsxs(Button, {
69
- size: "small",
70
- variant: isCurrent ? 'primary' : undefined,
71
- isPressed: isCurrent,
72
- onClick: () => updateDimensions(scaledHeight, scaledWidth),
73
- children: [scale, "%"]
74
- }, scale);
75
- })
76
- }), /*#__PURE__*/_jsx(Button, {
77
- size: "small",
78
- onClick: () => updateDimensions(),
79
- children: __('Reset')
80
- })]
108
+ }), /*#__PURE__*/_jsx(ToggleGroupControl, {
109
+ label: __('Image size presets'),
110
+ hideLabelFromVision: true,
111
+ onChange: handleUpdateDimensions,
112
+ value: selectedValue,
113
+ isBlock: true,
114
+ __next40pxDefaultSize: true,
115
+ __nextHasNoMarginBottom: true,
116
+ children: IMAGE_SIZE_PRESETS.map(scale => {
117
+ return /*#__PURE__*/_jsx(ToggleGroupControlOption, {
118
+ value: scale,
119
+ label: `${scale}%`
120
+ }, scale);
121
+ })
81
122
  })]
82
123
  })]
83
124
  });
@@ -1 +1 @@
1
- {"version":3,"names":["Button","ButtonGroup","SelectControl","__experimentalNumberControl","NumberControl","__experimentalHStack","HStack","__","useDimensionHandler","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","IMAGE_SIZE_PRESETS","noop","ImageSizeControl","imageSizeHelp","imageWidth","imageHeight","imageSizeOptions","isResizable","slug","width","height","onChange","onChangeImage","currentHeight","currentWidth","updateDimension","updateDimensions","children","length","__nextHasNoMarginBottom","label","value","options","help","size","className","align","spacing","min","map","scale","scaledWidth","Math","round","scaledHeight","isCurrent","variant","undefined","isPressed","onClick"],"sources":["@wordpress/block-editor/src/components/image-size-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tButtonGroup,\n\tSelectControl,\n\t__experimentalNumberControl as NumberControl,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDimensionHandler from './use-dimension-handler';\n\nconst IMAGE_SIZE_PRESETS = [ 25, 50, 75, 100 ];\nconst noop = () => {};\n\nexport default function ImageSizeControl( {\n\timageSizeHelp,\n\timageWidth,\n\timageHeight,\n\timageSizeOptions = [],\n\tisResizable = true,\n\tslug,\n\twidth,\n\theight,\n\tonChange,\n\tonChangeImage = noop,\n} ) {\n\tconst { currentHeight, currentWidth, updateDimension, updateDimensions } =\n\t\tuseDimensionHandler( height, width, imageHeight, imageWidth, onChange );\n\n\treturn (\n\t\t<>\n\t\t\t{ imageSizeOptions && imageSizeOptions.length > 0 && (\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Resolution' ) }\n\t\t\t\t\tvalue={ slug }\n\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\tonChange={ onChangeImage }\n\t\t\t\t\thelp={ imageSizeHelp }\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isResizable && (\n\t\t\t\t<div className=\"block-editor-image-size-control\">\n\t\t\t\t\t<HStack align=\"baseline\" spacing=\"3\">\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tclassName=\"block-editor-image-size-control__width\"\n\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\tvalue={ currentWidth }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tupdateDimension( 'width', value )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tclassName=\"block-editor-image-size-control__height\"\n\t\t\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\t\t\tvalue={ currentHeight }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tupdateDimension( 'height', value )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<HStack>\n\t\t\t\t\t\t<ButtonGroup aria-label={ __( 'Image size presets' ) }>\n\t\t\t\t\t\t\t{ IMAGE_SIZE_PRESETS.map( ( scale ) => {\n\t\t\t\t\t\t\t\tconst scaledWidth = Math.round(\n\t\t\t\t\t\t\t\t\timageWidth * ( scale / 100 )\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst scaledHeight = Math.round(\n\t\t\t\t\t\t\t\t\timageHeight * ( scale / 100 )\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tconst isCurrent =\n\t\t\t\t\t\t\t\t\tcurrentWidth === scaledWidth &&\n\t\t\t\t\t\t\t\t\tcurrentHeight === scaledHeight;\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tkey={ scale }\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\tisCurrent ? 'primary' : undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisPressed={ isCurrent }\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tupdateDimensions(\n\t\t\t\t\t\t\t\t\t\t\t\tscaledHeight,\n\t\t\t\t\t\t\t\t\t\t\t\tscaledWidth\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ scale }%\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t);\n\t\t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AW,IAAKyB,KAAK,GAAG,GAAG,CAC5B,CAAC;YAED,MAAMK,SAAS,GACdrB,YAAY,KAAKiB,WAAW,IAC5BlB,aAAa,KAAKqB,YAAY;YAE/B,oBACCrC,KAAA,CAACZ,MAAM;cAENuC,IAAI,EAAC,OAAO;cACZY,OAAO,EACND,SAAS,GAAG,SAAS,GAAGE,SACxB;cACDC,SAAS,EAAGH,SAAW;cACvBI,OAAO,EAAGA,CAAA,KACTvB,gBAAgB,CACfkB,YAAY,EACZH,WACD,CACA;cAAAd,QAAA,GAECa,KAAK,EAAE,GACV;YAAA,GAdOA,KAcC,CAAC;UAEX,CAAE;QAAC,CACS,CAAC,eACdnC,IAAA,CAACV,MAAM;UACNuC,IAAI,EAAC,OAAO;UACZe,OAAO,EAAGA,CAAA,KAAMvB,gBAAgB,CAAC,CAAG;UAAAC,QAAA,EAElCzB,EAAE,CAAE,OAAQ;QAAC,CACR,CAAC;MAAA,CACF,CAAC;IAAA,CACL,CACL;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["SelectControl","__experimentalNumberControl","NumberControl","__experimentalHStack","HStack","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","__","useDimensionHandler","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","IMAGE_SIZE_PRESETS","noop","getScaledWidthAndHeight","scale","imageWidth","imageHeight","scaledWidth","Math","round","scaledHeight","ImageSizeControl","imageSizeHelp","imageSizeOptions","isResizable","slug","width","height","onChange","onChangeImage","currentHeight","currentWidth","updateDimension","updateDimensions","handleUpdateDimensions","undefined","selectedValue","find","children","length","__nextHasNoMarginBottom","label","value","options","help","size","className","align","spacing","min","hideLabelFromVision","isBlock","__next40pxDefaultSize","map"],"sources":["@wordpress/block-editor/src/components/image-size-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tSelectControl,\n\t__experimentalNumberControl as NumberControl,\n\t__experimentalHStack as HStack,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDimensionHandler from './use-dimension-handler';\n\nconst IMAGE_SIZE_PRESETS = [ 25, 50, 75, 100 ];\nconst noop = () => {};\n\n/**\n * Get scaled width and height for the given scale.\n *\n * @param {number} scale The scale to get the scaled width and height for.\n * @param {number} imageWidth The image width.\n * @param {number} imageHeight The image height.\n *\n * @return {Object} The scaled width and height.\n */\nfunction getScaledWidthAndHeight( scale, imageWidth, imageHeight ) {\n\tconst scaledWidth = Math.round( imageWidth * ( scale / 100 ) );\n\tconst scaledHeight = Math.round( imageHeight * ( scale / 100 ) );\n\n\treturn {\n\t\tscaledWidth,\n\t\tscaledHeight,\n\t};\n}\n\nexport default function ImageSizeControl( {\n\timageSizeHelp,\n\timageWidth,\n\timageHeight,\n\timageSizeOptions = [],\n\tisResizable = true,\n\tslug,\n\twidth,\n\theight,\n\tonChange,\n\tonChangeImage = noop,\n} ) {\n\tconst { currentHeight, currentWidth, updateDimension, updateDimensions } =\n\t\tuseDimensionHandler( height, width, imageHeight, imageWidth, onChange );\n\n\t/**\n\t * Updates the dimensions for the given scale.\n\t * Handler for toggle group control change.\n\t *\n\t * @param {number} scale The scale to update the dimensions for.\n\t */\n\tconst handleUpdateDimensions = ( scale ) => {\n\t\tif ( undefined === scale ) {\n\t\t\tupdateDimensions();\n\t\t\treturn;\n\t\t}\n\n\t\tconst { scaledWidth, scaledHeight } = getScaledWidthAndHeight(\n\t\t\tscale,\n\t\t\timageWidth,\n\t\t\timageHeight\n\t\t);\n\n\t\tupdateDimensions( scaledHeight, scaledWidth );\n\t};\n\n\t/**\n\t * Add the stored image preset value to toggle group control.\n\t */\n\tconst selectedValue = IMAGE_SIZE_PRESETS.find( ( scale ) => {\n\t\tconst { scaledWidth, scaledHeight } = getScaledWidthAndHeight(\n\t\t\tscale,\n\t\t\timageWidth,\n\t\t\timageHeight\n\t\t);\n\n\t\treturn currentWidth === scaledWidth && currentHeight === scaledHeight;\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t{ imageSizeOptions && imageSizeOptions.length > 0 && (\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Resolution' ) }\n\t\t\t\t\tvalue={ slug }\n\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\tonChange={ onChangeImage }\n\t\t\t\t\thelp={ imageSizeHelp }\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isResizable && (\n\t\t\t\t<div className=\"block-editor-image-size-control\">\n\t\t\t\t\t<HStack align=\"baseline\" spacing=\"3\">\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tclassName=\"block-editor-image-size-control__width\"\n\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\tvalue={ currentWidth }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tupdateDimension( 'width', value )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tclassName=\"block-editor-image-size-control__height\"\n\t\t\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\t\t\tvalue={ currentHeight }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tupdateDimension( 'height', value )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\tlabel={ __( 'Image size presets' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tonChange={ handleUpdateDimensions }\n\t\t\t\t\t\tvalue={ selectedValue }\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t>\n\t\t\t\t\t\t{ IMAGE_SIZE_PRESETS.map( ( scale ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\tkey={ scale }\n\t\t\t\t\t\t\t\t\tvalue={ scale }\n\t\t\t\t\t\t\t\t\tlabel={ `${ scale }%` }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,aAAa,EACbC,2BAA2B,IAAIC,aAAa,EAC5CC,oBAAoB,IAAIC,MAAM,EAC9BC,gCAAgC,IAAIC,kBAAkB,EACtDC,sCAAsC,IAAIC,wBAAwB,QAC5D,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAE1D,MAAMC,kBAAkB,GAAG,CAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAE;AAC9C,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,uBAAuBA,CAAEC,KAAK,EAAEC,UAAU,EAAEC,WAAW,EAAG;EAClE,MAAMC,WAAW,GAAGC,IAAI,CAACC,KAAK,CAAEJ,UAAU,IAAKD,KAAK,GAAG,GAAG,CAAG,CAAC;EAC9D,MAAMM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5B,KAAO;YACf2B,KAAK,EAAG,GAAI3B,KAAK;UAAM,GAFjBA,KAGN,CAAC;QAEJ,CAAE;MAAC,CACgB,CAAC;IAAA,CACjB,CACL;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
@@ -163,17 +163,21 @@ export function useInnerBlocksProps(props = {}, options = {}) {
163
163
  const selected = useSelect(select => {
164
164
  const {
165
165
  getBlockName,
166
- __unstableGetEditorMode,
166
+ isZoomOut,
167
167
  getTemplateLock,
168
168
  getBlockRootClientId,
169
169
  getBlockEditingMode,
170
170
  getBlockSettings,
171
171
  getSectionRootClientId
172
172
  } = unlock(select(blockEditorStore));
173
- let _isDropZoneDisabled;
174
173
  if (!clientId) {
174
+ const sectionRootClientId = getSectionRootClientId();
175
+ // Disable the root drop zone when zoomed out and the section root client id
176
+ // is not the root block list (represented by an empty string).
177
+ // This avoids drag handling bugs caused by having two block lists acting as
178
+ // drop zones - the actual 'root' block list and the section root.
175
179
  return {
176
- isDropZoneDisabled: _isDropZoneDisabled
180
+ isDropZoneDisabled: isZoomOut() && sectionRootClientId !== ''
177
181
  };
178
182
  }
179
183
  const {
@@ -184,8 +188,8 @@ export function useInnerBlocksProps(props = {}, options = {}) {
184
188
  const blockEditingMode = getBlockEditingMode(clientId);
185
189
  const parentClientId = getBlockRootClientId(clientId);
186
190
  const [defaultLayout] = getBlockSettings(clientId, 'layout');
187
- _isDropZoneDisabled = blockEditingMode === 'disabled';
188
- if (__unstableGetEditorMode() === 'zoom-out') {
191
+ let _isDropZoneDisabled = blockEditingMode === 'disabled';
192
+ if (isZoomOut()) {
189
193
  // In zoom out mode, we want to disable the drop zone for the sections.
190
194
  // The inner blocks belonging to the section drop zone is
191
195
  // already disabled by the blocks themselves being disabled.
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useMergeRefs","forwardRef","useMemo","memo","useSelect","getBlockSupport","store","blocksStore","__unstableGetInnerBlocksProps","getInnerBlocksProps","ButtonBlockAppender","DefaultBlockAppender","useNestedSettingsUpdate","useInnerBlockTemplateSync","useBlockContext","BlockListItems","BlockContextProvider","useBlockEditContext","useBlockSync","blockEditorStore","useBlockDropZone","unlock","jsx","_jsx","EMPTY_OBJECT","BlockContext","children","clientId","context","value","BlockListItemsMemo","UncontrolledInnerBlocks","props","allowedBlocks","prioritizedInserterBlocks","defaultBlock","directInsert","__experimentalDefaultBlock","__experimentalDirectInsert","template","templateLock","wrapperRef","templateInsertUpdatesSelection","__experimentalCaptureToolbars","captureToolbars","__experimentalAppenderTagName","renderAppender","orientation","placeholder","layout","name","blockType","parentLock","defaultLayout","defaultLayoutBlockSupport","allowSizingOnChildren","usedLayout","memoedLayout","items","rootClientId","providesContext","Object","keys","length","ControlledInnerBlocks","ForwardedInnerBlocks","ref","innerBlocksProps","useInnerBlocksProps","className","options","__unstableDisableLayoutClassNames","__unstableDisableDropZone","dropZoneElement","__unstableLayoutClassNames","layoutClassNames","selected","select","getBlockName","__unstableGetEditorMode","getTemplateLock","getBlockRootClientId","getBlockEditingMode","getBlockSettings","getSectionRootClientId","_isDropZoneDisabled","isDropZoneDisabled","hasBlockSupport","getBlockType","blockName","blockEditingMode","parentClientId","sectionRootClientId","blockDropZoneRef","isManualPlacement","window","__experimentalEnableGridInteractivity","InnerBlocks","onChange","save","Content"],"sources":["@wordpress/block-editor/src/components/inner-blocks/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useMemo, memo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tgetBlockSupport,\n\tstore as blocksStore,\n\t__unstableGetInnerBlocksProps as getInnerBlocksProps,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport ButtonBlockAppender from './button-block-appender';\nimport DefaultBlockAppender from './default-block-appender';\nimport useNestedSettingsUpdate from './use-nested-settings-update';\nimport useInnerBlockTemplateSync from './use-inner-block-template-sync';\nimport useBlockContext from './use-block-context';\nimport { BlockListItems } from '../block-list';\nimport { BlockContextProvider } from '../block-context';\nimport { useBlockEditContext } from '../block-edit/context';\nimport useBlockSync from '../provider/use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDropZone from '../use-block-drop-zone';\nimport { unlock } from '../../lock-unlock';\n\nconst EMPTY_OBJECT = {};\n\nfunction BlockContext( { children, clientId } ) {\n\tconst context = useBlockContext( clientId );\n\treturn (\n\t\t<BlockContextProvider value={ context }>\n\t\t\t{ children }\n\t\t</BlockContextProvider>\n\t);\n}\n\nconst BlockListItemsMemo = memo( BlockListItems );\n\n/**\n * InnerBlocks is a component which allows a single block to have multiple blocks\n * as children. The UncontrolledInnerBlocks component is used whenever the inner\n * blocks are not controlled by another entity. In other words, it is normally\n * used for inner blocks in the post editor\n *\n * @param {Object} props The component props.\n */\nfunction UncontrolledInnerBlocks( props ) {\n\tconst {\n\t\tclientId,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\twrapperRef,\n\t\ttemplateInsertUpdatesSelection,\n\t\t__experimentalCaptureToolbars: captureToolbars,\n\t\t__experimentalAppenderTagName,\n\t\trenderAppender,\n\t\torientation,\n\t\tplaceholder,\n\t\tlayout,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tdefaultLayout,\n\t} = props;\n\n\tuseNestedSettingsUpdate(\n\t\tclientId,\n\t\tparentLock,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplateLock,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tlayout\n\t);\n\n\tuseInnerBlockTemplateSync(\n\t\tclientId,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection\n\t);\n\n\tconst defaultLayoutBlockSupport =\n\t\tgetBlockSupport( name, 'layout' ) ||\n\t\tgetBlockSupport( name, '__experimentalLayout' ) ||\n\t\tEMPTY_OBJECT;\n\n\tconst { allowSizingOnChildren = false } = defaultLayoutBlockSupport;\n\tconst usedLayout = layout || defaultLayoutBlockSupport;\n\n\tconst memoedLayout = useMemo(\n\t\t() => ( {\n\t\t\t// Default layout will know about any content/wide size defined by the theme.\n\t\t\t...defaultLayout,\n\t\t\t...usedLayout,\n\t\t\t...( allowSizingOnChildren && {\n\t\t\t\tallowSizingOnChildren: true,\n\t\t\t} ),\n\t\t} ),\n\t\t[ defaultLayout, usedLayout, allowSizingOnChildren ]\n\t);\n\n\t// For controlled inner blocks, we don't want a change in blocks to\n\t// re-render the blocks list.\n\tconst items = (\n\t\t<BlockListItemsMemo\n\t\t\trootClientId={ clientId }\n\t\t\trenderAppender={ renderAppender }\n\t\t\t__experimentalAppenderTagName={ __experimentalAppenderTagName }\n\t\t\tlayout={ memoedLayout }\n\t\t\twrapperRef={ wrapperRef }\n\t\t\tplaceholder={ placeholder }\n\t\t/>\n\t);\n\n\tif (\n\t\t! blockType?.providesContext ||\n\t\tObject.keys( blockType.providesContext ).length === 0\n\t) {\n\t\treturn items;\n\t}\n\n\treturn <BlockContext clientId={ clientId }>{ items }</BlockContext>;\n}\n\n/**\n * The controlled inner blocks component wraps the uncontrolled inner blocks\n * component with the blockSync hook. This keeps the innerBlocks of the block in\n * the block-editor store in sync with the blocks of the controlling entity. An\n * example of an inner block controller is a template part block, which provides\n * its own blocks from the template part entity data source.\n *\n * @param {Object} props The component props.\n */\nfunction ControlledInnerBlocks( props ) {\n\tuseBlockSync( props );\n\treturn <UncontrolledInnerBlocks { ...props } />;\n}\n\nconst ForwardedInnerBlocks = forwardRef( ( props, ref ) => {\n\tconst innerBlocksProps = useInnerBlocksProps( { ref }, props );\n\treturn (\n\t\t<div className=\"block-editor-inner-blocks\">\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</div>\n\t);\n} );\n\n/**\n * This hook is used to lightly mark an element as an inner blocks wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * an inner blocks wrapper, automatically rendering inner blocks as children. If\n * you define a ref for the element, it is important to pass the ref to this\n * hook, which the hook in turn will pass to the component through the props it\n * returns. Optionally, you can also pass any other props through this hook, and\n * they will be merged and returned.\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Optional. Inner blocks options.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport function useInnerBlocksProps( props = {}, options = {} ) {\n\tconst {\n\t\t__unstableDisableLayoutClassNames,\n\t\t__unstableDisableDropZone,\n\t\tdropZoneElement,\n\t} = options;\n\tconst {\n\t\tclientId,\n\t\tlayout = null,\n\t\t__unstableLayoutClassNames: layoutClassNames = '',\n\t} = useBlockEditContext();\n\tconst selected = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tgetBlockSettings,\n\t\t\t\tgetSectionRootClientId,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\tlet _isDropZoneDisabled;\n\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn { isDropZoneDisabled: _isDropZoneDisabled };\n\t\t\t}\n\n\t\t\tconst { hasBlockSupport, getBlockType } = select( blocksStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockEditingMode = getBlockEditingMode( clientId );\n\t\t\tconst parentClientId = getBlockRootClientId( clientId );\n\t\t\tconst [ defaultLayout ] = getBlockSettings( clientId, 'layout' );\n\n\t\t\t_isDropZoneDisabled = blockEditingMode === 'disabled';\n\n\t\t\tif ( __unstableGetEditorMode() === 'zoom-out' ) {\n\t\t\t\t// In zoom out mode, we want to disable the drop zone for the sections.\n\t\t\t\t// The inner blocks belonging to the section drop zone is\n\t\t\t\t// already disabled by the blocks themselves being disabled.\n\t\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\n\t\t\t\t_isDropZoneDisabled = clientId !== sectionRootClientId;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t__experimentalCaptureToolbars: hasBlockSupport(\n\t\t\t\t\tblockName,\n\t\t\t\t\t'__experimentalExposeControlsToChildren',\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\tname: blockName,\n\t\t\t\tblockType: getBlockType( blockName ),\n\t\t\t\tparentLock: getTemplateLock( parentClientId ),\n\t\t\t\tparentClientId,\n\t\t\t\tisDropZoneDisabled: _isDropZoneDisabled,\n\t\t\t\tdefaultLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst {\n\t\t__experimentalCaptureToolbars,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tparentClientId,\n\t\tisDropZoneDisabled,\n\t\tdefaultLayout,\n\t} = selected;\n\n\tconst blockDropZoneRef = useBlockDropZone( {\n\t\tdropZoneElement,\n\t\trootClientId: clientId,\n\t\tparentClientId,\n\t} );\n\n\tconst ref = useMergeRefs( [\n\t\tprops.ref,\n\t\t__unstableDisableDropZone ||\n\t\tisDropZoneDisabled ||\n\t\t( layout?.isManualPlacement &&\n\t\t\twindow.__experimentalEnableGridInteractivity )\n\t\t\t? null\n\t\t\t: blockDropZoneRef,\n\t] );\n\n\tconst innerBlocksProps = {\n\t\t__experimentalCaptureToolbars,\n\t\tlayout,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tdefaultLayout,\n\t\t...options,\n\t};\n\tconst InnerBlocks =\n\t\tinnerBlocksProps.value && innerBlocksProps.onChange\n\t\t\t? ControlledInnerBlocks\n\t\t\t: UncontrolledInnerBlocks;\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tclassName: clsx(\n\t\t\tprops.className,\n\t\t\t'block-editor-block-list__layout',\n\t\t\t__unstableDisableLayoutClassNames ? '' : layoutClassNames\n\t\t),\n\t\tchildren: clientId ? (\n\t\t\t<InnerBlocks { ...innerBlocksProps } clientId={ clientId } />\n\t\t) : (\n\t\t\t<BlockListItems { ...options } />\n\t\t),\n\t};\n}\n\nuseInnerBlocksProps.save = getInnerBlocksProps;\n\n// Expose default appender placeholders as components.\nForwardedInnerBlocks.DefaultBlockAppender = DefaultBlockAppender;\nForwardedInnerBlocks.ButtonBlockAppender = ButtonBlockAppender;\n\nForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport default ForwardedInnerBlocks;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,UAAU,EAAEC,OAAO,EAAEC,IAAI,QAAQ,oBAAoB;AAC9D,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,eAAe,EACfC,KAAK,IAAIC,WAAW,EACpBC,6BAA6B,IAAIC,mBAAmB,QAC9C,mBAAmB;;AAE1B;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,OAAOC,eAAe,MAAM,qBAAqB;AACjD,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,oBAAoB,QAAQ,kBAAkB;AACvD,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,OAAOC,YAAY,MAAM,4BAA4B;AACrD,SAASZ,KAAK,IAAIa,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,gBAAgB,MAAM,wBAAwB;AACrD,SAASC,MAAM,QAAQ,mBAAmB;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C,QAAQ,gBACjBJ,IAAA,CAAC0E,WAAW;MAAA,GAAM9B,gBAAgB;MAAGxC,QAAQ,EAAGA;IAAU,CAAE,CAAC,gBAE7DJ,IAAA,CAACR,cAAc;MAAA,GAAMuD;IAAO,CAAI;EAElC,CAAC;AACF;AAEAF,mBAAmB,CAAC+B,IAAI,GAAG1F,mBAAmB;;AAE9C;AACAwD,oBAAoB,CAACtD,oBAAoB,GAAGA,oBAAoB;AAChEsD,oBAAoB,CAACvD,mBAAmB,GAAGA,mBAAmB;AAE9DuD,oBAAoB,CAACmC,OAAO,GAAG,MAAMhC,mBAAmB,CAAC+B,IAAI,CAAC,CAAC,CAACzE,QAAQ;;AAExE;AACA;AACA;AACA,eAAeuC,oBAAoB","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useMergeRefs","forwardRef","useMemo","memo","useSelect","getBlockSupport","store","blocksStore","__unstableGetInnerBlocksProps","getInnerBlocksProps","ButtonBlockAppender","DefaultBlockAppender","useNestedSettingsUpdate","useInnerBlockTemplateSync","useBlockContext","BlockListItems","BlockContextProvider","useBlockEditContext","useBlockSync","blockEditorStore","useBlockDropZone","unlock","jsx","_jsx","EMPTY_OBJECT","BlockContext","children","clientId","context","value","BlockListItemsMemo","UncontrolledInnerBlocks","props","allowedBlocks","prioritizedInserterBlocks","defaultBlock","directInsert","__experimentalDefaultBlock","__experimentalDirectInsert","template","templateLock","wrapperRef","templateInsertUpdatesSelection","__experimentalCaptureToolbars","captureToolbars","__experimentalAppenderTagName","renderAppender","orientation","placeholder","layout","name","blockType","parentLock","defaultLayout","defaultLayoutBlockSupport","allowSizingOnChildren","usedLayout","memoedLayout","items","rootClientId","providesContext","Object","keys","length","ControlledInnerBlocks","ForwardedInnerBlocks","ref","innerBlocksProps","useInnerBlocksProps","className","options","__unstableDisableLayoutClassNames","__unstableDisableDropZone","dropZoneElement","__unstableLayoutClassNames","layoutClassNames","selected","select","getBlockName","isZoomOut","getTemplateLock","getBlockRootClientId","getBlockEditingMode","getBlockSettings","getSectionRootClientId","sectionRootClientId","isDropZoneDisabled","hasBlockSupport","getBlockType","blockName","blockEditingMode","parentClientId","_isDropZoneDisabled","blockDropZoneRef","isManualPlacement","window","__experimentalEnableGridInteractivity","InnerBlocks","onChange","save","Content"],"sources":["@wordpress/block-editor/src/components/inner-blocks/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useMemo, memo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tgetBlockSupport,\n\tstore as blocksStore,\n\t__unstableGetInnerBlocksProps as getInnerBlocksProps,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport ButtonBlockAppender from './button-block-appender';\nimport DefaultBlockAppender from './default-block-appender';\nimport useNestedSettingsUpdate from './use-nested-settings-update';\nimport useInnerBlockTemplateSync from './use-inner-block-template-sync';\nimport useBlockContext from './use-block-context';\nimport { BlockListItems } from '../block-list';\nimport { BlockContextProvider } from '../block-context';\nimport { useBlockEditContext } from '../block-edit/context';\nimport useBlockSync from '../provider/use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDropZone from '../use-block-drop-zone';\nimport { unlock } from '../../lock-unlock';\n\nconst EMPTY_OBJECT = {};\n\nfunction BlockContext( { children, clientId } ) {\n\tconst context = useBlockContext( clientId );\n\treturn (\n\t\t<BlockContextProvider value={ context }>\n\t\t\t{ children }\n\t\t</BlockContextProvider>\n\t);\n}\n\nconst BlockListItemsMemo = memo( BlockListItems );\n\n/**\n * InnerBlocks is a component which allows a single block to have multiple blocks\n * as children. The UncontrolledInnerBlocks component is used whenever the inner\n * blocks are not controlled by another entity. In other words, it is normally\n * used for inner blocks in the post editor\n *\n * @param {Object} props The component props.\n */\nfunction UncontrolledInnerBlocks( props ) {\n\tconst {\n\t\tclientId,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\twrapperRef,\n\t\ttemplateInsertUpdatesSelection,\n\t\t__experimentalCaptureToolbars: captureToolbars,\n\t\t__experimentalAppenderTagName,\n\t\trenderAppender,\n\t\torientation,\n\t\tplaceholder,\n\t\tlayout,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tdefaultLayout,\n\t} = props;\n\n\tuseNestedSettingsUpdate(\n\t\tclientId,\n\t\tparentLock,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplateLock,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tlayout\n\t);\n\n\tuseInnerBlockTemplateSync(\n\t\tclientId,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection\n\t);\n\n\tconst defaultLayoutBlockSupport =\n\t\tgetBlockSupport( name, 'layout' ) ||\n\t\tgetBlockSupport( name, '__experimentalLayout' ) ||\n\t\tEMPTY_OBJECT;\n\n\tconst { allowSizingOnChildren = false } = defaultLayoutBlockSupport;\n\tconst usedLayout = layout || defaultLayoutBlockSupport;\n\n\tconst memoedLayout = useMemo(\n\t\t() => ( {\n\t\t\t// Default layout will know about any content/wide size defined by the theme.\n\t\t\t...defaultLayout,\n\t\t\t...usedLayout,\n\t\t\t...( allowSizingOnChildren && {\n\t\t\t\tallowSizingOnChildren: true,\n\t\t\t} ),\n\t\t} ),\n\t\t[ defaultLayout, usedLayout, allowSizingOnChildren ]\n\t);\n\n\t// For controlled inner blocks, we don't want a change in blocks to\n\t// re-render the blocks list.\n\tconst items = (\n\t\t<BlockListItemsMemo\n\t\t\trootClientId={ clientId }\n\t\t\trenderAppender={ renderAppender }\n\t\t\t__experimentalAppenderTagName={ __experimentalAppenderTagName }\n\t\t\tlayout={ memoedLayout }\n\t\t\twrapperRef={ wrapperRef }\n\t\t\tplaceholder={ placeholder }\n\t\t/>\n\t);\n\n\tif (\n\t\t! blockType?.providesContext ||\n\t\tObject.keys( blockType.providesContext ).length === 0\n\t) {\n\t\treturn items;\n\t}\n\n\treturn <BlockContext clientId={ clientId }>{ items }</BlockContext>;\n}\n\n/**\n * The controlled inner blocks component wraps the uncontrolled inner blocks\n * component with the blockSync hook. This keeps the innerBlocks of the block in\n * the block-editor store in sync with the blocks of the controlling entity. An\n * example of an inner block controller is a template part block, which provides\n * its own blocks from the template part entity data source.\n *\n * @param {Object} props The component props.\n */\nfunction ControlledInnerBlocks( props ) {\n\tuseBlockSync( props );\n\treturn <UncontrolledInnerBlocks { ...props } />;\n}\n\nconst ForwardedInnerBlocks = forwardRef( ( props, ref ) => {\n\tconst innerBlocksProps = useInnerBlocksProps( { ref }, props );\n\treturn (\n\t\t<div className=\"block-editor-inner-blocks\">\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</div>\n\t);\n} );\n\n/**\n * This hook is used to lightly mark an element as an inner blocks wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * an inner blocks wrapper, automatically rendering inner blocks as children. If\n * you define a ref for the element, it is important to pass the ref to this\n * hook, which the hook in turn will pass to the component through the props it\n * returns. Optionally, you can also pass any other props through this hook, and\n * they will be merged and returned.\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Optional. Inner blocks options.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport function useInnerBlocksProps( props = {}, options = {} ) {\n\tconst {\n\t\t__unstableDisableLayoutClassNames,\n\t\t__unstableDisableDropZone,\n\t\tdropZoneElement,\n\t} = options;\n\tconst {\n\t\tclientId,\n\t\tlayout = null,\n\t\t__unstableLayoutClassNames: layoutClassNames = '',\n\t} = useBlockEditContext();\n\tconst selected = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tisZoomOut,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tgetBlockSettings,\n\t\t\t\tgetSectionRootClientId,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tif ( ! clientId ) {\n\t\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\t\t\t\t// Disable the root drop zone when zoomed out and the section root client id\n\t\t\t\t// is not the root block list (represented by an empty string).\n\t\t\t\t// This avoids drag handling bugs caused by having two block lists acting as\n\t\t\t\t// drop zones - the actual 'root' block list and the section root.\n\t\t\t\treturn {\n\t\t\t\t\tisDropZoneDisabled:\n\t\t\t\t\t\tisZoomOut() && sectionRootClientId !== '',\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { hasBlockSupport, getBlockType } = select( blocksStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockEditingMode = getBlockEditingMode( clientId );\n\t\t\tconst parentClientId = getBlockRootClientId( clientId );\n\t\t\tconst [ defaultLayout ] = getBlockSettings( clientId, 'layout' );\n\n\t\t\tlet _isDropZoneDisabled = blockEditingMode === 'disabled';\n\n\t\t\tif ( isZoomOut() ) {\n\t\t\t\t// In zoom out mode, we want to disable the drop zone for the sections.\n\t\t\t\t// The inner blocks belonging to the section drop zone is\n\t\t\t\t// already disabled by the blocks themselves being disabled.\n\t\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\t\t\t\t_isDropZoneDisabled = clientId !== sectionRootClientId;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t__experimentalCaptureToolbars: hasBlockSupport(\n\t\t\t\t\tblockName,\n\t\t\t\t\t'__experimentalExposeControlsToChildren',\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\tname: blockName,\n\t\t\t\tblockType: getBlockType( blockName ),\n\t\t\t\tparentLock: getTemplateLock( parentClientId ),\n\t\t\t\tparentClientId,\n\t\t\t\tisDropZoneDisabled: _isDropZoneDisabled,\n\t\t\t\tdefaultLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst {\n\t\t__experimentalCaptureToolbars,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tparentClientId,\n\t\tisDropZoneDisabled,\n\t\tdefaultLayout,\n\t} = selected;\n\n\tconst blockDropZoneRef = useBlockDropZone( {\n\t\tdropZoneElement,\n\t\trootClientId: clientId,\n\t\tparentClientId,\n\t} );\n\n\tconst ref = useMergeRefs( [\n\t\tprops.ref,\n\t\t__unstableDisableDropZone ||\n\t\tisDropZoneDisabled ||\n\t\t( layout?.isManualPlacement &&\n\t\t\twindow.__experimentalEnableGridInteractivity )\n\t\t\t? null\n\t\t\t: blockDropZoneRef,\n\t] );\n\n\tconst innerBlocksProps = {\n\t\t__experimentalCaptureToolbars,\n\t\tlayout,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tdefaultLayout,\n\t\t...options,\n\t};\n\tconst InnerBlocks =\n\t\tinnerBlocksProps.value && innerBlocksProps.onChange\n\t\t\t? ControlledInnerBlocks\n\t\t\t: UncontrolledInnerBlocks;\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tclassName: clsx(\n\t\t\tprops.className,\n\t\t\t'block-editor-block-list__layout',\n\t\t\t__unstableDisableLayoutClassNames ? '' : layoutClassNames\n\t\t),\n\t\tchildren: clientId ? (\n\t\t\t<InnerBlocks { ...innerBlocksProps } clientId={ clientId } />\n\t\t) : (\n\t\t\t<BlockListItems { ...options } />\n\t\t),\n\t};\n}\n\nuseInnerBlocksProps.save = getInnerBlocksProps;\n\n// Expose default appender placeholders as components.\nForwardedInnerBlocks.DefaultBlockAppender = DefaultBlockAppender;\nForwardedInnerBlocks.ButtonBlockAppender = ButtonBlockAppender;\n\nForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/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MAAMhC,mBAAmB,CAAC+B,IAAI,CAAC,CAAC,CAACzE,QAAQ;;AAExE;AACA;AACA;AACA,eAAeuC,oBAAoB","ignoreList":[]}
@@ -16,6 +16,7 @@ import { PatternsFilter } from './patterns-filter';
16
16
  import { usePatternCategories } from './use-pattern-categories';
17
17
  import { isPatternFiltered, allPatternsCategory, myPatternsCategory, INSERTER_PATTERN_TYPES } from './utils';
18
18
  import { store as blockEditorStore } from '../../../store';
19
+ import { unlock } from '../../../lock-unlock';
19
20
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
20
21
  const noop = () => {};
21
22
  export function PatternCategoryPreviews({
@@ -25,7 +26,7 @@ export function PatternCategoryPreviews({
25
26
  category,
26
27
  showTitlesAsTooltip
27
28
  }) {
28
- const isZoomOutMode = useSelect(select => select(blockEditorStore).__unstableGetEditorMode() === 'zoom-out', []);
29
+ const isZoomOutMode = useSelect(select => unlock(select(blockEditorStore)).isZoomOut(), []);
29
30
  const [allPatterns,, onClickPattern] = usePatternsState(onInsert, rootClientId, category?.name);
30
31
  const [patternSyncFilter, setPatternSyncFilter] = useState('all');
31
32
  const [patternSourceFilter, setPatternSourceFilter] = useState('all');
@@ -58,7 +59,6 @@ export function PatternCategoryPreviews({
58
59
  } = pagingProps;
59
60
 
60
61
  // Hide block pattern preview on unmount.
61
- // eslint-disable-next-line react-hooks/exhaustive-deps
62
62
  useEffect(() => () => onHover(null), []);
63
63
  const onSetPatternSyncFilter = useCallback(value => {
64
64
  setPatternSyncFilter(value);
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","useState","useCallback","useRef","useEffect","__","__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalHeading","Heading","__experimentalText","Text","FlexBlock","useSelect","usePatternsState","BlockPatternsList","usePatternsPaging","PatternsFilter","usePatternCategories","isPatternFiltered","allPatternsCategory","myPatternsCategory","INSERTER_PATTERN_TYPES","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","noop","PatternCategoryPreviews","rootClientId","onInsert","onHover","category","showTitlesAsTooltip","isZoomOutMode","select","__unstableGetEditorMode","allPatterns","onClickPattern","name","patternSyncFilter","setPatternSyncFilter","patternSourceFilter","setPatternSourceFilter","availableCategories","scrollContainerRef","currentCategoryPatterns","filter","pattern","type","user","categories","some","catName","c","includes","pagingProps","changePage","onSetPatternSyncFilter","value","onSetPatternSourceFilter","children","spacing","className","size","level","as","label","length","variant","ref","shownPatterns","categoryPatternsAsyncList","blockPatterns","categoryPatterns","orientation","isDraggable","patternFilter"],"sources":["@wordpress/block-editor/src/components/inserter/block-patterns-tab/pattern-category-previews.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseMemo,\n\tuseState,\n\tuseCallback,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n\tFlexBlock,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport usePatternsState from '../hooks/use-patterns-state';\nimport BlockPatternsList from '../../block-patterns-list';\nimport usePatternsPaging from '../hooks/use-patterns-paging';\nimport { PatternsFilter } from './patterns-filter';\nimport { usePatternCategories } from './use-pattern-categories';\nimport {\n\tisPatternFiltered,\n\tallPatternsCategory,\n\tmyPatternsCategory,\n\tINSERTER_PATTERN_TYPES,\n} from './utils';\nimport { store as blockEditorStore } from '../../../store';\n\nconst noop = () => {};\n\nexport function PatternCategoryPreviews( {\n\trootClientId,\n\tonInsert,\n\tonHover = noop,\n\tcategory,\n\tshowTitlesAsTooltip,\n} ) {\n\tconst isZoomOutMode = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',\n\t\t[]\n\t);\n\tconst [ allPatterns, , onClickPattern ] = usePatternsState(\n\t\tonInsert,\n\t\trootClientId,\n\t\tcategory?.name\n\t);\n\tconst [ patternSyncFilter, setPatternSyncFilter ] = useState( 'all' );\n\tconst [ patternSourceFilter, setPatternSourceFilter ] = useState( 'all' );\n\n\tconst availableCategories = usePatternCategories(\n\t\trootClientId,\n\t\tpatternSourceFilter\n\t);\n\tconst scrollContainerRef = useRef();\n\tconst currentCategoryPatterns = useMemo(\n\t\t() =>\n\t\t\tallPatterns.filter( ( pattern ) => {\n\t\t\t\tif (\n\t\t\t\t\tisPatternFiltered(\n\t\t\t\t\t\tpattern,\n\t\t\t\t\t\tpatternSourceFilter,\n\t\t\t\t\t\tpatternSyncFilter\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif ( category.name === allPatternsCategory.name ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tcategory.name === myPatternsCategory.name &&\n\t\t\t\t\tpattern.type === INSERTER_PATTERN_TYPES.user\n\t\t\t\t) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tif ( category.name === 'uncategorized' ) {\n\t\t\t\t\t// The uncategorized category should show all the patterns without any category...\n\t\t\t\t\tif ( ! pattern.categories ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\n\t\t\t\t\t// ...or with no available category.\n\t\t\t\t\treturn ! pattern.categories.some( ( catName ) =>\n\t\t\t\t\t\tavailableCategories.some( ( c ) => c.name === catName )\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn pattern.categories?.includes( category.name );\n\t\t\t} ),\n\t\t[\n\t\t\tallPatterns,\n\t\t\tavailableCategories,\n\t\t\tcategory.name,\n\t\t\tpatternSourceFilter,\n\t\t\tpatternSyncFilter,\n\t\t]\n\t);\n\n\tconst pagingProps = usePatternsPaging(\n\t\tcurrentCategoryPatterns,\n\t\tcategory,\n\t\tscrollContainerRef\n\t);\n\tconst { changePage } = pagingProps;\n\n\t// Hide block pattern preview on unmount.\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tuseEffect( () => () => onHover( null ), [] );\n\n\tconst onSetPatternSyncFilter = useCallback(\n\t\t( value ) => {\n\t\t\tsetPatternSyncFilter( value );\n\t\t\tchangePage( 1 );\n\t\t},\n\t\t[ setPatternSyncFilter, changePage ]\n\t);\n\tconst onSetPatternSourceFilter = useCallback(\n\t\t( value ) => {\n\t\t\tsetPatternSourceFilter( value );\n\t\t\tchangePage( 1 );\n\t\t},\n\t\t[ setPatternSourceFilter, changePage ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<VStack\n\t\t\t\tspacing={ 2 }\n\t\t\t\tclassName=\"block-editor-inserter__patterns-category-panel-header\"\n\t\t\t>\n\t\t\t\t<HStack>\n\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t<Heading\n\t\t\t\t\t\t\tclassName=\"block-editor-inserter__patterns-category-panel-title\"\n\t\t\t\t\t\t\tsize={ 13 }\n\t\t\t\t\t\t\tlevel={ 4 }\n\t\t\t\t\t\t\tas=\"div\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ category.label }\n\t\t\t\t\t\t</Heading>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t<PatternsFilter\n\t\t\t\t\t\tpatternSyncFilter={ patternSyncFilter }\n\t\t\t\t\t\tpatternSourceFilter={ patternSourceFilter }\n\t\t\t\t\t\tsetPatternSyncFilter={ onSetPatternSyncFilter }\n\t\t\t\t\t\tsetPatternSourceFilter={ onSetPatternSourceFilter }\n\t\t\t\t\t\tscrollContainerRef={ scrollContainerRef }\n\t\t\t\t\t\tcategory={ category }\n\t\t\t\t\t/>\n\t\t\t\t</HStack>\n\t\t\t\t{ ! currentCategoryPatterns.length && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tvariant=\"muted\"\n\t\t\t\t\t\tclassName=\"block-editor-inserter__patterns-category-no-results\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'No results found' ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t\t{ currentCategoryPatterns.length > 0 && (\n\t\t\t\t<>\n\t\t\t\t\t{ isZoomOutMode && (\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tsize=\"12\"\n\t\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t\t\tclassName=\"block-editor-inserter__help-text\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Drag and drop patterns into the canvas.' ) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t) }\n\t\t\t\t\t<BlockPatternsList\n\t\t\t\t\t\tref={ scrollContainerRef }\n\t\t\t\t\t\tshownPatterns={ pagingProps.categoryPatternsAsyncList }\n\t\t\t\t\t\tblockPatterns={ pagingProps.categoryPatterns }\n\t\t\t\t\t\tonClickPattern={ onClickPattern }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tlabel={ category.label }\n\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\tcategory={ category.name }\n\t\t\t\t\t\tisDraggable\n\t\t\t\t\t\tshowTitlesAsTooltip={ showTitlesAsTooltip }\n\t\t\t\t\t\tpatternFilter={ patternSourceFilter }\n\t\t\t\t\t\tpagingProps={ pagingProps }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,OAAO,EACPC,QAAQ,EACRC,WAAW,EACXC,MAAM,EACNC,SAAS,QACH,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,iBAAiB;AAEpC,SACCC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,qBAAqB,IAAIC,OAAO,EAChCC,kBAAkB,IAAIC,IAAI,EAC1BC,SAAS,QACH,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,OAAOC,gBAAgB,MAAM,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C,CACN,eACDuB,IAAA,CAACX,iBAAiB;QACjB2D,GAAG,EAAGzB,kBAAoB;QAC1B0B,aAAa,EAAGf,WAAW,CAACgB,yBAA2B;QACvDC,aAAa,EAAGjB,WAAW,CAACkB,gBAAkB;QAC9CpC,cAAc,EAAGA,cAAgB;QACjCP,OAAO,EAAGA,OAAS;QACnBoC,KAAK,EAAGnC,QAAQ,CAACmC,KAAO;QACxBQ,WAAW,EAAC,UAAU;QACtB3C,QAAQ,EAAGA,QAAQ,CAACO,IAAM;QAC1BqC,WAAW;QACX3C,mBAAmB,EAAGA,mBAAqB;QAC3C4C,aAAa,EAAGnC,mBAAqB;QACrCc,WAAW,EAAGA;MAAa,CAC3B,CAAC;IAAA,CACD,CACF;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","useState","useCallback","useRef","useEffect","__","__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalHeading","Heading","__experimentalText","Text","FlexBlock","useSelect","usePatternsState","BlockPatternsList","usePatternsPaging","PatternsFilter","usePatternCategories","isPatternFiltered","allPatternsCategory","myPatternsCategory","INSERTER_PATTERN_TYPES","store","blockEditorStore","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","noop","PatternCategoryPreviews","rootClientId","onInsert","onHover","category","showTitlesAsTooltip","isZoomOutMode","select","isZoomOut","allPatterns","onClickPattern","name","patternSyncFilter","setPatternSyncFilter","patternSourceFilter","setPatternSourceFilter","availableCategories","scrollContainerRef","currentCategoryPatterns","filter","pattern","type","user","categories","some","catName","c","includes","pagingProps","changePage","onSetPatternSyncFilter","value","onSetPatternSourceFilter","children","spacing","className","size","level","as","label","length","variant","ref","shownPatterns","categoryPatternsAsyncList","blockPatterns","categoryPatterns","orientation","isDraggable","patternFilter"],"sources":["@wordpress/block-editor/src/components/inserter/block-patterns-tab/pattern-category-previews.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseMemo,\n\tuseState,\n\tuseCallback,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n\tFlexBlock,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport usePatternsState from '../hooks/use-patterns-state';\nimport BlockPatternsList from '../../block-patterns-list';\nimport usePatternsPaging from '../hooks/use-patterns-paging';\nimport { PatternsFilter } from './patterns-filter';\nimport { usePatternCategories } from './use-pattern-categories';\nimport {\n\tisPatternFiltered,\n\tallPatternsCategory,\n\tmyPatternsCategory,\n\tINSERTER_PATTERN_TYPES,\n} from './utils';\nimport { store as blockEditorStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst noop = () => {};\n\nexport function PatternCategoryPreviews( {\n\trootClientId,\n\tonInsert,\n\tonHover = noop,\n\tcategory,\n\tshowTitlesAsTooltip,\n} ) {\n\tconst isZoomOutMode = useSelect(\n\t\t( select ) => unlock( select( blockEditorStore ) ).isZoomOut(),\n\t\t[]\n\t);\n\tconst [ allPatterns, , onClickPattern ] = usePatternsState(\n\t\tonInsert,\n\t\trootClientId,\n\t\tcategory?.name\n\t);\n\tconst [ patternSyncFilter, setPatternSyncFilter ] = useState( 'all' );\n\tconst [ patternSourceFilter, setPatternSourceFilter ] = useState( 'all' );\n\n\tconst availableCategories = usePatternCategories(\n\t\trootClientId,\n\t\tpatternSourceFilter\n\t);\n\tconst scrollContainerRef = useRef();\n\tconst currentCategoryPatterns = useMemo(\n\t\t() =>\n\t\t\tallPatterns.filter( ( pattern ) => {\n\t\t\t\tif (\n\t\t\t\t\tisPatternFiltered(\n\t\t\t\t\t\tpattern,\n\t\t\t\t\t\tpatternSourceFilter,\n\t\t\t\t\t\tpatternSyncFilter\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif ( category.name === allPatternsCategory.name ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tcategory.name === myPatternsCategory.name &&\n\t\t\t\t\tpattern.type === INSERTER_PATTERN_TYPES.user\n\t\t\t\t) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tif ( category.name === 'uncategorized' ) {\n\t\t\t\t\t// The uncategorized category should show all the patterns without any category...\n\t\t\t\t\tif ( ! pattern.categories ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\n\t\t\t\t\t// ...or with no available category.\n\t\t\t\t\treturn ! pattern.categories.some( ( catName ) =>\n\t\t\t\t\t\tavailableCategories.some( ( c ) => c.name === catName )\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn pattern.categories?.includes( category.name );\n\t\t\t} ),\n\t\t[\n\t\t\tallPatterns,\n\t\t\tavailableCategories,\n\t\t\tcategory.name,\n\t\t\tpatternSourceFilter,\n\t\t\tpatternSyncFilter,\n\t\t]\n\t);\n\n\tconst pagingProps = usePatternsPaging(\n\t\tcurrentCategoryPatterns,\n\t\tcategory,\n\t\tscrollContainerRef\n\t);\n\tconst { changePage } = pagingProps;\n\n\t// Hide block pattern preview on unmount.\n\tuseEffect( () => () => onHover( null ), [] );\n\n\tconst onSetPatternSyncFilter = useCallback(\n\t\t( value ) => {\n\t\t\tsetPatternSyncFilter( value );\n\t\t\tchangePage( 1 );\n\t\t},\n\t\t[ setPatternSyncFilter, changePage ]\n\t);\n\tconst onSetPatternSourceFilter = useCallback(\n\t\t( value ) => {\n\t\t\tsetPatternSourceFilter( value );\n\t\t\tchangePage( 1 );\n\t\t},\n\t\t[ setPatternSourceFilter, changePage ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<VStack\n\t\t\t\tspacing={ 2 }\n\t\t\t\tclassName=\"block-editor-inserter__patterns-category-panel-header\"\n\t\t\t>\n\t\t\t\t<HStack>\n\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t<Heading\n\t\t\t\t\t\t\tclassName=\"block-editor-inserter__patterns-category-panel-title\"\n\t\t\t\t\t\t\tsize={ 13 }\n\t\t\t\t\t\t\tlevel={ 4 }\n\t\t\t\t\t\t\tas=\"div\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ category.label }\n\t\t\t\t\t\t</Heading>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t<PatternsFilter\n\t\t\t\t\t\tpatternSyncFilter={ patternSyncFilter }\n\t\t\t\t\t\tpatternSourceFilter={ patternSourceFilter }\n\t\t\t\t\t\tsetPatternSyncFilter={ onSetPatternSyncFilter }\n\t\t\t\t\t\tsetPatternSourceFilter={ onSetPatternSourceFilter }\n\t\t\t\t\t\tscrollContainerRef={ scrollContainerRef }\n\t\t\t\t\t\tcategory={ category }\n\t\t\t\t\t/>\n\t\t\t\t</HStack>\n\t\t\t\t{ ! currentCategoryPatterns.length && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tvariant=\"muted\"\n\t\t\t\t\t\tclassName=\"block-editor-inserter__patterns-category-no-results\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'No results found' ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t\t{ currentCategoryPatterns.length > 0 && (\n\t\t\t\t<>\n\t\t\t\t\t{ isZoomOutMode && (\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tsize=\"12\"\n\t\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t\t\tclassName=\"block-editor-inserter__help-text\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Drag and drop patterns into the canvas.' ) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t) }\n\t\t\t\t\t<BlockPatternsList\n\t\t\t\t\t\tref={ scrollContainerRef }\n\t\t\t\t\t\tshownPatterns={ pagingProps.categoryPatternsAsyncList }\n\t\t\t\t\t\tblockPatterns={ pagingProps.categoryPatterns }\n\t\t\t\t\t\tonClickPattern={ onClickPattern }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tlabel={ category.label }\n\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\tcategory={ category.name }\n\t\t\t\t\t\tisDraggable\n\t\t\t\t\t\tshowTitlesAsTooltip={ showTitlesAsTooltip }\n\t\t\t\t\t\tpatternFilter={ patternSourceFilter }\n\t\t\t\t\t\tpagingProps={ pagingProps }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,OAAO,EACPC,QAAQ,EACRC,WAAW,EACXC,MAAM,EACNC,SAAS,QACH,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,iBAAiB;AAEpC,SACCC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,qBAAqB,IAAIC,OAAO,EAChCC,kBAAkB,IAAIC,IAAI,EAC1BC,SAAS,QACH,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,iBAAiB,MAAM,2BAA2B;AACzD,OAAOC,iBAAiB,MAAM,8BAA8B;AAC5D,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,oBAAoB,QAAQ,0BAA0B;AAC/D,SACCC,iBAAiB,EACjBC,mBAAmB,EACnBC,kBAAkB,EAClBC,sBAAsB,QAChB,SAAS;AAChB,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,gBAAgB;AAC1D,SAASC,MAAM,QAAQ,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAE9C,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,OAAO,SAASC,uBAAuBA,CAAE;EACxCC,YAAY;EACZC,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A,CAAC;AAEL","ignoreList":[]}
@@ -111,7 +111,7 @@ export function PatternsFilter({
111
111
  value: patternSyncFilter
112
112
  })
113
113
  }), /*#__PURE__*/_jsx("div", {
114
- className: "block-editor-tool-selector__help",
114
+ className: "block-editor-inserter__patterns-filter-help",
115
115
  children: createInterpolateElement(__('Patterns are available from the <Link>WordPress.org Pattern Directory</Link>, bundled in the active theme, or created by users on this site. Only patterns created on this site can be synced.'), {
116
116
  Link: /*#__PURE__*/_jsx(ExternalLink, {
117
117
  href: __('https://wordpress.org/patterns/')
@@ -1 +1 @@
1
- {"version":3,"names":["SVG","Path","DropdownMenu","MenuGroup","MenuItemsChoice","ExternalLink","__","_x","Icon","useMemo","createInterpolateElement","myPatternsCategory","INSERTER_SYNC_TYPES","INSERTER_PATTERN_TYPES","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","getShouldDisableSyncFilter","sourceFilter","getShouldHideSourcesFilter","category","name","PATTERN_SOURCE_MENU_OPTIONS","value","label","directory","theme","user","PatternsFilter","setPatternSyncFilter","setPatternSourceFilter","patternSyncFilter","patternSourceFilter","scrollContainerRef","currentPatternSourceFilter","shouldDisableSyncFilter","shouldHideSourcesFilter","patternSyncMenuOptions","full","disabled","unsynced","handleSetSourceFilterChange","newSourceFilter","children","popoverProps","placement","toggleProps","size","icon","width","height","viewBox","fill","xmlns","d","choices","onSelect","current","scrollTo","className","Link","href"],"sources":["@wordpress/block-editor/src/components/inserter/block-patterns-tab/patterns-filter.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tSVG,\n\tPath,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItemsChoice,\n\tExternalLink,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { Icon } from '@wordpress/icons';\nimport { useMemo, createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tmyPatternsCategory,\n\tINSERTER_SYNC_TYPES,\n\tINSERTER_PATTERN_TYPES,\n} from './utils';\n\nconst getShouldDisableSyncFilter = ( sourceFilter ) =>\n\tsourceFilter !== 'all' && sourceFilter !== 'user';\nconst getShouldHideSourcesFilter = ( category ) => {\n\treturn category.name === myPatternsCategory.name;\n};\n\nconst PATTERN_SOURCE_MENU_OPTIONS = [\n\t{\n\t\tvalue: 'all',\n\t\tlabel: _x( 'All', 'patterns' ),\n\t},\n\t{\n\t\tvalue: INSERTER_PATTERN_TYPES.directory,\n\t\tlabel: __( 'Pattern Directory' ),\n\t},\n\t{\n\t\tvalue: INSERTER_PATTERN_TYPES.theme,\n\t\tlabel: __( 'Theme & Plugins' ),\n\t},\n\t{\n\t\tvalue: INSERTER_PATTERN_TYPES.user,\n\t\tlabel: __( 'User' ),\n\t},\n];\n\nexport function PatternsFilter( {\n\tsetPatternSyncFilter,\n\tsetPatternSourceFilter,\n\tpatternSyncFilter,\n\tpatternSourceFilter,\n\tscrollContainerRef,\n\tcategory,\n} ) {\n\t// If the category is `myPatterns` then we need to set the source filter to `user`, but\n\t// we do this by deriving from props rather than calling setPatternSourceFilter otherwise\n\t// the user may be confused when switching to another category if the haven't explicity set\n\t// this filter themselves.\n\tconst currentPatternSourceFilter =\n\t\tcategory.name === myPatternsCategory.name\n\t\t\t? INSERTER_PATTERN_TYPES.user\n\t\t\t: patternSourceFilter;\n\n\t// We need to disable the sync filter option if the source filter is not 'all' or 'user'\n\t// otherwise applying them will just result in no patterns being shown.\n\tconst shouldDisableSyncFilter = getShouldDisableSyncFilter(\n\t\tcurrentPatternSourceFilter\n\t);\n\n\t// We also hide the directory and theme source filter if the category is `myPatterns`\n\t// otherwise there will only be one option available.\n\tconst shouldHideSourcesFilter = getShouldHideSourcesFilter( category );\n\n\tconst patternSyncMenuOptions = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tvalue: 'all',\n\t\t\t\tlabel: _x( 'All', 'patterns' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: INSERTER_SYNC_TYPES.full,\n\t\t\t\tlabel: _x( 'Synced', 'patterns' ),\n\t\t\t\tdisabled: shouldDisableSyncFilter,\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: INSERTER_SYNC_TYPES.unsynced,\n\t\t\t\tlabel: _x( 'Not synced', 'patterns' ),\n\t\t\t\tdisabled: shouldDisableSyncFilter,\n\t\t\t},\n\t\t],\n\t\t[ shouldDisableSyncFilter ]\n\t);\n\n\tfunction handleSetSourceFilterChange( newSourceFilter ) {\n\t\tsetPatternSourceFilter( newSourceFilter );\n\t\tif ( getShouldDisableSyncFilter( newSourceFilter ) ) {\n\t\t\tsetPatternSyncFilter( 'all' );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tplacement: 'right-end',\n\t\t\t\t} }\n\t\t\t\tlabel={ __( 'Filter patterns' ) }\n\t\t\t\ttoggleProps={ { size: 'compact' } }\n\t\t\t\ticon={\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<SVG\n\t\t\t\t\t\t\t\twidth=\"24\"\n\t\t\t\t\t\t\t\theight=\"24\"\n\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Path\n\t\t\t\t\t\t\t\t\td=\"M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</SVG>\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{ () => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! shouldHideSourcesFilter && (\n\t\t\t\t\t\t\t<MenuGroup label={ __( 'Source' ) }>\n\t\t\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\t\t\tchoices={ PATTERN_SOURCE_MENU_OPTIONS }\n\t\t\t\t\t\t\t\t\tonSelect={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\thandleSetSourceFilterChange( value );\n\t\t\t\t\t\t\t\t\t\tscrollContainerRef.current?.scrollTo(\n\t\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t\t0\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tvalue={ currentPatternSourceFilter }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<MenuGroup label={ __( 'Type' ) }>\n\t\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\t\tchoices={ patternSyncMenuOptions }\n\t\t\t\t\t\t\t\tonSelect={ ( value ) => {\n\t\t\t\t\t\t\t\t\tsetPatternSyncFilter( value );\n\t\t\t\t\t\t\t\t\tscrollContainerRef.current?.scrollTo(\n\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t0\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tvalue={ patternSyncFilter }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<div className=\"block-editor-tool-selector__help\">\n\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Patterns are available from the <Link>WordPress.org Pattern Directory</Link>, bundled in the active theme, or created by users on this site. Only patterns created on this site can be synced.'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tLink: (\n\t\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\t\thref={ __(\n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,CAAC,eACZnB,IAAA;UAAK+C,SAAS,EAAC,kCAAkC;UAAAhB,QAAA,EAC9CpC,wBAAwB,CACzBJ,EAAE,CACD,gMACD,CAAC,EACD;YACCyD,IAAI,eACHhD,IAAA,CAACV,YAAY;cACZ2D,IAAI,EAAG1D,EAAE,CACR,iCACD;YAAG,CACH;UAEH,CACD;QAAC,CACG,CAAC;MAAA,CACL;IACF,CACY;EAAC,CACd,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["SVG","Path","DropdownMenu","MenuGroup","MenuItemsChoice","ExternalLink","__","_x","Icon","useMemo","createInterpolateElement","myPatternsCategory","INSERTER_SYNC_TYPES","INSERTER_PATTERN_TYPES","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","getShouldDisableSyncFilter","sourceFilter","getShouldHideSourcesFilter","category","name","PATTERN_SOURCE_MENU_OPTIONS","value","label","directory","theme","user","PatternsFilter","setPatternSyncFilter","setPatternSourceFilter","patternSyncFilter","patternSourceFilter","scrollContainerRef","currentPatternSourceFilter","shouldDisableSyncFilter","shouldHideSourcesFilter","patternSyncMenuOptions","full","disabled","unsynced","handleSetSourceFilterChange","newSourceFilter","children","popoverProps","placement","toggleProps","size","icon","width","height","viewBox","fill","xmlns","d","choices","onSelect","current","scrollTo","className","Link","href"],"sources":["@wordpress/block-editor/src/components/inserter/block-patterns-tab/patterns-filter.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tSVG,\n\tPath,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItemsChoice,\n\tExternalLink,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { Icon } from '@wordpress/icons';\nimport { useMemo, createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tmyPatternsCategory,\n\tINSERTER_SYNC_TYPES,\n\tINSERTER_PATTERN_TYPES,\n} from './utils';\n\nconst getShouldDisableSyncFilter = ( sourceFilter ) =>\n\tsourceFilter !== 'all' && sourceFilter !== 'user';\nconst getShouldHideSourcesFilter = ( category ) => {\n\treturn category.name === myPatternsCategory.name;\n};\n\nconst PATTERN_SOURCE_MENU_OPTIONS = [\n\t{\n\t\tvalue: 'all',\n\t\tlabel: _x( 'All', 'patterns' ),\n\t},\n\t{\n\t\tvalue: INSERTER_PATTERN_TYPES.directory,\n\t\tlabel: __( 'Pattern Directory' ),\n\t},\n\t{\n\t\tvalue: INSERTER_PATTERN_TYPES.theme,\n\t\tlabel: __( 'Theme & Plugins' ),\n\t},\n\t{\n\t\tvalue: INSERTER_PATTERN_TYPES.user,\n\t\tlabel: __( 'User' ),\n\t},\n];\n\nexport function PatternsFilter( {\n\tsetPatternSyncFilter,\n\tsetPatternSourceFilter,\n\tpatternSyncFilter,\n\tpatternSourceFilter,\n\tscrollContainerRef,\n\tcategory,\n} ) {\n\t// If the category is `myPatterns` then we need to set the source filter to `user`, but\n\t// we do this by deriving from props rather than calling setPatternSourceFilter otherwise\n\t// the user may be confused when switching to another category if the haven't explicity set\n\t// this filter themselves.\n\tconst currentPatternSourceFilter =\n\t\tcategory.name === myPatternsCategory.name\n\t\t\t? INSERTER_PATTERN_TYPES.user\n\t\t\t: patternSourceFilter;\n\n\t// We need to disable the sync filter option if the source filter is not 'all' or 'user'\n\t// otherwise applying them will just result in no patterns being shown.\n\tconst shouldDisableSyncFilter = getShouldDisableSyncFilter(\n\t\tcurrentPatternSourceFilter\n\t);\n\n\t// We also hide the directory and theme source filter if the category is `myPatterns`\n\t// otherwise there will only be one option available.\n\tconst shouldHideSourcesFilter = getShouldHideSourcesFilter( category );\n\n\tconst patternSyncMenuOptions = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tvalue: 'all',\n\t\t\t\tlabel: _x( 'All', 'patterns' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: INSERTER_SYNC_TYPES.full,\n\t\t\t\tlabel: _x( 'Synced', 'patterns' ),\n\t\t\t\tdisabled: shouldDisableSyncFilter,\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: INSERTER_SYNC_TYPES.unsynced,\n\t\t\t\tlabel: _x( 'Not synced', 'patterns' ),\n\t\t\t\tdisabled: shouldDisableSyncFilter,\n\t\t\t},\n\t\t],\n\t\t[ shouldDisableSyncFilter ]\n\t);\n\n\tfunction handleSetSourceFilterChange( newSourceFilter ) {\n\t\tsetPatternSourceFilter( newSourceFilter );\n\t\tif ( getShouldDisableSyncFilter( newSourceFilter ) ) {\n\t\t\tsetPatternSyncFilter( 'all' );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tplacement: 'right-end',\n\t\t\t\t} }\n\t\t\t\tlabel={ __( 'Filter patterns' ) }\n\t\t\t\ttoggleProps={ { size: 'compact' } }\n\t\t\t\ticon={\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<SVG\n\t\t\t\t\t\t\t\twidth=\"24\"\n\t\t\t\t\t\t\t\theight=\"24\"\n\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Path\n\t\t\t\t\t\t\t\t\td=\"M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</SVG>\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{ () => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! shouldHideSourcesFilter && (\n\t\t\t\t\t\t\t<MenuGroup label={ __( 'Source' ) }>\n\t\t\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\t\t\tchoices={ PATTERN_SOURCE_MENU_OPTIONS }\n\t\t\t\t\t\t\t\t\tonSelect={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\thandleSetSourceFilterChange( value );\n\t\t\t\t\t\t\t\t\t\tscrollContainerRef.current?.scrollTo(\n\t\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t\t0\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tvalue={ currentPatternSourceFilter }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<MenuGroup label={ __( 'Type' ) }>\n\t\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\t\tchoices={ patternSyncMenuOptions }\n\t\t\t\t\t\t\t\tonSelect={ ( value ) => {\n\t\t\t\t\t\t\t\t\tsetPatternSyncFilter( value );\n\t\t\t\t\t\t\t\t\tscrollContainerRef.current?.scrollTo(\n\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t0\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tvalue={ patternSyncFilter }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<div className=\"block-editor-inserter__patterns-filter-help\">\n\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Patterns are available from the <Link>WordPress.org Pattern Directory</Link>, bundled in the active theme, or created by users on this site. Only patterns created on this site can be synced.'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tLink: (\n\t\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/patterns/'\n\t\t\t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