@wordpress/block-editor 14.9.0 → 14.10.1

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 (370) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +40 -0
  4. package/build/components/audio-player/index.native.js +1 -1
  5. package/build/components/audio-player/index.native.js.map +1 -1
  6. package/build/components/background-image-control/index.js +4 -0
  7. package/build/components/background-image-control/index.js.map +1 -1
  8. package/build/components/block-alignment-matrix-control/index.js +32 -0
  9. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  10. package/build/components/block-card/index.js +45 -8
  11. package/build/components/block-card/index.js.map +1 -1
  12. package/build/components/block-edit/edit.js +147 -10
  13. package/build/components/block-edit/edit.js.map +1 -1
  14. package/build/components/block-list/index.js +1 -2
  15. package/build/components/block-list/index.js.map +1 -1
  16. package/build/components/block-list/use-block-props/index.js +2 -2
  17. package/build/components/block-list/use-block-props/index.js.map +1 -1
  18. package/build/components/block-list/zoom-out-separator.js +20 -3
  19. package/build/components/block-list/zoom-out-separator.js.map +1 -1
  20. package/build/components/block-settings-menu/block-settings-dropdown.js +5 -8
  21. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  22. package/build/components/block-styles/utils.js +3 -3
  23. package/build/components/block-styles/utils.js.map +1 -1
  24. package/build/components/block-tools/zoom-out-mode-inserters.js +19 -6
  25. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  26. package/build/components/button-block-appender/index.js +1 -5
  27. package/build/components/button-block-appender/index.js.map +1 -1
  28. package/build/components/child-layout-control/index.js +6 -0
  29. package/build/components/child-layout-control/index.js.map +1 -1
  30. package/build/components/colors-gradients/dropdown.js +51 -11
  31. package/build/components/colors-gradients/dropdown.js.map +1 -1
  32. package/build/components/contrast-checker/index.native.js +1 -1
  33. package/build/components/contrast-checker/index.native.js.map +1 -1
  34. package/build/components/date-format-picker/index.js +7 -16
  35. package/build/components/date-format-picker/index.js.map +1 -1
  36. package/build/components/font-appearance-control/index.js +9 -0
  37. package/build/components/font-appearance-control/index.js.map +1 -1
  38. package/build/components/font-family/index.js +10 -1
  39. package/build/components/font-family/index.js.map +1 -1
  40. package/build/components/global-styles/color-panel.js +3 -0
  41. package/build/components/global-styles/color-panel.js.map +1 -1
  42. package/build/components/global-styles/typography-utils.js +1 -1
  43. package/build/components/global-styles/typography-utils.js.map +1 -1
  44. package/build/components/global-styles/use-global-styles-output.js +2 -2
  45. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  46. package/build/components/grid/grid-visualizer.js +9 -0
  47. package/build/components/grid/grid-visualizer.js.map +1 -1
  48. package/build/components/grid/utils.js +12 -1
  49. package/build/components/grid/utils.js.map +1 -1
  50. package/build/components/iframe/index.js +1 -1
  51. package/build/components/iframe/index.js.map +1 -1
  52. package/build/components/inner-blocks/use-inner-block-template-sync.js +11 -11
  53. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  54. package/build/components/inserter/block-patterns-explorer/index.js +1 -1
  55. package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
  56. package/build/components/inserter/block-patterns-tab/index.js +1 -1
  57. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  58. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
  59. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  60. package/build/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
  61. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  62. package/build/components/inserter/category-tabs/index.js +1 -2
  63. package/build/components/inserter/category-tabs/index.js.map +1 -1
  64. package/build/components/inserter/index.js +6 -15
  65. package/build/components/inserter/index.js.map +1 -1
  66. package/build/components/inserter/quick-inserter.js +2 -13
  67. package/build/components/inserter/quick-inserter.js.map +1 -1
  68. package/build/components/keyboard-shortcuts/index.js +2 -2
  69. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  70. package/build/components/line-height-control/index.js +9 -0
  71. package/build/components/line-height-control/index.js.map +1 -1
  72. package/build/components/media-placeholder/index.js +2 -2
  73. package/build/components/media-placeholder/index.js.map +1 -1
  74. package/build/components/media-replace-flow/index.js +26 -26
  75. package/build/components/media-replace-flow/index.js.map +1 -1
  76. package/build/components/plain-text/index.js +34 -0
  77. package/build/components/plain-text/index.js.map +1 -1
  78. package/build/components/provider/index.js +61 -5
  79. package/build/components/provider/index.js.map +1 -1
  80. package/build/components/provider/use-media-upload-settings.js +28 -0
  81. package/build/components/provider/use-media-upload-settings.js.map +1 -0
  82. package/build/components/resolution-tool/index.js +3 -1
  83. package/build/components/resolution-tool/index.js.map +1 -1
  84. package/build/components/responsive-block-control/index.js +1 -1
  85. package/build/components/responsive-block-control/index.js.map +1 -1
  86. package/build/components/rich-text/event-listeners/delete.js +7 -1
  87. package/build/components/rich-text/event-listeners/delete.js.map +1 -1
  88. package/build/components/rich-text/index.js +2 -2
  89. package/build/components/rich-text/index.js.map +1 -1
  90. package/build/components/use-block-drop-zone/index.js +2 -1
  91. package/build/components/use-block-drop-zone/index.js.map +1 -1
  92. package/build/hooks/background.js +2 -0
  93. package/build/hooks/background.js.map +1 -1
  94. package/build/hooks/block-bindings.js +15 -14
  95. package/build/hooks/block-bindings.js.map +1 -1
  96. package/build/hooks/border.js +3 -3
  97. package/build/hooks/border.js.map +1 -1
  98. package/build/hooks/color.js +1 -1
  99. package/build/hooks/color.js.map +1 -1
  100. package/build/hooks/dimensions.js +2 -2
  101. package/build/hooks/dimensions.js.map +1 -1
  102. package/build/hooks/font-family.js +1 -1
  103. package/build/hooks/font-family.js.map +1 -1
  104. package/build/hooks/gap.js +2 -2
  105. package/build/hooks/gap.js.map +1 -1
  106. package/build/hooks/index.js +0 -1
  107. package/build/hooks/index.js.map +1 -1
  108. package/build/hooks/index.native.js +7 -0
  109. package/build/hooks/index.native.js.map +1 -1
  110. package/build/hooks/style.js +7 -7
  111. package/build/hooks/style.js.map +1 -1
  112. package/build/hooks/supports.js +7 -7
  113. package/build/hooks/supports.js.map +1 -1
  114. package/build/hooks/typography.js +6 -6
  115. package/build/hooks/typography.js.map +1 -1
  116. package/build/hooks/use-zoom-out.js +12 -1
  117. package/build/hooks/use-zoom-out.js.map +1 -1
  118. package/build/hooks/utils.js +1 -1
  119. package/build/hooks/utils.js.map +1 -1
  120. package/build/store/private-actions.js +1 -1
  121. package/build/store/private-actions.js.map +1 -1
  122. package/build/store/private-selectors.js +11 -1
  123. package/build/store/private-selectors.js.map +1 -1
  124. package/build/store/reducer.js +93 -12
  125. package/build/store/reducer.js.map +1 -1
  126. package/build/store/selectors.js +6 -8
  127. package/build/store/selectors.js.map +1 -1
  128. package/build/utils/block-bindings.js +95 -0
  129. package/build/utils/block-bindings.js.map +1 -1
  130. package/build-module/components/audio-player/index.native.js +2 -2
  131. package/build-module/components/audio-player/index.native.js.map +1 -1
  132. package/build-module/components/background-image-control/index.js +5 -1
  133. package/build-module/components/background-image-control/index.js.map +1 -1
  134. package/build-module/components/block-alignment-matrix-control/index.js +32 -0
  135. package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
  136. package/build-module/components/block-card/index.js +45 -8
  137. package/build-module/components/block-card/index.js.map +1 -1
  138. package/build-module/components/block-edit/edit.js +148 -11
  139. package/build-module/components/block-edit/edit.js.map +1 -1
  140. package/build-module/components/block-list/index.js +2 -3
  141. package/build-module/components/block-list/index.js.map +1 -1
  142. package/build-module/components/block-list/use-block-props/index.js +1 -1
  143. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  144. package/build-module/components/block-list/zoom-out-separator.js +20 -3
  145. package/build-module/components/block-list/zoom-out-separator.js.map +1 -1
  146. package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -8
  147. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  148. package/build-module/components/block-styles/utils.js +3 -3
  149. package/build-module/components/block-styles/utils.js.map +1 -1
  150. package/build-module/components/block-tools/zoom-out-mode-inserters.js +19 -6
  151. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  152. package/build-module/components/button-block-appender/index.js +2 -6
  153. package/build-module/components/button-block-appender/index.js.map +1 -1
  154. package/build-module/components/child-layout-control/index.js +7 -1
  155. package/build-module/components/child-layout-control/index.js.map +1 -1
  156. package/build-module/components/colors-gradients/dropdown.js +51 -11
  157. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  158. package/build-module/components/contrast-checker/index.native.js +2 -2
  159. package/build-module/components/contrast-checker/index.native.js.map +1 -1
  160. package/build-module/components/date-format-picker/index.js +7 -16
  161. package/build-module/components/date-format-picker/index.js.map +1 -1
  162. package/build-module/components/font-appearance-control/index.js +8 -0
  163. package/build-module/components/font-appearance-control/index.js.map +1 -1
  164. package/build-module/components/font-family/index.js +10 -1
  165. package/build-module/components/font-family/index.js.map +1 -1
  166. package/build-module/components/global-styles/color-panel.js +3 -0
  167. package/build-module/components/global-styles/color-panel.js.map +1 -1
  168. package/build-module/components/global-styles/typography-utils.js +1 -1
  169. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  170. package/build-module/components/global-styles/use-global-styles-output.js +2 -2
  171. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  172. package/build-module/components/grid/grid-visualizer.js +9 -0
  173. package/build-module/components/grid/grid-visualizer.js.map +1 -1
  174. package/build-module/components/grid/utils.js +12 -1
  175. package/build-module/components/grid/utils.js.map +1 -1
  176. package/build-module/components/iframe/index.js +1 -1
  177. package/build-module/components/iframe/index.js.map +1 -1
  178. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +12 -12
  179. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  180. package/build-module/components/inserter/block-patterns-explorer/index.js +1 -1
  181. package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
  182. package/build-module/components/inserter/block-patterns-tab/index.js +1 -1
  183. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  184. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
  185. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  186. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
  187. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  188. package/build-module/components/inserter/category-tabs/index.js +1 -2
  189. package/build-module/components/inserter/category-tabs/index.js.map +1 -1
  190. package/build-module/components/inserter/index.js +6 -15
  191. package/build-module/components/inserter/index.js.map +1 -1
  192. package/build-module/components/inserter/quick-inserter.js +2 -13
  193. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  194. package/build-module/components/keyboard-shortcuts/index.js +2 -2
  195. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  196. package/build-module/components/line-height-control/index.js +8 -0
  197. package/build-module/components/line-height-control/index.js.map +1 -1
  198. package/build-module/components/media-placeholder/index.js +3 -3
  199. package/build-module/components/media-placeholder/index.js.map +1 -1
  200. package/build-module/components/media-replace-flow/index.js +28 -28
  201. package/build-module/components/media-replace-flow/index.js.map +1 -1
  202. package/build-module/components/plain-text/index.js +34 -0
  203. package/build-module/components/plain-text/index.js.map +1 -1
  204. package/build-module/components/provider/index.js +62 -5
  205. package/build-module/components/provider/index.js.map +1 -1
  206. package/build-module/components/provider/use-media-upload-settings.js +22 -0
  207. package/build-module/components/provider/use-media-upload-settings.js.map +1 -0
  208. package/build-module/components/resolution-tool/index.js +3 -1
  209. package/build-module/components/resolution-tool/index.js.map +1 -1
  210. package/build-module/components/responsive-block-control/index.js +1 -1
  211. package/build-module/components/responsive-block-control/index.js.map +1 -1
  212. package/build-module/components/rich-text/event-listeners/delete.js +7 -1
  213. package/build-module/components/rich-text/event-listeners/delete.js.map +1 -1
  214. package/build-module/components/rich-text/index.js +1 -1
  215. package/build-module/components/rich-text/index.js.map +1 -1
  216. package/build-module/components/use-block-drop-zone/index.js +2 -1
  217. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  218. package/build-module/hooks/background.js +2 -0
  219. package/build-module/hooks/background.js.map +1 -1
  220. package/build-module/hooks/block-bindings.js +13 -12
  221. package/build-module/hooks/block-bindings.js.map +1 -1
  222. package/build-module/hooks/border.js +3 -3
  223. package/build-module/hooks/border.js.map +1 -1
  224. package/build-module/hooks/color.js +1 -1
  225. package/build-module/hooks/color.js.map +1 -1
  226. package/build-module/hooks/dimensions.js +2 -2
  227. package/build-module/hooks/dimensions.js.map +1 -1
  228. package/build-module/hooks/font-family.js +1 -1
  229. package/build-module/hooks/font-family.js.map +1 -1
  230. package/build-module/hooks/gap.js +2 -2
  231. package/build-module/hooks/gap.js.map +1 -1
  232. package/build-module/hooks/index.js +0 -1
  233. package/build-module/hooks/index.js.map +1 -1
  234. package/build-module/hooks/index.native.js +1 -0
  235. package/build-module/hooks/index.native.js.map +1 -1
  236. package/build-module/hooks/style.js +7 -7
  237. package/build-module/hooks/style.js.map +1 -1
  238. package/build-module/hooks/supports.js +7 -7
  239. package/build-module/hooks/supports.js.map +1 -1
  240. package/build-module/hooks/typography.js +6 -6
  241. package/build-module/hooks/typography.js.map +1 -1
  242. package/build-module/hooks/use-zoom-out.js +12 -2
  243. package/build-module/hooks/use-zoom-out.js.map +1 -1
  244. package/build-module/hooks/utils.js +1 -1
  245. package/build-module/hooks/utils.js.map +1 -1
  246. package/build-module/store/private-actions.js +1 -1
  247. package/build-module/store/private-actions.js.map +1 -1
  248. package/build-module/store/private-selectors.js +11 -1
  249. package/build-module/store/private-selectors.js.map +1 -1
  250. package/build-module/store/reducer.js +93 -12
  251. package/build-module/store/reducer.js.map +1 -1
  252. package/build-module/store/selectors.js +6 -8
  253. package/build-module/store/selectors.js.map +1 -1
  254. package/build-module/utils/block-bindings.js +90 -0
  255. package/build-module/utils/block-bindings.js.map +1 -1
  256. package/build-style/style-rtl.css +27 -9
  257. package/build-style/style.css +27 -9
  258. package/package.json +33 -33
  259. package/src/components/audio-player/index.native.js +2 -2
  260. package/src/components/background-image-control/index.js +4 -0
  261. package/src/components/background-image-control/style.scss +4 -2
  262. package/src/components/block-alignment-matrix-control/README.md +29 -6
  263. package/src/components/block-alignment-matrix-control/index.js +31 -0
  264. package/src/components/block-alignment-matrix-control/stories/index.story.js +78 -0
  265. package/src/components/block-card/README.md +7 -0
  266. package/src/components/block-card/index.js +41 -12
  267. package/src/components/block-card/stories/index.story.js +79 -0
  268. package/src/components/block-card/style.scss +9 -1
  269. package/src/components/block-edit/edit.js +218 -11
  270. package/src/components/block-list/index.js +2 -7
  271. package/src/components/block-list/use-block-props/index.js +1 -1
  272. package/src/components/block-list/zoom-out-separator.js +30 -0
  273. package/src/components/block-settings-menu/block-settings-dropdown.js +17 -20
  274. package/src/components/block-styles/utils.js +3 -3
  275. package/src/components/block-title/stories/index.story.js +76 -0
  276. package/src/components/block-tools/style.scss +1 -0
  277. package/src/components/block-tools/zoom-out-mode-inserters.js +21 -3
  278. package/src/components/border-radius-control/README.md +59 -0
  279. package/src/components/border-radius-control/stories/index.story.js +58 -0
  280. package/src/components/button-block-appender/index.js +2 -7
  281. package/src/components/child-layout-control/index.js +14 -0
  282. package/src/components/colors-gradients/dropdown.js +57 -8
  283. package/src/components/colors-gradients/style.scss +5 -0
  284. package/src/components/contrast-checker/index.native.js +2 -2
  285. package/src/components/contrast-checker/stories/index.story.js +117 -0
  286. package/src/components/date-format-picker/README.md +6 -13
  287. package/src/components/date-format-picker/index.js +10 -17
  288. package/src/components/date-format-picker/stories/index.story.js +69 -0
  289. package/src/components/date-format-picker/style.scss +3 -1
  290. package/src/components/default-block-appender/content.scss +1 -0
  291. package/src/components/dimensions-tool/stories/aspect-ratio-tool.story.js +2 -1
  292. package/src/components/dimensions-tool/stories/index.story.js +2 -1
  293. package/src/components/dimensions-tool/stories/scale-tool.story.js +2 -1
  294. package/src/components/dimensions-tool/stories/width-height-tool.story.js +2 -1
  295. package/src/components/font-appearance-control/index.js +15 -0
  296. package/src/components/font-family/README.md +1 -0
  297. package/src/components/font-family/index.js +17 -1
  298. package/src/components/font-family/stories/index.story.js +1 -0
  299. package/src/components/global-styles/color-panel.js +3 -0
  300. package/src/components/global-styles/test/use-global-styles-output.js +1 -1
  301. package/src/components/global-styles/typography-utils.js +1 -1
  302. package/src/components/global-styles/use-global-styles-output.js +2 -2
  303. package/src/components/grid/grid-visualizer.js +11 -0
  304. package/src/components/grid/utils.js +19 -1
  305. package/src/components/iframe/index.js +1 -1
  306. package/src/components/inner-blocks/use-inner-block-template-sync.js +17 -10
  307. package/src/components/inserter/block-patterns-explorer/index.js +2 -3
  308. package/src/components/inserter/block-patterns-tab/index.js +3 -1
  309. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
  310. package/src/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
  311. package/src/components/inserter/category-tabs/index.js +3 -2
  312. package/src/components/inserter/index.js +1 -13
  313. package/src/components/inserter/quick-inserter.js +2 -25
  314. package/src/components/keyboard-shortcuts/index.js +2 -2
  315. package/src/components/line-height-control/README.md +1 -0
  316. package/src/components/line-height-control/index.js +12 -0
  317. package/src/components/line-height-control/stories/index.story.js +1 -0
  318. package/src/components/line-height-control/test/index.js +7 -1
  319. package/src/components/list-view/style.scss +10 -5
  320. package/src/components/media-placeholder/index.js +3 -3
  321. package/src/components/media-replace-flow/README.md +7 -0
  322. package/src/components/media-replace-flow/index.js +28 -36
  323. package/src/components/media-replace-flow/style.scss +6 -6
  324. package/src/components/plain-text/README.md +2 -2
  325. package/src/components/plain-text/index.js +34 -0
  326. package/src/components/plain-text/stories/index.story.js +75 -0
  327. package/src/components/provider/index.js +81 -4
  328. package/src/components/provider/use-media-upload-settings.js +25 -0
  329. package/src/components/resolution-tool/index.js +2 -0
  330. package/src/components/resolution-tool/stories/index.story.js +36 -8
  331. package/src/components/responsive-block-control/index.js +1 -1
  332. package/src/components/rich-text/event-listeners/delete.js +6 -1
  333. package/src/components/rich-text/index.js +1 -1
  334. package/src/components/text-alignment-control/README.md +49 -0
  335. package/src/components/text-alignment-control/stories/index.story.js +56 -18
  336. package/src/components/text-decoration-control/README.md +0 -1
  337. package/src/components/text-decoration-control/stories/index.story.js +51 -16
  338. package/src/components/text-transform-control/README.md +3 -4
  339. package/src/components/text-transform-control/stories/index.story.js +53 -16
  340. package/src/components/use-block-drop-zone/index.js +8 -1
  341. package/src/components/warning/stories/index.story.js +86 -0
  342. package/src/hooks/background.js +6 -0
  343. package/src/hooks/block-bindings.js +17 -18
  344. package/src/hooks/border.js +9 -3
  345. package/src/hooks/color.js +1 -1
  346. package/src/hooks/dimensions.js +2 -2
  347. package/src/hooks/font-family.js +1 -1
  348. package/src/hooks/gap.js +2 -2
  349. package/src/hooks/index.js +0 -1
  350. package/src/hooks/index.native.js +1 -0
  351. package/src/hooks/style.js +13 -7
  352. package/src/hooks/supports.js +7 -7
  353. package/src/hooks/test/style.js +2 -1
  354. package/src/hooks/typography.js +6 -6
  355. package/src/hooks/use-zoom-out.js +10 -2
  356. package/src/hooks/utils.js +1 -1
  357. package/src/store/private-actions.js +1 -0
  358. package/src/store/private-selectors.js +15 -5
  359. package/src/store/reducer.js +112 -19
  360. package/src/store/selectors.js +6 -8
  361. package/src/store/test/private-selectors.js +53 -9
  362. package/src/store/test/reducer.js +172 -166
  363. package/src/store/test/selectors.js +23 -0
  364. package/src/utils/block-bindings.js +95 -0
  365. package/tsconfig.json +2 -5
  366. package/build/hooks/use-bindings-attributes.js +0 -262
  367. package/build/hooks/use-bindings-attributes.js.map +0 -1
  368. package/build-module/hooks/use-bindings-attributes.js +0 -253
  369. package/build-module/hooks/use-bindings-attributes.js.map +0 -1
  370. package/src/hooks/use-bindings-attributes.js +0 -322
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","deprecated","Button","__experimentalText","Text","__experimentalVStack","VStack","chevronLeft","chevronRight","__","_x","isRTL","sprintf","useSelect","useDispatch","BlockIcon","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","BlockCard","title","icon","description","blockType","className","name","since","alternative","parentNavBlockClientId","select","getSelectedBlockClientId","getBlockParentsByBlockName","_selectedBlockClientId","selectBlock","children","onClick","label","style","minWidth","padding","size","showColors","spacing","length"],"sources":["@wordpress/block-editor/src/components/block-card/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport { __, _x, isRTL, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\n\nfunction BlockCard( { title, icon, description, blockType, className, name } ) {\n\tif ( blockType ) {\n\t\tdeprecated( '`blockType` property in `BlockCard component`', {\n\t\t\tsince: '5.7',\n\t\t\talternative: '`title, icon and description` properties',\n\t\t} );\n\t\t( { title, icon, description } = blockType );\n\t}\n\n\tconst { parentNavBlockClientId } = useSelect( ( select ) => {\n\t\tconst { getSelectedBlockClientId, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst _selectedBlockClientId = getSelectedBlockClientId();\n\n\t\treturn {\n\t\t\tparentNavBlockClientId: getBlockParentsByBlockName(\n\t\t\t\t_selectedBlockClientId,\n\t\t\t\t'core/navigation',\n\t\t\t\ttrue\n\t\t\t)[ 0 ],\n\t\t};\n\t}, [] );\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<div className={ clsx( 'block-editor-block-card', className ) }>\n\t\t\t{ parentNavBlockClientId && ( // This is only used by the Navigation block for now. It's not ideal having Navigation block specific code here.\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ () => selectBlock( parentNavBlockClientId ) }\n\t\t\t\t\tlabel={ __( 'Go to parent Navigation block' ) }\n\t\t\t\t\tstyle={\n\t\t\t\t\t\t// TODO: This style override is also used in ToolsPanelHeader.\n\t\t\t\t\t\t// It should be supported out-of-the-box by Button.\n\t\t\t\t\t\t{ minWidth: 24, padding: 0 }\n\t\t\t\t\t}\n\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<BlockIcon icon={ icon } showColors />\n\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t<h2 className=\"block-editor-block-card__title\">\n\t\t\t\t\t{ name?.length\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: 1: Custom block name. 2: Block title.\n\t\t\t\t\t\t\t\t_x( '%1$s (%2$s)', 'block label' ),\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: title }\n\t\t\t\t</h2>\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text className=\"block-editor-block-card__description\">\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nexport default BlockCard;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SACCC,MAAM,EACNC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,WAAW,EAAEC,YAAY,QAAQ,kBAAkB;AAC5D,SAASC,EAAE,EAAEC,EAAE,EAAEC,KAAK,EAAEC,OAAO,QAAQ,iBAAiB;AACxD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,OAAOC,SAAS,MAAM,eAAe;AACrC,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAExD,SAASC,SAASA,CAAE;EAAEC,KAAK;EAAEC,IAAI;EAAEC,WAA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AM;MAACuC,OAAO,EAAG,CAAG;MAAAR,QAAA,gBACpBlB,IAAA;QAAIQ,SAAS,EAAC,gCAAgC;QAAAU,QAAA,EAC3CT,IAAI,EAAEkB,MAAM,GACXlC,OAAO;QACP;QACAF,EAAE,CAAE,aAAa,EAAE,aAAc,CAAC,EAClCkB,IAAI,EACJL,KACA,CAAC,GACDA;MAAK,CACL,CAAC,EACHE,WAAW,iBACZN,IAAA,CAACf,IAAI;QAACuB,SAAS,EAAC,sCAAsC;QAAAU,QAAA,EACnDZ;MAAW,CACR,CACN;IAAA,CACM,CAAC;EAAA,CACL,CAAC;AAER;AAEA,eAAeH,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["clsx","Button","__experimentalText","Text","__experimentalVStack","VStack","privateApis","componentsPrivateApis","useDispatch","useSelect","deprecated","__","isRTL","chevronLeft","chevronRight","unlock","store","blockEditorStore","BlockIcon","jsx","_jsx","jsxs","_jsxs","Badge","BlockCard","title","icon","description","blockType","className","name","since","alternative","parentNavBlockClientId","select","getSelectedBlockClientId","getBlockParentsByBlockName","_selectedBlockClientId","selectBlock","children","onClick","label","style","minWidth","padding","size","showColors","spacing","length"],"sources":["@wordpress/block-editor/src/components/block-card/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as blockEditorStore } from '../../store';\nimport BlockIcon from '../block-icon';\n\nconst { Badge } = unlock( componentsPrivateApis );\n\n/**\n * A card component that displays block information including title, icon, and description.\n * Can be used to show block metadata and navigation controls for parent blocks.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-card/README.md\n *\n * @example\n * ```jsx\n * function Example() {\n * return (\n * <BlockCard\n * title=\"My Block\"\n * icon=\"smiley\"\n * description=\"A simple block example\"\n * name=\"Custom Block\"\n * />\n * );\n * }\n * ```\n *\n * @param {Object} props Component props.\n * @param {string} props.title The title of the block.\n * @param {string|Object} props.icon The icon of the block. This can be any of [WordPress' Dashicons](https://developer.wordpress.org/resource/dashicons/), or a custom `svg` element.\n * @param {string} props.description The description of the block.\n * @param {Object} [props.blockType] Deprecated: Object containing block type data.\n * @param {string} [props.className] Additional classes to apply to the card.\n * @param {string} [props.name] Custom block name to display before the title.\n * @return {Element} Block card component.\n */\nfunction BlockCard( { title, icon, description, blockType, className, name } ) {\n\tif ( blockType ) {\n\t\tdeprecated( '`blockType` property in `BlockCard component`', {\n\t\t\tsince: '5.7',\n\t\t\talternative: '`title, icon and description` properties',\n\t\t} );\n\t\t( { title, icon, description } = blockType );\n\t}\n\n\tconst { parentNavBlockClientId } = useSelect( ( select ) => {\n\t\tconst { getSelectedBlockClientId, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst _selectedBlockClientId = getSelectedBlockClientId();\n\n\t\treturn {\n\t\t\tparentNavBlockClientId: getBlockParentsByBlockName(\n\t\t\t\t_selectedBlockClientId,\n\t\t\t\t'core/navigation',\n\t\t\t\ttrue\n\t\t\t)[ 0 ],\n\t\t};\n\t}, [] );\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<div className={ clsx( 'block-editor-block-card', className ) }>\n\t\t\t{ parentNavBlockClientId && ( // This is only used by the Navigation block for now. It's not ideal having Navigation block specific code here.\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ () => selectBlock( parentNavBlockClientId ) }\n\t\t\t\t\tlabel={ __( 'Go to parent Navigation block' ) }\n\t\t\t\t\tstyle={\n\t\t\t\t\t\t// TODO: This style override is also used in ToolsPanelHeader.\n\t\t\t\t\t\t// It should be supported out-of-the-box by Button.\n\t\t\t\t\t\t{ minWidth: 24, padding: 0 }\n\t\t\t\t\t}\n\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<BlockIcon icon={ icon } showColors />\n\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t<h2 className=\"block-editor-block-card__title\">\n\t\t\t\t\t<span className=\"block-editor-block-card__name\">\n\t\t\t\t\t\t{ !! name?.length ? name : title }\n\t\t\t\t\t</span>\n\t\t\t\t\t{ !! name?.length && <Badge>{ title }</Badge> }\n\t\t\t\t</h2>\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text className=\"block-editor-block-card__description\">\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nexport default BlockCard;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,MAAM,EACNC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,EAC9BC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,WAAW,EAAEC,YAAY,QAAQ,kBAAkB;;AAE5D;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,SAAS,MAAM,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEtC,MAAM;EAAEC;AAAM,CAAC,GAAGR,MAAM,CAAER,qBAAsB,CAAC;;AAEjD;AACA;AAC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,KAAK,CAAC,CAAC,GAAGE,YAAY,GAAGD,WAAa;MAC7CgC,IAAI,EAAC;IAAO,CACZ,CACD,eACDzB,IAAA,CAACF,SAAS;MAACQ,IAAI,EAAGA,IAAM;MAACoB,UAAU;IAAA,CAAE,CAAC,eACtCxB,KAAA,CAACjB,MAAM;MAAC0C,OAAO,EAAG,CAAG;MAAAR,QAAA,gBACpBjB,KAAA;QAAIO,SAAS,EAAC,gCAAgC;QAAAU,QAAA,gBAC7CnB,IAAA;UAAMS,SAAS,EAAC,+BAA+B;UAAAU,QAAA,EAC5C,CAAC,CAAET,IAAI,EAAEkB,MAAM,GAAGlB,IAAI,GAAGL;QAAK,CAC3B,CAAC,EACL,CAAC,CAAEK,IAAI,EAAEkB,MAAM,iBAAI5B,IAAA,CAACG,KAAK;UAAAgB,QAAA,EAAGd;QAAK,CAAS,CAAC;MAAA,CAC1C,CAAC,EACHE,WAAW,iBACZP,IAAA,CAACjB,IAAI;QAAC0B,SAAS,EAAC,sCAAsC;QAAAU,QAAA,EACnDZ;MAAW,CACR,CACN;IAAA,CACM,CAAC;EAAA,CACL,CAAC;AAER;AAEA,eAAeH,SAAS","ignoreList":[]}
@@ -7,14 +7,18 @@ import clsx from 'clsx';
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
10
+ import { getBlockDefaultClassName, getBlockType, hasBlockSupport, store as blocksStore } from '@wordpress/blocks';
10
11
  import { withFilters } from '@wordpress/components';
11
- import { getBlockDefaultClassName, hasBlockSupport, getBlockType } from '@wordpress/blocks';
12
- import { useContext, useMemo } from '@wordpress/element';
12
+ import { useRegistry, useSelect } from '@wordpress/data';
13
+ import { useCallback, useContext, useMemo } from '@wordpress/element';
13
14
 
14
15
  /**
15
16
  * Internal dependencies
16
17
  */
17
18
  import BlockContext from '../block-context';
19
+ import isURLLike from '../link-control/is-url-like';
20
+ import { canBindAttribute, hasPatternOverridesDefaultBinding, replacePatternOverridesDefaultBinding } from '../../utils/block-bindings';
21
+ import { unlock } from '../../lock-unlock';
18
22
 
19
23
  /**
20
24
  * Default value used for blocks which do not define their own context needs,
@@ -46,33 +50,166 @@ const Edit = props => {
46
50
  const EditWithFilters = withFilters('editor.BlockEdit')(Edit);
47
51
  const EditWithGeneratedProps = props => {
48
52
  const {
49
- attributes = {},
50
- name
53
+ name,
54
+ clientId,
55
+ attributes,
56
+ setAttributes
51
57
  } = props;
58
+ const registry = useRegistry();
52
59
  const blockType = getBlockType(name);
53
60
  const blockContext = useContext(BlockContext);
61
+ const registeredSources = useSelect(select => unlock(select(blocksStore)).getAllBlockBindingsSources(), []);
62
+ const {
63
+ blockBindings,
64
+ context,
65
+ hasPatternOverrides
66
+ } = useMemo(() => {
67
+ // Assign context values using the block type's declared context needs.
68
+ const computedContext = blockType?.usesContext ? Object.fromEntries(Object.entries(blockContext).filter(([key]) => blockType.usesContext.includes(key))) : DEFAULT_BLOCK_CONTEXT;
69
+ // Add context requested by Block Bindings sources.
70
+ if (attributes?.metadata?.bindings) {
71
+ Object.values(attributes?.metadata?.bindings || {}).forEach(binding => {
72
+ registeredSources[binding?.source]?.usesContext?.forEach(key => {
73
+ computedContext[key] = blockContext[key];
74
+ });
75
+ });
76
+ }
77
+ return {
78
+ blockBindings: replacePatternOverridesDefaultBinding(name, attributes?.metadata?.bindings),
79
+ context: computedContext,
80
+ hasPatternOverrides: hasPatternOverridesDefaultBinding(attributes?.metadata?.bindings)
81
+ };
82
+ }, [name, blockType?.usesContext, blockContext, attributes?.metadata?.bindings, registeredSources]);
83
+ const computedAttributes = useSelect(select => {
84
+ if (!blockBindings) {
85
+ return attributes;
86
+ }
87
+ const attributesFromSources = {};
88
+ const blockBindingsBySource = new Map();
89
+ for (const [attributeName, binding] of Object.entries(blockBindings)) {
90
+ const {
91
+ source: sourceName,
92
+ args: sourceArgs
93
+ } = binding;
94
+ const source = registeredSources[sourceName];
95
+ if (!source || !canBindAttribute(name, attributeName)) {
96
+ continue;
97
+ }
98
+ blockBindingsBySource.set(source, {
99
+ ...blockBindingsBySource.get(source),
100
+ [attributeName]: {
101
+ args: sourceArgs
102
+ }
103
+ });
104
+ }
105
+ if (blockBindingsBySource.size) {
106
+ for (const [source, bindings] of blockBindingsBySource) {
107
+ // Get values in batch if the source supports it.
108
+ let values = {};
109
+ if (!source.getValues) {
110
+ Object.keys(bindings).forEach(attr => {
111
+ // Default to the the source label when `getValues` doesn't exist.
112
+ values[attr] = source.label;
113
+ });
114
+ } else {
115
+ values = source.getValues({
116
+ select,
117
+ context,
118
+ clientId,
119
+ bindings
120
+ });
121
+ }
122
+ for (const [attributeName, value] of Object.entries(values)) {
123
+ if (attributeName === 'url' && (!value || !isURLLike(value))) {
124
+ // Return null if value is not a valid URL.
125
+ attributesFromSources[attributeName] = null;
126
+ } else {
127
+ attributesFromSources[attributeName] = value;
128
+ }
129
+ }
130
+ }
131
+ }
132
+ return {
133
+ ...attributes,
134
+ ...attributesFromSources
135
+ };
136
+ }, [attributes, blockBindings, clientId, context, name, registeredSources]);
137
+ const setBoundAttributes = useCallback(nextAttributes => {
138
+ if (!blockBindings) {
139
+ setAttributes(nextAttributes);
140
+ return;
141
+ }
142
+ registry.batch(() => {
143
+ const keptAttributes = {
144
+ ...nextAttributes
145
+ };
146
+ const blockBindingsBySource = new Map();
54
147
 
55
- // Assign context values using the block type's declared context needs.
56
- const context = useMemo(() => {
57
- return blockType && blockType.usesContext ? Object.fromEntries(Object.entries(blockContext).filter(([key]) => blockType.usesContext.includes(key))) : DEFAULT_BLOCK_CONTEXT;
58
- }, [blockType, blockContext]);
148
+ // Loop only over the updated attributes to avoid modifying the bound ones that haven't changed.
149
+ for (const [attributeName, newValue] of Object.entries(keptAttributes)) {
150
+ if (!blockBindings[attributeName] || !canBindAttribute(name, attributeName)) {
151
+ continue;
152
+ }
153
+ const binding = blockBindings[attributeName];
154
+ const source = registeredSources[binding?.source];
155
+ if (!source?.setValues) {
156
+ continue;
157
+ }
158
+ blockBindingsBySource.set(source, {
159
+ ...blockBindingsBySource.get(source),
160
+ [attributeName]: {
161
+ args: binding.args,
162
+ newValue
163
+ }
164
+ });
165
+ delete keptAttributes[attributeName];
166
+ }
167
+ if (blockBindingsBySource.size) {
168
+ for (const [source, bindings] of blockBindingsBySource) {
169
+ source.setValues({
170
+ select: registry.select,
171
+ dispatch: registry.dispatch,
172
+ context,
173
+ clientId,
174
+ bindings
175
+ });
176
+ }
177
+ }
178
+ const hasParentPattern = !!context['pattern/overrides'];
179
+ if (
180
+ // Don't update non-connected attributes if the block is using pattern overrides
181
+ // and the editing is happening while overriding the pattern (not editing the original).
182
+ !(hasPatternOverrides && hasParentPattern) && Object.keys(keptAttributes).length) {
183
+ // Don't update caption and href until they are supported.
184
+ if (hasPatternOverrides) {
185
+ delete keptAttributes.caption;
186
+ delete keptAttributes.href;
187
+ }
188
+ setAttributes(keptAttributes);
189
+ }
190
+ });
191
+ }, [blockBindings, clientId, context, hasPatternOverrides, setAttributes, registeredSources, name, registry]);
59
192
  if (!blockType) {
60
193
  return null;
61
194
  }
62
195
  if (blockType.apiVersion > 1) {
63
196
  return /*#__PURE__*/_jsx(EditWithFilters, {
64
197
  ...props,
65
- context: context
198
+ attributes: computedAttributes,
199
+ context: context,
200
+ setAttributes: setBoundAttributes
66
201
  });
67
202
  }
68
203
 
69
204
  // Generate a class name for the block's editable form.
70
205
  const generatedClassName = hasBlockSupport(blockType, 'className', true) ? getBlockDefaultClassName(name) : null;
71
- const className = clsx(generatedClassName, attributes.className, props.className);
206
+ const className = clsx(generatedClassName, attributes?.className, props.className);
72
207
  return /*#__PURE__*/_jsx(EditWithFilters, {
73
208
  ...props,
209
+ attributes: computedAttributes,
210
+ className: className,
74
211
  context: context,
75
- className: className
212
+ setAttributes: setBoundAttributes
76
213
  });
77
214
  };
78
215
  export default EditWithGeneratedProps;
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","withFilters","getBlockDefaultClassName","hasBlockSupport","getBlockType","useContext","useMemo","BlockContext","jsx","_jsx","DEFAULT_BLOCK_CONTEXT","Edit","props","name","blockType","Component","edit","save","EditWithFilters","EditWithGeneratedProps","attributes","blockContext","context","usesContext","Object","fromEntries","entries","filter","key","includes","apiVersion","generatedClassName","className"],"sources":["@wordpress/block-editor/src/components/block-edit/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { withFilters } from '@wordpress/components';\nimport {\n\tgetBlockDefaultClassName,\n\thasBlockSupport,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport { useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockContext from '../block-context';\n\n/**\n * Default value used for blocks which do not define their own context needs,\n * used to guarantee that a block's `context` prop will always be an object. It\n * is assigned as a constant since it is always expected to be an empty object,\n * and in order to avoid unnecessary React reconciliations of a changing object.\n *\n * @type {{}}\n */\nconst DEFAULT_BLOCK_CONTEXT = {};\n\nconst Edit = ( props ) => {\n\tconst { name } = props;\n\tconst blockType = getBlockType( name );\n\n\tif ( ! blockType ) {\n\t\treturn null;\n\t}\n\n\t// `edit` and `save` are functions or components describing the markup\n\t// with which a block is displayed. If `blockType` is valid, assign\n\t// them preferentially as the render value for the block.\n\tconst Component = blockType.edit || blockType.save;\n\n\treturn <Component { ...props } />;\n};\n\nconst EditWithFilters = withFilters( 'editor.BlockEdit' )( Edit );\n\nconst EditWithGeneratedProps = ( props ) => {\n\tconst { attributes = {}, name } = props;\n\tconst blockType = getBlockType( name );\n\tconst blockContext = useContext( BlockContext );\n\n\t// Assign context values using the block type's declared context needs.\n\tconst context = useMemo( () => {\n\t\treturn blockType && blockType.usesContext\n\t\t\t? Object.fromEntries(\n\t\t\t\t\tObject.entries( blockContext ).filter( ( [ key ] ) =>\n\t\t\t\t\t\tblockType.usesContext.includes( key )\n\t\t\t\t\t)\n\t\t\t )\n\t\t\t: DEFAULT_BLOCK_CONTEXT;\n\t}, [ blockType, blockContext ] );\n\n\tif ( ! blockType ) {\n\t\treturn null;\n\t}\n\n\tif ( blockType.apiVersion > 1 ) {\n\t\treturn <EditWithFilters { ...props } context={ context } />;\n\t}\n\n\t// Generate a class name for the block's editable form.\n\tconst generatedClassName = hasBlockSupport( blockType, 'className', true )\n\t\t? getBlockDefaultClassName( name )\n\t\t: null;\n\tconst className = clsx(\n\t\tgeneratedClassName,\n\t\tattributes.className,\n\t\tprops.className\n\t);\n\n\treturn (\n\t\t<EditWithFilters\n\t\t\t{ ...props }\n\t\t\tcontext={ context }\n\t\t\tclassName={ className }\n\t\t/>\n\t);\n};\n\nexport default EditWithGeneratedProps;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SACCC,wBAAwB,EACxBC,eAAe,EACfC,YAAY,QACN,mBAAmB;AAC1B,SAASC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;;AAExD;AACA;AACA;AACA,OAAOC,YAAY,MAAM,kBAAkB;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,SAAAC,GAAA,IAAAC,IAAA;AAQA,MAAMC,qBAAqB,GAAG,CAAC,CAAC;AAEhC,MAAMC,IAAI,GAAKC,KAAK,IAAM;EACzB,MAAM;IAAEC;EAAK,CAAC,GAAGD,KAAK;EACtB,MAAME,SAAS,GAAGV,YAAY,CAAES,IAAK,CAAC;EAEtC,IAAK,CAAEC,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;;EAEA;EACA;EACA;EACA,MAAMC,SAAS,GAAGD,SAAS,CAACE,IAAI,IAAIF,SAAS,CAACG,IAAI;EAElD,oBAAOR,IAAA,CAACM,SAAS;IAAA,GAAMH;EAAK,CAAI,CAAC;AAClC,CAAC;AAED,MAAMM,eAAe,GAAGjB,WAAW,CAAE,kBAAmB,CAAC,CAAEU,IAAK,CAAC;AAEjE,MAAMQ,sBAAsB,GAAKP,KAAK,IAAM;EAC3C,MAAM;IAAEQ,UAAU,GAAG,CAAC,CAAC;IAAEP;EAAK,CAAC,GAAGD,KAAK;EACvC,MAAME,SAAS,GAAGV,YAAY,CAAES,IAAK,CAAC;EACtC,MAAMQ,YAAY,GAAGhB,UAAU,CAAEE,YAAa,CAAC;;EAE/C;EACA,MAAMe,OAAO,GAAGhB,OAAO,CAAE,MAAM;IAC9B,OAAOQ,SAAS,IAAIA,SAAS,CAACS,WAAW,GACtCC,MAAM,CAACC,WAAW,CAClBD,MAAM,CAACE,OAAO,CAAEL,YAAa,CAAC,CAACM,MAAM,CAAE,CAAE,CAAEC,GAAG,CAAE,KAC/Cd,SAAS,CAACS,WAAW,CAACM,QAAQ,CAAED,GAAI,CACrC,CACA,CAAC,GACDlB,qBAAqB;EACzB,CAAC,EAAE,CAAEI,SAAS,EAAEO,YAAY,CAAG,CAAC;EAEhC,IAAK,CAAEP,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,IAAKA,SAAS,CAACgB,UAAU,GAAG,CAAC,EAAG;IAC/B,oBAAOrB,IAAA,CAACS,eAAe;MAAA,GAAMN,KAAK;MAAGU,OAAO,EAAGA;IAAS,CAAE,CAAC;EAC5D;;EAEA;EACA,MAAMS,kBAAkB,GAAG5B,eAAe,CAAEW,SAAS,EAAE,WAAW,EAAE,IAAK,CAAC,GACvEZ,wBAAwB,CAAEW,IAAK,CAAC,GAChC,IAAI;EACP,MAAMmB,SAAS,GAAGhC,IAAI,CACrB+B,kBAAkB,EAClBX,UAAU,CAACY,SAAS,EACpBpB,KAAK,CAACoB,SACP,CAAC;EAED,oBACCvB,IAAA,CAACS,eAAe;IAAA,GACVN,KAAK;IACVU,OAAO,EAAGA,OAAS;IACnBU,SAAS,EAAGA;EAAW,CACvB,CAAC;AAEJ,CAAC;AAED,eAAeb,sBAAsB","ignoreList":[]}
1
+ {"version":3,"names":["clsx","getBlockDefaultClassName","getBlockType","hasBlockSupport","store","blocksStore","withFilters","useRegistry","useSelect","useCallback","useContext","useMemo","BlockContext","isURLLike","canBindAttribute","hasPatternOverridesDefaultBinding","replacePatternOverridesDefaultBinding","unlock","jsx","_jsx","DEFAULT_BLOCK_CONTEXT","Edit","props","name","blockType","Component","edit","save","EditWithFilters","EditWithGeneratedProps","clientId","attributes","setAttributes","registry","blockContext","registeredSources","select","getAllBlockBindingsSources","blockBindings","context","hasPatternOverrides","computedContext","usesContext","Object","fromEntries","entries","filter","key","includes","metadata","bindings","values","forEach","binding","source","computedAttributes","attributesFromSources","blockBindingsBySource","Map","attributeName","sourceName","args","sourceArgs","set","get","size","getValues","keys","attr","label","value","setBoundAttributes","nextAttributes","batch","keptAttributes","newValue","setValues","dispatch","hasParentPattern","length","caption","href","apiVersion","generatedClassName","className"],"sources":["@wordpress/block-editor/src/components/block-edit/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockDefaultClassName,\n\tgetBlockType,\n\thasBlockSupport,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { withFilters } from '@wordpress/components';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { useCallback, useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockContext from '../block-context';\nimport isURLLike from '../link-control/is-url-like';\nimport {\n\tcanBindAttribute,\n\thasPatternOverridesDefaultBinding,\n\treplacePatternOverridesDefaultBinding,\n} from '../../utils/block-bindings';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Default value used for blocks which do not define their own context needs,\n * used to guarantee that a block's `context` prop will always be an object. It\n * is assigned as a constant since it is always expected to be an empty object,\n * and in order to avoid unnecessary React reconciliations of a changing object.\n *\n * @type {{}}\n */\nconst DEFAULT_BLOCK_CONTEXT = {};\n\nconst Edit = ( props ) => {\n\tconst { name } = props;\n\tconst blockType = getBlockType( name );\n\n\tif ( ! blockType ) {\n\t\treturn null;\n\t}\n\n\t// `edit` and `save` are functions or components describing the markup\n\t// with which a block is displayed. If `blockType` is valid, assign\n\t// them preferentially as the render value for the block.\n\tconst Component = blockType.edit || blockType.save;\n\n\treturn <Component { ...props } />;\n};\n\nconst EditWithFilters = withFilters( 'editor.BlockEdit' )( Edit );\n\nconst EditWithGeneratedProps = ( props ) => {\n\tconst { name, clientId, attributes, setAttributes } = props;\n\tconst registry = useRegistry();\n\tconst blockType = getBlockType( name );\n\tconst blockContext = useContext( BlockContext );\n\tconst registeredSources = useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blocksStore ) ).getAllBlockBindingsSources(),\n\t\t[]\n\t);\n\n\tconst { blockBindings, context, hasPatternOverrides } = useMemo( () => {\n\t\t// Assign context values using the block type's declared context needs.\n\t\tconst computedContext = blockType?.usesContext\n\t\t\t? Object.fromEntries(\n\t\t\t\t\tObject.entries( blockContext ).filter( ( [ key ] ) =>\n\t\t\t\t\t\tblockType.usesContext.includes( key )\n\t\t\t\t\t)\n\t\t\t )\n\t\t\t: DEFAULT_BLOCK_CONTEXT;\n\t\t// Add context requested by Block Bindings sources.\n\t\tif ( attributes?.metadata?.bindings ) {\n\t\t\tObject.values( attributes?.metadata?.bindings || {} ).forEach(\n\t\t\t\t( binding ) => {\n\t\t\t\t\tregisteredSources[ binding?.source ]?.usesContext?.forEach(\n\t\t\t\t\t\t( key ) => {\n\t\t\t\t\t\t\tcomputedContext[ key ] = blockContext[ key ];\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}\n\t\treturn {\n\t\t\tblockBindings: replacePatternOverridesDefaultBinding(\n\t\t\t\tname,\n\t\t\t\tattributes?.metadata?.bindings\n\t\t\t),\n\t\t\tcontext: computedContext,\n\t\t\thasPatternOverrides: hasPatternOverridesDefaultBinding(\n\t\t\t\tattributes?.metadata?.bindings\n\t\t\t),\n\t\t};\n\t}, [\n\t\tname,\n\t\tblockType?.usesContext,\n\t\tblockContext,\n\t\tattributes?.metadata?.bindings,\n\t\tregisteredSources,\n\t] );\n\n\tconst computedAttributes = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! blockBindings ) {\n\t\t\t\treturn attributes;\n\t\t\t}\n\n\t\t\tconst attributesFromSources = {};\n\t\t\tconst blockBindingsBySource = new Map();\n\n\t\t\tfor ( const [ attributeName, binding ] of Object.entries(\n\t\t\t\tblockBindings\n\t\t\t) ) {\n\t\t\t\tconst { source: sourceName, args: sourceArgs } = binding;\n\t\t\t\tconst source = registeredSources[ sourceName ];\n\t\t\t\tif ( ! source || ! canBindAttribute( name, attributeName ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tblockBindingsBySource.set( source, {\n\t\t\t\t\t...blockBindingsBySource.get( source ),\n\t\t\t\t\t[ attributeName ]: {\n\t\t\t\t\t\targs: sourceArgs,\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tif ( blockBindingsBySource.size ) {\n\t\t\t\tfor ( const [ source, bindings ] of blockBindingsBySource ) {\n\t\t\t\t\t// Get values in batch if the source supports it.\n\t\t\t\t\tlet values = {};\n\t\t\t\t\tif ( ! source.getValues ) {\n\t\t\t\t\t\tObject.keys( bindings ).forEach( ( attr ) => {\n\t\t\t\t\t\t\t// Default to the the source label when `getValues` doesn't exist.\n\t\t\t\t\t\t\tvalues[ attr ] = source.label;\n\t\t\t\t\t\t} );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvalues = source.getValues( {\n\t\t\t\t\t\t\tselect,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tbindings,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\tfor ( const [ attributeName, value ] of Object.entries(\n\t\t\t\t\t\tvalues\n\t\t\t\t\t) ) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tattributeName === 'url' &&\n\t\t\t\t\t\t\t( ! value || ! isURLLike( value ) )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// Return null if value is not a valid URL.\n\t\t\t\t\t\t\tattributesFromSources[ attributeName ] = null;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tattributesFromSources[ attributeName ] = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\t...attributesFromSources,\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tattributes,\n\t\t\tblockBindings,\n\t\t\tclientId,\n\t\t\tcontext,\n\t\t\tname,\n\t\t\tregisteredSources,\n\t\t]\n\t);\n\n\tconst setBoundAttributes = useCallback(\n\t\t( nextAttributes ) => {\n\t\t\tif ( ! blockBindings ) {\n\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tregistry.batch( () => {\n\t\t\t\tconst keptAttributes = { ...nextAttributes };\n\t\t\t\tconst blockBindingsBySource = new Map();\n\n\t\t\t\t// Loop only over the updated attributes to avoid modifying the bound ones that haven't changed.\n\t\t\t\tfor ( const [ attributeName, newValue ] of Object.entries(\n\t\t\t\t\tkeptAttributes\n\t\t\t\t) ) {\n\t\t\t\t\tif (\n\t\t\t\t\t\t! blockBindings[ attributeName ] ||\n\t\t\t\t\t\t! canBindAttribute( name, attributeName )\n\t\t\t\t\t) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst binding = blockBindings[ attributeName ];\n\t\t\t\t\tconst source = registeredSources[ binding?.source ];\n\t\t\t\t\tif ( ! source?.setValues ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tblockBindingsBySource.set( source, {\n\t\t\t\t\t\t...blockBindingsBySource.get( source ),\n\t\t\t\t\t\t[ attributeName ]: {\n\t\t\t\t\t\t\targs: binding.args,\n\t\t\t\t\t\t\tnewValue,\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t\tdelete keptAttributes[ attributeName ];\n\t\t\t\t}\n\n\t\t\t\tif ( blockBindingsBySource.size ) {\n\t\t\t\t\tfor ( const [\n\t\t\t\t\t\tsource,\n\t\t\t\t\t\tbindings,\n\t\t\t\t\t] of blockBindingsBySource ) {\n\t\t\t\t\t\tsource.setValues( {\n\t\t\t\t\t\t\tselect: registry.select,\n\t\t\t\t\t\t\tdispatch: registry.dispatch,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tbindings,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst hasParentPattern = !! context[ 'pattern/overrides' ];\n\n\t\t\t\tif (\n\t\t\t\t\t// Don't update non-connected attributes if the block is using pattern overrides\n\t\t\t\t\t// and the editing is happening while overriding the pattern (not editing the original).\n\t\t\t\t\t! ( hasPatternOverrides && hasParentPattern ) &&\n\t\t\t\t\tObject.keys( keptAttributes ).length\n\t\t\t\t) {\n\t\t\t\t\t// Don't update caption and href until they are supported.\n\t\t\t\t\tif ( hasPatternOverrides ) {\n\t\t\t\t\t\tdelete keptAttributes.caption;\n\t\t\t\t\t\tdelete keptAttributes.href;\n\t\t\t\t\t}\n\t\t\t\t\tsetAttributes( keptAttributes );\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\t[\n\t\t\tblockBindings,\n\t\t\tclientId,\n\t\t\tcontext,\n\t\t\thasPatternOverrides,\n\t\t\tsetAttributes,\n\t\t\tregisteredSources,\n\t\t\tname,\n\t\t\tregistry,\n\t\t]\n\t);\n\n\tif ( ! blockType ) {\n\t\treturn null;\n\t}\n\n\tif ( blockType.apiVersion > 1 ) {\n\t\treturn (\n\t\t\t<EditWithFilters\n\t\t\t\t{ ...props }\n\t\t\t\tattributes={ computedAttributes }\n\t\t\t\tcontext={ context }\n\t\t\t\tsetAttributes={ setBoundAttributes }\n\t\t\t/>\n\t\t);\n\t}\n\n\t// Generate a class name for the block's editable form.\n\tconst generatedClassName = hasBlockSupport( blockType, 'className', true )\n\t\t? getBlockDefaultClassName( name )\n\t\t: null;\n\tconst className = clsx(\n\t\tgeneratedClassName,\n\t\tattributes?.className,\n\t\tprops.className\n\t);\n\n\treturn (\n\t\t<EditWithFilters\n\t\t\t{ ...props }\n\t\t\tattributes={ computedAttributes }\n\t\t\tclassName={ className }\n\t\t\tcontext={ context }\n\t\t\tsetAttributes={ setBoundAttributes }\n\t\t/>\n\t);\n};\n\nexport default EditWithGeneratedProps;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,wBAAwB,EACxBC,YAAY,EACZC,eAAe,EACfC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,WAAW,EAAEC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;;AAErE;AACA;AACA;AACA,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,SAAS,MAAM,6BAA6B;AACnD,SACCC,gBAAgB,EAChBC,iCAAiC,EACjCC,qCAAqC,QAC/B,4BAA4B;AACnC,SAASC,MAAM,QAAQ,mBAAmB;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,SAAAC,GAAA,IAAAC,IAAA;AAQA,MAAMC,qBAAqB,GAAG,CAAC,CAAC;AAEhC,MAAMC,IAAI,GAAKC,KAAK,IAAM;EACzB,MAAM;IAAEC;EAAK,CAAC,GAAGD,KAAK;EACtB,MAAME,SAAS,GAAGtB,YAAY,CAAEqB,IAAK,CAAC;EAEtC,IAAK,CAAEC,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;;EAEA;EACA;EACA;EACA,MAAMC,SAAS,GAAGD,SAAS,CAACE,IAAI,IAAIF,SAAS,CAACG,IAAI;EAElD,oBAAOR,IAAA,CAACM,SAAS;IAAA,GAAMH;EAAK,CAAI,CAAC;AAClC,CAAC;AAED,MAAMM,eAAe,GAAGtB,WAAW,CAAE,kBAA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a,EACbG,iBAAiB,EACjBZ,IAAI,EACJU,QAAQ,CAEV,CAAC;EAED,IAAK,CAAET,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,IAAKA,SAAS,CAAC0D,UAAU,GAAG,CAAC,EAAG;IAC/B,oBACC/D,IAAA,CAACS,eAAe;MAAA,GACVN,KAAK;MACVS,UAAU,EAAGwB,kBAAoB;MACjChB,OAAO,EAAGA,OAAS;MACnBP,aAAa,EAAGuC;IAAoB,CACpC,CAAC;EAEJ;;EAEA;EACA,MAAMY,kBAAkB,GAAGhF,eAAe,CAAEqB,SAAS,EAAE,WAAW,EAAE,IAAK,CAAC,GACvEvB,wBAAwB,CAAEsB,IAAK,CAAC,GAChC,IAAI;EACP,MAAM6D,SAAS,GAAGpF,IAAI,CACrBmF,kBAAkB,EAClBpD,UAAU,EAAEqD,SAAS,EACrB9D,KAAK,CAAC8D,SACP,CAAC;EAED,oBACCjE,IAAA,CAACS,eAAe;IAAA,GACVN,KAAK;IACVS,UAAU,EAAGwB,kBAAoB;IACjC6B,SAAS,EAAGA,SAAW;IACvB7C,OAAO,EAAGA,OAAS;IACnBP,aAAa,EAAGuC;EAAoB,CACpC,CAAC;AAEJ,CAAC;AAED,eAAe1C,sBAAsB","ignoreList":[]}
@@ -8,7 +8,7 @@ import clsx from 'clsx';
8
8
  * WordPress dependencies
9
9
  */
10
10
  import { AsyncModeProvider, useSelect, useDispatch, useRegistry } from '@wordpress/data';
11
- import { useViewportMatch, useMergeRefs, useDebounce } from '@wordpress/compose';
11
+ import { useMergeRefs, useDebounce } from '@wordpress/compose';
12
12
  import { createContext, useMemo, useCallback, useEffect } from '@wordpress/element';
13
13
 
14
14
  /**
@@ -32,7 +32,6 @@ function Root({
32
32
  className,
33
33
  ...settings
34
34
  }) {
35
- const isLargeViewport = useViewportMatch('medium');
36
35
  const {
37
36
  isOutlineMode,
38
37
  isFocusMode,
@@ -88,7 +87,7 @@ function Root({
88
87
  ref: useMergeRefs([useBlockSelectionClearer(), useInBetweenInserter(), useTypingObserver()]),
89
88
  className: clsx('is-root-container', className, {
90
89
  'is-outline-mode': isOutlineMode,
91
- 'is-focus-mode': isFocusMode && isLargeViewport
90
+ 'is-focus-mode': isFocusMode
92
91
  })
93
92
  }, settings);
94
93
  return /*#__PURE__*/_jsxs(IntersectionObserver.Provider, {
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","AsyncModeProvider","useSelect","useDispatch","useRegistry","useViewportMatch","useMergeRefs","useDebounce","createContext","useMemo","useCallback","useEffect","BlockListBlock","BlockListAppender","useInBetweenInserter","store","blockEditorStore","LayoutProvider","defaultLayout","useBlockSelectionClearer","useInnerBlocksProps","BlockEditContextProvider","DEFAULT_BLOCK_EDIT_CONTEXT","useTypingObserver","ZoomOutSeparator","unlock","jsx","_jsx","jsxs","_jsxs","IntersectionObserver","pendingBlockVisibilityUpdatesPerRegistry","WeakMap","Root","className","settings","isLargeViewport","isOutlineMode","isFocusMode","temporarilyEditingAsBlocks","select","getSettings","getTemporarilyEditingAsBlocks","isTyping","outlineMode","focusMode","registry","setBlockVisibility","delayedBlockVisibilityUpdates","updates","get","forEach","id","isIntersecting","trailing","intersectionObserver","Observer","window","entries","set","entry","clientId","target","getAttribute","push","innerBlocksProps","ref","Provider","value","children","StopEditingAsBlocksOnOutsideSelect","stopEditingAsBlocks","isBlockOrDescendantSelected","isBlockSelected","hasSelectedInnerBlock","BlockList","EMPTY_ARRAY","EMPTY_SET","Set","Items","placeholder","rootClientId","renderAppender","CustomAppender","__experimentalAppenderTagName","layout","hasAppender","hasCustomAppender","order","isZoomOut","selectedBlocks","visibleBlocks","shouldRenderAppender","getBlockOrder","getSelectedBlockClientId","getSelectedBlockClientIds","__unstableGetVisibleBlocks","getTemplateLock","getBlockEditingMode","isSectionBlock","_isZoomOut","_order","isPreviewMode","selectedBlockClientId","length","map","has","includes","position","tagName","BlockListItems","props"],"sources":["@wordpress/block-editor/src/components/block-list/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAsyncModeProvider,\n\tuseSelect,\n\tuseDispatch,\n\tuseRegistry,\n} from '@wordpress/data';\nimport {\n\tuseViewportMatch,\n\tuseMergeRefs,\n\tuseDebounce,\n} from '@wordpress/compose';\nimport {\n\tcreateContext,\n\tuseMemo,\n\tuseCallback,\n\tuseEffect,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockListBlock from './block';\nimport BlockListAppender from '../block-list-appender';\nimport { useInBetweenInserter } from './use-in-between-inserter';\nimport { store as blockEditorStore } from '../../store';\nimport { LayoutProvider, defaultLayout } from './layout';\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useInnerBlocksProps } from '../inner-blocks';\nimport {\n\tBlockEditContextProvider,\n\tDEFAULT_BLOCK_EDIT_CONTEXT,\n} from '../block-edit/context';\nimport { useTypingObserver } from '../observe-typing';\nimport { ZoomOutSeparator } from './zoom-out-separator';\nimport { unlock } from '../../lock-unlock';\n\nexport const IntersectionObserver = createContext();\nconst pendingBlockVisibilityUpdatesPerRegistry = new WeakMap();\n\nfunction Root( { className, ...settings } ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { isOutlineMode, isFocusMode, temporarilyEditingAsBlocks } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getSettings, getTemporarilyEditingAsBlocks, isTyping } =\n\t\t\t\tunlock( select( blockEditorStore ) );\n\t\t\tconst { outlineMode, focusMode } = getSettings();\n\t\t\treturn {\n\t\t\t\tisOutlineMode: outlineMode && ! isTyping(),\n\t\t\t\tisFocusMode: focusMode,\n\t\t\t\ttemporarilyEditingAsBlocks: getTemporarilyEditingAsBlocks(),\n\t\t\t};\n\t\t}, [] );\n\tconst registry = useRegistry();\n\tconst { setBlockVisibility } = useDispatch( blockEditorStore );\n\n\tconst delayedBlockVisibilityUpdates = useDebounce(\n\t\tuseCallback( () => {\n\t\t\tconst updates = {};\n\t\t\tpendingBlockVisibilityUpdatesPerRegistry\n\t\t\t\t.get( registry )\n\t\t\t\t.forEach( ( [ id, isIntersecting ] ) => {\n\t\t\t\t\tupdates[ id ] = isIntersecting;\n\t\t\t\t} );\n\t\t\tsetBlockVisibility( updates );\n\t\t}, [ registry ] ),\n\t\t300,\n\t\t{\n\t\t\ttrailing: true,\n\t\t}\n\t);\n\tconst intersectionObserver = useMemo( () => {\n\t\tconst { IntersectionObserver: Observer } = window;\n\n\t\tif ( ! Observer ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn new Observer( ( entries ) => {\n\t\t\tif ( ! pendingBlockVisibilityUpdatesPerRegistry.get( registry ) ) {\n\t\t\t\tpendingBlockVisibilityUpdatesPerRegistry.set( registry, [] );\n\t\t\t}\n\t\t\tfor ( const entry of entries ) {\n\t\t\t\tconst clientId = entry.target.getAttribute( 'data-block' );\n\t\t\t\tpendingBlockVisibilityUpdatesPerRegistry\n\t\t\t\t\t.get( registry )\n\t\t\t\t\t.push( [ clientId, entry.isIntersecting ] );\n\t\t\t}\n\t\t\tdelayedBlockVisibilityUpdates();\n\t\t} );\n\t}, [] );\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tref: useMergeRefs( [\n\t\t\t\tuseBlockSelectionClearer(),\n\t\t\t\tuseInBetweenInserter(),\n\t\t\t\tuseTypingObserver(),\n\t\t\t] ),\n\t\t\tclassName: clsx( 'is-root-container', className, {\n\t\t\t\t'is-outline-mode': isOutlineMode,\n\t\t\t\t'is-focus-mode': isFocusMode && isLargeViewport,\n\t\t\t} ),\n\t\t},\n\t\tsettings\n\t);\n\treturn (\n\t\t<IntersectionObserver.Provider value={ intersectionObserver }>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t\t{ !! temporarilyEditingAsBlocks && (\n\t\t\t\t<StopEditingAsBlocksOnOutsideSelect\n\t\t\t\t\tclientId={ temporarilyEditingAsBlocks }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</IntersectionObserver.Provider>\n\t);\n}\n\nfunction StopEditingAsBlocksOnOutsideSelect( { clientId } ) {\n\tconst { stopEditingAsBlocks } = unlock( useDispatch( blockEditorStore ) );\n\tconst isBlockOrDescendantSelected = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isBlockSelected, hasSelectedInnerBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\tisBlockSelected( clientId ) ||\n\t\t\t\thasSelectedInnerBlock( clientId, true )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tuseEffect( () => {\n\t\tif ( ! isBlockOrDescendantSelected ) {\n\t\t\tstopEditingAsBlocks( clientId );\n\t\t}\n\t}, [ isBlockOrDescendantSelected, clientId, stopEditingAsBlocks ] );\n\treturn null;\n}\n\nexport default function BlockList( settings ) {\n\treturn (\n\t\t<BlockEditContextProvider value={ DEFAULT_BLOCK_EDIT_CONTEXT }>\n\t\t\t<Root { ...settings } />\n\t\t</BlockEditContextProvider>\n\t);\n}\n\nconst EMPTY_ARRAY = [];\nconst EMPTY_SET = new Set();\n\nfunction Items( {\n\tplaceholder,\n\trootClientId,\n\trenderAppender: CustomAppender,\n\t__experimentalAppenderTagName,\n\tlayout = defaultLayout,\n} ) {\n\t// Avoid passing CustomAppender to useSelect because it could be a new\n\t// function on every render.\n\tconst hasAppender = CustomAppender !== false;\n\tconst hasCustomAppender = !! CustomAppender;\n\tconst {\n\t\torder,\n\t\tisZoomOut,\n\t\tselectedBlocks,\n\t\tvisibleBlocks,\n\t\tshouldRenderAppender,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetSettings,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\t__unstableGetVisibleBlocks,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tisSectionBlock,\n\t\t\t\tisZoomOut: _isZoomOut,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst _order = getBlockOrder( rootClientId );\n\n\t\t\tif ( getSettings().isPreviewMode ) {\n\t\t\t\treturn {\n\t\t\t\t\torder: _order,\n\t\t\t\t\tselectedBlocks: EMPTY_ARRAY,\n\t\t\t\t\tvisibleBlocks: EMPTY_SET,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\t\treturn {\n\t\t\t\torder: _order,\n\t\t\t\tselectedBlocks: getSelectedBlockClientIds(),\n\t\t\t\tvisibleBlocks: __unstableGetVisibleBlocks(),\n\t\t\t\tisZoomOut: _isZoomOut(),\n\t\t\t\tshouldRenderAppender:\n\t\t\t\t\t! isSectionBlock( rootClientId ) &&\n\t\t\t\t\tgetBlockEditingMode( rootClientId ) !== 'disabled' &&\n\t\t\t\t\t! getTemplateLock( rootClientId ) &&\n\t\t\t\t\thasAppender &&\n\t\t\t\t\t! _isZoomOut() &&\n\t\t\t\t\t( hasCustomAppender ||\n\t\t\t\t\t\trootClientId === selectedBlockClientId ||\n\t\t\t\t\t\t( ! rootClientId &&\n\t\t\t\t\t\t\t! selectedBlockClientId &&\n\t\t\t\t\t\t\t! _order.length ) ),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId, hasAppender, hasCustomAppender ]\n\t);\n\n\treturn (\n\t\t<LayoutProvider value={ layout }>\n\t\t\t{ order.map( ( clientId ) => (\n\t\t\t\t<AsyncModeProvider\n\t\t\t\t\tkey={ clientId }\n\t\t\t\t\tvalue={\n\t\t\t\t\t\t// Only provide data asynchronously if the block is\n\t\t\t\t\t\t// not visible and not selected.\n\t\t\t\t\t\t! visibleBlocks.has( clientId ) &&\n\t\t\t\t\t\t! selectedBlocks.includes( clientId )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isZoomOut && (\n\t\t\t\t\t\t<ZoomOutSeparator\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tposition=\"top\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<BlockListBlock\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isZoomOut && (\n\t\t\t\t\t\t<ZoomOutSeparator\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tposition=\"bottom\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</AsyncModeProvider>\n\t\t\t) ) }\n\t\t\t{ order.length < 1 && placeholder }\n\t\t\t{ shouldRenderAppender && (\n\t\t\t\t<BlockListAppender\n\t\t\t\t\ttagName={ __experimentalAppenderTagName }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\tCustomAppender={ CustomAppender }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</LayoutProvider>\n\t);\n}\n\nexport function BlockListItems( props ) {\n\t// This component needs to always be synchronous as it's the one changing\n\t// the async mode depending on the block selection.\n\treturn (\n\t\t<AsyncModeProvider value={ false }>\n\t\t\t<Items { ...props } />\n\t\t</AsyncModeProvider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,iBAAiB,EACjBC,SAAS,EACTC,WAAW,EACXC,WAAW,QACL,iBAAiB;AACxB,SACCC,gBAAgB,EAChBC,YAAY,EACZC,WAAW,QACL,oBAAoB;AAC3B,SACCC,aAAa,EACbC,OAAO,EACPC,WAAW,EACXC,SAAS,QACH,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAOC,cAAc,MAAM,SAAS;AACpC,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,cAAc,E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A,CAACoD,KAAK;MAAA,GAAMgC;IAAK,CAAI;EAAC,CACJ,CAAC;AAEtB","ignoreList":[]}
1
+ {"version":3,"names":["clsx","AsyncModeProvider","useSelect","useDispatch","useRegistry","useMergeRefs","useDebounce","createContext","useMemo","useCallback","useEffect","BlockListBlock","BlockListAppender","useInBetweenInserter","store","blockEditorStore","LayoutProvider","defaultLayout","useBlockSelectionClearer","useInnerBlocksProps","BlockEditContextProvider","DEFAULT_BLOCK_EDIT_CONTEXT","useTypingObserver","ZoomOutSeparator","unlock","jsx","_jsx","jsxs","_jsxs","IntersectionObserver","pendingBlockVisibilityUpdatesPerRegistry","WeakMap","Root","className","settings","isOutlineMode","isFocusMode","temporarilyEditingAsBlocks","select","getSettings","getTemporarilyEditingAsBlocks","isTyping","outlineMode","focusMode","registry","setBlockVisibility","delayedBlockVisibilityUpdates","updates","get","forEach","id","isIntersecting","trailing","intersectionObserver","Observer","window","entries","set","entry","clientId","target","getAttribute","push","innerBlocksProps","ref","Provider","value","children","StopEditingAsBlocksOnOutsideSelect","stopEditingAsBlocks","isBlockOrDescendantSelected","isBlockSelected","hasSelectedInnerBlock","BlockList","EMPTY_ARRAY","EMPTY_SET","Set","Items","placeholder","rootClientId","renderAppender","CustomAppender","__experimentalAppenderTagName","layout","hasAppender","hasCustomAppender","order","isZoomOut","selectedBlocks","visibleBlocks","shouldRenderAppender","getBlockOrder","getSelectedBlockClientId","getSelectedBlockClientIds","__unstableGetVisibleBlocks","getTemplateLock","getBlockEditingMode","isSectionBlock","_isZoomOut","_order","isPreviewMode","selectedBlockClientId","length","map","has","includes","position","tagName","BlockListItems","props"],"sources":["@wordpress/block-editor/src/components/block-list/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAsyncModeProvider,\n\tuseSelect,\n\tuseDispatch,\n\tuseRegistry,\n} from '@wordpress/data';\nimport { useMergeRefs, useDebounce } from '@wordpress/compose';\nimport {\n\tcreateContext,\n\tuseMemo,\n\tuseCallback,\n\tuseEffect,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockListBlock from './block';\nimport BlockListAppender from '../block-list-appender';\nimport { useInBetweenInserter } from './use-in-between-inserter';\nimport { store as blockEditorStore } from '../../store';\nimport { LayoutProvider, defaultLayout } from './layout';\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useInnerBlocksProps } from '../inner-blocks';\nimport {\n\tBlockEditContextProvider,\n\tDEFAULT_BLOCK_EDIT_CONTEXT,\n} from '../block-edit/context';\nimport { useTypingObserver } from '../observe-typing';\nimport { ZoomOutSeparator } from './zoom-out-separator';\nimport { unlock } from '../../lock-unlock';\n\nexport const IntersectionObserver = createContext();\nconst pendingBlockVisibilityUpdatesPerRegistry = new WeakMap();\n\nfunction Root( { className, ...settings } ) {\n\tconst { isOutlineMode, isFocusMode, temporarilyEditingAsBlocks } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getSettings, getTemporarilyEditingAsBlocks, isTyping } =\n\t\t\t\tunlock( select( blockEditorStore ) );\n\t\t\tconst { outlineMode, focusMode } = getSettings();\n\t\t\treturn {\n\t\t\t\tisOutlineMode: outlineMode && ! isTyping(),\n\t\t\t\tisFocusMode: focusMode,\n\t\t\t\ttemporarilyEditingAsBlocks: getTemporarilyEditingAsBlocks(),\n\t\t\t};\n\t\t}, [] );\n\tconst registry = useRegistry();\n\tconst { setBlockVisibility } = useDispatch( blockEditorStore );\n\n\tconst delayedBlockVisibilityUpdates = useDebounce(\n\t\tuseCallback( () => {\n\t\t\tconst updates = {};\n\t\t\tpendingBlockVisibilityUpdatesPerRegistry\n\t\t\t\t.get( registry )\n\t\t\t\t.forEach( ( [ id, isIntersecting ] ) => {\n\t\t\t\t\tupdates[ id ] = isIntersecting;\n\t\t\t\t} );\n\t\t\tsetBlockVisibility( updates );\n\t\t}, [ registry ] ),\n\t\t300,\n\t\t{\n\t\t\ttrailing: true,\n\t\t}\n\t);\n\tconst intersectionObserver = useMemo( () => {\n\t\tconst { IntersectionObserver: Observer } = window;\n\n\t\tif ( ! Observer ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn new Observer( ( entries ) => {\n\t\t\tif ( ! pendingBlockVisibilityUpdatesPerRegistry.get( registry ) ) {\n\t\t\t\tpendingBlockVisibilityUpdatesPerRegistry.set( registry, [] );\n\t\t\t}\n\t\t\tfor ( const entry of entries ) {\n\t\t\t\tconst clientId = entry.target.getAttribute( 'data-block' );\n\t\t\t\tpendingBlockVisibilityUpdatesPerRegistry\n\t\t\t\t\t.get( registry )\n\t\t\t\t\t.push( [ clientId, entry.isIntersecting ] );\n\t\t\t}\n\t\t\tdelayedBlockVisibilityUpdates();\n\t\t} );\n\t}, [] );\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tref: useMergeRefs( [\n\t\t\t\tuseBlockSelectionClearer(),\n\t\t\t\tuseInBetweenInserter(),\n\t\t\t\tuseTypingObserver(),\n\t\t\t] ),\n\t\t\tclassName: clsx( 'is-root-container', className, {\n\t\t\t\t'is-outline-mode': isOutlineMode,\n\t\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t} ),\n\t\t},\n\t\tsettings\n\t);\n\treturn (\n\t\t<IntersectionObserver.Provider value={ intersectionObserver }>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t\t{ !! temporarilyEditingAsBlocks && (\n\t\t\t\t<StopEditingAsBlocksOnOutsideSelect\n\t\t\t\t\tclientId={ temporarilyEditingAsBlocks }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</IntersectionObserver.Provider>\n\t);\n}\n\nfunction StopEditingAsBlocksOnOutsideSelect( { clientId } ) {\n\tconst { stopEditingAsBlocks } = unlock( useDispatch( blockEditorStore ) );\n\tconst isBlockOrDescendantSelected = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isBlockSelected, hasSelectedInnerBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\tisBlockSelected( clientId ) ||\n\t\t\t\thasSelectedInnerBlock( clientId, true )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tuseEffect( () => {\n\t\tif ( ! isBlockOrDescendantSelected ) {\n\t\t\tstopEditingAsBlocks( clientId );\n\t\t}\n\t}, [ isBlockOrDescendantSelected, clientId, stopEditingAsBlocks ] );\n\treturn null;\n}\n\nexport default function BlockList( settings ) {\n\treturn (\n\t\t<BlockEditContextProvider value={ DEFAULT_BLOCK_EDIT_CONTEXT }>\n\t\t\t<Root { ...settings } />\n\t\t</BlockEditContextProvider>\n\t);\n}\n\nconst EMPTY_ARRAY = [];\nconst EMPTY_SET = new Set();\n\nfunction Items( {\n\tplaceholder,\n\trootClientId,\n\trenderAppender: CustomAppender,\n\t__experimentalAppenderTagName,\n\tlayout = defaultLayout,\n} ) {\n\t// Avoid passing CustomAppender to useSelect because it could be a new\n\t// function on every render.\n\tconst hasAppender = CustomAppender !== false;\n\tconst hasCustomAppender = !! CustomAppender;\n\tconst {\n\t\torder,\n\t\tisZoomOut,\n\t\tselectedBlocks,\n\t\tvisibleBlocks,\n\t\tshouldRenderAppender,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetSettings,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\t__unstableGetVisibleBlocks,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tisSectionBlock,\n\t\t\t\tisZoomOut: _isZoomOut,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst _order = getBlockOrder( rootClientId );\n\n\t\t\tif ( getSettings().isPreviewMode ) {\n\t\t\t\treturn {\n\t\t\t\t\torder: _order,\n\t\t\t\t\tselectedBlocks: EMPTY_ARRAY,\n\t\t\t\t\tvisibleBlocks: EMPTY_SET,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\t\treturn {\n\t\t\t\torder: _order,\n\t\t\t\tselectedBlocks: getSelectedBlockClientIds(),\n\t\t\t\tvisibleBlocks: __unstableGetVisibleBlocks(),\n\t\t\t\tisZoomOut: _isZoomOut(),\n\t\t\t\tshouldRenderAppender:\n\t\t\t\t\t! isSectionBlock( rootClientId ) &&\n\t\t\t\t\tgetBlockEditingMode( rootClientId ) !== 'disabled' &&\n\t\t\t\t\t! getTemplateLock( rootClientId ) &&\n\t\t\t\t\thasAppender &&\n\t\t\t\t\t! _isZoomOut() &&\n\t\t\t\t\t( hasCustomAppender ||\n\t\t\t\t\t\trootClientId === selectedBlockClientId ||\n\t\t\t\t\t\t( ! rootClientId &&\n\t\t\t\t\t\t\t! selectedBlockClientId &&\n\t\t\t\t\t\t\t! _order.length ) ),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId, hasAppender, hasCustomAppender ]\n\t);\n\n\treturn (\n\t\t<LayoutProvider value={ layout }>\n\t\t\t{ order.map( ( clientId ) => (\n\t\t\t\t<AsyncModeProvider\n\t\t\t\t\tkey={ clientId }\n\t\t\t\t\tvalue={\n\t\t\t\t\t\t// Only provide data asynchronously if the block is\n\t\t\t\t\t\t// not visible and not selected.\n\t\t\t\t\t\t! visibleBlocks.has( clientId ) &&\n\t\t\t\t\t\t! selectedBlocks.includes( clientId )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isZoomOut && (\n\t\t\t\t\t\t<ZoomOutSeparator\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tposition=\"top\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<BlockListBlock\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isZoomOut && (\n\t\t\t\t\t\t<ZoomOutSeparator\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tposition=\"bottom\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</AsyncModeProvider>\n\t\t\t) ) }\n\t\t\t{ order.length < 1 && placeholder }\n\t\t\t{ shouldRenderAppender && (\n\t\t\t\t<BlockListAppender\n\t\t\t\t\ttagName={ __experimentalAppenderTagName }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\tCustomAppender={ CustomAppender }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</LayoutProvider>\n\t);\n}\n\nexport function BlockListItems( props ) {\n\t// This component needs to always be synchronous as it's the one changing\n\t// the async mode depending on the block selection.\n\treturn (\n\t\t<AsyncModeProvider value={ false }>\n\t\t\t<Items { ...props } />\n\t\t</AsyncModeProvider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,iBAAiB,EACjBC,SAAS,EACTC,WAAW,EACXC,WAAW,QACL,iBAAiB;AACxB,SAASC,YAAY,EAAEC,WAAW,QAAQ,oBAAoB;AAC9D,SACCC,aAAa,EACbC,OAAO,EACPC,WAAW,EACXC,SAAS,QACH,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAOC,cAAc,MAAM,SAAS;AACpC,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,cAAc,EAAEC,aAAa,QAAQ,UAAU;AACxD,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,mBAAmB,QAAQ,iBAAiB;AACrD,SACCC,wBAAwB,EACxBC,0BAA0B,QACpB,uBAAuB;AAC9B,SAASC,iBAAiB,QAAQ,mBAAmB;AACrD,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,MAAM,QAAQ,mB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EjBiE,KAAK;MACJ;MACA;MACA,CAAEuB,aAAa,CAACe,GAAG,CAAE7C,QAAS,CAAC,IAC/B,CAAE6B,cAAc,CAACiB,QAAQ,CAAE9C,QAAS,CACpC;MAAAQ,QAAA,GAECoB,SAAS,iBACV7D,IAAA,CAACH,gBAAgB;QAChBoC,QAAQ,EAAGA,QAAU;QACrBoB,YAAY,EAAGA,YAAc;QAC7B2B,QAAQ,EAAC;MAAK,CACd,CACD,eACDhF,IAAA,CAACf,cAAc;QACdoE,YAAY,EAAGA,YAAc;QAC7BpB,QAAQ,EAAGA;MAAU,CACrB,CAAC,EACA4B,SAAS,iBACV7D,IAAA,CAACH,gBAAgB;QAChBoC,QAAQ,EAAGA,QAAU;QACrBoB,YAAY,EAAGA,YAAc;QAC7B2B,QAAQ,EAAC;MAAQ,CACjB,CACD;IAAA,GAzBK/C,QA0BY,CAClB,CAAC,EACD2B,KAAK,CAACgB,MAAM,GAAG,CAAC,IAAIxB,WAAW,EAC/BY,oBAAoB,iBACrBhE,IAAA,CAACd,iBAAiB;MACjB+F,OAAO,EAAGzB,6BAA+B;MACzCH,YAAY,EAAGA,YAAc;MAC7BE,cAAc,EAAGA;IAAgB,CACjC,CACD;EAAA,CACc,CAAC;AAEnB;AAEA,OAAO,SAAS2B,cAAcA,CAAEC,KAAK,EAAG;EACvC;EACA;EACA,oBACCnF,IAAA,CAACzB,iBAAiB;IAACiE,KAAK,EAAG,KAAO;IAAAC,QAAA,eACjCzC,IAAA,CAACmD,KAAK;MAAA,GAAMgC;IAAK,CAAI;EAAC,CACJ,CAAC;AAEtB","ignoreList":[]}
@@ -26,7 +26,7 @@ import { useBlockRefProvider } from './use-block-refs';
26
26
  import { useIntersectionObserver } from './use-intersection-observer';
27
27
  import { useScrollIntoView } from './use-scroll-into-view';
28
28
  import { useFlashEditableBlocks } from '../../use-flash-editable-blocks';
29
- import { canBindBlock } from '../../../hooks/use-bindings-attributes';
29
+ import { canBindBlock } from '../../../utils/block-bindings';
30
30
  import { useFirefoxDraggableCompatibility } from './use-firefox-draggable-compatibility';
31
31
 
32
32
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useContext","__","sprintf","__unstableGetBlockProps","getBlockProps","useMergeRefs","useDisabled","warning","useMovingAnimation","PrivateBlockContext","useFocusFirstElement","useIsHovered","blockBindingsKey","useBlockEditContext","useFocusHandler","useEventHandlers","useBlockRefProvider","useIntersectionObserver","useScrollIntoView","useFlashEditableBlocks","canBindBlock","useFirefoxDraggableCompatibility","useBlockProps","props","__unstableIsHtml","clientId","className","wrapperProps","isAligned","index","mode","name","blockApiVersion","blockTitle","isSelected","isSubtreeDisabled","hasOverlay","initialPosition","blockEditingMode","isHighlighted","isMultiSelected","isPartiallySelected","isReusable","isDragging","hasChildSelected","isEditingDisabled","hasEditableOutline","isTemporarilyEditingAsBlocks","defaultClassName","isSectionBlock","canMove","blockLabel","htmlSuffix","ffDragRef","mergedRefs","ref","triggerAnimationOnChange","isDisabled","isEnabled","undefined","blockEditContext","hasBlockBindings","bindingsStyle","globalThis","SCRIPT_DEBUG","hasNegativeMargin","style","marginTop","charAt","marginBottom","marginLeft","marginRight","tabIndex","draggable","id","role","inert","save"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableGetBlockProps as getBlockProps } from '@wordpress/blocks';\nimport { useMergeRefs, useDisabled } from '@wordpress/compose';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../../use-moving-animation';\nimport { PrivateBlockContext } from '../private-block-context';\nimport { useFocusFirstElement } from './use-focus-first-element';\nimport { useIsHovered } from './use-is-hovered';\nimport {\n\tblockBindingsKey,\n\tuseBlockEditContext,\n} from '../../block-edit/context';\nimport { useFocusHandler } from './use-focus-handler';\nimport { useEventHandlers } from './use-selected-block-event-handlers';\nimport { useBlockRefProvider } from './use-block-refs';\nimport { useIntersectionObserver } from './use-intersection-observer';\nimport { useScrollIntoView } from './use-scroll-into-view';\nimport { useFlashEditableBlocks } from '../../use-flash-editable-blocks';\nimport { canBindBlock } from '../../../hooks/use-bindings-attributes';\nimport { useFirefoxDraggableCompatibility } from './use-firefox-draggable-compatibility';\n\n/**\n * This hook is used to lightly mark an element as a block element. The element\n * should be the outermost element of a block. Call this hook and pass the\n * returned props to the element to mark as a block. If you define a ref for the\n * element, it is important to pass the ref to this hook, which the hook in turn\n * will pass to the component through the props it returns. Optionally, you can\n * also pass any other props through this hook, and they will be merged and\n * returned.\n *\n * Use of this hook on the outermost element of a block is required if using API >= v2.\n *\n * @example\n * ```js\n * import { useBlockProps } from '@wordpress/block-editor';\n *\n * export default function Edit() {\n *\n * const blockProps = useBlockProps( {\n * className: 'my-custom-class',\n * style: {\n * color: '#222222',\n * backgroundColor: '#eeeeee'\n * }\n * } )\n *\n * return (\n *\t <div { ...blockProps }>\n *\n * </div>\n * )\n * }\n *\n * ```\n *\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 Options for internal use only.\n * @param {boolean} options.__unstableIsHtml\n *\n * @return {Object} Props to pass to the element to mark as a block.\n */\nexport function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {\n\tconst {\n\t\tclientId,\n\t\tclassName,\n\t\twrapperProps = {},\n\t\tisAligned,\n\t\tindex,\n\t\tmode,\n\t\tname,\n\t\tblockApiVersion,\n\t\tblockTitle,\n\t\tisSelected,\n\t\tisSubtreeDisabled,\n\t\thasOverlay,\n\t\tinitialPosition,\n\t\tblockEditingMode,\n\t\tisHighlighted,\n\t\tisMultiSelected,\n\t\tisPartiallySelected,\n\t\tisReusable,\n\t\tisDragging,\n\t\thasChildSelected,\n\t\tisEditingDisabled,\n\t\thasEditableOutline,\n\t\tisTemporarilyEditingAsBlocks,\n\t\tdefaultClassName,\n\t\tisSectionBlock,\n\t\tcanMove,\n\t} = useContext( PrivateBlockContext );\n\n\t// translators: %s: Type of block (i.e. Text, Image etc)\n\tconst blockLabel = sprintf( __( 'Block: %s' ), blockTitle );\n\tconst htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';\n\tconst ffDragRef = useFirefoxDraggableCompatibility();\n\tconst mergedRefs = useMergeRefs( [\n\t\tprops.ref,\n\t\tuseFocusFirstElement( { clientId, initialPosition } ),\n\t\tuseBlockRefProvider( clientId ),\n\t\tuseFocusHandler( clientId ),\n\t\tuseEventHandlers( { clientId, isSelected } ),\n\t\tuseIsHovered( { clientId } ),\n\t\tuseIntersectionObserver(),\n\t\tuseMovingAnimation( { triggerAnimationOnChange: index, clientId } ),\n\t\tuseDisabled( { isDisabled: ! hasOverlay } ),\n\t\tuseFlashEditableBlocks( {\n\t\t\tclientId,\n\t\t\tisEnabled: isSectionBlock,\n\t\t} ),\n\t\tuseScrollIntoView( { isSelected } ),\n\t\tcanMove ? ffDragRef : undefined,\n\t] );\n\n\tconst blockEditContext = useBlockEditContext();\n\tconst hasBlockBindings = !! blockEditContext[ blockBindingsKey ];\n\tconst bindingsStyle =\n\t\thasBlockBindings && canBindBlock( name )\n\t\t\t? {\n\t\t\t\t\t'--wp-admin-theme-color': 'var(--wp-block-synced-color)',\n\t\t\t\t\t'--wp-admin-theme-color--rgb':\n\t\t\t\t\t\t'var(--wp-block-synced-color--rgb)',\n\t\t\t }\n\t\t\t: {};\n\n\t// Ensures it warns only inside the `edit` implementation for the block.\n\tif ( blockApiVersion < 2 && clientId === blockEditContext.clientId ) {\n\t\twarning(\n\t\t\t`Block type \"${ name }\" must support API version 2 or higher to work correctly with \"useBlockProps\" method.`\n\t\t);\n\t}\n\n\tlet hasNegativeMargin = false;\n\tif (\n\t\twrapperProps?.style?.marginTop?.charAt( 0 ) === '-' ||\n\t\twrapperProps?.style?.marginBottom?.charAt( 0 ) === '-' ||\n\t\twrapperProps?.style?.marginLeft?.charAt( 0 ) === '-' ||\n\t\twrapperProps?.style?.marginRight?.charAt( 0 ) === '-'\n\t) {\n\t\thasNegativeMargin = true;\n\t}\n\n\treturn {\n\t\ttabIndex: blockEditingMode === 'disabled' ? -1 : 0,\n\t\tdraggable: canMove && ! hasChildSelected ? true : undefined,\n\t\t...wrapperProps,\n\t\t...props,\n\t\tref: mergedRefs,\n\t\tid: `block-${ clientId }${ htmlSuffix }`,\n\t\trole: 'document',\n\t\t'aria-label': blockLabel,\n\t\t'data-block': clientId,\n\t\t'data-type': name,\n\t\t'data-title': blockTitle,\n\t\tinert: isSubtreeDisabled ? 'true' : undefined,\n\t\tclassName: clsx(\n\t\t\t'block-editor-block-list__block',\n\t\t\t{\n\t\t\t\t// The wp-block className is important for editor styles.\n\t\t\t\t'wp-block': ! isAligned,\n\t\t\t\t'has-block-overlay': hasOverlay,\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-highlighted': isHighlighted,\n\t\t\t\t'is-multi-selected': isMultiSelected,\n\t\t\t\t'is-partially-selected': isPartiallySelected,\n\t\t\t\t'is-reusable': isReusable,\n\t\t\t\t'is-dragging': isDragging,\n\t\t\t\t'has-child-selected': hasChildSelected,\n\t\t\t\t'is-editing-disabled': isEditingDisabled,\n\t\t\t\t'has-editable-outline': hasEditableOutline,\n\t\t\t\t'has-negative-margin': hasNegativeMargin,\n\t\t\t\t'is-content-locked-temporarily-editing-as-blocks':\n\t\t\t\t\tisTemporarilyEditingAsBlocks,\n\t\t\t},\n\t\t\tclassName,\n\t\t\tprops.className,\n\t\t\twrapperProps.className,\n\t\t\tdefaultClassName\n\t\t),\n\t\tstyle: { ...wrapperProps.style, ...props.style, ...bindingsStyle },\n\t};\n}\n\n/**\n * Call within a save function to get the props for the block wrapper.\n *\n * @param {Object} props Optional. Props to pass to the element.\n */\nuseBlockProps.save = getBlockProps;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,UA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AChC;MACC;MACA,UAAU,EAAE,CAAE6B,SAAS;MACvB,mBAAmB,EAAEQ,UAAU;MAC/B,aAAa,EAAEF,UAAU;MACzB,gBAAgB,EAAEK,aAAa;MAC/B,mBAAmB,EAAEC,eAAe;MACpC,uBAAuB,EAAEC,mBAAmB;MAC5C,aAAa,EAAEC,UAAU;MACzB,aAAa,EAAEC,UAAU;MACzB,oBAAoB,EAAEC,gBAAgB;MACtC,qBAAqB,EAAEC,iBAAiB;MACxC,sBAAsB,EAAEC,kBAAkB;MAC1C,qBAAqB,EAAEmB,iBAAiB;MACxC,iDAAiD,EAChDlB;IACF,CAAC,EACDrB,SAAS,EACTH,KAAK,CAACG,SAAS,EACfC,YAAY,CAACD,SAAS,EACtBsB,gBACD,CAAC;IACDkB,KAAK,EAAE;MAAE,GAAGvC,YAAY,CAACuC,KAAK;MAAE,GAAG3C,KAAK,CAAC2C,KAAK;MAAE,GAAGJ;IAAc;EAClE,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACAxC,aAAa,CAACuD,IAAI,GAAGzE,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useContext","__","sprintf","__unstableGetBlockProps","getBlockProps","useMergeRefs","useDisabled","warning","useMovingAnimation","PrivateBlockContext","useFocusFirstElement","useIsHovered","blockBindingsKey","useBlockEditContext","useFocusHandler","useEventHandlers","useBlockRefProvider","useIntersectionObserver","useScrollIntoView","useFlashEditableBlocks","canBindBlock","useFirefoxDraggableCompatibility","useBlockProps","props","__unstableIsHtml","clientId","className","wrapperProps","isAligned","index","mode","name","blockApiVersion","blockTitle","isSelected","isSubtreeDisabled","hasOverlay","initialPosition","blockEditingMode","isHighlighted","isMultiSelected","isPartiallySelected","isReusable","isDragging","hasChildSelected","isEditingDisabled","hasEditableOutline","isTemporarilyEditingAsBlocks","defaultClassName","isSectionBlock","canMove","blockLabel","htmlSuffix","ffDragRef","mergedRefs","ref","triggerAnimationOnChange","isDisabled","isEnabled","undefined","blockEditContext","hasBlockBindings","bindingsStyle","globalThis","SCRIPT_DEBUG","hasNegativeMargin","style","marginTop","charAt","marginBottom","marginLeft","marginRight","tabIndex","draggable","id","role","inert","save"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableGetBlockProps as getBlockProps } from '@wordpress/blocks';\nimport { useMergeRefs, useDisabled } from '@wordpress/compose';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../../use-moving-animation';\nimport { PrivateBlockContext } from '../private-block-context';\nimport { useFocusFirstElement } from './use-focus-first-element';\nimport { useIsHovered } from './use-is-hovered';\nimport {\n\tblockBindingsKey,\n\tuseBlockEditContext,\n} from '../../block-edit/context';\nimport { useFocusHandler } from './use-focus-handler';\nimport { useEventHandlers } from './use-selected-block-event-handlers';\nimport { useBlockRefProvider } from './use-block-refs';\nimport { useIntersectionObserver } from './use-intersection-observer';\nimport { useScrollIntoView } from './use-scroll-into-view';\nimport { useFlashEditableBlocks } from '../../use-flash-editable-blocks';\nimport { canBindBlock } from '../../../utils/block-bindings';\nimport { useFirefoxDraggableCompatibility } from './use-firefox-draggable-compatibility';\n\n/**\n * This hook is used to lightly mark an element as a block element. The element\n * should be the outermost element of a block. Call this hook and pass the\n * returned props to the element to mark as a block. If you define a ref for the\n * element, it is important to pass the ref to this hook, which the hook in turn\n * will pass to the component through the props it returns. Optionally, you can\n * also pass any other props through this hook, and they will be merged and\n * returned.\n *\n * Use of this hook on the outermost element of a block is required if using API >= v2.\n *\n * @example\n * ```js\n * import { useBlockProps } from '@wordpress/block-editor';\n *\n * export default function Edit() {\n *\n * const blockProps = useBlockProps( {\n * className: 'my-custom-class',\n * style: {\n * color: '#222222',\n * backgroundColor: '#eeeeee'\n * }\n * } )\n *\n * return (\n *\t <div { ...blockProps }>\n *\n * </div>\n * )\n * }\n *\n * ```\n *\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 Options for internal use only.\n * @param {boolean} options.__unstableIsHtml\n *\n * @return {Object} Props to pass to the element to mark as a block.\n */\nexport function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {\n\tconst {\n\t\tclientId,\n\t\tclassName,\n\t\twrapperProps = {},\n\t\tisAligned,\n\t\tindex,\n\t\tmode,\n\t\tname,\n\t\tblockApiVersion,\n\t\tblockTitle,\n\t\tisSelected,\n\t\tisSubtreeDisabled,\n\t\thasOverlay,\n\t\tinitialPosition,\n\t\tblockEditingMode,\n\t\tisHighlighted,\n\t\tisMultiSelected,\n\t\tisPartiallySelected,\n\t\tisReusable,\n\t\tisDragging,\n\t\thasChildSelected,\n\t\tisEditingDisabled,\n\t\thasEditableOutline,\n\t\tisTemporarilyEditingAsBlocks,\n\t\tdefaultClassName,\n\t\tisSectionBlock,\n\t\tcanMove,\n\t} = useContext( PrivateBlockContext );\n\n\t// translators: %s: Type of block (i.e. Text, Image etc)\n\tconst blockLabel = sprintf( __( 'Block: %s' ), blockTitle );\n\tconst htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';\n\tconst ffDragRef = useFirefoxDraggableCompatibility();\n\tconst mergedRefs = useMergeRefs( [\n\t\tprops.ref,\n\t\tuseFocusFirstElement( { clientId, initialPosition } ),\n\t\tuseBlockRefProvider( clientId ),\n\t\tuseFocusHandler( clientId ),\n\t\tuseEventHandlers( { clientId, isSelected } ),\n\t\tuseIsHovered( { clientId } ),\n\t\tuseIntersectionObserver(),\n\t\tuseMovingAnimation( { triggerAnimationOnChange: index, clientId } ),\n\t\tuseDisabled( { isDisabled: ! hasOverlay } ),\n\t\tuseFlashEditableBlocks( {\n\t\t\tclientId,\n\t\t\tisEnabled: isSectionBlock,\n\t\t} ),\n\t\tuseScrollIntoView( { isSelected } ),\n\t\tcanMove ? ffDragRef : undefined,\n\t] );\n\n\tconst blockEditContext = useBlockEditContext();\n\tconst hasBlockBindings = !! blockEditContext[ blockBindingsKey ];\n\tconst bindingsStyle =\n\t\thasBlockBindings && canBindBlock( name )\n\t\t\t? {\n\t\t\t\t\t'--wp-admin-theme-color': 'var(--wp-block-synced-color)',\n\t\t\t\t\t'--wp-admin-theme-color--rgb':\n\t\t\t\t\t\t'var(--wp-block-synced-color--rgb)',\n\t\t\t }\n\t\t\t: {};\n\n\t// Ensures it warns only inside the `edit` implementation for the block.\n\tif ( blockApiVersion < 2 && clientId === blockEditContext.clientId ) {\n\t\twarning(\n\t\t\t`Block type \"${ name }\" must support API version 2 or higher to work correctly with \"useBlockProps\" method.`\n\t\t);\n\t}\n\n\tlet hasNegativeMargin = false;\n\tif (\n\t\twrapperProps?.style?.marginTop?.charAt( 0 ) === '-' ||\n\t\twrapperProps?.style?.marginBottom?.charAt( 0 ) === '-' ||\n\t\twrapperProps?.style?.marginLeft?.charAt( 0 ) === '-' ||\n\t\twrapperProps?.style?.marginRight?.charAt( 0 ) === '-'\n\t) {\n\t\thasNegativeMargin = true;\n\t}\n\n\treturn {\n\t\ttabIndex: blockEditingMode === 'disabled' ? -1 : 0,\n\t\tdraggable: canMove && ! hasChildSelected ? true : undefined,\n\t\t...wrapperProps,\n\t\t...props,\n\t\tref: mergedRefs,\n\t\tid: `block-${ clientId }${ htmlSuffix }`,\n\t\trole: 'document',\n\t\t'aria-label': blockLabel,\n\t\t'data-block': clientId,\n\t\t'data-type': name,\n\t\t'data-title': blockTitle,\n\t\tinert: isSubtreeDisabled ? 'true' : undefined,\n\t\tclassName: clsx(\n\t\t\t'block-editor-block-list__block',\n\t\t\t{\n\t\t\t\t// The wp-block className is important for editor styles.\n\t\t\t\t'wp-block': ! isAligned,\n\t\t\t\t'has-block-overlay': hasOverlay,\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-highlighted': isHighlighted,\n\t\t\t\t'is-multi-selected': isMultiSelected,\n\t\t\t\t'is-partially-selected': isPartiallySelected,\n\t\t\t\t'is-reusable': isReusable,\n\t\t\t\t'is-dragging': isDragging,\n\t\t\t\t'has-child-selected': hasChildSelected,\n\t\t\t\t'is-editing-disabled': isEditingDisabled,\n\t\t\t\t'has-editable-outline': hasEditableOutline,\n\t\t\t\t'has-negative-margin': hasNegativeMargin,\n\t\t\t\t'is-content-locked-temporarily-editing-as-blocks':\n\t\t\t\t\tisTemporarilyEditingAsBlocks,\n\t\t\t},\n\t\t\tclassName,\n\t\t\tprops.className,\n\t\t\twrapperProps.className,\n\t\t\tdefaultClassName\n\t\t),\n\t\tstyle: { ...wrapperProps.style, ...props.style, ...bindingsStyle },\n\t};\n}\n\n/**\n * Call within a save function to get the props for the block wrapper.\n *\n * @param {Object} props Optional. Props to pass to the element.\n */\nuseBlockProps.save = getBlockProps;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,uBAAuB,IAAIC,aAAa,QAAQ,mBAAmB;AAC5E,SAASC,YAAY,EAAEC,WAAW,QAAQ,oBAAoB;AAC9D,OAAOC,OAAO,MAAM,oBAAoB;;AAExC;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,4BAA4B;AAC3D,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SACCC,gBAAgB,EAChBC,mBAAmB,QACb,0BAA0B;AACjC,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,gBAAgB,QAAQ,qCAAqC;AACtE,SAASC,mBAAmB,QAAQ,kBAAkB;AACtD,SAASC,uBAAuB,QAAQ,6BAA6B;AACrE,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,sBAAsB,QAAQ,iCAAiC;AACxE,SA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Aa,CAACuD,IAAI,GAAGzE,aAAa","ignoreList":[]}
@@ -29,14 +29,16 @@ export function ZoomOutSeparator({
29
29
  sectionClientIds,
30
30
  insertionPoint,
31
31
  blockInsertionPointVisible,
32
- blockInsertionPoint
32
+ blockInsertionPoint,
33
+ blocksBeingDragged
33
34
  } = useSelect(select => {
34
35
  const {
35
36
  getInsertionPoint,
36
37
  getBlockOrder,
37
38
  getSectionRootClientId,
38
39
  isBlockInsertionPointVisible,
39
- getBlockInsertionPoint
40
+ getBlockInsertionPoint,
41
+ getDraggedBlockClientIds
40
42
  } = unlock(select(blockEditorStore));
41
43
  const root = getSectionRootClientId();
42
44
  const sectionRootClientIds = getBlockOrder(root);
@@ -46,7 +48,8 @@ export function ZoomOutSeparator({
46
48
  blockOrder: getBlockOrder(root),
47
49
  insertionPoint: getInsertionPoint(),
48
50
  blockInsertionPoint: getBlockInsertionPoint(),
49
- blockInsertionPointVisible: isBlockInsertionPointVisible()
51
+ blockInsertionPointVisible: isBlockInsertionPointVisible(),
52
+ blocksBeingDragged: getDraggedBlockClientIds()
50
53
  };
51
54
  }, []);
52
55
  const isReducedMotion = useReducedMotion();
@@ -60,6 +63,7 @@ export function ZoomOutSeparator({
60
63
  }
61
64
  const hasTopInsertionPoint = insertionPoint?.index === 0 && clientId === sectionClientIds[insertionPoint.index];
62
65
  const hasBottomInsertionPoint = insertionPoint && insertionPoint.hasOwnProperty('index') && clientId === sectionClientIds[insertionPoint.index - 1];
66
+
63
67
  // We want to show the zoom out separator in either of these conditions:
64
68
  // 1. If the inserter has an insertion index set
65
69
  // 2. We are dragging a pattern over an insertion point
@@ -69,6 +73,19 @@ export function ZoomOutSeparator({
69
73
  if (position === 'bottom') {
70
74
  isVisible = hasBottomInsertionPoint || blockInsertionPointVisible && clientId === sectionClientIds[blockInsertionPoint.index - 1];
71
75
  }
76
+ const blockBeingDraggedClientId = blocksBeingDragged[0];
77
+ const isCurrentBlockBeingDragged = blocksBeingDragged.includes(clientId);
78
+ const blockBeingDraggedIndex = sectionClientIds.indexOf(blockBeingDraggedClientId);
79
+ const blockBeingDraggedPreviousSiblingClientId = blockBeingDraggedIndex > 0 ? sectionClientIds[blockBeingDraggedIndex - 1] : null;
80
+ const isCurrentBlockPreviousSiblingOfBlockBeingDragged = blockBeingDraggedPreviousSiblingClientId === clientId;
81
+
82
+ // The separators are visually top/bottom of the block, but in actual fact
83
+ // the "top" separator is the "bottom" separator of the previous block.
84
+ // Therefore, this logic hides the separator if the current block is being dragged
85
+ // or if the current block is the previous sibling of the block being dragged.
86
+ if (isCurrentBlockBeingDragged || isCurrentBlockPreviousSiblingOfBlockBeingDragged) {
87
+ isVisible = false;
88
+ }
72
89
  return /*#__PURE__*/_jsx(AnimatePresence, {
73
90
  children: isVisible && /*#__PURE__*/_jsx(motion.div, {
74
91
  initial: {
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","useReducedMotion","useSelect","useState","__","store","blockEditorStore","unlock","jsx","_jsx","ZoomOutSeparator","clientId","rootClientId","position","isDraggedOver","setIsDraggedOver","sectionRootClientId","sectionClientIds","insertionPoint","blockInsertionPointVisible","blockInsertionPoint","select","getInsertionPoint","getBlockOrder","getSectionRootClientId","isBlockInsertionPointVisible","getBlockInsertionPoint","root","sectionRootClientIds","blockOrder","isReducedMotion","isVisible","isSectionBlock","includes","hasTopInsertionPoint","index","hasBottomInsertionPoint","hasOwnProperty","children","div","initial","height","animate","exit","transition","type","duration","ease","className","onDragOver","onDragLeave","opacity","delay"],"sources":["@wordpress/block-editor/src/components/block-list/zoom-out-separator.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport function ZoomOutSeparator( {\n\tclientId,\n\trootClientId = '',\n\tposition = 'top',\n} ) {\n\tconst [ isDraggedOver, setIsDraggedOver ] = useState( false );\n\tconst {\n\t\tsectionRootClientId,\n\t\tsectionClientIds,\n\t\tinsertionPoint,\n\t\tblockInsertionPointVisible,\n\t\tblockInsertionPoint,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetInsertionPoint,\n\t\t\tgetBlockOrder,\n\t\t\tgetSectionRootClientId,\n\t\t\tisBlockInsertionPointVisible,\n\t\t\tgetBlockInsertionPoint,\n\t\t} = unlock( select( blockEditorStore ) );\n\n\t\tconst root = getSectionRootClientId();\n\t\tconst sectionRootClientIds = getBlockOrder( root );\n\t\treturn {\n\t\t\tsectionRootClientId: root,\n\t\t\tsectionClientIds: sectionRootClientIds,\n\t\t\tblockOrder: getBlockOrder( root ),\n\t\t\tinsertionPoint: getInsertionPoint(),\n\t\t\tblockInsertionPoint: getBlockInsertionPoint(),\n\t\t\tblockInsertionPointVisible: isBlockInsertionPointVisible(),\n\t\t};\n\t}, [] );\n\n\tconst isReducedMotion = useReducedMotion();\n\n\tif ( ! clientId ) {\n\t\treturn;\n\t}\n\n\tlet isVisible = false;\n\n\tconst isSectionBlock =\n\t\trootClientId === sectionRootClientId &&\n\t\tsectionClientIds &&\n\t\tsectionClientIds.includes( clientId );\n\n\tif ( ! isSectionBlock ) {\n\t\treturn null;\n\t}\n\n\tconst hasTopInsertionPoint =\n\t\tinsertionPoint?.index === 0 &&\n\t\tclientId === sectionClientIds[ insertionPoint.index ];\n\tconst hasBottomInsertionPoint =\n\t\tinsertionPoint &&\n\t\tinsertionPoint.hasOwnProperty( 'index' ) &&\n\t\tclientId === sectionClientIds[ insertionPoint.index - 1 ];\n\t// We want to show the zoom out separator in either of these conditions:\n\t// 1. If the inserter has an insertion index set\n\t// 2. We are dragging a pattern over an insertion point\n\tif ( position === 'top' ) {\n\t\tisVisible =\n\t\t\thasTopInsertionPoint ||\n\t\t\t( blockInsertionPointVisible &&\n\t\t\t\tblockInsertionPoint.index === 0 &&\n\t\t\t\tclientId === sectionClientIds[ blockInsertionPoint.index ] );\n\t}\n\n\tif ( position === 'bottom' ) {\n\t\tisVisible =\n\t\t\thasBottomInsertionPoint ||\n\t\t\t( blockInsertionPointVisible &&\n\t\t\t\tclientId ===\n\t\t\t\t\tsectionClientIds[ blockInsertionPoint.index - 1 ] );\n\t}\n\n\treturn (\n\t\t<AnimatePresence>\n\t\t\t{ isVisible && (\n\t\t\t\t<motion.div\n\t\t\t\t\tinitial={ { height: 0 } }\n\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t// Use a height equal to that of the zoom out frame size.\n\t\t\t\t\t\theight: 'calc(1 * var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale)',\n\t\t\t\t\t} }\n\t\t\t\t\texit={ { height: 0 } }\n\t\t\t\t\ttransition={ {\n\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\tduration: isReducedMotion ? 0 : 0.2,\n\t\t\t\t\t\tease: [ 0.6, 0, 0.4, 1 ],\n\t\t\t\t\t} }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'block-editor-block-list__zoom-out-separator',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-dragged-over': isDraggedOver,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tdata-is-insertion-point=\"true\"\n\t\t\t\t\tonDragOver={ () => setIsDraggedOver( true ) }\n\t\t\t\t\tonDragLeave={ () => setIsDraggedOver( false ) }\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tinitial={ { opacity: 0 } }\n\t\t\t\t\t\tanimate={ { opacity: 1 } }\n\t\t\t\t\t\texit={ { opacity: 0, transition: { delay: -0.125 } } }\n\t\t\t\t\t\ttransition={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,CAAI;EACvD;EAEA,oBACC1B,IAAA,CAACT,eAAe;IAAAsC,QAAA,EACbP,SAAS,iBACVtB,IAAA,CAACX,MAAM,CAACyC,GAAG;MACVC,OAAO,EAAG;QAAEC,MAAM,EAAE;MAAE,CAAG;MACzBC,OAAO,EAAG;QACT;QACAD,MAAM,EAAE;MACT,CAAG;MACHE,IAAI,EAAG;QAAEF,MAAM,EAAE;MAAE,CAAG;MACtBG,UAAU,EAAG;QACZC,IAAI,EAAE,OAAO;QACbC,QAAQ,EAAEhB,eAAe,GAAG,CAAC,GAAG,GAAG;QACnCiB,IAAI,EAAE,CAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;MACvB,CAAG;MACHC,SAAS,EAAGpD,IAAI,CACf,6CAA6C,EAC7C;QACC,iBAAiB,EAAEkB;MACpB,CACD,CAAG;MACH,2BAAwB,MAAM;MAC9BmC,UAAU,EAAGA,CAAA,KAAMlC,gBAAgB,CAAE,IAAK,CAAG;MAC7CmC,WAAW,EAAGA,CAAA,KAAMnC,gBAAgB,CAAE,KAAM,CAAG;MAAAuB,QAAA,eAE/C7B,IAAA,CAACX,MAAM,CAACyC,GAAG;QACVC,OAAO,EAAG;UAAEW,OAAO,EAAE;QAAE,CAAG;QAC1BT,OAAO,EAAG;UAAES,OAAO,EAAE;QAAE,CAAG;QAC1BR,IAAI,EAAG;UAAEQ,OAAO,EAAE,CAAC;UAAEP,UAAU,EAAE;YAAEQ,KAAK,EAAE,CAAC;UAAM;QAAE,CAAG;QACtDR,UAAU,EAAG;UACZG,IAAI,EAAE,QAAQ;UACdD,QAAQ,EAAE,GAAG;UACbM,KAAK,EAAE;QACR,CAAG;QAAAd,QAAA,EAEDlC,EAAE,CAAE,eAAgB;MAAC,CACZ;IAAC,CACF;EACZ,CACe,CAAC;AAEpB","ignoreList":[]}
1
+ {"version":3,"names":["clsx","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","useReducedMotion","useSelect","useState","__","store","blockEditorStore","unlock","jsx","_jsx","ZoomOutSeparator","clientId","rootClientId","position","isDraggedOver","setIsDraggedOver","sectionRootClientId","sectionClientIds","insertionPoint","blockInsertionPointVisible","blockInsertionPoint","blocksBeingDragged","select","getInsertionPoint","getBlockOrder","getSectionRootClientId","isBlockInsertionPointVisible","getBlockInsertionPoint","getDraggedBlockClientIds","root","sectionRootClientIds","blockOrder","isReducedMotion","isVisible","isSectionBlock","includes","hasTopInsertionPoint","index","hasBottomInsertionPoint","hasOwnProperty","blockBeingDraggedClientId","isCurrentBlockBeingDragged","blockBeingDraggedIndex","indexOf","blockBeingDraggedPreviousSiblingClientId","isCurrentBlockPreviousSiblingOfBlockBeingDragged","children","div","initial","height","animate","exit","transition","type","duration","ease","className","onDragOver","onDragLeave","opacity","delay"],"sources":["@wordpress/block-editor/src/components/block-list/zoom-out-separator.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport function ZoomOutSeparator( {\n\tclientId,\n\trootClientId = '',\n\tposition = 'top',\n} ) {\n\tconst [ isDraggedOver, setIsDraggedOver ] = useState( false );\n\tconst {\n\t\tsectionRootClientId,\n\t\tsectionClientIds,\n\t\tinsertionPoint,\n\t\tblockInsertionPointVisible,\n\t\tblockInsertionPoint,\n\t\tblocksBeingDragged,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetInsertionPoint,\n\t\t\tgetBlockOrder,\n\t\t\tgetSectionRootClientId,\n\t\t\tisBlockInsertionPointVisible,\n\t\t\tgetBlockInsertionPoint,\n\t\t\tgetDraggedBlockClientIds,\n\t\t} = unlock( select( blockEditorStore ) );\n\n\t\tconst root = getSectionRootClientId();\n\t\tconst sectionRootClientIds = getBlockOrder( root );\n\t\treturn {\n\t\t\tsectionRootClientId: root,\n\t\t\tsectionClientIds: sectionRootClientIds,\n\t\t\tblockOrder: getBlockOrder( root ),\n\t\t\tinsertionPoint: getInsertionPoint(),\n\t\t\tblockInsertionPoint: getBlockInsertionPoint(),\n\t\t\tblockInsertionPointVisible: isBlockInsertionPointVisible(),\n\t\t\tblocksBeingDragged: getDraggedBlockClientIds(),\n\t\t};\n\t}, [] );\n\n\tconst isReducedMotion = useReducedMotion();\n\n\tif ( ! clientId ) {\n\t\treturn;\n\t}\n\n\tlet isVisible = false;\n\n\tconst isSectionBlock =\n\t\trootClientId === sectionRootClientId &&\n\t\tsectionClientIds &&\n\t\tsectionClientIds.includes( clientId );\n\n\tif ( ! isSectionBlock ) {\n\t\treturn null;\n\t}\n\n\tconst hasTopInsertionPoint =\n\t\tinsertionPoint?.index === 0 &&\n\t\tclientId === sectionClientIds[ insertionPoint.index ];\n\tconst hasBottomInsertionPoint =\n\t\tinsertionPoint &&\n\t\tinsertionPoint.hasOwnProperty( 'index' ) &&\n\t\tclientId === sectionClientIds[ insertionPoint.index - 1 ];\n\n\t// We want to show the zoom out separator in either of these conditions:\n\t// 1. If the inserter has an insertion index set\n\t// 2. We are dragging a pattern over an insertion point\n\tif ( position === 'top' ) {\n\t\tisVisible =\n\t\t\thasTopInsertionPoint ||\n\t\t\t( blockInsertionPointVisible &&\n\t\t\t\tblockInsertionPoint.index === 0 &&\n\t\t\t\tclientId === sectionClientIds[ blockInsertionPoint.index ] );\n\t}\n\n\tif ( position === 'bottom' ) {\n\t\tisVisible =\n\t\t\thasBottomInsertionPoint ||\n\t\t\t( blockInsertionPointVisible &&\n\t\t\t\tclientId ===\n\t\t\t\t\tsectionClientIds[ blockInsertionPoint.index - 1 ] );\n\t}\n\n\tconst blockBeingDraggedClientId = blocksBeingDragged[ 0 ];\n\n\tconst isCurrentBlockBeingDragged = blocksBeingDragged.includes( clientId );\n\n\tconst blockBeingDraggedIndex = sectionClientIds.indexOf(\n\t\tblockBeingDraggedClientId\n\t);\n\tconst blockBeingDraggedPreviousSiblingClientId =\n\t\tblockBeingDraggedIndex > 0\n\t\t\t? sectionClientIds[ blockBeingDraggedIndex - 1 ]\n\t\t\t: null;\n\n\tconst isCurrentBlockPreviousSiblingOfBlockBeingDragged =\n\t\tblockBeingDraggedPreviousSiblingClientId === clientId;\n\n\t// The separators are visually top/bottom of the block, but in actual fact\n\t// the \"top\" separator is the \"bottom\" separator of the previous block.\n\t// Therefore, this logic hides the separator if the current block is being dragged\n\t// or if the current block is the previous sibling of the block being dragged.\n\tif (\n\t\tisCurrentBlockBeingDragged ||\n\t\tisCurrentBlockPreviousSiblingOfBlockBeingDragged\n\t) {\n\t\tisVisible = false;\n\t}\n\n\treturn (\n\t\t<AnimatePresence>\n\t\t\t{ isVisible && (\n\t\t\t\t<motion.div\n\t\t\t\t\tinitial={ { height: 0 } }\n\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t// Use a height equal to that of the zoom out frame size.\n\t\t\t\t\t\theight: 'calc(1 * var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale)',\n\t\t\t\t\t} }\n\t\t\t\t\texit={ { height: 0 } }\n\t\t\t\t\ttransition={ {\n\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\tduration: isReducedMotion ? 0 : 0.2,\n\t\t\t\t\t\tease: [ 0.6, 0, 0.4, 1 ],\n\t\t\t\t\t} }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'block-editor-block-list__zoom-out-separator',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-dragged-over': isDraggedOver,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tdata-is-insertion-point=\"true\"\n\t\t\t\t\tonDragOver={ () => setIsDraggedOver( true ) }\n\t\t\t\t\tonDragLeave={ () => setIsDraggedOver( false ) }\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tinitial={ { opacity: 0 } }\n\t\t\t\t\t\tanimate={ { opacity: 1 } }\n\t\t\t\t\t\texit={ { opacity: 0, transition: { delay: -0.125 } } }\n\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\tease: 'linear',\n\t\t\t\t\t\t\tduration: 0.1,\n\t\t\t\t\t\t\tdelay: 0.125,\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Drop pattern.' ) }\n\t\t\t\t\t</motion.div>\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t</AnimatePresence>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,gBAAgB,IAAIC,MAAM,EAC1BC,yBAAyB,IAAIC,eAAe,QACtC,uBAAuB;AAC9B,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,OAAO,SAASC,gBAAgBA,CAAE;EACjCC,QAAQ;EACRC,YAAY,GAAG,EAAE;EACjBC,QAAQ,GAAG;AACZ,CAAC,EAAG;EACH,MAAM,CAAEC,aAAa,EAAEC,gBAAgB,CAAE,GAAGZ,QAAQ,CAAE,KAAM,CAAC;EAC7D,MAAM;IACLa,mBAAmB;IACnBC,gBAAgB;IAChBC,cAAc;IACdC,0BAA0B;IAC1BC,mBAAmB;IACnBC;EACD,CAAC,GAAGnB,SAAS,CAAIoB,MAAM,IAAM;IAC5B,MAAM;MACLC,iBAAiB;MACjBC,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