@wordpress/block-editor 13.2.0 → 13.4.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 (538) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +0 -5
  3. package/build/components/alignment-control/ui.js +2 -2
  4. package/build/components/alignment-control/ui.js.map +1 -1
  5. package/build/components/block-alignment-control/ui.js +1 -1
  6. package/build/components/block-alignment-control/ui.js.map +1 -1
  7. package/build/components/block-alignment-control/ui.native.js +1 -1
  8. package/build/components/block-alignment-control/ui.native.js.map +1 -1
  9. package/build/components/block-breadcrumb/index.js +12 -1
  10. package/build/components/block-breadcrumb/index.js.map +1 -1
  11. package/build/components/block-inspector/index.js +6 -3
  12. package/build/components/block-inspector/index.js.map +1 -1
  13. package/build/components/block-list/use-block-props/index.js +3 -1
  14. package/build/components/block-list/use-block-props/index.js.map +1 -1
  15. package/build/components/block-list/use-block-props/use-block-refs.js +9 -2
  16. package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
  17. package/build/components/block-list/use-block-props/use-is-hovered.js +25 -9
  18. package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  19. package/build/components/block-list/use-in-between-inserter.js +3 -2
  20. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  21. package/build/components/block-lock/modal.js +2 -0
  22. package/build/components/block-lock/modal.js.map +1 -1
  23. package/build/components/block-lock/toolbar.js +0 -1
  24. package/build/components/block-lock/toolbar.js.map +1 -1
  25. package/build/components/block-mover/button.js +1 -1
  26. package/build/components/block-mover/button.js.map +1 -1
  27. package/build/components/block-mover/index.js +1 -1
  28. package/build/components/block-mover/index.js.map +1 -1
  29. package/build/components/block-pattern-setup/setup-toolbar.js +2 -2
  30. package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  31. package/build/components/block-patterns-paging/index.js +5 -7
  32. package/build/components/block-patterns-paging/index.js.map +1 -1
  33. package/build/components/block-quick-navigation/index.js +20 -17
  34. package/build/components/block-quick-navigation/index.js.map +1 -1
  35. package/build/components/block-removal-warning-modal/index.js +2 -0
  36. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  37. package/build/components/block-rename/modal.js +4 -12
  38. package/build/components/block-rename/modal.js.map +1 -1
  39. package/build/components/block-switcher/index.js +1 -1
  40. package/build/components/block-switcher/index.js.map +1 -1
  41. package/build/components/block-switcher/pattern-transformations-menu.js +11 -12
  42. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  43. package/build/components/block-switcher/preview-block-popover.js +20 -17
  44. package/build/components/block-switcher/preview-block-popover.js.map +1 -1
  45. package/build/components/block-toolbar/shuffle.js +6 -2
  46. package/build/components/block-toolbar/shuffle.js.map +1 -1
  47. package/build/components/block-tools/block-selection-button.js +7 -58
  48. package/build/components/block-tools/block-selection-button.js.map +1 -1
  49. package/build/components/block-tools/block-toolbar-breadcrumb.js +9 -2
  50. package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
  51. package/build/components/block-tools/index.js +14 -1
  52. package/build/components/block-tools/index.js.map +1 -1
  53. package/build/components/block-tools/use-show-block-tools.js +9 -8
  54. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  55. package/build/components/block-tools/zoom-out-mode-inserter-button.js +45 -0
  56. package/build/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
  57. package/build/components/block-tools/zoom-out-mode-inserters.js +29 -28
  58. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  59. package/build/components/block-tools/zoom-out-popover.js +58 -0
  60. package/build/components/block-tools/zoom-out-popover.js.map +1 -0
  61. package/build/components/block-tools/zoom-out-toolbar.js +138 -0
  62. package/build/components/block-tools/zoom-out-toolbar.js.map +1 -0
  63. package/build/components/button-block-appender/index.js +3 -1
  64. package/build/components/button-block-appender/index.js.map +1 -1
  65. package/build/components/child-layout-control/index.js +26 -18
  66. package/build/components/child-layout-control/index.js.map +1 -1
  67. package/build/components/date-format-picker/index.js +1 -1
  68. package/build/components/date-format-picker/index.js.map +1 -1
  69. package/build/components/default-block-appender/index.js +7 -4
  70. package/build/components/default-block-appender/index.js.map +1 -1
  71. package/build/components/dimensions-tool/index.js +6 -4
  72. package/build/components/dimensions-tool/index.js.map +1 -1
  73. package/build/components/font-appearance-control/index.js +22 -62
  74. package/build/components/font-appearance-control/index.js.map +1 -1
  75. package/build/components/global-styles/background-panel.js +185 -116
  76. package/build/components/global-styles/background-panel.js.map +1 -1
  77. package/build/components/global-styles/border-panel.js +2 -1
  78. package/build/components/global-styles/border-panel.js.map +1 -1
  79. package/build/components/global-styles/color-panel.js +2 -1
  80. package/build/components/global-styles/color-panel.js.map +1 -1
  81. package/build/components/global-styles/dimensions-panel.js +2 -1
  82. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  83. package/build/components/global-styles/filters-panel.js +2 -1
  84. package/build/components/global-styles/filters-panel.js.map +1 -1
  85. package/build/components/global-styles/hooks.js +13 -1
  86. package/build/components/global-styles/hooks.js.map +1 -1
  87. package/build/components/global-styles/image-settings-panel.js +2 -1
  88. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  89. package/build/components/global-styles/typography-panel.js +45 -24
  90. package/build/components/global-styles/typography-panel.js.map +1 -1
  91. package/build/components/global-styles/typography-utils.js +121 -0
  92. package/build/components/global-styles/typography-utils.js.map +1 -1
  93. package/build/components/global-styles/use-global-styles-output.js +47 -13
  94. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  95. package/build/components/global-styles/utils.js +17 -7
  96. package/build/components/global-styles/utils.js.map +1 -1
  97. package/build/components/grid/grid-item-movers.js +90 -48
  98. package/build/components/grid/grid-item-movers.js.map +1 -1
  99. package/build/components/grid/grid-item-resizer.js +2 -2
  100. package/build/components/grid/grid-item-resizer.js.map +1 -1
  101. package/build/components/grid/grid-visualizer.js +117 -37
  102. package/build/components/grid/grid-visualizer.js.map +1 -1
  103. package/build/components/grid/use-grid-layout-sync.js +60 -41
  104. package/build/components/grid/use-grid-layout-sync.js.map +1 -1
  105. package/build/components/index.js +1 -9
  106. package/build/components/index.js.map +1 -1
  107. package/build/components/inner-blocks/index.js +2 -2
  108. package/build/components/inner-blocks/index.js.map +1 -1
  109. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
  110. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
  111. package/build/components/inserter/block-patterns-tab/patterns-filter.js +20 -23
  112. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  113. package/build/components/inserter/media-tab/media-panel.js +1 -0
  114. package/build/components/inserter/media-tab/media-panel.js.map +1 -1
  115. package/build/components/inserter/menu.js +26 -4
  116. package/build/components/inserter/menu.js.map +1 -1
  117. package/build/components/inserter/preview-panel.js +20 -3
  118. package/build/components/inserter/preview-panel.js.map +1 -1
  119. package/build/components/inserter/quick-inserter.js +2 -1
  120. package/build/components/inserter/quick-inserter.js.map +1 -1
  121. package/build/components/inserter-draggable-blocks/index.js +10 -3
  122. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  123. package/build/components/inspector-controls/block-support-tools-panel.js +2 -1
  124. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  125. package/build/components/inspector-controls-tabs/settings-tab.js +1 -2
  126. package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  127. package/build/components/link-control/link-preview.js +1 -1
  128. package/build/components/link-control/link-preview.js.map +1 -1
  129. package/build/components/list-view/block-select-button.js +2 -6
  130. package/build/components/list-view/block-select-button.js.map +1 -1
  131. package/build/components/list-view/block.js +2 -2
  132. package/build/components/list-view/block.js.map +1 -1
  133. package/build/components/list-view/utils.js +3 -1
  134. package/build/components/list-view/utils.js.map +1 -1
  135. package/build/components/media-placeholder/index.js +19 -23
  136. package/build/components/media-placeholder/index.js.map +1 -1
  137. package/build/components/navigable-toolbar/index.js +3 -1
  138. package/build/components/navigable-toolbar/index.js.map +1 -1
  139. package/build/components/rich-text/format-toolbar/index.js +1 -1
  140. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  141. package/build/components/rich-text/index.js +1 -1
  142. package/build/components/rich-text/index.js.map +1 -1
  143. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +9 -3
  144. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  145. package/build/components/tabbed-sidebar/index.js +66 -0
  146. package/build/components/tabbed-sidebar/index.js.map +1 -0
  147. package/build/components/url-popover/image-url-input-ui.js +3 -3
  148. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  149. package/build/components/url-popover/index.js +3 -0
  150. package/build/components/url-popover/index.js.map +1 -1
  151. package/build/hooks/background.js +26 -4
  152. package/build/hooks/background.js.map +1 -1
  153. package/build/hooks/block-hooks.js +11 -17
  154. package/build/hooks/block-hooks.js.map +1 -1
  155. package/build/hooks/block-style-variation.js +169 -4
  156. package/build/hooks/block-style-variation.js.map +1 -1
  157. package/build/hooks/duotone.js +16 -11
  158. package/build/hooks/duotone.js.map +1 -1
  159. package/build/hooks/grid-visualizer.js +62 -0
  160. package/build/hooks/grid-visualizer.js.map +1 -0
  161. package/build/hooks/index.js +15 -2
  162. package/build/hooks/index.js.map +1 -1
  163. package/build/hooks/layout-child.js +47 -23
  164. package/build/hooks/layout-child.js.map +1 -1
  165. package/build/hooks/position.js +4 -15
  166. package/build/hooks/position.js.map +1 -1
  167. package/build/hooks/use-bindings-attributes.js +96 -55
  168. package/build/hooks/use-bindings-attributes.js.map +1 -1
  169. package/build/hooks/utils.js +2 -0
  170. package/build/hooks/utils.js.map +1 -1
  171. package/build/layouts/constrained.js +50 -4
  172. package/build/layouts/constrained.js.map +1 -1
  173. package/build/layouts/grid.js +92 -51
  174. package/build/layouts/grid.js.map +1 -1
  175. package/build/private-apis.js +6 -4
  176. package/build/private-apis.js.map +1 -1
  177. package/build/store/actions.js +18 -1
  178. package/build/store/actions.js.map +1 -1
  179. package/build/store/defaults.js +0 -2
  180. package/build/store/defaults.js.map +1 -1
  181. package/build/store/defaults.native.js +0 -3
  182. package/build/store/defaults.native.js.map +1 -1
  183. package/build/store/private-keys.js +2 -1
  184. package/build/store/private-keys.js.map +1 -1
  185. package/build/store/reducer.js +19 -1
  186. package/build/store/reducer.js.map +1 -1
  187. package/build/store/selectors.js +13 -1
  188. package/build/store/selectors.js.map +1 -1
  189. package/build/utils/format-font-style.js +45 -0
  190. package/build/utils/format-font-style.js.map +1 -0
  191. package/build/utils/format-font-weight.js +68 -0
  192. package/build/utils/format-font-weight.js.map +1 -0
  193. package/build/utils/get-editor-region.js +34 -0
  194. package/build/utils/get-editor-region.js.map +1 -0
  195. package/build/utils/get-font-styles-and-weights.js +167 -0
  196. package/build/utils/get-font-styles-and-weights.js.map +1 -0
  197. package/build/utils/pasting.js +5 -13
  198. package/build/utils/pasting.js.map +1 -1
  199. package/build-module/components/alignment-control/ui.js +2 -2
  200. package/build-module/components/alignment-control/ui.js.map +1 -1
  201. package/build-module/components/block-alignment-control/ui.js +1 -1
  202. package/build-module/components/block-alignment-control/ui.js.map +1 -1
  203. package/build-module/components/block-alignment-control/ui.native.js +1 -1
  204. package/build-module/components/block-alignment-control/ui.native.js.map +1 -1
  205. package/build-module/components/block-breadcrumb/index.js +12 -1
  206. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  207. package/build-module/components/block-inspector/index.js +6 -3
  208. package/build-module/components/block-inspector/index.js.map +1 -1
  209. package/build-module/components/block-list/use-block-props/index.js +3 -1
  210. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  211. package/build-module/components/block-list/use-block-props/use-block-refs.js +11 -4
  212. package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
  213. package/build-module/components/block-list/use-block-props/use-is-hovered.js +26 -9
  214. package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  215. package/build-module/components/block-list/use-in-between-inserter.js +3 -2
  216. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  217. package/build-module/components/block-lock/modal.js +2 -0
  218. package/build-module/components/block-lock/modal.js.map +1 -1
  219. package/build-module/components/block-lock/toolbar.js +0 -1
  220. package/build-module/components/block-lock/toolbar.js.map +1 -1
  221. package/build-module/components/block-mover/button.js +1 -1
  222. package/build-module/components/block-mover/button.js.map +1 -1
  223. package/build-module/components/block-mover/index.js +1 -1
  224. package/build-module/components/block-mover/index.js.map +1 -1
  225. package/build-module/components/block-pattern-setup/setup-toolbar.js +2 -2
  226. package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  227. package/build-module/components/block-patterns-paging/index.js +5 -7
  228. package/build-module/components/block-patterns-paging/index.js.map +1 -1
  229. package/build-module/components/block-quick-navigation/index.js +20 -17
  230. package/build-module/components/block-quick-navigation/index.js.map +1 -1
  231. package/build-module/components/block-removal-warning-modal/index.js +2 -0
  232. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  233. package/build-module/components/block-rename/modal.js +5 -13
  234. package/build-module/components/block-rename/modal.js.map +1 -1
  235. package/build-module/components/block-switcher/index.js +1 -1
  236. package/build-module/components/block-switcher/index.js.map +1 -1
  237. package/build-module/components/block-switcher/pattern-transformations-menu.js +12 -13
  238. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  239. package/build-module/components/block-switcher/preview-block-popover.js +20 -17
  240. package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
  241. package/build-module/components/block-toolbar/shuffle.js +6 -2
  242. package/build-module/components/block-toolbar/shuffle.js.map +1 -1
  243. package/build-module/components/block-tools/block-selection-button.js +10 -61
  244. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  245. package/build-module/components/block-tools/block-toolbar-breadcrumb.js +9 -2
  246. package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
  247. package/build-module/components/block-tools/index.js +14 -1
  248. package/build-module/components/block-tools/index.js.map +1 -1
  249. package/build-module/components/block-tools/use-show-block-tools.js +9 -8
  250. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  251. package/build-module/components/block-tools/zoom-out-mode-inserter-button.js +37 -0
  252. package/build-module/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
  253. package/build-module/components/block-tools/zoom-out-mode-inserters.js +30 -29
  254. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  255. package/build-module/components/block-tools/zoom-out-popover.js +49 -0
  256. package/build-module/components/block-tools/zoom-out-popover.js.map +1 -0
  257. package/build-module/components/block-tools/zoom-out-toolbar.js +131 -0
  258. package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -0
  259. package/build-module/components/button-block-appender/index.js +3 -1
  260. package/build-module/components/button-block-appender/index.js.map +1 -1
  261. package/build-module/components/child-layout-control/index.js +27 -19
  262. package/build-module/components/child-layout-control/index.js.map +1 -1
  263. package/build-module/components/date-format-picker/index.js +2 -2
  264. package/build-module/components/date-format-picker/index.js.map +1 -1
  265. package/build-module/components/default-block-appender/index.js +7 -4
  266. package/build-module/components/default-block-appender/index.js.map +1 -1
  267. package/build-module/components/dimensions-tool/index.js +6 -4
  268. package/build-module/components/dimensions-tool/index.js.map +1 -1
  269. package/build-module/components/font-appearance-control/index.js +24 -62
  270. package/build-module/components/font-appearance-control/index.js.map +1 -1
  271. package/build-module/components/global-styles/background-panel.js +188 -119
  272. package/build-module/components/global-styles/background-panel.js.map +1 -1
  273. package/build-module/components/global-styles/border-panel.js +3 -2
  274. package/build-module/components/global-styles/border-panel.js.map +1 -1
  275. package/build-module/components/global-styles/color-panel.js +3 -2
  276. package/build-module/components/global-styles/color-panel.js.map +1 -1
  277. package/build-module/components/global-styles/dimensions-panel.js +3 -2
  278. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  279. package/build-module/components/global-styles/filters-panel.js +3 -2
  280. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  281. package/build-module/components/global-styles/hooks.js +13 -1
  282. package/build-module/components/global-styles/hooks.js.map +1 -1
  283. package/build-module/components/global-styles/image-settings-panel.js +3 -2
  284. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  285. package/build-module/components/global-styles/typography-panel.js +47 -26
  286. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  287. package/build-module/components/global-styles/typography-utils.js +117 -0
  288. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  289. package/build-module/components/global-styles/use-global-styles-output.js +47 -13
  290. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  291. package/build-module/components/global-styles/utils.js +15 -6
  292. package/build-module/components/global-styles/utils.js.map +1 -1
  293. package/build-module/components/grid/grid-item-movers.js +93 -50
  294. package/build-module/components/grid/grid-item-movers.js.map +1 -1
  295. package/build-module/components/grid/grid-item-resizer.js +2 -2
  296. package/build-module/components/grid/grid-item-resizer.js.map +1 -1
  297. package/build-module/components/grid/grid-visualizer.js +118 -38
  298. package/build-module/components/grid/grid-visualizer.js.map +1 -1
  299. package/build-module/components/grid/use-grid-layout-sync.js +61 -42
  300. package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
  301. package/build-module/components/index.js +0 -5
  302. package/build-module/components/index.js.map +1 -1
  303. package/build-module/components/inner-blocks/index.js +2 -2
  304. package/build-module/components/inner-blocks/index.js.map +1 -1
  305. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
  306. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
  307. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +20 -23
  308. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  309. package/build-module/components/inserter/media-tab/media-panel.js +1 -0
  310. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
  311. package/build-module/components/inserter/menu.js +26 -4
  312. package/build-module/components/inserter/menu.js.map +1 -1
  313. package/build-module/components/inserter/preview-panel.js +20 -3
  314. package/build-module/components/inserter/preview-panel.js.map +1 -1
  315. package/build-module/components/inserter/quick-inserter.js +2 -1
  316. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  317. package/build-module/components/inserter-draggable-blocks/index.js +10 -3
  318. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  319. package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -2
  320. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  321. package/build-module/components/inspector-controls-tabs/settings-tab.js +1 -2
  322. package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  323. package/build-module/components/link-control/link-preview.js +1 -1
  324. package/build-module/components/link-control/link-preview.js.map +1 -1
  325. package/build-module/components/list-view/block-select-button.js +3 -7
  326. package/build-module/components/list-view/block-select-button.js.map +1 -1
  327. package/build-module/components/list-view/block.js +2 -2
  328. package/build-module/components/list-view/block.js.map +1 -1
  329. package/build-module/components/list-view/utils.js +3 -1
  330. package/build-module/components/list-view/utils.js.map +1 -1
  331. package/build-module/components/media-placeholder/index.js +19 -23
  332. package/build-module/components/media-placeholder/index.js.map +1 -1
  333. package/build-module/components/navigable-toolbar/index.js +3 -1
  334. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  335. package/build-module/components/rich-text/format-toolbar/index.js +1 -1
  336. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  337. package/build-module/components/rich-text/index.js +1 -1
  338. package/build-module/components/rich-text/index.js.map +1 -1
  339. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +9 -3
  340. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  341. package/build-module/components/tabbed-sidebar/index.js +60 -0
  342. package/build-module/components/tabbed-sidebar/index.js.map +1 -0
  343. package/build-module/components/url-popover/image-url-input-ui.js +3 -3
  344. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  345. package/build-module/components/url-popover/index.js +3 -0
  346. package/build-module/components/url-popover/index.js.map +1 -1
  347. package/build-module/hooks/background.js +26 -4
  348. package/build-module/hooks/background.js.map +1 -1
  349. package/build-module/hooks/block-hooks.js +11 -17
  350. package/build-module/hooks/block-hooks.js.map +1 -1
  351. package/build-module/hooks/block-style-variation.js +168 -4
  352. package/build-module/hooks/block-style-variation.js.map +1 -1
  353. package/build-module/hooks/duotone.js +16 -11
  354. package/build-module/hooks/duotone.js.map +1 -1
  355. package/build-module/hooks/grid-visualizer.js +61 -0
  356. package/build-module/hooks/grid-visualizer.js.map +1 -0
  357. package/build-module/hooks/index.js +3 -0
  358. package/build-module/hooks/index.js.map +1 -1
  359. package/build-module/hooks/layout-child.js +47 -23
  360. package/build-module/hooks/layout-child.js.map +1 -1
  361. package/build-module/hooks/position.js +4 -15
  362. package/build-module/hooks/position.js.map +1 -1
  363. package/build-module/hooks/use-bindings-attributes.js +96 -56
  364. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  365. package/build-module/hooks/utils.js +2 -0
  366. package/build-module/hooks/utils.js.map +1 -1
  367. package/build-module/layouts/constrained.js +50 -4
  368. package/build-module/layouts/constrained.js.map +1 -1
  369. package/build-module/layouts/grid.js +92 -51
  370. package/build-module/layouts/grid.js.map +1 -1
  371. package/build-module/private-apis.js +8 -6
  372. package/build-module/private-apis.js.map +1 -1
  373. package/build-module/store/actions.js +15 -0
  374. package/build-module/store/actions.js.map +1 -1
  375. package/build-module/store/defaults.js +0 -2
  376. package/build-module/store/defaults.js.map +1 -1
  377. package/build-module/store/defaults.native.js +0 -3
  378. package/build-module/store/defaults.native.js.map +1 -1
  379. package/build-module/store/private-keys.js +1 -0
  380. package/build-module/store/private-keys.js.map +1 -1
  381. package/build-module/store/reducer.js +18 -1
  382. package/build-module/store/reducer.js.map +1 -1
  383. package/build-module/store/selectors.js +10 -0
  384. package/build-module/store/selectors.js.map +1 -1
  385. package/build-module/utils/format-font-style.js +39 -0
  386. package/build-module/utils/format-font-style.js.map +1 -0
  387. package/build-module/utils/format-font-weight.js +62 -0
  388. package/build-module/utils/format-font-weight.js.map +1 -0
  389. package/build-module/utils/get-editor-region.js +28 -0
  390. package/build-module/utils/get-editor-region.js.map +1 -0
  391. package/build-module/utils/get-font-styles-and-weights.js +160 -0
  392. package/build-module/utils/get-font-styles-and-weights.js.map +1 -0
  393. package/build-module/utils/pasting.js +5 -13
  394. package/build-module/utils/pasting.js.map +1 -1
  395. package/build-style/content-rtl.css +7 -6
  396. package/build-style/content.css +7 -6
  397. package/build-style/style-rtl.css +356 -181
  398. package/build-style/style.css +356 -181
  399. package/build-types/components/block-context/index.d.ts +2 -2
  400. package/build-types/components/block-context/index.d.ts.map +1 -1
  401. package/build-types/utils/dom.d.ts.map +1 -1
  402. package/package.json +32 -32
  403. package/src/components/alignment-control/ui.js +2 -2
  404. package/src/components/block-alignment-control/ui.js +1 -1
  405. package/src/components/block-alignment-control/ui.native.js +1 -1
  406. package/src/components/block-breadcrumb/index.js +16 -1
  407. package/src/components/block-context/README.md +4 -4
  408. package/src/components/block-inspector/index.js +8 -4
  409. package/src/components/block-list/content.scss +2 -16
  410. package/src/components/block-list/use-block-props/index.js +1 -1
  411. package/src/components/block-list/use-block-props/use-block-refs.js +19 -3
  412. package/src/components/block-list/use-block-props/use-is-hovered.js +26 -11
  413. package/src/components/block-list/use-in-between-inserter.js +5 -1
  414. package/src/components/block-lock/modal.js +10 -2
  415. package/src/components/block-lock/style.scss +4 -8
  416. package/src/components/block-lock/toolbar.js +0 -1
  417. package/src/components/block-mover/button.js +1 -1
  418. package/src/components/block-mover/index.js +1 -1
  419. package/src/components/block-pattern-setup/setup-toolbar.js +2 -2
  420. package/src/components/block-patterns-paging/index.js +8 -11
  421. package/src/components/block-patterns-paging/style.scss +0 -5
  422. package/src/components/block-quick-navigation/index.js +21 -28
  423. package/src/components/block-removal-warning-modal/index.js +10 -2
  424. package/src/components/block-rename/modal.js +2 -8
  425. package/src/components/block-switcher/index.js +1 -1
  426. package/src/components/block-switcher/pattern-transformations-menu.js +17 -15
  427. package/src/components/block-switcher/preview-block-popover.js +20 -14
  428. package/src/components/block-switcher/style.scss +8 -17
  429. package/src/components/block-switcher/test/index.js +6 -6
  430. package/src/components/block-toolbar/shuffle.js +9 -1
  431. package/src/components/block-toolbar/style.scss +1 -11
  432. package/src/components/block-tools/block-selection-button.js +11 -83
  433. package/src/components/block-tools/block-toolbar-breadcrumb.js +9 -4
  434. package/src/components/block-tools/index.js +21 -1
  435. package/src/components/block-tools/style.scss +23 -0
  436. package/src/components/block-tools/use-show-block-tools.js +21 -10
  437. package/src/components/block-tools/zoom-out-mode-inserter-button.js +47 -0
  438. package/src/components/block-tools/zoom-out-mode-inserters.js +44 -33
  439. package/src/components/block-tools/zoom-out-popover.js +50 -0
  440. package/src/components/block-tools/zoom-out-toolbar.js +140 -0
  441. package/src/components/button-block-appender/index.js +2 -1
  442. package/src/components/child-layout-control/index.js +41 -23
  443. package/src/components/date-format-picker/index.js +2 -2
  444. package/src/components/date-format-picker/style.scss +0 -9
  445. package/src/components/default-block-appender/index.js +11 -4
  446. package/src/components/dimensions-tool/index.js +97 -89
  447. package/src/components/font-appearance-control/index.js +24 -82
  448. package/src/components/font-appearance-control/style.scss +3 -5
  449. package/src/components/global-styles/background-panel.js +266 -167
  450. package/src/components/global-styles/border-panel.js +3 -2
  451. package/src/components/global-styles/color-panel.js +3 -2
  452. package/src/components/global-styles/dimensions-panel.js +3 -2
  453. package/src/components/global-styles/filters-panel.js +3 -2
  454. package/src/components/global-styles/hooks.js +14 -1
  455. package/src/components/global-styles/image-settings-panel.js +3 -2
  456. package/src/components/global-styles/style.scss +116 -19
  457. package/src/components/global-styles/test/typography-utils.js +594 -0
  458. package/src/components/global-styles/test/use-global-styles-output.js +3 -1
  459. package/src/components/global-styles/typography-panel.js +56 -27
  460. package/src/components/global-styles/typography-utils.js +159 -0
  461. package/src/components/global-styles/use-global-styles-output.js +45 -10
  462. package/src/components/global-styles/utils.js +17 -6
  463. package/src/components/grid/grid-item-movers.js +140 -86
  464. package/src/components/grid/grid-item-resizer.js +3 -2
  465. package/src/components/grid/grid-visualizer.js +172 -55
  466. package/src/components/grid/style.scss +157 -8
  467. package/src/components/grid/use-grid-layout-sync.js +88 -46
  468. package/src/components/iframe/content.scss +2 -1
  469. package/src/components/index.js +0 -5
  470. package/src/components/inner-blocks/index.js +6 -2
  471. package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -16
  472. package/src/components/inserter/block-patterns-tab/patterns-filter.js +40 -44
  473. package/src/components/inserter/media-tab/media-panel.js +1 -0
  474. package/src/components/inserter/menu.js +47 -13
  475. package/src/components/inserter/preview-panel.js +27 -4
  476. package/src/components/inserter/quick-inserter.js +6 -1
  477. package/src/components/inserter/style.scss +58 -92
  478. package/src/components/inserter-draggable-blocks/index.js +11 -3
  479. package/src/components/inspector-controls/block-support-tools-panel.js +3 -3
  480. package/src/components/inspector-controls-tabs/settings-tab.js +0 -2
  481. package/src/components/inspector-controls-tabs/style.scss +0 -21
  482. package/src/components/link-control/link-preview.js +1 -1
  483. package/src/components/list-view/block-select-button.js +3 -13
  484. package/src/components/list-view/block.js +10 -3
  485. package/src/components/list-view/style.scss +2 -1
  486. package/src/components/list-view/utils.js +13 -2
  487. package/src/components/media-placeholder/index.js +22 -32
  488. package/src/components/navigable-toolbar/index.js +3 -1
  489. package/src/components/rich-text/format-toolbar/index.js +1 -1
  490. package/src/components/rich-text/index.js +1 -1
  491. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +9 -2
  492. package/src/components/tabbed-sidebar/README.md +76 -0
  493. package/src/components/tabbed-sidebar/index.js +70 -0
  494. package/src/components/tabbed-sidebar/style.scss +53 -0
  495. package/src/components/url-popover/image-url-input-ui.js +3 -3
  496. package/src/components/url-popover/index.js +3 -0
  497. package/src/components/url-popover/style.scss +1 -0
  498. package/src/hooks/background.js +25 -10
  499. package/src/hooks/block-hooks.js +9 -16
  500. package/src/hooks/block-style-variation.js +202 -3
  501. package/src/hooks/duotone.js +16 -12
  502. package/src/hooks/grid-visualizer.js +62 -0
  503. package/src/hooks/index.js +3 -0
  504. package/src/hooks/layout-child.js +64 -39
  505. package/src/hooks/position.js +3 -20
  506. package/src/hooks/test/get-variation-styles-with-ref-values.js +91 -0
  507. package/src/hooks/use-bindings-attributes.js +107 -63
  508. package/src/hooks/utils.js +2 -0
  509. package/src/layouts/constrained.js +53 -4
  510. package/src/layouts/grid.js +148 -51
  511. package/src/private-apis.js +12 -7
  512. package/src/store/actions.js +15 -0
  513. package/src/store/defaults.js +0 -2
  514. package/src/store/defaults.native.js +0 -3
  515. package/src/store/private-keys.js +1 -0
  516. package/src/store/reducer.js +18 -0
  517. package/src/store/selectors.js +10 -0
  518. package/src/style.scss +1 -1
  519. package/src/utils/format-font-style.js +40 -0
  520. package/src/utils/format-font-weight.js +63 -0
  521. package/src/utils/get-editor-region.js +31 -0
  522. package/src/utils/get-font-styles-and-weights.js +191 -0
  523. package/src/utils/pasting.js +5 -12
  524. package/src/utils/test/format-font-style.js +34 -0
  525. package/src/utils/test/format-font-weight.js +66 -0
  526. package/src/utils/test/get-font-styles-and-weights.js +513 -0
  527. package/tsconfig.tsbuildinfo +1 -1
  528. package/build/components/inserter/reusable-block-rename-hint.js +0 -71
  529. package/build/components/inserter/reusable-block-rename-hint.js.map +0 -1
  530. package/build/components/inspector-controls-tabs/settings-tab-hint.js +0 -53
  531. package/build/components/inspector-controls-tabs/settings-tab-hint.js.map +0 -1
  532. package/build-module/components/inserter/reusable-block-rename-hint.js +0 -64
  533. package/build-module/components/inserter/reusable-block-rename-hint.js.map +0 -1
  534. package/build-module/components/inspector-controls-tabs/settings-tab-hint.js +0 -47
  535. package/build-module/components/inspector-controls-tabs/settings-tab-hint.js.map +0 -1
  536. package/src/components/inserter/reusable-block-rename-hint.js +0 -69
  537. package/src/components/inspector-controls-tabs/settings-tab-hint.js +0 -52
  538. package/src/hooks/position.scss +0 -18
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_data","_element","_globalStyles","_utils","_store","_privateKeys","VARIATION_PREFIX","getVariationMatches","className","split","reduce","matches","name","startsWith","match","slice","length","push","getVariationNameFromClass","registeredStyles","variation","some","style","useBlockStyleVariation","clientId","merged","mergedConfig","useContext","GlobalStylesContext","globalSettings","globalStyles","useSelect","select","settings","blockEditorStore","getSettings","__experimentalFeatures","globalStylesDataKey","useMemo","_mergedConfig$styles","_mergedConfig$setting","styles","variationStyles","blocks","variations","useBlockProps","getBlockStyles","blocksStore","variationClass","variationConfig","blockSelectors","getBlockSelectors","getBlockTypes","hasBlockGapSupport","hasFallbackGapSupport","disableLayoutStyles","disableRootPadding","toStyles","blockGap","blockStyles","layoutStyles","marginReset","presets","rootPadding","useStyleOverride","id","css","__unstableType","_default","exports","default","hasSupport","attributeKeys","isMatch"],"sources":["@wordpress/block-editor/src/hooks/block-style-variation.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockTypes, store as blocksStore } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tGlobalStylesContext,\n\ttoStyles,\n\tgetBlockSelectors,\n} from '../components/global-styles';\nimport { useStyleOverride } from './utils';\nimport { store as blockEditorStore } from '../store';\nimport { globalStylesDataKey } from '../store/private-keys';\n\nconst VARIATION_PREFIX = 'is-style-';\n\nfunction getVariationMatches( className ) {\n\tif ( ! className ) {\n\t\treturn [];\n\t}\n\treturn className.split( /\\s+/ ).reduce( ( matches, name ) => {\n\t\tif ( name.startsWith( VARIATION_PREFIX ) ) {\n\t\t\tconst match = name.slice( VARIATION_PREFIX.length );\n\t\t\tif ( match !== 'default' ) {\n\t\t\t\tmatches.push( match );\n\t\t\t}\n\t\t}\n\t\treturn matches;\n\t}, [] );\n}\n\n/**\n * Get the first block style variation that has been registered from the class string.\n *\n * @param {string} className CSS class string for a block.\n * @param {Array} registeredStyles Currently registered block styles.\n *\n * @return {string|null} The name of the first registered variation.\n */\nfunction getVariationNameFromClass( className, registeredStyles = [] ) {\n\t// The global flag affects how capturing groups work in JS. So the regex\n\t// below will only return full CSS classes not just the variation name.\n\tconst matches = getVariationMatches( className );\n\n\tif ( ! matches ) {\n\t\treturn null;\n\t}\n\n\tfor ( const variation of matches ) {\n\t\tif ( registeredStyles.some( ( style ) => style.name === variation ) ) {\n\t\t\treturn variation;\n\t\t}\n\t}\n\treturn null;\n}\n\nfunction useBlockStyleVariation( name, variation, clientId ) {\n\t// Prefer global styles data in GlobalStylesContext, which are available\n\t// if in the site editor. Otherwise fall back to whatever is in the\n\t// editor settings and available in the post editor.\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\tconst { globalSettings, globalStyles } = useSelect( ( select ) => {\n\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tglobalSettings: settings.__experimentalFeatures,\n\t\t\tglobalStyles: settings[ globalStylesDataKey ],\n\t\t};\n\t}, [] );\n\n\treturn useMemo( () => {\n\t\tconst styles = mergedConfig?.styles ?? globalStyles;\n\t\tconst variationStyles =\n\t\t\tstyles?.blocks?.[ name ]?.variations?.[ variation ];\n\n\t\treturn {\n\t\t\tsettings: mergedConfig?.settings ?? globalSettings,\n\t\t\t// The variation style data is all that is needed to generate\n\t\t\t// the styles for the current application to a block. The variation\n\t\t\t// name is updated to match the instance specific class name.\n\t\t\tstyles: {\n\t\t\t\tblocks: {\n\t\t\t\t\t[ name ]: {\n\t\t\t\t\t\tvariations: {\n\t\t\t\t\t\t\t[ `${ variation }-${ clientId }` ]: variationStyles,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}, [\n\t\tmergedConfig,\n\t\tglobalSettings,\n\t\tglobalStyles,\n\t\tvariation,\n\t\tclientId,\n\t\tname,\n\t] );\n}\n\n// Rather than leveraging `useInstanceId` here, the `clientId` is used.\n// This is so that the variation style override's ID is predictable\n// when the order of applied style variations changes.\nfunction useBlockProps( { name, className, clientId } ) {\n\tconst { getBlockStyles } = useSelect( blocksStore );\n\n\tconst registeredStyles = getBlockStyles( name );\n\tconst variation = getVariationNameFromClass( className, registeredStyles );\n\tconst variationClass = `${ VARIATION_PREFIX }${ variation }-${ clientId }`;\n\n\tconst { settings, styles } = useBlockStyleVariation(\n\t\tname,\n\t\tvariation,\n\t\tclientId\n\t);\n\n\tconst variationStyles = useMemo( () => {\n\t\tif ( ! variation ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst variationConfig = { settings, styles };\n\t\tconst blockSelectors = getBlockSelectors(\n\t\t\tgetBlockTypes(),\n\t\t\tgetBlockStyles,\n\t\t\tclientId\n\t\t);\n\t\tconst hasBlockGapSupport = false;\n\t\tconst hasFallbackGapSupport = true;\n\t\tconst disableLayoutStyles = true;\n\t\tconst disableRootPadding = true;\n\n\t\treturn toStyles(\n\t\t\tvariationConfig,\n\t\t\tblockSelectors,\n\t\t\thasBlockGapSupport,\n\t\t\thasFallbackGapSupport,\n\t\t\tdisableLayoutStyles,\n\t\t\tdisableRootPadding,\n\t\t\t{\n\t\t\t\tblockGap: false,\n\t\t\t\tblockStyles: true,\n\t\t\t\tlayoutStyles: false,\n\t\t\t\tmarginReset: false,\n\t\t\t\tpresets: false,\n\t\t\t\trootPadding: false,\n\t\t\t\tvariationStyles: true,\n\t\t\t}\n\t\t);\n\t}, [ variation, settings, styles, getBlockStyles, clientId ] );\n\n\tuseStyleOverride( {\n\t\tid: `variation-${ clientId }`,\n\t\tcss: variationStyles,\n\t\t__unstableType: 'variation',\n\t\t// The clientId will be stored with the override and used to ensure\n\t\t// the order of overrides matches the order of blocks so that the\n\t\t// correct CSS cascade is maintained.\n\t\tclientId,\n\t} );\n\n\treturn variation ? { className: variationClass } : {};\n}\n\nexport default {\n\thasSupport: () => true,\n\tattributeKeys: [ 'className' ],\n\tisMatch: ( { className } ) => getVariationMatches( className ).length > 0,\n\tuseBlockProps,\n};\n"],"mappings":";;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,aAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAjBA;AACA;AACA;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;EACdC,UAAU,EAAEA,CAAA,KAAM,IAAI;EACtBC,aAAa,EAAE,CAAE,WAAW,CAAE;EAC9BC,OAAO,EAAEA,CAAE;IAAEjE;EAAU,CAAC,KAAMD,mBAAmB,CAAEC,SAAU,CAAC,CAACQ,MAAM,GAAG,CAAC;EACzE6B;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_blocks","require","_data","_element","_globalStyles","_utils","_object","_store","_privateKeys","_lockUnlock","_jsxRuntime","VARIATION_PREFIX","getVariationMatches","className","split","reduce","matches","name","startsWith","match","slice","length","push","getVariationNameFromClass","registeredStyles","variation","some","style","OverrideStyles","override","useStyleOverride","__unstableBlockStyleVariationOverridesWithConfig","config","getBlockStyles","overrides","useSelect","select","blocksStore","unlock","blockEditorStore","getStyleOverrides","getBlockName","overridesWithConfig","useMemo","newOverrides","overriddenClientIds","clientId","includes","blockName","configStyles","styles","blocks","variations","variationConfig","settings","blockSelectors","getBlockSelectors","getBlockTypes","hasBlockGapSupport","hasFallbackGapSupport","disableLayoutStyles","disableRootPadding","variationStyles","toStyles","blockGap","blockStyles","layoutStyles","marginReset","presets","rootPadding","id","css","__unstableType","jsx","Fragment","children","map","getVariationStylesWithRefValues","globalStyles","replaceRefs","Object","keys","forEach","key","value","ref","undefined","trim","refValue","getValueFromObjectPath","JSON","parse","stringify","useBlockStyleVariation","merged","mergedConfig","useContext","GlobalStylesContext","globalSettings","getSettings","__experimentalFeatures","globalStylesDataKey","_mergedConfig$setting","_mergedConfig$styles","_mergedConfig$setting2","useBlockProps","variationClass","_default","exports","default","hasSupport","attributeKeys","isMatch"],"sources":["@wordpress/block-editor/src/hooks/block-style-variation.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockTypes, store as blocksStore } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tGlobalStylesContext,\n\ttoStyles,\n\tgetBlockSelectors,\n} from '../components/global-styles';\nimport { useStyleOverride } from './utils';\nimport { getValueFromObjectPath } from '../utils/object';\nimport { store as blockEditorStore } from '../store';\nimport { globalStylesDataKey } from '../store/private-keys';\nimport { unlock } from '../lock-unlock';\n\nconst VARIATION_PREFIX = 'is-style-';\n\nfunction getVariationMatches( className ) {\n\tif ( ! className ) {\n\t\treturn [];\n\t}\n\treturn className.split( /\\s+/ ).reduce( ( matches, name ) => {\n\t\tif ( name.startsWith( VARIATION_PREFIX ) ) {\n\t\t\tconst match = name.slice( VARIATION_PREFIX.length );\n\t\t\tif ( match !== 'default' ) {\n\t\t\t\tmatches.push( match );\n\t\t\t}\n\t\t}\n\t\treturn matches;\n\t}, [] );\n}\n\n/**\n * Get the first block style variation that has been registered from the class string.\n *\n * @param {string} className CSS class string for a block.\n * @param {Array} registeredStyles Currently registered block styles.\n *\n * @return {string|null} The name of the first registered variation.\n */\nfunction getVariationNameFromClass( className, registeredStyles = [] ) {\n\t// The global flag affects how capturing groups work in JS. So the regex\n\t// below will only return full CSS classes not just the variation name.\n\tconst matches = getVariationMatches( className );\n\n\tif ( ! matches ) {\n\t\treturn null;\n\t}\n\n\tfor ( const variation of matches ) {\n\t\tif ( registeredStyles.some( ( style ) => style.name === variation ) ) {\n\t\t\treturn variation;\n\t\t}\n\t}\n\treturn null;\n}\n\n// A helper component to apply a style override using the useStyleOverride hook.\nfunction OverrideStyles( { override } ) {\n\tuseStyleOverride( override );\n}\n\n/**\n * This component is used to generate new block style variation overrides\n * based on an incoming theme config. If a matching style is found in the config,\n * a new override is created and returned. The overrides can be used in conjunction with\n * useStyleOverride to apply the new styles to the editor. Its use is\n * subject to change.\n *\n * @param {Object} props Props.\n * @param {Object} props.config A global styles object, containing settings and styles.\n * @return {JSX.Element|undefined} An array of new block variation overrides.\n */\nexport function __unstableBlockStyleVariationOverridesWithConfig( { config } ) {\n\tconst { getBlockStyles, overrides } = useSelect(\n\t\t( select ) => ( {\n\t\t\tgetBlockStyles: select( blocksStore ).getBlockStyles,\n\t\t\toverrides: unlock( select( blockEditorStore ) ).getStyleOverrides(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { getBlockName } = useSelect( blockEditorStore );\n\n\tconst overridesWithConfig = useMemo( () => {\n\t\tif ( ! overrides?.length ) {\n\t\t\treturn;\n\t\t}\n\t\tconst newOverrides = [];\n\t\tconst overriddenClientIds = [];\n\t\tfor ( const [ , override ] of overrides ) {\n\t\t\tif (\n\t\t\t\toverride?.variation &&\n\t\t\t\toverride?.clientId &&\n\t\t\t\t/*\n\t\t\t\t * Because this component overwrites existing style overrides,\n\t\t\t\t * filter out any overrides that are already present in the store.\n\t\t\t\t */\n\t\t\t\t! overriddenClientIds.includes( override.clientId )\n\t\t\t) {\n\t\t\t\tconst blockName = getBlockName( override.clientId );\n\t\t\t\tconst configStyles =\n\t\t\t\t\tconfig?.styles?.blocks?.[ blockName ]?.variations?.[\n\t\t\t\t\t\toverride.variation\n\t\t\t\t\t];\n\t\t\t\tif ( configStyles ) {\n\t\t\t\t\tconst variationConfig = {\n\t\t\t\t\t\tsettings: config?.settings,\n\t\t\t\t\t\t// The variation style data is all that is needed to generate\n\t\t\t\t\t\t// the styles for the current application to a block. The variation\n\t\t\t\t\t\t// name is updated to match the instance specific class name.\n\t\t\t\t\t\tstyles: {\n\t\t\t\t\t\t\tblocks: {\n\t\t\t\t\t\t\t\t[ blockName ]: {\n\t\t\t\t\t\t\t\t\tvariations: {\n\t\t\t\t\t\t\t\t\t\t[ `${ override.variation }-${ override.clientId }` ]:\n\t\t\t\t\t\t\t\t\t\t\tconfigStyles,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tconst blockSelectors = getBlockSelectors(\n\t\t\t\t\t\tgetBlockTypes(),\n\t\t\t\t\t\tgetBlockStyles,\n\t\t\t\t\t\toverride.clientId\n\t\t\t\t\t);\n\t\t\t\t\tconst hasBlockGapSupport = false;\n\t\t\t\t\tconst hasFallbackGapSupport = true;\n\t\t\t\t\tconst disableLayoutStyles = true;\n\t\t\t\t\tconst disableRootPadding = true;\n\t\t\t\t\tconst variationStyles = toStyles(\n\t\t\t\t\t\tvariationConfig,\n\t\t\t\t\t\tblockSelectors,\n\t\t\t\t\t\thasBlockGapSupport,\n\t\t\t\t\t\thasFallbackGapSupport,\n\t\t\t\t\t\tdisableLayoutStyles,\n\t\t\t\t\t\tdisableRootPadding,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tblockGap: false,\n\t\t\t\t\t\t\tblockStyles: true,\n\t\t\t\t\t\t\tlayoutStyles: false,\n\t\t\t\t\t\t\tmarginReset: false,\n\t\t\t\t\t\t\tpresets: false,\n\t\t\t\t\t\t\trootPadding: false,\n\t\t\t\t\t\t\tvariationStyles: true,\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tnewOverrides.push( {\n\t\t\t\t\t\tid: `${ override.variation }-${ override.clientId }`,\n\t\t\t\t\t\tcss: variationStyles,\n\t\t\t\t\t\t__unstableType: 'variation',\n\t\t\t\t\t\tvariation: override.variation,\n\t\t\t\t\t\t// The clientId will be stored with the override and used to ensure\n\t\t\t\t\t\t// the order of overrides matches the order of blocks so that the\n\t\t\t\t\t\t// correct CSS cascade is maintained.\n\t\t\t\t\t\tclientId: override.clientId,\n\t\t\t\t\t} );\n\t\t\t\t\toverriddenClientIds.push( override.clientId );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn newOverrides;\n\t}, [ config, overrides, getBlockStyles, getBlockName ] );\n\n\tif ( ! overridesWithConfig || ! overridesWithConfig.length ) {\n\t\treturn;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ overridesWithConfig.map( ( override ) => (\n\t\t\t\t<OverrideStyles key={ override.id } override={ override } />\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\n/**\n * Retrieves any variation styles data and resolves any referenced values.\n *\n * @param {Object} globalStyles A complete global styles object, containing settings and styles.\n * @param {string} name The name of the desired block type.\n * @param {variation} variation The of the block style variation to retrieve data for.\n *\n * @return {Object|undefined} The global styles data for the specified variation.\n */\nexport function getVariationStylesWithRefValues(\n\tglobalStyles,\n\tname,\n\tvariation\n) {\n\tif ( ! globalStyles?.styles?.blocks?.[ name ]?.variations?.[ variation ] ) {\n\t\treturn;\n\t}\n\n\t// Helper to recursively look for `ref` values to resolve.\n\tconst replaceRefs = ( variationStyles ) => {\n\t\tObject.keys( variationStyles ).forEach( ( key ) => {\n\t\t\tconst value = variationStyles[ key ];\n\n\t\t\t// Only process objects.\n\t\t\tif ( typeof value === 'object' && value !== null ) {\n\t\t\t\t// Process `ref` value if present.\n\t\t\t\tif ( value.ref !== undefined ) {\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof value.ref !== 'string' ||\n\t\t\t\t\t\tvalue.ref.trim() === ''\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Remove invalid ref.\n\t\t\t\t\t\tdelete variationStyles[ key ];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Resolve `ref` value.\n\t\t\t\t\t\tconst refValue = getValueFromObjectPath(\n\t\t\t\t\t\t\tglobalStyles,\n\t\t\t\t\t\t\tvalue.ref\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif ( refValue ) {\n\t\t\t\t\t\t\tvariationStyles[ key ] = refValue;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdelete variationStyles[ key ];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Recursively resolve `ref` values in nested objects.\n\t\t\t\t\treplaceRefs( value );\n\n\t\t\t\t\t// After recursion, if value is empty due to explicitly\n\t\t\t\t\t// `undefined` ref value, remove it.\n\t\t\t\t\tif ( Object.keys( value ).length === 0 ) {\n\t\t\t\t\t\tdelete variationStyles[ key ];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t};\n\n\t// Deep clone variation node to avoid mutating it within global styles and losing refs.\n\tconst styles = JSON.parse(\n\t\tJSON.stringify(\n\t\t\tglobalStyles.styles.blocks[ name ].variations[ variation ]\n\t\t)\n\t);\n\treplaceRefs( styles );\n\n\treturn styles;\n}\n\nfunction useBlockStyleVariation( name, variation, clientId ) {\n\t// Prefer global styles data in GlobalStylesContext, which are available\n\t// if in the site editor. Otherwise fall back to whatever is in the\n\t// editor settings and available in the post editor.\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\tconst { globalSettings, globalStyles } = useSelect( ( select ) => {\n\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tglobalSettings: settings.__experimentalFeatures,\n\t\t\tglobalStyles: settings[ globalStylesDataKey ],\n\t\t};\n\t}, [] );\n\n\treturn useMemo( () => {\n\t\tconst variationStyles = getVariationStylesWithRefValues(\n\t\t\t{\n\t\t\t\tsettings: mergedConfig?.settings ?? globalSettings,\n\t\t\t\tstyles: mergedConfig?.styles ?? globalStyles,\n\t\t\t},\n\t\t\tname,\n\t\t\tvariation\n\t\t);\n\n\t\treturn {\n\t\t\tsettings: mergedConfig?.settings ?? globalSettings,\n\t\t\t// The variation style data is all that is needed to generate\n\t\t\t// the styles for the current application to a block. The variation\n\t\t\t// name is updated to match the instance specific class name.\n\t\t\tstyles: {\n\t\t\t\tblocks: {\n\t\t\t\t\t[ name ]: {\n\t\t\t\t\t\tvariations: {\n\t\t\t\t\t\t\t[ `${ variation }-${ clientId }` ]: variationStyles,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}, [\n\t\tmergedConfig,\n\t\tglobalSettings,\n\t\tglobalStyles,\n\t\tvariation,\n\t\tclientId,\n\t\tname,\n\t] );\n}\n\n// Rather than leveraging `useInstanceId` here, the `clientId` is used.\n// This is so that the variation style override's ID is predictable\n// when the order of applied style variations changes.\nfunction useBlockProps( { name, className, clientId } ) {\n\tconst { getBlockStyles } = useSelect( blocksStore );\n\n\tconst registeredStyles = getBlockStyles( name );\n\tconst variation = getVariationNameFromClass( className, registeredStyles );\n\tconst variationClass = `${ VARIATION_PREFIX }${ variation }-${ clientId }`;\n\n\tconst { settings, styles } = useBlockStyleVariation(\n\t\tname,\n\t\tvariation,\n\t\tclientId\n\t);\n\n\tconst variationStyles = useMemo( () => {\n\t\tif ( ! variation ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst variationConfig = { settings, styles };\n\t\tconst blockSelectors = getBlockSelectors(\n\t\t\tgetBlockTypes(),\n\t\t\tgetBlockStyles,\n\t\t\tclientId\n\t\t);\n\t\tconst hasBlockGapSupport = false;\n\t\tconst hasFallbackGapSupport = true;\n\t\tconst disableLayoutStyles = true;\n\t\tconst disableRootPadding = true;\n\n\t\treturn toStyles(\n\t\t\tvariationConfig,\n\t\t\tblockSelectors,\n\t\t\thasBlockGapSupport,\n\t\t\thasFallbackGapSupport,\n\t\t\tdisableLayoutStyles,\n\t\t\tdisableRootPadding,\n\t\t\t{\n\t\t\t\tblockGap: false,\n\t\t\t\tblockStyles: true,\n\t\t\t\tlayoutStyles: false,\n\t\t\t\tmarginReset: false,\n\t\t\t\tpresets: false,\n\t\t\t\trootPadding: false,\n\t\t\t\tvariationStyles: true,\n\t\t\t}\n\t\t);\n\t}, [ variation, settings, styles, getBlockStyles, clientId ] );\n\n\tuseStyleOverride( {\n\t\tid: `variation-${ clientId }`,\n\t\tcss: variationStyles,\n\t\t__unstableType: 'variation',\n\t\tvariation,\n\t\t// The clientId will be stored with the override and used to ensure\n\t\t// the order of overrides matches the order of blocks so that the\n\t\t// correct CSS cascade is maintained.\n\t\tclientId,\n\t} );\n\n\treturn variation ? { className: variationClass } : {};\n}\n\nexport default {\n\thasSupport: () => true,\n\tattributeKeys: [ 'className' ],\n\tisMatch: ( { className } ) => getVariationMatches( className ).length > 0,\n\tuseBlockProps,\n};\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,K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 @@ function useDuotoneStyles({
240
240
  return;
241
241
  }
