@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
@@ -9,12 +9,16 @@ exports.appendToSelector = appendToSelector;
9
9
  exports.areGlobalStyleConfigsEqual = areGlobalStyleConfigsEqual;
10
10
  exports.getBlockStyleVariationSelector = getBlockStyleVariationSelector;
11
11
  exports.getPresetVariableFromValue = getPresetVariableFromValue;
12
+ exports.getResolvedRefValue = getResolvedRefValue;
13
+ exports.getResolvedThemeFilePath = getResolvedThemeFilePath;
14
+ exports.getResolvedValue = getResolvedValue;
12
15
  exports.getValueFromVariable = getValueFromVariable;
13
16
  exports.scopeFeatureSelectors = scopeFeatureSelectors;
14
17
  exports.scopeSelector = scopeSelector;
15
18
  exports.useToolsPanelDropdownMenuProps = useToolsPanelDropdownMenuProps;
16
19
  var _es = _interopRequireDefault(require("fast-deep-equal/es6"));
17
20
  var _compose = require("@wordpress/compose");
21
+ var _styleEngine = require("@wordpress/style-engine");
18
22
  var _typographyUtils = require("./typography-utils");
19
23
  var _object = require("../../utils/object");
20
24
  /**
@@ -424,4 +428,80 @@ function getBlockStyleVariationSelector(variation, blockSelector) {
424
428
  const result = blockSelector.split(',').map(part => part.replace(ancestorRegex, addVariationClass));
425
429
  return result.join(',');
426
430
  }
431
+
432
+ /**
433
+ * Looks up a theme file URI based on a relative path.
434
+ *
435
+ * @param {string} file A relative path.
436
+ * @param {Array<Object>} themeFileURIs A collection of absolute theme file URIs and their corresponding file paths.
437
+ * @return {string} A resolved theme file URI, if one is found in the themeFileURIs collection.
438
+ */
439
+ function getResolvedThemeFilePath(file, themeFileURIs) {
440
+ if (!file || !themeFileURIs || !Array.isArray(themeFileURIs)) {
441
+ return file;
442
+ }
443
+ const uri = themeFileURIs.find(themeFileUri => themeFileUri?.name === file);
444
+ if (!uri?.href) {
445
+ return file;
446
+ }
447
+ return uri?.href;
448
+ }
449
+
450
+ /**
451
+ * Resolves ref values in theme JSON.
452
+ *
453
+ * @param {Object|string} ruleValue A block style value that may contain a reference to a theme.json value.
454
+ * @param {Object} tree A theme.json object.
455
+ * @return {*} The resolved value or incoming ruleValue.
456
+ */
457
+ function getResolvedRefValue(ruleValue, tree) {
458
+ if (!ruleValue || !tree) {
459
+ return ruleValue;
460
+ }
461
+
462
+ /*
463
+ * Where the rule value is an object with a 'ref' property pointing
464
+ * to a path, this converts that path into the value at that path.
465
+ * For example: { "ref": "style.color.background" } => "#fff".
466
+ */
467
+ if (typeof ruleValue !== 'string' && ruleValue?.ref) {
468
+ const refPath = ruleValue.ref.split('.');
469
+ const resolvedRuleValue = (0, _styleEngine.getCSSValueFromRawStyle)((0, _object.getValueFromObjectPath)(tree, refPath));
470
+
471
+ /*
472
+ * Presence of another ref indicates a reference to another dynamic value.
473
+ * Pointing to another dynamic value is not supported.
474
+ */
475
+ if (resolvedRuleValue?.ref) {
476
+ return undefined;
477
+ }
478
+ if (!resolvedRuleValue) {
479
+ return ruleValue;
480
+ }
481
+ return resolvedRuleValue;
482
+ }
483
+ return ruleValue;
484
+ }
485
+
486
+ /**
487
+ * Resolves ref and relative path values in theme JSON.
488
+ *
489
+ * @param {Object|string} ruleValue A block style value that may contain a reference to a theme.json value.
490
+ * @param {Object} tree A theme.json object.
491
+ * @return {*} The resolved value or incoming ruleValue.
492
+ */
493
+ function getResolvedValue(ruleValue, tree) {
494
+ if (!ruleValue || !tree) {
495
+ return ruleValue;
496
+ }
497
+
498
+ // Resolve ref values.
499
+ const resolvedValue = getResolvedRefValue(ruleValue, tree);
500
+
501
+ // Resolve relative paths.
502
+ if (resolvedValue?.url) {
503
+ resolvedValue.url = getResolvedThemeFilePath(resolvedValue.url, tree?._links?.['wp:theme-file']);
504
+ }
505
+ return resolvedValue;
506
+ }
427
507
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_es","_interopRequireDefault","require","_compose","_typographyUtils","_object","ROOT_BLOCK_SELECTOR","exports","ROOT_CSS_PROPERTIES_SELECTOR","PRESET_METADATA","path","valueKey","cssVarInfix","classes","classSuffix","propertyName","valueFunc","slug","preset","settings","getTypographyFontSizeValue","size","STYLE_PATH_TO_CSS_VAR_INFIX","shadow","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","useToolsPanelDropdownMenuProps","isMobile","useViewportMatch","popoverProps","placement","offset","findInPresetsBy","features","blockName","presetPath","presetProperty","presetValueValue","orderedPresetsByOrigin","getValueFromObjectPath","presetByOrigin","origins","origin","presets","presetObject","find","highestPresetObjectWithSameSlug","undefined","getPresetVariableFromValue","variableStylePath","presetPropertyValue","metadata","data","getValueFromPresetVariable","variable","presetType","result","getValueFromVariable","getValueFromCustomVariable","_getValueFromObjectPa","ref","refPath","split","USER_VALUE_PREFIX","THEME_VALUE_PREFIX","THEME_VALUE_SUFFIX","parsedVar","startsWith","slice","length","endsWith","type","scopeSelector","scope","selector","scopes","selectors","selectorsScoped","forEach","outer","inner","push","trim","join","scopeFeatureSelectors","featureSelectors","Object","entries","feature","subfeature","subfeatureSelector","appendToSelector","toAppend","includes","newSelectors","map","sel","areGlobalStyleConfigsEqual","original","variation","fastDeepEqual","styles","getBlockStyleVariationSelector","blockSelector","variationClass","ancestorRegex","addVariationClass","_match","group1","group2","part","replace"],"sources":["@wordpress/block-editor/src/components/global-styles/utils.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getTypographyFontSizeValue } from './typography-utils';\nimport { getValueFromObjectPath } from '../../utils/object';\n\n/* Supporting data. */\nexport const ROOT_BLOCK_SELECTOR = 'body';\nexport const ROOT_CSS_PROPERTIES_SELECTOR = ':root';\n\nexport const PRESET_METADATA = [\n\t{\n\t\tpath: [ 'color', 'palette' ],\n\t\tvalueKey: 'color',\n\t\tcssVarInfix: 'color',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'color', propertyName: 'color' },\n\t\t\t{\n\t\t\t\tclassSuffix: 'background-color',\n\t\t\t\tpropertyName: 'background-color',\n\t\t\t},\n\t\t\t{\n\t\t\t\tclassSuffix: 'border-color',\n\t\t\t\tpropertyName: 'border-color',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'gradients' ],\n\t\tvalueKey: 'gradient',\n\t\tcssVarInfix: 'gradient',\n\t\tclasses: [\n\t\t\t{\n\t\t\t\tclassSuffix: 'gradient-background',\n\t\t\t\tpropertyName: 'background',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'duotone' ],\n\t\tvalueKey: 'colors',\n\t\tcssVarInfix: 'duotone',\n\t\tvalueFunc: ( { slug } ) => `url( '#wp-duotone-${ slug }' )`,\n\t\tclasses: [],\n\t},\n\t{\n\t\tpath: [ 'shadow', 'presets' ],\n\t\tvalueKey: 'shadow',\n\t\tcssVarInfix: 'shadow',\n\t\tclasses: [],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontSizes' ],\n\t\tvalueFunc: ( preset, settings ) =>\n\t\t\tgetTypographyFontSizeValue( preset, settings ),\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'font-size',\n\t\tclasses: [ { classSuffix: 'font-size', propertyName: 'font-size' } ],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontFamilies' ],\n\t\tvalueKey: 'fontFamily',\n\t\tcssVarInfix: 'font-family',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'font-family', propertyName: 'font-family' },\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'spacing', 'spacingSizes' ],\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'spacing',\n\t\tvalueFunc: ( { size } ) => size,\n\t\tclasses: [],\n\t},\n];\n\nexport const STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'filter.duotone': 'duotone',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.caption.color.text': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tshadow: 'shadow',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// A static list of block attributes that store global style preset slugs.\nexport const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nexport function useToolsPanelDropdownMenuProps() {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n}\n\nfunction findInPresetsBy(\n\tfeatures,\n\tblockName,\n\tpresetPath,\n\tpresetProperty,\n\tpresetValueValue\n) {\n\t// Block presets take priority above root level presets.\n\tconst orderedPresetsByOrigin = [\n\t\tgetValueFromObjectPath( features, [\n\t\t\t'blocks',\n\t\t\tblockName,\n\t\t\t...presetPath,\n\t\t] ),\n\t\tgetValueFromObjectPath( features, presetPath ),\n\t];\n\n\tfor ( const presetByOrigin of orderedPresetsByOrigin ) {\n\t\tif ( presetByOrigin ) {\n\t\t\t// Preset origins ordered by priority.\n\t\t\tconst origins = [ 'custom', 'theme', 'default' ];\n\t\t\tfor ( const origin of origins ) {\n\t\t\t\tconst presets = presetByOrigin[ origin ];\n\t\t\t\tif ( presets ) {\n\t\t\t\t\tconst presetObject = presets.find(\n\t\t\t\t\t\t( preset ) =>\n\t\t\t\t\t\t\tpreset[ presetProperty ] === presetValueValue\n\t\t\t\t\t);\n\t\t\t\t\tif ( presetObject ) {\n\t\t\t\t\t\tif ( presetProperty === 'slug' ) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.\n\t\t\t\t\t\tconst highestPresetObjectWithSameSlug = findInPresetsBy(\n\t\t\t\t\t\t\tfeatures,\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tpresetPath,\n\t\t\t\t\t\t\t'slug',\n\t\t\t\t\t\t\tpresetObject.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\thighestPresetObjectWithSameSlug[\n\t\t\t\t\t\t\t\tpresetProperty\n\t\t\t\t\t\t\t] === presetObject[ presetProperty ]\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function getPresetVariableFromValue(\n\tfeatures,\n\tblockName,\n\tvariableStylePath,\n\tpresetPropertyValue\n) {\n\tif ( ! presetPropertyValue ) {\n\t\treturn presetPropertyValue;\n\t}\n\n\tconst cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[ variableStylePath ];\n\n\tconst metadata = PRESET_METADATA.find(\n\t\t( data ) => data.cssVarInfix === cssVarInfix\n\t);\n\n\tif ( ! metadata ) {\n\t\t// The property doesn't have preset data\n\t\t// so the value should be returned as it is.\n\t\treturn presetPropertyValue;\n\t}\n\tconst { valueKey, path } = metadata;\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures,\n\t\tblockName,\n\t\tpath,\n\t\tvalueKey,\n\t\tpresetPropertyValue\n\t);\n\n\tif ( ! presetObject ) {\n\t\t// Value wasn't found in the presets,\n\t\t// so it must be a custom value.\n\t\treturn presetPropertyValue;\n\t}\n\n\treturn `var:preset|${ cssVarInfix }|${ presetObject.slug }`;\n}\n\nfunction getValueFromPresetVariable(\n\tfeatures,\n\tblockName,\n\tvariable,\n\t[ presetType, slug ]\n) {\n\tconst metadata = PRESET_METADATA.find(\n\t\t( data ) => data.cssVarInfix === presetType\n\t);\n\tif ( ! metadata ) {\n\t\treturn variable;\n\t}\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures.settings,\n\t\tblockName,\n\t\tmetadata.path,\n\t\t'slug',\n\t\tslug\n\t);\n\n\tif ( presetObject ) {\n\t\tconst { valueKey } = metadata;\n\t\tconst result = presetObject[ valueKey ];\n\t\treturn getValueFromVariable( features, blockName, result );\n\t}\n\n\treturn variable;\n}\n\nfunction getValueFromCustomVariable( features, blockName, variable, path ) {\n\tconst result =\n\t\tgetValueFromObjectPath( features.settings, [\n\t\t\t'blocks',\n\t\t\tblockName,\n\t\t\t'custom',\n\t\t\t...path,\n\t\t] ) ??\n\t\tgetValueFromObjectPath( features.settings, [ 'custom', ...path ] );\n\tif ( ! result ) {\n\t\treturn variable;\n\t}\n\t// A variable may reference another variable so we need recursion until we find the value.\n\treturn getValueFromVariable( features, blockName, result );\n}\n\n/**\n * Attempts to fetch the value of a theme.json CSS variable.\n *\n * @param {Object} features GlobalStylesContext config, e.g., user, base or merged. Represents the theme.json tree.\n * @param {string} blockName The name of a block as represented in the styles property. E.g., 'root' for root-level, and 'core/${blockName}' for blocks.\n * @param {string|*} variable An incoming style value. A CSS var value is expected, but it could be any value.\n * @return {string|*|{ref}} The value of the CSS var, if found. If not found, the passed variable argument.\n */\nexport function getValueFromVariable( features, blockName, variable ) {\n\tif ( ! variable || typeof variable !== 'string' ) {\n\t\tif ( variable?.ref && typeof variable?.ref === 'string' ) {\n\t\t\tconst refPath = variable.ref.split( '.' );\n\t\t\tvariable = getValueFromObjectPath( features, refPath );\n\t\t\t// Presence of another ref indicates a reference to another dynamic value.\n\t\t\t// Pointing to another dynamic value is not supported.\n\t\t\tif ( ! variable || !! variable?.ref ) {\n\t\t\t\treturn variable;\n\t\t\t}\n\t\t} else {\n\t\t\treturn variable;\n\t\t}\n\t}\n\tconst USER_VALUE_PREFIX = 'var:';\n\tconst THEME_VALUE_PREFIX = 'var(--wp--';\n\tconst THEME_VALUE_SUFFIX = ')';\n\n\tlet parsedVar;\n\n\tif ( variable.startsWith( USER_VALUE_PREFIX ) ) {\n\t\tparsedVar = variable.slice( USER_VALUE_PREFIX.length ).split( '|' );\n\t} else if (\n\t\tvariable.startsWith( THEME_VALUE_PREFIX ) &&\n\t\tvariable.endsWith( THEME_VALUE_SUFFIX )\n\t) {\n\t\tparsedVar = variable\n\t\t\t.slice( THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length )\n\t\t\t.split( '--' );\n\t} else {\n\t\t// We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )`\n\t\treturn variable;\n\t}\n\n\tconst [ type, ...path ] = parsedVar;\n\tif ( type === 'preset' ) {\n\t\treturn getValueFromPresetVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\tif ( type === 'custom' ) {\n\t\treturn getValueFromCustomVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\treturn variable;\n}\n\n/**\n * Function that scopes a selector with another one. This works a bit like\n * SCSS nesting except the `&` operator isn't supported.\n *\n * @example\n * ```js\n * const scope = '.a, .b .c';\n * const selector = '> .x, .y';\n * const merged = scopeSelector( scope, selector );\n * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'\n * ```\n *\n * @param {string} scope Selector to scope to.\n * @param {string} selector Original selector.\n *\n * @return {string} Scoped selector.\n */\nexport function scopeSelector( scope, selector ) {\n\tif ( ! scope || ! selector ) {\n\t\treturn selector;\n\t}\n\n\tconst scopes = scope.split( ',' );\n\tconst selectors = selector.split( ',' );\n\n\tconst selectorsScoped = [];\n\tscopes.forEach( ( outer ) => {\n\t\tselectors.forEach( ( inner ) => {\n\t\t\tselectorsScoped.push( `${ outer.trim() } ${ inner.trim() }` );\n\t\t} );\n\t} );\n\n\treturn selectorsScoped.join( ', ' );\n}\n\n/**\n * Scopes a collection of selectors for features and subfeatures.\n *\n * @example\n * ```js\n * const scope = '.custom-scope';\n * const selectors = {\n * color: '.wp-my-block p',\n * typography: { fontSize: '.wp-my-block caption' },\n * };\n * const result = scopeFeatureSelector( scope, selectors );\n * // result is {\n * // color: '.custom-scope .wp-my-block p',\n * // typography: { fonSize: '.custom-scope .wp-my-block caption' },\n * // }\n * ```\n *\n * @param {string} scope Selector to scope collection of selectors with.\n * @param {Object} selectors Collection of feature selectors e.g.\n *\n * @return {Object|undefined} Scoped collection of feature selectors.\n */\nexport function scopeFeatureSelectors( scope, selectors ) {\n\tif ( ! scope || ! selectors ) {\n\t\treturn;\n\t}\n\n\tconst featureSelectors = {};\n\n\tObject.entries( selectors ).forEach( ( [ feature, selector ] ) => {\n\t\tif ( typeof selector === 'string' ) {\n\t\t\tfeatureSelectors[ feature ] = scopeSelector( scope, selector );\n\t\t}\n\n\t\tif ( typeof selector === 'object' ) {\n\t\t\tfeatureSelectors[ feature ] = {};\n\n\t\t\tObject.entries( selector ).forEach(\n\t\t\t\t( [ subfeature, subfeatureSelector ] ) => {\n\t\t\t\t\tfeatureSelectors[ feature ][ subfeature ] = scopeSelector(\n\t\t\t\t\t\tscope,\n\t\t\t\t\t\tsubfeatureSelector\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t} );\n\n\treturn featureSelectors;\n}\n\n/**\n * Appends a sub-selector to an existing one.\n *\n * Given the compounded `selector` \"h1, h2, h3\"\n * and the `toAppend` selector \".some-class\" the result will be\n * \"h1.some-class, h2.some-class, h3.some-class\".\n *\n * @param {string} selector Original selector.\n * @param {string} toAppend Selector to append.\n *\n * @return {string} The new selector.\n */\nexport function appendToSelector( selector, toAppend ) {\n\tif ( ! selector.includes( ',' ) ) {\n\t\treturn selector + toAppend;\n\t}\n\tconst selectors = selector.split( ',' );\n\tconst newSelectors = selectors.map( ( sel ) => sel + toAppend );\n\treturn newSelectors.join( ',' );\n}\n\n/**\n * Compares global style variations according to their styles and settings properties.\n *\n * @example\n * ```js\n * const globalStyles = { styles: { typography: { fontSize: '10px' } }, settings: {} };\n * const variation = { styles: { typography: { fontSize: '10000px' } }, settings: {} };\n * const isEqual = areGlobalStyleConfigsEqual( globalStyles, variation );\n * // false\n * ```\n *\n * @param {Object} original A global styles object.\n * @param {Object} variation A global styles object.\n *\n * @return {boolean} Whether `original` and `variation` match.\n */\nexport function areGlobalStyleConfigsEqual( original, variation ) {\n\tif ( typeof original !== 'object' || typeof variation !== 'object' ) {\n\t\treturn original === variation;\n\t}\n\treturn (\n\t\tfastDeepEqual( original?.styles, variation?.styles ) &&\n\t\tfastDeepEqual( original?.settings, variation?.settings )\n\t);\n}\n\n/**\n * Generates the selector for a block style variation by creating the\n * appropriate CSS class and adding it to the ancestor portion of the block's\n * selector.\n *\n * For example, take the Button block which has a compound selector:\n * `.wp-block-button .wp-block-button__link`. With a variation named 'custom',\n * the class `.is-style-custom` should be added to the `.wp-block-button`\n * ancestor only.\n *\n * This function will take into account comma separated and complex selectors.\n *\n * @param {string} variation Name for the variation.\n * @param {string} blockSelector CSS selector for the block.\n *\n * @return {string} CSS selector for the block style variation.\n */\nexport function getBlockStyleVariationSelector( variation, blockSelector ) {\n\tconst variationClass = `.is-style-${ variation }`;\n\n\tif ( ! blockSelector ) {\n\t\treturn variationClass;\n\t}\n\n\tconst ancestorRegex = /((?::\\([^)]+\\))?\\s*)([^\\s:]+)/;\n\tconst addVariationClass = ( _match, group1, group2 ) => {\n\t\treturn group1 + group2 + variationClass;\n\t};\n\n\tconst result = blockSelector\n\t\t.split( ',' )\n\t\t.map( ( part ) => part.replace( ancestorRegex, addVariationClass ) );\n\n\treturn result.join( ',' );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAGA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAdA;AACA;AACA;;AAGA;AACA;AACA;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CAAE,GAAI,CAAC;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASc,0BAA0BA,CAAEC,QAAQ,EAAEC,SAAS,EAAG;EACjE,IAAK,OAAOD,QAAQ,KAAK,QAAQ,IAAI,OAAOC,SAAS,KAAK,QAAQ,EAAG;IACpE,OAAOD,QAAQ,KAAKC,SAAS;EAC9B;EACA,OACC,IAAAC,WAAa,EAAEF,QAAQ,EAAEG,MAAM,EAAEF,SAAS,EAAEE,MAAO,CAAC,IACpD,IAAAD,WAAa,EAAEF,QAAQ,EAAE9E,QAAQ,EAAE+E,SAAS,EAAE/E,QAAS,CAAC;AAE1D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASkF,8BAA8BA,CAAEH,SAAS,EAAEI,aAAa,EAAG;EAC1E,MAAMC,cAAc,GAAI,aAAaL,SAAW,EAAC;EAEjD,IAAK,CAAEI,aAAa,EAAG;IACtB,OAAOC,cAAc;EACtB;EAEA,MAAMC,aAAa,GAAG,+BAA+B;EACrD,MAAMC,iBAAiB,GAAGA,CAAEC,MAAM,EAAEC,MAAM,EAAEC,MAAM,KAAM;IACvD,OAAOD,MAAM,GAAGC,MAAM,GAAGL,cAAc;EACxC,CAAC;EAED,MAAMhD,MAAM,GAAG+C,aAAa,CAC1BzC,KAAK,CAAE,GAAI,CAAC,CACZiC,GAAG,CAAIe,IAAI,IAAMA,IAAI,CAACC,OAAO,CAAEN,aAAa,EAAEC,iBAAkB,CAAE,CAAC;EAErE,OAAOlD,MAAM,CAAC2B,IAAI,CAAE,GAAI,CAAC;AAC1B","ignoreList":[]}
1
+ {"version":3,"names":["_es","_interopRequireDefault","require","_compose","_styleEngine","_typographyUtils","_object","ROOT_BLOCK_SELECTOR","exports","ROOT_CSS_PROPERTIES_SELECTOR","PRESET_METADATA","path","valueKey","cssVarInfix","classes","classSuffix","propertyName","valueFunc","slug","preset","settings","getTypographyFontSizeValue","size","STYLE_PATH_TO_CSS_VAR_INFIX","shadow","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","useToolsPanelDropdownMenuProps","isMobile","useViewportMatch","popoverProps","placement","offset","findInPresetsBy","features","blockName","presetPath","presetProperty","presetValueValue","orderedPresetsByOrigin","getValueFromObjectPath","presetByOrigin","origins","origin","presets","presetObject","find","highestPresetObjectWithSameSlug","undefined","getPresetVariableFromValue","variableStylePath","presetPropertyValue","metadata","data","getValueFromPresetVariable","variable","presetType","result","getValueFromVariable","getValueFromCustomVariable","_getValueFromObjectPa","ref","refPath","split","USER_VALUE_PREFIX","THEME_VALUE_PREFIX","THEME_VALUE_SUFFIX","parsedVar","startsWith","slice","length","endsWith","type","scopeSelector","scope","selector","scopes","selectors","selectorsScoped","forEach","outer","inner","push","trim","join","scopeFeatureSelectors","featureSelectors","Object","entries","feature","subfeature","subfeatureSelector","appendToSelector","toAppend","includes","newSelectors","map","sel","areGlobalStyleConfigsEqual","original","variation","fastDeepEqual","styles","getBlockStyleVariationSelector","blockSelector","variationClass","ancestorRegex","addVariationClass","_match","group1","group2","part","replace","getResolvedThemeFilePath","file","themeFileURIs","Array","isArray","uri","themeFileUri","name","href","getResolvedRefValue","ruleValue","tree","resolvedRuleValue","getCSSValueFromRawStyle","getResolvedValue","resolvedValue","url","_links"],"sources":["@wordpress/block-editor/src/components/global-styles/utils.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { getCSSValueFromRawStyle } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport { getTypographyFontSizeValue } from './typography-utils';\nimport { getValueFromObjectPath } from '../../utils/object';\n\n/* Supporting data. */\nexport const ROOT_BLOCK_SELECTOR = 'body';\nexport const ROOT_CSS_PROPERTIES_SELECTOR = ':root';\n\nexport const PRESET_METADATA = [\n\t{\n\t\tpath: [ 'color', 'palette' ],\n\t\tvalueKey: 'color',\n\t\tcssVarInfix: 'color',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'color', propertyName: 'color' },\n\t\t\t{\n\t\t\t\tclassSuffix: 'background-color',\n\t\t\t\tpropertyName: 'background-color',\n\t\t\t},\n\t\t\t{\n\t\t\t\tclassSuffix: 'border-color',\n\t\t\t\tpropertyName: 'border-color',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'gradients' ],\n\t\tvalueKey: 'gradient',\n\t\tcssVarInfix: 'gradient',\n\t\tclasses: [\n\t\t\t{\n\t\t\t\tclassSuffix: 'gradient-background',\n\t\t\t\tpropertyName: 'background',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'duotone' ],\n\t\tvalueKey: 'colors',\n\t\tcssVarInfix: 'duotone',\n\t\tvalueFunc: ( { slug } ) => `url( '#wp-duotone-${ slug }' )`,\n\t\tclasses: [],\n\t},\n\t{\n\t\tpath: [ 'shadow', 'presets' ],\n\t\tvalueKey: 'shadow',\n\t\tcssVarInfix: 'shadow',\n\t\tclasses: [],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontSizes' ],\n\t\tvalueFunc: ( preset, settings ) =>\n\t\t\tgetTypographyFontSizeValue( preset, settings ),\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'font-size',\n\t\tclasses: [ { classSuffix: 'font-size', propertyName: 'font-size' } ],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontFamilies' ],\n\t\tvalueKey: 'fontFamily',\n\t\tcssVarInfix: 'font-family',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'font-family', propertyName: 'font-family' },\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'spacing', 'spacingSizes' ],\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'spacing',\n\t\tvalueFunc: ( { size } ) => size,\n\t\tclasses: [],\n\t},\n];\n\nexport const STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'filter.duotone': 'duotone',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.caption.color.text': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tshadow: 'shadow',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// A static list of block attributes that store global style preset slugs.\nexport const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nexport function useToolsPanelDropdownMenuProps() {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n}\n\nfunction findInPresetsBy(\n\tfeatures,\n\tblockName,\n\tpresetPath,\n\tpresetProperty,\n\tpresetValueValue\n) {\n\t// Block presets take priority above root level presets.\n\tconst orderedPresetsByOrigin = [\n\t\tgetValueFromObjectPath( features, [\n\t\t\t'blocks',\n\t\t\tblockName,\n\t\t\t...presetPath,\n\t\t] ),\n\t\tgetValueFromObjectPath( features, presetPath ),\n\t];\n\n\tfor ( const presetByOrigin of orderedPresetsByOrigin ) {\n\t\tif ( presetByOrigin ) {\n\t\t\t// Preset origins ordered by priority.\n\t\t\tconst origins = [ 'custom', 'theme', 'default' ];\n\t\t\tfor ( const origin of origins ) {\n\t\t\t\tconst presets = presetByOrigin[ origin ];\n\t\t\t\tif ( presets ) {\n\t\t\t\t\tconst presetObject = presets.find(\n\t\t\t\t\t\t( preset ) =>\n\t\t\t\t\t\t\tpreset[ presetProperty ] === presetValueValue\n\t\t\t\t\t);\n\t\t\t\t\tif ( presetObject ) {\n\t\t\t\t\t\tif ( presetProperty === 'slug' ) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.\n\t\t\t\t\t\tconst highestPresetObjectWithSameSlug = findInPresetsBy(\n\t\t\t\t\t\t\tfeatures,\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tpresetPath,\n\t\t\t\t\t\t\t'slug',\n\t\t\t\t\t\t\tpresetObject.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\thighestPresetObjectWithSameSlug[\n\t\t\t\t\t\t\t\tpresetProperty\n\t\t\t\t\t\t\t] === presetObject[ presetProperty ]\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function getPresetVariableFromValue(\n\tfeatures,\n\tblockName,\n\tvariableStylePath,\n\tpresetPropertyValue\n) {\n\tif ( ! presetPropertyValue ) {\n\t\treturn presetPropertyValue;\n\t}\n\n\tconst cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[ variableStylePath ];\n\n\tconst metadata = PRESET_METADATA.find(\n\t\t( data ) => data.cssVarInfix === cssVarInfix\n\t);\n\n\tif ( ! metadata ) {\n\t\t// The property doesn't have preset data\n\t\t// so the value should be returned as it is.\n\t\treturn presetPropertyValue;\n\t}\n\tconst { valueKey, path } = metadata;\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures,\n\t\tblockName,\n\t\tpath,\n\t\tvalueKey,\n\t\tpresetPropertyValue\n\t);\n\n\tif ( ! presetObject ) {\n\t\t// Value wasn't found in the presets,\n\t\t// so it must be a custom value.\n\t\treturn presetPropertyValue;\n\t}\n\n\treturn `var:preset|${ cssVarInfix }|${ presetObject.slug }`;\n}\n\nfunction getValueFromPresetVariable(\n\tfeatures,\n\tblockName,\n\tvariable,\n\t[ presetType, slug ]\n) {\n\tconst metadata = PRESET_METADATA.find(\n\t\t( data ) => data.cssVarInfix === presetType\n\t);\n\tif ( ! metadata ) {\n\t\treturn variable;\n\t}\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures.settings,\n\t\tblockName,\n\t\tmetadata.path,\n\t\t'slug',\n\t\tslug\n\t);\n\n\tif ( presetObject ) {\n\t\tconst { valueKey } = metadata;\n\t\tconst result = presetObject[ valueKey ];\n\t\treturn getValueFromVariable( features, blockName, result );\n\t}\n\n\treturn variable;\n}\n\nfunction getValueFromCustomVariable( features, blockName, variable, path ) {\n\tconst result =\n\t\tgetValueFromObjectPath( features.settings, [\n\t\t\t'blocks',\n\t\t\tblockName,\n\t\t\t'custom',\n\t\t\t...path,\n\t\t] ) ??\n\t\tgetValueFromObjectPath( features.settings, [ 'custom', ...path ] );\n\tif ( ! result ) {\n\t\treturn variable;\n\t}\n\t// A variable may reference another variable so we need recursion until we find the value.\n\treturn getValueFromVariable( features, blockName, result );\n}\n\n/**\n * Attempts to fetch the value of a theme.json CSS variable.\n *\n * @param {Object} features GlobalStylesContext config, e.g., user, base or merged. Represents the theme.json tree.\n * @param {string} blockName The name of a block as represented in the styles property. E.g., 'root' for root-level, and 'core/${blockName}' for blocks.\n * @param {string|*} variable An incoming style value. A CSS var value is expected, but it could be any value.\n * @return {string|*|{ref}} The value of the CSS var, if found. If not found, the passed variable argument.\n */\nexport function getValueFromVariable( features, blockName, variable ) {\n\tif ( ! variable || typeof variable !== 'string' ) {\n\t\tif ( variable?.ref && typeof variable?.ref === 'string' ) {\n\t\t\tconst refPath = variable.ref.split( '.' );\n\t\t\tvariable = getValueFromObjectPath( features, refPath );\n\t\t\t// Presence of another ref indicates a reference to another dynamic value.\n\t\t\t// Pointing to another dynamic value is not supported.\n\t\t\tif ( ! variable || !! variable?.ref ) {\n\t\t\t\treturn variable;\n\t\t\t}\n\t\t} else {\n\t\t\treturn variable;\n\t\t}\n\t}\n\tconst USER_VALUE_PREFIX = 'var:';\n\tconst THEME_VALUE_PREFIX = 'var(--wp--';\n\tconst THEME_VALUE_SUFFIX = ')';\n\n\tlet parsedVar;\n\n\tif ( variable.startsWith( USER_VALUE_PREFIX ) ) {\n\t\tparsedVar = variable.slice( USER_VALUE_PREFIX.length ).split( '|' );\n\t} else if (\n\t\tvariable.startsWith( THEME_VALUE_PREFIX ) &&\n\t\tvariable.endsWith( THEME_VALUE_SUFFIX )\n\t) {\n\t\tparsedVar = variable\n\t\t\t.slice( THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length )\n\t\t\t.split( '--' );\n\t} else {\n\t\t// We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )`\n\t\treturn variable;\n\t}\n\n\tconst [ type, ...path ] = parsedVar;\n\tif ( type === 'preset' ) {\n\t\treturn getValueFromPresetVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\tif ( type === 'custom' ) {\n\t\treturn getValueFromCustomVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\treturn variable;\n}\n\n/**\n * Function that scopes a selector with another one. This works a bit like\n * SCSS nesting except the `&` operator isn't supported.\n *\n * @example\n * ```js\n * const scope = '.a, .b .c';\n * const selector = '> .x, .y';\n * const merged = scopeSelector( scope, selector );\n * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'\n * ```\n *\n * @param {string} scope Selector to scope to.\n * @param {string} selector Original selector.\n *\n * @return {string} Scoped selector.\n */\nexport function scopeSelector( scope, selector ) {\n\tif ( ! scope || ! selector ) {\n\t\treturn selector;\n\t}\n\n\tconst scopes = scope.split( ',' );\n\tconst selectors = selector.split( ',' );\n\n\tconst selectorsScoped = [];\n\tscopes.forEach( ( outer ) => {\n\t\tselectors.forEach( ( inner ) => {\n\t\t\tselectorsScoped.push( `${ outer.trim() } ${ inner.trim() }` );\n\t\t} );\n\t} );\n\n\treturn selectorsScoped.join( ', ' );\n}\n\n/**\n * Scopes a collection of selectors for features and subfeatures.\n *\n * @example\n * ```js\n * const scope = '.custom-scope';\n * const selectors = {\n * color: '.wp-my-block p',\n * typography: { fontSize: '.wp-my-block caption' },\n * };\n * const result = scopeFeatureSelector( scope, selectors );\n * // result is {\n * // color: '.custom-scope .wp-my-block p',\n * // typography: { fonSize: '.custom-scope .wp-my-block caption' },\n * // }\n * ```\n *\n * @param {string} scope Selector to scope collection of selectors with.\n * @param {Object} selectors Collection of feature selectors e.g.\n *\n * @return {Object|undefined} Scoped collection of feature selectors.\n */\nexport function scopeFeatureSelectors( scope, selectors ) {\n\tif ( ! scope || ! selectors ) {\n\t\treturn;\n\t}\n\n\tconst featureSelectors = {};\n\n\tObject.entries( selectors ).forEach( ( [ feature, selector ] ) => {\n\t\tif ( typeof selector === 'string' ) {\n\t\t\tfeatureSelectors[ feature ] = scopeSelector( scope, selector );\n\t\t}\n\n\t\tif ( typeof selector === 'object' ) {\n\t\t\tfeatureSelectors[ feature ] = {};\n\n\t\t\tObject.entries( selector ).forEach(\n\t\t\t\t( [ subfeature, subfeatureSelector ] ) => {\n\t\t\t\t\tfeatureSelectors[ feature ][ subfeature ] = scopeSelector(\n\t\t\t\t\t\tscope,\n\t\t\t\t\t\tsubfeatureSelector\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t} );\n\n\treturn featureSelectors;\n}\n\n/**\n * Appends a sub-selector to an existing one.\n *\n * Given the compounded `selector` \"h1, h2, h3\"\n * and the `toAppend` selector \".some-class\" the result will be\n * \"h1.some-class, h2.some-class, h3.some-class\".\n *\n * @param {string} selector Original selector.\n * @param {string} toAppend Selector to append.\n *\n * @return {string} The new selector.\n */\nexport function appendToSelector( selector, toAppend ) {\n\tif ( ! selector.includes( ',' ) ) {\n\t\treturn selector + toAppend;\n\t}\n\tconst selectors = selector.split( ',' );\n\tconst newSelectors = selectors.map( ( sel ) => sel + toAppend );\n\treturn newSelectors.join( ',' );\n}\n\n/**\n * Compares global style variations according to their styles and settings properties.\n *\n * @example\n * ```js\n * const globalStyles = { styles: { typography: { fontSize: '10px' } }, settings: {} };\n * const variation = { styles: { typography: { fontSize: '10000px' } }, settings: {} };\n * const isEqual = areGlobalStyleConfigsEqual( globalStyles, variation );\n * // false\n * ```\n *\n * @param {Object} original A global styles object.\n * @param {Object} variation A global styles object.\n *\n * @return {boolean} Whether `original` and `variation` match.\n */\nexport function areGlobalStyleConfigsEqual( original, variation ) {\n\tif ( typeof original !== 'object' || typeof variation !== 'object' ) {\n\t\treturn original === variation;\n\t}\n\treturn (\n\t\tfastDeepEqual( original?.styles, variation?.styles ) &&\n\t\tfastDeepEqual( original?.settings, variation?.settings )\n\t);\n}\n\n/**\n * Generates the selector for a block style variation by creating the\n * appropriate CSS class and adding it to the ancestor portion of the block's\n * selector.\n *\n * For example, take the Button block which has a compound selector:\n * `.wp-block-button .wp-block-button__link`. With a variation named 'custom',\n * the class `.is-style-custom` should be added to the `.wp-block-button`\n * ancestor only.\n *\n * This function will take into account comma separated and complex selectors.\n *\n * @param {string} variation Name for the variation.\n * @param {string} blockSelector CSS selector for the block.\n *\n * @return {string} CSS selector for the block style variation.\n */\nexport function getBlockStyleVariationSelector( variation, blockSelector ) {\n\tconst variationClass = `.is-style-${ variation }`;\n\n\tif ( ! blockSelector ) {\n\t\treturn variationClass;\n\t}\n\n\tconst ancestorRegex = /((?::\\([^)]+\\))?\\s*)([^\\s:]+)/;\n\tconst addVariationClass = ( _match, group1, group2 ) => {\n\t\treturn group1 + group2 + variationClass;\n\t};\n\n\tconst result = blockSelector\n\t\t.split( ',' )\n\t\t.map( ( part ) => part.replace( ancestorRegex, addVariationClass ) );\n\n\treturn result.join( ',' );\n}\n\n/**\n * Looks up a theme file URI based on a relative path.\n *\n * @param {string} file A relative path.\n * @param {Array<Object>} themeFileURIs A collection of absolute theme file URIs and their corresponding file paths.\n * @return {string} A resolved theme file URI, if one is found in the themeFileURIs collection.\n */\nexport function getResolvedThemeFilePath( file, themeFileURIs ) {\n\tif ( ! file || ! themeFileURIs || ! Array.isArray( themeFileURIs ) ) {\n\t\treturn file;\n\t}\n\n\tconst uri = themeFileURIs.find(\n\t\t( themeFileUri ) => themeFileUri?.name === file\n\t);\n\n\tif ( ! uri?.href ) {\n\t\treturn file;\n\t}\n\n\treturn uri?.href;\n}\n\n/**\n * Resolves ref values in theme JSON.\n *\n * @param {Object|string} ruleValue A block style value that may contain a reference to a theme.json value.\n * @param {Object} tree A theme.json object.\n * @return {*} The resolved value or incoming ruleValue.\n */\nexport function getResolvedRefValue( ruleValue, tree ) {\n\tif ( ! ruleValue || ! tree ) {\n\t\treturn ruleValue;\n\t}\n\n\t/*\n\t * Where the rule value is an object with a 'ref' property pointing\n\t * to a path, this converts that path into the value at that path.\n\t * For example: { \"ref\": \"style.color.background\" } => \"#fff\".\n\t */\n\tif ( typeof ruleValue !== 'string' && ruleValue?.ref ) {\n\t\tconst refPath = ruleValue.ref.split( '.' );\n\t\tconst resolvedRuleValue = getCSSValueFromRawStyle(\n\t\t\tgetValueFromObjectPath( tree, refPath )\n\t\t);\n\n\t\t/*\n\t\t * Presence of another ref indicates a reference to another dynamic value.\n\t\t * Pointing to another dynamic value is not supported.\n\t\t */\n\t\tif ( resolvedRuleValue?.ref ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif ( ! resolvedRuleValue ) {\n\t\t\treturn ruleValue;\n\t\t}\n\n\t\treturn resolvedRuleValue;\n\t}\n\treturn ruleValue;\n}\n\n/**\n * Resolves ref and relative path values in theme JSON.\n *\n * @param {Object|string} ruleValue A block style value that may contain a reference to a theme.json value.\n * @param {Object} tree A theme.json object.\n * @return {*} The resolved value or incoming ruleValue.\n */\nexport function getResolvedValue( ruleValue, tree ) {\n\tif ( ! ruleValue || ! tree ) {\n\t\treturn ruleValue;\n\t}\n\n\t// Resolve ref values.\n\tconst resolvedValue = getResolvedRefValue( ruleValue, tree );\n\n\t// Resolve relative paths.\n\tif ( resolvedValue?.url ) {\n\t\tresolvedValue.url = getResolvedThemeFilePath(\n\t\t\tresolvedValue.url,\n\t\t\ttree?._links?.[ 'wp:theme-file' ]\n\t\t);\n\t}\n\n\treturn resolvedValue;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAGA,IAAAA,GAAA,GAAAC,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AAI,CAAEC,IAAI,EAAG;IAC5B,OAAOD,SAAS;EACjB;;EAEA;EACA,MAAMK,aAAa,GAAGN,mBAAmB,CAAEC,SAAS,EAAEC,IAAK,CAAC;;EAE5D;EACA,IAAKI,aAAa,EAAEC,GAAG,EAAG;IACzBD,aAAa,CAACC,GAAG,GAAGhB,wBAAwB,CAC3Ce,aAAa,CAACC,GAAG,EACjBL,IAAI,EAAEM,MAAM,GAAI,eAAe,CAChC,CAAC;EACF;EAEA,OAAOF,aAAa;AACrB","ignoreList":[]}
@@ -52,19 +52,21 @@ function GridItemMovers({
52
52
  group: "parent",
53
53
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.ToolbarGroup, {
54
54
  className: "block-editor-grid-item-mover__move-button-container",
55
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(GridItemMover, {
56
- className: "is-left-button",
57
- icon: _icons.chevronLeft,
58
- label: (0, _i18n.__)('Move left'),
59
- description: (0, _i18n.__)('Move left'),
60
- isDisabled: columnStart <= 1,
61
- onClick: () => {
62
- onChange({
63
- columnStart: columnStart - 1
64
- });
65
- __unstableMarkNextChangeAsNotPersistent();
66
- moveBlocksToPosition([blockClientId], gridClientId, gridClientId, getNumberOfBlocksBeforeCell(columnStart - 1, rowStart));
67
- }
55
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
56
+ className: "block-editor-grid-item-mover__move-horizontal-button-container is-left",
57
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(GridItemMover, {
58
+ icon: _icons.chevronLeft,
59
+ label: (0, _i18n.__)('Move left'),
60
+ description: (0, _i18n.__)('Move left'),
61
+ isDisabled: columnStart <= 1,
62
+ onClick: () => {
63
+ onChange({
64
+ columnStart: columnStart - 1
65
+ });
66
+ __unstableMarkNextChangeAsNotPersistent();
67
+ moveBlocksToPosition([blockClientId], gridClientId, gridClientId, getNumberOfBlocksBeforeCell(columnStart - 1, rowStart));
68
+ }
69
+ })
68
70
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
69
71
  className: "block-editor-grid-item-mover__move-vertical-button-container",
70
72
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(GridItemMover, {
@@ -94,19 +96,21 @@ function GridItemMovers({
94
96
  moveBlocksToPosition([blockClientId], gridClientId, gridClientId, getNumberOfBlocksBeforeCell(columnStart, rowStart + 1));
95
97
  }
96
98
  })]
97
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(GridItemMover, {
98
- className: "is-right-button",
99
- icon: _icons.chevronRight,
100
- label: (0, _i18n.__)('Move right'),
101
- description: (0, _i18n.__)('Move right'),
102
- isDisabled: columnCount && columnEnd >= columnCount,
103
- onClick: () => {
104
- onChange({
105
- columnStart: columnStart + 1
106
- });
107
- __unstableMarkNextChangeAsNotPersistent();
108
- moveBlocksToPosition([blockClientId], gridClientId, gridClientId, getNumberOfBlocksBeforeCell(columnStart + 1, rowStart));
109
- }
99
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
100
+ className: "block-editor-grid-item-mover__move-horizontal-button-container is-right",
101
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(GridItemMover, {
102
+ icon: _icons.chevronRight,
103
+ label: (0, _i18n.__)('Move right'),
104
+ description: (0, _i18n.__)('Move right'),
105
+ isDisabled: columnCount && columnEnd >= columnCount,
106
+ onClick: () => {
107
+ onChange({
108
+ columnStart: columnStart + 1
109
+ });
110
+ __unstableMarkNextChangeAsNotPersistent();
111
+ moveBlocksToPosition([blockClientId], gridClientId, gridClientId, getNumberOfBlocksBeforeCell(columnStart + 1, rowStart));
112
+ }
113
+ })
110
114
  })]
111
115
  })
112
116
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_components","_icons","_data","_compose","_blockControls","_useGetNumberOfBlocksBeforeCell","_store","_jsxRuntime","GridItemMovers","layout","parentLayout","onChange","gridClientId","blockClientId","_layout$columnStart","_layout$rowStart","_layout$columnSpan","_layout$rowSpan","moveBlocksToPosition","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","columnStart","rowStart","columnSpan","rowSpan","columnEnd","rowEnd","columnCount","rowCount","getNumberOfBlocksBeforeCell","useGetNumberOfBlocksBeforeCell","jsx","default","group","children","jsxs","ToolbarGroup","className","GridItemMover","icon","chevronLeft","label","__","description","isDisabled","onClick","chevronUp","chevronDown","chevronRight","instanceId","useInstanceId","descriptionId","Fragment","ToolbarButton","clsx","disabled","accessibleWhenDisabled","VisuallyHidden","id"],"sources":["@wordpress/block-editor/src/components/grid/grid-item-movers.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tVisuallyHidden,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport {\n\tchevronLeft,\n\tchevronUp,\n\tchevronDown,\n\tchevronRight,\n} from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockControls from '../block-controls';\nimport { useGetNumberOfBlocksBeforeCell } from './use-get-number-of-blocks-before-cell';\nimport { store as blockEditorStore } from '../../store';\n\nexport function GridItemMovers( {\n\tlayout,\n\tparentLayout,\n\tonChange,\n\tgridClientId,\n\tblockClientId,\n} ) {\n\tconst { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst columnStart = layout?.columnStart ?? 1;\n\tconst rowStart = layout?.rowStart ?? 1;\n\tconst columnSpan = layout?.columnSpan ?? 1;\n\tconst rowSpan = layout?.rowSpan ?? 1;\n\tconst columnEnd = columnStart + columnSpan - 1;\n\tconst rowEnd = rowStart + rowSpan - 1;\n\tconst columnCount = parentLayout?.columnCount;\n\tconst rowCount = parentLayout?.rowCount;\n\n\tconst getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(\n\t\tgridClientId,\n\t\tcolumnCount\n\t);\n\n\treturn (\n\t\t<BlockControls group=\"parent\">\n\t\t\t<ToolbarGroup className=\"block-editor-grid-item-mover__move-button-container\">\n\t\t\t\t<GridItemMover\n\t\t\t\t\tclassName=\"is-left-button\"\n\t\t\t\t\ticon={ chevronLeft }\n\t\t\t\t\tlabel={ __( 'Move left' ) }\n\t\t\t\t\tdescription={ __( 'Move left' ) }\n\t\t\t\t\tisDisabled={ columnStart <= 1 }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\tcolumnStart: columnStart - 1,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\tcolumnStart - 1,\n\t\t\t\t\t\t\t\trowStart\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t<div className=\"block-editor-grid-item-mover__move-vertical-button-container\">\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\tclassName=\"is-up-button\"\n\t\t\t\t\t\ticon={ chevronUp }\n\t\t\t\t\t\tlabel={ __( 'Move up' ) }\n\t\t\t\t\t\tdescription={ __( 'Move up' ) }\n\t\t\t\t\t\tisDisabled={ rowStart <= 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\trowStart: rowStart - 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\trowStart - 1\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\tclassName=\"is-down-button\"\n\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\tlabel={ __( 'Move down' ) }\n\t\t\t\t\t\tdescription={ __( 'Move down' ) }\n\t\t\t\t\t\tisDisabled={ rowCount && rowEnd >= rowCount }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\trowStart: rowStart + 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\trowStart + 1\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<GridItemMover\n\t\t\t\t\tclassName=\"is-right-button\"\n\t\t\t\t\ticon={ chevronRight }\n\t\t\t\t\tlabel={ __( 'Move right' ) }\n\t\t\t\t\tdescription={ __( 'Move right' ) }\n\t\t\t\t\tisDisabled={ columnCount && columnEnd >= columnCount }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\tcolumnStart: columnStart + 1,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\tcolumnStart + 1,\n\t\t\t\t\t\t\t\trowStart\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n}\n\nfunction GridItemMover( {\n\tclassName,\n\ticon,\n\tlabel,\n\tisDisabled,\n\tonClick,\n\tdescription,\n} ) {\n\tconst instanceId = useInstanceId( GridItemMover );\n\tconst descriptionId = `block-editor-grid-item-mover-button__description-${ instanceId }`;\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-grid-item-mover-button',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\tonClick={ isDisabled ? null : onClick }\n\t\t\t\tdisabled={ isDisabled }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t/>\n\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t{ description }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAMA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,cAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,+BAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAAwD,IAAAS,WAAA,GAAAT,OAAA;AA5BxD;AACA;AAC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;EACxF,oBACC,IAAA3C,WAAA,CAAA6B,IAAA,EAAA7B,WAAA,CAAA8C,QAAA;IAAAlB,QAAA,gBACC,IAAA5B,WAAA,CAAAyB,GAAA,EAAChC,WAAA,CAAAsD,aAAa;MACbhB,SAAS,EAAG,IAAAiB,aAAI,EACf,qCAAqC,EACrCjB,SACD,CAAG;MACHE,IAAI,EAAGA,IAAM;MACbE,KAAK,EAAGA,KAAO;MACf,oBAAmBU,aAAe;MAClCN,OAAO,EAAGD,UAAU,GAAG,IAAI,GAAGC,OAAS;MACvCU,QAAQ,EAAGX,UAAY;MACvBY,sBAAsB;IAAA,CACtB,CAAC,eACF,IAAAlD,WAAA,CAAAyB,GAAA,EAAChC,WAAA,CAAA0D,cAAc;MAACC,EAAE,EAAGP,aAAe;MAAAjB,QAAA,EACjCS;IAAW,CACE,CAAC;EAAA,CAChB,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_components","_icons","_data","_compose","_blockControls","_useGetNumberOfBlocksBeforeCell","_store","_jsxRuntime","GridItemMovers","layout","parentLayout","onChange","gridClientId","blockClientId","_layout$columnStart","_layout$rowStart","_layout$columnSpan","_layout$rowSpan","moveBlocksToPosition","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","columnStart","rowStart","columnSpan","rowSpan","columnEnd","rowEnd","columnCount","rowCount","getNumberOfBlocksBeforeCell","useGetNumberOfBlocksBeforeCell","jsx","default","group","children","jsxs","ToolbarGroup","className","GridItemMover","icon","chevronLeft","label","__","description","isDisabled","onClick","chevronUp","chevronDown","chevronRight","instanceId","useInstanceId","descriptionId","Fragment","ToolbarButton","clsx","disabled","accessibleWhenDisabled","VisuallyHidden","id"],"sources":["@wordpress/block-editor/src/components/grid/grid-item-movers.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tVisuallyHidden,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport {\n\tchevronLeft,\n\tchevronUp,\n\tchevronDown,\n\tchevronRight,\n} from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockControls from '../block-controls';\nimport { useGetNumberOfBlocksBeforeCell } from './use-get-number-of-blocks-before-cell';\nimport { store as blockEditorStore } from '../../store';\n\nexport function GridItemMovers( {\n\tlayout,\n\tparentLayout,\n\tonChange,\n\tgridClientId,\n\tblockClientId,\n} ) {\n\tconst { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst columnStart = layout?.columnStart ?? 1;\n\tconst rowStart = layout?.rowStart ?? 1;\n\tconst columnSpan = layout?.columnSpan ?? 1;\n\tconst rowSpan = layout?.rowSpan ?? 1;\n\tconst columnEnd = columnStart + columnSpan - 1;\n\tconst rowEnd = rowStart + rowSpan - 1;\n\tconst columnCount = parentLayout?.columnCount;\n\tconst rowCount = parentLayout?.rowCount;\n\n\tconst getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(\n\t\tgridClientId,\n\t\tcolumnCount\n\t);\n\n\treturn (\n\t\t<BlockControls group=\"parent\">\n\t\t\t<ToolbarGroup className=\"block-editor-grid-item-mover__move-button-container\">\n\t\t\t\t<div className=\"block-editor-grid-item-mover__move-horizontal-button-container is-left\">\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\ticon={ chevronLeft }\n\t\t\t\t\t\tlabel={ __( 'Move left' ) }\n\t\t\t\t\t\tdescription={ __( 'Move left' ) }\n\t\t\t\t\t\tisDisabled={ columnStart <= 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcolumnStart: columnStart - 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart - 1,\n\t\t\t\t\t\t\t\t\trowStart\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"block-editor-grid-item-mover__move-vertical-button-container\">\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\tclassName=\"is-up-button\"\n\t\t\t\t\t\ticon={ chevronUp }\n\t\t\t\t\t\tlabel={ __( 'Move up' ) }\n\t\t\t\t\t\tdescription={ __( 'Move up' ) }\n\t\t\t\t\t\tisDisabled={ rowStart <= 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\trowStart: rowStart - 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\trowStart - 1\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\tclassName=\"is-down-button\"\n\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\tlabel={ __( 'Move down' ) }\n\t\t\t\t\t\tdescription={ __( 'Move down' ) }\n\t\t\t\t\t\tisDisabled={ rowCount && rowEnd >= rowCount }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\trowStart: rowStart + 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\trowStart + 1\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"block-editor-grid-item-mover__move-horizontal-button-container is-right\">\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\ticon={ chevronRight }\n\t\t\t\t\t\tlabel={ __( 'Move right' ) }\n\t\t\t\t\t\tdescription={ __( 'Move right' ) }\n\t\t\t\t\t\tisDisabled={ columnCount && columnEnd >= columnCount }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcolumnStart: columnStart + 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart + 1,\n\t\t\t\t\t\t\t\t\trowStart\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n}\n\nfunction GridItemMover( {\n\tclassName,\n\ticon,\n\tlabel,\n\tisDisabled,\n\tonClick,\n\tdescription,\n} ) {\n\tconst instanceId = useInstanceId( GridItemMover );\n\tconst descriptionId = `block-editor-grid-item-mover-button__description-${ instanceId }`;\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-grid-item-mover-button',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\tonClick={ isDisabled ? null : onClick }\n\t\t\t\tdisabled={ isDisabled }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t/>\n\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t{ description }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAMA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,cAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,+BAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAAwD,IAAAS,WAAA,GAAAT,OAAA;AA5BxD;AACA;AACA;;AAGA;AACA;AACA;;AAgBA;AACA;AACA;;AAKO,SAASU,cAAcA,CAAE;EAC/BC,MAAM;EACNC,YAAY;EACZC,QAAQ;EACRC,YAAY;EACZC;AACD,CAAC,EAAG;EAAA,IAAAC,mBAAA,EAAAC,gBAAA,EAAAC,kBAAA,EAAAC,eAAA;EACH,MAAM;IAAEC,oBAAoB;IAAEC;EAAwC,CAAC,GACtE,IAAAC,iBAAW,EAAEC,YAAiB,CAAC;EAEhC,MAAM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,qCAAqC,EACrCjB,SACD,CAAG;MACHE,IAAI,EAAGA,IAAM;MACbE,KAAK,EAAGA,KAAO;MACf,oBAAmBU,aAAe;MAClCN,OAAO,EAAGD,UAAU,GAAG,IAAI,GAAGC,OAAS;MACvCU,QAAQ,EAAGX,UAAY;MACvBY,sBAAsB;IAAA,CACtB,CAAC,eACF,IAAAlD,WAAA,CAAAyB,GAAA,EAAChC,WAAA,CAAA0D,cAAc;MAACC,EAAE,EAAGP,aAAe;MAAAjB,QAAA,EACjCS;IAAW,CACE,CAAC;EAAA,CAChB,CAAC;AAEL","ignoreList":[]}
@@ -25,7 +25,7 @@ function GridItemResizer({
25
25
  onChange,
26
26
  parentLayout
27
27
  }) {
28
- const blockElement = (0, _useBlockRefs.__unstableUseBlockElement)(clientId);
28
+ const blockElement = (0, _useBlockRefs.useBlockElement)(clientId);
29
29
  const rootBlockElement = blockElement?.parentElement;
30
30
  const {
31
31
  isManualPlacement
@@ -93,7 +93,7 @@ function GridItemResizerInner({
93
93
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_cover.default, {
94
94
  className: "block-editor-grid-item-resizer",
95
95
  clientId: clientId,
96
- __unstablePopoverSlot: "block-toolbar",
96
+ __unstablePopoverSlot: "__unstable-block-tools-after",
97
97
  additionalStyles: styles,
98
98
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ResizableBox, {
99
99
  className: "block-editor-grid-item-resizer__box",
@@ -113,6 +113,18 @@ function GridItemResizerInner({
113
113
  },
114
114
  bounds: bounds,
115
115
  boundsByDirection: true,
116
+ onPointerDown: ({
117
+ target,
118
+ pointerId
119
+ }) => {
120
+ /*
121
+ * Captures the pointer to avoid hiccups while dragging over objects
122
+ * like iframes and ensures that the event to end the drag is
123
+ * captured by the target (resize handle) whether or not it’s under
124
+ * the pointer.
125
+ */
126
+ target.setPointerCapture(pointerId);
127
+ },
116
128
  onResizeStart: (event, direction) => {
117
129
  /*
118
130
  * The container justification and alignment need to be set
@@ -120,19 +132,6 @@ function GridItemResizerInner({
120
132
  * so that it resizes in the right direction.
121
133
  */
122
134
  setResizeDirection(direction);
123
-
124
- /*
125
- * The mouseup event on the resize handle doesn't trigger if the mouse
126
- * isn't directly above the handle, so we try to detect if it happens
127
- * outside the grid and dispatch a mouseup event on the handle.
128
- */
129
- blockElement.ownerDocument.addEventListener('mouseup', () => {
130
- event.target.dispatchEvent(new Event('mouseup', {
131
- bubbles: true
132
- }));
133
- }, {
134
- once: true
135
- });
136
135
  },
137
136
  onResizeStop: (event, direction, boxElement) => {
138
137
  const columnGap = parseFloat((0, _utils.getComputedCSS)(rootBlockElement, 'column-gap'));
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_element","_useBlockRefs","_cover","_interopRequireDefault","_utils","_jsxRuntime","GridItemResizer","clientId","bounds","onChange","parentLayout","blockElement","useBlockElement","rootBlockElement","parentElement","isManualPlacement","jsx","GridItemResizerInner","isManualGrid","window","__experimentalEnableGridInteractivity","resizeDirection","setResizeDirection","useState","enableSide","setEnableSide","top","bottom","left","right","useEffect","observer","ResizeObserver","blockClientRect","getBoundingClientRect","rootBlockClientRect","observe","disconnect","justification","alignment","styles","display","justifyContent","alignItems","default","className","__unstablePopoverSlot","additionalStyles","children","ResizableBox","size","width","height","enable","bottomLeft","bottomRight","topLeft","topRight","boundsByDirection","onResizeStart","event","direction","ownerDocument","addEventListener","target","dispatchEvent","Event","bubbles","once","onResizeStop","boxElement","columnGap","parseFloat","getComputedCSS","rowGap","gridColumnTracks","getGridTracks","gridRowTracks","rect","DOMRect","offsetLeft","offsetTop","offsetWidth","offsetHeight","columnStart","getClosestTrack","rowStart","columnEnd","rowEnd","columnSpan","rowSpan","undefined"],"sources":["@wordpress/block-editor/src/components/grid/grid-item-resizer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ResizableBox } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport BlockPopoverCover from '../block-popover/cover';\nimport { getComputedCSS, getGridTracks, getClosestTrack } from './utils';\n\nexport function GridItemResizer( {\n\tclientId,\n\tbounds,\n\tonChange,\n\tparentLayout,\n} ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst rootBlockElement = blockElement?.parentElement;\n\tconst { isManualPlacement } = parentLayout;\n\n\tif ( ! blockElement || ! rootBlockElement ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GridItemResizerInner\n\t\t\tclientId={ clientId }\n\t\t\tbounds={ bounds }\n\t\t\tblockElement={ blockElement }\n\t\t\trootBlockElement={ rootBlockElement }\n\t\t\tonChange={ onChange }\n\t\t\tisManualGrid={\n\t\t\t\tisManualPlacement &&\n\t\t\t\twindow.__experimentalEnableGridInteractivity\n\t\t\t}\n\t\t/>\n\t);\n}\n\nfunction GridItemResizerInner( {\n\tclientId,\n\tbounds,\n\tblockElement,\n\trootBlockElement,\n\tonChange,\n\tisManualGrid,\n} ) {\n\tconst [ resizeDirection, setResizeDirection ] = useState( null );\n\tconst [ enableSide, setEnableSide ] = useState( {\n\t\ttop: false,\n\t\tbottom: false,\n\t\tleft: false,\n\t\tright: false,\n\t} );\n\n\tuseEffect( () => {\n\t\tconst observer = new window.ResizeObserver( () => {\n\t\t\tconst blockClientRect = blockElement.getBoundingClientRect();\n\t\t\tconst rootBlockClientRect =\n\t\t\t\trootBlockElement.getBoundingClientRect();\n\t\t\tsetEnableSide( {\n\t\t\t\ttop: blockClientRect.top > rootBlockClientRect.top,\n\t\t\t\tbottom: blockClientRect.bottom < rootBlockClientRect.bottom,\n\t\t\t\tleft: blockClientRect.left > rootBlockClientRect.left,\n\t\t\t\tright: blockClientRect.right < rootBlockClientRect.right,\n\t\t\t} );\n\t\t} );\n\t\tobserver.observe( blockElement );\n\t\treturn () => observer.disconnect();\n\t}, [ blockElement, rootBlockElement ] );\n\n\tconst justification = {\n\t\tright: 'flex-start',\n\t\tleft: 'flex-end',\n\t};\n\n\tconst alignment = {\n\t\ttop: 'flex-end',\n\t\tbottom: 'flex-start',\n\t};\n\n\tconst styles = {\n\t\tdisplay: 'flex',\n\t\tjustifyContent: 'center',\n\t\talignItems: 'center',\n\t\t...( justification[ resizeDirection ] && {\n\t\t\tjustifyContent: justification[ resizeDirection ],\n\t\t} ),\n\t\t...( alignment[ resizeDirection ] && {\n\t\t\talignItems: alignment[ resizeDirection ],\n\t\t} ),\n\t};\n\n\treturn (\n\t\t<BlockPopoverCover\n\t\t\tclassName=\"block-editor-grid-item-resizer\"\n\t\t\tclientId={ clientId }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t\tadditionalStyles={ styles }\n\t\t>\n\t\t\t<ResizableBox\n\t\t\t\tclassName=\"block-editor-grid-item-resizer__box\"\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: '100%',\n\t\t\t\t\theight: '100%',\n\t\t\t\t} }\n\t\t\t\tenable={ {\n\t\t\t\t\tbottom: enableSide.bottom,\n\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\tbottomRight: false,\n\t\t\t\t\tleft: enableSide.left,\n\t\t\t\t\tright: enableSide.right,\n\t\t\t\t\ttop: enableSide.top,\n\t\t\t\t\ttopLeft: false,\n\t\t\t\t\ttopRight: false,\n\t\t\t\t} }\n\t\t\t\tbounds={ bounds }\n\t\t\t\tboundsByDirection\n\t\t\t\tonResizeStart={ ( event, direction ) => {\n\t\t\t\t\t/*\n\t\t\t\t\t * The container justification and alignment need to be set\n\t\t\t\t\t * according to the direction the resizer is being dragged in,\n\t\t\t\t\t * so that it resizes in the right direction.\n\t\t\t\t\t */\n\t\t\t\t\tsetResizeDirection( direction );\n\n\t\t\t\t\t/*\n\t\t\t\t\t * The mouseup event on the resize handle doesn't trigger if the mouse\n\t\t\t\t\t * isn't directly above the handle, so we try to detect if it happens\n\t\t\t\t\t * outside the grid and dispatch a mouseup event on the handle.\n\t\t\t\t\t */\n\t\t\t\t\tblockElement.ownerDocument.addEventListener(\n\t\t\t\t\t\t'mouseup',\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tevent.target.dispatchEvent(\n\t\t\t\t\t\t\t\tnew Event( 'mouseup', { bubbles: true } )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ once: true }\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t\tonResizeStop={ ( event, direction, boxElement ) => {\n\t\t\t\t\tconst columnGap = parseFloat(\n\t\t\t\t\t\tgetComputedCSS( rootBlockElement, 'column-gap' )\n\t\t\t\t\t);\n\t\t\t\t\tconst rowGap = parseFloat(\n\t\t\t\t\t\tgetComputedCSS( rootBlockElement, 'row-gap' )\n\t\t\t\t\t);\n\t\t\t\t\tconst gridColumnTracks = getGridTracks(\n\t\t\t\t\t\tgetComputedCSS(\n\t\t\t\t\t\t\trootBlockElement,\n\t\t\t\t\t\t\t'grid-template-columns'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcolumnGap\n\t\t\t\t\t);\n\t\t\t\t\tconst gridRowTracks = getGridTracks(\n\t\t\t\t\t\tgetComputedCSS(\n\t\t\t\t\t\t\trootBlockElement,\n\t\t\t\t\t\t\t'grid-template-rows'\n\t\t\t\t\t\t),\n\t\t\t\t\t\trowGap\n\t\t\t\t\t);\n\t\t\t\t\tconst rect = new window.DOMRect(\n\t\t\t\t\t\tblockElement.offsetLeft + boxElement.offsetLeft,\n\t\t\t\t\t\tblockElement.offsetTop + boxElement.offsetTop,\n\t\t\t\t\t\tboxElement.offsetWidth,\n\t\t\t\t\t\tboxElement.offsetHeight\n\t\t\t\t\t);\n\t\t\t\t\tconst columnStart =\n\t\t\t\t\t\tgetClosestTrack( gridColumnTracks, rect.left ) + 1;\n\t\t\t\t\tconst rowStart =\n\t\t\t\t\t\tgetClosestTrack( gridRowTracks, rect.top ) + 1;\n\t\t\t\t\tconst columnEnd =\n\t\t\t\t\t\tgetClosestTrack( gridColumnTracks, rect.right, 'end' ) +\n\t\t\t\t\t\t1;\n\t\t\t\t\tconst rowEnd =\n\t\t\t\t\t\tgetClosestTrack( gridRowTracks, rect.bottom, 'end' ) +\n\t\t\t\t\t\t1;\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\tcolumnSpan: columnEnd - columnStart + 1,\n\t\t\t\t\t\trowSpan: rowEnd - rowStart + 1,\n\t\t\t\t\t\tcolumnStart: isManualGrid ? columnStart : undefined,\n\t\t\t\t\t\trowStart: isManualGrid ? rowStart : undefined,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</BlockPopoverCover>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAAyE,IAAAM,WAAA,GAAAN,OAAA;AAXzE;AACA;AACA;;AAIA;AACA;AACA;;AAKO,SAASO,eAAeA,CAAE;EAChCC,QAAQ;EACRC,MAAM;EACNC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,MAAMC,YAAY,GAAG,IAAAC,uCAAe,EAAEL,QAAS,CAAC;EAChD,MAAMM,gBAAgB,GAAGF,YAAY,EAAEG,aAAa;EACpD,MAAM;IAAEC;EAAkB,CAAC,GAAGL,YAAY;EAE1C,IAAK,CAAEC,YAAY,IAAI,CAAEE,gBAAgB,EAAG;IAC3C,OAAO,IAAI;EACZ;EAEA,oBACC,IAAAR,WAAA,CAAAW,GAAA,EAACC,oBAAoB;IACpBV,QAAQ,EAAGA,QAAU;IACrBC,MAAM,EAAGA,MAAQ;IACjBG,YAAY,EAAGA,YAAc;IAC7BE,gBAAgB,EAAGA,gBAAkB;IACrCJ,QAAQ,EAAGA,QAAU;IACrBS,YAAY,EACXH,iBAAiB,IACjBI,MAAM,CAACC;EACP,CACD,CAAC;AAEJ;AAEA,SAASH,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AI,CAACnD,MAAM,EAAE,KAAM,CAAC,GACpD,CAAC;QACFlB,QAAQ,CAAE;UACTgF,UAAU,EAAEF,SAAS,GAAGH,WAAW,GAAG,CAAC;UACvCM,OAAO,EAAEF,MAAM,GAAGF,QAAQ,GAAG,CAAC;UAC9BF,WAAW,EAAElE,YAAY,GAAGkE,WAAW,GAAGO,SAAS;UACnDL,QAAQ,EAAEpE,YAAY,GAAGoE,QAAQ,GAAGK;QACrC,CAAE,CAAC;MACJ;IAAG,CACH;EAAC,CACgB,CAAC;AAEtB","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_element","_useBlockRefs","_cover","_interopRequireDefault","_utils","_jsxRuntime","GridItemResizer","clientId","bounds","onChange","parentLayout","blockElement","useBlockElement","rootBlockElement","parentElement","isManualPlacement","jsx","GridItemResizerInner","isManualGrid","window","__experimentalEnableGridInteractivity","resizeDirection","setResizeDirection","useState","enableSide","setEnableSide","top","bottom","left","right","useEffect","observer","ResizeObserver","blockClientRect","getBoundingClientRect","rootBlockClientRect","observe","disconnect","justification","alignment","styles","display","justifyContent","alignItems","default","className","__unstablePopoverSlot","additionalStyles","children","ResizableBox","size","width","height","enable","bottomLeft","bottomRight","topLeft","topRight","boundsByDirection","onPointerDown","target","pointerId","setPointerCapture","onResizeStart","event","direction","onResizeStop","boxElement","columnGap","parseFloat","getComputedCSS","rowGap","gridColumnTracks","getGridTracks","gridRowTracks","rect","DOMRect","offsetLeft","offsetTop","offsetWidth","offsetHeight","columnStart","getClosestTrack","rowStart","columnEnd","rowEnd","columnSpan","rowSpan","undefined"],"sources":["@wordpress/block-editor/src/components/grid/grid-item-resizer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ResizableBox } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport BlockPopoverCover from '../block-popover/cover';\nimport { getComputedCSS, getGridTracks, getClosestTrack } from './utils';\n\nexport function GridItemResizer( {\n\tclientId,\n\tbounds,\n\tonChange,\n\tparentLayout,\n} ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst rootBlockElement = blockElement?.parentElement;\n\tconst { isManualPlacement } = parentLayout;\n\n\tif ( ! blockElement || ! rootBlockElement ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GridItemResizerInner\n\t\t\tclientId={ clientId }\n\t\t\tbounds={ bounds }\n\t\t\tblockElement={ blockElement }\n\t\t\trootBlockElement={ rootBlockElement }\n\t\t\tonChange={ onChange }\n\t\t\tisManualGrid={\n\t\t\t\tisManualPlacement &&\n\t\t\t\twindow.__experimentalEnableGridInteractivity\n\t\t\t}\n\t\t/>\n\t);\n}\n\nfunction GridItemResizerInner( {\n\tclientId,\n\tbounds,\n\tblockElement,\n\trootBlockElement,\n\tonChange,\n\tisManualGrid,\n} ) {\n\tconst [ resizeDirection, setResizeDirection ] = useState( null );\n\tconst [ enableSide, setEnableSide ] = useState( {\n\t\ttop: false,\n\t\tbottom: false,\n\t\tleft: false,\n\t\tright: false,\n\t} );\n\n\tuseEffect( () => {\n\t\tconst observer = new window.ResizeObserver( () => {\n\t\t\tconst blockClientRect = blockElement.getBoundingClientRect();\n\t\t\tconst rootBlockClientRect =\n\t\t\t\trootBlockElement.getBoundingClientRect();\n\t\t\tsetEnableSide( {\n\t\t\t\ttop: blockClientRect.top > rootBlockClientRect.top,\n\t\t\t\tbottom: blockClientRect.bottom < rootBlockClientRect.bottom,\n\t\t\t\tleft: blockClientRect.left > rootBlockClientRect.left,\n\t\t\t\tright: blockClientRect.right < rootBlockClientRect.right,\n\t\t\t} );\n\t\t} );\n\t\tobserver.observe( blockElement );\n\t\treturn () => observer.disconnect();\n\t}, [ blockElement, rootBlockElement ] );\n\n\tconst justification = {\n\t\tright: 'flex-start',\n\t\tleft: 'flex-end',\n\t};\n\n\tconst alignment = {\n\t\ttop: 'flex-end',\n\t\tbottom: 'flex-start',\n\t};\n\n\tconst styles = {\n\t\tdisplay: 'flex',\n\t\tjustifyContent: 'center',\n\t\talignItems: 'center',\n\t\t...( justification[ resizeDirection ] && {\n\t\t\tjustifyContent: justification[ resizeDirection ],\n\t\t} ),\n\t\t...( alignment[ resizeDirection ] && {\n\t\t\talignItems: alignment[ resizeDirection ],\n\t\t} ),\n\t};\n\n\treturn (\n\t\t<BlockPopoverCover\n\t\t\tclassName=\"block-editor-grid-item-resizer\"\n\t\t\tclientId={ clientId }\n\t\t\t__unstablePopoverSlot=\"__unstable-block-tools-after\"\n\t\t\tadditionalStyles={ styles }\n\t\t>\n\t\t\t<ResizableBox\n\t\t\t\tclassName=\"block-editor-grid-item-resizer__box\"\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: '100%',\n\t\t\t\t\theight: '100%',\n\t\t\t\t} }\n\t\t\t\tenable={ {\n\t\t\t\t\tbottom: enableSide.bottom,\n\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\tbottomRight: false,\n\t\t\t\t\tleft: enableSide.left,\n\t\t\t\t\tright: enableSide.right,\n\t\t\t\t\ttop: enableSide.top,\n\t\t\t\t\ttopLeft: false,\n\t\t\t\t\ttopRight: false,\n\t\t\t\t} }\n\t\t\t\tbounds={ bounds }\n\t\t\t\tboundsByDirection\n\t\t\t\tonPointerDown={ ( { target, pointerId } ) => {\n\t\t\t\t\t/*\n\t\t\t\t\t * Captures the pointer to avoid hiccups while dragging over objects\n\t\t\t\t\t * like iframes and ensures that the event to end the drag is\n\t\t\t\t\t * captured by the target (resize handle) whether or not it’s under\n\t\t\t\t\t * the pointer.\n\t\t\t\t\t */\n\t\t\t\t\ttarget.setPointerCapture( pointerId );\n\t\t\t\t} }\n\t\t\t\tonResizeStart={ ( event, direction ) => {\n\t\t\t\t\t/*\n\t\t\t\t\t * The container justification and alignment need to be set\n\t\t\t\t\t * according to the direction the resizer is being dragged in,\n\t\t\t\t\t * so that it resizes in the right direction.\n\t\t\t\t\t */\n\t\t\t\t\tsetResizeDirection( direction );\n\t\t\t\t} }\n\t\t\t\tonResizeStop={ ( event, direction, boxElement ) => {\n\t\t\t\t\tconst columnGap = parseFloat(\n\t\t\t\t\t\tgetComputedCSS( rootBlockElement, 'column-gap' )\n\t\t\t\t\t);\n\t\t\t\t\tconst rowGap = parseFloat(\n\t\t\t\t\t\tgetComputedCSS( rootBlockElement, 'row-gap' )\n\t\t\t\t\t);\n\t\t\t\t\tconst gridColumnTracks = getGridTracks(\n\t\t\t\t\t\tgetComputedCSS(\n\t\t\t\t\t\t\trootBlockElement,\n\t\t\t\t\t\t\t'grid-template-columns'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcolumnGap\n\t\t\t\t\t);\n\t\t\t\t\tconst gridRowTracks = getGridTracks(\n\t\t\t\t\t\tgetComputedCSS(\n\t\t\t\t\t\t\trootBlockElement,\n\t\t\t\t\t\t\t'grid-template-rows'\n\t\t\t\t\t\t),\n\t\t\t\t\t\trowGap\n\t\t\t\t\t);\n\t\t\t\t\tconst rect = new window.DOMRect(\n\t\t\t\t\t\tblockElement.offsetLeft + boxElement.offsetLeft,\n\t\t\t\t\t\tblockElement.offsetTop + boxElement.offsetTop,\n\t\t\t\t\t\tboxElement.offsetWidth,\n\t\t\t\t\t\tboxElement.offsetHeight\n\t\t\t\t\t);\n\t\t\t\t\tconst columnStart =\n\t\t\t\t\t\tgetClosestTrack( gridColumnTracks, rect.left ) + 1;\n\t\t\t\t\tconst rowStart =\n\t\t\t\t\t\tgetClosestTrack( gridRowTracks, rect.top ) + 1;\n\t\t\t\t\tconst columnEnd =\n\t\t\t\t\t\tgetClosestTrack( gridColumnTracks, rect.right, 'end' ) +\n\t\t\t\t\t\t1;\n\t\t\t\t\tconst rowEnd =\n\t\t\t\t\t\tgetClosestTrack( gridRowTracks, rect.bottom, 'end' ) +\n\t\t\t\t\t\t1;\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\tcolumnSpan: columnEnd - columnStart + 1,\n\t\t\t\t\t\trowSpan: rowEnd - rowStart + 1,\n\t\t\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ACgB,CAAC;AAEtB","ignoreList":[]}
@@ -15,6 +15,7 @@ var _utils = require("./utils");
15
15
  var _store = require("../../store");
16
16
  var _useGetNumberOfBlocksBeforeCell = require("./use-get-number-of-blocks-before-cell");
17
17
  var _buttonBlockAppender = _interopRequireDefault(require("../button-block-appender"));
18
+ var _lockUnlock = require("../../lock-unlock");
18
19
  var _jsxRuntime = require("react/jsx-runtime");
19
20
  /**
20
21
  * External dependencies
@@ -34,7 +35,7 @@ function GridVisualizer({
34
35
  parentLayout
35
36
  }) {
36
37
  const isDistractionFree = (0, _data.useSelect)(select => select(_store.store).getSettings().isDistractionFree, []);
37
- const gridElement = (0, _useBlockRefs.__unstableUseBlockElement)(clientId);
38
+ const gridElement = (0, _useBlockRefs.useBlockElement)(clientId);
38
39
  if (isDistractionFree || !gridElement) {
39
40
  return null;
40
41
  }
@@ -108,16 +109,24 @@ function ManualGridVisualizer({
108
109
  gridInfo
109
110
  }) {
110
111
  const [highlightedRect, setHighlightedRect] = (0, _element.useState)(null);
111
- const gridItems = (0, _data.useSelect)(select => select(_store.store).getBlocks(gridClientId), [gridClientId]);
112
+ const gridItemStyles = (0, _data.useSelect)(select => {
113
+ const {
114
+ getBlockOrder,
115
+ getBlockStyles
116
+ } = (0, _lockUnlock.unlock)(select(_store.store));
117
+ const blockOrder = getBlockOrder(gridClientId);
118
+ return getBlockStyles(blockOrder);
119
+ }, [gridClientId]);
112
120
  const occupiedRects = (0, _element.useMemo)(() => {
113
121
  const rects = [];
114
- for (const block of gridItems) {
122
+ for (const style of Object.values(gridItemStyles)) {
123
+ var _style$layout;
115
124
  const {
116
125
  columnStart,
117
126
  rowStart,
118
127
  columnSpan = 1,
119
128
  rowSpan = 1
120
- } = block.attributes.style?.layout || {};
129
+ } = (_style$layout = style?.layout) !== null && _style$layout !== void 0 ? _style$layout : {};
121
130
  if (!columnStart || !rowStart) {
122
131
  continue;
123
132
  }
@@ -129,7 +138,7 @@ function ManualGridVisualizer({
129
138
  }));
130
139
  }
131
140
  return rects;
132
- }, [gridItems]);
141
+ }, [gridItemStyles]);
133
142
  return (0, _utils.range)(1, gridInfo.numRows).map(row => (0, _utils.range)(1, gridInfo.numColumns).map(column => {
134
143
  var _highlightedRect$cont;
135
144
  const isCellOccupied = occupiedRects.some(rect => rect.contains(column, row));
@@ -170,7 +179,9 @@ function GridVisualizerCell({
170
179
  function useGridVisualizerDropZone(column, row, gridClientId, gridInfo, setHighlightedRect) {
171
180
  const {
172
181
  getBlockAttributes,
173
- getBlockRootClientId
182
+ getBlockRootClientId,
183
+ canInsertBlockType,
184
+ getBlockName
174
185
  } = (0, _data.useSelect)(_store.store);
175
186
  const {
176
187
  updateBlockAttributes,
@@ -180,6 +191,10 @@ function useGridVisualizerDropZone(column, row, gridClientId, gridInfo, setHighl
180
191
  const getNumberOfBlocksBeforeCell = (0, _useGetNumberOfBlocksBeforeCell.useGetNumberOfBlocksBeforeCell)(gridClientId, gridInfo.numColumns);
181
192
  return useDropZoneWithValidation({
182
193
  validateDrag(srcClientId) {
194
+ const blockName = getBlockName(srcClientId);
195
+ if (!canInsertBlockType(blockName, gridClientId)) {
196
+ return false;
197
+ }
183
198
  const attributes = getBlockAttributes(srcClientId);
184
199
  const rect = new _utils.GridRect({
185
200
  columnStart: column,