@wordpress/block-editor 13.4.0 → 14.1.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 (533) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +20 -15
  3. package/build/autocompleters/block.js +1 -1
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/components/block-breadcrumb/index.js +3 -1
  6. package/build/components/block-breadcrumb/index.js.map +1 -1
  7. package/build/components/block-draggable/index.js +2 -2
  8. package/build/components/block-draggable/index.js.map +1 -1
  9. package/build/components/block-list/use-block-props/index.js +2 -2
  10. package/build/components/block-list/use-block-props/index.js.map +1 -1
  11. package/build/components/block-list/use-block-props/use-block-refs.js +24 -32
  12. package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
  13. package/build/components/block-list/use-in-between-inserter.js +11 -4
  14. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  15. package/build/components/block-mover/index.js +1 -2
  16. package/build/components/block-mover/index.js.map +1 -1
  17. package/build/components/block-popover/cover.js +1 -1
  18. package/build/components/block-popover/cover.js.map +1 -1
  19. package/build/components/block-popover/inbetween.js +2 -2
  20. package/build/components/block-popover/inbetween.js.map +1 -1
  21. package/build/components/block-popover/index.js +2 -2
  22. package/build/components/block-popover/index.js.map +1 -1
  23. package/build/components/block-settings-menu/block-mode-toggle.js +28 -34
  24. package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  25. package/build/components/block-tools/block-selection-button.js +1 -2
  26. package/build/components/block-tools/block-selection-button.js.map +1 -1
  27. package/build/components/block-tools/index.js +1 -1
  28. package/build/components/block-tools/index.js.map +1 -1
  29. package/build/components/block-tools/insertion-point.js +14 -3
  30. package/build/components/block-tools/insertion-point.js.map +1 -1
  31. package/build/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  32. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  33. package/build/components/block-tools/use-show-block-tools.js +2 -1
  34. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  35. package/build/components/block-tools/zoom-out-mode-inserters.js +22 -19
  36. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  37. package/build/components/block-tools/zoom-out-toolbar.js +0 -1
  38. package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
  39. package/build/components/border-radius-control/index.js +1 -0
  40. package/build/components/border-radius-control/index.js.map +1 -1
  41. package/build/components/child-layout-control/index.js +3 -1
  42. package/build/components/child-layout-control/index.js.map +1 -1
  43. package/build/components/convert-to-group-buttons/index.js +1 -1
  44. package/build/components/convert-to-group-buttons/index.js.map +1 -1
  45. package/build/components/date-format-picker/index.js +2 -0
  46. package/build/components/date-format-picker/index.js.map +1 -1
  47. package/build/components/dimensions-tool/scale-tool.js +1 -0
  48. package/build/components/dimensions-tool/scale-tool.js.map +1 -1
  49. package/build/components/font-appearance-control/index.js +3 -0
  50. package/build/components/font-appearance-control/index.js.map +1 -1
  51. package/build/components/font-family/index.js +15 -0
  52. package/build/components/font-family/index.js.map +1 -1
  53. package/build/components/global-styles/background-panel.js +153 -77
  54. package/build/components/global-styles/background-panel.js.map +1 -1
  55. package/build/components/global-styles/get-global-styles-changes.js +3 -1
  56. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  57. package/build/components/global-styles/hooks.js +0 -7
  58. package/build/components/global-styles/hooks.js.map +1 -1
  59. package/build/components/global-styles/image-settings-panel.js +1 -0
  60. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  61. package/build/components/global-styles/index.js +0 -6
  62. package/build/components/global-styles/index.js.map +1 -1
  63. package/build/components/global-styles/typography-panel.js +0 -1
  64. package/build/components/global-styles/typography-panel.js.map +1 -1
  65. package/build/components/global-styles/use-global-styles-output.js +59 -40
  66. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  67. package/build/components/global-styles/utils.js +80 -0
  68. package/build/components/global-styles/utils.js.map +1 -1
  69. package/build/components/grid/grid-item-movers.js +30 -26
  70. package/build/components/grid/grid-item-movers.js.map +1 -1
  71. package/build/components/grid/grid-item-resizer.js +14 -15
  72. package/build/components/grid/grid-item-resizer.js.map +1 -1
  73. package/build/components/grid/grid-visualizer.js +21 -6
  74. package/build/components/grid/grid-visualizer.js.map +1 -1
  75. package/build/components/grid/use-grid-layout-sync.js +56 -20
  76. package/build/components/grid/use-grid-layout-sync.js.map +1 -1
  77. package/build/components/height-control/index.js +1 -0
  78. package/build/components/height-control/index.js.map +1 -1
  79. package/build/components/iframe/index.js +2 -4
  80. package/build/components/iframe/index.js.map +1 -1
  81. package/build/components/image-editor/zoom-dropdown.js +11 -7
  82. package/build/components/image-editor/zoom-dropdown.js.map +1 -1
  83. package/build/components/inner-blocks/button-block-appender.js +8 -8
  84. package/build/components/inner-blocks/button-block-appender.js.map +1 -1
  85. package/build/components/inner-blocks/default-block-appender.js +7 -25
  86. package/build/components/inner-blocks/default-block-appender.js.map +1 -1
  87. package/build/components/inner-blocks/index.js +9 -11
  88. package/build/components/inner-blocks/index.js.map +1 -1
  89. package/build/components/inserter/category-tabs/index.js +29 -2
  90. package/build/components/inserter/category-tabs/index.js.map +1 -1
  91. package/build/components/inserter/library.js +4 -2
  92. package/build/components/inserter/library.js.map +1 -1
  93. package/build/components/inserter/menu.js +32 -14
  94. package/build/components/inserter/menu.js.map +1 -1
  95. package/build/components/inserter/quick-inserter.js +4 -0
  96. package/build/components/inserter/quick-inserter.js.map +1 -1
  97. package/build/components/line-height-control/index.js +3 -15
  98. package/build/components/line-height-control/index.js.map +1 -1
  99. package/build/components/link-control/search-input.js +0 -1
  100. package/build/components/link-control/search-input.js.map +1 -1
  101. package/build/components/media-placeholder/index.js +9 -4
  102. package/build/components/media-placeholder/index.js.map +1 -1
  103. package/build/components/media-replace-flow/index.js +3 -1
  104. package/build/components/media-replace-flow/index.js.map +1 -1
  105. package/build/components/media-upload/index.native.js +4 -1
  106. package/build/components/media-upload/index.native.js.map +1 -1
  107. package/build/components/multi-selection-inspector/index.js +12 -12
  108. package/build/components/multi-selection-inspector/index.js.map +1 -1
  109. package/build/components/resolution-tool/index.js +1 -0
  110. package/build/components/resolution-tool/index.js.map +1 -1
  111. package/build/components/skip-to-selected-block/index.js +4 -2
  112. package/build/components/skip-to-selected-block/index.js.map +1 -1
  113. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -8
  114. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  115. package/build/components/text-alignment-control/index.js +13 -8
  116. package/build/components/text-alignment-control/index.js.map +1 -1
  117. package/build/components/text-decoration-control/index.js +13 -8
  118. package/build/components/text-decoration-control/index.js.map +1 -1
  119. package/build/components/text-transform-control/index.js +13 -8
  120. package/build/components/text-transform-control/index.js.map +1 -1
  121. package/build/components/url-input/button.js +0 -1
  122. package/build/components/url-input/button.js.map +1 -1
  123. package/build/components/url-input/index.js +1 -11
  124. package/build/components/url-input/index.js.map +1 -1
  125. package/build/components/url-popover/image-url-input-ui.js +2 -0
  126. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  127. package/build/components/url-popover/link-editor.js +0 -1
  128. package/build/components/url-popover/link-editor.js.map +1 -1
  129. package/build/components/use-block-drop-zone/index.js +42 -4
  130. package/build/components/use-block-drop-zone/index.js.map +1 -1
  131. package/build/components/use-on-block-drop/index.js +3 -6
  132. package/build/components/use-on-block-drop/index.js.map +1 -1
  133. package/build/components/use-resize-canvas/index.js +1 -3
  134. package/build/components/use-resize-canvas/index.js.map +1 -1
  135. package/build/components/use-settings/index.js +2 -1
  136. package/build/components/use-settings/index.js.map +1 -1
  137. package/build/components/writing-mode-control/index.js +13 -8
  138. package/build/components/writing-mode-control/index.js.map +1 -1
  139. package/build/hooks/background.js +19 -23
  140. package/build/hooks/background.js.map +1 -1
  141. package/build/hooks/block-bindings.js +209 -39
  142. package/build/hooks/block-bindings.js.map +1 -1
  143. package/build/hooks/block-hooks.js +1 -0
  144. package/build/hooks/block-hooks.js.map +1 -1
  145. package/build/hooks/block-style-variation.js +2 -2
  146. package/build/hooks/block-style-variation.js.map +1 -1
  147. package/build/hooks/contrast-checker.js +6 -6
  148. package/build/hooks/contrast-checker.js.map +1 -1
  149. package/build/hooks/duotone.js +3 -3
  150. package/build/hooks/duotone.js.map +1 -1
  151. package/build/hooks/index.js +7 -1
  152. package/build/hooks/index.js.map +1 -1
  153. package/build/hooks/line-height.js +0 -1
  154. package/build/hooks/line-height.js.map +1 -1
  155. package/build/hooks/spacing-visualizer.js +1 -1
  156. package/build/hooks/spacing-visualizer.js.map +1 -1
  157. package/build/hooks/use-bindings-attributes.js +4 -0
  158. package/build/hooks/use-bindings-attributes.js.map +1 -1
  159. package/build/hooks/use-zoom-out.js +1 -1
  160. package/build/hooks/use-zoom-out.js.map +1 -1
  161. package/build/hooks/utils.js +20 -0
  162. package/build/hooks/utils.js.map +1 -1
  163. package/build/index.js +7 -0
  164. package/build/index.js.map +1 -1
  165. package/build/layouts/constrained.js +1 -0
  166. package/build/layouts/constrained.js.map +1 -1
  167. package/build/layouts/flex.js +2 -0
  168. package/build/layouts/flex.js.map +1 -1
  169. package/build/layouts/grid.js +3 -0
  170. package/build/layouts/grid.js.map +1 -1
  171. package/build/private-apis.js +3 -2
  172. package/build/private-apis.js.map +1 -1
  173. package/build/store/actions.js +9 -1
  174. package/build/store/actions.js.map +1 -1
  175. package/build/store/private-selectors.js +30 -0
  176. package/build/store/private-selectors.js.map +1 -1
  177. package/build/store/reducer.js +10 -1
  178. package/build/store/reducer.js.map +1 -1
  179. package/build/store/selectors.js +4 -4
  180. package/build/store/selectors.js.map +1 -1
  181. package/build/utils/block-bindings.js +112 -0
  182. package/build/utils/block-bindings.js.map +1 -0
  183. package/build/utils/get-editor-region.js +1 -1
  184. package/build/utils/get-editor-region.js.map +1 -1
  185. package/build/utils/get-px-from-css-unit.js +1 -1
  186. package/build/utils/get-px-from-css-unit.js.map +1 -1
  187. package/build-module/autocompleters/block.js +1 -1
  188. package/build-module/autocompleters/block.js.map +1 -1
  189. package/build-module/components/block-breadcrumb/index.js +4 -2
  190. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  191. package/build-module/components/block-draggable/index.js +3 -3
  192. package/build-module/components/block-draggable/index.js.map +1 -1
  193. package/build-module/components/block-list/use-block-props/index.js +2 -2
  194. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  195. package/build-module/components/block-list/use-block-props/use-block-refs.js +24 -34
  196. package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
  197. package/build-module/components/block-list/use-in-between-inserter.js +11 -4
  198. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  199. package/build-module/components/block-mover/index.js +1 -2
  200. package/build-module/components/block-mover/index.js.map +1 -1
  201. package/build-module/components/block-popover/cover.js +1 -1
  202. package/build-module/components/block-popover/cover.js.map +1 -1
  203. package/build-module/components/block-popover/inbetween.js +1 -1
  204. package/build-module/components/block-popover/inbetween.js.map +1 -1
  205. package/build-module/components/block-popover/index.js +1 -1
  206. package/build-module/components/block-popover/index.js.map +1 -1
  207. package/build-module/components/block-settings-menu/block-mode-toggle.js +29 -34
  208. package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  209. package/build-module/components/block-tools/block-selection-button.js +1 -2
  210. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  211. package/build-module/components/block-tools/index.js +1 -1
  212. package/build-module/components/block-tools/index.js.map +1 -1
  213. package/build-module/components/block-tools/insertion-point.js +14 -3
  214. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  215. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  216. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  217. package/build-module/components/block-tools/use-show-block-tools.js +2 -1
  218. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  219. package/build-module/components/block-tools/zoom-out-mode-inserters.js +23 -20
  220. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  221. package/build-module/components/block-tools/zoom-out-toolbar.js +0 -1
  222. package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
  223. package/build-module/components/border-radius-control/index.js +1 -0
  224. package/build-module/components/border-radius-control/index.js.map +1 -1
  225. package/build-module/components/child-layout-control/index.js +3 -1
  226. package/build-module/components/child-layout-control/index.js.map +1 -1
  227. package/build-module/components/convert-to-group-buttons/index.js +1 -1
  228. package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
  229. package/build-module/components/date-format-picker/index.js +2 -0
  230. package/build-module/components/date-format-picker/index.js.map +1 -1
  231. package/build-module/components/dimensions-tool/scale-tool.js +1 -0
  232. package/build-module/components/dimensions-tool/scale-tool.js.map +1 -1
  233. package/build-module/components/font-appearance-control/index.js +3 -0
  234. package/build-module/components/font-appearance-control/index.js.map +1 -1
  235. package/build-module/components/font-family/index.js +14 -0
  236. package/build-module/components/font-family/index.js.map +1 -1
  237. package/build-module/components/global-styles/background-panel.js +156 -80
  238. package/build-module/components/global-styles/background-panel.js.map +1 -1
  239. package/build-module/components/global-styles/get-global-styles-changes.js +3 -1
  240. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  241. package/build-module/components/global-styles/hooks.js +0 -6
  242. package/build-module/components/global-styles/hooks.js.map +1 -1
  243. package/build-module/components/global-styles/image-settings-panel.js +1 -0
  244. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  245. package/build-module/components/global-styles/index.js +1 -1
  246. package/build-module/components/global-styles/index.js.map +1 -1
  247. package/build-module/components/global-styles/typography-panel.js +0 -1
  248. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  249. package/build-module/components/global-styles/use-global-styles-output.js +61 -42
  250. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  251. package/build-module/components/global-styles/utils.js +77 -0
  252. package/build-module/components/global-styles/utils.js.map +1 -1
  253. package/build-module/components/grid/grid-item-movers.js +30 -26
  254. package/build-module/components/grid/grid-item-movers.js.map +1 -1
  255. package/build-module/components/grid/grid-item-resizer.js +14 -15
  256. package/build-module/components/grid/grid-item-resizer.js.map +1 -1
  257. package/build-module/components/grid/grid-visualizer.js +21 -6
  258. package/build-module/components/grid/grid-visualizer.js.map +1 -1
  259. package/build-module/components/grid/use-grid-layout-sync.js +56 -20
  260. package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
  261. package/build-module/components/height-control/index.js +1 -0
  262. package/build-module/components/height-control/index.js.map +1 -1
  263. package/build-module/components/iframe/index.js +2 -4
  264. package/build-module/components/iframe/index.js.map +1 -1
  265. package/build-module/components/image-editor/zoom-dropdown.js +12 -8
  266. package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
  267. package/build-module/components/inner-blocks/button-block-appender.js +7 -6
  268. package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
  269. package/build-module/components/inner-blocks/default-block-appender.js +6 -23
  270. package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
  271. package/build-module/components/inner-blocks/index.js +9 -11
  272. package/build-module/components/inner-blocks/index.js.map +1 -1
  273. package/build-module/components/inserter/category-tabs/index.js +30 -3
  274. package/build-module/components/inserter/category-tabs/index.js.map +1 -1
  275. package/build-module/components/inserter/library.js +4 -2
  276. package/build-module/components/inserter/library.js.map +1 -1
  277. package/build-module/components/inserter/menu.js +32 -14
  278. package/build-module/components/inserter/menu.js.map +1 -1
  279. package/build-module/components/inserter/quick-inserter.js +5 -1
  280. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  281. package/build-module/components/line-height-control/index.js +3 -14
  282. package/build-module/components/line-height-control/index.js.map +1 -1
  283. package/build-module/components/link-control/search-input.js +0 -1
  284. package/build-module/components/link-control/search-input.js.map +1 -1
  285. package/build-module/components/media-placeholder/index.js +9 -4
  286. package/build-module/components/media-placeholder/index.js.map +1 -1
  287. package/build-module/components/media-replace-flow/index.js +3 -1
  288. package/build-module/components/media-replace-flow/index.js.map +1 -1
  289. package/build-module/components/media-upload/index.native.js +4 -1
  290. package/build-module/components/media-upload/index.native.js.map +1 -1
  291. package/build-module/components/multi-selection-inspector/index.js +12 -12
  292. package/build-module/components/multi-selection-inspector/index.js.map +1 -1
  293. package/build-module/components/resolution-tool/index.js +1 -0
  294. package/build-module/components/resolution-tool/index.js.map +1 -1
  295. package/build-module/components/skip-to-selected-block/index.js +5 -3
  296. package/build-module/components/skip-to-selected-block/index.js.map +1 -1
  297. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -8
  298. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  299. package/build-module/components/text-alignment-control/index.js +13 -8
  300. package/build-module/components/text-alignment-control/index.js.map +1 -1
  301. package/build-module/components/text-decoration-control/index.js +13 -8
  302. package/build-module/components/text-decoration-control/index.js.map +1 -1
  303. package/build-module/components/text-transform-control/index.js +13 -8
  304. package/build-module/components/text-transform-control/index.js.map +1 -1
  305. package/build-module/components/url-input/button.js +0 -1
  306. package/build-module/components/url-input/button.js.map +1 -1
  307. package/build-module/components/url-input/index.js +1 -11
  308. package/build-module/components/url-input/index.js.map +1 -1
  309. package/build-module/components/url-popover/image-url-input-ui.js +2 -0
  310. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  311. package/build-module/components/url-popover/link-editor.js +0 -1
  312. package/build-module/components/url-popover/link-editor.js.map +1 -1
  313. package/build-module/components/use-block-drop-zone/index.js +42 -4
  314. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  315. package/build-module/components/use-on-block-drop/index.js +3 -6
  316. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  317. package/build-module/components/use-resize-canvas/index.js +1 -3
  318. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  319. package/build-module/components/use-settings/index.js +2 -1
  320. package/build-module/components/use-settings/index.js.map +1 -1
  321. package/build-module/components/writing-mode-control/index.js +13 -8
  322. package/build-module/components/writing-mode-control/index.js.map +1 -1
  323. package/build-module/hooks/background.js +19 -23
  324. package/build-module/hooks/background.js.map +1 -1
  325. package/build-module/hooks/block-bindings.js +214 -43
  326. package/build-module/hooks/block-bindings.js.map +1 -1
  327. package/build-module/hooks/block-hooks.js +1 -0
  328. package/build-module/hooks/block-hooks.js.map +1 -1
  329. package/build-module/hooks/block-style-variation.js +3 -3
  330. package/build-module/hooks/block-style-variation.js.map +1 -1
  331. package/build-module/hooks/contrast-checker.js +7 -7
  332. package/build-module/hooks/contrast-checker.js.map +1 -1
  333. package/build-module/hooks/duotone.js +4 -4
  334. package/build-module/hooks/duotone.js.map +1 -1
  335. package/build-module/hooks/index.js +2 -1
  336. package/build-module/hooks/index.js.map +1 -1
  337. package/build-module/hooks/line-height.js +0 -1
  338. package/build-module/hooks/line-height.js.map +1 -1
  339. package/build-module/hooks/spacing-visualizer.js +1 -1
  340. package/build-module/hooks/spacing-visualizer.js.map +1 -1
  341. package/build-module/hooks/use-bindings-attributes.js +3 -0
  342. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  343. package/build-module/hooks/use-zoom-out.js +1 -1
  344. package/build-module/hooks/use-zoom-out.js.map +1 -1
  345. package/build-module/hooks/utils.js +19 -0
  346. package/build-module/hooks/utils.js.map +1 -1
  347. package/build-module/index.js +1 -1
  348. package/build-module/index.js.map +1 -1
  349. package/build-module/layouts/constrained.js +1 -0
  350. package/build-module/layouts/constrained.js.map +1 -1
  351. package/build-module/layouts/flex.js +2 -0
  352. package/build-module/layouts/flex.js.map +1 -1
  353. package/build-module/layouts/grid.js +3 -0
  354. package/build-module/layouts/grid.js.map +1 -1
  355. package/build-module/private-apis.js +4 -3
  356. package/build-module/private-apis.js.map +1 -1
  357. package/build-module/store/actions.js +9 -1
  358. package/build-module/store/actions.js.map +1 -1
  359. package/build-module/store/private-selectors.js +27 -0
  360. package/build-module/store/private-selectors.js.map +1 -1
  361. package/build-module/store/reducer.js +9 -1
  362. package/build-module/store/reducer.js.map +1 -1
  363. package/build-module/store/selectors.js +4 -4
  364. package/build-module/store/selectors.js.map +1 -1
  365. package/build-module/utils/block-bindings.js +105 -0
  366. package/build-module/utils/block-bindings.js.map +1 -0
  367. package/build-module/utils/get-editor-region.js +1 -1
  368. package/build-module/utils/get-editor-region.js.map +1 -1
  369. package/build-module/utils/get-px-from-css-unit.js +1 -1
  370. package/build-module/utils/get-px-from-css-unit.js.map +1 -1
  371. package/build-style/content-rtl.css +12 -26
  372. package/build-style/content.css +12 -26
  373. package/build-style/default-editor-styles-rtl.css +5 -2
  374. package/build-style/default-editor-styles.css +5 -2
  375. package/build-style/style-rtl.css +123 -83
  376. package/build-style/style.css +123 -83
  377. package/package.json +32 -32
  378. package/src/autocompleters/block.js +2 -1
  379. package/src/autocompleters/style.scss +4 -0
  380. package/src/components/block-breadcrumb/index.js +4 -2
  381. package/src/components/block-canvas/style.scss +1 -0
  382. package/src/components/block-draggable/index.js +3 -3
  383. package/src/components/block-list/content.scss +5 -13
  384. package/src/components/block-list/use-block-props/index.js +2 -2
  385. package/src/components/block-list/use-block-props/use-block-refs.js +27 -43
  386. package/src/components/block-list/use-in-between-inserter.js +17 -5
  387. package/src/components/block-mover/index.js +5 -2
  388. package/src/components/block-popover/cover.js +1 -1
  389. package/src/components/block-popover/inbetween.js +1 -1
  390. package/src/components/block-popover/index.js +1 -1
  391. package/src/components/block-settings-menu/block-mode-toggle.js +28 -31
  392. package/src/components/block-settings-menu/test/block-mode-toggle.js +26 -23
  393. package/src/components/block-tools/block-selection-button.js +1 -2
  394. package/src/components/block-tools/index.js +5 -6
  395. package/src/components/block-tools/insertion-point.js +11 -0
  396. package/src/components/block-tools/style.scss +1 -1
  397. package/src/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  398. package/src/components/block-tools/use-show-block-tools.js +4 -1
  399. package/src/components/block-tools/zoom-out-mode-inserters.js +21 -19
  400. package/src/components/block-tools/zoom-out-toolbar.js +0 -1
  401. package/src/components/block-variation-transforms/style.scss +1 -1
  402. package/src/components/border-radius-control/index.js +1 -0
  403. package/src/components/border-radius-control/style.scss +0 -10
  404. package/src/components/button-block-appender/content.scss +1 -1
  405. package/src/components/child-layout-control/index.js +2 -0
  406. package/src/components/color-palette/test/__snapshots__/control.js.snap +2 -2
  407. package/src/components/colors-gradients/test/control.js +3 -2
  408. package/src/components/convert-to-group-buttons/index.js +1 -1
  409. package/src/components/date-format-picker/index.js +2 -0
  410. package/src/components/dimensions-tool/scale-tool.js +1 -0
  411. package/src/components/font-appearance-control/index.js +3 -0
  412. package/src/components/font-family/README.md +17 -0
  413. package/src/components/font-family/index.js +19 -0
  414. package/src/components/font-family/stories/index.story.js +54 -0
  415. package/src/components/global-styles/background-panel.js +180 -93
  416. package/src/components/global-styles/get-global-styles-changes.js +4 -1
  417. package/src/components/global-styles/hooks.js +0 -5
  418. package/src/components/global-styles/image-settings-panel.js +1 -0
  419. package/src/components/global-styles/index.js +0 -1
  420. package/src/components/global-styles/style.scss +13 -12
  421. package/src/components/global-styles/test/use-global-styles-output.js +68 -7
  422. package/src/components/global-styles/test/utils.js +120 -0
  423. package/src/components/global-styles/typography-panel.js +0 -1
  424. package/src/components/global-styles/use-global-styles-output.js +71 -53
  425. package/src/components/global-styles/utils.js +90 -0
  426. package/src/components/grid/grid-item-movers.js +46 -44
  427. package/src/components/grid/grid-item-resizer.js +11 -17
  428. package/src/components/grid/grid-visualizer.js +23 -8
  429. package/src/components/grid/style.scss +60 -10
  430. package/src/components/grid/use-grid-layout-sync.js +68 -14
  431. package/src/components/height-control/index.js +1 -0
  432. package/src/components/iframe/content.scss +2 -2
  433. package/src/components/iframe/index.js +1 -3
  434. package/src/components/image-editor/zoom-dropdown.js +17 -9
  435. package/src/components/inner-blocks/button-block-appender.js +5 -7
  436. package/src/components/inner-blocks/default-block-appender.js +4 -23
  437. package/src/components/inner-blocks/index.js +10 -9
  438. package/src/components/inserter/category-tabs/index.js +35 -2
  439. package/src/components/inserter/library.js +2 -0
  440. package/src/components/inserter/menu.js +34 -29
  441. package/src/components/inserter/quick-inserter.js +4 -1
  442. package/src/components/inserter/style.scss +17 -12
  443. package/src/components/inserter-list-item/style.scss +1 -0
  444. package/src/components/inspector-controls/README.md +5 -0
  445. package/src/components/line-height-control/README.md +4 -5
  446. package/src/components/line-height-control/index.js +4 -21
  447. package/src/components/line-height-control/stories/index.story.js +0 -1
  448. package/src/components/line-height-control/test/index.js +1 -7
  449. package/src/components/link-control/search-input.js +0 -1
  450. package/src/components/link-control/style.scss +1 -1
  451. package/src/components/media-placeholder/index.js +12 -7
  452. package/src/components/media-replace-flow/README.md +7 -0
  453. package/src/components/media-replace-flow/index.js +3 -1
  454. package/src/components/media-upload/README.md +2 -0
  455. package/src/components/media-upload/index.native.js +2 -0
  456. package/src/components/multi-selection-inspector/index.js +8 -9
  457. package/src/components/resolution-tool/index.js +1 -0
  458. package/src/components/responsive-block-control/README.md +1 -0
  459. package/src/components/responsive-block-control/test/index.js +6 -1
  460. package/src/components/skip-to-selected-block/index.js +5 -3
  461. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +11 -10
  462. package/src/components/spacing-sizes-control/style.scss +16 -16
  463. package/src/components/tabbed-sidebar/style.scss +1 -19
  464. package/src/components/text-alignment-control/index.js +20 -8
  465. package/src/components/text-decoration-control/index.js +20 -8
  466. package/src/components/text-decoration-control/stories/index.story.js +0 -4
  467. package/src/components/text-transform-control/index.js +20 -8
  468. package/src/components/text-transform-control/stories/index.story.js +0 -4
  469. package/src/components/url-input/README.md +0 -5
  470. package/src/components/url-input/button.js +0 -1
  471. package/src/components/url-input/index.js +1 -15
  472. package/src/components/url-input/style.scss +2 -2
  473. package/src/components/url-popover/image-url-input-ui.js +2 -0
  474. package/src/components/url-popover/link-editor.js +0 -1
  475. package/src/components/use-block-drop-zone/index.js +86 -16
  476. package/src/components/use-on-block-drop/index.js +1 -9
  477. package/src/components/use-resize-canvas/index.js +1 -3
  478. package/src/components/use-settings/index.js +2 -1
  479. package/src/components/writing-mode-control/index.js +20 -8
  480. package/src/hooks/background.js +21 -27
  481. package/src/hooks/block-bindings.js +248 -54
  482. package/src/hooks/block-bindings.scss +13 -2
  483. package/src/hooks/block-hooks.js +1 -0
  484. package/src/hooks/block-hooks.scss +1 -0
  485. package/src/hooks/block-style-variation.js +3 -3
  486. package/src/hooks/contrast-checker.js +7 -7
  487. package/src/hooks/duotone.js +4 -4
  488. package/src/hooks/index.js +2 -1
  489. package/src/hooks/line-height.js +0 -1
  490. package/src/hooks/spacing-visualizer.js +1 -1
  491. package/src/hooks/test/background.js +60 -0
  492. package/src/hooks/use-bindings-attributes.js +4 -0
  493. package/src/hooks/use-editor-wrapper-styles.native.scss +1 -0
  494. package/src/hooks/use-zoom-out.js +1 -1
  495. package/src/hooks/utils.js +14 -1
  496. package/src/index.js +1 -0
  497. package/src/layouts/constrained.js +1 -0
  498. package/src/layouts/flex.js +2 -0
  499. package/src/layouts/grid.js +3 -0
  500. package/src/private-apis.js +3 -2
  501. package/src/store/actions.js +13 -5
  502. package/src/store/private-selectors.js +36 -0
  503. package/src/store/reducer.js +7 -0
  504. package/src/store/selectors.js +4 -4
  505. package/src/store/test/private-selectors.js +89 -0
  506. package/src/style.scss +1 -2
  507. package/src/utils/block-bindings.js +98 -0
  508. package/src/utils/get-editor-region.js +1 -1
  509. package/src/utils/get-px-from-css-unit.js +1 -1
  510. package/src/utils/test/transform-styles.js +49 -0
  511. package/tsconfig.tsbuildinfo +1 -1
  512. package/build/components/global-styles/theme-file-uri-utils.js +0 -80
  513. package/build/components/global-styles/theme-file-uri-utils.js.map +0 -1
  514. package/build/components/inner-blocks/with-client-id.js +0 -28
  515. package/build/components/inner-blocks/with-client-id.js.map +0 -1
  516. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -30
  517. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
  518. package/build/components/segmented-text-control/index.js +0 -63
  519. package/build/components/segmented-text-control/index.js.map +0 -1
  520. package/build-module/components/global-styles/theme-file-uri-utils.js +0 -73
  521. package/build-module/components/global-styles/theme-file-uri-utils.js.map +0 -1
  522. package/build-module/components/inner-blocks/with-client-id.js +0 -21
  523. package/build-module/components/inner-blocks/with-client-id.js.map +0 -1
  524. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -23
  525. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
  526. package/build-module/components/segmented-text-control/index.js +0 -58
  527. package/build-module/components/segmented-text-control/index.js.map +0 -1
  528. package/src/components/global-styles/test/theme-file-uri-utils.js +0 -66
  529. package/src/components/global-styles/theme-file-uri-utils.js +0 -77
  530. package/src/components/inner-blocks/with-client-id.js +0 -19
  531. package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -25
  532. package/src/components/segmented-text-control/index.js +0 -63
  533. package/src/components/segmented-text-control/style.scss +0 -15