242
242
 
243
- // Safari does not always update the duotone filter when the duotone colors
244
- // are changed. When using Safari, force the block element to be repainted by
245
- // the browser to ensure any changes are reflected visually. This logic matches
246
- // that used on the site frontend in `block-supports/duotone.php`.
243
+ // Safari does not always update the duotone filter when the duotone
244
+ // colors are changed. When using Safari, force the block element to be
245
+ // repainted by the browser to ensure any changes are reflected
246
+ // visually. This logic matches that used on the site frontend in
247
+ // `block-supports/duotone.php`.
247
248
  if (blockElement && isSafari) {
248
249
  const display = blockElement.style.display;
249
- // Switch to `inline-block` to force a repaint. In the editor, `inline-block`
250
- // is used instead of `none` to ensure that scroll position is not affected,
251
- // as `none` results in the editor scrolling to the top of the block.
250
+ // Switch to `inline-block` to force a repaint. In the editor,
251
+ // `inline-block` is used instead of `none` to ensure that scroll
252
+ // position is not affected, as `none` results in the editor
253
+ // scrolling to the top of the block.
252
254
  blockElement.style.display = 'inline-block';
253
- // Simply accessing el.offsetHeight flushes layout and style
254
- // changes in WebKit without having to wait for setTimeout.
255
+ // Simply accessing el.offsetHeight flushes layout and style changes
256
+ // in WebKit without having to wait for setTimeout.
255
257
  // eslint-disable-next-line no-unused-expressions
256
258
  blockElement.offsetHeight;
257
259
  blockElement.style.display = display;
258
260
  }
