@wordpress/block-editor 14.0.0 → 14.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (807) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +10 -24
  3. package/build/autocompleters/block.js +1 -1
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/components/block-alignment-matrix-control/index.js +2 -2
  6. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  7. package/build/components/block-breadcrumb/index.js +8 -2
  8. package/build/components/block-breadcrumb/index.js.map +1 -1
  9. package/build/components/block-canvas/index.js +8 -1
  10. package/build/components/block-canvas/index.js.map +1 -1
  11. package/build/components/block-compare/block-view.js +4 -1
  12. package/build/components/block-compare/block-view.js.map +1 -1
  13. package/build/components/block-draggable/index.js +4 -4
  14. package/build/components/block-draggable/index.js.map +1 -1
  15. package/build/components/block-draggable/use-scroll-when-dragging.js +25 -25
  16. package/build/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
  17. package/build/components/block-edit/multiple-usage-warning.js +8 -2
  18. package/build/components/block-edit/multiple-usage-warning.js.map +1 -1
  19. package/build/components/block-inspector/index.js +27 -9
  20. package/build/components/block-inspector/index.js.map +1 -1
  21. package/build/components/block-list/block-invalid-warning.js +6 -3
  22. package/build/components/block-list/block-invalid-warning.js.map +1 -1
  23. package/build/components/block-list/block.js +5 -1
  24. package/build/components/block-list/block.js.map +1 -1
  25. package/build/components/block-list/use-block-props/index.js +7 -3
  26. package/build/components/block-list/use-block-props/index.js.map +1 -1
  27. package/build/components/block-list/use-block-props/use-focus-first-element.js +1 -0
  28. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  29. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +46 -0
  30. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -0
  31. package/build/components/block-list/use-in-between-inserter.js +11 -4
  32. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  33. package/build/components/block-lock/toolbar.js +3 -3
  34. package/build/components/block-lock/toolbar.js.map +1 -1
  35. package/build/components/block-mover/button.js +4 -1
  36. package/build/components/block-mover/button.js.map +1 -1
  37. package/build/components/block-mover/index.js +4 -1
  38. package/build/components/block-mover/index.js.map +1 -1
  39. package/build/components/block-navigation/dropdown.js +4 -1
  40. package/build/components/block-navigation/dropdown.js.map +1 -1
  41. package/build/components/block-pattern-setup/index.js +1 -4
  42. package/build/components/block-pattern-setup/index.js.map +1 -1
  43. package/build/components/block-pattern-setup/setup-toolbar.js +22 -7
  44. package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  45. package/build/components/block-patterns-list/index.js +11 -14
  46. package/build/components/block-patterns-list/index.js.map +1 -1
  47. package/build/components/block-patterns-paging/index.js +12 -3
  48. package/build/components/block-patterns-paging/index.js.map +1 -1
  49. package/build/components/block-popover/index.js +2 -15
  50. package/build/components/block-popover/index.js.map +1 -1
  51. package/build/components/block-quick-navigation/index.js +4 -1
  52. package/build/components/block-quick-navigation/index.js.map +1 -1
  53. package/build/components/block-settings-menu/block-mode-toggle.js +28 -34
  54. package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  55. package/build/components/block-settings-menu-controls/index.js +4 -0
  56. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  57. package/build/components/block-switcher/index.js +22 -17
  58. package/build/components/block-switcher/index.js.map +1 -1
  59. package/build/components/block-switcher/pattern-transformations-menu.js +1 -4
  60. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  61. package/build/components/block-toolbar/index.js +12 -11
  62. package/build/components/block-toolbar/index.js.map +1 -1
  63. package/build/components/block-toolbar/shuffle.js +6 -2
  64. package/build/components/block-toolbar/shuffle.js.map +1 -1
  65. package/build/components/block-tools/block-selection-button.js +8 -2
  66. package/build/components/block-tools/block-selection-button.js.map +1 -1
  67. package/build/components/block-tools/block-toolbar-popover.js +10 -6
  68. package/build/components/block-tools/block-toolbar-popover.js.map +1 -1
  69. package/build/components/block-tools/insertion-point.js +14 -3
  70. package/build/components/block-tools/insertion-point.js.map +1 -1
  71. package/build/components/block-tools/use-block-toolbar-popover-props.js +2 -1
  72. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  73. package/build/components/block-tools/use-show-block-tools.js +2 -1
  74. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  75. package/build/components/block-tools/zoom-out-mode-inserters.js +4 -5
  76. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  77. package/build/components/block-tools/zoom-out-popover.js +3 -4
  78. package/build/components/block-tools/zoom-out-popover.js.map +1 -1
  79. package/build/components/block-tools/zoom-out-toolbar.js +14 -5
  80. package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
  81. package/build/components/block-variation-picker/index.js +4 -1
  82. package/build/components/block-variation-picker/index.js.map +1 -1
  83. package/build/components/block-variation-transforms/index.js +4 -1
  84. package/build/components/block-variation-transforms/index.js.map +1 -1
  85. package/build/components/border-radius-control/index.js +1 -0
  86. package/build/components/border-radius-control/index.js.map +1 -1
  87. package/build/components/button-block-appender/index.js +14 -3
  88. package/build/components/button-block-appender/index.js.map +1 -1
  89. package/build/components/colors-gradients/dropdown.js +4 -1
  90. package/build/components/colors-gradients/dropdown.js.map +1 -1
  91. package/build/components/content-lock/index.js +13 -0
  92. package/build/components/content-lock/index.js.map +1 -0
  93. package/build/components/content-lock/modify-content-lock-menu-item.js +64 -0
  94. package/build/components/content-lock/modify-content-lock-menu-item.js.map +1 -0
  95. package/build/components/convert-to-group-buttons/index.js +1 -1
  96. package/build/components/convert-to-group-buttons/index.js.map +1 -1
  97. package/build/components/date-format-picker/index.js +2 -0
  98. package/build/components/date-format-picker/index.js.map +1 -1
  99. package/build/components/editor-styles/index.js +4 -3
  100. package/build/components/editor-styles/index.js.map +1 -1
  101. package/build/components/font-appearance-control/index.js +3 -0
  102. package/build/components/font-appearance-control/index.js.map +1 -1
  103. package/build/components/font-family/index.js +3 -0
  104. package/build/components/font-family/index.js.map +1 -1
  105. package/build/components/global-styles/background-panel.js +118 -50
  106. package/build/components/global-styles/background-panel.js.map +1 -1
  107. package/build/components/global-styles/color-panel.js +8 -5
  108. package/build/components/global-styles/color-panel.js.map +1 -1
  109. package/build/components/global-styles/color-panel.native.js +1 -1
  110. package/build/components/global-styles/color-panel.native.js.map +1 -1
  111. package/build/components/global-styles/dimensions-panel.js +34 -37
  112. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  113. package/build/components/global-styles/filters-panel.js +4 -1
  114. package/build/components/global-styles/filters-panel.js.map +1 -1
  115. package/build/components/global-styles/get-global-styles-changes.js +3 -1
  116. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  117. package/build/components/global-styles/hooks.js +0 -7
  118. package/build/components/global-styles/hooks.js.map +1 -1
  119. package/build/components/global-styles/index.js +0 -6
  120. package/build/components/global-styles/index.js.map +1 -1
  121. package/build/components/global-styles/shadow-panel-components.js +13 -7
  122. package/build/components/global-styles/shadow-panel-components.js.map +1 -1
  123. package/build/components/global-styles/typography-utils.js +17 -6
  124. package/build/components/global-styles/typography-utils.js.map +1 -1
  125. package/build/components/global-styles/use-global-styles-output.js +3 -3
  126. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  127. package/build/components/global-styles/utils.js +11 -29
  128. package/build/components/global-styles/utils.js.map +1 -1
  129. package/build/components/grid/grid-item-movers.js +2 -2
  130. package/build/components/grid/grid-item-movers.js.map +1 -1
  131. package/build/components/grid/grid-visualizer.js +20 -5
  132. package/build/components/grid/grid-visualizer.js.map +1 -1
  133. package/build/components/height-control/index.js +1 -0
  134. package/build/components/height-control/index.js.map +1 -1
  135. package/build/components/iframe/index.js +8 -6
  136. package/build/components/iframe/index.js.map +1 -1
  137. package/build/components/image-editor/zoom-dropdown.js +11 -7
  138. package/build/components/image-editor/zoom-dropdown.js.map +1 -1
  139. package/build/components/inner-blocks/button-block-appender.js +8 -8
  140. package/build/components/inner-blocks/button-block-appender.js.map +1 -1
  141. package/build/components/inner-blocks/default-block-appender.js +7 -25
  142. package/build/components/inner-blocks/default-block-appender.js.map +1 -1
  143. package/build/components/inner-blocks/index.js +8 -12
  144. package/build/components/inner-blocks/index.js.map +1 -1
  145. package/build/components/inner-blocks/use-inner-block-template-sync.js +3 -3
  146. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  147. package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +4 -1
  148. package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
  149. package/build/components/inserter/block-patterns-tab/index.js +4 -1
  150. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  151. package/build/components/inserter/media-tab/hooks.js +3 -3
  152. package/build/components/inserter/media-tab/hooks.js.map +1 -1
  153. package/build/components/inserter/media-tab/media-list.js +1 -4
  154. package/build/components/inserter/media-tab/media-list.js.map +1 -1
  155. package/build/components/inserter/media-tab/media-preview.js +8 -2
  156. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  157. package/build/components/inserter/media-tab/media-tab.js +4 -1
  158. package/build/components/inserter/media-tab/media-tab.js.map +1 -1
  159. package/build/components/inserter/menu.js +14 -13
  160. package/build/components/inserter/menu.js.map +1 -1
  161. package/build/components/inserter/quick-inserter.js +8 -1
  162. package/build/components/inserter/quick-inserter.js.map +1 -1
  163. package/build/components/inserter-list-item/index.js +4 -4
  164. package/build/components/inserter-list-item/index.js.map +1 -1
  165. package/build/components/inserter-listbox/index.js +3 -7
  166. package/build/components/inserter-listbox/index.js.map +1 -1
  167. package/build/components/inserter-listbox/item.js +4 -1
  168. package/build/components/inserter-listbox/item.js.map +1 -1
  169. package/build/components/inspector-controls/groups.js +2 -0
  170. package/build/components/inspector-controls/groups.js.map +1 -1
  171. package/build/components/inspector-controls-tabs/index.js +4 -1
  172. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  173. package/build/components/inspector-controls-tabs/settings-tab.js +3 -1
  174. package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  175. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -1
  176. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  177. package/build/components/inspector-popover-header/index.js +8 -2
  178. package/build/components/inspector-popover-header/index.js.map +1 -1
  179. package/build/components/letter-spacing-control/index.js +7 -4
  180. package/build/components/letter-spacing-control/index.js.map +1 -1
  181. package/build/components/line-height-control/index.js +3 -0
  182. package/build/components/line-height-control/index.js.map +1 -1
  183. package/build/components/link-control/index.js +19 -10
  184. package/build/components/link-control/index.js.map +1 -1
  185. package/build/components/link-control/settings-drawer.js +4 -1
  186. package/build/components/link-control/settings-drawer.js.map +1 -1
  187. package/build/components/list-view/block-select-button.js +4 -1
  188. package/build/components/list-view/block-select-button.js.map +1 -1
  189. package/build/components/media-placeholder/index.js +36 -10
  190. package/build/components/media-placeholder/index.js.map +1 -1
  191. package/build/components/media-replace-flow/index.js +8 -1
  192. package/build/components/media-replace-flow/index.js.map +1 -1
  193. package/build/components/media-upload/index.native.js +4 -1
  194. package/build/components/media-upload/index.native.js.map +1 -1
  195. package/build/components/multi-selection-inspector/index.js +12 -12
  196. package/build/components/multi-selection-inspector/index.js.map +1 -1
  197. package/build/components/provider/use-block-sync.js +19 -19
  198. package/build/components/provider/use-block-sync.js.map +1 -1
  199. package/build/components/rich-text/event-listeners/paste-handler.js +12 -1
  200. package/build/components/rich-text/event-listeners/paste-handler.js.map +1 -1
  201. package/build/components/rich-text/index.js +38 -30
  202. package/build/components/rich-text/index.js.map +1 -1
  203. package/build/components/rich-text/use-mark-persistent.js +5 -5
  204. package/build/components/rich-text/use-mark-persistent.js.map +1 -1
  205. package/build/components/skip-to-selected-block/index.js +4 -1
  206. package/build/components/skip-to-selected-block/index.js.map +1 -1
  207. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
  208. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  209. package/build/components/text-alignment-control/index.js +13 -8
  210. package/build/components/text-alignment-control/index.js.map +1 -1
  211. package/build/components/text-decoration-control/index.js +13 -8
  212. package/build/components/text-decoration-control/index.js.map +1 -1
  213. package/build/components/text-transform-control/index.js +13 -8
  214. package/build/components/text-transform-control/index.js.map +1 -1
  215. package/build/components/tool-selector/index.js +4 -1
  216. package/build/components/tool-selector/index.js.map +1 -1
  217. package/build/components/url-input/button.js +12 -3
  218. package/build/components/url-input/button.js.map +1 -1
  219. package/build/components/url-input/index.js +4 -1
  220. package/build/components/url-input/index.js.map +1 -1
  221. package/build/components/url-popover/image-url-input-ui.js +2 -0
  222. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  223. package/build/components/use-block-drop-zone/index.js +12 -2
  224. package/build/components/use-block-drop-zone/index.js.map +1 -1
  225. package/build/components/writing-flow/index.js +2 -1
  226. package/build/components/writing-flow/index.js.map +1 -1
  227. package/build/components/writing-flow/use-arrow-nav.js +4 -1
  228. package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
  229. package/build/components/writing-flow/use-event-redirect.js +66 -0
  230. package/build/components/writing-flow/use-event-redirect.js.map +1 -0
  231. package/build/components/writing-flow/use-input.js +31 -1
  232. package/build/components/writing-flow/use-input.js.map +1 -1
  233. package/build/components/writing-flow/use-select-all.js +14 -1
  234. package/build/components/writing-flow/use-select-all.js.map +1 -1
  235. package/build/components/writing-flow/use-selection-observer.js +20 -6
  236. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  237. package/build/components/writing-flow/use-tab-nav.js +4 -4
  238. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  239. package/build/components/writing-flow/utils.js +27 -0
  240. package/build/components/writing-flow/utils.js.map +1 -1
  241. package/build/components/writing-mode-control/index.js +13 -8
  242. package/build/components/writing-mode-control/index.js.map +1 -1
  243. package/build/hooks/background.js +19 -23
  244. package/build/hooks/background.js.map +1 -1
  245. package/build/hooks/block-bindings.js +64 -103
  246. package/build/hooks/block-bindings.js.map +1 -1
  247. package/build/hooks/content-lock-ui.js +8 -26
  248. package/build/hooks/content-lock-ui.js.map +1 -1
  249. package/build/hooks/duotone.js +0 -4
  250. package/build/hooks/duotone.js.map +1 -1
  251. package/build/hooks/layout.js +4 -1
  252. package/build/hooks/layout.js.map +1 -1
  253. package/build/hooks/spacing-visualizer.js +3 -3
  254. package/build/hooks/spacing-visualizer.js.map +1 -1
  255. package/build/hooks/style.js +1 -5
  256. package/build/hooks/style.js.map +1 -1
  257. package/build/hooks/use-bindings-attributes.js +19 -20
  258. package/build/hooks/use-bindings-attributes.js.map +1 -1
  259. package/build/hooks/use-zoom-out.js +7 -7
  260. package/build/hooks/use-zoom-out.js.map +1 -1
  261. package/build/layouts/constrained.js +42 -41
  262. package/build/layouts/constrained.js.map +1 -1
  263. package/build/layouts/flex.js +6 -1
  264. package/build/layouts/flex.js.map +1 -1
  265. package/build/layouts/grid.js +3 -0
  266. package/build/layouts/grid.js.map +1 -1
  267. package/build/layouts/utils.js +1 -7
  268. package/build/layouts/utils.js.map +1 -1
  269. package/build/private-apis.js +4 -1
  270. package/build/private-apis.js.map +1 -1
  271. package/build/store/actions.js +2 -7
  272. package/build/store/actions.js.map +1 -1
  273. package/build/store/private-actions.js +1 -0
  274. package/build/store/private-actions.js.map +1 -1
  275. package/build/store/private-keys.js +2 -1
  276. package/build/store/private-keys.js.map +1 -1
  277. package/build/store/private-selectors.js +39 -11
  278. package/build/store/private-selectors.js.map +1 -1
  279. package/build/store/reducer.js +2 -0
  280. package/build/store/reducer.js.map +1 -1
  281. package/build/store/selectors.js +19 -43
  282. package/build/store/selectors.js.map +1 -1
  283. package/build/store/utils.js +48 -0
  284. package/build/store/utils.js.map +1 -1
  285. package/build/utils/block-bindings.js +117 -0
  286. package/build/utils/block-bindings.js.map +1 -0
  287. package/build/utils/dom.js +101 -0
  288. package/build/utils/dom.js.map +1 -1
  289. package/build/utils/get-font-styles-and-weights.js +4 -4
  290. package/build/utils/get-font-styles-and-weights.js.map +1 -1
  291. package/build/utils/transform-styles/index.js +120 -16
  292. package/build/utils/transform-styles/index.js.map +1 -1
  293. package/build-module/autocompleters/block.js +1 -1
  294. package/build-module/autocompleters/block.js.map +1 -1
  295. package/build-module/components/block-alignment-matrix-control/index.js +1 -1
  296. package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
  297. package/build-module/components/block-breadcrumb/index.js +8 -2
  298. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  299. package/build-module/components/block-canvas/index.js +9 -1
  300. package/build-module/components/block-canvas/index.js.map +1 -1
  301. package/build-module/components/block-compare/block-view.js +4 -1
  302. package/build-module/components/block-compare/block-view.js.map +1 -1
  303. package/build-module/components/block-draggable/index.js +4 -4
  304. package/build-module/components/block-draggable/index.js.map +1 -1
  305. package/build-module/components/block-draggable/use-scroll-when-dragging.js +25 -25
  306. package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
  307. package/build-module/components/block-edit/multiple-usage-warning.js +8 -2
  308. package/build-module/components/block-edit/multiple-usage-warning.js.map +1 -1
  309. package/build-module/components/block-inspector/index.js +27 -9
  310. package/build-module/components/block-inspector/index.js.map +1 -1
  311. package/build-module/components/block-list/block-invalid-warning.js +6 -3
  312. package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
  313. package/build-module/components/block-list/block.js +5 -1
  314. package/build-module/components/block-list/block.js.map +1 -1
  315. package/build-module/components/block-list/use-block-props/index.js +7 -3
  316. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  317. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +1 -0
  318. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  319. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +40 -0
  320. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -0
  321. package/build-module/components/block-list/use-in-between-inserter.js +11 -4
  322. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  323. package/build-module/components/block-lock/toolbar.js +3 -3
  324. package/build-module/components/block-lock/toolbar.js.map +1 -1
  325. package/build-module/components/block-mover/button.js +4 -1
  326. package/build-module/components/block-mover/button.js.map +1 -1
  327. package/build-module/components/block-mover/index.js +4 -1
  328. package/build-module/components/block-mover/index.js.map +1 -1
  329. package/build-module/components/block-navigation/dropdown.js +4 -1
  330. package/build-module/components/block-navigation/dropdown.js.map +1 -1
  331. package/build-module/components/block-pattern-setup/index.js +1 -4
  332. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  333. package/build-module/components/block-pattern-setup/setup-toolbar.js +23 -8
  334. package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  335. package/build-module/components/block-patterns-list/index.js +11 -14
  336. package/build-module/components/block-patterns-list/index.js.map +1 -1
  337. package/build-module/components/block-patterns-paging/index.js +12 -3
  338. package/build-module/components/block-patterns-paging/index.js.map +1 -1
  339. package/build-module/components/block-popover/index.js +2 -15
  340. package/build-module/components/block-popover/index.js.map +1 -1
  341. package/build-module/components/block-quick-navigation/index.js +4 -1
  342. package/build-module/components/block-quick-navigation/index.js.map +1 -1
  343. package/build-module/components/block-settings-menu/block-mode-toggle.js +29 -34
  344. package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  345. package/build-module/components/block-settings-menu-controls/index.js +4 -0
  346. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  347. package/build-module/components/block-switcher/index.js +22 -17
  348. package/build-module/components/block-switcher/index.js.map +1 -1
  349. package/build-module/components/block-switcher/pattern-transformations-menu.js +1 -4
  350. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  351. package/build-module/components/block-toolbar/index.js +12 -11
  352. package/build-module/components/block-toolbar/index.js.map +1 -1
  353. package/build-module/components/block-toolbar/shuffle.js +6 -2
  354. package/build-module/components/block-toolbar/shuffle.js.map +1 -1
  355. package/build-module/components/block-tools/block-selection-button.js +8 -2
  356. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  357. package/build-module/components/block-tools/block-toolbar-popover.js +10 -6
  358. package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -1
  359. package/build-module/components/block-tools/insertion-point.js +14 -3
  360. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  361. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +2 -1
  362. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  363. package/build-module/components/block-tools/use-show-block-tools.js +2 -1
  364. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  365. package/build-module/components/block-tools/zoom-out-mode-inserters.js +4 -5
  366. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  367. package/build-module/components/block-tools/zoom-out-popover.js +3 -4
  368. package/build-module/components/block-tools/zoom-out-popover.js.map +1 -1
  369. package/build-module/components/block-tools/zoom-out-toolbar.js +15 -6
  370. package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
  371. package/build-module/components/block-variation-picker/index.js +4 -1
  372. package/build-module/components/block-variation-picker/index.js.map +1 -1
  373. package/build-module/components/block-variation-transforms/index.js +4 -1
  374. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  375. package/build-module/components/border-radius-control/index.js +1 -0
  376. package/build-module/components/border-radius-control/index.js.map +1 -1
  377. package/build-module/components/button-block-appender/index.js +15 -4
  378. package/build-module/components/button-block-appender/index.js.map +1 -1
  379. package/build-module/components/colors-gradients/dropdown.js +4 -1
  380. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  381. package/build-module/components/content-lock/index.js +2 -0
  382. package/build-module/components/content-lock/index.js.map +1 -0
  383. package/build-module/components/content-lock/modify-content-lock-menu-item.js +57 -0
  384. package/build-module/components/content-lock/modify-content-lock-menu-item.js.map +1 -0
  385. package/build-module/components/convert-to-group-buttons/index.js +1 -1
  386. package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
  387. package/build-module/components/date-format-picker/index.js +2 -0
  388. package/build-module/components/date-format-picker/index.js.map +1 -1
  389. package/build-module/components/editor-styles/index.js +4 -3
  390. package/build-module/components/editor-styles/index.js.map +1 -1
  391. package/build-module/components/font-appearance-control/index.js +3 -0
  392. package/build-module/components/font-appearance-control/index.js.map +1 -1
  393. package/build-module/components/font-family/index.js +3 -0
  394. package/build-module/components/font-family/index.js.map +1 -1
  395. package/build-module/components/global-styles/background-panel.js +121 -53
  396. package/build-module/components/global-styles/background-panel.js.map +1 -1
  397. package/build-module/components/global-styles/color-panel.js +7 -4
  398. package/build-module/components/global-styles/color-panel.js.map +1 -1
  399. package/build-module/components/global-styles/color-panel.native.js +2 -2
  400. package/build-module/components/global-styles/color-panel.native.js.map +1 -1
  401. package/build-module/components/global-styles/dimensions-panel.js +36 -39
  402. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  403. package/build-module/components/global-styles/filters-panel.js +4 -1
  404. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  405. package/build-module/components/global-styles/get-global-styles-changes.js +3 -1
  406. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  407. package/build-module/components/global-styles/hooks.js +0 -6
  408. package/build-module/components/global-styles/hooks.js.map +1 -1
  409. package/build-module/components/global-styles/index.js +1 -1
  410. package/build-module/components/global-styles/index.js.map +1 -1
  411. package/build-module/components/global-styles/shadow-panel-components.js +13 -7
  412. package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
  413. package/build-module/components/global-styles/typography-utils.js +17 -6
  414. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  415. package/build-module/components/global-styles/use-global-styles-output.js +5 -5
  416. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  417. package/build-module/components/global-styles/utils.js +11 -28
  418. package/build-module/components/global-styles/utils.js.map +1 -1
  419. package/build-module/components/grid/grid-item-movers.js +3 -3
  420. package/build-module/components/grid/grid-item-movers.js.map +1 -1
  421. package/build-module/components/grid/grid-visualizer.js +20 -5
  422. package/build-module/components/grid/grid-visualizer.js.map +1 -1
  423. package/build-module/components/height-control/index.js +1 -0
  424. package/build-module/components/height-control/index.js.map +1 -1
  425. package/build-module/components/iframe/index.js +8 -6
  426. package/build-module/components/iframe/index.js.map +1 -1
  427. package/build-module/components/image-editor/zoom-dropdown.js +12 -8
  428. package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
  429. package/build-module/components/inner-blocks/button-block-appender.js +7 -6
  430. package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
  431. package/build-module/components/inner-blocks/default-block-appender.js +6 -23
  432. package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
  433. package/build-module/components/inner-blocks/index.js +8 -12
  434. package/build-module/components/inner-blocks/index.js.map +1 -1
  435. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +3 -3
  436. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  437. package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +4 -1
  438. package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
  439. package/build-module/components/inserter/block-patterns-tab/index.js +4 -1
  440. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  441. package/build-module/components/inserter/media-tab/hooks.js +3 -3
  442. package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
  443. package/build-module/components/inserter/media-tab/media-list.js +1 -4
  444. package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
  445. package/build-module/components/inserter/media-tab/media-preview.js +8 -2
  446. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  447. package/build-module/components/inserter/media-tab/media-tab.js +4 -1
  448. package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
  449. package/build-module/components/inserter/menu.js +14 -13
  450. package/build-module/components/inserter/menu.js.map +1 -1
  451. package/build-module/components/inserter/quick-inserter.js +9 -2
  452. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  453. package/build-module/components/inserter-list-item/index.js +4 -4
  454. package/build-module/components/inserter-list-item/index.js.map +1 -1
  455. package/build-module/components/inserter-listbox/index.js +3 -7
  456. package/build-module/components/inserter-listbox/index.js.map +1 -1
  457. package/build-module/components/inserter-listbox/item.js +4 -1
  458. package/build-module/components/inserter-listbox/item.js.map +1 -1
  459. package/build-module/components/inspector-controls/groups.js +2 -0
  460. package/build-module/components/inspector-controls/groups.js.map +1 -1
  461. package/build-module/components/inspector-controls-tabs/index.js +4 -1
  462. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  463. package/build-module/components/inspector-controls-tabs/settings-tab.js +3 -1
  464. package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  465. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -1
  466. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  467. package/build-module/components/inspector-popover-header/index.js +8 -2
  468. package/build-module/components/inspector-popover-header/index.js.map +1 -1
  469. package/build-module/components/letter-spacing-control/index.js +7 -4
  470. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  471. package/build-module/components/line-height-control/index.js +3 -0
  472. package/build-module/components/line-height-control/index.js.map +1 -1
  473. package/build-module/components/link-control/index.js +19 -10
  474. package/build-module/components/link-control/index.js.map +1 -1
  475. package/build-module/components/link-control/settings-drawer.js +4 -1
  476. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  477. package/build-module/components/list-view/block-select-button.js +4 -1
  478. package/build-module/components/list-view/block-select-button.js.map +1 -1
  479. package/build-module/components/media-placeholder/index.js +36 -10
  480. package/build-module/components/media-placeholder/index.js.map +1 -1
  481. package/build-module/components/media-replace-flow/index.js +8 -1
  482. package/build-module/components/media-replace-flow/index.js.map +1 -1
  483. package/build-module/components/media-upload/index.native.js +4 -1
  484. package/build-module/components/media-upload/index.native.js.map +1 -1
  485. package/build-module/components/multi-selection-inspector/index.js +12 -12
  486. package/build-module/components/multi-selection-inspector/index.js.map +1 -1
  487. package/build-module/components/provider/use-block-sync.js +19 -19
  488. package/build-module/components/provider/use-block-sync.js.map +1 -1
  489. package/build-module/components/rich-text/event-listeners/paste-handler.js +12 -1
  490. package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -1
  491. package/build-module/components/rich-text/index.js +39 -31
  492. package/build-module/components/rich-text/index.js.map +1 -1
  493. package/build-module/components/rich-text/use-mark-persistent.js +5 -5
  494. package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
  495. package/build-module/components/skip-to-selected-block/index.js +4 -1
  496. package/build-module/components/skip-to-selected-block/index.js.map +1 -1
  497. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
  498. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  499. package/build-module/components/text-alignment-control/index.js +13 -8
  500. package/build-module/components/text-alignment-control/index.js.map +1 -1
  501. package/build-module/components/text-decoration-control/index.js +13 -8
  502. package/build-module/components/text-decoration-control/index.js.map +1 -1
  503. package/build-module/components/text-transform-control/index.js +13 -8
  504. package/build-module/components/text-transform-control/index.js.map +1 -1
  505. package/build-module/components/tool-selector/index.js +4 -1
  506. package/build-module/components/tool-selector/index.js.map +1 -1
  507. package/build-module/components/url-input/button.js +12 -3
  508. package/build-module/components/url-input/button.js.map +1 -1
  509. package/build-module/components/url-input/index.js +4 -1
  510. package/build-module/components/url-input/index.js.map +1 -1
  511. package/build-module/components/url-popover/image-url-input-ui.js +2 -0
  512. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  513. package/build-module/components/use-block-drop-zone/index.js +12 -2
  514. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  515. package/build-module/components/writing-flow/index.js +2 -1
  516. package/build-module/components/writing-flow/index.js.map +1 -1
  517. package/build-module/components/writing-flow/use-arrow-nav.js +4 -1
  518. package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
  519. package/build-module/components/writing-flow/use-event-redirect.js +60 -0
  520. package/build-module/components/writing-flow/use-event-redirect.js.map +1 -0
  521. package/build-module/components/writing-flow/use-input.js +31 -1
  522. package/build-module/components/writing-flow/use-input.js.map +1 -1
  523. package/build-module/components/writing-flow/use-select-all.js +14 -1
  524. package/build-module/components/writing-flow/use-select-all.js.map +1 -1
  525. package/build-module/components/writing-flow/use-selection-observer.js +16 -2
  526. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  527. package/build-module/components/writing-flow/use-tab-nav.js +4 -4
  528. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  529. package/build-module/components/writing-flow/utils.js +26 -0
  530. package/build-module/components/writing-flow/utils.js.map +1 -1
  531. package/build-module/components/writing-mode-control/index.js +13 -8
  532. package/build-module/components/writing-mode-control/index.js.map +1 -1
  533. package/build-module/hooks/background.js +19 -23
  534. package/build-module/hooks/background.js.map +1 -1
  535. package/build-module/hooks/block-bindings.js +66 -105
  536. package/build-module/hooks/block-bindings.js.map +1 -1
  537. package/build-module/hooks/content-lock-ui.js +10 -30
  538. package/build-module/hooks/content-lock-ui.js.map +1 -1
  539. package/build-module/hooks/duotone.js +0 -4
  540. package/build-module/hooks/duotone.js.map +1 -1
  541. package/build-module/hooks/layout.js +4 -1
  542. package/build-module/hooks/layout.js.map +1 -1
  543. package/build-module/hooks/spacing-visualizer.js +3 -3
  544. package/build-module/hooks/spacing-visualizer.js.map +1 -1
  545. package/build-module/hooks/style.js +1 -5
  546. package/build-module/hooks/style.js.map +1 -1
  547. package/build-module/hooks/use-bindings-attributes.js +19 -20
  548. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  549. package/build-module/hooks/use-zoom-out.js +7 -7
  550. package/build-module/hooks/use-zoom-out.js.map +1 -1
  551. package/build-module/layouts/constrained.js +44 -43
  552. package/build-module/layouts/constrained.js.map +1 -1
  553. package/build-module/layouts/flex.js +6 -1
  554. package/build-module/layouts/flex.js.map +1 -1
  555. package/build-module/layouts/grid.js +3 -0
  556. package/build-module/layouts/grid.js.map +1 -1
  557. package/build-module/layouts/utils.js +1 -7
  558. package/build-module/layouts/utils.js.map +1 -1
  559. package/build-module/private-apis.js +5 -2
  560. package/build-module/private-apis.js.map +1 -1
  561. package/build-module/store/actions.js +2 -7
  562. package/build-module/store/actions.js.map +1 -1
  563. package/build-module/store/private-actions.js +1 -0
  564. package/build-module/store/private-actions.js.map +1 -1
  565. package/build-module/store/private-keys.js +1 -0
  566. package/build-module/store/private-keys.js.map +1 -1
  567. package/build-module/store/private-selectors.js +36 -12
  568. package/build-module/store/private-selectors.js.map +1 -1
  569. package/build-module/store/reducer.js +2 -0
  570. package/build-module/store/reducer.js.map +1 -1
  571. package/build-module/store/selectors.js +22 -46
  572. package/build-module/store/selectors.js.map +1 -1
  573. package/build-module/store/utils.js +46 -0
  574. package/build-module/store/utils.js.map +1 -1
  575. package/build-module/utils/block-bindings.js +110 -0
  576. package/build-module/utils/block-bindings.js.map +1 -0
  577. package/build-module/utils/dom.js +99 -0
  578. package/build-module/utils/dom.js.map +1 -1
  579. package/build-module/utils/get-font-styles-and-weights.js +4 -4
  580. package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
  581. package/build-module/utils/transform-styles/index.js +120 -16
  582. package/build-module/utils/transform-styles/index.js.map +1 -1
  583. package/build-style/content-rtl.css +9 -25
  584. package/build-style/content.css +9 -25
  585. package/build-style/default-editor-styles-rtl.css +2 -2
  586. package/build-style/default-editor-styles.css +2 -2
  587. package/build-style/style-rtl.css +53 -76
  588. package/build-style/style.css +53 -76
  589. package/build-types/utils/dom.d.ts +25 -0
  590. package/build-types/utils/dom.d.ts.map +1 -1
  591. package/package.json +34 -32
  592. package/src/autocompleters/block.js +2 -1
  593. package/src/components/block-alignment-matrix-control/index.js +1 -1
  594. package/src/components/block-breadcrumb/index.js +4 -0
  595. package/src/components/block-breadcrumb/style.scss +1 -1
  596. package/src/components/block-canvas/index.js +9 -1
  597. package/src/components/block-compare/block-view.js +7 -1
  598. package/src/components/block-draggable/content.scss +1 -1
  599. package/src/components/block-draggable/index.js +4 -4
  600. package/src/components/block-draggable/style.scss +1 -1
  601. package/src/components/block-draggable/use-scroll-when-dragging.js +25 -25
  602. package/src/components/block-edit/multiple-usage-warning.js +4 -0
  603. package/src/components/block-inspector/index.js +22 -6
  604. package/src/components/block-list/block-invalid-warning.js +4 -2
  605. package/src/components/block-list/block.js +6 -2
  606. package/src/components/block-list/content.scss +7 -16
  607. package/src/components/block-list/use-block-props/index.js +5 -2
  608. package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -0
  609. package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +44 -0
  610. package/src/components/block-list/use-in-between-inserter.js +17 -5
  611. package/src/components/block-lock/style.scss +1 -1
  612. package/src/components/block-lock/toolbar.js +3 -3
  613. package/src/components/block-mover/button.js +2 -0
  614. package/src/components/block-mover/index.js +2 -0
  615. package/src/components/block-mover/style.scss +1 -1
  616. package/src/components/block-navigation/dropdown.js +2 -0
  617. package/src/components/block-pattern-setup/index.js +3 -7
  618. package/src/components/block-pattern-setup/setup-toolbar.js +17 -4
  619. package/src/components/block-pattern-setup/style.scss +2 -2
  620. package/src/components/block-patterns-list/index.js +15 -13
  621. package/src/components/block-patterns-list/style.scss +2 -2
  622. package/src/components/block-patterns-paging/index.js +6 -0
  623. package/src/components/block-popover/index.js +7 -28
  624. package/src/components/block-popover/style.scss +1 -1
  625. package/src/components/block-quick-navigation/index.js +2 -0
  626. package/src/components/block-settings-menu/block-mode-toggle.js +28 -31
  627. package/src/components/block-settings-menu/test/block-mode-toggle.js +26 -23
  628. package/src/components/block-settings-menu-controls/index.js +7 -1
  629. package/src/components/block-switcher/index.js +26 -20
  630. package/src/components/block-switcher/pattern-transformations-menu.js +3 -7
  631. package/src/components/block-switcher/style.scss +5 -6
  632. package/src/components/block-toolbar/index.js +17 -8
  633. package/src/components/block-toolbar/shuffle.js +9 -7
  634. package/src/components/block-tools/block-selection-button.js +4 -0
  635. package/src/components/block-tools/block-toolbar-popover.js +10 -6
  636. package/src/components/block-tools/insertion-point.js +11 -0
  637. package/src/components/block-tools/style.scss +4 -5
  638. package/src/components/block-tools/use-block-toolbar-popover-props.js +2 -1
  639. package/src/components/block-tools/use-show-block-tools.js +4 -1
  640. package/src/components/block-tools/zoom-out-mode-inserters.js +5 -2
  641. package/src/components/block-tools/zoom-out-popover.js +3 -7
  642. package/src/components/block-tools/zoom-out-toolbar.js +20 -6
  643. package/src/components/block-variation-picker/README.md +2 -2
  644. package/src/components/block-variation-picker/index.js +6 -1
  645. package/src/components/block-variation-transforms/index.js +2 -0
  646. package/src/components/block-variation-transforms/style.scss +2 -2
  647. package/src/components/border-radius-control/index.js +1 -0
  648. package/src/components/border-radius-control/style.scss +0 -10
  649. package/src/components/button-block-appender/content.scss +0 -1
  650. package/src/components/button-block-appender/index.js +14 -3
  651. package/src/components/color-palette/test/control.js +15 -2
  652. package/src/components/colors-gradients/dropdown.js +5 -1
  653. package/src/components/colors-gradients/style.scss +4 -4
  654. package/src/components/content-lock/index.js +1 -0
  655. package/src/components/content-lock/modify-content-lock-menu-item.js +58 -0
  656. package/src/components/convert-to-group-buttons/index.js +1 -1
  657. package/src/components/date-format-picker/index.js +2 -0
  658. package/src/components/default-block-appender/content.scss +0 -1
  659. package/src/components/editor-styles/index.js +4 -3
  660. package/src/components/font-appearance-control/index.js +3 -0
  661. package/src/components/font-family/README.md +11 -2
  662. package/src/components/font-family/index.js +3 -0
  663. package/src/components/global-styles/background-panel.js +135 -64
  664. package/src/components/global-styles/color-panel.js +8 -4
  665. package/src/components/global-styles/color-panel.native.js +2 -2
  666. package/src/components/global-styles/dimensions-panel.js +40 -40
  667. package/src/components/global-styles/filters-panel.js +5 -1
  668. package/src/components/global-styles/get-global-styles-changes.js +4 -1
  669. package/src/components/global-styles/hooks.js +0 -5
  670. package/src/components/global-styles/index.js +0 -1
  671. package/src/components/global-styles/shadow-panel-components.js +12 -8
  672. package/src/components/global-styles/style.scss +16 -6
  673. package/src/components/global-styles/test/typography-utils.js +96 -5
  674. package/src/components/global-styles/test/use-global-styles-output.js +20 -4
  675. package/src/components/global-styles/test/utils.js +10 -0
  676. package/src/components/global-styles/typography-utils.js +22 -6
  677. package/src/components/global-styles/use-global-styles-output.js +5 -6
  678. package/src/components/global-styles/utils.js +11 -35
  679. package/src/components/grid/grid-item-movers.js +3 -3
  680. package/src/components/grid/grid-visualizer.js +22 -7
  681. package/src/components/grid/style.scss +1 -1
  682. package/src/components/height-control/index.js +1 -0
  683. package/src/components/iframe/index.js +8 -6
  684. package/src/components/image-editor/zoom-dropdown.js +17 -9
  685. package/src/components/inner-blocks/button-block-appender.js +5 -7
  686. package/src/components/inner-blocks/default-block-appender.js +4 -23
  687. package/src/components/inner-blocks/index.js +11 -10
  688. package/src/components/inner-blocks/use-inner-block-template-sync.js +3 -3
  689. package/src/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +2 -0
  690. package/src/components/inserter/block-patterns-tab/index.js +2 -0
  691. package/src/components/inserter/media-tab/hooks.js +3 -3
  692. package/src/components/inserter/media-tab/media-list.js +1 -4
  693. package/src/components/inserter/media-tab/media-preview.js +12 -2
  694. package/src/components/inserter/media-tab/media-tab.js +2 -0
  695. package/src/components/inserter/menu.js +13 -22
  696. package/src/components/inserter/quick-inserter.js +6 -1
  697. package/src/components/inserter/style.scss +7 -9
  698. package/src/components/inserter-list-item/index.js +4 -4
  699. package/src/components/inserter-list-item/style.scss +2 -3
  700. package/src/components/inserter-listbox/index.js +2 -8
  701. package/src/components/inserter-listbox/item.js +9 -1
  702. package/src/components/inspector-controls/groups.js +2 -0
  703. package/src/components/inspector-controls-tabs/index.js +2 -0
  704. package/src/components/inspector-controls-tabs/settings-tab.js +1 -0
  705. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +5 -2
  706. package/src/components/inspector-popover-header/index.js +4 -0
  707. package/src/components/letter-spacing-control/README.md +8 -1
  708. package/src/components/letter-spacing-control/index.js +7 -4
  709. package/src/components/line-height-control/README.md +7 -0
  710. package/src/components/line-height-control/index.js +3 -0
  711. package/src/components/link-control/index.js +17 -8
  712. package/src/components/link-control/settings-drawer.js +2 -0
  713. package/src/components/link-control/style.scss +2 -4
  714. package/src/components/list-view/block-select-button.js +2 -0
  715. package/src/components/list-view/style.scss +14 -16
  716. package/src/components/media-placeholder/index.js +26 -7
  717. package/src/components/media-replace-flow/index.js +12 -1
  718. package/src/components/media-upload/README.md +2 -0
  719. package/src/components/media-upload/index.native.js +2 -0
  720. package/src/components/multi-selection-inspector/index.js +8 -9
  721. package/src/components/provider/use-block-sync.js +20 -20
  722. package/src/components/responsive-block-control/README.md +3 -26
  723. package/src/components/responsive-block-control/test/index.js +1 -0
  724. package/src/components/rich-text/content.scss +1 -1
  725. package/src/components/rich-text/event-listeners/paste-handler.js +6 -1
  726. package/src/components/rich-text/index.js +54 -41
  727. package/src/components/rich-text/style.scss +1 -1
  728. package/src/components/rich-text/use-mark-persistent.js +5 -5
  729. package/src/components/skip-to-selected-block/index.js +2 -0
  730. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -4
  731. package/src/components/spacing-sizes-control/style.scss +17 -16
  732. package/src/components/text-alignment-control/index.js +20 -8
  733. package/src/components/text-decoration-control/index.js +20 -8
  734. package/src/components/text-decoration-control/stories/index.story.js +0 -4
  735. package/src/components/text-transform-control/index.js +20 -8
  736. package/src/components/text-transform-control/stories/index.story.js +0 -4
  737. package/src/components/tool-selector/index.js +2 -0
  738. package/src/components/url-input/button.js +6 -0
  739. package/src/components/url-input/index.js +2 -0
  740. package/src/components/url-input/style.scss +2 -2
  741. package/src/components/url-popover/image-url-input-ui.js +2 -0
  742. package/src/components/url-popover/stories/index.story.js +7 -1
  743. package/src/components/use-block-drop-zone/index.js +21 -3
  744. package/src/components/warning/content.scss +3 -10
  745. package/src/components/writing-flow/index.js +2 -0
  746. package/src/components/writing-flow/use-arrow-nav.js +9 -2
  747. package/src/components/writing-flow/use-event-redirect.js +72 -0
  748. package/src/components/writing-flow/use-input.js +36 -1
  749. package/src/components/writing-flow/use-select-all.js +18 -1
  750. package/src/components/writing-flow/use-selection-observer.js +23 -3
  751. package/src/components/writing-flow/use-tab-nav.js +4 -4
  752. package/src/components/writing-flow/utils.js +30 -0
  753. package/src/components/writing-mode-control/index.js +20 -8
  754. package/src/hooks/background.js +21 -27
  755. package/src/hooks/block-bindings.js +64 -122
  756. package/src/hooks/block-bindings.scss +2 -10
  757. package/src/hooks/content-lock-ui.js +11 -36
  758. package/src/hooks/duotone.js +0 -4
  759. package/src/hooks/layout.js +2 -0
  760. package/src/hooks/layout.scss +3 -11
  761. package/src/hooks/spacing-visualizer.js +3 -3
  762. package/src/hooks/style.js +1 -4
  763. package/src/hooks/test/background.js +60 -0
  764. package/src/hooks/use-bindings-attributes.js +23 -24
  765. package/src/hooks/use-zoom-out.js +7 -7
  766. package/src/layouts/constrained.js +51 -47
  767. package/src/layouts/flex.js +4 -0
  768. package/src/layouts/grid.js +3 -0
  769. package/src/layouts/test/grid.js +2 -2
  770. package/src/layouts/test/utils.js +6 -8
  771. package/src/layouts/utils.js +1 -9
  772. package/src/private-apis.js +4 -0
  773. package/src/store/actions.js +4 -6
  774. package/src/store/private-actions.js +1 -0
  775. package/src/store/private-keys.js +1 -0
  776. package/src/store/private-selectors.js +44 -7
  777. package/src/store/reducer.js +2 -0
  778. package/src/store/selectors.js +32 -51
  779. package/src/store/test/private-selectors.js +89 -0
  780. package/src/store/utils.js +50 -0
  781. package/src/style.scss +0 -1
  782. package/src/utils/block-bindings.js +97 -0
  783. package/src/utils/dom.js +117 -0
  784. package/src/utils/get-font-styles-and-weights.js +12 -4
  785. package/src/utils/test/get-font-styles-and-weights.js +148 -0
  786. package/src/utils/test/transform-styles.js +284 -26
  787. package/src/utils/transform-styles/index.js +132 -21
  788. package/tsconfig.json +1 -0
  789. package/tsconfig.tsbuildinfo +1 -1
  790. package/build/components/global-styles/theme-file-uri-utils.js +0 -21
  791. package/build/components/global-styles/theme-file-uri-utils.js.map +0 -1
  792. package/build/components/inner-blocks/with-client-id.js +0 -28
  793. package/build/components/inner-blocks/with-client-id.js.map +0 -1
  794. package/build/components/segmented-text-control/index.js +0 -63
  795. package/build/components/segmented-text-control/index.js.map +0 -1
  796. package/build-module/components/global-styles/theme-file-uri-utils.js +0 -15
  797. package/build-module/components/global-styles/theme-file-uri-utils.js.map +0 -1
  798. package/build-module/components/inner-blocks/with-client-id.js +0 -21
  799. package/build-module/components/inner-blocks/with-client-id.js.map +0 -1
  800. package/build-module/components/segmented-text-control/index.js +0 -58
  801. package/build-module/components/segmented-text-control/index.js.map +0 -1
  802. package/src/components/global-styles/test/theme-file-uri-utils.js +0 -41
  803. package/src/components/global-styles/theme-file-uri-utils.js +0 -18
  804. package/src/components/inner-blocks/with-client-id.js +0 -19
  805. package/src/components/segmented-text-control/index.js +0 -63
  806. package/src/components/segmented-text-control/style.scss +0 -15
  807. package/src/utils/test/__snapshots__/transform-styles.js.snap +0 -109
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_compose","_hooks","_blocks","_data","_components","_i18n","_store","_components2","_useSettings","_layouts","_blockEditingMode","_definitions","_utils","_lockUnlock","_jsxRuntime","layoutBlockSupportKey","kebabCase","unlock","componentsPrivateApis","hasLayoutBlockSupport","blockName","hasBlockSupport","useLayoutClasses","blockAttributes","layout","default","defaultBlockLayout","getBlockSupport","usedLayout","inherit","contentSize","wideSize","type","layoutClassnames","LAYOUT_DEFINITIONS","className","baseClassName","splitBlockName","split","fullBlockName","pop","join","compoundClassName","push","hasGlobalPadding","useSelect","select","blockEditorStore","getSettings","__experimentalFeatures","useRootPaddingAwareAlignments","orientation","justifyContent","flexWrap","useLayoutStyles","selector","style","fullLayoutType","getLayoutType","blockGapSupport","useSettings","hasBlockGapSupport","getLayoutStyle","LayoutPanelPure","setAttributes","name","clientId","settings","useBlockSettings","layoutSettings","themeSupportsLayout","supportsLayout","blockEditingMode","useBlockEditingMode","layoutBlockSupport","blockSupportAndThemeSettings","allowSwitching","allowEditing","allowInheriting","blockSupportAndLayout","defaultType","blockLayoutType","showInheritToggle","layoutType","constrainedType","displayControlsForLegacyLayouts","hasContentSizeOrLegacySettings","onChangeType","newType","onChangeLayout","newLayout","jsxs","Fragment","children","jsx","InspectorControls","PanelBody","title","__","ToggleControl","__nextHasNoMarginBottom","label","checked","onChange","help","LayoutTypeSwitcher","inspectorControls","toolBarControls","_default","exports","shareWithChildBlocks","edit","attributeKeys","hasSupport","ButtonGroup","getLayoutTypes","map","Button","isPressed","onClick","addAttribute","_settings$attributes$","attributes","BlockWithLayoutStyles","block","BlockListBlock","props","layoutClasses","id","useInstanceId","selectorPrefix","css","layoutClassNames","clsx","useStyleOverride","__unstableLayoutClassNames","withLayoutStyles","createHigherOrderComponent","blockSupportsLayout","extraProps","getBlockSettings","disableLayoutStyles","undefined","addFilter"],"sources":["@wordpress/block-editor/src/hooks/layout.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport { useSettings } from '../components/use-settings';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { LAYOUT_DEFINITIONS } from '../layouts/definitions';\nimport { useBlockSettings, useStyleOverride } from './utils';\nimport { unlock } from '../lock-unlock';\n\nconst layoutBlockSupportKey = 'layout';\nconst { kebabCase } = unlock( componentsPrivateApis );\n\nfunction hasLayoutBlockSupport( blockName ) {\n\treturn (\n\t\thasBlockSupport( blockName, 'layout' ) ||\n\t\thasBlockSupport( blockName, '__experimentalLayout' )\n\t);\n}\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( blockAttributes = {}, blockName = '' ) {\n\tconst { layout } = blockAttributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( blockName, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst layoutClassnames = [];\n\n\tif ( LAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className ) {\n\t\tconst baseClassName =\n\t\t\tLAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className;\n\t\tconst splitBlockName = blockName.split( '/' );\n\t\tconst fullBlockName =\n\t\t\tsplitBlockName[ 0 ] === 'core'\n\t\t\t\t? splitBlockName.pop()\n\t\t\t\t: splitBlockName.join( '-' );\n\t\tconst compoundClassName = `wp-block-${ fullBlockName }-${ baseClassName }`;\n\t\tlayoutClassnames.push( baseClassName, compoundClassName );\n\t}\n\n\tconst hasGlobalPadding = useSelect(\n\t\t( select ) => {\n\t\t\treturn (\n\t\t\t\t( usedLayout?.inherit ||\n\t\t\t\t\tusedLayout?.contentSize ||\n\t\t\t\t\tusedLayout?.type === 'constrained' ) &&\n\t\t\t\tselect( blockEditorStore ).getSettings().__experimentalFeatures\n\t\t\t\t\t?.useRootPaddingAwareAlignments\n\t\t\t);\n\t\t},\n\t\t[ usedLayout?.contentSize, usedLayout?.inherit, usedLayout?.type ]\n\t);\n\n\tif ( hasGlobalPadding ) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( usedLayout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );\n\t}\n\n\tif ( usedLayout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tusedLayout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\n/**\n * Generates a CSS rule with the given block's layout styles.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( blockAttributes = {}, blockName, selector ) {\n\tconst { layout = {}, style = {} } = blockAttributes;\n\t// Update type for blocks using legacy layouts.\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || {};\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\treturn fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName,\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n}\n\nfunction LayoutPanelPure( {\n\tlayout,\n\tsetAttributes,\n\tname: blockName,\n\tclientId,\n} ) {\n\tconst settings = useBlockSettings( blockName );\n\t// Block settings come from theme.json under settings.[blockName].\n\tconst { layout: layoutSettings } = settings;\n\tconst { themeSupportsLayout } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tthemeSupportsLayout: getSettings().supportsLayout,\n\t\t};\n\t}, [] );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\t// Layout block support comes from the block's block.json.\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst blockSupportAndThemeSettings = {\n\t\t...layoutSettings,\n\t\t...layoutBlockSupport,\n\t};\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = blockSupportAndThemeSettings;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t/*\n\t * Try to find the layout type from either the\n\t * block's layout settings or any saved layout config.\n\t */\n\tconst blockSupportAndLayout = {\n\t\t...layoutBlockSupport,\n\t\t...layout,\n\t};\n\tconst { type, default: { type: defaultType = 'default' } = {} } =\n\t\tblockSupportAndLayout;\n\tconst blockLayoutType = type || defaultType;\n\n\t// Only show the inherit toggle if it's supported,\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t( ! blockLayoutType ||\n\t\t\tblockLayoutType === 'default' ||\n\t\t\tblockLayoutType === 'constrained' ||\n\t\t\tblockSupportAndLayout.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst { inherit = false, contentSize = null } = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( blockLayoutType === 'default' ||\n\t\t\tblockLayoutType === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( blockLayoutType );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tclassName=\"block-editor-hooks__toggle-control\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutType?.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t'constrained' ||\n\t\t\t\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container. Toggle to constrain.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ blockLayoutType }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\tname={ blockName }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: LayoutPanelPure,\n\tattributeKeys: [ 'layout' ],\n\thasSupport( name ) {\n\t\treturn hasLayoutBlockSupport( name );\n\t},\n};\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasLayoutBlockSupport( settings ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockWithLayoutStyles( {\n\tblock: BlockListBlock,\n\tprops,\n\tblockGapSupport,\n\tlayoutClasses,\n} ) {\n\tconst { name, attributes } = props;\n\tconst id = useInstanceId( BlockListBlock );\n\tconst { layout } = attributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst selectorPrefix = `wp-container-${ kebabCase( name ) }-is-layout-`;\n\t// Higher specificity to override defaults from theme.json.\n\tconst selector = `.${ selectorPrefix }${ id }`;\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t// Get CSS string for the current layout type.\n\t// The CSS and `style` element is only output if it is not empty.\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout: usedLayout,\n\t\tstyle: attributes?.style,\n\t\thasBlockGapSupport,\n\t} );\n\n\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\tconst layoutClassNames = clsx(\n\t\t{\n\t\t\t[ `${ selectorPrefix }${ id }` ]: !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t},\n\t\tlayoutClasses\n\t);\n\n\tuseStyleOverride( { css } );\n\n\treturn (\n\t\t<BlockListBlock\n\t\t\t{ ...props }\n\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t/>\n\t);\n}\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { clientId, name, attributes } = props;\n\t\tconst blockSupportsLayout = hasLayoutBlockSupport( name );\n\t\tconst layoutClasses = useLayoutClasses( attributes, name );\n\t\tconst extraProps = useSelect(\n\t\t\t( select ) => {\n\t\t\t\t// The callback returns early to avoid block editor subscription.\n\t\t\t\tif ( ! blockSupportsLayout ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst { getSettings, getBlockSettings } = unlock(\n\t\t\t\t\tselect( blockEditorStore )\n\t\t\t\t);\n\t\t\t\tconst { disableLayoutStyles } = getSettings();\n\n\t\t\t\tif ( disableLayoutStyles ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst [ blockGapSupport ] = getBlockSettings(\n\t\t\t\t\tclientId,\n\t\t\t\t\t'spacing.blockGap'\n\t\t\t\t);\n\n\t\t\t\treturn { blockGapSupport };\n\t\t\t},\n\t\t\t[ blockSupportsLayout, clientId ]\n\t\t);\n\n\t\tif ( ! extraProps ) {\n\t\t\treturn (\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\t__unstableLayoutClassNames={\n\t\t\t\t\t\tblockSupportsLayout ? layoutClasses : undefined\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<BlockWithLayoutStyles\n\t\t\t\tblock={ BlockListBlock }\n\t\t\t\tprops={ props }\n\t\t\t\tlayoutClasses={ layoutClasses }\n\t\t\t\t{ ...extraProps }\n\t\t\t/>\n\t\t);\n\t},\n\t'withLayoutStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\n"],"mappings":";;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAOA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,iBAAA,GAAAX,OAAA;AACA,IAAAY,YAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,WAAA,GAAAd,OAAA;AAAwC,IAAAe,WAAA,GAAAf,OAAA;AA/BxC;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;;AAUA,MAAMgB,qBAAqB,GAAG,QAAQ;AACtC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AAErD,SAASC,qBAAqBA,CAAEC,SAAS,EAAG;EAC3C,OACC,IAAAC,uBAAe,EAAED,SAAS,EAAE,QAAS,CAAC,IACtC,IAAAC,uBAAe,EAAED,SAAS,EAAE,sBAAuB,CAAC;AAEtD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,gBAAgBA,CAAEC,eAAe,GAAG,CAAC,CAAC,EAAEH,SAAS,GAAG,EAAE,EAAG;EACxE,MAAM;IAAEI;EAAO,CAAC,GAAGD,eAAe;EAClC,MAAM;IAAEE,OAAO,E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,CAAC;IAE7C,IAAK6F,mBAAmB,EAAG;MAC1B;IACD;IAEA,MAAM,CAAElF,eAAe,CAAE,GAAGiF,gBAAgB,CAC3C1E,QAAQ,EACR,kBACD,CAAC;IAED,OAAO;MAAEP;IAAgB,CAAC;EAC3B,CAAC,EACD,CAAE+E,mBAAmB,EAAExE,QAAQ,CAChC,CAAC;EAED,IAAK,CAAEyE,UAAU,EAAG;IACnB,oBACC,IAAA7H,WAAA,CAAAgF,GAAA,EAAC+B,cAAc;MAAA,GACTC,KAAK;MACVS,0BAA0B,EACzBG,mBAAmB,GAAGX,aAAa,GAAGe;IACtC,CACD,CAAC;EAEJ;EAEA,oBACC,IAAAhI,WAAA,CAAAgF,GAAA,EAAC6B,qBAAqB;IACrBC,KAAK,EAAGC,cAAgB;IACxBC,KAAK,EAAGA,KAAO;IACfC,aAAa,EAAGA,aAAe;IAAA,GAC1BY;EAAU,CACf,CAAC;AAEJ,CAAC,EACD,kBACD,CAAC;AAED,IAAAI,gBAAS,EACR,0BAA0B,EAC1B,0BAA0B,EAC1BvB,YACD,CAAC;AACD,IAAAuB,gBAAS,EACR,uBAAuB,EACvB,uCAAuC,EACvCP,gBACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_compose","_hooks","_blocks","_data","_components","_i18n","_store","_components2","_useSettings","_layouts","_blockEditingMode","_definitions","_utils","_lockUnlock","_jsxRuntime","layoutBlockSupportKey","kebabCase","unlock","componentsPrivateApis","hasLayoutBlockSupport","blockName","hasBlockSupport","useLayoutClasses","blockAttributes","layout","default","defaultBlockLayout","getBlockSupport","usedLayout","inherit","contentSize","wideSize","type","layoutClassnames","LAYOUT_DEFINITIONS","className","baseClassName","splitBlockName","split","fullBlockName","pop","join","compoundClassName","push","hasGlobalPadding","useSelect","select","blockEditorStore","getSettings","__experimentalFeatures","useRootPaddingAwareAlignments","orientation","justifyContent","flexWrap","useLayoutStyles","selector","style","fullLayoutType","getLayoutType","blockGapSupport","useSettings","hasBlockGapSupport","getLayoutStyle","LayoutPanelPure","setAttributes","name","clientId","settings","useBlockSettings","layoutSettings","themeSupportsLayout","supportsLayout","blockEditingMode","useBlockEditingMode","layoutBlockSupport","blockSupportAndThemeSettings","allowSwitching","allowEditing","allowInheriting","blockSupportAndLayout","defaultType","blockLayoutType","showInheritToggle","layoutType","constrainedType","displayControlsForLegacyLayouts","hasContentSizeOrLegacySettings","onChangeType","newType","onChangeLayout","newLayout","jsxs","Fragment","children","jsx","InspectorControls","PanelBody","title","__","ToggleControl","__nextHasNoMarginBottom","label","checked","onChange","help","LayoutTypeSwitcher","inspectorControls","toolBarControls","_default","exports","shareWithChildBlocks","edit","attributeKeys","hasSupport","ButtonGroup","getLayoutTypes","map","Button","__next40pxDefaultSize","isPressed","onClick","addAttribute","_settings$attributes$","attributes","BlockWithLayoutStyles","block","BlockListBlock","props","layoutClasses","id","useInstanceId","selectorPrefix","css","layoutClassNames","clsx","useStyleOverride","__unstableLayoutClassNames","withLayoutStyles","createHigherOrderComponent","blockSupportsLayout","extraProps","getBlockSettings","disableLayoutStyles","undefined","addFilter"],"sources":["@wordpress/block-editor/src/hooks/layout.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport { useSettings } from '../components/use-settings';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { LAYOUT_DEFINITIONS } from '../layouts/definitions';\nimport { useBlockSettings, useStyleOverride } from './utils';\nimport { unlock } from '../lock-unlock';\n\nconst layoutBlockSupportKey = 'layout';\nconst { kebabCase } = unlock( componentsPrivateApis );\n\nfunction hasLayoutBlockSupport( blockName ) {\n\treturn (\n\t\thasBlockSupport( blockName, 'layout' ) ||\n\t\thasBlockSupport( blockName, '__experimentalLayout' )\n\t);\n}\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( blockAttributes = {}, blockName = '' ) {\n\tconst { layout } = blockAttributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( blockName, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst layoutClassnames = [];\n\n\tif ( LAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className ) {\n\t\tconst baseClassName =\n\t\t\tLAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className;\n\t\tconst splitBlockName = blockName.split( '/' );\n\t\tconst fullBlockName =\n\t\t\tsplitBlockName[ 0 ] === 'core'\n\t\t\t\t? splitBlockName.pop()\n\t\t\t\t: splitBlockName.join( '-' );\n\t\tconst compoundClassName = `wp-block-${ fullBlockName }-${ baseClassName }`;\n\t\tlayoutClassnames.push( baseClassName, compoundClassName );\n\t}\n\n\tconst hasGlobalPadding = useSelect(\n\t\t( select ) => {\n\t\t\treturn (\n\t\t\t\t( usedLayout?.inherit ||\n\t\t\t\t\tusedLayout?.contentSize ||\n\t\t\t\t\tusedLayout?.type === 'constrained' ) &&\n\t\t\t\tselect( blockEditorStore ).getSettings().__experimentalFeatures\n\t\t\t\t\t?.useRootPaddingAwareAlignments\n\t\t\t);\n\t\t},\n\t\t[ usedLayout?.contentSize, usedLayout?.inherit, usedLayout?.type ]\n\t);\n\n\tif ( hasGlobalPadding ) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( usedLayout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );\n\t}\n\n\tif ( usedLayout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tusedLayout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\n/**\n * Generates a CSS rule with the given block's layout styles.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( blockAttributes = {}, blockName, selector ) {\n\tconst { layout = {}, style = {} } = blockAttributes;\n\t// Update type for blocks using legacy layouts.\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || {};\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\treturn fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName,\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n}\n\nfunction LayoutPanelPure( {\n\tlayout,\n\tsetAttributes,\n\tname: blockName,\n\tclientId,\n} ) {\n\tconst settings = useBlockSettings( blockName );\n\t// Block settings come from theme.json under settings.[blockName].\n\tconst { layout: layoutSettings } = settings;\n\tconst { themeSupportsLayout } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tthemeSupportsLayout: getSettings().supportsLayout,\n\t\t};\n\t}, [] );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\t// Layout block support comes from the block's block.json.\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst blockSupportAndThemeSettings = {\n\t\t...layoutSettings,\n\t\t...layoutBlockSupport,\n\t};\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = blockSupportAndThemeSettings;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t/*\n\t * Try to find the layout type from either the\n\t * block's layout settings or any saved layout config.\n\t */\n\tconst blockSupportAndLayout = {\n\t\t...layoutBlockSupport,\n\t\t...layout,\n\t};\n\tconst { type, default: { type: defaultType = 'default' } = {} } =\n\t\tblockSupportAndLayout;\n\tconst blockLayoutType = type || defaultType;\n\n\t// Only show the inherit toggle if it's supported,\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t( ! blockLayoutType ||\n\t\t\tblockLayoutType === 'default' ||\n\t\t\tblockLayoutType === 'constrained' ||\n\t\t\tblockSupportAndLayout.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst { inherit = false, contentSize = null } = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( blockLayoutType === 'default' ||\n\t\t\tblockLayoutType === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( blockLayoutType );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tclassName=\"block-editor-hooks__toggle-control\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutType?.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t'constrained' ||\n\t\t\t\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container. Toggle to constrain.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ blockLayoutType }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\tname={ blockName }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: LayoutPanelPure,\n\tattributeKeys: [ 'layout' ],\n\thasSupport( name ) {\n\t\treturn hasLayoutBlockSupport( name );\n\t},\n};\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasLayoutBlockSupport( settings ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockWithLayoutStyles( {\n\tblock: BlockListBlock,\n\tprops,\n\tblockGapSupport,\n\tlayoutClasses,\n} ) {\n\tconst { name, attributes } = props;\n\tconst id = useInstanceId( BlockListBlock );\n\tconst { layout } = attributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst selectorPrefix = `wp-container-${ kebabCase( name ) }-is-layout-`;\n\t// Higher specificity to override defaults from theme.json.\n\tconst selector = `.${ selectorPrefix }${ id }`;\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t// Get CSS string for the current layout type.\n\t// The CSS and `style` element is only output if it is not empty.\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout: usedLayout,\n\t\tstyle: attributes?.style,\n\t\thasBlockGapSupport,\n\t} );\n\n\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\tconst layoutClassNames = clsx(\n\t\t{\n\t\t\t[ `${ selectorPrefix }${ id }` ]: !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t},\n\t\tlayoutClasses\n\t);\n\n\tuseStyleOverride( { css } );\n\n\treturn (\n\t\t<BlockListBlock\n\t\t\t{ ...props }\n\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t/>\n\t);\n}\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { clientId, name, attributes } = props;\n\t\tconst blockSupportsLayout = hasLayoutBlockSupport( name );\n\t\tconst layoutClasses = useLayoutClasses( attributes, name );\n\t\tconst extraProps = useSelect(\n\t\t\t( select ) => {\n\t\t\t\t// The callback returns early to avoid block editor subscription.\n\t\t\t\tif ( ! blockSupportsLayout ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst { getSettings, getBlockSettings } = unlock(\n\t\t\t\t\tselect( blockEditorStore )\n\t\t\t\t);\n\t\t\t\tconst { disableLayoutStyles } = getSettings();\n\n\t\t\t\tif ( disableLayoutStyles ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst [ blockGapSupport ] = getBlockSettings(\n\t\t\t\t\tclientId,\n\t\t\t\t\t'spacing.blockGap'\n\t\t\t\t);\n\n\t\t\t\treturn { blockGapSupport };\n\t\t\t},\n\t\t\t[ blockSupportsLayout, clientId ]\n\t\t);\n\n\t\tif ( ! extraProps ) {\n\t\t\treturn (\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\t__unstableLayoutClassNames={\n\t\t\t\t\t\tblockSupportsLayout ? layoutClasses : undefined\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<BlockWithLayoutStyles\n\t\t\t\tblock={ BlockListBlock }\n\t\t\t\tprops={ props }\n\t\t\t\tlayoutClasses={ layoutClasses }\n\t\t\t\t{ ...extraProps }\n\t\t\t/>\n\t\t);\n\t},\n\t'withLayoutStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\n"],"mappings":";;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAOA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,iBAAA,GAAAX,OAAA;AACA,IAAAY,YAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,WAAA,GAAAd,OAAA;AAAwC,IAAAe,WAAA,GAAAf,OAAA;AA/BxC;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;;A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AAC","ignoreList":[]}
@@ -38,14 +38,14 @@ function SpacingVisualizer({
38
38
  // See https://github.com/WordPress/gutenberg/pull/59227.
39
39
  window.requestAnimationFrame(() => window.requestAnimationFrame(updateStyle));
40
40
  }, [blockElement, value]);
41
- const previousValue = (0, _element.useRef)(value);
41
+ const previousValueRef = (0, _element.useRef)(value);
42
42
  const [isActive, setIsActive] = (0, _element.useState)(false);
43
43
  (0, _element.useEffect)(() => {
44
- if ((0, _isShallowEqual.default)(value, previousValue.current) || forceShow) {
44
+ if ((0, _isShallowEqual.default)(value, previousValueRef.current) || forceShow) {
45
45
  return;
46
46
  }
47
47
  setIsActive(true);
48
- previousValue.current = value;
48
+ previousValueRef.current = value;
49
49
  const timeout = setTimeout(() => {
50
50
  setIsActive(false);
51
51
  }, 400);
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_isShallowEqual","_interopRequireDefault","_cover","_useBlockRefs","_jsxRuntime","SpacingVisualizer","clientId","value","computeStyle","forceShow","blockElement","useBlockElement","style","updateStyle","useReducer","useLayoutEffect","window","requestAnimationFrame","previousValue","useRef","isActive","setIsActive","useState","useEffect","isShallowEqual","current","timeout","setTimeout","clearTimeout","jsx","default","__unstablePopoverSlot","children","className","getComputedCSS","element","property","ownerDocument","defaultView","getComputedStyle","getPropertyValue","MarginVisualizer","spacing","margin","top","right","bottom","left","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","PaddingVisualizer","padding"],"sources":["@wordpress/block-editor/src/hooks/spacing-visualizer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseRef,\n\tuseLayoutEffect,\n\tuseEffect,\n\tuseReducer,\n} from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockPopoverCover from '../components/block-popover/cover';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction SpacingVisualizer( { clientId, value, computeStyle, forceShow } ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst [ style, updateStyle ] = useReducer( () =>\n\t\tcomputeStyle( blockElement )\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! blockElement ) {\n\t\t\treturn;\n\t\t}\n\t\t// It's not sufficient to read the computed spacing value when value.spacing changes as\n\t\t// useEffect may run before the browser recomputes CSS. We therefore combine\n\t\t// useLayoutEffect and two rAF calls to ensure that we read the spacing after the current\n\t\t// paint but before the next paint.\n\t\t// See https://github.com/WordPress/gutenberg/pull/59227.\n\t\twindow.requestAnimationFrame( () =>\n\t\t\twindow.requestAnimationFrame( updateStyle )\n\t\t);\n\t}, [ blockElement, value ] );\n\n\tconst previousValue = useRef( value );\n\tconst [ isActive, setIsActive ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( isShallowEqual( value, previousValue.current ) || forceShow ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsActive( true );\n\t\tpreviousValue.current = value;\n\n\t\tconst timeout = setTimeout( () => {\n\t\t\tsetIsActive( false );\n\t\t}, 400 );\n\n\t\treturn () => {\n\t\t\tsetIsActive( false );\n\t\t\tclearTimeout( timeout );\n\t\t};\n\t}, [ value, forceShow ] );\n\n\tif ( ! isActive && ! forceShow ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopoverCover\n\t\t\tclientId={ clientId }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t>\n\t\t\t<div className=\"block-editor__spacing-visualizer\" style={ style } />\n\t\t</BlockPopoverCover>\n\t);\n}\n\nfunction getComputedCSS( element, property ) {\n\treturn element.ownerDocument.defaultView\n\t\t.getComputedStyle( element )\n\t\t.getPropertyValue( property );\n}\n\nexport function MarginVisualizer( { clientId, value, forceShow } ) {\n\treturn (\n\t\t<SpacingVisualizer\n\t\t\tclientId={ clientId }\n\t\t\tvalue={ value?.spacing?.margin }\n\t\t\tcomputeStyle={ ( blockElement ) => {\n\t\t\t\tconst top = getComputedCSS( blockElement, 'margin-top' );\n\t\t\t\tconst right = getComputedCSS( blockElement, 'margin-right' );\n\t\t\t\tconst bottom = getComputedCSS( blockElement, 'margin-bottom' );\n\t\t\t\tconst left = getComputedCSS( blockElement, 'margin-left' );\n\t\t\t\treturn {\n\t\t\t\t\tborderTopWidth: top,\n\t\t\t\t\tborderRightWidth: right,\n\t\t\t\t\tborderBottomWidth: bottom,\n\t\t\t\t\tborderLeftWidth: left,\n\t\t\t\t\ttop: top ? `-${ top }` : 0,\n\t\t\t\t\tright: right ? `-${ right }` : 0,\n\t\t\t\t\tbottom: bottom ? `-${ bottom }` : 0,\n\t\t\t\t\tleft: left ? `-${ left }` : 0,\n\t\t\t\t};\n\t\t\t} }\n\t\t\tforceShow={ forceShow }\n\t\t/>\n\t);\n}\n\nexport function PaddingVisualizer( { clientId, value, forceShow } ) {\n\treturn (\n\t\t<SpacingVisualizer\n\t\t\tclientId={ clientId }\n\t\t\tvalue={ value?.spacing?.padding }\n\t\t\tcomputeStyle={ ( blockElement ) => ( {\n\t\t\t\tborderTopWidth: getComputedCSS( blockElement, 'padding-top' ),\n\t\t\t\tborderRightWidth: getComputedCSS(\n\t\t\t\t\tblockElement,\n\t\t\t\t\t'padding-right'\n\t\t\t\t),\n\t\t\t\tborderBottomWidth: getComputedCSS(\n\t\t\t\t\tblockElement,\n\t\t\t\t\t'padding-bottom'\n\t\t\t\t),\n\t\t\t\tborderLeftWidth: getComputedCSS( blockElement, 'padding-left' ),\n\t\t\t} ) }\n\t\t\tforceShow={ forceShow }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAOA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAA0F,IAAAK,WAAA,GAAAL,OAAA;AAhB1F;AACA;AACA;;AAUA;AACA;AACA;;AAIA,SAASM,iBAAiBA,CAAE;EAAEC,Q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AAI,GAAI,IAAIA,IAAM,EAAC,GAAG;MAC7B,CAAC;IACF,CAAG;IACHtC,SAAS,EAAGA;EAAW,CACvB,CAAC;AAEJ;AAEO,SAAS2C,iBAAiBA,CAAE;EAAE9C,QAAQ;EAAEC,KAAK;EAAEE;AAAU,CAAC,EAAG;EACnE,oBACC,IAAAL,WAAA,CAAAyB,GAAA,EAACxB,iBAAiB;IACjBC,QAAQ,EAAGA,QAAU;IACrBC,KAAK,EAAGA,KAAK,EAAEmC,OAAO,EAAEW,OAAS;IACjC7C,YAAY,EAAKE,YAAY,KAAQ;MACpCsC,cAAc,EAAEd,cAAc,CAAExB,YAAY,EAAE,aAAc,CAAC;MAC7DuC,gBAAgB,EAAEf,cAAc,CAC/BxB,YAAY,EACZ,eACD,CAAC;MACDwC,iBAAiB,EAAEhB,cAAc,CAChCxB,YAAY,EACZ,gBACD,CAAC;MACDyC,eAAe,EAAEjB,cAAc,CAAExB,YAAY,EAAE,cAAe;IAC/D,CAAC,CAAI;IACLD,SAAS,EAAGA;EAAW,CACvB,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_isShallowEqual","_interopRequireDefault","_cover","_useBlockRefs","_jsxRuntime","SpacingVisualizer","clientId","value","computeStyle","forceShow","blockElement","useBlockElement","style","updateStyle","useReducer","useLayoutEffect","window","requestAnimationFrame","previousValueRef","useRef","isActive","setIsActive","useState","useEffect","isShallowEqual","current","timeout","setTimeout","clearTimeout","jsx","default","__unstablePopoverSlot","children","className","getComputedCSS","element","property","ownerDocument","defaultView","getComputedStyle","getPropertyValue","MarginVisualizer","spacing","margin","top","right","bottom","left","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","PaddingVisualizer","padding"],"sources":["@wordpress/block-editor/src/hooks/spacing-visualizer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseRef,\n\tuseLayoutEffect,\n\tuseEffect,\n\tuseReducer,\n} from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockPopoverCover from '../components/block-popover/cover';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction SpacingVisualizer( { clientId, value, computeStyle, forceShow } ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst [ style, updateStyle ] = useReducer( () =>\n\t\tcomputeStyle( blockElement )\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! blockElement ) {\n\t\t\treturn;\n\t\t}\n\t\t// It's not sufficient to read the computed spacing value when value.spacing changes as\n\t\t// useEffect may run before the browser recomputes CSS. We therefore combine\n\t\t// useLayoutEffect and two rAF calls to ensure that we read the spacing after the current\n\t\t// paint but before the next paint.\n\t\t// See https://github.com/WordPress/gutenberg/pull/59227.\n\t\twindow.requestAnimationFrame( () =>\n\t\t\twindow.requestAnimationFrame( updateStyle )\n\t\t);\n\t}, [ blockElement, value ] );\n\n\tconst previousValueRef = useRef( value );\n\tconst [ isActive, setIsActive ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( isShallowEqual( value, previousValueRef.current ) || forceShow ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsActive( true );\n\t\tpreviousValueRef.current = value;\n\n\t\tconst timeout = setTimeout( () => {\n\t\t\tsetIsActive( false );\n\t\t}, 400 );\n\n\t\treturn () => {\n\t\t\tsetIsActive( false );\n\t\t\tclearTimeout( timeout );\n\t\t};\n\t}, [ value, forceShow ] );\n\n\tif ( ! isActive && ! forceShow ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopoverCover\n\t\t\tclientId={ clientId }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t>\n\t\t\t<div className=\"block-editor__spacing-visualizer\" style={ style } />\n\t\t</BlockPopoverCover>\n\t);\n}\n\nfunction getComputedCSS( element, property ) {\n\treturn element.ownerDocument.defaultView\n\t\t.getComputedStyle( element )\n\t\t.getPropertyValue( property );\n}\n\nexport function MarginVisualizer( { clientId, value, forceShow } ) {\n\treturn (\n\t\t<SpacingVisualizer\n\t\t\tclientId={ clientId }\n\t\t\tvalue={ value?.spacing?.margin }\n\t\t\tcomputeStyle={ ( blockElement ) => {\n\t\t\t\tconst top = getComputedCSS( blockElement, 'margin-top' );\n\t\t\t\tconst right = getComputedCSS( blockElement, 'margin-right' );\n\t\t\t\tconst bottom = getComputedCSS( blockElement, 'margin-bottom' );\n\t\t\t\tconst left = getComputedCSS( blockElement, 'margin-left' );\n\t\t\t\treturn {\n\t\t\t\t\tborderTopWidth: top,\n\t\t\t\t\tborderRightWidth: right,\n\t\t\t\t\tborderBottomWidth: bottom,\n\t\t\t\t\tborderLeftWidth: left,\n\t\t\t\t\ttop: top ? `-${ top }` : 0,\n\t\t\t\t\tright: right ? `-${ right }` : 0,\n\t\t\t\t\tbottom: bottom ? `-${ bottom }` : 0,\n\t\t\t\t\tleft: left ? `-${ left }` : 0,\n\t\t\t\t};\n\t\t\t} }\n\t\t\tforceShow={ forceShow }\n\t\t/>\n\t);\n}\n\nexport function PaddingVisualizer( { clientId, value, forceShow } ) {\n\treturn (\n\t\t<SpacingVisualizer\n\t\t\tclientId={ clientId }\n\t\t\tvalue={ value?.spacing?.padding }\n\t\t\tcomputeStyle={ ( blockElement ) => ( {\n\t\t\t\tborderTopWidth: getComputedCSS( blockElement, 'padding-top' ),\n\t\t\t\tborderRightWidth: getComputedCSS(\n\t\t\t\t\tblockElement,\n\t\t\t\t\t'padding-right'\n\t\t\t\t),\n\t\t\t\tborderBottomWidth: getComputedCSS(\n\t\t\t\t\tblockElement,\n\t\t\t\t\t'padding-bottom'\n\t\t\t\t),\n\t\t\t\tborderLeftWidth: getComputedCSS( blockElement, 'padding-left' ),\n\t\t\t} ) }\n\t\t\tforceShow={ forceShow }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAOA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA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AAI,IAAIA,GAAK,EAAC,GAAG,CAAC;QAC1BC,KAAK,EAAEA,KAAK,GAAI,IAAIA,KAAO,EAAC,GAAG,CAAC;QAChCC,MAAM,EAAEA,MAAM,GAAI,IAAIA,MAAQ,EAAC,GAAG,CAAC;QACnCC,IAAI,EAAEA,IAAI,GAAI,IAAIA,IAAM,EAAC,GAAG;MAC7B,CAAC;IACF,CAAG;IACHtC,SAAS,EAAGA;EAAW,CACvB,CAAC;AAEJ;AAEO,SAAS2C,iBAAiBA,CAAE;EAAE9C,QAAQ;EAAEC,KAAK;EAAEE;AAAU,CAAC,EAAG;EACnE,oBACC,IAAAL,WAAA,CAAAyB,GAAA,EAACxB,iBAAiB;IACjBC,QAAQ,EAAGA,QAAU;IACrBC,KAAK,EAAGA,KAAK,EAAEmC,OAAO,EAAEW,OAAS;IACjC7C,YAAY,EAAKE,YAAY,KAAQ;MACpCsC,cAAc,EAAEd,cAAc,CAAExB,YAAY,EAAE,aAAc,CAAC;MAC7DuC,gBAAgB,EAAEf,cAAc,CAC/BxB,YAAY,EACZ,eACD,CAAC;MACDwC,iBAAiB,EAAEhB,cAAc,CAChCxB,YAAY,EACZ,gBACD,CAAC;MACDyC,eAAe,EAAEjB,cAAc,CAAExB,YAAY,EAAE,cAAe;IAC/D,CAAC,CAAI;IACLD,SAAS,EAAGA;EAAW,CACvB,CAAC;AAEJ","ignoreList":[]}
@@ -338,11 +338,7 @@ function useBlockProps({
338
338
  style
339
339
  }) {
340
340
  const blockElementsContainerIdentifier = `wp-elements-${(0, _compose.useInstanceId)(useBlockProps)}`;
341
-
342
- // The .editor-styles-wrapper selector is required on elements styles. As it is
343
- // added to all other editor styles, not providing it causes reset and global
344
- // styles to override element styles because of higher specificity.
345
- const baseElementSelector = `.editor-styles-wrapper .${blockElementsContainerIdentifier}`;
341
+ const baseElementSelector = `.${blockElementsContainerIdentifier}`;
346
342
  const blockElementStyles = style?.elements;
347
343
  const styles = (0, _element.useMemo)(() => {
348
344
  if (!blockElementStyles) {
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_hooks","_blocks","_compose","_styleEngine","_background","_border","_color","_typography","_dimensions","_utils","_utils2","_blockEditingMode","_jsxRuntime","styleSupportKeys","TYPOGRAPHY_SUPPORT_KEYS","BORDER_SUPPORT_KEY","COLOR_SUPPORT_KEY","DIMENSIONS_SUPPORT_KEY","BACKGROUND_SUPPORT_KEY","SPACING_SUPPORT_KEY","SHADOW_SUPPORT_KEY","hasStyleSupport","nameOrType","some","key","hasBlockSupport","getInlineStyles","styles","output","getCSSRules","forEach","rule","value","addAttribute","settings","attributes","style","Object","assign","type","skipSerializationPathsEdit","TYPOGRAPHY_SUPPORT_KEY","skipSerializationPathsSave","skipSerializationPathsSaveChecks","renamedFeatures","gradients","omitStyle","paths","preserveReference","newStyle","JSON","parse","stringify","Array","isArray","path","split","length","firstSubpath","restPath","addSaveProps","props","blockNameOrType","skipPaths","entries","indicator","skipSerialization","getBlockSupport","featureName","feature","BlockStyleControls","clientId","name","setAttributes","__unstableParentLayout","useBlockSettings","blockEditingMode","useBlockEditingMode","passedProps","typography","textAlign","jsxs","Fragment","children","jsx","ColorEdit","BackgroundImagePanel","TypographyPanel","BorderPanel","DimensionsPanel","_default","exports","default","edit","hasSupport","attributeKeys","useBlockProps","elementTypes","elementType","pseudo","elements","blockElementsContainerIdentifier","useInstanceId","baseElementSelector","blockElementStyles","useMemo","elementCSSRules","shouldSkipSerialization","elementStyles","selector","scopeSelector","ELEMENTS","push","compileCSS","pseudoSelector","element","join","undefined","useStyleOverride","css","className","addFilter"],"sources":["@wordpress/block-editor/src/hooks/style.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n} from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { getCSSRules, compileCSS } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport { BACKGROUND_SUPPORT_KEY, BackgroundImagePanel } from './background';\nimport { BORDER_SUPPORT_KEY, BorderPanel, SHADOW_SUPPORT_KEY } from './border';\nimport { COLOR_SUPPORT_KEY, ColorEdit } from './color';\nimport {\n\tTypographyPanel,\n\tTYPOGRAPHY_SUPPORT_KEY,\n\tTYPOGRAPHY_SUPPORT_KEYS,\n} from './typography';\nimport {\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n\tDimensionsPanel,\n} from './dimensions';\nimport {\n\tshouldSkipSerialization,\n\tuseStyleOverride,\n\tuseBlockSettings,\n} from './utils';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\nconst styleSupportKeys = [\n\t...TYPOGRAPHY_SUPPORT_KEYS,\n\tBORDER_SUPPORT_KEY,\n\tCOLOR_SUPPORT_KEY,\n\tDIMENSIONS_SUPPORT_KEY,\n\tBACKGROUND_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n\tSHADOW_SUPPORT_KEY,\n];\n\nconst hasStyleSupport = ( nameOrType ) =>\n\tstyleSupportKeys.some( ( key ) => hasBlockSupport( nameOrType, key ) );\n\n/**\n * Returns the inline styles to add depending on the style object\n *\n * @param {Object} styles Styles configuration.\n *\n * @return {Object} Flattened CSS variables declaration.\n */\nexport function getInlineStyles( styles = {} ) {\n\tconst output = {};\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tgetCSSRules( styles ).forEach( ( rule ) => {\n\t\toutput[ rule.key ] = rule.value;\n\t} );\n\n\treturn output;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `style` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttribute( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsEdit = {\n\t[ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ],\n\t[ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tCOLOR_SUPPORT_KEY,\n\t],\n\t[ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t],\n\t[ `${ DIMENSIONS_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t],\n\t[ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tSPACING_SUPPORT_KEY,\n\t],\n\t[ `${ SHADOW_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tSHADOW_SUPPORT_KEY,\n\t],\n};\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * Extends the Edit skip paths to enable skipping additional paths in just\n * the Save component. This allows a block support to be serialized within the\n * editor, while using an alternate approach, such as server-side rendering, when\n * the support is saved.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsSave = {\n\t...skipSerializationPathsEdit,\n\t[ `${ DIMENSIONS_SUPPORT_KEY }.aspectRatio` ]: [\n\t\t`${ DIMENSIONS_SUPPORT_KEY }.aspectRatio`,\n\t], // Skip serialization of aspect ratio in save mode.\n\t[ `${ BACKGROUND_SUPPORT_KEY }` ]: [ BACKGROUND_SUPPORT_KEY ], // Skip serialization of background support in save mode.\n};\n\nconst skipSerializationPathsSaveChecks = {\n\t[ `${ DIMENSIONS_SUPPORT_KEY }.aspectRatio` ]: true,\n\t[ `${ BACKGROUND_SUPPORT_KEY }` ]: true,\n};\n\n/**\n * A dictionary used to normalize feature names between support flags, style\n * object properties and __experimentSkipSerialization configuration arrays.\n *\n * This allows not having to provide a migration for a support flag and possible\n * backwards compatibility bridges, while still achieving consistency between\n * the support flag and the skip serialization array.\n *\n * @constant\n * @type {Record<string, string>}\n */\nconst renamedFeatures = { gradients: 'gradient' };\n\n/**\n * A utility function used to remove one or more paths from a style object.\n * Works in a way similar to Lodash's `omit()`. See unit tests and examples below.\n *\n * It supports a single string path:\n *\n * ```\n * omitStyle( { color: 'red' }, 'color' ); // {}\n * ```\n *\n * or an array of paths:\n *\n * ```\n * omitStyle( { color: 'red', background: '#fff' }, [ 'color', 'background' ] ); // {}\n * ```\n *\n * It also allows you to specify paths at multiple levels in a string.\n *\n * ```\n * omitStyle( { typography: { textDecoration: 'underline' } }, 'typography.textDecoration' ); // {}\n * ```\n *\n * You can remove multiple paths at the same time:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t'typography.textDecoration',\n * \t\t\t'typography.textTransform',\n *\t\t]\n * );\n * // {}\n * ```\n *\n * You can also specify nested paths as arrays:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'typography', 'textDecoration' ],\n * \t\t\t[ 'typography', 'textTransform' ],\n *\t\t]\n * );\n * // {}\n * ```\n *\n * With regards to nesting of styles, infinite depth is supported:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\tborder: {\n * \t\t\t\tradius: {\n * \t\t\t\t\ttopLeft: '10px',\n * \t\t\t\t\ttopRight: '0.5rem',\n * \t\t\t\t}\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'border', 'radius', 'topRight' ],\n *\t\t]\n * );\n * // { border: { radius: { topLeft: '10px' } } }\n * ```\n *\n * The third argument, `preserveReference`, defines how to treat the input style object.\n * It is mostly necessary to properly handle mutation when recursively handling the style object.\n * Defaulting to `false`, this will always create a new object, avoiding to mutate `style`.\n * However, when recursing, we change that value to `true` in order to work with a single copy\n * of the original style object.\n *\n * @see https://lodash.com/docs/4.17.15#omit\n *\n * @param {Object} style Styles object.\n * @param {Array|string} paths Paths to remove.\n * @param {boolean} preserveReference True to mutate the `style` object, false otherwise.\n * @return {Object} Styles object with the specified paths removed.\n */\nexport function omitStyle( style, paths, preserveReference = false ) {\n\tif ( ! style ) {\n\t\treturn style;\n\t}\n\n\tlet newStyle = style;\n\tif ( ! preserveReference ) {\n\t\tnewStyle = JSON.parse( JSON.stringify( style ) );\n\t}\n\n\tif ( ! Array.isArray( paths ) ) {\n\t\tpaths = [ paths ];\n\t}\n\n\tpaths.forEach( ( path ) => {\n\t\tif ( ! Array.isArray( path ) ) {\n\t\t\tpath = path.split( '.' );\n\t\t}\n\n\t\tif ( path.length > 1 ) {\n\t\t\tconst [ firstSubpath, ...restPath ] = path;\n\t\t\tomitStyle( newStyle[ firstSubpath ], [ restPath ], true );\n\t\t} else if ( path.length === 1 ) {\n\t\t\tdelete newStyle[ path[ 0 ] ];\n\t\t}\n\t} );\n\n\treturn newStyle;\n}\n\n/**\n * Override props assigned to save component to inject the CSS variables definition.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object|string} blockNameOrType Block type.\n * @param {Object} attributes Block attributes.\n * @param {?Record<string, string[]>} skipPaths An object of keys and paths to skip serialization.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps(\n\tprops,\n\tblockNameOrType,\n\tattributes,\n\tskipPaths = skipSerializationPathsSave\n) {\n\tif ( ! hasStyleSupport( blockNameOrType ) ) {\n\t\treturn props;\n\t}\n\n\tlet { style } = attributes;\n\tObject.entries( skipPaths ).forEach( ( [ indicator, path ] ) => {\n\t\tconst skipSerialization =\n\t\t\tskipSerializationPathsSaveChecks[ indicator ] ||\n\t\t\tgetBlockSupport( blockNameOrType, indicator );\n\n\t\tif ( skipSerialization === true ) {\n\t\t\tstyle = omitStyle( style, path );\n\t\t}\n\n\t\tif ( Array.isArray( skipSerialization ) ) {\n\t\t\tskipSerialization.forEach( ( featureName ) => {\n\t\t\t\tconst feature = renamedFeatures[ featureName ] || featureName;\n\t\t\t\tstyle = omitStyle( style, [ [ ...path, feature ] ] );\n\t\t\t} );\n\t\t}\n\t} );\n\n\tprops.style = {\n\t\t...getInlineStyles( style ),\n\t\t...props.style,\n\t};\n\n\treturn props;\n}\n\nfunction BlockStyleControls( {\n\tclientId,\n\tname,\n\tsetAttributes,\n\t__unstableParentLayout,\n} ) {\n\tconst settings = useBlockSettings( name, __unstableParentLayout );\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst passedProps = {\n\t\tclientId,\n\t\tname,\n\t\tsetAttributes,\n\t\tsettings: {\n\t\t\t...settings,\n\t\t\ttypography: {\n\t\t\t\t...settings.typography,\n\t\t\t\t// The text alignment UI for individual blocks is rendered in\n\t\t\t\t// the block toolbar, so disable it here.\n\t\t\t\ttextAlign: false,\n\t\t\t},\n\t\t},\n\t};\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t<ColorEdit { ...passedProps } />\n\t\t\t<BackgroundImagePanel { ...passedProps } />\n\t\t\t<TypographyPanel { ...passedProps } />\n\t\t\t<BorderPanel { ...passedProps } />\n\t\t\t<DimensionsPanel { ...passedProps } />\n\t\t</>\n\t);\n}\n\nexport default {\n\tedit: BlockStyleControls,\n\thasSupport: hasStyleSupport,\n\taddSaveProps,\n\tattributeKeys: [ 'style' ],\n\tuseBlockProps,\n};\n\n// Defines which element types are supported, including their hover styles or\n// any other elements that have been included under a single element type\n// e.g. heading and h1-h6.\nconst elementTypes = [\n\t{ elementType: 'button' },\n\t{ elementType: 'link', pseudo: [ ':hover' ] },\n\t{\n\t\telementType: 'heading',\n\t\telements: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ],\n\t},\n];\n\nfunction useBlockProps( { name, style } ) {\n\tconst blockElementsContainerIdentifier = `wp-elements-${ useInstanceId(\n\t\tuseBlockProps\n\t) }`;\n\n\t// The .editor-styles-wrapper selector is required on elements styles. As it is\n\t// added to all other editor styles, not providing it causes reset and global\n\t// styles to override element styles because of higher specificity.\n\tconst baseElementSelector = `.editor-styles-wrapper .${ blockElementsContainerIdentifier }`;\n\tconst blockElementStyles = style?.elements;\n\n\tconst styles = useMemo( () => {\n\t\tif ( ! blockElementStyles ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst elementCSSRules = [];\n\n\t\telementTypes.forEach( ( { elementType, pseudo, elements } ) => {\n\t\t\tconst skipSerialization = shouldSkipSerialization(\n\t\t\t\tname,\n\t\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t\telementType\n\t\t\t);\n\n\t\t\tif ( skipSerialization ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst elementStyles = blockElementStyles?.[ elementType ];\n\n\t\t\t// Process primary element type styles.\n\t\t\tif ( elementStyles ) {\n\t\t\t\tconst selector = scopeSelector(\n\t\t\t\t\tbaseElementSelector,\n\t\t\t\t\tELEMENTS[ elementType ]\n\t\t\t\t);\n\n\t\t\t\telementCSSRules.push(\n\t\t\t\t\tcompileCSS( elementStyles, { selector } )\n\t\t\t\t);\n\n\t\t\t\t// Process any interactive states for the element type.\n\t\t\t\tif ( pseudo ) {\n\t\t\t\t\tpseudo.forEach( ( pseudoSelector ) => {\n\t\t\t\t\t\tif ( elementStyles[ pseudoSelector ] ) {\n\t\t\t\t\t\t\telementCSSRules.push(\n\t\t\t\t\t\t\t\tcompileCSS( elementStyles[ pseudoSelector ], {\n\t\t\t\t\t\t\t\t\tselector: scopeSelector(\n\t\t\t\t\t\t\t\t\t\tbaseElementSelector,\n\t\t\t\t\t\t\t\t\t\t`${ ELEMENTS[ elementType ] }${ pseudoSelector }`\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Process related elements e.g. h1-h6 for headings\n\t\t\tif ( elements ) {\n\t\t\t\telements.forEach( ( element ) => {\n\t\t\t\t\tif ( blockElementStyles[ element ] ) {\n\t\t\t\t\t\telementCSSRules.push(\n\t\t\t\t\t\t\tcompileCSS( blockElementStyles[ element ], {\n\t\t\t\t\t\t\t\tselector: scopeSelector(\n\t\t\t\t\t\t\t\t\tbaseElementSelector,\n\t\t\t\t\t\t\t\t\tELEMENTS[ element ]\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\treturn elementCSSRules.length > 0\n\t\t\t? elementCSSRules.join( '' )\n\t\t\t: undefined;\n\t}, [ baseElementSelector, blockElementStyles, name ] );\n\n\tuseStyleOverride( { css: styles } );\n\n\treturn addSaveProps(\n\t\t{ className: blockElementsContainerIdentifier },\n\t\tname,\n\t\t{ style },\n\t\tskipSerializationPathsEdit\n\t);\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addAttribute',\n\taddAttribute\n);\n"],"mappings":";;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,I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AACA;AACA,MAAMM,0BAA0B,GAAG;EAClC,CAAG,GAAGzB,0BAAoB,kCAAiC,GAAI,CAAE,QAAQ,CAAE;EAC3E,CAAG,GAAGC,wBAAmB,kCAAiC,GAAI,CAC7DA,wBAAiB,CACjB;EACD,CAAG,GAAGyB,kCAAwB,kCAAiC,GAAI,CAClEA,kCAAsB,CACtB;EACD,CAAG,GAAGxB,kCAAwB,kCAAiC,GAAI,CAClEA,kCAAsB,CACtB;EACD,CAAG,GAAGE,+BAAqB,kCAAiC,GAAI,CAC/DA,+BAAmB,CACnB;EACD,CAAG,GAAGC,0BAAoB,kCAAiC,GAAI,CAC9DA,0BAAkB;AAEpB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMsB,0BAA0B,GAAG;EAClC,GAAGF,0BAA0B;EAC7B,CAAG,GAAGvB,kCAAwB,cAAa,GAAI,CAC7C,GAAGA,kCAAwB,cAAa,CACzC;EAAE;EACH,CAAG,GAAGC,kCAAwB,EAAC,GAAI,CAAEA,kCAAsB,CAAE,CAAE;AAChE,CAAC;AAED,MAAMyB,gCAAgC,GAAG;EACxC,CAAG,GAAG1B,kCAAwB,cAAa,GAAI,IAAI;EACnD,CAAG,GAAGC,kCAAwB,EAAC,GAAI;AACpC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM0B,eAAe,GAAG;EAAEC,SAAS,EAAE;AAAW,CAAC;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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jD;cACD,CAAE,CACH,CAAC;YACF;UACD,CAAE,CAAC;QACJ;MACD;;MAEA;MACA,IAAKd,QAAQ,EAAG;QACfA,QAAQ,CAACtE,OAAO,CAAIqF,OAAO,IAAM;UAChC,IAAKX,kBAAkB,CAAEW,OAAO,CAAE,EAAG;YACpCT,eAAe,CAACM,IAAI,CACnB,IAAAC,uBAAU,EAAET,kBAAkB,CAAEW,OAAO,CAAE,EAAE;cAC1CN,QAAQ,EAAE,IAAAC,qBAAa,EACtBP,mBAAmB,EACnBQ,+BAAQ,CAAEI,OAAO,CAClB;YACD,CAAE,CACH,CAAC;UACF;QACD,CAAE,CAAC;MACJ;IACD,CAAE,CAAC;IAEH,OAAOT,eAAe,CAACjD,MAAM,GAAG,CAAC,GAC9BiD,eAAe,CAACU,IAAI,CAAE,EAAG,CAAC,GAC1BC,SAAS;EACb,CAAC,EAAE,CAAEd,mBAAmB,EAAEC,kBAAkB,EAAEhC,IAAI,CAAG,CAAC;EAEtD,IAAA8C,uBAAgB,EAAE;IAAEC,GAAG,EAAE5F;EAAO,CAAE,CAAC;EAEnC,OAAOiC,YAAY,CAClB;IAAE4D,SAAS,EAAEnB;EAAiC,CAAC,EAC/C7B,IAAI,EACJ;IAAEpC;EAAM,CAAC,EACTI,0BACD,CAAC;AACF;AAEA,IAAAiF,gBAAS,EACR,0BAA0B,EAC1B,yBAAyB,EACzBxF,YACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_hooks","_blocks","_compose","_styleEngine","_background","_border","_color","_typography","_dimensions","_utils","_utils2","_blockEditingMode","_jsxRuntime","styleSupportKeys","TYPOGRAPHY_SUPPORT_KEYS","BORDER_SUPPORT_KEY","COLOR_SUPPORT_KEY","DIMENSIONS_SUPPORT_KEY","BACKGROUND_SUPPORT_KEY","SPACING_SUPPORT_KEY","SHADOW_SUPPORT_KEY","hasStyleSupport","nameOrType","some","key","hasBlockSupport","getInlineStyles","styles","output","getCSSRules","forEach","rule","value","addAttribute","settings","attributes","style","Object","assign","type","skipSerializationPathsEdit","TYPOGRAPHY_SUPPORT_KEY","skipSerializationPathsSave","skipSerializationPathsSaveChecks","renamedFeatures","gradients","omitStyle","paths","preserveReference","newStyle","JSON","parse","stringify","Array","isArray","path","split","length","firstSubpath","restPath","addSaveProps","props","blockNameOrType","skipPaths","entries","indicator","skipSerialization","getBlockSupport","featureName","feature","BlockStyleControls","clientId","name","setAttributes","__unstableParentLayout","useBlockSettings","blockEditingMode","useBlockEditingMode","passedProps","typography","textAlign","jsxs","Fragment","children","jsx","ColorEdit","BackgroundImagePanel","TypographyPanel","BorderPanel","DimensionsPanel","_default","exports","default","edit","hasSupport","attributeKeys","useBlockProps","elementTypes","elementType","pseudo","elements","blockElementsContainerIdentifier","useInstanceId","baseElementSelector","blockElementStyles","useMemo","elementCSSRules","shouldSkipSerialization","elementStyles","selector","scopeSelector","ELEMENTS","push","compileCSS","pseudoSelector","element","join","undefined","useStyleOverride","css","className","addFilter"],"sources":["@wordpress/block-editor/src/hooks/style.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n} from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { getCSSRules, compileCSS } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport { BACKGROUND_SUPPORT_KEY, BackgroundImagePanel } from './background';\nimport { BORDER_SUPPORT_KEY, BorderPanel, SHADOW_SUPPORT_KEY } from './border';\nimport { COLOR_SUPPORT_KEY, ColorEdit } from './color';\nimport {\n\tTypographyPanel,\n\tTYPOGRAPHY_SUPPORT_KEY,\n\tTYPOGRAPHY_SUPPORT_KEYS,\n} from './typography';\nimport {\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n\tDimensionsPanel,\n} from './dimensions';\nimport {\n\tshouldSkipSerialization,\n\tuseStyleOverride,\n\tuseBlockSettings,\n} from './utils';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\nconst styleSupportKeys = [\n\t...TYPOGRAPHY_SUPPORT_KEYS,\n\tBORDER_SUPPORT_KEY,\n\tCOLOR_SUPPORT_KEY,\n\tDIMENSIONS_SUPPORT_KEY,\n\tBACKGROUND_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n\tSHADOW_SUPPORT_KEY,\n];\n\nconst hasStyleSupport = ( nameOrType ) =>\n\tstyleSupportKeys.some( ( key ) => hasBlockSupport( nameOrType, key ) );\n\n/**\n * Returns the inline styles to add depending on the style object\n *\n * @param {Object} styles Styles configuration.\n *\n * @return {Object} Flattened CSS variables declaration.\n */\nexport function getInlineStyles( styles = {} ) {\n\tconst output = {};\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tgetCSSRules( styles ).forEach( ( rule ) => {\n\t\toutput[ rule.key ] = rule.value;\n\t} );\n\n\treturn output;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `style` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttribute( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsEdit = {\n\t[ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ],\n\t[ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tCOLOR_SUPPORT_KEY,\n\t],\n\t[ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t],\n\t[ `${ DIMENSIONS_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t],\n\t[ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tSPACING_SUPPORT_KEY,\n\t],\n\t[ `${ SHADOW_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tSHADOW_SUPPORT_KEY,\n\t],\n};\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * Extends the Edit skip paths to enable skipping additional paths in just\n * the Save component. This allows a block support to be serialized within the\n * editor, while using an alternate approach, such as server-side rendering, when\n * the support is saved.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsSave = {\n\t...skipSerializationPathsEdit,\n\t[ `${ DIMENSIONS_SUPPORT_KEY }.aspectRatio` ]: [\n\t\t`${ DIMENSIONS_SUPPORT_KEY }.aspectRatio`,\n\t], // Skip serialization of aspect ratio in save mode.\n\t[ `${ BACKGROUND_SUPPORT_KEY }` ]: [ BACKGROUND_SUPPORT_KEY ], // Skip serialization of background support in save mode.\n};\n\nconst skipSerializationPathsSaveChecks = {\n\t[ `${ DIMENSIONS_SUPPORT_KEY }.aspectRatio` ]: true,\n\t[ `${ BACKGROUND_SUPPORT_KEY }` ]: true,\n};\n\n/**\n * A dictionary used to normalize feature names between support flags, style\n * object properties and __experimentSkipSerialization configuration arrays.\n *\n * This allows not having to provide a migration for a support flag and possible\n * backwards compatibility bridges, while still achieving consistency between\n * the support flag and the skip serialization array.\n *\n * @constant\n * @type {Record<string, string>}\n */\nconst renamedFeatures = { gradients: 'gradient' };\n\n/**\n * A utility function used to remove one or more paths from a style object.\n * Works in a way similar to Lodash's `omit()`. See unit tests and examples below.\n *\n * It supports a single string path:\n *\n * ```\n * omitStyle( { color: 'red' }, 'color' ); // {}\n * ```\n *\n * or an array of paths:\n *\n * ```\n * omitStyle( { color: 'red', background: '#fff' }, [ 'color', 'background' ] ); // {}\n * ```\n *\n * It also allows you to specify paths at multiple levels in a string.\n *\n * ```\n * omitStyle( { typography: { textDecoration: 'underline' } }, 'typography.textDecoration' ); // {}\n * ```\n *\n * You can remove multiple paths at the same time:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t'typography.textDecoration',\n * \t\t\t'typography.textTransform',\n *\t\t]\n * );\n * // {}\n * ```\n *\n * You can also specify nested paths as arrays:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'typography', 'textDecoration' ],\n * \t\t\t[ 'typography', 'textTransform' ],\n *\t\t]\n * );\n * // {}\n * ```\n *\n * With regards to nesting of styles, infinite depth is supported:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\tborder: {\n * \t\t\t\tradius: {\n * \t\t\t\t\ttopLeft: '10px',\n * \t\t\t\t\ttopRight: '0.5rem',\n * \t\t\t\t}\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'border', 'radius', 'topRight' ],\n *\t\t]\n * );\n * // { border: { radius: { topLeft: '10px' } } }\n * ```\n *\n * The third argument, `preserveReference`, defines how to treat the input style object.\n * It is mostly necessary to properly handle mutation when recursively handling the style object.\n * Defaulting to `false`, this will always create a new object, avoiding to mutate `style`.\n * However, when recursing, we change that value to `true` in order to work with a single copy\n * of the original style object.\n *\n * @see https://lodash.com/docs/4.17.15#omit\n *\n * @param {Object} style Styles object.\n * @param {Array|string} paths Paths to remove.\n * @param {boolean} preserveReference True to mutate the `style` object, false otherwise.\n * @return {Object} Styles object with the specified paths removed.\n */\nexport function omitStyle( style, paths, preserveReference = false ) {\n\tif ( ! style ) {\n\t\treturn style;\n\t}\n\n\tlet newStyle = style;\n\tif ( ! preserveReference ) {\n\t\tnewStyle = JSON.parse( JSON.stringify( style ) );\n\t}\n\n\tif ( ! Array.isArray( paths ) ) {\n\t\tpaths = [ paths ];\n\t}\n\n\tpaths.forEach( ( path ) => {\n\t\tif ( ! Array.isArray( path ) ) {\n\t\t\tpath = path.split( '.' );\n\t\t}\n\n\t\tif ( path.length > 1 ) {\n\t\t\tconst [ firstSubpath, ...restPath ] = path;\n\t\t\tomitStyle( newStyle[ firstSubpath ], [ restPath ], true );\n\t\t} else if ( path.length === 1 ) {\n\t\t\tdelete newStyle[ path[ 0 ] ];\n\t\t}\n\t} );\n\n\treturn newStyle;\n}\n\n/**\n * Override props assigned to save component to inject the CSS variables definition.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object|string} blockNameOrType Block type.\n * @param {Object} attributes Block attributes.\n * @param {?Record<string, string[]>} skipPaths An object of keys and paths to skip serialization.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps(\n\tprops,\n\tblockNameOrType,\n\tattributes,\n\tskipPaths = skipSerializationPathsSave\n) {\n\tif ( ! hasStyleSupport( blockNameOrType ) ) {\n\t\treturn props;\n\t}\n\n\tlet { style } = attributes;\n\tObject.entries( skipPaths ).forEach( ( [ indicator, path ] ) => {\n\t\tconst skipSerialization =\n\t\t\tskipSerializationPathsSaveChecks[ indicator ] ||\n\t\t\tgetBlockSupport( blockNameOrType, indicator );\n\n\t\tif ( skipSerialization === true ) {\n\t\t\tstyle = omitStyle( style, path );\n\t\t}\n\n\t\tif ( Array.isArray( skipSerialization ) ) {\n\t\t\tskipSerialization.forEach( ( featureName ) => {\n\t\t\t\tconst feature = renamedFeatures[ featureName ] || featureName;\n\t\t\t\tstyle = omitStyle( style, [ [ ...path, feature ] ] );\n\t\t\t} );\n\t\t}\n\t} );\n\n\tprops.style = {\n\t\t...getInlineStyles( style ),\n\t\t...props.style,\n\t};\n\n\treturn props;\n}\n\nfunction BlockStyleControls( {\n\tclientId,\n\tname,\n\tsetAttributes,\n\t__unstableParentLayout,\n} ) {\n\tconst settings = useBlockSettings( name, __unstableParentLayout );\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst passedProps = {\n\t\tclientId,\n\t\tname,\n\t\tsetAttributes,\n\t\tsettings: {\n\t\t\t...settings,\n\t\t\ttypography: {\n\t\t\t\t...settings.typography,\n\t\t\t\t// The text alignment UI for individual blocks is rendered in\n\t\t\t\t// the block toolbar, so disable it here.\n\t\t\t\ttextAlign: false,\n\t\t\t},\n\t\t},\n\t};\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t<ColorEdit { ...passedProps } />\n\t\t\t<BackgroundImagePanel { ...passedProps } />\n\t\t\t<TypographyPanel { ...passedProps } />\n\t\t\t<BorderPanel { ...passedProps } />\n\t\t\t<DimensionsPanel { ...passedProps } />\n\t\t</>\n\t);\n}\n\nexport default {\n\tedit: BlockStyleControls,\n\thasSupport: hasStyleSupport,\n\taddSaveProps,\n\tattributeKeys: [ 'style' ],\n\tuseBlockProps,\n};\n\n// Defines which element types are supported, including their hover styles or\n// any other elements that have been included under a single element type\n// e.g. heading and h1-h6.\nconst elementTypes = [\n\t{ elementType: 'button' },\n\t{ elementType: 'link', pseudo: [ ':hover' ] },\n\t{\n\t\telementType: 'heading',\n\t\telements: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ],\n\t},\n];\n\nfunction useBlockProps( { name, style } ) {\n\tconst blockElementsContainerIdentifier = `wp-elements-${ useInstanceId(\n\t\tuseBlockProps\n\t) }`;\n\n\tconst baseElementSelector = `.${ blockElementsContainerIdentifier }`;\n\tconst blockElementStyles = style?.elements;\n\n\tconst styles = useMemo( () => {\n\t\tif ( ! blockElementStyles ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst elementCSSRules = [];\n\n\t\telementTypes.forEach( ( { elementType, pseudo, elements } ) => {\n\t\t\tconst skipSerialization = shouldSkipSerialization(\n\t\t\t\tname,\n\t\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t\telementType\n\t\t\t);\n\n\t\t\tif ( skipSerialization ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst elementStyles = blockElementStyles?.[ elementType ];\n\n\t\t\t// Process primary element type styles.\n\t\t\tif ( elementStyles ) {\n\t\t\t\tconst selector = scopeSelector(\n\t\t\t\t\tbaseElementSelector,\n\t\t\t\t\tELEMENTS[ elementType ]\n\t\t\t\t);\n\n\t\t\t\telementCSSRules.push(\n\t\t\t\t\tcompileCSS( elementStyles, { selector } )\n\t\t\t\t);\n\n\t\t\t\t// Process any interactive states for the element type.\n\t\t\t\tif ( pseudo ) {\n\t\t\t\t\tpseudo.forEach( ( pseudoSelector ) => {\n\t\t\t\t\t\tif ( elementStyles[ pseudoSelector ] ) {\n\t\t\t\t\t\t\telementCSSRules.push(\n\t\t\t\t\t\t\t\tcompileCSS( elementStyles[ pseudoSelector ], {\n\t\t\t\t\t\t\t\t\tselector: scopeSelector(\n\t\t\t\t\t\t\t\t\t\tbaseElementSelector,\n\t\t\t\t\t\t\t\t\t\t`${ ELEMENTS[ elementType ] }${ pseudoSelector }`\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Process related elements e.g. h1-h6 for headings\n\t\t\tif ( elements ) {\n\t\t\t\telements.forEach( ( element ) => {\n\t\t\t\t\tif ( blockElementStyles[ element ] ) {\n\t\t\t\t\t\telementCSSRules.push(\n\t\t\t\t\t\t\tcompileCSS( blockElementStyles[ element ], {\n\t\t\t\t\t\t\t\tselector: scopeSelector(\n\t\t\t\t\t\t\t\t\tbaseElementSelector,\n\t\t\t\t\t\t\t\t\tELEMENTS[ element ]\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\treturn elementCSSRules.length > 0\n\t\t\t? elementCSSRules.join( '' )\n\t\t\t: undefined;\n\t}, [ baseElementSelector, blockElementStyles, name ] );\n\n\tuseStyleOverride( { css: styles } );\n\n\treturn addSaveProps(\n\t\t{ className: blockElementsContainerIdentifier },\n\t\tname,\n\t\t{ style },\n\t\tskipSerializationPathsEdit\n\t);\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addAttribute',\n\taddAttribute\n);\n"],"mappings":";;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAKA,IAAAS,WAAA,GAAAT,OAAA;AAKA,IAAAU,MAAA,GAAAV,OAAA;AAKA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,iBAAA,GAAAZ,OAAA;AAAuE,IAAAa,WAAA,GAAAb,OAAA;AAnCvE;AACA;AACA;;AAWA;AACA;AACA;;AAsBA,MAAMc,gBAAgB,GAAG,CACxB,GAAGC,mCAAuB,EAC1BC,0BAAkB,EAClBC,wBAAiB,EACjBC,kCAAsB,EACtBC,kCAAsB,EACtBC,+BAAmB,EACnBC,0BAAkB,CAClB;AAED,MAAMC,eAAe,GAAKC,UAAU,IACnCT,gBAAgB,CAACU,IAAI,CAAIC,GAAG,IAAM,IAAAC,uBAAe,E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ACA;AACA;AACA,MAAMsB,0BAA0B,GAAG;EAClC,GAAGF,0BAA0B;EAC7B,CAAG,GAAGvB,kCAAwB,cAAa,GAAI,CAC7C,GAAGA,kCAAwB,cAAa,CACzC;EAAE;EACH,CAAG,GAAGC,kCAAwB,EAAC,GAAI,CAAEA,kCAAsB,CAAE,CAAE;AAChE,CAAC;AAED,MAAMyB,gCAAgC,GAAG;EACxC,CAAG,GAAG1B,kCAAwB,cAAa,GAAI,IAAI;EACnD,CAAG,GAAGC,kCAAwB,EAAC,GAAI;AACpC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM0B,eAAe,GAAG;EAAEC,SAAS,EAAE;AAAW,CAAC;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,SAASA,CAAEV,KAAK,EAAEW,KAAK,EAAEC,iBAAiB,GAAG,KAAK,EAAG;EACpE,IAAK,CAAEZ,KAAK,EAAG;IACd,OAAOA,KAAK;EACb;EAEA,IAAIa,QAAQ,GAAGb,KAAK;EACpB,IAAK,CAAEY,iBAAiB,EAAG;IAC1BC,QAAQ,GAAGC,IAAI,CAACC,KAAK,CAAED,IAAI,CAACE,SAAS,CAAEhB,KAAM,CAAE,CAAC;EACjD;EAEA,IAAK,CAAEiB,KAAK,CAACC,OAAO,CAA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AI,CAAE,EAAG,CAAC,GAC1BC,SAAS;EACb,CAAC,EAAE,CAAEd,mBAAmB,EAAEC,kBAAkB,EAAEhC,IAAI,CAAG,CAAC;EAEtD,IAAA8C,uBAAgB,EAAE;IAAEC,GAAG,EAAE5F;EAAO,CAAE,CAAC;EAEnC,OAAOiC,YAAY,CAClB;IAAE4D,SAAS,EAAEnB;EAAiC,CAAC,EAC/C7B,IAAI,EACJ;IAAEpC;EAAM,CAAC,EACTI,0BACD,CAAC;AACF;AAEA,IAAAiF,gBAAS,EACR,0BAA0B,EAC1B,yBAAyB,EACzBxF,YACD,CAAC","ignoreList":[]}
@@ -13,6 +13,7 @@ var _compose = require("@wordpress/compose");
13
13
  var _data = require("@wordpress/data");
14
14
  var _element = require("@wordpress/element");
15
15
  var _hooks = require("@wordpress/hooks");
16
+ var _isUrlLike = _interopRequireDefault(require("../components/link-control/is-url-like"));
16
17
  var _lockUnlock = require("../lock-unlock");
17
18
  var _blockContext = _interopRequireDefault(require("../components/block-context"));
18
19
  var _jsxRuntime = require("react/jsx-runtime");
@@ -122,7 +123,7 @@ const withBlockBindingSupport = exports.withBlockBindingSupport = (0, _compose.c
122
123
  args: sourceArgs
123
124
  } = binding;
124
125
  const source = sources[sourceName];
125
- if (!source?.getValues || !canBindAttribute(name, attributeName)) {
126
+ if (!source || !canBindAttribute(name, attributeName)) {
126
127
  continue;
127
128
  }
128
129
  blockBindingsBySource.set(source, {
@@ -143,26 +144,24 @@ const withBlockBindingSupport = exports.withBlockBindingSupport = (0, _compose.c
143
144
  }
144
145
 
145
146
  // Get values in batch if the source supports it.
146
- const values = source.getValues({
147
- registry,
148
- context,
149
- clientId,
150
- bindings
151
- });
147
+ let values = {};
148
+ if (!source.getValues) {
149
+ Object.keys(bindings).forEach(attr => {
150
+ // Default to the `key` or the source label when `getValues` doesn't exist
151
+ values[attr] = bindings[attr].args?.key || source.label;
152
+ });
153
+ } else {
154
+ values = source.getValues({
155
+ registry,
156
+ context,
157
+ clientId,
158
+ bindings
159
+ });
160
+ }
152
161
  for (const [attributeName, value] of Object.entries(values)) {
153
- // Use placeholder when value is undefined.
154
- if (value === undefined) {
155
- if (attributeName === 'url') {
156
- attributes[attributeName] = null;
157
- } else {
158
- attributes[attributeName] = source.getPlaceholder?.({
159
- registry,
160
- context,
161
- clientId,
162
- attributeName,
163
- args: bindings[attributeName].args
164
- });
165
- }
162
+ if (attributeName === 'url' && (!value || !(0, _isUrlLike.default)(value))) {
163
+ // Return null if value is not a valid URL.
164
+ attributes[attributeName] = null;
166
165
  } else {
167
166
  attributes[attributeName] = value;
168
167
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_compose","_data","_element","_hooks","_lockUnlock","_blockContext","_interopRequireDefault","_jsxRuntime","BLOCK_BINDINGS_ALLOWED_BLOCKS","DEFAULT_ATTRIBUTE","replacePatternOverrideDefaultBindings","blockName","bindings","source","supportedAttributes","bindingsWithDefaults","attributeName","bindingSource","canBindBlock","canBindAttribute","includes","getBindableAttributes","withBlockBindingSupport","exports","createHigherOrderComponent","BlockEdit","props","registry","useRegistry","blockContext","useContext","BlockContext","sources","useSelect","select","unlock","blocksStore","getAllBlockBindingsSources","name","clientId","hasParentPattern","context","hasPatternOverridesDefaultBinding","attributes","metadata","blockBindings","useMemo","boundAttributes","blockBindingsBySource","Map","binding","Object","entries","sourceName","args","sourceArgs","getValues","set","get","size","usesContext","length","key","values","value","undefined","getPlaceholder","setAttributes","_setAttributes","useCallback","nextAttributes","batch","keptAttributes","newValue","setValues","keys","caption","href","jsx","Fragment","children","shimAttributeSource","settings","edit","addFilter"],"sources":["@wordpress/block-editor/src/hooks/use-bindings-attributes.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { useCallback, useMemo, useContext } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport BlockContext from '../components/block-context';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Given a binding of block attributes, returns a higher order component that\n * overrides its `attributes` and `setAttributes` props to sync any changes needed.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\n\nconst BLOCK_BINDINGS_ALLOWED_BLOCKS = {\n\t'core/paragraph': [ 'content' ],\n\t'core/heading': [ 'content' ],\n\t'core/image': [ 'id', 'url', 'title', 'alt' ],\n\t'core/button': [ 'url', 'text', 'linkTarget', 'rel' ],\n};\n\nconst DEFAULT_ATTRIBUTE = '__default';\n\n/**\n * Returns the bindings with the `__default` binding for pattern overrides\n * replaced with the full-set of supported attributes. e.g.:\n *\n * bindings passed in: `{ __default: { source: 'core/pattern-overrides' } }`\n * bindings returned: `{ content: { source: 'core/pattern-overrides' } }`\n *\n * @param {string} blockName The block name (e.g. 'core/paragraph').\n * @param {Object} bindings A block's bindings from the metadata attribute.\n *\n * @return {Object} The bindings with default replaced for pattern overrides.\n */\nfunction replacePatternOverrideDefaultBindings( blockName, bindings ) {\n\t// The `__default` binding currently only works for pattern overrides.\n\tif (\n\t\tbindings?.[ DEFAULT_ATTRIBUTE ]?.source === 'core/pattern-overrides'\n\t) {\n\t\tconst supportedAttributes = BLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ];\n\t\tconst bindingsWithDefaults = {};\n\t\tfor ( const attributeName of supportedAttributes ) {\n\t\t\t// If the block has mixed binding sources, retain any non pattern override bindings.\n\t\t\tconst bindingSource = bindings[ attributeName ]\n\t\t\t\t? bindings[ attributeName ]\n\t\t\t\t: { source: 'core/pattern-overrides' };\n\t\t\tbindingsWithDefaults[ attributeName ] = bindingSource;\n\t\t}\n\n\t\treturn bindingsWithDefaults;\n\t}\n\n\treturn bindings;\n}\n\n/**\n * Based on the given block name,\n * check if it is possible to bind the block.\n *\n * @param {string} blockName - The block name.\n * @return {boolean} Whether it is possible to bind the block to sources.\n */\nexport function canBindBlock( blockName ) {\n\treturn blockName in BLOCK_BINDINGS_ALLOWED_BLOCKS;\n}\n\n/**\n * Based on the given block name and attribute name,\n * check if it is possible to bind the block attribute.\n *\n * @param {string} blockName - The block name.\n * @param {string} attributeName - The attribute name.\n * @return {boolean} Whether it is possible to bind the block attribute.\n */\nexport function canBindAttribute( blockName, attributeName ) {\n\treturn (\n\t\tcanBindBlock( blockName ) &&\n\t\tBLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ].includes( attributeName )\n\t);\n}\n\nexport function getBindableAttributes( blockName ) {\n\treturn BLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ];\n}\n\nexport const withBlockBindingSupport = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst registry = useRegistry();\n\t\tconst blockContext = useContext( BlockContext );\n\t\tconst sources = useSelect( ( select ) =>\n\t\t\tunlock( select( blocksStore ) ).getAllBlockBindingsSources()\n\t\t);\n\t\tconst { name, clientId } = props;\n\t\tconst hasParentPattern = !! props.context[ 'pattern/overrides' ];\n\t\tconst hasPatternOverridesDefaultBinding =\n\t\t\tprops.attributes.metadata?.bindings?.[ DEFAULT_ATTRIBUTE ]\n\t\t\t\t?.source === 'core/pattern-overrides';\n\t\tconst blockBindings = useMemo(\n\t\t\t() =>\n\t\t\t\treplacePatternOverrideDefaultBindings(\n\t\t\t\t\tname,\n\t\t\t\t\tprops.attributes.metadata?.bindings\n\t\t\t\t),\n\t\t\t[ props.attributes.metadata?.bindings, name ]\n\t\t);\n\n\t\t// While this hook doesn't directly call any selectors, `useSelect` is\n\t\t// used purposely here to ensure `boundAttributes` is updated whenever\n\t\t// there are attribute updates.\n\t\t// `source.getValues` may also call a selector via `registry.select`.\n\t\tconst boundAttributes = useSelect( () => {\n\t\t\tif ( ! blockBindings ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst attributes = {};\n\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 = sources[ sourceName ];\n\t\t\t\tif (\n\t\t\t\t\t! source?.getValues ||\n\t\t\t\t\t! canBindAttribute( name, attributeName )\n\t\t\t\t) {\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// Populate context.\n\t\t\t\t\tconst context = {};\n\n\t\t\t\t\tif ( source.usesContext?.length ) {\n\t\t\t\t\t\tfor ( const key of source.usesContext ) {\n\t\t\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Get values in batch if the source supports it.\n\t\t\t\t\tconst values = source.getValues( {\n\t\t\t\t\t\tregistry,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tbindings,\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\t// Use placeholder when value is undefined.\n\t\t\t\t\t\tif ( value === undefined ) {\n\t\t\t\t\t\t\tif ( attributeName === 'url' ) {\n\t\t\t\t\t\t\t\tattributes[ attributeName ] = null;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tattributes[ attributeName ] =\n\t\t\t\t\t\t\t\t\tsource.getPlaceholder?.( {\n\t\t\t\t\t\t\t\t\t\tregistry,\n\t\t\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t\t\tattributeName,\n\t\t\t\t\t\t\t\t\t\targs: bindings[ attributeName ].args,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tattributes[ 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 attributes;\n\t\t}, [ blockBindings, name, clientId, blockContext, registry, sources ] );\n\n\t\tconst { setAttributes } = props;\n\n\t\tconst _setAttributes = useCallback(\n\t\t\t( nextAttributes ) => {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tif ( ! blockBindings ) {\n\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst keptAttributes = { ...nextAttributes };\n\t\t\t\t\tconst blockBindingsBySource = new Map();\n\n\t\t\t\t\t// Loop only over the updated attributes to avoid modifying the bound ones that haven't changed.\n\t\t\t\t\tfor ( const [ attributeName, newValue ] of Object.entries(\n\t\t\t\t\t\tkeptAttributes\n\t\t\t\t\t) ) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! blockBindings[ attributeName ] ||\n\t\t\t\t\t\t\t! canBindAttribute( name, attributeName )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst binding = blockBindings[ attributeName ];\n\t\t\t\t\t\tconst source = sources[ binding?.source ];\n\t\t\t\t\t\tif ( ! source?.setValues ) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tblockBindingsBySource.set( source, {\n\t\t\t\t\t\t\t...blockBindingsBySource.get( source ),\n\t\t\t\t\t\t\t[ attributeName ]: {\n\t\t\t\t\t\t\t\targs: binding.args,\n\t\t\t\t\t\t\t\tnewValue,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tdelete keptAttributes[ attributeName ];\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( blockBindingsBySource.size ) {\n\t\t\t\t\t\tfor ( const [\n\t\t\t\t\t\t\tsource,\n\t\t\t\t\t\t\tbindings,\n\t\t\t\t\t\t] of blockBindingsBySource ) {\n\t\t\t\t\t\t\t// Populate context.\n\t\t\t\t\t\t\tconst context = {};\n\n\t\t\t\t\t\t\tif ( source.usesContext?.length ) {\n\t\t\t\t\t\t\t\tfor ( const key of source.usesContext ) {\n\t\t\t\t\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsource.setValues( {\n\t\t\t\t\t\t\t\tregistry,\n\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\tbindings,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t// Don't update non-connected attributes if the block is using pattern overrides\n\t\t\t\t\t\t// and the editing is happening while overriding the pattern (not editing the original).\n\t\t\t\t\t\t! (\n\t\t\t\t\t\t\thasPatternOverridesDefaultBinding &&\n\t\t\t\t\t\t\thasParentPattern\n\t\t\t\t\t\t) &&\n\t\t\t\t\t\tObject.keys( keptAttributes ).length\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Don't update caption and href until they are supported.\n\t\t\t\t\t\tif ( hasPatternOverridesDefaultBinding ) {\n\t\t\t\t\t\t\tdelete keptAttributes?.caption;\n\t\t\t\t\t\t\tdelete keptAttributes?.href;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetAttributes( keptAttributes );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\t[\n\t\t\t\tregistry,\n\t\t\t\tblockBindings,\n\t\t\t\tname,\n\t\t\t\tclientId,\n\t\t\t\tblockContext,\n\t\t\t\tsetAttributes,\n\t\t\t\tsources,\n\t\t\t\thasPatternOverridesDefaultBinding,\n\t\t\t\thasParentPattern,\n\t\t\t]\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tattributes={ { ...props.attributes, ...boundAttributes } }\n\t\t\t\t\tsetAttributes={ _setAttributes }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withBlockBindingSupport'\n);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade bound attributes.\n *\n * @param {WPBlockSettings} settings - Registered block settings.\n * @param {string} name - Block name.\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings, name ) {\n\tif ( ! canBindBlock( name ) ) {\n\t\treturn settings;\n\t}\n\n\treturn {\n\t\t...settings,\n\t\tedit: withBlockBindingSupport( settings.edit ),\n\t};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAC,sBAAA,CAAAP,OAAA;AAAuD,IAAAQ,WAAA,GAAAR,OAAA;AAbvD;AACA;AACA;;AAOA;AACA;AACA;;AAIA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAEA,MAAMS,6BAA6B,GAAG;EACrC,gBAAgB,EAAE,CAAE,SAAS,CAAE;EAC/B,cAAc,EAAE,CAAE,SAAS,CAAE;EAC7B,YAAY,EAAE,CAAE,IAAI,EAAE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AC9C,IAAK,CAAEpB,YAAY,CAAEoB,IAAK,CAAC,EAAG;IAC7B,OAAO4C,QAAQ;EAChB;EAEA,OAAO;IACN,GAAGA,QAAQ;IACXC,IAAI,EAAE7D,uBAAuB,CAAE4D,QAAQ,CAACC,IAAK;EAC9C,CAAC;AACF;AAEA,IAAAC,gBAAS,EACR,0BAA0B,EAC1B,0EAA0E,EAC1EH,mBACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_blocks","require","_compose","_data","_element","_hooks","_isUrlLike","_interopRequireDefault","_lockUnlock","_blockContext","_jsxRuntime","BLOCK_BINDINGS_ALLOWED_BLOCKS","DEFAULT_ATTRIBUTE","replacePatternOverrideDefaultBindings","blockName","bindings","source","supportedAttributes","bindingsWithDefaults","attributeName","bindingSource","canBindBlock","canBindAttribute","includes","getBindableAttributes","withBlockBindingSupport","exports","createHigherOrderComponent","BlockEdit","props","registry","useRegistry","blockContext","useContext","BlockContext","sources","useSelect","select","unlock","blocksStore","getAllBlockBindingsSources","name","clientId","hasParentPattern","context","hasPatternOverridesDefaultBinding","attributes","metadata","blockBindings","useMemo","boundAttributes","blockBindingsBySource","Map","binding","Object","entries","sourceName","args","sourceArgs","set","get","size","usesContext","length","key","values","getValues","keys","forEach","attr","label","value","isURLLike","setAttributes","_setAttributes","useCallback","nextAttributes","batch","keptAttributes","newValue","setValues","caption","href","jsx","Fragment","children","shimAttributeSource","settings","edit","addFilter"],"sources":["@wordpress/block-editor/src/hooks/use-bindings-attributes.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { useCallback, useMemo, useContext } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport isURLLike from '../components/link-control/is-url-like';\nimport { unlock } from '../lock-unlock';\nimport BlockContext from '../components/block-context';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Given a binding of block attributes, returns a higher order component that\n * overrides its `attributes` and `setAttributes` props to sync any changes needed.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\n\nconst BLOCK_BINDINGS_ALLOWED_BLOCKS = {\n\t'core/paragraph': [ 'content' ],\n\t'core/heading': [ 'content' ],\n\t'core/image': [ 'id', 'url', 'title', 'alt' ],\n\t'core/button': [ 'url', 'text', 'linkTarget', 'rel' ],\n};\n\nconst DEFAULT_ATTRIBUTE = '__default';\n\n/**\n * Returns the bindings with the `__default` binding for pattern overrides\n * replaced with the full-set of supported attributes. e.g.:\n *\n * bindings passed in: `{ __default: { source: 'core/pattern-overrides' } }`\n * bindings returned: `{ content: { source: 'core/pattern-overrides' } }`\n *\n * @param {string} blockName The block name (e.g. 'core/paragraph').\n * @param {Object} bindings A block's bindings from the metadata attribute.\n *\n * @return {Object} The bindings with default replaced for pattern overrides.\n */\nfunction replacePatternOverrideDefaultBindings( blockName, bindings ) {\n\t// The `__default` binding currently only works for pattern overrides.\n\tif (\n\t\tbindings?.[ DEFAULT_ATTRIBUTE ]?.source === 'core/pattern-overrides'\n\t) {\n\t\tconst supportedAttributes = BLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ];\n\t\tconst bindingsWithDefaults = {};\n\t\tfor ( const attributeName of supportedAttributes ) {\n\t\t\t// If the block has mixed binding sources, retain any non pattern override bindings.\n\t\t\tconst bindingSource = bindings[ attributeName ]\n\t\t\t\t? bindings[ attributeName ]\n\t\t\t\t: { source: 'core/pattern-overrides' };\n\t\t\tbindingsWithDefaults[ attributeName ] = bindingSource;\n\t\t}\n\n\t\treturn bindingsWithDefaults;\n\t}\n\n\treturn bindings;\n}\n\n/**\n * Based on the given block name,\n * check if it is possible to bind the block.\n *\n * @param {string} blockName - The block name.\n * @return {boolean} Whether it is possible to bind the block to sources.\n */\nexport function canBindBlock( blockName ) {\n\treturn blockName in BLOCK_BINDINGS_ALLOWED_BLOCKS;\n}\n\n/**\n * Based on the given block name and attribute name,\n * check if it is possible to bind the block attribute.\n *\n * @param {string} blockName - The block name.\n * @param {string} attributeName - The attribute name.\n * @return {boolean} Whether it is possible to bind the block attribute.\n */\nexport function canBindAttribute( blockName, attributeName ) {\n\treturn (\n\t\tcanBindBlock( blockName ) &&\n\t\tBLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ].includes( attributeName )\n\t);\n}\n\nexport function getBindableAttributes( blockName ) {\n\treturn BLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ];\n}\n\nexport const withBlockBindingSupport = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst registry = useRegistry();\n\t\tconst blockContext = useContext( BlockContext );\n\t\tconst sources = useSelect( ( select ) =>\n\t\t\tunlock( select( blocksStore ) ).getAllBlockBindingsSources()\n\t\t);\n\t\tconst { name, clientId } = props;\n\t\tconst hasParentPattern = !! props.context[ 'pattern/overrides' ];\n\t\tconst hasPatternOverridesDefaultBinding =\n\t\t\tprops.attributes.metadata?.bindings?.[ DEFAULT_ATTRIBUTE ]\n\t\t\t\t?.source === 'core/pattern-overrides';\n\t\tconst blockBindings = useMemo(\n\t\t\t() =>\n\t\t\t\treplacePatternOverrideDefaultBindings(\n\t\t\t\t\tname,\n\t\t\t\t\tprops.attributes.metadata?.bindings\n\t\t\t\t),\n\t\t\t[ props.attributes.metadata?.bindings, name ]\n\t\t);\n\n\t\t// While this hook doesn't directly call any selectors, `useSelect` is\n\t\t// used purposely here to ensure `boundAttributes` is updated whenever\n\t\t// there are attribute updates.\n\t\t// `source.getValues` may also call a selector via `registry.select`.\n\t\tconst boundAttributes = useSelect( () => {\n\t\t\tif ( ! blockBindings ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst attributes = {};\n\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 = sources[ 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// Populate context.\n\t\t\t\t\tconst context = {};\n\n\t\t\t\t\tif ( source.usesContext?.length ) {\n\t\t\t\t\t\tfor ( const key of source.usesContext ) {\n\t\t\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\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 `key` or the source label when `getValues` doesn't exist\n\t\t\t\t\t\t\tvalues[ attr ] =\n\t\t\t\t\t\t\t\tbindings[ attr ].args?.key || 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\tregistry,\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\tattributes[ attributeName ] = null;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tattributes[ 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 attributes;\n\t\t}, [ blockBindings, name, clientId, blockContext, registry, sources ] );\n\n\t\tconst { setAttributes } = props;\n\n\t\tconst _setAttributes = useCallback(\n\t\t\t( nextAttributes ) => {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tif ( ! blockBindings ) {\n\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst keptAttributes = { ...nextAttributes };\n\t\t\t\t\tconst blockBindingsBySource = new Map();\n\n\t\t\t\t\t// Loop only over the updated attributes to avoid modifying the bound ones that haven't changed.\n\t\t\t\t\tfor ( const [ attributeName, newValue ] of Object.entries(\n\t\t\t\t\t\tkeptAttributes\n\t\t\t\t\t) ) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! blockBindings[ attributeName ] ||\n\t\t\t\t\t\t\t! canBindAttribute( name, attributeName )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst binding = blockBindings[ attributeName ];\n\t\t\t\t\t\tconst source = sources[ binding?.source ];\n\t\t\t\t\t\tif ( ! source?.setValues ) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tblockBindingsBySource.set( source, {\n\t\t\t\t\t\t\t...blockBindingsBySource.get( source ),\n\t\t\t\t\t\t\t[ attributeName ]: {\n\t\t\t\t\t\t\t\targs: binding.args,\n\t\t\t\t\t\t\t\tnewValue,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tdelete keptAttributes[ attributeName ];\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( blockBindingsBySource.size ) {\n\t\t\t\t\t\tfor ( const [\n\t\t\t\t\t\t\tsource,\n\t\t\t\t\t\t\tbindings,\n\t\t\t\t\t\t] of blockBindingsBySource ) {\n\t\t\t\t\t\t\t// Populate context.\n\t\t\t\t\t\t\tconst context = {};\n\n\t\t\t\t\t\t\tif ( source.usesContext?.length ) {\n\t\t\t\t\t\t\t\tfor ( const key of source.usesContext ) {\n\t\t\t\t\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsource.setValues( {\n\t\t\t\t\t\t\t\tregistry,\n\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\tbindings,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t// Don't update non-connected attributes if the block is using pattern overrides\n\t\t\t\t\t\t// and the editing is happening while overriding the pattern (not editing the original).\n\t\t\t\t\t\t! (\n\t\t\t\t\t\t\thasPatternOverridesDefaultBinding &&\n\t\t\t\t\t\t\thasParentPattern\n\t\t\t\t\t\t) &&\n\t\t\t\t\t\tObject.keys( keptAttributes ).length\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Don't update caption and href until they are supported.\n\t\t\t\t\t\tif ( hasPatternOverridesDefaultBinding ) {\n\t\t\t\t\t\t\tdelete keptAttributes?.caption;\n\t\t\t\t\t\t\tdelete keptAttributes?.href;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetAttributes( keptAttributes );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\t[\n\t\t\t\tregistry,\n\t\t\t\tblockBindings,\n\t\t\t\tname,\n\t\t\t\tclientId,\n\t\t\t\tblockContext,\n\t\t\t\tsetAttributes,\n\t\t\t\tsources,\n\t\t\t\thasPatternOverridesDefaultBinding,\n\t\t\t\thasParentPattern,\n\t\t\t]\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tattributes={ { ...props.attributes, ...boundAttributes } }\n\t\t\t\t\tsetAttributes={ _setAttributes }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withBlockBindingSupport'\n);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade bound attributes.\n *\n * @param {WPBlockSettings} settings - Registered block settings.\n * @param {string} name - Block name.\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings, name ) {\n\tif ( ! canBindBlock( name ) ) {\n\t\treturn settings;\n\t}\n\n\treturn {\n\t\t...settings,\n\t\tedit: withBlockBindingSupport( settings.edit ),\n\t};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAKA,IAAAK,UAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAF,sBAAA,CAAAN,OAAA;AAAuD,IAAAS,WAAA,GAAAT,OAAA;AAdvD;AACA;AACA;;AAOA;AACA;AACA;;AAKA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAEA,MAAMU,6BAA6B,GAAG;EACrC,gBAAgB,EAAE,CAAE,SAAS,CAAE;EAC/B,cAAc,EAAE,CAAE,SAAS,CAAE;EAC7B,YAAY,EAAE,CAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAE;EAC7C,aAAa,EAAE,C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AACA;AACA,SAASY,mBAAmBA,CAAEC,QAAQ,EAAE9C,IAAI,EAAG;EAC9C,IAAK,CAAEpB,YAAY,CAAEoB,IAAK,CAAC,EAAG;IAC7B,OAAO8C,QAAQ;EAChB;EAEA,OAAO;IACN,GAAGA,QAAQ;IACXC,IAAI,EAAE/D,uBAAuB,CAAE8D,QAAQ,CAACC,IAAK;EAC9C,CAAC;AACF;AAEA,IAAAC,gBAAS,EACR,0BAA0B,EAC1B,0EAA0E,EAC1EH,mBACD,CAAC","ignoreList":[]}
@@ -27,17 +27,17 @@ function useZoomOut(zoomOut = true) {
27
27
  const {
28
28
  __unstableGetEditorMode
29
29
  } = (0, _data.useSelect)(_store.store);
30
- const originalEditingMode = (0, _element.useRef)(null);
30
+ const originalEditingModeRef = (0, _element.useRef)(null);
31
31
  const mode = __unstableGetEditorMode();
32
32
  (0, _element.useEffect)(() => {
33
33
  // Only set this on mount so we know what to return to when we unmount.
34
- if (!originalEditingMode.current) {
35
- originalEditingMode.current = mode;
34
+ if (!originalEditingModeRef.current) {
35
+ originalEditingModeRef.current = mode;
36
36
  }
37
37
  return () => {
38
38
  // We need to use __unstableGetEditorMode() here and not `mode`, as mode may not update on unmount
39
- if (__unstableGetEditorMode() === 'zoom-out' && __unstableGetEditorMode() !== originalEditingMode.current) {
40
- __unstableSetEditorMode(originalEditingMode.current);
39
+ if (__unstableGetEditorMode() === 'zoom-out' && __unstableGetEditorMode() !== originalEditingModeRef.current) {
40
+ __unstableSetEditorMode(originalEditingModeRef.current);
41
41
  }
42
42
  };
43
43
  }, []);
@@ -46,8 +46,8 @@ function useZoomOut(zoomOut = true) {
46
46
  (0, _element.useEffect)(() => {
47
47
  if (zoomOut && mode !== 'zoom-out') {
48
48
  __unstableSetEditorMode('zoom-out');
49
- } else if (!zoomOut && __unstableGetEditorMode() === 'zoom-out' && originalEditingMode.current !== mode) {
50
- __unstableSetEditorMode(originalEditingMode.current);
49
+ } else if (!zoomOut && __unstableGetEditorMode() === 'zoom-out' && originalEditingModeRef.current !== mode) {
50
+ __unstableSetEditorMode(originalEditingModeRef.current);
51
51
  }
52
52
  }, [__unstableGetEditorMode, __unstableSetEditorMode, zoomOut]); // Mode is deliberately excluded from the dependencies so that the effect does not run when mode changes.
53
53
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_store","useZoomOut","zoomOut","__unstableSetEditorMode","useDispatch","blockEditorStore","__unstableGetEditorMode","useSelect","originalEditingMode","useRef","mode","useEffect","current"],"sources":["@wordpress/block-editor/src/hooks/use-zoom-out.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\n\n/**\n * A hook used to set the editor mode to zoomed out mode, invoking the hook sets the mode.\n *\n * @param {boolean} zoomOut If we should enter into zoomOut mode or not\n */\nexport function useZoomOut( zoomOut = true ) {\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\tconst { __unstableGetEditorMode } = useSelect( blockEditorStore );\n\n\tconst originalEditingMode = useRef( null );\n\tconst mode = __unstableGetEditorMode();\n\n\tuseEffect( () => {\n\t\t// Only set this on mount so we know what to return to when we unmount.\n\t\tif ( ! originalEditingMode.current ) {\n\t\t\toriginalEditingMode.current = mode;\n\t\t}\n\n\t\treturn () => {\n\t\t\t// We need to use __unstableGetEditorMode() here and not `mode`, as mode may not update on unmount\n\t\t\tif (\n\t\t\t\t__unstableGetEditorMode() === 'zoom-out' &&\n\t\t\t\t__unstableGetEditorMode() !== originalEditingMode.current\n\t\t\t) {\n\t\t\t\t__unstableSetEditorMode( originalEditingMode.current );\n\t\t\t}\n\t\t};\n\t}, [] );\n\n\t// The effect opens the zoom-out view if we want it open and it's not currently in zoom-out mode.\n\tuseEffect( () => {\n\t\tif ( zoomOut && mode !== 'zoom-out' ) {\n\t\t\t__unstableSetEditorMode( 'zoom-out' );\n\t\t} else if (\n\t\t\t! zoomOut &&\n\t\t\t__unstableGetEditorMode() === 'zoom-out' &&\n\t\t\toriginalEditingMode.current !== mode\n\t\t) {\n\t\t\t__unstableSetEditorMode( originalEditingMode.current );\n\t\t}\n\t}, [ __unstableGetEditorMode, __unstableSetEditorMode, zoomOut ] ); // Mode is deliberately excluded from the dependencies so that the effect does not run when mode changes.\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACO,SAASG,UAAUA,CAAEC,OAAO,GAAG,IAAI,EAAG;EAC5C,MAAM;IAAEC;EAAwB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAiB,CAAC;EACnE,MAAM;IAAEC;EAAwB,CAAC,GAAG,IAAAC,eAAS,EAAEF,YAAiB,CAAC;EAEjE,MAAMG,mBAAmB,GAAG,IAAAC,eAAM,EAAE,IAAK,CAAC;EAC1C,MAAMC,IAAI,GAAGJ,uBAAuB,CAAC,CAAC;EAEtC,IAAAK,kBAAS,EAAE,MAAM;IAChB;IACA,IAAK,CAAEH,mBAAmB,CAACI,OAAO,EAAG;MACpCJ,mBAAmB,CAACI,OAAO,GAAGF,IAAI;IACnC;IAEA,OAAO,MAAM;MACZ;MACA,IACCJ,uBAAuB,CAAC,CAAC,KAAK,UAAU,IACxCA,uBAAuB,CAAC,CAAC,KAAKE,mBAAmB,CAACI,OAAO,EACxD;QACDT,uBAAuB,CAAEK,mBAAmB,CAACI,OAAQ,CAAC;MACvD;IACD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;;EAEP;EACA,IAAAD,kBAAS,EAAE,MAAM;IAChB,IAAKT,OAAO,IAAIQ,IAAI,KAAK,UAAU,EAAG;MACrCP,uBAAuB,CAAE,UAAW,CAAC;IACtC,CAAC,MAAM,IACN,CAAED,OAAO,IACTI,uBAAuB,CAAC,CAAC,KAAK,UAAU,IACxCE,mBAAmB,CAACI,OAAO,KAAKF,IAAI,EACnC;MACDP,uBAAuB,CAAEK,mBAAmB,CAACI,OAAQ,CAAC;IACvD;EACD,CAAC,EAAE,CAAEN,uBAAuB,EAAEH,uBAAuB,EAAED,OAAO,CAAG,CAAC,CAAC,CAAC;AACrE","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_element","_store","useZoomOut","zoomOut","__unstableSetEditorMode","useDispatch","blockEditorStore","__unstableGetEditorMode","useSelect","originalEditingModeRef","useRef","mode","useEffect","current"],"sources":["@wordpress/block-editor/src/hooks/use-zoom-out.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\n\n/**\n * A hook used to set the editor mode to zoomed out mode, invoking the hook sets the mode.\n *\n * @param {boolean} zoomOut If we should enter into zoomOut mode or not\n */\nexport function useZoomOut( zoomOut = true ) {\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\tconst { __unstableGetEditorMode } = useSelect( blockEditorStore );\n\n\tconst originalEditingModeRef = useRef( null );\n\tconst mode = __unstableGetEditorMode();\n\n\tuseEffect( () => {\n\t\t// Only set this on mount so we know what to return to when we unmount.\n\t\tif ( ! originalEditingModeRef.current ) {\n\t\t\toriginalEditingModeRef.current = mode;\n\t\t}\n\n\t\treturn () => {\n\t\t\t// We need to use __unstableGetEditorMode() here and not `mode`, as mode may not update on unmount\n\t\t\tif (\n\t\t\t\t__unstableGetEditorMode() === 'zoom-out' &&\n\t\t\t\t__unstableGetEditorMode() !== originalEditingModeRef.current\n\t\t\t) {\n\t\t\t\t__unstableSetEditorMode( originalEditingModeRef.current );\n\t\t\t}\n\t\t};\n\t}, [] );\n\n\t// The effect opens the zoom-out view if we want it open and it's not currently in zoom-out mode.\n\tuseEffect( () => {\n\t\tif ( zoomOut && mode !== 'zoom-out' ) {\n\t\t\t__unstableSetEditorMode( 'zoom-out' );\n\t\t} else if (\n\t\t\t! zoomOut &&\n\t\t\t__unstableGetEditorMode() === 'zoom-out' &&\n\t\t\toriginalEditingModeRef.current !== mode\n\t\t) {\n\t\t\t__unstableSetEditorMode( originalEditingModeRef.current );\n\t\t}\n\t}, [ __unstableGetEditorMode, __unstableSetEditorMode, zoomOut ] ); // Mode is deliberately excluded from the dependencies so that the effect does not run when mode changes.\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACO,SAASG,UAAUA,CAAEC,OAAO,GAAG,IAAI,EAAG;EAC5C,MAAM;IAAEC;EAAwB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAiB,CAAC;EACnE,MAAM;IAAEC;EAAwB,CAAC,GAAG,IAAAC,eAAS,EAAEF,YAAiB,CAAC;EAEjE,MAAMG,sBAAsB,GAAG,IAAAC,eAAM,EAAE,IAAK,CAAC;EAC7C,MAAMC,IAAI,GAAGJ,uBAAuB,CAAC,CAAC;EAEtC,IAAAK,kBAAS,EAAE,MAAM;IAChB;IACA,IAAK,CAAEH,sBAAsB,CAACI,OAAO,EAAG;MACvCJ,sBAAsB,CAACI,OAAO,GAAGF,IAAI;IACtC;IAEA,OAAO,MAAM;MACZ;MACA,IACCJ,uBAAuB,CAAC,CAAC,KAAK,UAAU,IACxCA,uBAAuB,CAAC,CAAC,KAAKE,sBAAsB,CAACI,OAAO,EAC3D;QACDT,uBAAuB,CAAEK,sBAAsB,CAACI,OAAQ,CAAC;MAC1D;IACD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;;EAEP;EACA,IAAAD,kBAAS,EAAE,MAAM;IAChB,IAAKT,OAAO,IAAIQ,IAAI,KAAK,UAAU,EAAG;MACrCP,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