@@ -226,15 +226,15 @@ function useDuotoneStyles({
226
226
  });
227
227
  const selector = selectorsScoped.join(', ');
228
228
  const isValidFilter = Array.isArray(colors) || colors === 'unset';
229
- (0, _utils3.useStyleOverride)(isValidFilter ? {
229
+ (0, _utils3.usePrivateStyleOverride)(isValidFilter ? {
230
230
  css: colors !== 'unset' ? (0, _utils.getDuotoneStylesheet)(selector, filterId) : (0, _utils.getDuotoneUnsetStylesheet)(selector),
231
231
  __unstableType: 'presets'
232
232
  } : undefined);
233
- (0, _utils3.useStyleOverride)(isValidFilter ? {
233
+ (0, _utils3.usePrivateStyleOverride)(isValidFilter ? {
234
234
  assets: colors !== 'unset' ? (0, _utils.getDuotoneFilter)(filterId, colors) : '',
235
235
  __unstableType: 'svgs'
236
236
  } : undefined);
237
- const blockElement = (0, _useBlockRefs.__unstableUseBlockElement)(clientId);
237
+ const blockElement = (0, _useBlockRefs.useBlockElement)(clientId);
238
238
  (0, _element.useEffect)(() => {
239
239
  if (!isValidFilter) {
240
240
  return;
@@ -1 +1 @@
1
- {"version":3,"names":["_colord","require","_names","_interopRequireDefault","_blocks","_compose","_hooks","_element","_components","_utils","_getBlockCssSelector","_utils2","_utils3","_filtersPanel","_blockEditingMode","_useBlockRefs","_jsxRuntime","EMPTY_ARRAY","isSafari","window","navigator","userAgent","includes","extend","namesPlugin","useMultiOriginPresets","presetSetting","defaultSetting","enableDefault","userPresets","themePresets","defaultPresets","useSettings","useMemo","getColorsFromDuotonePreset","duotone","duotonePalette","preset","find","slug","colors","undefined","getDuotonePresetFromColors","Array","isArray","duotonePreset","every","val","index","DuotonePanelPure","style","setAttributes","name","duotoneStyle","color","settings","useBlockSettings","blockEditingMode","useBlockEditingMode","colorPalette","enableCustomColors","enableCustomDuotone","disableCustomColors","disableCustomDuotone","length","duotonePresetOrColors","jsxs","Fragment","children","jsx","InspectorControls","group","default","value","filter","onChange","newDuotone","newStyle","BlockControls","__experimentalShareWithChildBlocks","__experimentalDuotoneControl","maybePreset","_default","exports","shareWithChildBlocks","edit","useBlockProps","attributeKeys","hasSupport","hasBlockSupport","addDuotoneAttributes","attributes","Object","assign","type","useDuotoneStyles","clientId","id","filterId","selector","duotoneSelector","attribute","duotoneAttr","isCustom","isPreset","isCSS","selectors","split","selectorsScoped","map","selectorPart","trim","join","isValidFilter","useStyleOverride","css","getDuotoneStylesheet","getDuotoneUnsetStylesheet","__unstableType","assets","getDuotoneFilter","blockElement","useBlockElement","useEffect","display","offsetHeight","useInstanceId","blockType","getBlockType","duotoneSupport","getBlockSupport","experimentalDuotone","rootSelector","getBlockCSSSelector","scopeSelector","fallback","filterClass","shouldRender","className","addFilter"],"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSettings,\n} from '../components';\nimport {\n\tgetDuotoneFilter,\n\tgetDuotoneStylesheet,\n\tgetDuotoneUnsetStylesheet,\n} from '../components/duotone/utils';\nimport { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockSettings, useStyleOverride } from './utils';\nimport { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { __unstableUseBlockElement as useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nconst EMPTY_ARRAY = [];\n\n// Safari does not always update the duotone filter when the duotone colors\n// are changed. This browser check is later used to force a re-render of the block\n// element to ensure the duotone filter is updated. The check is included at the\n// root of this file as it only needs to be run once per page load.\nconst isSafari =\n\twindow?.navigator.userAgent &&\n\twindow.navigator.userAgent.includes( 'Safari' ) &&\n\t! window.navigator.userAgent.includes( 'Chrome' ) &&\n\t! window.navigator.userAgent.includes( 'Chromium' );\n\nextend( [ namesPlugin ] );\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst [ enableDefault, userPresets, themePresets, defaultPresets ] =\n\t\tuseSettings(\n\t\t\tdefaultSetting,\n\t\t\t`${ presetSetting }.custom`,\n\t\t\t`${ presetSetting }.theme`,\n\t\t\t`${ presetSetting }.default`\n\t\t);\n\treturn useMemo(\n\t\t() => [\n\t\t\t...( userPresets || EMPTY_ARRAY ),\n\t\t\t...( themePresets || EMPTY_ARRAY ),\n\t\t\t...( ( enableDefault && defaultPresets ) || EMPTY_ARRAY ),\n\t\t],\n\t\t[ enableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function getColorsFromDuotonePreset( duotone, duotonePalette ) {\n\tif ( ! duotone ) {\n\t\treturn;\n\t}\n\tconst preset = duotonePalette?.find( ( { slug } ) => {\n\t\treturn duotone === `var:preset|duotone|${ slug }`;\n\t} );\n\n\treturn preset ? preset.colors : undefined;\n}\n\nexport function getDuotonePresetFromColors( colors, duotonePalette ) {\n\tif ( ! colors || ! Array.isArray( colors ) ) {\n\t\treturn;\n\t}\n\n\tconst preset = duotonePalette?.find( ( duotonePreset ) => {\n\t\treturn duotonePreset?.colors?.every(\n\t\t\t( val, index ) => val === colors[ index ]\n\t\t);\n\t} );\n\n\treturn preset ? `var:preset|duotone|${ preset.slug }` : undefined;\n}\n\nfunction DuotonePanelPure( { style, setAttributes, name } ) {\n\tconst duotoneStyle = style?.color?.duotone;\n\tconst settings = useBlockSettings( name );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst [ enableCustomColors, enableCustomDuotone ] = useSettings(\n\t\t'color.custom',\n\t\t'color.customDuotone'\n\t);\n\tconst disableCustomColors = ! enableCustomColors;\n\tconst disableCustomDuotone =\n\t\t! enableCustomDuotone ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst duotonePresetOrColors = ! Array.isArray( duotoneStyle )\n\t\t? getColorsFromDuotonePreset( duotoneStyle, duotonePalette )\n\t\t: duotoneStyle;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"filter\">\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tvalue={ { filter: { duotone: duotonePresetOrColors } } }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...newDuotone?.filter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<DuotoneControl\n\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tvalue={ duotonePresetOrColors }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst maybePreset = getDuotonePresetFromColors(\n\t\t\t\t\t\t\tnewDuotone,\n\t\t\t\t\t\t\tduotonePalette\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\t\tduotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: DuotonePanelPure,\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'filter.duotone' );\n\t},\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\tif ( ! hasBlockSupport( settings, 'filter.duotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// 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\nfunction useDuotoneStyles( {\n\tclientId,\n\tid: filterId,\n\tselector: duotoneSelector,\n\tattribute: duotoneAttr,\n} ) {\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\n\t// Possible values for duotone attribute:\n\t// 1. Array of colors - e.g. ['#000000', '#ffffff'].\n\t// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''\n\t// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.\n\tconst isCustom = Array.isArray( duotoneAttr );\n\tconst duotonePreset = isCustom\n\t\t? undefined\n\t\t: getColorsFromDuotonePreset( duotoneAttr, duotonePalette );\n\tconst isPreset = typeof duotoneAttr === 'string' && duotonePreset;\n\tconst isCSS = typeof duotoneAttr === 'string' && ! isPreset;\n\n\t// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.\n\tlet colors = null;\n\tif ( isPreset ) {\n\t\t// Array of colors.\n\t\tcolors = duotonePreset;\n\t} else if ( isCSS ) {\n\t\t// CSS filter property string (e.g. 'unset').\n\t\tcolors = duotoneAttr;\n\t} else if ( isCustom ) {\n\t\t// Array of colors.\n\t\tcolors = duotoneAttr;\n\t}\n\n\t// Build the CSS selectors to which the filter will be applied.\n\tconst selectors = duotoneSelector.split( ',' );\n\n\tconst selectorsScoped = selectors.map( ( selectorPart ) => {\n\t\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t\t// since we're not using inline styles to apply the filter. We need to\n\t\t// override duotone applied by global styles and theme.json.\n\n\t\t// Assuming the selector part is a subclass selector (not a tag name)\n\t\t// so we can prepend the filter id class. If we want to support elements\n\t\t// such as `img` or namespaces, we'll need to add a case for that here.\n\t\treturn `.${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\tuseStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tcss:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneStylesheet( selector, filterId )\n\t\t\t\t\t\t\t: getDuotoneUnsetStylesheet( selector ),\n\t\t\t\t\t__unstableType: 'presets',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\tuseStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tassets:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneFilter( filterId, colors )\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t__unstableType: 'svgs',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\n\tconst blockElement = useBlockElement( clientId );\n\n\tuseEffect( () => {\n\t\tif ( ! isValidFilter ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Safari does not always update the duotone filter when the duotone\n\t\t// colors are changed. When using Safari, force the block element to be\n\t\t// repainted by the browser to ensure any changes are reflected\n\t\t// visually. This logic matches that used on the site frontend in\n\t\t// `block-supports/duotone.php`.\n\t\tif ( blockElement && isSafari ) {\n\t\t\tconst display = blockElement.style.display;\n\t\t\t// Switch to `inline-block` to force a repaint. In the editor,\n\t\t\t// `inline-block` is used instead of `none` to ensure that scroll\n\t\t\t// position is not affected, as `none` results in the editor\n\t\t\t// scrolling to the top of the block.\n\t\t\tblockElement.style.display = 'inline-block';\n\t\t\t// Simply accessing el.offsetHeight flushes layout and style changes\n\t\t\t// in WebKit without having to wait for setTimeout.\n\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\tblockElement.offsetHeight;\n\t\t\tblockElement.style.display = display;\n\t\t}\n\t\t// `colors` must be a dependency so this effect runs when the colors\n\t\t// change in Safari.\n\t}, [ isValidFilter, blockElement, colors ] );\n}\n\nfunction useBlockProps( { clientId, name, style } ) {\n\tconst id = useInstanceId( useBlockProps );\n\tconst selector = useMemo( () => {\n\t\tconst blockType = getBlockType( name );\n\n\t\tif ( blockType ) {\n\t\t\t// Backwards compatibility for `supports.color.__experimentalDuotone`\n\t\t\t// is provided via the `block_type_metadata_settings` filter. If\n\t\t\t// `supports.filter.duotone` has not been set and the\n\t\t\t// experimental property has been, the experimental property\n\t\t\t// value is copied into `supports.filter.duotone`.\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'filter.duotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( ! duotoneSupport ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// If the experimental duotone support was set, that value is\n\t\t\t// to be treated as a selector and requires scoping.\n\t\t\tconst experimentalDuotone = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( experimentalDuotone ) {\n\t\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\t\treturn typeof experimentalDuotone === 'string'\n\t\t\t\t\t? scopeSelector( rootSelector, experimentalDuotone )\n\t\t\t\t\t: rootSelector;\n\t\t\t}\n\n\t\t\t// Regular filter.duotone support uses filter.duotone selectors with fallbacks.\n\t\t\treturn getBlockCSSSelector( blockType, 'filter.duotone', {\n\t\t\t\tfallback: true,\n\t\t\t} );\n\t\t}\n\t}, [ name ] );\n\n\tconst attribute = style?.color?.duotone;\n\n\tconst filterClass = `wp-duotone-${ id }`;\n\n\tconst shouldRender = selector && attribute;\n\n\tuseDuotoneStyles( {\n\t\tclientId,\n\t\tid: filterClass,\n\t\tselector,\n\t\tattribute,\n\t} );\n\n\treturn {\n\t\tclassName: shouldRender ? filterClass : '',\n\t};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA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,EAAED,YAAY,GAAGD,WAAW,GAAG;EACzC,CAAC;AACF;AAEA,IAAAG,gBAAS,EACR,0BAA0B,EAC1B,oCAAoC,EACpCjD,oBACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_colord","require","_names","_interopRequireDefault","_blocks","_compose","_hooks","_element","_components","_utils","_getBlockCssSelector","_utils2","_utils3","_filtersPanel","_blockEditingMode","_useBlockRefs","_jsxRuntime","EMPTY_ARRAY","isSafari","window","navigator","userAgent","includes","extend","namesPlugin","useMultiOriginPresets","presetSetting","defaultSetting","enableDefault","userPresets","themePresets","defaultPresets","useSettings","useMemo","getColorsFromDuotonePreset","duotone","duotonePalette","preset","find","slug","colors","undefined","getDuotonePresetFromColors","Array","isArray","duotonePreset","every","val","index","DuotonePanelPure","style","setAttributes","name","duotoneStyle","color","settings","useBlockSettings","blockEditingMode","useBlockEditingMode","colorPalette","enableCustomColors","enableCustomDuotone","disableCustomColors","disableCustomDuotone","length","duotonePresetOrColors","jsxs","Fragment","children","jsx","InspectorControls","group","default","value","filter","onChange","newDuotone","newStyle","BlockControls","__experimentalShareWithChildBlocks","__experimentalDuotoneControl","maybePreset","_default","exports","shareWithChildBlocks","edit","useBlockProps","attributeKeys","hasSupport","hasBlockSupport","addDuotoneAttributes","attributes","Object","assign","type","useDuotoneStyles","clientId","id","filterId","selector","duotoneSelector","attribute","duotoneAttr","isCustom","isPreset","isCSS","selectors","split","selectorsScoped","map","selectorPart","trim","join","isValidFilter","usePrivateStyleOverride","css","getDuotoneStylesheet","getDuotoneUnsetStylesheet","__unstableType","assets","getDuotoneFilter","blockElement","useBlockElement","useEffect","display","offsetHeight","useInstanceId","blockType","getBlockType","duotoneSupport","getBlockSupport","experimentalDuotone","rootSelector","getBlockCSSSelector","scopeSelector","fallback","filterClass","shouldRender","className","addFilter"],"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSettings,\n} from '../components';\nimport {\n\tgetDuotoneFilter,\n\tgetDuotoneStylesheet,\n\tgetDuotoneUnsetStylesheet,\n} from '../components/duotone/utils';\nimport { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockSettings, usePrivateStyleOverride } from './utils';\nimport { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nconst EMPTY_ARRAY = [];\n\n// Safari does not always update the duotone filter when the duotone colors\n// are changed. This browser check is later used to force a re-render of the block\n// element to ensure the duotone filter is updated. The check is included at the\n// root of this file as it only needs to be run once per page load.\nconst isSafari =\n\twindow?.navigator.userAgent &&\n\twindow.navigator.userAgent.includes( 'Safari' ) &&\n\t! window.navigator.userAgent.includes( 'Chrome' ) &&\n\t! window.navigator.userAgent.includes( 'Chromium' );\n\nextend( [ namesPlugin ] );\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst [ enableDefault, userPresets, themePresets, defaultPresets ] =\n\t\tuseSettings(\n\t\t\tdefaultSetting,\n\t\t\t`${ presetSetting }.custom`,\n\t\t\t`${ presetSetting }.theme`,\n\t\t\t`${ presetSetting }.default`\n\t\t);\n\treturn useMemo(\n\t\t() => [\n\t\t\t...( userPresets || EMPTY_ARRAY ),\n\t\t\t...( themePresets || EMPTY_ARRAY ),\n\t\t\t...( ( enableDefault && defaultPresets ) || EMPTY_ARRAY ),\n\t\t],\n\t\t[ enableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function getColorsFromDuotonePreset( duotone, duotonePalette ) {\n\tif ( ! duotone ) {\n\t\treturn;\n\t}\n\tconst preset = duotonePalette?.find( ( { slug } ) => {\n\t\treturn duotone === `var:preset|duotone|${ slug }`;\n\t} );\n\n\treturn preset ? preset.colors : undefined;\n}\n\nexport function getDuotonePresetFromColors( colors, duotonePalette ) {\n\tif ( ! colors || ! Array.isArray( colors ) ) {\n\t\treturn;\n\t}\n\n\tconst preset = duotonePalette?.find( ( duotonePreset ) => {\n\t\treturn duotonePreset?.colors?.every(\n\t\t\t( val, index ) => val === colors[ index ]\n\t\t);\n\t} );\n\n\treturn preset ? `var:preset|duotone|${ preset.slug }` : undefined;\n}\n\nfunction DuotonePanelPure( { style, setAttributes, name } ) {\n\tconst duotoneStyle = style?.color?.duotone;\n\tconst settings = useBlockSettings( name );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst [ enableCustomColors, enableCustomDuotone ] = useSettings(\n\t\t'color.custom',\n\t\t'color.customDuotone'\n\t);\n\tconst disableCustomColors = ! enableCustomColors;\n\tconst disableCustomDuotone =\n\t\t! enableCustomDuotone ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst duotonePresetOrColors = ! Array.isArray( duotoneStyle )\n\t\t? getColorsFromDuotonePreset( duotoneStyle, duotonePalette )\n\t\t: duotoneStyle;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"filter\">\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tvalue={ { filter: { duotone: duotonePresetOrColors } } }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...newDuotone?.filter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<DuotoneControl\n\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tvalue={ duotonePresetOrColors }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst maybePreset = getDuotonePresetFromColors(\n\t\t\t\t\t\t\tnewDuotone,\n\t\t\t\t\t\t\tduotonePalette\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\t\tduotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: DuotonePanelPure,\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'filter.duotone' );\n\t},\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\tif ( ! hasBlockSupport( settings, 'filter.duotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// 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\nfunction useDuotoneStyles( {\n\tclientId,\n\tid: filterId,\n\tselector: duotoneSelector,\n\tattribute: duotoneAttr,\n} ) {\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\n\t// Possible values for duotone attribute:\n\t// 1. Array of colors - e.g. ['#000000', '#ffffff'].\n\t// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''\n\t// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.\n\tconst isCustom = Array.isArray( duotoneAttr );\n\tconst duotonePreset = isCustom\n\t\t? undefined\n\t\t: getColorsFromDuotonePreset( duotoneAttr, duotonePalette );\n\tconst isPreset = typeof duotoneAttr === 'string' && duotonePreset;\n\tconst isCSS = typeof duotoneAttr === 'string' && ! isPreset;\n\n\t// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.\n\tlet colors = null;\n\tif ( isPreset ) {\n\t\t// Array of colors.\n\t\tcolors = duotonePreset;\n\t} else if ( isCSS ) {\n\t\t// CSS filter property string (e.g. 'unset').\n\t\tcolors = duotoneAttr;\n\t} else if ( isCustom ) {\n\t\t// Array of colors.\n\t\tcolors = duotoneAttr;\n\t}\n\n\t// Build the CSS selectors to which the filter will be applied.\n\tconst selectors = duotoneSelector.split( ',' );\n\n\tconst selectorsScoped = selectors.map( ( selectorPart ) => {\n\t\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t\t// since we're not using inline styles to apply the filter. We need to\n\t\t// override duotone applied by global styles and theme.json.\n\n\t\t// Assuming the selector part is a subclass selector (not a tag name)\n\t\t// so we can prepend the filter id class. If we want to support elements\n\t\t// such as `img` or namespaces, we'll need to add a case for that here.\n\t\treturn `.${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\tusePrivateStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tcss:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneStylesheet( selector, filterId )\n\t\t\t\t\t\t\t: getDuotoneUnsetStylesheet( selector ),\n\t\t\t\t\t__unstableType: 'presets',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\tusePrivateStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tassets:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneFilter( filterId, colors )\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t__unstableType: 'svgs',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\n\tconst blockElement = useBlockElement( clientId );\n\n\tuseEffect( () => {\n\t\tif ( ! isValidFilter ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Safari does not always update the duotone filter when the duotone\n\t\t// colors are changed. When using Safari, force the block element to be\n\t\t// repainted by the browser to ensure any changes are reflected\n\t\t// visually. This logic matches that used on the site frontend in\n\t\t// `block-supports/duotone.php`.\n\t\tif ( blockElement && isSafari ) {\n\t\t\tconst display = blockElement.style.display;\n\t\t\t// Switch to `inline-block` to force a repaint. In the editor,\n\t\t\t// `inline-block` is used instead of `none` to ensure that scroll\n\t\t\t// position is not affected, as `none` results in the editor\n\t\t\t// scrolling to the top of the block.\n\t\t\tblockElement.style.display = 'inline-block';\n\t\t\t// Simply accessing el.offsetHeight flushes layout and style changes\n\t\t\t// in WebKit without having to wait for setTimeout.\n\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\tblockElement.offsetHeight;\n\t\t\tblockElement.style.display = display;\n\t\t}\n\t\t// `colors` must be a dependency so this effect runs when the colors\n\t\t// change in Safari.\n\t}, [ isValidFilter, blockElement, colors ] );\n}\n\nfunction useBlockProps( { clientId, name, style } ) {\n\tconst id = useInstanceId( useBlockProps );\n\tconst selector = useMemo( () => {\n\t\tconst blockType = getBlockType( name );\n\n\t\tif ( blockType ) {\n\t\t\t// Backwards compatibility for `supports.color.__experimentalDuotone`\n\t\t\t// is provided via the `block_type_metadata_settings` filter. If\n\t\t\t// `supports.filter.duotone` has not been set and the\n\t\t\t// experimental property has been, the experimental property\n\t\t\t// value is copied into `supports.filter.duotone`.\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'filter.duotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( ! duotoneSupport ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// If the experimental duotone support was set, that value is\n\t\t\t// to be treated as a selector and requires scoping.\n\t\t\tconst experimentalDuotone = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( experimentalDuotone ) {\n\t\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\t\treturn typeof experimentalDuotone === 'string'\n\t\t\t\t\t? scopeSelector( rootSelector, experimentalDuotone )\n\t\t\t\t\t: rootSelector;\n\t\t\t}\n\n\t\t\t// Regular filter.duotone support uses filter.duotone selectors with fallbacks.\n\t\t\treturn getBlockCSSSelector( blockType, 'filter.duotone', {\n\t\t\t\tfallback: true,\n\t\t\t} );\n\t\t}\n\t}, [ name ] );\n\n\tconst attribute = style?.color?.duotone;\n\n\tconst filterClass = `wp-duotone-${ id }`;\n\n\tconst shouldRender = selector && attribute;\n\n\tuseDuotoneStyles( {\n\t\tclientId,\n\t\tid: filterClass,\n\t\tselector,\n\t\tattribute,\n\t} );\n\n\treturn {\n\t\tclassName: shouldRender ? filterClass : '',\n\t};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,WAAA,GAAAP,OAAA;AAMA,IAAAQ,MAAA,GAAAR,OAAA;AAKA,IAAAS,oBAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,aAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,iBAAA,GAAAb,OAAA;AACA,IAAAc,aAAA,GAAAd,OAAA;AAA0F,IAAAe,WAAA,GAAAf,OAAA;AArC1F;AACA;AACA;;AAIA;AACA;AACA;;AAUA;AACA;AACA;;AAmBA,MAAMgB,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA;AACA,MAAMC,QAAQ,GACbC,MAAM,EAAEC,SAAS,CAACC,SAAS,IAC3BF,MAAM,CAACC,SAAS,CAACC,SAAS,CAACC,QAAQ,CAAE,QAAS,CAAC,IAC/C,CAAEH,MAAM,CAACC,SAAS,CAACC,SAAS,CAACC,QAAQ,CAAE,QAAS,CAAC,IACjD,CAAEH,MAAM,CAACC,SAAS,CAACC,SAAS,CAACC,QAAQ,CAAE,UAAW,CAAC;AAEpD,IAAAC,cA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MACX,CAAE,CAAC;IACJ;EACD,CAAC,EAAE,CAAEnF,IAAI,CAAG,CAAC;EAEb,MAAMiD,SAAS,GAAGnD,KAAK,EAAEI,KAAK,EAAEnB,OAAO;EAEvC,MAAMqG,WAAW,GAAI,cAAcvC,EAAI,EAAC;EAExC,MAAMwC,YAAY,GAAGtC,QAAQ,IAAIE,SAAS;EAE1CN,gBAAgB,CAAE;IACjBC,QAAQ;IACRC,EAAE,EAAEuC,WAAW;IACfrC,QAAQ;IACRE;EACD,CAAE,CAAC;EAEH,OAAO;IACNqC,SAAS,EAAED,YAAY,GAAGD,WAAW,GAAG;EACzC,CAAC;AACF;AAEA,IAAAG,gBAAS,EACR,0BAA0B,EAC1B,oCAAoC,EACpCjD,oBACD,CAAC","ignoreList":[]}
@@ -88,6 +88,12 @@ Object.defineProperty(exports, "useLayoutStyles", {
88
88
  return _layout.useLayoutStyles;
89
89
  }
90
90
  });
91
+ Object.defineProperty(exports, "useStyleOverride", {
92
+ enumerable: true,
93
+ get: function () {
94
+ return _utils.useStyleOverride;
95
+ }
96
+ });
91
97
  Object.defineProperty(exports, "useZoomOut", {
92
98
  enumerable: true,
93
99
  get: function () {
@@ -137,7 +143,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
137
143
  * Internal dependencies
138
144
  */
139
145
 
140
- (0, _utils.createBlockEditFilter)([_blockBindings.default, _align.default, _textAlign.default, _anchor.default, _customClassName.default, _style.default, _duotone.default, _position.default, _layout.default, _contentLockUi.default, _blockHooks.default, _layoutChild.default].filter(Boolean));
146
+ (0, _utils.createBlockEditFilter)([_align.default, _textAlign.default, _anchor.default, _customClassName.default, _style.default, _duotone.default, _position.default, _layout.default, _contentLockUi.default, _blockHooks.default, _blockBindings.default, _layoutChild.default].filter(Boolean));
141
147
  (0, _utils.createBlockListBlockFilter)([_align.default, _textAlign.default, _background.default, _style.default, _color.default, _dimensions.default, _duotone.default, _fontFamily.default, _fontSize.default, _border.default, _position.default, _blockStyleVariation.default, _layoutChild.default]);
142
148
  (0, _utils.createBlockSaveFilter)([_align.default, _textAlign.default, _anchor.default, _ariaLabel.default, _customClassName.default, _border.default, _color.default, _style.default, _fontFamily.default, _fontSize.default]);
143
149
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_utils","require","_align","_interopRequireDefault","_background","_interopRequireWildcard","_anchor","_ariaLabel","_customClassName","_style","_color","_dimensions","_duotone","_fontFamily","_fontSize","_textAlign","_border","_position","_blockStyleVariation","_layout","_layoutChild","_contentLockUi","_blockHooks","_blockBindings","_useBorderProps","_useShadowProps","_useColorProps","_useSpacingProps","_useTypographyProps","_gap","_useCachedTruthy","_useZoomOut","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","createBlockEditFilter","blockBindingsPanel","align","textAlign","anchor","customClassName","style","duotone","position","layout","contentLockUI","blockHooks","childLayout","filter","Boolean","createBlockListBlockFilter","background","color","dimensions","fontFamily","fontSize","border","blockStyleVariation","createBlockSaveFilter","ariaLabel"],"sources":["@wordpress/block-editor/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateBlockEditFilter,\n\tcreateBlockListBlockFilter,\n\tcreateBlockSaveFilter,\n} from './utils';\nimport './compat';\nimport align from './align';\nimport background from './background';\nimport './lock';\nimport anchor from './anchor';\nimport ariaLabel from './aria-label';\nimport customClassName from './custom-class-name';\nimport './generated-class-name';\nimport style from './style';\nimport './settings';\nimport color from './color';\nimport dimensions from './dimensions';\nimport duotone from './duotone';\nimport fontFamily from './font-family';\nimport fontSize from './font-size';\nimport textAlign from './text-align';\nimport border from './border';\nimport position from './position';\nimport blockStyleVariation from './block-style-variation';\nimport layout from './layout';\nimport childLayout from './layout-child';\nimport contentLockUI from './content-lock-ui';\nimport './metadata';\nimport blockHooks from './block-hooks';\nimport blockBindingsPanel from './block-bindings';\nimport './block-renaming';\nimport './use-bindings-attributes';\nimport './grid-visualizer';\n\ncreateBlockEditFilter(\n\t[\n\t\tblockBindingsPanel,\n\t\talign,\n\t\ttextAlign,\n\t\tanchor,\n\t\tcustomClassName,\n\t\tstyle,\n\t\tduotone,\n\t\tposition,\n\t\tlayout,\n\t\tcontentLockUI,\n\t\tblockHooks,\n\t\tchildLayout,\n\t].filter( Boolean )\n);\ncreateBlockListBlockFilter( [\n\talign,\n\ttextAlign,\n\tbackground,\n\tstyle,\n\tcolor,\n\tdimensions,\n\tduotone,\n\tfontFamily,\n\tfontSize,\n\tborder,\n\tposition,\n\tblockStyleVariation,\n\tchildLayout,\n] );\ncreateBlockSaveFilter( [\n\talign,\n\ttextAlign,\n\tanchor,\n\tariaLabel,\n\tcustomClassName,\n\tborder,\n\tcolor,\n\tstyle,\n\tfontFamily,\n\tfontSize,\n] );\n\nexport { useCustomSides } from './dimensions';\nexport { useLayoutClasses, useLayoutStyles } from './layout';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getShadowClassesAndStyles } from './use-shadow-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getTypographyClassesAndStyles } from './use-typography-props';\nexport { getGapCSSValue } from './gap';\nexport { useCachedTruthy } from './use-cached-truthy';\nexport { setBackgroundStyleDefaults } from './background';\nexport { useZoomOut } from './use-zoom-out';\nexport { __unstableBlockStyleVariationOverridesWithConfig } from './block-style-variation';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKAA,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACAA,OAAA;AACA,IAAAK,OAAA,GAAAH,sBAAA,C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AEC,OAAQ,CACnB,CAAC;AACD,IAAAC,iCAA0B,EAAE,CAC3Bb,cAAK,EACLC,kBAAS,EACTa,mBAAU,EACVV,cAAK,EACLW,cAAK,EACLC,mBAAU,EACVX,gBAAO,EACPY,mBAAU,EACVC,iBAAQ,EACRC,eAAM,EACNb,iBAAQ,EACRc,4BAAmB,EACnBV,oBAAW,CACV,CAAC;AACH,IAAAW,4BAAqB,EAAE,CACtBrB,cAAK,EACLC,kBAAS,EACTC,eAAM,EACNoB,kBAAS,EACTnB,wBAAe,EACfgB,eAAM,EACNJ,cAAK,EACLX,cAAK,EACLa,mBAAU,EACVC,iBAAQ,CACP,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_utils","require","_align","_interopRequireDefault","_background","_interopRequireWildcard","_anchor","_ariaLabel","_customClassName","_style","_color","_dimensions","_duotone","_fontFamily","_fontSize","_textAlign","_border","_position","_blockStyleVariation","_layout","_layoutChild","_contentLockUi","_blockHooks","_blockBindings","_useBorderProps","_useShadowProps","_useColorProps","_useSpacingProps","_useTypographyProps","_gap","_useCachedTruthy","_useZoomOut","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","createBlockEditFilter","align","textAlign","anchor","customClassName","style","duotone","position","layout","contentLockUI","blockHooks","blockBindingsPanel","childLayout","filter","Boolean","createBlockListBlockFilter","background","color","dimensions","fontFamily","fontSize","border","blockStyleVariation","createBlockSaveFilter","ariaLabel"],"sources":["@wordpress/block-editor/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateBlockEditFilter,\n\tcreateBlockListBlockFilter,\n\tcreateBlockSaveFilter,\n} from './utils';\nimport './compat';\nimport align from './align';\nimport background from './background';\nimport './lock';\nimport anchor from './anchor';\nimport ariaLabel from './aria-label';\nimport customClassName from './custom-class-name';\nimport './generated-class-name';\nimport style from './style';\nimport './settings';\nimport color from './color';\nimport dimensions from './dimensions';\nimport duotone from './duotone';\nimport fontFamily from './font-family';\nimport fontSize from './font-size';\nimport textAlign from './text-align';\nimport border from './border';\nimport position from './position';\nimport blockStyleVariation from './block-style-variation';\nimport layout from './layout';\nimport childLayout from './layout-child';\nimport contentLockUI from './content-lock-ui';\nimport './metadata';\nimport blockHooks from './block-hooks';\nimport blockBindingsPanel from './block-bindings';\nimport './block-renaming';\nimport './use-bindings-attributes';\nimport './grid-visualizer';\n\ncreateBlockEditFilter(\n\t[\n\t\talign,\n\t\ttextAlign,\n\t\tanchor,\n\t\tcustomClassName,\n\t\tstyle,\n\t\tduotone,\n\t\tposition,\n\t\tlayout,\n\t\tcontentLockUI,\n\t\tblockHooks,\n\t\tblockBindingsPanel,\n\t\tchildLayout,\n\t].filter( Boolean )\n);\ncreateBlockListBlockFilter( [\n\talign,\n\ttextAlign,\n\tbackground,\n\tstyle,\n\tcolor,\n\tdimensions,\n\tduotone,\n\tfontFamily,\n\tfontSize,\n\tborder,\n\tposition,\n\tblockStyleVariation,\n\tchildLayout,\n] );\ncreateBlockSaveFilter( [\n\talign,\n\ttextAlign,\n\tanchor,\n\tariaLabel,\n\tcustomClassName,\n\tborder,\n\tcolor,\n\tstyle,\n\tfontFamily,\n\tfontSize,\n] );\n\nexport { useCustomSides } from './dimensions';\nexport { useLayoutClasses, useLayoutStyles } from './layout';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getShadowClassesAndStyles } from './use-shadow-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getTypographyClassesAndStyles } from './use-typography-props';\nexport { getGapCSSValue } from './gap';\nexport { useCachedTruthy } from './use-cached-truthy';\nexport { setBackgroundStyleDefaults } from './background';\nexport { useZoomOut } from './use-zoom-out';\nexport { __unstableBlockStyleVariationOverridesWithConfig } from './block-style-variation';\nexport { useStyleOverride } from './utils';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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AAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AA3F5C;AACA;AACA;;AAmCA,IAAAW,4BAAqB,EACpB,CACCC,cAAK,EACLC,kBAAS,EACTC,eAAM,EACNC,wBAAe,EACfC,cAAK,EACLC,gBAAO,EACPC,iBAAQ,EACRC,eAAM,EACNC,sBAAa,EACbC,mBAAU,EACVC,sBAAkB,EAClBC,oBAAW,CACX,CAACC,MAAM,CAAEC,OAAQ,CACnB,CAAC;AACD,IAAAC,iCAA0B,EAAE,CAC3Bd,cAAK,EACLC,kBAAS,EACTc,mBAAU,EACVX,cAAK,EACLY,cAAK,EACLC,mBAAU,EACVZ,gBAAO,EACPa,mBAAU,EACVC,iBAAQ,EACRC,eAAM,EACNd,iBAAQ,EACRe,4BAAmB,EACnBV,oBAAW,CACV,CAAC;AACH,IAAAW,4BAAqB,EAAE,CACtBtB,cAAK,EACLC,kBAAS,EACTC,eAAM,EACNqB,kBAAS,EACTpB,wBAAe,EACfiB,eAAM,EACNJ,cAAK,EACLZ,cAAK,EACLc,mBAAU,EACVC,iBAAQ,CACP,CAAC","ignoreList":[]}
@@ -50,7 +50,6 @@ function LineHeightEdit(props) {
50
50
  };
51
51
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_lineHeightControl.default, {
52
52
  __unstableInputWidth: "100%",
53
- __nextHasNoMarginBottom: true,
54
53
  value: style?.typography?.lineHeight,
55
54
  onChange: onChange,
56
55
  size: "__unstable-large"
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_lineHeightControl","_interopRequireDefault","_utils","_useSettings","_jsxRuntime","LINE_HEIGHT_SUPPORT_KEY","exports","LineHeightEdit","props","attributes","style","setAttributes","onChange","newLineHeightValue","newStyle","typography","lineHeight","cleanEmptyObject","jsx","default","__unstableInputWidth","__nextHasNoMarginBottom","value","size","useIsLineHeightDisabled","name","blockName","isEnabled","useSettings","hasBlockSupport"],"sources":["@wordpress/block-editor/src/hooks/line-height.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport LineHeightControl from '../components/line-height-control';\nimport { cleanEmptyObject } from './utils';\nimport { useSettings } from '../components/use-settings';\n\nexport const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';\n\n/**\n * Inspector control panel containing the line height related configuration\n *\n * @param {Object} props\n *\n * @return {Element} Line height edit element.\n */\nexport function LineHeightEdit( props ) {\n\tconst {\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t} = props;\n\n\tconst onChange = ( newLineHeightValue ) => {\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\ttypography: {\n\t\t\t\t...style?.typography,\n\t\t\t\tlineHeight: newLineHeightValue,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( { style: cleanEmptyObject( newStyle ) } );\n\t};\n\treturn (\n\t\t<LineHeightControl\n\t\t\t__unstableInputWidth=\"100%\"\n\t\t\t__nextHasNoMarginBottom\n\t\t\tvalue={ style?.typography?.lineHeight }\n\t\t\tonChange={ onChange }\n\t\t\tsize=\"__unstable-large\"\n\t\t/>\n\t);\n}\n\n/**\n * Custom hook that checks if line-height settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsLineHeightDisabled( { name: blockName } = {} ) {\n\tconst [ isEnabled ] = useSettings( 'typography.lineHeight' );\n\n\treturn (\n\t\t! isEnabled || ! hasBlockSupport( blockName, LINE_HEIGHT_SUPPORT_KEY )\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,kBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAAyD,IAAAK,WAAA,GAAAL,OAAA;AAVzD;AACA;AACA;;AAGA;AACA;AACA;;AAKO,MAAMM,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,uBAAuB;;AAE9D;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,cAAcA,CAAEC,KAAK,EAAG;EACvC,MAAM;IACLC,UAAU,EAAE;MAAEC;IAAM,CAAC;IACrBC;EACD,CAAC,GAAGH,KAAK;EAET,MAAMI,QAAQ,GAAKC,kBAAkB,IAAM;IAC1C,MAAMC,QAAQ,GAAG;MAChB,GAAGJ,KAAK;MACRK,UAAU,EAAE;QACX,GAAGL,KAAK,EAAEK,UAAU;QACpBC,UAAU,EAAEH;MACb;IACD,CAAC;IAEDF,aAAa,CAAE;MAAED,KAAK,EAAE,IAAAO,uBAAgB,EAAEH,QAAS;IAAE,CAAE,CAAC;EACzD,CAAC;EACD,oBACC,IAAAV,WAAA,CAAAc,GAAA,EAAClB,kBAAA,CAAAmB,OAAiB;IACjBC,oBAAoB,EAAC,MAAM;IAC3BC,uBAAuB;IACvBC,KAAK,EAAGZ,KAAK,EAAEK,UAAU,EAAEC,UAAY;IACvCJ,QAAQ,EAAGA,QAAU;IACrBW,IAAI,EAAC;EAAkB,CACvB,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,uBAAuBA,CAAE;EAAEC,IAAI,EAAEC;AAAU,CAAC,GAAG,CAAC,CAAC,EAAG;EACnE,MAAM,CAAEC,SAAS,CAAE,GAAG,IAAAC,wBAAW,EAAE,uBAAwB,CAAC;EAE5D,OACC,CAAED,SAAS,IAAI,CAAE,IAAAE,uBAAe,EAAEH,SAAS,EAAErB,uBAAwB,CAAC;AAExE","ignoreList":[]}
1
+ {"version":3,"names":["_blocks","require","_lineHeightControl","_interopRequireDefault","_utils","_useSettings","_jsxRuntime","LINE_HEIGHT_SUPPORT_KEY","exports","LineHeightEdit","props","attributes","style","setAttributes","onChange","newLineHeightValue","newStyle","typography","lineHeight","cleanEmptyObject","jsx","default","__unstableInputWidth","value","size","useIsLineHeightDisabled","name","blockName","isEnabled","useSettings","hasBlockSupport"],"sources":["@wordpress/block-editor/src/hooks/line-height.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport LineHeightControl from '../components/line-height-control';\nimport { cleanEmptyObject } from './utils';\nimport { useSettings } from '../components/use-settings';\n\nexport const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';\n\n/**\n * Inspector control panel containing the line height related configuration\n *\n * @param {Object} props\n *\n * @return {Element} Line height edit element.\n */\nexport function LineHeightEdit( props ) {\n\tconst {\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t} = props;\n\n\tconst onChange = ( newLineHeightValue ) => {\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\ttypography: {\n\t\t\t\t...style?.typography,\n\t\t\t\tlineHeight: newLineHeightValue,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( { style: cleanEmptyObject( newStyle ) } );\n\t};\n\treturn (\n\t\t<LineHeightControl\n\t\t\t__unstableInputWidth=\"100%\"\n\t\t\tvalue={ style?.typography?.lineHeight }\n\t\t\tonChange={ onChange }\n\t\t\tsize=\"__unstable-large\"\n\t\t/>\n\t);\n}\n\n/**\n * Custom hook that checks if line-height settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsLineHeightDisabled( { name: blockName } = {} ) {\n\tconst [ isEnabled ] = useSettings( 'typography.lineHeight' );\n\n\treturn (\n\t\t! isEnabled || ! hasBlockSupport( blockName, LINE_HEIGHT_SUPPORT_KEY )\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,kBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAAyD,IAAAK,WAAA,GAAAL,OAAA;AAVzD;AACA;AACA;;AAGA;AACA;AACA;;AAKO,MAAMM,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,uBAAuB;;AAE9D;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,cAAcA,CAAEC,KAAK,EAAG;EACvC,MAAM;IACLC,UAAU,EAAE;MAAEC;IAAM,CAAC;IACrBC;EACD,CAAC,GAAGH,KAAK;EAET,MAAMI,QAAQ,GAAKC,kBAAkB,IAAM;IAC1C,MAAMC,QAAQ,GAAG;MAChB,GAAGJ,KAAK;MACRK,UAAU,EAAE;QACX,GAAGL,KAAK,EAAEK,UAAU;QACpBC,UAAU,EAAEH;MACb;IACD,CAAC;IAEDF,aAAa,CAAE;MAAED,KAAK,EAAE,IAAAO,uBAAgB,EAAEH,QAAS;IAAE,CAAE,CAAC;EACzD,CAAC;EACD,oBACC,IAAAV,WAAA,CAAAc,GAAA,EAAClB,kBAAA,CAAAmB,OAAiB;IACjBC,oBAAoB,EAAC,MAAM;IAC3BC,KAAK,EAAGX,KAAK,EAAEK,UAAU,EAAEC,UAAY;IACvCJ,QAAQ,EAAGA,QAAU;IACrBU,IAAI,EAAC;EAAkB,CACvB,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,uBAAuBA,CAAE;EAAEC,IAAI,EAAEC;AAAU,CAAC,GAAG,CAAC,CAAC,EAAG;EACnE,MAAM,CAAEC,SAAS,CAAE,GAAG,IAAAC,wBAAW,EAAE,uBAAwB,CAAC;EAE5D,OACC,CAAED,SAAS,IAAI,CAAE,IAAAE,uBAAe,EAAEH,SAAS,EAAEpB,uBAAwB,CAAC;AAExE","ignoreList":[]}
@@ -25,7 +25,7 @@ function SpacingVisualizer({
25
25
  computeStyle,
26
26
  forceShow
27
27
  }) {
28
- const blockElement = (0, _useBlockRefs.__unstableUseBlockElement)(clientId);
28
+ const blockElement = (0, _useBlockRefs.useBlockElement)(clientId);
29
29
  const [style, updateStyle] = (0, _element.useReducer)(() => computeStyle(blockElement));
30
30
  (0, _element.useLayoutEffect)(() => {
31
31
  if (!blockElement) {
@@ -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 { __unstableUseBlockElement as 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;AAAuH,IAAAK,WAAA,GAAAL,OAAA;AAhBvH;AACA;AACA;;AAUA;AACA;AACA;;AAIA,SAASM,iBAAiBA,CAAE;EAAEC,QAAQ;EAAEC,KAAK;EAAEC,YAAY;EAAEC;AAAU,CAAC,EAAG;EAC1E,MAAMC,YAAY,GAAG,IAAAC,uCAAe,EAAEL,QAAS,CAAC;EAChD,MAAM,CAAEM,KAAK,EAAEC,WAAW,CAAE,GAAG,IAAAC,mBAAU,EAAE,MAC1CN,YAAY,CAAEE,YAAa,CAC5B,CAAC;EAED,IAAAK,wBAAe,EAAE,MAAM;IACtB,IAAK,CAAEL,YAAY,EAAG;MACrB;IACD;IACA;IACA;IACA;IACA;IACA;IACAM,MAAM,CAACC,qBAAqB,CAAE,MAC7BD,MAAM,CAACC,qBAAqB,CAAEJ,WAAY,CAC3C,CAAC;EACF,CAAC,EAAE,CAAEH,YAAY,EAAEH,KAAK,CAAG,CAAC;EAE5B,MA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AC;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","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,QAAQ;EAAEC,KAAK;EAAEC,YAAY;EAAEC;AAAU,CAAC,EAAG;EAC1E,MAAMC,YAAY,GAAG,IAAAC,6BAAe,EAAEL,QAAS,CAAC;EAChD,MAAM,CAAEM,KAAK,EAAEC,WAAW,CAAE,GAAG,IAAAC,mBAAU,EAAE,MAC1CN,YAAY,CAAEE,YAAa,CAC5B,CAAC;EAED,IAAAK,wBAAe,EAAE,MAAM;IACtB,IAAK,CAAEL,YAAY,EAAG;MACrB;IACD;IACA;IAC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AO,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":[]}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.canBindAttribute = canBindAttribute;
8
8
  exports.canBindBlock = canBindBlock;
9
+ exports.getBindableAttributes = getBindableAttributes;
9
10
  exports.withBlockBindingSupport = void 0;
10
11
  var _blocks = require("@wordpress/blocks");
11
12
  var _compose = require("@wordpress/compose");
@@ -90,6 +91,9 @@ function canBindBlock(blockName) {
90
91
  function canBindAttribute(blockName, attributeName) {
91
92
  return canBindBlock(blockName) && BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName].includes(attributeName);
92
93
  }
94
+ function getBindableAttributes(blockName) {
95
+ return BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName];
96
+ }
93
97
  const withBlockBindingSupport = exports.withBlockBindingSupport = (0, _compose.createHigherOrderComponent)(BlockEdit => props => {
94
98
  const registry = (0, _data.useRegistry)();
95
99
  const blockContext = (0, _element.useContext)(_blockContext.default);
@@ -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","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 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":";;;;;;;;;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ED,oBACC,IAAAhC,WAAA,CAAAsE,GAAA,EAAAtE,WAAA,CAAAuE,QAAA;IAAAC,QAAA,eACC,IAAAxE,WAAA,CAAAsE,GAAA,EAACrD,SAAS;MAAA,GACJC,KAAK;MACViB,UAAU,EAAG;QAAE,GAAGjB,KAAK,CAACiB,UAAU;QAAE,GAAGI;MAAgB,CAAG;MAC1DoB,aAAa,EAAGC;IAAgB,CAChC;EAAC,CACD,CAAC;AAEL,CAAC,EACD,yBACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASa,mBAAmBA,CAAEC,QAAQ,EAAE5C,IAAI,EAAG;EAC9C,IAAK,CAAEnB,YAAY,CAAEmB,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","_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,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ACrD,SAAS;MAAA,GACJC,KAAK;MACViB,UAAU,EAAG;QAAE,GAAGjB,KAAK,CAACiB,UAAU;QAAE,GAAGI;MAAgB,CAAG;MAC1DoB,aAAa,EAAGC;IAAgB,CAChC;EAAC,CACD,CAAC;AAEL,CAAC,EACD,yBACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASa,mBAAmBA,CAAEC,QAAQ,EAAE5C,IAAI,EAAG;EAC9C,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":[]}
@@ -49,6 +49,6 @@ function useZoomOut(zoomOut = true) {
49
49
  } else if (!zoomOut && __unstableGetEditorMode() === 'zoom-out' && originalEditingMode.current !== mode) {
50
50
  __unstableSetEditorMode(originalEditingMode.current);
51
51
  }
52
- }, [__unstableSetEditorMode, zoomOut, mode]);
52
+ }, [__unstableGetEditorMode, __unstableSetEditorMode, zoomOut]); // Mode is deliberately excluded from the dependencies so that the effect does not run when mode changes.
53
53
  }
54
54
  //# sourceMappingURL=use-zoom-out.js.map
@@ -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}, [ __unstableSetEditorMode, zoomOut, mode ] );\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,CAAET,uBAAuB,EAAED,OAAO,EAAEQ,IAAI,CAAG,CAAC;AAChD","ignoreList":[]}
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":[]}
@@ -11,6 +11,7 @@ exports.createBlockSaveFilter = createBlockSaveFilter;
11
11
  exports.shouldSkipSerialization = shouldSkipSerialization;
12
12
  exports.transformStyles = transformStyles;
13
13
  exports.useBlockSettings = useBlockSettings;
14
+ exports.usePrivateStyleOverride = usePrivateStyleOverride;
14
15
  exports.useStyleOverride = useStyleOverride;
15
16
  var _blocks = require("@wordpress/blocks");
16
17
  var _element = require("@wordpress/element");
@@ -112,7 +113,26 @@ function shouldSkipSerialization(blockNameOrType, featureSet, feature) {
112
113
  return skipSerialization;
113
114
  }
114
115
  const pendingStyleOverrides = new WeakMap();
116
+
117
+ /**
118
+ * Override a block editor settings style. Leave the ID blank to create a new
119
+ * style.
120
+ *
121
+ * @param {Object} override Override object.
122
+ * @param {?string} override.id Id of the style override, leave blank to create
123
+ * a new style.
124
+ * @param {string} override.css CSS to apply.
125
+ */
115
126
  function useStyleOverride({
127
+ id,
128
+ css
129
+ }) {
130
+ return usePrivateStyleOverride({
131
+ id,
132
+ css
133
+ });
134
+ }
135
+ function usePrivateStyleOverride({
116
136
  id,
117
137
  css,
118
138
  assets,