259
- }, [isValidFilter, blockElement]);
261
+ // `colors` must be a dependency so this effect runs when the colors
262
+ // change in Safari.
263
+ }, [isValidFilter, blockElement, colors]);
260
264
  }
261
265
  function useBlockProps({
266
+ clientId,
262
267
  name,
263
268
  style
264
269
  }) {
@@ -294,7 +299,7 @@ function useBlockProps({
294
299
  const filterClass = `wp-duotone-${id}`;
295
300
  const shouldRender = selector && attribute;
296
301
  useDuotoneStyles({
297
- clientId: id,
302
+ clientId,
298
303
  id: filterClass,
299
304
  selector,
300
305
  attribute
@@ -1 +1 @@
1
- {"version":3,"names":["_colord","require","_names","_interopRequireDefault","_blocks","_compose","_hooks","_element","_components","_utils","_getBlockCssSelector","_utils2","_utils3","_filtersPanel","_blockEditingMode","_useBlockRefs","_jsxRuntime","EMPTY_ARRAY","isSafari","window","navigator","userAgent","includes","extend","namesPlugin","useMultiOriginPresets","presetSetting","defaultSetting","enableDefault","userPresets","themePresets","defaultPresets","useSettings","useMemo","getColorsFromDuotonePreset","duotone","duotonePalette","preset","find","slug","colors","undefined","getDuotonePresetFromColors","Array","isArray","duotonePreset","every","val","index","DuotonePanelPure","style","setAttributes","name","duotoneStyle","color","settings","useBlockSettings","blockEditingMode","useBlockEditingMode","colorPalette","enableCustomColors","enableCustomDuotone","disableCustomColors","disableCustomDuotone","length","duotonePresetOrColors","jsxs","Fragment","children","jsx","InspectorControls","group","default","value","filter","onChange","newDuotone","newStyle","BlockControls","__experimentalShareWithChildBlocks","__experimentalDuotoneControl","maybePreset","_default","exports","shareWithChildBlocks","edit","useBlockProps","attributeKeys","hasSupport","hasBlockSupport","addDuotoneAttributes","attributes","Object","assign","type","useDuotoneStyles","clientId","id","filterId","selector","duotoneSelector","attribute","duotoneAttr","isCustom","isPreset","isCSS","selectors","split","selectorsScoped","map","selectorPart","trim","join","isValidFilter","useStyleOverride","css","getDuotoneStylesheet","getDuotoneUnsetStylesheet","__unstableType","assets","getDuotoneFilter","blockElement","useBlockElement","useEffect","display","offsetHeight","useInstanceId","blockType","getBlockType","duotoneSupport","getBlockSupport","experimentalDuotone","rootSelector","getBlockCSSSelector","scopeSelector","fallback","filterClass","shouldRender","className","addFilter"],"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSettings,\n} from '../components';\nimport {\n\tgetDuotoneFilter,\n\tgetDuotoneStylesheet,\n\tgetDuotoneUnsetStylesheet,\n} from '../components/duotone/utils';\nimport { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockSettings, useStyleOverride } from './utils';\nimport { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { __unstableUseBlockElement as useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nconst EMPTY_ARRAY = [];\n\n// Safari does not always update the duotone filter when the duotone colors\n// are changed. This browser check is later used to force a re-render of the block\n// element to ensure the duotone filter is updated. The check is included at the\n// root of this file as it only needs to be run once per page load.\nconst isSafari =\n\twindow?.navigator.userAgent &&\n\twindow.navigator.userAgent.includes( 'Safari' ) &&\n\t! window.navigator.userAgent.includes( 'Chrome' ) &&\n\t! window.navigator.userAgent.includes( 'Chromium' );\n\nextend( [ namesPlugin ] );\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst [ enableDefault, userPresets, themePresets, defaultPresets ] =\n\t\tuseSettings(\n\t\t\tdefaultSetting,\n\t\t\t`${ presetSetting }.custom`,\n\t\t\t`${ presetSetting }.theme`,\n\t\t\t`${ presetSetting }.default`\n\t\t);\n\treturn useMemo(\n\t\t() => [\n\t\t\t...( userPresets || EMPTY_ARRAY ),\n\t\t\t...( themePresets || EMPTY_ARRAY ),\n\t\t\t...( ( enableDefault && defaultPresets ) || EMPTY_ARRAY ),\n\t\t],\n\t\t[ enableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function getColorsFromDuotonePreset( duotone, duotonePalette ) {\n\tif ( ! duotone ) {\n\t\treturn;\n\t}\n\tconst preset = duotonePalette?.find( ( { slug } ) => {\n\t\treturn duotone === `var:preset|duotone|${ slug }`;\n\t} );\n\n\treturn preset ? preset.colors : undefined;\n}\n\nexport function getDuotonePresetFromColors( colors, duotonePalette ) {\n\tif ( ! colors || ! Array.isArray( colors ) ) {\n\t\treturn;\n\t}\n\n\tconst preset = duotonePalette?.find( ( duotonePreset ) => {\n\t\treturn duotonePreset?.colors?.every(\n\t\t\t( val, index ) => val === colors[ index ]\n\t\t);\n\t} );\n\n\treturn preset ? `var:preset|duotone|${ preset.slug }` : undefined;\n}\n\nfunction DuotonePanelPure( { style, setAttributes, name } ) {\n\tconst duotoneStyle = style?.color?.duotone;\n\tconst settings = useBlockSettings( name );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst [ enableCustomColors, enableCustomDuotone ] = useSettings(\n\t\t'color.custom',\n\t\t'color.customDuotone'\n\t);\n\tconst disableCustomColors = ! enableCustomColors;\n\tconst disableCustomDuotone =\n\t\t! enableCustomDuotone ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst duotonePresetOrColors = ! Array.isArray( duotoneStyle )\n\t\t? getColorsFromDuotonePreset( duotoneStyle, duotonePalette )\n\t\t: duotoneStyle;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"filter\">\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tvalue={ { filter: { duotone: duotonePresetOrColors } } }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...newDuotone?.filter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<DuotoneControl\n\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tvalue={ duotonePresetOrColors }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst maybePreset = getDuotonePresetFromColors(\n\t\t\t\t\t\t\tnewDuotone,\n\t\t\t\t\t\t\tduotonePalette\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\t\tduotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: DuotonePanelPure,\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'filter.duotone' );\n\t},\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\tif ( ! hasBlockSupport( settings, 'filter.duotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\nfunction useDuotoneStyles( {\n\tclientId,\n\tid: filterId,\n\tselector: duotoneSelector,\n\tattribute: duotoneAttr,\n} ) {\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\n\t// Possible values for duotone attribute:\n\t// 1. Array of colors - e.g. ['#000000', '#ffffff'].\n\t// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''\n\t// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.\n\tconst isCustom = Array.isArray( duotoneAttr );\n\tconst duotonePreset = isCustom\n\t\t? undefined\n\t\t: getColorsFromDuotonePreset( duotoneAttr, duotonePalette );\n\tconst isPreset = typeof duotoneAttr === 'string' && duotonePreset;\n\tconst isCSS = typeof duotoneAttr === 'string' && ! isPreset;\n\n\t// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.\n\tlet colors = null;\n\tif ( isPreset ) {\n\t\t// Array of colors.\n\t\tcolors = duotonePreset;\n\t} else if ( isCSS ) {\n\t\t// CSS filter property string (e.g. 'unset').\n\t\tcolors = duotoneAttr;\n\t} else if ( isCustom ) {\n\t\t// Array of colors.\n\t\tcolors = duotoneAttr;\n\t}\n\n\t// Build the CSS selectors to which the filter will be applied.\n\tconst selectors = duotoneSelector.split( ',' );\n\n\tconst selectorsScoped = selectors.map( ( selectorPart ) => {\n\t\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t\t// since we're not using inline styles to apply the filter. We need to\n\t\t// override duotone applied by global styles and theme.json.\n\n\t\t// Assuming the selector part is a subclass selector (not a tag name)\n\t\t// so we can prepend the filter id class. If we want to support elements\n\t\t// such as `img` or namespaces, we'll need to add a case for that here.\n\t\treturn `.${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\tuseStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tcss:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneStylesheet( selector, filterId )\n\t\t\t\t\t\t\t: getDuotoneUnsetStylesheet( selector ),\n\t\t\t\t\t__unstableType: 'presets',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\tuseStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tassets:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneFilter( filterId, colors )\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t__unstableType: 'svgs',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\n\tconst blockElement = useBlockElement( clientId );\n\n\tuseEffect( () => {\n\t\tif ( ! isValidFilter ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Safari does not always update the duotone filter when the duotone colors\n\t\t// are changed. When using Safari, force the block element to be repainted by\n\t\t// the browser to ensure any changes are reflected visually. This logic matches\n\t\t// that used on the site frontend in `block-supports/duotone.php`.\n\t\tif ( blockElement && isSafari ) {\n\t\t\tconst display = blockElement.style.display;\n\t\t\t// Switch to `inline-block` to force a repaint. In the editor, `inline-block`\n\t\t\t// is used instead of `none` to ensure that scroll position is not affected,\n\t\t\t// as `none` results in the editor scrolling to the top of the block.\n\t\t\tblockElement.style.display = 'inline-block';\n\t\t\t// Simply accessing el.offsetHeight flushes layout and style\n\t\t\t// changes in WebKit without having to wait for setTimeout.\n\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\tblockElement.offsetHeight;\n\t\t\tblockElement.style.display = display;\n\t\t}\n\t}, [ isValidFilter, blockElement ] );\n}\n\nfunction useBlockProps( { name, style } ) {\n\tconst id = useInstanceId( useBlockProps );\n\tconst selector = useMemo( () => {\n\t\tconst blockType = getBlockType( name );\n\n\t\tif ( blockType ) {\n\t\t\t// Backwards compatibility for `supports.color.__experimentalDuotone`\n\t\t\t// is provided via the `block_type_metadata_settings` filter. If\n\t\t\t// `supports.filter.duotone` has not been set and the\n\t\t\t// experimental property has been, the experimental property\n\t\t\t// value is copied into `supports.filter.duotone`.\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'filter.duotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( ! duotoneSupport ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// If the experimental duotone support was set, that value is\n\t\t\t// to be treated as a selector and requires scoping.\n\t\t\tconst experimentalDuotone = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( experimentalDuotone ) {\n\t\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\t\treturn typeof experimentalDuotone === 'string'\n\t\t\t\t\t? scopeSelector( rootSelector, experimentalDuotone )\n\t\t\t\t\t: rootSelector;\n\t\t\t}\n\n\t\t\t// Regular filter.duotone support uses filter.duotone selectors with fallbacks.\n\t\t\treturn getBlockCSSSelector( blockType, 'filter.duotone', {\n\t\t\t\tfallback: true,\n\t\t\t} );\n\t\t}\n\t}, [ name ] );\n\n\tconst attribute = style?.color?.duotone;\n\n\tconst filterClass = `wp-duotone-${ id }`;\n\n\tconst shouldRender = selector && attribute;\n\n\tuseDuotoneStyles( {\n\t\tclientId: id,\n\t\tid: filterClass,\n\t\tselector,\n\t\tattribute,\n\t} );\n\n\treturn {\n\t\tclassName: shouldRender ? filterClass : '',\n\t};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\n"],"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qC,SAAS,EAAED,YAAY,GAAGD,WAAW,GAAG;EACzC,CAAC;AACF;AAEA,IAAAG,gBAAS,EACR,0BAA0B,EAC1B,oCAAoC,EACpCjD,oBACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_colord","require","_names","_interopRequireDefault","_blocks","_compose","_hooks","_element","_components","_utils","_getBlockCssSelector","_utils2","_utils3","_filtersPanel","_blockEditingMode","_useBlockRefs","_jsxRuntime","EMPTY_ARRAY","isSafari","window","navigator","userAgent","includes","extend","namesPlugin","useMultiOriginPresets","presetSetting","defaultSetting","enableDefault","userPresets","themePresets","defaultPresets","useSettings","useMemo","getColorsFromDuotonePreset","duotone","duotonePalette","preset","find","slug","colors","undefined","getDuotonePresetFromColors","Array","isArray","duotonePreset","every","val","index","DuotonePanelPure","style","setAttributes","name","duotoneStyle","color","settings","useBlockSettings","blockEditingMode","useBlockEditingMode","colorPalette","enableCustomColors","enableCustomDuotone","disableCustomColors","disableCustomDuotone","length","duotonePresetOrColors","jsxs","Fragment","children","jsx","InspectorControls","group","default","value","filter","onChange","newDuotone","newStyle","BlockControls","__experimentalShareWithChildBlocks","__experimentalDuotoneControl","maybePreset","_default","exports","shareWithChildBlocks","edit","useBlockProps","attributeKeys","hasSupport","hasBlockSupport","addDuotoneAttributes","attributes","Object","assign","type","useDuotoneStyles","clientId","id","filterId","selector","duotoneSelector","attribute","duotoneAttr","isCustom","isPreset","isCSS","selectors","split","selectorsScoped","map","selectorPart","trim","join","isValidFilter","useStyleOverride","css","getDuotoneStylesheet","getDuotoneUnsetStylesheet","__unstableType","assets","getDuotoneFilter","blockElement","useBlockElement","useEffect","display","offsetHeight","useInstanceId","blockType","getBlockType","duotoneSupport","getBlockSupport","experimentalDuotone","rootSelector","getBlockCSSSelector","scopeSelector","fallback","filterClass","shouldRender","className","addFilter"],"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSettings,\n} from '../components';\nimport {\n\tgetDuotoneFilter,\n\tgetDuotoneStylesheet,\n\tgetDuotoneUnsetStylesheet,\n} from '../components/duotone/utils';\nimport { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockSettings, useStyleOverride } from './utils';\nimport { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { __unstableUseBlockElement as useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nconst EMPTY_ARRAY = [];\n\n// Safari does not always update the duotone filter when the duotone colors\n// are changed. This browser check is later used to force a re-render of the block\n// element to ensure the duotone filter is updated. The check is included at the\n// root of this file as it only needs to be run once per page load.\nconst isSafari =\n\twindow?.navigator.userAgent &&\n\twindow.navigator.userAgent.includes( 'Safari' ) &&\n\t! window.navigator.userAgent.includes( 'Chrome' ) &&\n\t! window.navigator.userAgent.includes( 'Chromium' );\n\nextend( [ namesPlugin ] );\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst [ enableDefault, userPresets, themePresets, defaultPresets ] =\n\t\tuseSettings(\n\t\t\tdefaultSetting,\n\t\t\t`${ presetSetting }.custom`,\n\t\t\t`${ presetSetting }.theme`,\n\t\t\t`${ presetSetting }.default`\n\t\t);\n\treturn useMemo(\n\t\t() => [\n\t\t\t...( userPresets || EMPTY_ARRAY ),\n\t\t\t...( themePresets || EMPTY_ARRAY ),\n\t\t\t...( ( enableDefault && defaultPresets ) || EMPTY_ARRAY ),\n\t\t],\n\t\t[ enableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function getColorsFromDuotonePreset( duotone, duotonePalette ) {\n\tif ( ! duotone ) {\n\t\treturn;\n\t}\n\tconst preset = duotonePalette?.find( ( { slug } ) => {\n\t\treturn duotone === `var:preset|duotone|${ slug }`;\n\t} );\n\n\treturn preset ? preset.colors : undefined;\n}\n\nexport function getDuotonePresetFromColors( colors, duotonePalette ) {\n\tif ( ! colors || ! Array.isArray( colors ) ) {\n\t\treturn;\n\t}\n\n\tconst preset = duotonePalette?.find( ( duotonePreset ) => {\n\t\treturn duotonePreset?.colors?.every(\n\t\t\t( val, index ) => val === colors[ index ]\n\t\t);\n\t} );\n\n\treturn preset ? `var:preset|duotone|${ preset.slug }` : undefined;\n}\n\nfunction DuotonePanelPure( { style, setAttributes, name } ) {\n\tconst duotoneStyle = style?.color?.duotone;\n\tconst settings = useBlockSettings( name );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst [ enableCustomColors, enableCustomDuotone ] = useSettings(\n\t\t'color.custom',\n\t\t'color.customDuotone'\n\t);\n\tconst disableCustomColors = ! enableCustomColors;\n\tconst disableCustomDuotone =\n\t\t! enableCustomDuotone ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst duotonePresetOrColors = ! Array.isArray( duotoneStyle )\n\t\t? getColorsFromDuotonePreset( duotoneStyle, duotonePalette )\n\t\t: duotoneStyle;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"filter\">\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tvalue={ { filter: { duotone: duotonePresetOrColors } } }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...newDuotone?.filter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<DuotoneControl\n\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tvalue={ duotonePresetOrColors }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst maybePreset = getDuotonePresetFromColors(\n\t\t\t\t\t\t\tnewDuotone,\n\t\t\t\t\t\t\tduotonePalette\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\t\tduotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: DuotonePanelPure,\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'filter.duotone' );\n\t},\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\tif ( ! hasBlockSupport( settings, 'filter.duotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\nfunction useDuotoneStyles( {\n\tclientId,\n\tid: filterId,\n\tselector: duotoneSelector,\n\tattribute: duotoneAttr,\n} ) {\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\n\t// Possible values for duotone attribute:\n\t// 1. Array of colors - e.g. ['#000000', '#ffffff'].\n\t// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''\n\t// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.\n\tconst isCustom = Array.isArray( duotoneAttr );\n\tconst duotonePreset = isCustom\n\t\t? undefined\n\t\t: getColorsFromDuotonePreset( duotoneAttr, duotonePalette );\n\tconst isPreset = typeof duotoneAttr === 'string' && duotonePreset;\n\tconst isCSS = typeof duotoneAttr === 'string' && ! isPreset;\n\n\t// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.\n\tlet colors = null;\n\tif ( isPreset ) {\n\t\t// Array of colors.\n\t\tcolors = duotonePreset;\n\t} else if ( isCSS ) {\n\t\t// CSS filter property string (e.g. 'unset').\n\t\tcolors = duotoneAttr;\n\t} else if ( isCustom ) {\n\t\t// Array of colors.\n\t\tcolors = duotoneAttr;\n\t}\n\n\t// Build the CSS selectors to which the filter will be applied.\n\tconst selectors = duotoneSelector.split( ',' );\n\n\tconst selectorsScoped = selectors.map( ( selectorPart ) => {\n\t\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t\t// since we're not using inline styles to apply the filter. We need to\n\t\t// override duotone applied by global styles and theme.json.\n\n\t\t// Assuming the selector part is a subclass selector (not a tag name)\n\t\t// so we can prepend the filter id class. If we want to support elements\n\t\t// such as `img` or namespaces, we'll need to add a case for that here.\n\t\treturn `.${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\tuseStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tcss:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneStylesheet( selector, filterId )\n\t\t\t\t\t\t\t: getDuotoneUnsetStylesheet( selector ),\n\t\t\t\t\t__unstableType: 'presets',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\tuseStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tassets:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneFilter( filterId, colors )\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t__unstableType: 'svgs',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\n\tconst blockElement = useBlockElement( clientId );\n\n\tuseEffect( () => {\n\t\tif ( ! isValidFilter ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Safari does not always update the duotone filter when the duotone\n\t\t// colors are changed. When using Safari, force the block element to be\n\t\t// repainted by the browser to ensure any changes are reflected\n\t\t// visually. This logic matches that used on the site frontend in\n\t\t// `block-supports/duotone.php`.\n\t\tif ( blockElement && isSafari ) {\n\t\t\tconst display = blockElement.style.display;\n\t\t\t// Switch to `inline-block` to force a repaint. In the editor,\n\t\t\t// `inline-block` is used instead of `none` to ensure that scroll\n\t\t\t// position is not affected, as `none` results in the editor\n\t\t\t// scrolling to the top of the block.\n\t\t\tblockElement.style.display = 'inline-block';\n\t\t\t// Simply accessing el.offsetHeight flushes layout and style changes\n\t\t\t// in WebKit without having to wait for setTimeout.\n\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\tblockElement.offsetHeight;\n\t\t\tblockElement.style.display = display;\n\t\t}\n\t\t// `colors` must be a dependency so this effect runs when the colors\n\t\t// change in Safari.\n\t}, [ isValidFilter, blockElement, colors ] );\n}\n\nfunction useBlockProps( { clientId, name, style } ) {\n\tconst id = useInstanceId( useBlockProps );\n\tconst selector = useMemo( () => {\n\t\tconst blockType = getBlockType( name );\n\n\t\tif ( blockType ) {\n\t\t\t// Backwards compatibility for `supports.color.__experimentalDuotone`\n\t\t\t// is provided via the `block_type_metadata_settings` filter. If\n\t\t\t// `supports.filter.duotone` has not been set and the\n\t\t\t// experimental property has been, the experimental property\n\t\t\t// value is copied into `supports.filter.duotone`.\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'filter.duotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( ! duotoneSupport ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// If the experimental duotone support was set, that value is\n\t\t\t// to be treated as a selector and requires scoping.\n\t\t\tconst experimentalDuotone = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( experimentalDuotone ) {\n\t\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\t\treturn typeof experimentalDuotone === 'string'\n\t\t\t\t\t? scopeSelector( rootSelector, experimentalDuotone )\n\t\t\t\t\t: rootSelector;\n\t\t\t}\n\n\t\t\t// Regular filter.duotone support uses filter.duotone selectors with fallbacks.\n\t\t\treturn getBlockCSSSelector( blockType, 'filter.duotone', {\n\t\t\t\tfallback: true,\n\t\t\t} );\n\t\t}\n\t}, [ name ] );\n\n\tconst attribute = style?.color?.duotone;\n\n\tconst filterClass = `wp-duotone-${ id }`;\n\n\tconst shouldRender = selector && attribute;\n\n\tuseDuotoneStyles( {\n\t\tclientId,\n\t\tid: filterClass,\n\t\tselector,\n\t\tattribute,\n\t} );\n\n\treturn {\n\t\tclassName: shouldRender ? filterClass : '',\n\t};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,WAAA,GAAAP,OAAA;AAMA,IAAAQ,MAAA,GAAAR,OAAA;AAKA,IAAAS,oBAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,aAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,iBAAA,GAAAb,OAAA;AACA,IAAAc,aAAA,GAAAd,OAAA;AAAuH,IAAAe,WAAA,GAAAf,OAAA;AArCvH;AACA;AACA;;AAIA;AACA;AACA;;AAUA;AACA;AACA;;AAmBA,MAAMgB,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA;AACA,MAAMC,QAAQ,GACbC,MAAM,EAAEC,SAAS,CAACC,SAAS,IAC3BF,MAAM,CAACC,SAAS,CAACC,SAAS,CAACC,QAAQ,CAAE,QAAS,CAAC,IAC/C,CAAEH,MAAM,CAACC,SAAS,CAACC,SAAS,CAACC,QAAQ,CAAE,QAAS,CAAC,IACjD,CAAEH,MAAM,CAACC,SAAS,CAACC,SAAS,CAACC,QAAQ,CAAE,UAAW,CAAC;AAEpD,IAA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AE;MACX,CAAE,CAAC;IACJ;EACD,CAAC,EAAE,CAAEnF,IAAI,CAAG,CAAC;EAEb,MAAMiD,SAAS,GAAGnD,KAAK,EAAEI,KAAK,EAAEnB,OAAO;EAEvC,MAAMqG,WAAW,GAAI,cAAcvC,EAAI,EAAC;EAExC,MAAMwC,YAAY,GAAGtC,QAAQ,IAAIE,SAAS;EAE1CN,gBAAgB,CAAE;IACjBC,QAAQ;IACRC,EAAE,EAAEuC,WAAW;IACfrC,QAAQ;IACRE;EACD,CAAE,CAAC;EAEH,OAAO;IACNqC,SAAS,EAAED,YAAY,GAAGD,WAAW,GAAG;EACzC,CAAC;AACF;AAEA,IAAAG,gBAAS,EACR,0BAA0B,EAC1B,oCAAoC,EACpCjD,oBACD,CAAC","ignoreList":[]}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ var _compose = require("@wordpress/compose");
4
+ var _hooks = require("@wordpress/hooks");
5
+ var _data = require("@wordpress/data");
6
+ var _grid = require("../components/grid");
7
+ var _store = require("../store");
8
+ var _jsxRuntime = require("react/jsx-runtime");
9
+ /**
10
+ * WordPress dependencies
11
+ */
12
+
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+
17
+ function GridLayoutSync(props) {
18
+ (0, _grid.useGridLayoutSync)(props);
19
+ }
20
+ function GridTools({
21
+ clientId,
22
+ layout
23
+ }) {
24
+ const {
25
+ isSelected,
26
+ isDragging
27
+ } = (0, _data.useSelect)(select => {
28
+ const {
29
+ isBlockSelected,
30
+ isDraggingBlocks
31
+ } = select(_store.store);
32
+ return {
33
+ isSelected: isBlockSelected(clientId),
34
+ isDragging: isDraggingBlocks()
35
+ };
36
+ });
37
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
38
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(GridLayoutSync, {
39
+ clientId: clientId
40
+ }), (isSelected || isDragging) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_grid.GridVisualizer, {
41
+ clientId: clientId,
42
+ parentLayout: layout
43
+ })]
44
+ });
45
+ }
46
+ const addGridVisualizerToBlockEdit = (0, _compose.createHigherOrderComponent)(BlockEdit => props => {
47
+ if (props.attributes.layout?.type !== 'grid') {
48
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(BlockEdit, {
49
+ ...props
50
+ }, "edit");
51
+ }
52
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
53
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(GridTools, {
54
+ clientId: props.clientId,
55
+ layout: props.attributes.layout
56
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(BlockEdit, {
57
+ ...props
58
+ }, "edit")]
59
+ });
60
+ }, 'addGridVisualizerToBlockEdit');
61
+ (0, _hooks.addFilter)('editor.BlockEdit', 'core/editor/grid-visualizer', addGridVisualizerToBlockEdit);
62
+ //# sourceMappingURL=grid-visualizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_compose","require","_hooks","_data","_grid","_store","_jsxRuntime","GridLayoutSync","props","useGridLayoutSync","GridTools","clientId","layout","isSelected","isDragging","useSelect","select","isBlockSelected","isDraggingBlocks","blockEditorStore","jsxs","Fragment","children","jsx","GridVisualizer","parentLayout","addGridVisualizerToBlockEdit","createHigherOrderComponent","BlockEdit","attributes","type","addFilter"],"sources":["@wordpress/block-editor/src/hooks/grid-visualizer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { GridVisualizer, useGridLayoutSync } from '../components/grid';\nimport { store as blockEditorStore } from '../store';\n\nfunction GridLayoutSync( props ) {\n\tuseGridLayoutSync( props );\n}\n\nfunction GridTools( { clientId, layout } ) {\n\tconst { isSelected, isDragging } = useSelect( ( select ) => {\n\t\tconst { isBlockSelected, isDraggingBlocks } =\n\t\t\tselect( blockEditorStore );\n\n\t\treturn {\n\t\t\tisSelected: isBlockSelected( clientId ),\n\t\t\tisDragging: isDraggingBlocks(),\n\t\t};\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<GridLayoutSync clientId={ clientId } />\n\t\t\t{ ( isSelected || isDragging ) && (\n\t\t\t\t<GridVisualizer clientId={ clientId } parentLayout={ layout } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nconst addGridVisualizerToBlockEdit = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tif ( props.attributes.layout?.type !== 'grid' ) {\n\t\t\treturn <BlockEdit key=\"edit\" { ...props } />;\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<GridTools\n\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\tlayout={ props.attributes.layout }\n\t\t\t\t/>\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'addGridVisualizerToBlockEdit'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/grid-visualizer',\n\taddGridVisualizerToBlockEdit\n);\n"],"mappings":";;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAAqD,IAAAK,WAAA,GAAAL,OAAA;AAXrD;AACA;AACA;;AAKA;AACA;AACA;;AAIA,SAASM,cAAcA,CAAEC,KAAK,EAAG;EAChC,IAAAC,uBAAiB,EAAED,KAAM,CAAC;AAC3B;AAEA,SAASE,SAASA,CAAE;EAAEC,QAAQ;EAAEC;AAAO,CAAC,EAAG;EAC1C,MAAM;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC3D,MAAM;MAAEC,eAAe;MAAEC;IAAiB,CAAC,GAC1CF,MAAM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Default = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
+ Object.defineProperty(exports, "__unstableBlockStyleVariationOverridesWithConfig", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _blockStyleVariation.__unstableBlockStyleVariationOverridesWithConfig;
11
+ }
12
+ });
7
13
  Object.defineProperty(exports, "getBorderClassesAndStyles", {
8
14
  enumerable: true,
9
15
  get: function () {
@@ -40,6 +46,12 @@ Object.defineProperty(exports, "getTypographyClassesAndStyles", {
40
46
  return _useTypographyProps.getTypographyClassesAndStyles;
41
47
  }
42
48
  });
49
+ Object.defineProperty(exports, "setBackgroundStyleDefaults", {
50
+ enumerable: true,
51
+ get: function () {
52
+ return _background.setBackgroundStyleDefaults;
53
+ }
54
+ });
43
55
  Object.defineProperty(exports, "useBorderProps", {
44
56
  enumerable: true,
45
57
  get: function () {
@@ -85,7 +97,7 @@ Object.defineProperty(exports, "useZoomOut", {
85
97
  var _utils = require("./utils");
86
98
  require("./compat");
87
99
  var _align = _interopRequireDefault(require("./align"));
88
- var _background = _interopRequireDefault(require("./background"));
100
+ var _background = _interopRequireWildcard(require("./background"));
89
101
  require("./lock");
90
102
  var _anchor = _interopRequireDefault(require("./anchor"));
91
103
  var _ariaLabel = _interopRequireDefault(require("./aria-label"));
@@ -101,7 +113,7 @@ var _fontSize = _interopRequireDefault(require("./font-size"));
101
113
  var _textAlign = _interopRequireDefault(require("./text-align"));
102
114
  var _border = _interopRequireDefault(require("./border"));
103
115
  var _position = _interopRequireDefault(require("./position"));
104
- var _blockStyleVariation = _interopRequireDefault(require("./block-style-variation"));
116
+ var _blockStyleVariation = _interopRequireWildcard(require("./block-style-variation"));
105
117
  var _layout = _interopRequireWildcard(require("./layout"));
106
118
  var _layoutChild = _interopRequireDefault(require("./layout-child"));
107
119
  var _contentLockUi = _interopRequireDefault(require("./content-lock-ui"));
@@ -110,6 +122,7 @@ var _blockHooks = _interopRequireDefault(require("./block-hooks"));
110
122
  var _blockBindings = _interopRequireDefault(require("./block-bindings"));
111
123
  require("./block-renaming");
112
124
  require("./use-bindings-attributes");
125
+ require("./grid-visualizer");
113
126
  var _useBorderProps = require("./use-border-props");
114
127
  var _useShadowProps = require("./use-shadow-props");
115
128
  var _useColorProps = require("./use-color-props");
@@ -1 +1 @@
1
- {"version":3,"names":["_utils","require","_align","_interopRequireDefault","_background","_anchor","_ariaLabel","_customClassName","_style","_color","_dimensions","_interopRequireWildcard","_duotone","_fontFamily","_fontSize","_textAlign","_border","_position","_blockStyleVariation","_layout","_layoutChild","_contentLockUi","_blockHooks","_blockBindings","_useBorderProps","_useShadowProps","_useColorProps","_useSpacingProps","_useTypographyProps","_gap","_useCachedTruthy","_useZoomOut","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","createBlockEditFilter","blockBindingsPanel","align","textAlign","anchor","customClassName","style","duotone","position","layout","contentLockUI","blockHooks","childLayout","filter","Boolean","createBlockListBlockFilter","background","color","dimensions","fontFamily","fontSize","border","blockStyleVariation","createBlockSaveFilter","ariaLabel"],"sources":["@wordpress/block-editor/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateBlockEditFilter,\n\tcreateBlockListBlockFilter,\n\tcreateBlockSaveFilter,\n} from './utils';\nimport './compat';\nimport align from './align';\nimport background from './background';\nimport './lock';\nimport anchor from './anchor';\nimport ariaLabel from './aria-label';\nimport customClassName from './custom-class-name';\nimport './generated-class-name';\nimport style from './style';\nimport './settings';\nimport color from './color';\nimport dimensions from './dimensions';\nimport duotone from './duotone';\nimport fontFamily from './font-family';\nimport fontSize from './font-size';\nimport textAlign from './text-align';\nimport border from './border';\nimport position from './position';\nimport blockStyleVariation from './block-style-variation';\nimport layout from './layout';\nimport childLayout from './layout-child';\nimport contentLockUI from './content-lock-ui';\nimport './metadata';\nimport blockHooks from './block-hooks';\nimport blockBindingsPanel from './block-bindings';\nimport './block-renaming';\nimport './use-bindings-attributes';\n\ncreateBlockEditFilter(\n\t[\n\t\tblockBindingsPanel,\n\t\talign,\n\t\ttextAlign,\n\t\tanchor,\n\t\tcustomClassName,\n\t\tstyle,\n\t\tduotone,\n\t\tposition,\n\t\tlayout,\n\t\tcontentLockUI,\n\t\tblockHooks,\n\t\tchildLayout,\n\t].filter( Boolean )\n);\ncreateBlockListBlockFilter( [\n\talign,\n\ttextAlign,\n\tbackground,\n\tstyle,\n\tcolor,\n\tdimensions,\n\tduotone,\n\tfontFamily,\n\tfontSize,\n\tborder,\n\tposition,\n\tblockStyleVariation,\n\tchildLayout,\n] );\ncreateBlockSaveFilter( [\n\talign,\n\ttextAlign,\n\tanchor,\n\tariaLabel,\n\tcustomClassName,\n\tborder,\n\tcolor,\n\tstyle,\n\tfontFamily,\n\tfontSize,\n] );\n\nexport { useCustomSides } from './dimensions';\nexport { useLayoutClasses, useLayoutStyles } from './layout';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getShadowClassesAndStyles } from './use-shadow-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getTypographyClassesAndStyles } from './use-typography-props';\nexport { getGapCSSValue } from './gap';\nexport { useCachedTruthy } from './use-cached-truthy';\nexport { useZoomOut } from './use-zoom-out';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKAA,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AACAA,OAAA;AACA,IAAAI,OAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,UAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,I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ACTa,mBAAU,EACVV,cAAK,EACLW,cAAK,EACLC,mBAAU,EACVX,gBAAO,EACPY,mBAAU,EACVC,iBAAQ,EACRC,eAAM,EACNb,iBAAQ,EACRc,4BAAmB,EACnBV,oBAAW,CACV,CAAC;AACH,IAAAW,4BAAqB,EAAE,CACtBrB,cAAK,EACLC,kBAAS,EACTC,eAAM,EACNoB,kBAAS,EACTnB,wBAAe,EACfgB,eAAM,EACNJ,cAAK,EACLX,cAAK,EACLa,mBAAU,EACVC,iBAAQ,CACP,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_utils","require","_align","_interopRequireDefault","_background","_interopRequireWildcard","_anchor","_ariaLabel","_customClassName","_style","_color","_dimensions","_duotone","_fontFamily","_fontSize","_textAlign","_border","_position","_blockStyleVariation","_layout","_layoutChild","_contentLockUi","_blockHooks","_blockBindings","_useBorderProps","_useShadowProps","_useColorProps","_useSpacingProps","_useTypographyProps","_gap","_useCachedTruthy","_useZoomOut","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","createBlockEditFilter","blockBindingsPanel","align","textAlign","anchor","customClassName","style","duotone","position","layout","contentLockUI","blockHooks","childLayout","filter","Boolean","createBlockListBlockFilter","background","color","dimensions","fontFamily","fontSize","border","blockStyleVariation","createBlockSaveFilter","ariaLabel"],"sources":["@wordpress/block-editor/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateBlockEditFilter,\n\tcreateBlockListBlockFilter,\n\tcreateBlockSaveFilter,\n} from './utils';\nimport './compat';\nimport align from './align';\nimport background from './background';\nimport './lock';\nimport anchor from './anchor';\nimport ariaLabel from './aria-label';\nimport customClassName from './custom-class-name';\nimport './generated-class-name';\nimport style from './style';\nimport './settings';\nimport color from './color';\nimport dimensions from './dimensions';\nimport duotone from './duotone';\nimport fontFamily from './font-family';\nimport fontSize from './font-size';\nimport textAlign from './text-align';\nimport border from './border';\nimport position from './position';\nimport blockStyleVariation from './block-style-variation';\nimport layout from './layout';\nimport childLayout from './layout-child';\nimport contentLockUI from './content-lock-ui';\nimport './metadata';\nimport blockHooks from './block-hooks';\nimport blockBindingsPanel from './block-bindings';\nimport './block-renaming';\nimport './use-bindings-attributes';\nimport './grid-visualizer';\n\ncreateBlockEditFilter(\n\t[\n\t\tblockBindingsPanel,\n\t\talign,\n\t\ttextAlign,\n\t\tanchor,\n\t\tcustomClassName,\n\t\tstyle,\n\t\tduotone,\n\t\tposition,\n\t\tlayout,\n\t\tcontentLockUI,\n\t\tblockHooks,\n\t\tchildLayout,\n\t].filter( Boolean )\n);\ncreateBlockListBlockFilter( [\n\talign,\n\ttextAlign,\n\tbackground,\n\tstyle,\n\tcolor,\n\tdimensions,\n\tduotone,\n\tfontFamily,\n\tfontSize,\n\tborder,\n\tposition,\n\tblockStyleVariation,\n\tchildLayout,\n] );\ncreateBlockSaveFilter( [\n\talign,\n\ttextAlign,\n\tanchor,\n\tariaLabel,\n\tcustomClassName,\n\tborder,\n\tcolor,\n\tstyle,\n\tfontFamily,\n\tfontSize,\n] );\n\nexport { useCustomSides } from './dimensions';\nexport { useLayoutClasses, useLayoutStyles } from './layout';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getShadowClassesAndStyles } from './use-shadow-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getTypographyClassesAndStyles } from './use-typography-props';\nexport { getGapCSSValue } from './gap';\nexport { useCachedTruthy } from './use-cached-truthy';\nexport { setBackgroundStyleDefaults } from './background';\nexport { useZoomOut } from './use-zoom-out';\nexport { __unstableBlockStyleVariationOverridesWithConfig } from './block-style-variation';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,MA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AAkB,EAClBC,cAAK,EACLC,kBAAS,EACTC,eAAM,EACNC,wBAAe,EACfC,cAAK,EACLC,gBAAO,EACPC,iBAAQ,EACRC,eAAM,EACNC,sBAAa,EACbC,mBAAU,EACVC,oBAAW,CACX,CAACC,MAAM,CAAEC,OAAQ,CACnB,CAAC;AACD,IAAAC,iCAA0B,EAAE,CAC3Bb,cAAK,EACLC,kBAAS,EACTa,mBAAU,EACVV,cAAK,EACLW,cAAK,EACLC,mBAAU,EACVX,gBAAO,EACPY,mBAAU,EACVC,iBAAQ,EACRC,eAAM,EACNb,iBAAQ,EACRc,4BAAmB,EACnBV,oBAAW,CACV,CAAC;AACH,IAAAW,4BAAqB,EAAE,CACtBrB,cAAK,EACLC,kBAAS,EACTC,eAAM,EACNoB,kBAAS,EACTnB,wBAAe,EACfgB,eAAM,EACNJ,cAAK,EACLX,cAAK,EACLa,mBAAU,EACVC,iBAAQ,CACP,CAAC","ignoreList":[]}
@@ -43,6 +43,23 @@ function useBlockPropsChildLayoutStyles({
43
43
  } = parentLayout;
44
44
  const id = (0, _compose.useInstanceId)(useBlockPropsChildLayoutStyles);
45
45
  const selector = `.wp-container-content-${id}`;
46
+
47
+ // Check that the grid layout attributes are of the correct type, so that we don't accidentally
48
+ // write code that stores a string attribute instead of a number.
49
+ if (process.env.NODE_ENV === 'development') {
50
+ if (columnStart && typeof columnStart !== 'number') {
51
+ throw new Error('columnStart must be a number');
52
+ }
53
+ if (rowStart && typeof rowStart !== 'number') {
54
+ throw new Error('rowStart must be a number');
55
+ }
56
+ if (columnSpan && typeof columnSpan !== 'number') {
57
+ throw new Error('columnSpan must be a number');
58
+ }
59
+ if (rowSpan && typeof rowSpan !== 'number') {
60
+ throw new Error('rowSpan must be a number');
61
+ }
62
+ }
46
63
  let css = '';
47
64
  if (shouldRenderChildLayoutStyles) {
48
65
  if (selfStretch === 'fixed' && flexSize) {
@@ -67,16 +84,25 @@ function useBlockPropsChildLayoutStyles({
67
84
  grid-column: span ${columnSpan};
68
85
  }`;
69
86
  }
87
+ if (rowStart && rowSpan) {
88
+ css += `${selector} {
89
+ grid-row: ${rowStart} / span ${rowSpan};
90
+ }`;
91
+ } else if (rowStart) {
92
+ css += `${selector} {
93
+ grid-row: ${rowStart};
94
+ }`;
95
+ } else if (rowSpan) {
96
+ css += `${selector} {
97
+ grid-row: span ${rowSpan};
98
+ }`;
99
+ }
70
100
  /**
71
101
  * If minimumColumnWidth is set on the parent, or if no
72
102
  * columnCount is set, the grid is responsive so a
73
103
  * container query is needed for the span to resize.
74
104
  */
75
105
  if ((columnSpan || columnStart) && (minimumColumnWidth || !columnCount)) {
76
- // Check if columnSpan and columnStart are numbers so Math.max doesn't break.
77
- const columnSpanNumber = columnSpan ? parseInt(columnSpan) : null;
78
- const columnStartNumber = columnStart ? parseInt(columnStart) : null;
79
- const highestNumber = Math.max(columnSpanNumber, columnStartNumber);
80
106
  let parentColumnValue = parseFloat(minimumColumnWidth);
81
107
  /**
82
108
  * 12rem is the default minimumColumnWidth value.
@@ -93,29 +119,28 @@ function useBlockPropsChildLayoutStyles({
93
119
  if (!['px', 'rem', 'em'].includes(parentColumnUnit)) {
94
120
  parentColumnUnit = 'rem';
95
121
  }
122
+ let numColsToBreakAt = 2;
123
+ if (columnSpan && columnStart) {
124
+ numColsToBreakAt = columnSpan + columnStart - 1;
125
+ } else if (columnSpan) {
126
+ numColsToBreakAt = columnSpan;
127
+ } else {
128
+ numColsToBreakAt = columnStart;
129
+ }
96
130
  const defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;
97
- const containerQueryValue = highestNumber * parentColumnValue + (highestNumber - 1) * defaultGapValue;
131
+ const containerQueryValue = numColsToBreakAt * parentColumnValue + (numColsToBreakAt - 1) * defaultGapValue;
132
+ // For blocks that only span one column, we want to remove any rowStart values as
133
+ // the container reduces in size, so that blocks are still arranged in markup order.
134
+ const minimumContainerQueryValue = parentColumnValue * 2 + defaultGapValue - 1;
98
135
  // If a span is set we want to preserve it as long as possible, otherwise we just reset the value.
99
- const gridColumnValue = columnSpan ? '1/-1' : 'auto';
100
- css += `@container (max-width: ${containerQueryValue}${parentColumnUnit}) {
136
+ const gridColumnValue = columnSpan && columnSpan > 1 ? '1/-1' : 'auto';
137
+ css += `@container (max-width: ${Math.max(containerQueryValue, minimumContainerQueryValue)}${parentColumnUnit}) {
101
138
  ${selector} {
102
139
  grid-column: ${gridColumnValue};
140
+ grid-row: auto;
103
141
  }
104
142
  }`;
105
143
  }
106
- if (rowStart && rowSpan) {
107
- css += `${selector} {
108
- grid-row: ${rowStart} / span ${rowSpan};
109
- }`;
110
- } else if (rowStart) {
111
- css += `${selector} {
112
- grid-row: ${rowStart};
113
- }`;
114
- } else if (rowSpan) {
115
- css += `${selector} {
116
- grid-row: span ${rowSpan};
117
- }`;
118
- }
119
144
  }
120
145
  (0, _utils.useStyleOverride)({
121
146
  css
@@ -140,7 +165,7 @@ function ChildLayoutControlsPure({
140
165
  const {
141
166
  type: parentLayoutType = 'default',
142
167
  allowSizingOnChildren = false,
143
- columnCount
168
+ isManualPlacement
144
169
  } = parentLayout;
145
170
  const rootClientId = (0, _data.useSelect)(select => {
146
171
  return select(_store.store).getBlockRootClientId(clientId);
@@ -151,7 +176,6 @@ function ChildLayoutControlsPure({
151
176
  if (parentLayoutType !== 'grid') {
152
177
  return null;
153
178
  }
154
- const isManualGrid = !!columnCount;
155
179
  function updateLayout(layout) {
156
180
  setAttributes({
157
181
  style: {
@@ -175,7 +199,7 @@ function ChildLayoutControlsPure({
175
199
  bounds: resizerBounds,
176
200
  onChange: updateLayout,
177
201
  parentLayout: parentLayout
178
- }), isManualGrid && window.__experimentalEnableGridInteractivity && /*#__PURE__*/(0, _jsxRuntime.jsx)(_grid.GridItemMovers, {
202
+ }), isManualPlacement && window.__experimentalEnableGridInteractivity && /*#__PURE__*/(0, _jsxRuntime.jsx)(_grid.GridItemMovers, {
179
203
  layout: style?.layout,
180
204
  parentLayout: parentLayout,
181
205
  onChange: updateLayout,
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_data","_element","_store","_utils","_layout","_grid","_jsxRuntime","useBlockPropsChildLayoutStyles","style","_style$layout","shouldRenderChildLayoutStyles","useSelect","select","blockEditorStore","getSettings","disableLayoutStyles","layout","selfStretch","flexSize","columnStart","rowStart","columnSpan","rowSpan","parentLayout","useLayout","columnCount","minimumColumnWidth","id","useInstanceId","selector","css","columnSpanNumber","parseInt","columnStartNumber","highestNumber","Math","max","parentColumnValue","parseFloat","isNaN","parentColumnUnit","replace","includes","defaultGapValue","containerQueryValue","gridColumnValue","useStyleOverride","className","ChildLayoutControlsPure","clientId","setAttributes","type","parentLayoutType","allowSizingOnChildren","rootClientId","getBlockRootClientId","resizerBounds","setResizerBounds","useState","isManualGrid","updateLayout","jsxs","Fragment","children","jsx","GridVisualizer","contentRef","GridItemResizer","bounds","onChange","window","__experimentalEnableGridInteractivity","GridItemMovers","gridClientId","blockClientId","_default","exports","default","useBlockProps","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/layout-child.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useStyleOverride } from './utils';\nimport { useLayout } from '../components/block-list/layout';\nimport {\n\tGridVisualizer,\n\tGridItemResizer,\n\tGridItemMovers,\n} from '../components/grid';\n\nfunction useBlockPropsChildLayoutStyles( { style } ) {\n\tconst shouldRenderChildLayoutStyles = useSelect( ( select ) => {\n\t\treturn ! select( blockEditorStore ).getSettings().disableLayoutStyles;\n\t} );\n\tconst layout = style?.layout ?? {};\n\tconst {\n\t\tselfStretch,\n\t\tflexSize,\n\t\tcolumnStart,\n\t\trowStart,\n\t\tcolumnSpan,\n\t\trowSpan,\n\t} = layout;\n\tconst parentLayout = useLayout() || {};\n\tconst { columnCount, minimumColumnWidth } = parentLayout;\n\tconst id = useInstanceId( useBlockPropsChildLayoutStyles );\n\tconst selector = `.wp-container-content-${ id }`;\n\n\tlet css = '';\n\tif ( shouldRenderChildLayoutStyles ) {\n\t\tif ( selfStretch === 'fixed' && flexSize ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tflex-basis: ${ flexSize };\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}`;\n\t\t} else if ( selfStretch === 'fill' ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tflex-grow: 1;\n\t\t\t}`;\n\t\t} else if ( columnStart && columnSpan ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: ${ columnStart } / span ${ columnSpan };\n\t\t\t}`;\n\t\t} else if ( columnStart ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: ${ columnStart };\n\t\t\t}`;\n\t\t} else if ( columnSpan ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: span ${ columnSpan };\n\t\t\t}`;\n\t\t}\n\t\t/**\n\t\t * If minimumColumnWidth is set on the parent, or if no\n\t\t * columnCount is set, the grid is responsive so a\n\t\t * container query is needed for the span to resize.\n\t\t */\n\t\tif (\n\t\t\t( columnSpan || columnStart ) &&\n\t\t\t( minimumColumnWidth || ! columnCount )\n\t\t) {\n\t\t\t// Check if columnSpan and columnStart are numbers so Math.max doesn't break.\n\t\t\tconst columnSpanNumber = columnSpan ? parseInt( columnSpan ) : null;\n\t\t\tconst columnStartNumber = columnStart\n\t\t\t\t? parseInt( columnStart )\n\t\t\t\t: null;\n\t\t\tconst highestNumber = Math.max(\n\t\t\t\tcolumnSpanNumber,\n\t\t\t\tcolumnStartNumber\n\t\t\t);\n\n\t\t\tlet parentColumnValue = parseFloat( minimumColumnWidth );\n\t\t\t/**\n\t\t\t * 12rem is the default minimumColumnWidth value.\n\t\t\t * If parentColumnValue is not a number, default to 12.\n\t\t\t */\n\t\t\tif ( isNaN( parentColumnValue ) ) {\n\t\t\t\tparentColumnValue = 12;\n\t\t\t}\n\n\t\t\tlet parentColumnUnit = minimumColumnWidth?.replace(\n\t\t\t\tparentColumnValue,\n\t\t\t\t''\n\t\t\t);\n\t\t\t/**\n\t\t\t * Check that parent column unit is either 'px', 'rem' or 'em'.\n\t\t\t * If not, default to 'rem'.\n\t\t\t */\n\t\t\tif ( ! [ 'px', 'rem', 'em' ].includes( parentColumnUnit ) ) {\n\t\t\t\tparentColumnUnit = 'rem';\n\t\t\t}\n\n\t\t\tconst defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;\n\t\t\tconst containerQueryValue =\n\t\t\t\thighestNumber * parentColumnValue +\n\t\t\t\t( highestNumber - 1 ) * defaultGapValue;\n\t\t\t// If a span is set we want to preserve it as long as possible, otherwise we just reset the value.\n\t\t\tconst gridColumnValue = columnSpan ? '1/-1' : 'auto';\n\n\t\t\tcss += `@container (max-width: ${ containerQueryValue }${ parentColumnUnit }) {\n\t\t\t\t${ selector } {\n\t\t\t\t\tgrid-column: ${ gridColumnValue };\n\t\t\t\t}\n\t\t\t}`;\n\t\t}\n\t\tif ( rowStart && rowSpan ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: ${ rowStart } / span ${ rowSpan };\n\t\t\t}`;\n\t\t} else if ( rowStart ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: ${ rowStart };\n\t\t\t}`;\n\t\t} else if ( rowSpan ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: span ${ rowSpan };\n\t\t\t}`;\n\t\t}\n\t}\n\n\tuseStyleOverride( { css } );\n\n\t// Only attach a container class if there is generated CSS to be attached.\n\tif ( ! css ) {\n\t\treturn;\n\t}\n\n\t// Attach a `wp-container-content` id-based classname.\n\treturn { className: `wp-container-content-${ id }` };\n}\n\nfunction ChildLayoutControlsPure( { clientId, style, setAttributes } ) {\n\tconst parentLayout = useLayout() || {};\n\tconst {\n\t\ttype: parentLayoutType = 'default',\n\t\tallowSizingOnChildren = false,\n\t\tcolumnCount,\n\t} = parentLayout;\n\n\tconst rootClientId = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( blockEditorStore ).getBlockRootClientId( clientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Use useState() instead of useRef() so that GridItemResizer updates when ref is set.\n\tconst [ resizerBounds, setResizerBounds ] = useState();\n\n\tif ( parentLayoutType !== 'grid' ) {\n\t\treturn null;\n\t}\n\n\tconst isManualGrid = !! columnCount;\n\n\tfunction updateLayout( layout ) {\n\t\tsetAttributes( {\n\t\t\tstyle: {\n\t\t\t\t...style,\n\t\t\t\tlayout: {\n\t\t\t\t\t...style?.layout,\n\t\t\t\t\t...layout,\n\t\t\t\t},\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<GridVisualizer\n\t\t\t\tclientId={ rootClientId }\n\t\t\t\tcontentRef={ setResizerBounds }\n\t\t\t\tparentLayout={ parentLayout }\n\t\t\t/>\n\t\t\t{ allowSizingOnChildren && (\n\t\t\t\t<GridItemResizer\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t// Don't allow resizing beyond the grid visualizer.\n\t\t\t\t\tbounds={ resizerBounds }\n\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isManualGrid && window.__experimentalEnableGridInteractivity && (\n\t\t\t\t<GridItemMovers\n\t\t\t\t\tlayout={ style?.layout }\n\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\tgridClientId={ rootClientId }\n\t\t\t\t\tblockClientId={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tuseBlockProps: useBlockPropsChildLayoutStyles,\n\tedit: ChildLayoutControlsPure,\n\tattributeKeys: [ 'style' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,I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BC,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_compose","require","_data","_element","_store","_utils","_layout","_grid","_jsxRuntime","useBlockPropsChildLayoutStyles","style","_style$layout","shouldRenderChildLayoutStyles","useSelect","select","blockEditorStore","getSettings","disableLayoutStyles","layout","selfStretch","flexSize","columnStart","rowStart","columnSpan","rowSpan","parentLayout","useLayout","columnCount","minimumColumnWidth","id","useInstanceId","selector","process","env","NODE_ENV","Error","css","parentColumnValue","parseFloat","isNaN","parentColumnUnit","replace","includes","numColsToBreakAt","defaultGapValue","containerQueryValue","minimumContainerQueryValue","gridColumnValue","Math","max","useStyleOverride","className","ChildLayoutControlsPure","clientId","setAttributes","type","parentLayoutType","allowSizingOnChildren","isManualPlacement","rootClientId","getBlockRootClientId","resizerBounds","setResizerBounds","useState","updateLayout","jsxs","Fragment","children","jsx","GridVisualizer","contentRef","GridItemResizer","bounds","onChange","window","__experimentalEnableGridInteractivity","GridItemMovers","gridClientId","blockClientId","_default","exports","default","useBlockProps","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/layout-child.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useStyleOverride } from './utils';\nimport { useLayout } from '../components/block-list/layout';\nimport {\n\tGridVisualizer,\n\tGridItemResizer,\n\tGridItemMovers,\n} from '../components/grid';\n\nfunction useBlockPropsChildLayoutStyles( { style } ) {\n\tconst shouldRenderChildLayoutStyles = useSelect( ( select ) => {\n\t\treturn ! select( blockEditorStore ).getSettings().disableLayoutStyles;\n\t} );\n\tconst layout = style?.layout ?? {};\n\tconst {\n\t\tselfStretch,\n\t\tflexSize,\n\t\tcolumnStart,\n\t\trowStart,\n\t\tcolumnSpan,\n\t\trowSpan,\n\t} = layout;\n\tconst parentLayout = useLayout() || {};\n\tconst { columnCount, minimumColumnWidth } = parentLayout;\n\tconst id = useInstanceId( useBlockPropsChildLayoutStyles );\n\tconst selector = `.wp-container-content-${ id }`;\n\n\t// Check that the grid layout attributes are of the correct type, so that we don't accidentally\n\t// write code that stores a string attribute instead of a number.\n\tif ( process.env.NODE_ENV === 'development' ) {\n\t\tif ( columnStart && typeof columnStart !== 'number' ) {\n\t\t\tthrow new Error( 'columnStart must be a number' );\n\t\t}\n\t\tif ( rowStart && typeof rowStart !== 'number' ) {\n\t\t\tthrow new Error( 'rowStart must be a number' );\n\t\t}\n\t\tif ( columnSpan && typeof columnSpan !== 'number' ) {\n\t\t\tthrow new Error( 'columnSpan must be a number' );\n\t\t}\n\t\tif ( rowSpan && typeof rowSpan !== 'number' ) {\n\t\t\tthrow new Error( 'rowSpan must be a number' );\n\t\t}\n\t}\n\n\tlet css = '';\n\tif ( shouldRenderChildLayoutStyles ) {\n\t\tif ( selfStretch === 'fixed' && flexSize ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tflex-basis: ${ flexSize };\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}`;\n\t\t} else if ( selfStretch === 'fill' ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tflex-grow: 1;\n\t\t\t}`;\n\t\t} else if ( columnStart && columnSpan ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: ${ columnStart } / span ${ columnSpan };\n\t\t\t}`;\n\t\t} else if ( columnStart ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: ${ columnStart };\n\t\t\t}`;\n\t\t} else if ( columnSpan ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: span ${ columnSpan };\n\t\t\t}`;\n\t\t}\n\t\tif ( rowStart && rowSpan ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: ${ rowStart } / span ${ rowSpan };\n\t\t\t}`;\n\t\t} else if ( rowStart ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: ${ rowStart };\n\t\t\t}`;\n\t\t} else if ( rowSpan ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: span ${ rowSpan };\n\t\t\t}`;\n\t\t}\n\t\t/**\n\t\t * If minimumColumnWidth is set on the parent, or if no\n\t\t * columnCount is set, the grid is responsive so a\n\t\t * container query is needed for the span to resize.\n\t\t */\n\t\tif (\n\t\t\t( columnSpan || columnStart ) &&\n\t\t\t( minimumColumnWidth || ! columnCount )\n\t\t) {\n\t\t\tlet parentColumnValue = parseFloat( minimumColumnWidth );\n\t\t\t/**\n\t\t\t * 12rem is the default minimumColumnWidth value.\n\t\t\t * If parentColumnValue is not a number, default to 12.\n\t\t\t */\n\t\t\tif ( isNaN( parentColumnValue ) ) {\n\t\t\t\tparentColumnValue = 12;\n\t\t\t}\n\n\t\t\tlet parentColumnUnit = minimumColumnWidth?.replace(\n\t\t\t\tparentColumnValue,\n\t\t\t\t''\n\t\t\t);\n\t\t\t/**\n\t\t\t * Check that parent column unit is either 'px', 'rem' or 'em'.\n\t\t\t * If not, default to 'rem'.\n\t\t\t */\n\t\t\tif ( ! [ 'px', 'rem', 'em' ].includes( parentColumnUnit ) ) {\n\t\t\t\tparentColumnUnit = 'rem';\n\t\t\t}\n\n\t\t\tlet numColsToBreakAt = 2;\n\n\t\t\tif ( columnSpan && columnStart ) {\n\t\t\t\tnumColsToBreakAt = columnSpan + columnStart - 1;\n\t\t\t} else if ( columnSpan ) {\n\t\t\t\tnumColsToBreakAt = columnSpan;\n\t\t\t} else {\n\t\t\t\tnumColsToBreakAt = columnStart;\n\t\t\t}\n\n\t\t\tconst defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;\n\t\t\tconst containerQueryValue =\n\t\t\t\tnumColsToBreakAt * parentColumnValue +\n\t\t\t\t( numColsToBreakAt - 1 ) * defaultGapValue;\n\t\t\t// For blocks that only span one column, we want to remove any rowStart values as\n\t\t\t// the container reduces in size, so that blocks are still arranged in markup order.\n\t\t\tconst minimumContainerQueryValue =\n\t\t\t\tparentColumnValue * 2 + defaultGapValue - 1;\n\t\t\t// If a span is set we want to preserve it as long as possible, otherwise we just reset the value.\n\t\t\tconst gridColumnValue =\n\t\t\t\tcolumnSpan && columnSpan > 1 ? '1/-1' : 'auto';\n\n\t\t\tcss += `@container (max-width: ${ Math.max(\n\t\t\t\tcontainerQueryValue,\n\t\t\t\tminimumContainerQueryValue\n\t\t\t) }${ parentColumnUnit }) {\n\t\t\t\t${ selector } {\n\t\t\t\t\tgrid-column: ${ gridColumnValue };\n\t\t\t\t\tgrid-row: auto;\n\t\t\t\t}\n\t\t\t}`;\n\t\t}\n\t}\n\n\tuseStyleOverride( { css } );\n\n\t// Only attach a container class if there is generated CSS to be attached.\n\tif ( ! css ) {\n\t\treturn;\n\t}\n\n\t// Attach a `wp-container-content` id-based classname.\n\treturn { className: `wp-container-content-${ id }` };\n}\n\nfunction ChildLayoutControlsPure( { clientId, style, setAttributes } ) {\n\tconst parentLayout = useLayout() || {};\n\tconst {\n\t\ttype: parentLayoutType = 'default',\n\t\tallowSizingOnChildren = false,\n\t\tisManualPlacement,\n\t} = parentLayout;\n\n\tconst rootClientId = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( blockEditorStore ).getBlockRootClientId( clientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Use useState() instead of useRef() so that GridItemResizer updates when ref is set.\n\tconst [ resizerBounds, setResizerBounds ] = useState();\n\n\tif ( parentLayoutType !== 'grid' ) {\n\t\treturn null;\n\t}\n\n\tfunction updateLayout( layout ) {\n\t\tsetAttributes( {\n\t\t\tstyle: {\n\t\t\t\t...style,\n\t\t\t\tlayout: {\n\t\t\t\t\t...style?.layout,\n\t\t\t\t\t...layout,\n\t\t\t\t},\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<GridVisualizer\n\t\t\t\tclientId={ rootClientId }\n\t\t\t\tcontentRef={ setResizerBounds }\n\t\t\t\tparentLayout={ parentLayout }\n\t\t\t/>\n\t\t\t{ allowSizingOnChildren && (\n\t\t\t\t<GridItemResizer\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t// Don't allow resizing beyond the grid visualizer.\n\t\t\t\t\tbounds={ resizerBounds }\n\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isManualPlacement &&\n\t\t\t\twindow.__experimentalEnableGridInteractivity && (\n\t\t\t\t\t<GridItemMovers\n\t\t\t\t\t\tlayout={ style?.layout }\n\t\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\t\tgridClientId={ rootClientId }\n\t\t\t\t\t\tblockClientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tuseBlockProps: useBlockPropsChildLayoutStyles,\n\tedit: ChildLayoutControlsPure,\n\tattributeKeys: [ 'style' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAI4B,IAAAO,WAAA,GAAAP,OAAA;AAjB5B;AACA;AACA;;AAKA;AACA;AACA;;AAUA,SAASQ,8BAA8BA,CAAE;EAAEC;AAAM,CAAC,EAAG;EAAA,IAAAC,aAAA;EACpD,MAAMC,6BAA6B,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC9D,OAAO,CAAEA,MAAM,CAAEC,YAAiB,CAAC,CAACC,WAAW,CAAC,CAAC,CAACC,mBAAmB;EACtE,CAAE,CAAC;EAC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