@wordpress/block-editor 13.3.0 → 14.0.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 (554) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +11 -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 +3 -1
  10. package/build/components/block-breadcrumb/index.js.map +1 -1
  11. package/build/components/block-draggable/index.js +2 -2
  12. package/build/components/block-draggable/index.js.map +1 -1
  13. package/build/components/block-inspector/index.js +6 -3
  14. package/build/components/block-inspector/index.js.map +1 -1
  15. package/build/components/block-list/use-block-props/index.js +3 -1
  16. package/build/components/block-list/use-block-props/index.js.map +1 -1
  17. package/build/components/block-list/use-block-props/use-block-refs.js +26 -27
  18. package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
  19. package/build/components/block-list/use-block-props/use-is-hovered.js +25 -9
  20. package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  21. package/build/components/block-list/use-in-between-inserter.js +3 -2
  22. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  23. package/build/components/block-lock/modal.js +2 -0
  24. package/build/components/block-lock/modal.js.map +1 -1
  25. package/build/components/block-mover/index.js +1 -2
  26. package/build/components/block-mover/index.js.map +1 -1
  27. package/build/components/block-popover/cover.js +1 -1
  28. package/build/components/block-popover/cover.js.map +1 -1
  29. package/build/components/block-popover/inbetween.js +2 -2
  30. package/build/components/block-popover/inbetween.js.map +1 -1
  31. package/build/components/block-popover/index.js +2 -2
  32. package/build/components/block-popover/index.js.map +1 -1
  33. package/build/components/block-removal-warning-modal/index.js +2 -0
  34. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  35. package/build/components/block-switcher/index.js +1 -1
  36. package/build/components/block-switcher/index.js.map +1 -1
  37. package/build/components/block-switcher/pattern-transformations-menu.js +11 -12
  38. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  39. package/build/components/block-switcher/preview-block-popover.js +20 -17
  40. package/build/components/block-switcher/preview-block-popover.js.map +1 -1
  41. package/build/components/block-toolbar/shuffle.js +5 -2
  42. package/build/components/block-toolbar/shuffle.js.map +1 -1
  43. package/build/components/block-tools/block-selection-button.js +1 -2
  44. package/build/components/block-tools/block-selection-button.js.map +1 -1
  45. package/build/components/block-tools/index.js +1 -1
  46. package/build/components/block-tools/index.js.map +1 -1
  47. package/build/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  48. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  49. package/build/components/block-tools/use-show-block-tools.js +7 -8
  50. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  51. package/build/components/block-tools/zoom-out-mode-inserter-button.js +45 -0
  52. package/build/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
  53. package/build/components/block-tools/zoom-out-mode-inserters.js +35 -36
  54. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  55. package/build/components/block-tools/zoom-out-popover.js +2 -1
  56. package/build/components/block-tools/zoom-out-popover.js.map +1 -1
  57. package/build/components/block-tools/zoom-out-toolbar.js +1 -2
  58. package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
  59. package/build/components/child-layout-control/index.js +3 -1
  60. package/build/components/child-layout-control/index.js.map +1 -1
  61. package/build/components/date-format-picker/index.js +2 -11
  62. package/build/components/date-format-picker/index.js.map +1 -1
  63. package/build/components/default-block-appender/index.js +7 -4
  64. package/build/components/default-block-appender/index.js.map +1 -1
  65. package/build/components/dimensions-tool/scale-tool.js +1 -0
  66. package/build/components/dimensions-tool/scale-tool.js.map +1 -1
  67. package/build/components/font-appearance-control/index.js +2 -7
  68. package/build/components/font-appearance-control/index.js.map +1 -1
  69. package/build/components/font-family/index.js +12 -0
  70. package/build/components/font-family/index.js.map +1 -1
  71. package/build/components/global-styles/background-panel.js +63 -52
  72. package/build/components/global-styles/background-panel.js.map +1 -1
  73. package/build/components/global-styles/hooks.js +5 -1
  74. package/build/components/global-styles/hooks.js.map +1 -1
  75. package/build/components/global-styles/image-settings-panel.js +1 -0
  76. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  77. package/build/components/global-styles/theme-file-uri-utils.js +0 -59
  78. package/build/components/global-styles/theme-file-uri-utils.js.map +1 -1
  79. package/build/components/global-styles/typography-panel.js +26 -44
  80. package/build/components/global-styles/typography-panel.js.map +1 -1
  81. package/build/components/global-styles/typography-utils.js +78 -7
  82. package/build/components/global-styles/typography-utils.js.map +1 -1
  83. package/build/components/global-styles/use-global-styles-output.js +82 -44
  84. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  85. package/build/components/global-styles/utils.js +96 -0
  86. package/build/components/global-styles/utils.js.map +1 -1
  87. package/build/components/grid/grid-item-movers.js +93 -44
  88. package/build/components/grid/grid-item-movers.js.map +1 -1
  89. package/build/components/grid/grid-item-resizer.js +14 -15
  90. package/build/components/grid/grid-item-resizer.js.map +1 -1
  91. package/build/components/grid/grid-visualizer.js +2 -2
  92. package/build/components/grid/grid-visualizer.js.map +1 -1
  93. package/build/components/grid/use-grid-layout-sync.js +93 -45
  94. package/build/components/grid/use-grid-layout-sync.js.map +1 -1
  95. package/build/components/iframe/index.js +4 -8
  96. package/build/components/iframe/index.js.map +1 -1
  97. package/build/components/index.js +1 -9
  98. package/build/components/index.js.map +1 -1
  99. package/build/components/inner-blocks/index.js +1 -1
  100. package/build/components/inner-blocks/index.js.map +1 -1
  101. package/build/components/inserter/block-patterns-tab/patterns-filter.js +20 -23
  102. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  103. package/build/components/inserter/category-tabs/index.js +29 -2
  104. package/build/components/inserter/category-tabs/index.js.map +1 -1
  105. package/build/components/inserter/media-tab/media-panel.js +1 -0
  106. package/build/components/inserter/media-tab/media-panel.js.map +1 -1
  107. package/build/components/inserter/menu.js +3 -3
  108. package/build/components/inserter/menu.js.map +1 -1
  109. package/build/components/inserter/preview-panel.js +20 -3
  110. package/build/components/inserter/preview-panel.js.map +1 -1
  111. package/build/components/inserter-draggable-blocks/index.js +10 -3
  112. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  113. package/build/components/inspector-controls-tabs/settings-tab.js +1 -2
  114. package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  115. package/build/components/line-height-control/index.js +0 -15
  116. package/build/components/line-height-control/index.js.map +1 -1
  117. package/build/components/link-control/search-input.js +0 -1
  118. package/build/components/link-control/search-input.js.map +1 -1
  119. package/build/components/list-view/block-select-button.js +2 -6
  120. package/build/components/list-view/block-select-button.js.map +1 -1
  121. package/build/components/list-view/block.js +2 -2
  122. package/build/components/list-view/block.js.map +1 -1
  123. package/build/components/list-view/utils.js +3 -1
  124. package/build/components/list-view/utils.js.map +1 -1
  125. package/build/components/media-replace-flow/index.js +3 -1
  126. package/build/components/media-replace-flow/index.js.map +1 -1
  127. package/build/components/resolution-tool/index.js +1 -0
  128. package/build/components/resolution-tool/index.js.map +1 -1
  129. package/build/components/rich-text/format-toolbar/index.js +1 -1
  130. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  131. package/build/components/rich-text/index.js +1 -1
  132. package/build/components/rich-text/index.js.map +1 -1
  133. package/build/components/skip-to-selected-block/index.js +4 -2
  134. package/build/components/skip-to-selected-block/index.js.map +1 -1
  135. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -8
  136. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  137. package/build/components/url-input/button.js +0 -1
  138. package/build/components/url-input/button.js.map +1 -1
  139. package/build/components/url-input/index.js +1 -11
  140. package/build/components/url-input/index.js.map +1 -1
  141. package/build/components/url-popover/image-url-input-ui.js +3 -3
  142. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  143. package/build/components/url-popover/link-editor.js +0 -1
  144. package/build/components/url-popover/link-editor.js.map +1 -1
  145. package/build/components/use-block-drop-zone/index.js +30 -4
  146. package/build/components/use-block-drop-zone/index.js.map +1 -1
  147. package/build/components/use-on-block-drop/index.js +3 -6
  148. package/build/components/use-on-block-drop/index.js.map +1 -1
  149. package/build/components/use-resize-canvas/index.js +1 -3
  150. package/build/components/use-resize-canvas/index.js.map +1 -1
  151. package/build/components/use-settings/index.js +2 -1
  152. package/build/components/use-settings/index.js.map +1 -1
  153. package/build/hooks/block-bindings.js +248 -36
  154. package/build/hooks/block-bindings.js.map +1 -1
  155. package/build/hooks/block-hooks.js +1 -0
  156. package/build/hooks/block-hooks.js.map +1 -1
  157. package/build/hooks/block-style-variation.js +2 -2
  158. package/build/hooks/block-style-variation.js.map +1 -1
  159. package/build/hooks/contrast-checker.js +6 -6
  160. package/build/hooks/contrast-checker.js.map +1 -1
  161. package/build/hooks/duotone.js +3 -3
  162. package/build/hooks/duotone.js.map +1 -1
  163. package/build/hooks/grid-visualizer.js +5 -8
  164. package/build/hooks/grid-visualizer.js.map +1 -1
  165. package/build/hooks/index.js +7 -1
  166. package/build/hooks/index.js.map +1 -1
  167. package/build/hooks/layout-child.js +9 -2
  168. package/build/hooks/layout-child.js.map +1 -1
  169. package/build/hooks/line-height.js +0 -1
  170. package/build/hooks/line-height.js.map +1 -1
  171. package/build/hooks/position.js +3 -7
  172. package/build/hooks/position.js.map +1 -1
  173. package/build/hooks/spacing-visualizer.js +1 -1
  174. package/build/hooks/spacing-visualizer.js.map +1 -1
  175. package/build/hooks/use-bindings-attributes.js +85 -50
  176. package/build/hooks/use-bindings-attributes.js.map +1 -1
  177. package/build/hooks/use-zoom-out.js +1 -1
  178. package/build/hooks/use-zoom-out.js.map +1 -1
  179. package/build/hooks/utils.js +20 -0
  180. package/build/hooks/utils.js.map +1 -1
  181. package/build/index.js +7 -0
  182. package/build/index.js.map +1 -1
  183. package/build/layouts/constrained.js +6 -2
  184. package/build/layouts/constrained.js.map +1 -1
  185. package/build/layouts/grid.js +2 -0
  186. package/build/layouts/grid.js.map +1 -1
  187. package/build/private-apis.js +0 -4
  188. package/build/private-apis.js.map +1 -1
  189. package/build/store/actions.js +27 -2
  190. package/build/store/actions.js.map +1 -1
  191. package/build/store/reducer.js +19 -1
  192. package/build/store/reducer.js.map +1 -1
  193. package/build/store/selectors.js +17 -5
  194. package/build/store/selectors.js.map +1 -1
  195. package/build/utils/get-editor-region.js +1 -1
  196. package/build/utils/get-editor-region.js.map +1 -1
  197. package/build/utils/get-px-from-css-unit.js +1 -1
  198. package/build/utils/get-px-from-css-unit.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 +4 -2
  206. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  207. package/build-module/components/block-draggable/index.js +3 -3
  208. package/build-module/components/block-draggable/index.js.map +1 -1
  209. package/build-module/components/block-inspector/index.js +6 -3
  210. package/build-module/components/block-inspector/index.js.map +1 -1
  211. package/build-module/components/block-list/use-block-props/index.js +3 -1
  212. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  213. package/build-module/components/block-list/use-block-props/use-block-refs.js +27 -30
  214. package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
  215. package/build-module/components/block-list/use-block-props/use-is-hovered.js +26 -9
  216. package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  217. package/build-module/components/block-list/use-in-between-inserter.js +3 -2
  218. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  219. package/build-module/components/block-lock/modal.js +2 -0
  220. package/build-module/components/block-lock/modal.js.map +1 -1
  221. package/build-module/components/block-mover/index.js +1 -2
  222. package/build-module/components/block-mover/index.js.map +1 -1
  223. package/build-module/components/block-popover/cover.js +1 -1
  224. package/build-module/components/block-popover/cover.js.map +1 -1
  225. package/build-module/components/block-popover/inbetween.js +1 -1
  226. package/build-module/components/block-popover/inbetween.js.map +1 -1
  227. package/build-module/components/block-popover/index.js +1 -1
  228. package/build-module/components/block-popover/index.js.map +1 -1
  229. package/build-module/components/block-removal-warning-modal/index.js +2 -0
  230. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  231. package/build-module/components/block-switcher/index.js +1 -1
  232. package/build-module/components/block-switcher/index.js.map +1 -1
  233. package/build-module/components/block-switcher/pattern-transformations-menu.js +12 -13
  234. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  235. package/build-module/components/block-switcher/preview-block-popover.js +20 -17
  236. package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
  237. package/build-module/components/block-toolbar/shuffle.js +5 -2
  238. package/build-module/components/block-toolbar/shuffle.js.map +1 -1
  239. package/build-module/components/block-tools/block-selection-button.js +1 -2
  240. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  241. package/build-module/components/block-tools/index.js +1 -1
  242. package/build-module/components/block-tools/index.js.map +1 -1
  243. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  244. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  245. package/build-module/components/block-tools/use-show-block-tools.js +7 -8
  246. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  247. package/build-module/components/block-tools/zoom-out-mode-inserter-button.js +37 -0
  248. package/build-module/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
  249. package/build-module/components/block-tools/zoom-out-mode-inserters.js +37 -38
  250. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  251. package/build-module/components/block-tools/zoom-out-popover.js +2 -1
  252. package/build-module/components/block-tools/zoom-out-popover.js.map +1 -1
  253. package/build-module/components/block-tools/zoom-out-toolbar.js +1 -2
  254. package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
  255. package/build-module/components/child-layout-control/index.js +3 -1
  256. package/build-module/components/child-layout-control/index.js.map +1 -1
  257. package/build-module/components/date-format-picker/index.js +4 -12
  258. package/build-module/components/date-format-picker/index.js.map +1 -1
  259. package/build-module/components/default-block-appender/index.js +7 -4
  260. package/build-module/components/default-block-appender/index.js.map +1 -1
  261. package/build-module/components/dimensions-tool/scale-tool.js +1 -0
  262. package/build-module/components/dimensions-tool/scale-tool.js.map +1 -1
  263. package/build-module/components/font-appearance-control/index.js +3 -6
  264. package/build-module/components/font-appearance-control/index.js.map +1 -1
  265. package/build-module/components/font-family/index.js +11 -0
  266. package/build-module/components/font-family/index.js.map +1 -1
  267. package/build-module/components/global-styles/background-panel.js +63 -52
  268. package/build-module/components/global-styles/background-panel.js.map +1 -1
  269. package/build-module/components/global-styles/hooks.js +5 -1
  270. package/build-module/components/global-styles/hooks.js.map +1 -1
  271. package/build-module/components/global-styles/image-settings-panel.js +1 -0
  272. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  273. package/build-module/components/global-styles/theme-file-uri-utils.js +0 -58
  274. package/build-module/components/global-styles/theme-file-uri-utils.js.map +1 -1
  275. package/build-module/components/global-styles/typography-panel.js +27 -45
  276. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  277. package/build-module/components/global-styles/typography-utils.js +76 -7
  278. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  279. package/build-module/components/global-styles/use-global-styles-output.js +81 -43
  280. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  281. package/build-module/components/global-styles/utils.js +92 -0
  282. package/build-module/components/global-styles/utils.js.map +1 -1
  283. package/build-module/components/grid/grid-item-movers.js +96 -46
  284. package/build-module/components/grid/grid-item-movers.js.map +1 -1
  285. package/build-module/components/grid/grid-item-resizer.js +14 -15
  286. package/build-module/components/grid/grid-item-resizer.js.map +1 -1
  287. package/build-module/components/grid/grid-visualizer.js +2 -2
  288. package/build-module/components/grid/grid-visualizer.js.map +1 -1
  289. package/build-module/components/grid/use-grid-layout-sync.js +94 -46
  290. package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
  291. package/build-module/components/iframe/index.js +4 -8
  292. package/build-module/components/iframe/index.js.map +1 -1
  293. package/build-module/components/index.js +0 -5
  294. package/build-module/components/index.js.map +1 -1
  295. package/build-module/components/inner-blocks/index.js +1 -1
  296. package/build-module/components/inner-blocks/index.js.map +1 -1
  297. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +20 -23
  298. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  299. package/build-module/components/inserter/category-tabs/index.js +30 -3
  300. package/build-module/components/inserter/category-tabs/index.js.map +1 -1
  301. package/build-module/components/inserter/media-tab/media-panel.js +1 -0
  302. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
  303. package/build-module/components/inserter/menu.js +3 -3
  304. package/build-module/components/inserter/menu.js.map +1 -1
  305. package/build-module/components/inserter/preview-panel.js +20 -3
  306. package/build-module/components/inserter/preview-panel.js.map +1 -1
  307. package/build-module/components/inserter-draggable-blocks/index.js +10 -3
  308. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  309. package/build-module/components/inspector-controls-tabs/settings-tab.js +1 -2
  310. package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  311. package/build-module/components/line-height-control/index.js +0 -14
  312. package/build-module/components/line-height-control/index.js.map +1 -1
  313. package/build-module/components/link-control/search-input.js +0 -1
  314. package/build-module/components/link-control/search-input.js.map +1 -1
  315. package/build-module/components/list-view/block-select-button.js +3 -7
  316. package/build-module/components/list-view/block-select-button.js.map +1 -1
  317. package/build-module/components/list-view/block.js +2 -2
  318. package/build-module/components/list-view/block.js.map +1 -1
  319. package/build-module/components/list-view/utils.js +3 -1
  320. package/build-module/components/list-view/utils.js.map +1 -1
  321. package/build-module/components/media-replace-flow/index.js +3 -1
  322. package/build-module/components/media-replace-flow/index.js.map +1 -1
  323. package/build-module/components/resolution-tool/index.js +1 -0
  324. package/build-module/components/resolution-tool/index.js.map +1 -1
  325. package/build-module/components/rich-text/format-toolbar/index.js +1 -1
  326. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  327. package/build-module/components/rich-text/index.js +1 -1
  328. package/build-module/components/rich-text/index.js.map +1 -1
  329. package/build-module/components/skip-to-selected-block/index.js +5 -3
  330. package/build-module/components/skip-to-selected-block/index.js.map +1 -1
  331. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -8
  332. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  333. package/build-module/components/url-input/button.js +0 -1
  334. package/build-module/components/url-input/button.js.map +1 -1
  335. package/build-module/components/url-input/index.js +1 -11
  336. package/build-module/components/url-input/index.js.map +1 -1
  337. package/build-module/components/url-popover/image-url-input-ui.js +3 -3
  338. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  339. package/build-module/components/url-popover/link-editor.js +0 -1
  340. package/build-module/components/url-popover/link-editor.js.map +1 -1
  341. package/build-module/components/use-block-drop-zone/index.js +30 -4
  342. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  343. package/build-module/components/use-on-block-drop/index.js +3 -6
  344. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  345. package/build-module/components/use-resize-canvas/index.js +1 -3
  346. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  347. package/build-module/components/use-settings/index.js +2 -1
  348. package/build-module/components/use-settings/index.js.map +1 -1
  349. package/build-module/hooks/block-bindings.js +253 -40
  350. package/build-module/hooks/block-bindings.js.map +1 -1
  351. package/build-module/hooks/block-hooks.js +1 -0
  352. package/build-module/hooks/block-hooks.js.map +1 -1
  353. package/build-module/hooks/block-style-variation.js +3 -3
  354. package/build-module/hooks/block-style-variation.js.map +1 -1
  355. package/build-module/hooks/contrast-checker.js +7 -7
  356. package/build-module/hooks/contrast-checker.js.map +1 -1
  357. package/build-module/hooks/duotone.js +4 -4
  358. package/build-module/hooks/duotone.js.map +1 -1
  359. package/build-module/hooks/grid-visualizer.js +5 -8
  360. package/build-module/hooks/grid-visualizer.js.map +1 -1
  361. package/build-module/hooks/index.js +2 -1
  362. package/build-module/hooks/index.js.map +1 -1
  363. package/build-module/hooks/layout-child.js +9 -2
  364. package/build-module/hooks/layout-child.js.map +1 -1
  365. package/build-module/hooks/line-height.js +0 -1
  366. package/build-module/hooks/line-height.js.map +1 -1
  367. package/build-module/hooks/position.js +3 -7
  368. package/build-module/hooks/position.js.map +1 -1
  369. package/build-module/hooks/spacing-visualizer.js +1 -1
  370. package/build-module/hooks/spacing-visualizer.js.map +1 -1
  371. package/build-module/hooks/use-bindings-attributes.js +84 -51
  372. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  373. package/build-module/hooks/use-zoom-out.js +1 -1
  374. package/build-module/hooks/use-zoom-out.js.map +1 -1
  375. package/build-module/hooks/utils.js +19 -0
  376. package/build-module/hooks/utils.js.map +1 -1
  377. package/build-module/index.js +1 -1
  378. package/build-module/index.js.map +1 -1
  379. package/build-module/layouts/constrained.js +6 -2
  380. package/build-module/layouts/constrained.js.map +1 -1
  381. package/build-module/layouts/grid.js +2 -0
  382. package/build-module/layouts/grid.js.map +1 -1
  383. package/build-module/private-apis.js +1 -5
  384. package/build-module/private-apis.js.map +1 -1
  385. package/build-module/store/actions.js +24 -1
  386. package/build-module/store/actions.js.map +1 -1
  387. package/build-module/store/reducer.js +18 -1
  388. package/build-module/store/reducer.js.map +1 -1
  389. package/build-module/store/selectors.js +14 -4
  390. package/build-module/store/selectors.js.map +1 -1
  391. package/build-module/utils/get-editor-region.js +1 -1
  392. package/build-module/utils/get-editor-region.js.map +1 -1
  393. package/build-module/utils/get-px-from-css-unit.js +1 -1
  394. package/build-module/utils/get-px-from-css-unit.js.map +1 -1
  395. package/build-style/content-rtl.css +11 -18
  396. package/build-style/content.css +11 -18
  397. package/build-style/default-editor-styles-rtl.css +3 -0
  398. package/build-style/default-editor-styles.css +3 -0
  399. package/build-style/style-rtl.css +242 -136
  400. package/build-style/style.css +242 -136
  401. package/build-types/components/block-context/index.d.ts +2 -2
  402. package/build-types/components/block-context/index.d.ts.map +1 -1
  403. package/build-types/utils/dom.d.ts.map +1 -1
  404. package/package.json +31 -31
  405. package/src/autocompleters/style.scss +4 -0
  406. package/src/components/alignment-control/ui.js +2 -2
  407. package/src/components/block-alignment-control/ui.js +1 -1
  408. package/src/components/block-alignment-control/ui.native.js +1 -1
  409. package/src/components/block-breadcrumb/index.js +4 -2
  410. package/src/components/block-canvas/style.scss +1 -0
  411. package/src/components/block-context/README.md +4 -4
  412. package/src/components/block-draggable/index.js +3 -3
  413. package/src/components/block-inspector/index.js +8 -4
  414. package/src/components/block-list/content.scss +2 -16
  415. package/src/components/block-list/use-block-props/index.js +1 -1
  416. package/src/components/block-list/use-block-props/use-block-refs.js +30 -30
  417. package/src/components/block-list/use-block-props/use-is-hovered.js +26 -11
  418. package/src/components/block-list/use-in-between-inserter.js +5 -1
  419. package/src/components/block-lock/modal.js +10 -2
  420. package/src/components/block-lock/style.scss +4 -8
  421. package/src/components/block-mover/index.js +5 -2
  422. package/src/components/block-patterns-paging/style.scss +0 -23
  423. package/src/components/block-popover/cover.js +1 -1
  424. package/src/components/block-popover/inbetween.js +1 -1
  425. package/src/components/block-popover/index.js +1 -1
  426. package/src/components/block-removal-warning-modal/index.js +10 -2
  427. package/src/components/block-switcher/index.js +1 -1
  428. package/src/components/block-switcher/pattern-transformations-menu.js +17 -15
  429. package/src/components/block-switcher/preview-block-popover.js +20 -14
  430. package/src/components/block-switcher/style.scss +8 -17
  431. package/src/components/block-toolbar/shuffle.js +8 -1
  432. package/src/components/block-tools/block-selection-button.js +1 -2
  433. package/src/components/block-tools/index.js +5 -6
  434. package/src/components/block-tools/style.scss +8 -0
  435. package/src/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  436. package/src/components/block-tools/use-show-block-tools.js +12 -9
  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 +48 -42
  439. package/src/components/block-tools/zoom-out-popover.js +1 -0
  440. package/src/components/block-tools/zoom-out-toolbar.js +1 -2
  441. package/src/components/button-block-appender/content.scss +1 -1
  442. package/src/components/child-layout-control/index.js +2 -0
  443. package/src/components/color-palette/test/__snapshots__/control.js.snap +2 -2
  444. package/src/components/colors-gradients/test/control.js +3 -2
  445. package/src/components/date-format-picker/index.js +2 -11
  446. package/src/components/default-block-appender/index.js +11 -4
  447. package/src/components/dimensions-tool/scale-tool.js +1 -0
  448. package/src/components/font-appearance-control/index.js +1 -5
  449. package/src/components/font-family/README.md +8 -0
  450. package/src/components/font-family/index.js +16 -0
  451. package/src/components/font-family/stories/index.story.js +54 -0
  452. package/src/components/global-styles/background-panel.js +90 -62
  453. package/src/components/global-styles/hooks.js +5 -1
  454. package/src/components/global-styles/image-settings-panel.js +1 -0
  455. package/src/components/global-styles/style.scss +11 -9
  456. package/src/components/global-styles/test/theme-file-uri-utils.js +1 -26
  457. package/src/components/global-styles/test/typography-utils.js +325 -0
  458. package/src/components/global-styles/test/use-global-styles-output.js +52 -5
  459. package/src/components/global-styles/test/utils.js +120 -0
  460. package/src/components/global-styles/theme-file-uri-utils.js +0 -59
  461. package/src/components/global-styles/typography-panel.js +36 -45
  462. package/src/components/global-styles/typography-utils.js +103 -7
  463. package/src/components/global-styles/use-global-styles-output.js +89 -50
  464. package/src/components/global-styles/utils.js +112 -0
  465. package/src/components/grid/grid-item-movers.js +141 -69
  466. package/src/components/grid/grid-item-resizer.js +11 -17
  467. package/src/components/grid/grid-visualizer.js +2 -2
  468. package/src/components/grid/style.scss +164 -0
  469. package/src/components/grid/use-grid-layout-sync.js +133 -40
  470. package/src/components/iframe/content.scss +3 -3
  471. package/src/components/iframe/index.js +3 -7
  472. package/src/components/index.js +0 -5
  473. package/src/components/inner-blocks/index.js +4 -1
  474. package/src/components/inserter/block-patterns-tab/patterns-filter.js +40 -44
  475. package/src/components/inserter/category-tabs/index.js +35 -2
  476. package/src/components/inserter/media-tab/media-panel.js +1 -0
  477. package/src/components/inserter/menu.js +3 -3
  478. package/src/components/inserter/preview-panel.js +27 -4
  479. package/src/components/inserter/style.scss +66 -47
  480. package/src/components/inserter-draggable-blocks/index.js +11 -3
  481. package/src/components/inspector-controls/README.md +5 -0
  482. package/src/components/inspector-controls-tabs/settings-tab.js +0 -2
  483. package/src/components/inspector-controls-tabs/style.scss +0 -21
  484. package/src/components/line-height-control/README.md +0 -8
  485. package/src/components/line-height-control/index.js +1 -21
  486. package/src/components/line-height-control/stories/index.story.js +0 -1
  487. package/src/components/line-height-control/test/index.js +1 -7
  488. package/src/components/link-control/search-input.js +0 -1
  489. package/src/components/list-view/block-select-button.js +3 -13
  490. package/src/components/list-view/block.js +10 -3
  491. package/src/components/list-view/style.scss +2 -1
  492. package/src/components/list-view/utils.js +13 -2
  493. package/src/components/media-replace-flow/README.md +7 -0
  494. package/src/components/media-replace-flow/index.js +3 -1
  495. package/src/components/resolution-tool/index.js +1 -0
  496. package/src/components/responsive-block-control/test/index.js +5 -1
  497. package/src/components/rich-text/format-toolbar/index.js +1 -1
  498. package/src/components/rich-text/index.js +1 -1
  499. package/src/components/skip-to-selected-block/index.js +5 -3
  500. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +6 -7
  501. package/src/components/tabbed-sidebar/style.scss +1 -19
  502. package/src/components/url-input/README.md +0 -5
  503. package/src/components/url-input/button.js +0 -1
  504. package/src/components/url-input/index.js +1 -15
  505. package/src/components/url-popover/image-url-input-ui.js +3 -3
  506. package/src/components/url-popover/link-editor.js +0 -1
  507. package/src/components/url-popover/style.scss +1 -0
  508. package/src/components/use-block-drop-zone/index.js +66 -14
  509. package/src/components/use-on-block-drop/index.js +1 -9
  510. package/src/components/use-resize-canvas/index.js +1 -3
  511. package/src/components/use-settings/index.js +2 -1
  512. package/src/hooks/block-bindings.js +303 -52
  513. package/src/hooks/block-bindings.scss +13 -2
  514. package/src/hooks/block-hooks.js +1 -0
  515. package/src/hooks/block-hooks.scss +1 -0
  516. package/src/hooks/block-style-variation.js +3 -3
  517. package/src/hooks/contrast-checker.js +7 -7
  518. package/src/hooks/duotone.js +4 -4
  519. package/src/hooks/grid-visualizer.js +5 -7
  520. package/src/hooks/index.js +2 -1
  521. package/src/hooks/layout-child.js +12 -3
  522. package/src/hooks/line-height.js +0 -1
  523. package/src/hooks/position.js +3 -13
  524. package/src/hooks/spacing-visualizer.js +1 -1
  525. package/src/hooks/use-bindings-attributes.js +93 -59
  526. package/src/hooks/use-editor-wrapper-styles.native.scss +1 -0
  527. package/src/hooks/use-zoom-out.js +1 -1
  528. package/src/hooks/utils.js +14 -1
  529. package/src/index.js +1 -0
  530. package/src/layouts/constrained.js +10 -2
  531. package/src/layouts/grid.js +2 -0
  532. package/src/private-apis.js +1 -8
  533. package/src/store/actions.js +28 -5
  534. package/src/store/reducer.js +18 -0
  535. package/src/store/selectors.js +14 -4
  536. package/src/style.scss +1 -1
  537. package/src/utils/get-editor-region.js +1 -1
  538. package/src/utils/get-px-from-css-unit.js +1 -1
  539. package/tsconfig.tsbuildinfo +1 -1
  540. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -30
  541. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
  542. package/build/components/inserter/reusable-block-rename-hint.js +0 -71
  543. package/build/components/inserter/reusable-block-rename-hint.js.map +0 -1
  544. package/build/components/inspector-controls-tabs/settings-tab-hint.js +0 -53
  545. package/build/components/inspector-controls-tabs/settings-tab-hint.js.map +0 -1
  546. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -23
  547. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
  548. package/build-module/components/inserter/reusable-block-rename-hint.js +0 -64
  549. package/build-module/components/inserter/reusable-block-rename-hint.js.map +0 -1
  550. package/build-module/components/inspector-controls-tabs/settings-tab-hint.js +0 -47
  551. package/build-module/components/inspector-controls-tabs/settings-tab-hint.js.map +0 -1
  552. package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -25
  553. package/src/components/inserter/reusable-block-rename-hint.js +0 -69
  554. package/src/components/inspector-controls-tabs/settings-tab-hint.js +0 -52
@@ -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","process","env","NODE_ENV","Error","css","parentColumnValue","parseFloat","isNaN","parentColumnUnit","replace","includes","highestNumber","Math","max","defaultGapValue","containerQueryValue","minimumContainerQueryValue","gridColumnValue","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\tconst highestNumber = Math.max( columnSpan, columnStart );\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// 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;EACH,MAAMC,MAAM,IAAAP,aAAA,GAAGD,KAAK,EAAEQ,MAAM,cAAAP,aAAA,cAA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_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;EACH,MAAMC,MAAM,IAAAP,aAAA,GAAGD,KAAK,EAAEQ,MAAM,cAAAP,aAAA,cAAAA,aAAA,GAAI,CAAC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,IAAI,EAAE/B,uBAAuB;EAC7BgC,aAAa,EAAE,CAAE,OAAO,CAAE;EAC1BC,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
@@ -50,7 +50,6 @@ function LineHeightEdit(props) {
50
50
  };
51
51
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_lineHeightControl.default, {
52
52
  __unstableInputWidth: "100%",
53
- __nextHasNoMarginBottom: true,
54
53
  value: style?.typography?.lineHeight,
55
54
  onChange: onChange,
56
55
  size: "__unstable-large"
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_lineHeightControl","_interopRequireDefault","_utils","_useSettings","_jsxRuntime","LINE_HEIGHT_SUPPORT_KEY","exports","LineHeightEdit","props","attributes","style","setAttributes","onChange","newLineHeightValue","newStyle","typography","lineHeight","cleanEmptyObject","jsx","default","__unstableInputWidth","__nextHasNoMarginBottom","value","size","useIsLineHeightDisabled","name","blockName","isEnabled","useSettings","hasBlockSupport"],"sources":["@wordpress/block-editor/src/hooks/line-height.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport LineHeightControl from '../components/line-height-control';\nimport { cleanEmptyObject } from './utils';\nimport { useSettings } from '../components/use-settings';\n\nexport const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';\n\n/**\n * Inspector control panel containing the line height related configuration\n *\n * @param {Object} props\n *\n * @return {Element} Line height edit element.\n */\nexport function LineHeightEdit( props ) {\n\tconst {\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t} = props;\n\n\tconst onChange = ( newLineHeightValue ) => {\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\ttypography: {\n\t\t\t\t...style?.typography,\n\t\t\t\tlineHeight: newLineHeightValue,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( { style: cleanEmptyObject( newStyle ) } );\n\t};\n\treturn (\n\t\t<LineHeightControl\n\t\t\t__unstableInputWidth=\"100%\"\n\t\t\t__nextHasNoMarginBottom\n\t\t\tvalue={ style?.typography?.lineHeight }\n\t\t\tonChange={ onChange }\n\t\t\tsize=\"__unstable-large\"\n\t\t/>\n\t);\n}\n\n/**\n * Custom hook that checks if line-height settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsLineHeightDisabled( { name: blockName } = {} ) {\n\tconst [ isEnabled ] = useSettings( 'typography.lineHeight' );\n\n\treturn (\n\t\t! isEnabled || ! hasBlockSupport( blockName, LINE_HEIGHT_SUPPORT_KEY )\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,kBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAAyD,IAAAK,WAAA,GAAAL,OAAA;AAVzD;AACA;AACA;;AAGA;AACA;AACA;;AAKO,MAAMM,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,uBAAuB;;AAE9D;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,cAAcA,CAAEC,KAAK,EAAG;EACvC,MAAM;IACLC,UAAU,EAAE;MAAEC;IAAM,CAAC;IACrBC;EACD,CAAC,GAAGH,KAAK;EAET,MAAMI,QAAQ,GAAKC,kBAAkB,IAAM;IAC1C,MAAMC,QAAQ,GAAG;MAChB,GAAGJ,KAAK;MACRK,UAAU,EAAE;QACX,GAAGL,KAAK,EAAEK,UAAU;QACpBC,UAAU,EAAEH;MACb;IACD,CAAC;IAEDF,aAAa,CAAE;MAAED,KAAK,EAAE,IAAAO,uBAAgB,EAAEH,QAAS;IAAE,CAAE,CAAC;EACzD,CAAC;EACD,oBACC,IAAAV,WAAA,CAAAc,GAAA,EAAClB,kBAAA,CAAAmB,OAAiB;IACjBC,oBAAoB,EAAC,MAAM;IAC3BC,uBAAuB;IACvBC,KAAK,EAAGZ,KAAK,EAAEK,UAAU,EAAEC,UAAY;IACvCJ,QAAQ,EAAGA,QAAU;IACrBW,IAAI,EAAC;EAAkB,CACvB,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,uBAAuBA,CAAE;EAAEC,IAAI,EAAEC;AAAU,CAAC,GAAG,CAAC,CAAC,EAAG;EACnE,MAAM,CAAEC,SAAS,CAAE,GAAG,IAAAC,wBAAW,EAAE,uBAAwB,CAAC;EAE5D,OACC,CAAED,SAAS,IAAI,CAAE,IAAAE,uBAAe,EAAEH,SAAS,EAAErB,uBAAwB,CAAC;AAExE","ignoreList":[]}
1
+ {"version":3,"names":["_blocks","require","_lineHeightControl","_interopRequireDefault","_utils","_useSettings","_jsxRuntime","LINE_HEIGHT_SUPPORT_KEY","exports","LineHeightEdit","props","attributes","style","setAttributes","onChange","newLineHeightValue","newStyle","typography","lineHeight","cleanEmptyObject","jsx","default","__unstableInputWidth","value","size","useIsLineHeightDisabled","name","blockName","isEnabled","useSettings","hasBlockSupport"],"sources":["@wordpress/block-editor/src/hooks/line-height.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport LineHeightControl from '../components/line-height-control';\nimport { cleanEmptyObject } from './utils';\nimport { useSettings } from '../components/use-settings';\n\nexport const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';\n\n/**\n * Inspector control panel containing the line height related configuration\n *\n * @param {Object} props\n *\n * @return {Element} Line height edit element.\n */\nexport function LineHeightEdit( props ) {\n\tconst {\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t} = props;\n\n\tconst onChange = ( newLineHeightValue ) => {\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\ttypography: {\n\t\t\t\t...style?.typography,\n\t\t\t\tlineHeight: newLineHeightValue,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( { style: cleanEmptyObject( newStyle ) } );\n\t};\n\treturn (\n\t\t<LineHeightControl\n\t\t\t__unstableInputWidth=\"100%\"\n\t\t\tvalue={ style?.typography?.lineHeight }\n\t\t\tonChange={ onChange }\n\t\t\tsize=\"__unstable-large\"\n\t\t/>\n\t);\n}\n\n/**\n * Custom hook that checks if line-height settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsLineHeightDisabled( { name: blockName } = {} ) {\n\tconst [ isEnabled ] = useSettings( 'typography.lineHeight' );\n\n\treturn (\n\t\t! isEnabled || ! hasBlockSupport( blockName, LINE_HEIGHT_SUPPORT_KEY )\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,kBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAAyD,IAAAK,WAAA,GAAAL,OAAA;AAVzD;AACA;AACA;;AAGA;AACA;AACA;;AAKO,MAAMM,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,uBAAuB;;AAE9D;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,cAAcA,CAAEC,KAAK,EAAG;EACvC,MAAM;IACLC,UAAU,EAAE;MAAEC;IAAM,CAAC;IACrBC;EACD,CAAC,GAAGH,KAAK;EAET,MAAMI,QAAQ,GAAKC,kBAAkB,IAAM;IAC1C,MAAMC,QAAQ,GAAG;MAChB,GAAGJ,KAAK;MACRK,UAAU,EAAE;QACX,GAAGL,KAAK,EAAEK,UAAU;QACpBC,UAAU,EAAEH;MACb;IACD,CAAC;IAEDF,aAAa,CAAE;MAAED,KAAK,EAAE,IAAAO,uBAAgB,EAAEH,QAAS;IAAE,CAAE,CAAC;EACzD,CAAC;EACD,oBACC,IAAAV,WAAA,CAAAc,GAAA,EAAClB,kBAAA,CAAAmB,OAAiB;IACjBC,oBAAoB,EAAC,MAAM;IAC3BC,KAAK,EAAGX,KAAK,EAAEK,UAAU,EAAEC,UAAY;IACvCJ,QAAQ,EAAGA,QAAU;IACrBU,IAAI,EAAC;EAAkB,CACvB,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,uBAAuBA,CAAE;EAAEC,IAAI,EAAEC;AAAU,CAAC,GAAG,CAAC,CAAC,EAAG;EACnE,MAAM,CAAEC,SAAS,CAAE,GAAG,IAAAC,wBAAW,EAAE,uBAAwB,CAAC;EAE5D,OACC,CAAED,SAAS,IAAI,CAAE,IAAAE,uBAAe,EAAEH,SAAS,EAAEpB,uBAAwB,CAAC;AAExE","ignoreList":[]}
@@ -25,7 +25,6 @@ var _useSettings = require("../components/use-settings");
25
25
  var _inspectorControls = _interopRequireDefault(require("../components/inspector-controls"));
26
26
  var _useBlockDisplayInformation = _interopRequireDefault(require("../components/use-block-display-information"));
27
27
  var _utils = require("./utils");
28
- var _lockUnlock = require("../lock-unlock");
29
28
  var _store = require("../store");
30
29
  var _jsxRuntime = require("react/jsx-runtime");
31
30
  /**
@@ -40,9 +39,6 @@ var _jsxRuntime = require("react/jsx-runtime");
40
39
  * Internal dependencies
41
40
  */
42
41
 
43
- const {
44
- CustomSelectControlV2Legacy: CustomSelectControl
45
- } = (0, _lockUnlock.unlock)(_components.privateApis);
46
42
  const POSITION_SUPPORT_KEY = 'position';
47
43
  const DEFAULT_OPTION = {
48
44
  key: 'default',
@@ -53,13 +49,13 @@ const STICKY_OPTION = {
53
49
  key: 'sticky',
54
50
  value: 'sticky',
55
51
  name: (0, _i18n._x)('Sticky', 'Name for the value of the CSS position property'),
56
- __experimentalHint: (0, _i18n.__)('The block will stick to the top of the window instead of scrolling.')
52
+ hint: (0, _i18n.__)('The block will stick to the top of the window instead of scrolling.')
57
53
  };
58
54
  const FIXED_OPTION = {
59
55
  key: 'fixed',
60
56
  value: 'fixed',
61
57
  name: (0, _i18n._x)('Fixed', 'Name for the value of the CSS position property'),
62
- __experimentalHint: (0, _i18n.__)('The block will not move when the page is scrolled.')
58
+ hint: (0, _i18n.__)('The block will not move when the page is scrolled.')
63
59
  };
64
60
  const POSITION_SIDES = ['top', 'right', 'bottom', 'left'];
65
61
  const VALID_POSITION_TYPES = ['sticky', 'fixed'];
@@ -269,7 +265,7 @@ function PositionPanelPure({
269
265
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.BaseControl, {
270
266
  __nextHasNoMarginBottom: true,
271
267
  help: stickyHelpText,
272
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomSelectControl, {
268
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CustomSelectControl, {
273
269
  __next40pxDefaultSize: true,
274
270
  label: (0, _i18n.__)('Position'),
275
271
  hideLabelFromVision: true,
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_blocks","_components","_compose","_data","_element","_useSettings","_inspectorControls","_useBlockDisplayInformation","_utils","_lockUnlock","_store","_jsxRuntime","CustomSelectControlV2Legacy","CustomSelectControl","unlock","componentsPrivateApis","POSITION_SUPPORT_KEY","DEFAULT_OPTION","key","value","name","__","STICKY_OPTION","_x","__experimentalHint","FIXED_OPTION","POSITION_SIDES","VALID_POSITION_TYPES","getPositionCSS","selector","style","output","type","positionType","position","includes","forEach","side","undefined","hasStickyPositionSupport","blockType","support","getBlockSupport","sticky","hasFixedPositionSupport","fixed","hasPositionSupport","hasPositionValue","props","attributes","hasStickyOrFixedPositionValue","resetPosition","setAttributes","cleanEmptyObject","top","right","bottom","left","useIsPositionDisabled","blockName","allowFixed","allowSticky","useSettings","isDisabled","PositionPanelPure","clientId","firstParentClientId","useSelect","select","getBlockParents","blockEditorStore","parents","length","blockInformation","useBlockDisplayInformation","stickyHelpText","sprintf","title","options","useMemo","availableOptions","push","onChangeType","next","placementValue","newStyle","selectedOption","find","option","Platform","web","jsx","default","group","children","BaseControl","__nextHasNoMarginBottom","help","__next40pxDefaultSize","label","hideLabelFromVision","describedBy","onChange","selectedItem","size","native","_default","exports","edit","Edit","isPositionDisabled","useBlockProps","attributeKeys","hasSupport","hasBlockSupport","hasPositionBlockSupport","allowPositionStyles","id","useInstanceId","positionSelector","css","className","clsx","useStyleOverride"],"sources":["@wordpress/block-editor/src/hooks/position.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport {\n\tBaseControl,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../components/use-settings';\nimport InspectorControls from '../components/inspector-controls';\nimport useBlockDisplayInformation from '../components/use-block-display-information';\nimport { cleanEmptyObject, useStyleOverride } from './utils';\nimport { unlock } from '../lock-unlock';\nimport { store as blockEditorStore } from '../store';\n\nconst { CustomSelectControlV2Legacy: CustomSelectControl } = unlock(\n\tcomponentsPrivateApis\n);\n\nconst POSITION_SUPPORT_KEY = 'position';\n\nconst DEFAULT_OPTION = {\n\tkey: 'default',\n\tvalue: '',\n\tname: __( 'Default' ),\n};\n\nconst STICKY_OPTION = {\n\tkey: 'sticky',\n\tvalue: 'sticky',\n\tname: _x( 'Sticky', 'Name for the value of the CSS position property' ),\n\t__experimentalHint: __(\n\t\t'The block will stick to the top of the window instead of scrolling.'\n\t),\n};\n\nconst FIXED_OPTION = {\n\tkey: 'fixed',\n\tvalue: 'fixed',\n\tname: _x( 'Fixed', 'Name for the value of the CSS position property' ),\n\t__experimentalHint: __(\n\t\t'The block will not move when the page is scrolled.'\n\t),\n};\n\nconst POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nconst VALID_POSITION_TYPES = [ 'sticky', 'fixed' ];\n\n/**\n * Get calculated position CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.selector Selector to use.\n * @param {Object} props.style Style object.\n * @return {string} The generated CSS rules.\n */\nexport function getPositionCSS( { selector, style } ) {\n\tlet output = '';\n\n\tconst { type: positionType } = style?.position || {};\n\n\tif ( ! VALID_POSITION_TYPES.includes( positionType ) ) {\n\t\treturn output;\n\t}\n\n\toutput += `${ selector } {`;\n\toutput += `position: ${ positionType };`;\n\n\tPOSITION_SIDES.forEach( ( side ) => {\n\t\tif ( style?.position?.[ side ] !== undefined ) {\n\t\t\toutput += `${ side }: ${ style.position[ side ] };`;\n\t\t}\n\t} );\n\n\tif ( positionType === 'sticky' || positionType === 'fixed' ) {\n\t\t// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.\n\t\toutput += `z-index: 10`;\n\t}\n\toutput += `}`;\n\n\treturn output;\n}\n\n/**\n * Determines if there is sticky position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasStickyPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.sticky );\n}\n\n/**\n * Determines if there is fixed position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasFixedPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.fixed );\n}\n\n/**\n * Determines if there is position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! support;\n}\n\n/**\n * Checks if there is a current value in the position block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a position value set.\n */\nexport function hasPositionValue( props ) {\n\treturn props.attributes.style?.position?.type !== undefined;\n}\n\n/**\n * Checks if the block is currently set to a sticky or fixed position.\n * This check is helpful for determining how to position block toolbars or other elements.\n *\n * @param {Object} attributes Block attributes.\n * @return {boolean} Whether or not the block is set to a sticky or fixed position.\n */\nexport function hasStickyOrFixedPositionValue( attributes ) {\n\tconst positionType = attributes?.style?.position?.type;\n\treturn positionType === 'sticky' || positionType === 'fixed';\n}\n\n/**\n * Resets the position block support attributes. This can be used when disabling\n * the position support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPosition( { attributes = {}, setAttributes } ) {\n\tconst { style = {} } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if position settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPositionDisabled( { name: blockName } = {} ) {\n\tconst [ allowFixed, allowSticky ] = useSettings(\n\t\t'position.fixed',\n\t\t'position.sticky'\n\t);\n\tconst isDisabled = ! allowFixed && ! allowSticky;\n\n\treturn ! hasPositionSupport( blockName ) || isDisabled;\n}\n\n/*\n * Position controls rendered in an inspector control panel.\n *\n * @param {Object} props\n *\n * @return {Element} Position panel.\n */\nexport function PositionPanelPure( {\n\tstyle = {},\n\tclientId,\n\tname: blockName,\n\tsetAttributes,\n} ) {\n\tconst allowFixed = hasFixedPositionSupport( blockName );\n\tconst allowSticky = hasStickyPositionSupport( blockName );\n\tconst value = style?.position?.type;\n\n\tconst { firstParentClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn { firstParentClientId: parents[ parents.length - 1 ] };\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst blockInformation = useBlockDisplayInformation( firstParentClientId );\n\tconst stickyHelpText =\n\t\tallowSticky && value === STICKY_OPTION.value && blockInformation\n\t\t\t? sprintf(\n\t\t\t\t\t/* translators: %s: the name of the parent block. */\n\t\t\t\t\t__(\n\t\t\t\t\t\t'The block will stick to the scrollable area of the parent %s block.'\n\t\t\t\t\t),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: null;\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Display options if they are allowed, or if a block already has a valid value set.\n\t\t// This allows for a block to be switched off from a position type that is not allowed.\n\t\tif ( allowSticky || value === STICKY_OPTION.value ) {\n\t\t\tavailableOptions.push( STICKY_OPTION );\n\t\t}\n\t\tif ( allowFixed || value === FIXED_OPTION.value ) {\n\t\t\tavailableOptions.push( FIXED_OPTION );\n\t\t}\n\t\treturn availableOptions;\n\t}, [ allowFixed, allowSticky, value ] );\n\n\tconst onChangeType = ( next ) => {\n\t\t// For now, use a hard-coded `0px` value for the position.\n\t\t// `0px` is preferred over `0` as it can be used in `calc()` functions.\n\t\t// In the future, it could be useful to allow for an offset value.\n\t\tconst placementValue = '0px';\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: next,\n\t\t\t\ttop:\n\t\t\t\t\tnext === 'sticky' || next === 'fixed'\n\t\t\t\t\t\t? placementValue\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst selectedOption = value\n\t\t? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION\n\t\t: DEFAULT_OPTION;\n\n\t// Only display position controls if there is at least one option to choose from.\n\treturn Platform.select( {\n\t\tweb:\n\t\t\toptions.length > 1 ? (\n\t\t\t\t<InspectorControls group=\"position\">\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\thelp={ stickyHelpText }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CustomSelectControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tdescribedBy={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Currently selected position.\n\t\t\t\t\t\t\t\t__( 'Currently selected position: %s' ),\n\t\t\t\t\t\t\t\tselectedOption.name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ selectedOption }\n\t\t\t\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\t\t\t\tonChangeType( selectedItem.value );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</InspectorControls>\n\t\t\t) : null,\n\t\tnative: null,\n\t} );\n}\n\nexport default {\n\tedit: function Edit( props ) {\n\t\tconst isPositionDisabled = useIsPositionDisabled( props );\n\t\tif ( isPositionDisabled ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn <PositionPanelPure { ...props } />;\n\t},\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, POSITION_SUPPORT_KEY );\n\t},\n};\n\nfunction useBlockProps( { name, style } ) {\n\tconst hasPositionBlockSupport = hasBlockSupport(\n\t\tname,\n\t\tPOSITION_SUPPORT_KEY\n\t);\n\tconst isPositionDisabled = useIsPositionDisabled( { name } );\n\tconst allowPositionStyles = hasPositionBlockSupport && ! isPositionDisabled;\n\n\tconst id = useInstanceId( useBlockProps );\n\n\t// Higher specificity to override defaults in editor UI.\n\tconst positionSelector = `.wp-container-${ id }.wp-container-${ id }`;\n\n\t// Get CSS string for the current position values.\n\tlet css;\n\tif ( allowPositionStyles ) {\n\t\tcss =\n\t\t\tgetPositionCSS( {\n\t\t\t\tselector: positionSelector,\n\t\t\t\tstyle,\n\t\t\t} ) || '';\n\t}\n\n\t// Attach a `wp-container-` id-based class name.\n\tconst className = clsx( {\n\t\t[ `wp-container-${ id }` ]: allowPositionStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t[ `is-position-${ style?.position?.type }` ]:\n\t\t\tallowPositionStyles && !! css && !! style?.position?.type,\n\t} );\n\n\tuseStyleOverride( { css } );\n\n\treturn { className };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAIA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,2BAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,WAAA,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AAAqD,IAAAa,WAAA,GAAAb,OAAA;AA1BrD;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;;AAQA,MAAM;EAAEc,2BAA2B,EAAEC;AAAoB,CAAC,GAAG,IAAAC,kBAAM,EAClEC,uBACD,CAAC;AAED,MAAMC,oBAAoB,GAAG,UAAU;AAEvC,MAAMC,cAAc,GAAG;EACtBC,GAAG,EAAE,SAAS;EACdC,KAAK,EAAE,EAAE;EACTC,IAAI,EAAE,IAAAC,QAAE,EAAE,SAAU;AACrB,CAAC;AAED,MAAMC,aAAa,GAAG;EACrBJ,G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oreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_blocks","_components","_compose","_data","_element","_useSettings","_inspectorControls","_useBlockDisplayInformation","_utils","_store","_jsxRuntime","POSITION_SUPPORT_KEY","DEFAULT_OPTION","key","value","name","__","STICKY_OPTION","_x","hint","FIXED_OPTION","POSITION_SIDES","VALID_POSITION_TYPES","getPositionCSS","selector","style","output","type","positionType","position","includes","forEach","side","undefined","hasStickyPositionSupport","blockType","support","getBlockSupport","sticky","hasFixedPositionSupport","fixed","hasPositionSupport","hasPositionValue","props","attributes","hasStickyOrFixedPositionValue","resetPosition","setAttributes","cleanEmptyObject","top","right","bottom","left","useIsPositionDisabled","blockName","allowFixed","allowSticky","useSettings","isDisabled","PositionPanelPure","clientId","firstParentClientId","useSelect","select","getBlockParents","blockEditorStore","parents","length","blockInformation","useBlockDisplayInformation","stickyHelpText","sprintf","title","options","useMemo","availableOptions","push","onChangeType","next","placementValue","newStyle","selectedOption","find","option","Platform","web","jsx","default","group","children","BaseControl","__nextHasNoMarginBottom","help","CustomSelectControl","__next40pxDefaultSize","label","hideLabelFromVision","describedBy","onChange","selectedItem","size","native","_default","exports","edit","Edit","isPositionDisabled","useBlockProps","attributeKeys","hasSupport","hasBlockSupport","hasPositionBlockSupport","allowPositionStyles","id","useInstanceId","positionSelector","css","className","clsx","useStyleOverride"],"sources":["@wordpress/block-editor/src/hooks/position.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { BaseControl, CustomSelectControl } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../components/use-settings';\nimport InspectorControls from '../components/inspector-controls';\nimport useBlockDisplayInformation from '../components/use-block-display-information';\nimport { cleanEmptyObject, useStyleOverride } from './utils';\nimport { store as blockEditorStore } from '../store';\n\nconst POSITION_SUPPORT_KEY = 'position';\n\nconst DEFAULT_OPTION = {\n\tkey: 'default',\n\tvalue: '',\n\tname: __( 'Default' ),\n};\n\nconst STICKY_OPTION = {\n\tkey: 'sticky',\n\tvalue: 'sticky',\n\tname: _x( 'Sticky', 'Name for the value of the CSS position property' ),\n\thint: __(\n\t\t'The block will stick to the top of the window instead of scrolling.'\n\t),\n};\n\nconst FIXED_OPTION = {\n\tkey: 'fixed',\n\tvalue: 'fixed',\n\tname: _x( 'Fixed', 'Name for the value of the CSS position property' ),\n\thint: __( 'The block will not move when the page is scrolled.' ),\n};\n\nconst POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nconst VALID_POSITION_TYPES = [ 'sticky', 'fixed' ];\n\n/**\n * Get calculated position CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.selector Selector to use.\n * @param {Object} props.style Style object.\n * @return {string} The generated CSS rules.\n */\nexport function getPositionCSS( { selector, style } ) {\n\tlet output = '';\n\n\tconst { type: positionType } = style?.position || {};\n\n\tif ( ! VALID_POSITION_TYPES.includes( positionType ) ) {\n\t\treturn output;\n\t}\n\n\toutput += `${ selector } {`;\n\toutput += `position: ${ positionType };`;\n\n\tPOSITION_SIDES.forEach( ( side ) => {\n\t\tif ( style?.position?.[ side ] !== undefined ) {\n\t\t\toutput += `${ side }: ${ style.position[ side ] };`;\n\t\t}\n\t} );\n\n\tif ( positionType === 'sticky' || positionType === 'fixed' ) {\n\t\t// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.\n\t\toutput += `z-index: 10`;\n\t}\n\toutput += `}`;\n\n\treturn output;\n}\n\n/**\n * Determines if there is sticky position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasStickyPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.sticky );\n}\n\n/**\n * Determines if there is fixed position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasFixedPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.fixed );\n}\n\n/**\n * Determines if there is position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! support;\n}\n\n/**\n * Checks if there is a current value in the position block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a position value set.\n */\nexport function hasPositionValue( props ) {\n\treturn props.attributes.style?.position?.type !== undefined;\n}\n\n/**\n * Checks if the block is currently set to a sticky or fixed position.\n * This check is helpful for determining how to position block toolbars or other elements.\n *\n * @param {Object} attributes Block attributes.\n * @return {boolean} Whether or not the block is set to a sticky or fixed position.\n */\nexport function hasStickyOrFixedPositionValue( attributes ) {\n\tconst positionType = attributes?.style?.position?.type;\n\treturn positionType === 'sticky' || positionType === 'fixed';\n}\n\n/**\n * Resets the position block support attributes. This can be used when disabling\n * the position support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPosition( { attributes = {}, setAttributes } ) {\n\tconst { style = {} } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if position settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPositionDisabled( { name: blockName } = {} ) {\n\tconst [ allowFixed, allowSticky ] = useSettings(\n\t\t'position.fixed',\n\t\t'position.sticky'\n\t);\n\tconst isDisabled = ! allowFixed && ! allowSticky;\n\n\treturn ! hasPositionSupport( blockName ) || isDisabled;\n}\n\n/*\n * Position controls rendered in an inspector control panel.\n *\n * @param {Object} props\n *\n * @return {Element} Position panel.\n */\nexport function PositionPanelPure( {\n\tstyle = {},\n\tclientId,\n\tname: blockName,\n\tsetAttributes,\n} ) {\n\tconst allowFixed = hasFixedPositionSupport( blockName );\n\tconst allowSticky = hasStickyPositionSupport( blockName );\n\tconst value = style?.position?.type;\n\n\tconst { firstParentClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn { firstParentClientId: parents[ parents.length - 1 ] };\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst blockInformation = useBlockDisplayInformation( firstParentClientId );\n\tconst stickyHelpText =\n\t\tallowSticky && value === STICKY_OPTION.value && blockInformation\n\t\t\t? sprintf(\n\t\t\t\t\t/* translators: %s: the name of the parent block. */\n\t\t\t\t\t__(\n\t\t\t\t\t\t'The block will stick to the scrollable area of the parent %s block.'\n\t\t\t\t\t),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: null;\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Display options if they are allowed, or if a block already has a valid value set.\n\t\t// This allows for a block to be switched off from a position type that is not allowed.\n\t\tif ( allowSticky || value === STICKY_OPTION.value ) {\n\t\t\tavailableOptions.push( STICKY_OPTION );\n\t\t}\n\t\tif ( allowFixed || value === FIXED_OPTION.value ) {\n\t\t\tavailableOptions.push( FIXED_OPTION );\n\t\t}\n\t\treturn availableOptions;\n\t}, [ allowFixed, allowSticky, value ] );\n\n\tconst onChangeType = ( next ) => {\n\t\t// For now, use a hard-coded `0px` value for the position.\n\t\t// `0px` is preferred over `0` as it can be used in `calc()` functions.\n\t\t// In the future, it could be useful to allow for an offset value.\n\t\tconst placementValue = '0px';\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: next,\n\t\t\t\ttop:\n\t\t\t\t\tnext === 'sticky' || next === 'fixed'\n\t\t\t\t\t\t? placementValue\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst selectedOption = value\n\t\t? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION\n\t\t: DEFAULT_OPTION;\n\n\t// Only display position controls if there is at least one option to choose from.\n\treturn Platform.select( {\n\t\tweb:\n\t\t\toptions.length > 1 ? (\n\t\t\t\t<InspectorControls group=\"position\">\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\thelp={ stickyHelpText }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CustomSelectControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tdescribedBy={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Currently selected position.\n\t\t\t\t\t\t\t\t__( 'Currently selected position: %s' ),\n\t\t\t\t\t\t\t\tselectedOption.name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ selectedOption }\n\t\t\t\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\t\t\t\tonChangeType( selectedItem.value );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</InspectorControls>\n\t\t\t) : null,\n\t\tnative: null,\n\t} );\n}\n\nexport default {\n\tedit: function Edit( props ) {\n\t\tconst isPositionDisabled = useIsPositionDisabled( props );\n\t\tif ( isPositionDisabled ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn <PositionPanelPure { ...props } />;\n\t},\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, POSITION_SUPPORT_KEY );\n\t},\n};\n\nfunction useBlockProps( { name, style } ) {\n\tconst hasPositionBlockSupport = hasBlockSupport(\n\t\tname,\n\t\tPOSITION_SUPPORT_KEY\n\t);\n\tconst isPositionDisabled = useIsPositionDisabled( { name } );\n\tconst allowPositionStyles = hasPositionBlockSupport && ! isPositionDisabled;\n\n\tconst id = useInstanceId( useBlockProps );\n\n\t// Higher specificity to override defaults in editor UI.\n\tconst positionSelector = `.wp-container-${ id }.wp-container-${ id }`;\n\n\t// Get CSS string for the current position values.\n\tlet css;\n\tif ( allowPositionStyles ) {\n\t\tcss =\n\t\t\tgetPositionCSS( {\n\t\t\t\tselector: positionSelector,\n\t\t\t\tstyle,\n\t\t\t} ) || '';\n\t}\n\n\t// Attach a `wp-container-` id-based class name.\n\tconst className = clsx( {\n\t\t[ `wp-container-${ id }` ]: allowPositionStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t[ `is-position-${ style?.position?.type }` ]:\n\t\t\tallowPositionStyles && !! css && !! style?.position?.type,\n\t} );\n\n\tuseStyleOverride( { css } );\n\n\treturn { className };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,YAAA,GA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QAAQ,EAAE2F,gBAAgB;MAC1B1F;IACD,CAAE,CAAC,IAAI,EAAE;EACX;;EAEA;EACA,MAAM4F,SAAS,GAAG,IAAAC,aAAI,EAAE;IACvB,CAAG,gBAAgBL,EAAI,EAAC,GAAID,mBAAmB,IAAI,CAAC,CAAEI,GAAG;IAAE;IAC3D,CAAG,eAAe3F,KAAK,EAAEI,QAAQ,EAAEF,IAAM,EAAC,GACzCqF,mBAAmB,IAAI,CAAC,CAAEI,GAAG,IAAI,CAAC,CAAE3F,KAAK,EAAEI,QAAQ,EAAEF;EACvD,CAAE,CAAC;EAEH,IAAA4F,uBAAgB,EAAE;IAAEH;EAAI,CAAE,CAAC;EAE3B,OAAO;IAAEC;EAAU,CAAC;AACrB","ignoreList":[]}
@@ -25,7 +25,7 @@ function SpacingVisualizer({
25
25
  computeStyle,
26
26
  forceShow
27
27
  }) {
28
- const blockElement = (0, _useBlockRefs.__unstableUseBlockElement)(clientId);
28
+ const blockElement = (0, _useBlockRefs.useBlockElement)(clientId);
29
29
  const [style, updateStyle] = (0, _element.useReducer)(() => computeStyle(blockElement));
30
30
  (0, _element.useLayoutEffect)(() => {
31
31
  if (!blockElement) {
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_isShallowEqual","_interopRequireDefault","_cover","_useBlockRefs","_jsxRuntime","SpacingVisualizer","clientId","value","computeStyle","forceShow","blockElement","useBlockElement","style","updateStyle","useReducer","useLayoutEffect","window","requestAnimationFrame","previousValue","useRef","isActive","setIsActive","useState","useEffect","isShallowEqual","current","timeout","setTimeout","clearTimeout","jsx","default","__unstablePopoverSlot","children","className","getComputedCSS","element","property","ownerDocument","defaultView","getComputedStyle","getPropertyValue","MarginVisualizer","spacing","margin","top","right","bottom","left","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","PaddingVisualizer","padding"],"sources":["@wordpress/block-editor/src/hooks/spacing-visualizer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseRef,\n\tuseLayoutEffect,\n\tuseEffect,\n\tuseReducer,\n} from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockPopoverCover from '../components/block-popover/cover';\nimport { __unstableUseBlockElement as useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction SpacingVisualizer( { clientId, value, computeStyle, forceShow } ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst [ style, updateStyle ] = useReducer( () =>\n\t\tcomputeStyle( blockElement )\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! blockElement ) {\n\t\t\treturn;\n\t\t}\n\t\t// It's not sufficient to read the computed spacing value when value.spacing changes as\n\t\t// useEffect may run before the browser recomputes CSS. We therefore combine\n\t\t// useLayoutEffect and two rAF calls to ensure that we read the spacing after the current\n\t\t// paint but before the next paint.\n\t\t// See https://github.com/WordPress/gutenberg/pull/59227.\n\t\twindow.requestAnimationFrame( () =>\n\t\t\twindow.requestAnimationFrame( updateStyle )\n\t\t);\n\t}, [ blockElement, value ] );\n\n\tconst previousValue = useRef( value );\n\tconst [ isActive, setIsActive ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( isShallowEqual( value, previousValue.current ) || forceShow ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsActive( true );\n\t\tpreviousValue.current = value;\n\n\t\tconst timeout = setTimeout( () => {\n\t\t\tsetIsActive( false );\n\t\t}, 400 );\n\n\t\treturn () => {\n\t\t\tsetIsActive( false );\n\t\t\tclearTimeout( timeout );\n\t\t};\n\t}, [ value, forceShow ] );\n\n\tif ( ! isActive && ! forceShow ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopoverCover\n\t\t\tclientId={ clientId }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t>\n\t\t\t<div className=\"block-editor__spacing-visualizer\" style={ style } />\n\t\t</BlockPopoverCover>\n\t);\n}\n\nfunction getComputedCSS( element, property ) {\n\treturn element.ownerDocument.defaultView\n\t\t.getComputedStyle( element )\n\t\t.getPropertyValue( property );\n}\n\nexport function MarginVisualizer( { clientId, value, forceShow } ) {\n\treturn (\n\t\t<SpacingVisualizer\n\t\t\tclientId={ clientId }\n\t\t\tvalue={ value?.spacing?.margin }\n\t\t\tcomputeStyle={ ( blockElement ) => {\n\t\t\t\tconst top = getComputedCSS( blockElement, 'margin-top' );\n\t\t\t\tconst right = getComputedCSS( blockElement, 'margin-right' );\n\t\t\t\tconst bottom = getComputedCSS( blockElement, 'margin-bottom' );\n\t\t\t\tconst left = getComputedCSS( blockElement, 'margin-left' );\n\t\t\t\treturn {\n\t\t\t\t\tborderTopWidth: top,\n\t\t\t\t\tborderRightWidth: right,\n\t\t\t\t\tborderBottomWidth: bottom,\n\t\t\t\t\tborderLeftWidth: left,\n\t\t\t\t\ttop: top ? `-${ top }` : 0,\n\t\t\t\t\tright: right ? `-${ right }` : 0,\n\t\t\t\t\tbottom: bottom ? `-${ bottom }` : 0,\n\t\t\t\t\tleft: left ? `-${ left }` : 0,\n\t\t\t\t};\n\t\t\t} }\n\t\t\tforceShow={ forceShow }\n\t\t/>\n\t);\n}\n\nexport function PaddingVisualizer( { clientId, value, forceShow } ) {\n\treturn (\n\t\t<SpacingVisualizer\n\t\t\tclientId={ clientId }\n\t\t\tvalue={ value?.spacing?.padding }\n\t\t\tcomputeStyle={ ( blockElement ) => ( {\n\t\t\t\tborderTopWidth: getComputedCSS( blockElement, 'padding-top' ),\n\t\t\t\tborderRightWidth: getComputedCSS(\n\t\t\t\t\tblockElement,\n\t\t\t\t\t'padding-right'\n\t\t\t\t),\n\t\t\t\tborderBottomWidth: getComputedCSS(\n\t\t\t\t\tblockElement,\n\t\t\t\t\t'padding-bottom'\n\t\t\t\t),\n\t\t\t\tborderLeftWidth: getComputedCSS( blockElement, 'padding-left' ),\n\t\t\t} ) }\n\t\t\tforceShow={ forceShow }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAA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EJ,MAAM;QACzBK,eAAe,EAAEJ,IAAI;QACrBH,GAAG,EAAEA,GAAG,GAAI,IAAIA,GAAK,EAAC,GAAG,CAAC;QAC1BC,KAAK,EAAEA,KAAK,GAAI,IAAIA,KAAO,EAAC,GAAG,CAAC;QAChCC,MAAM,EAAEA,MAAM,GAAI,IAAIA,MAAQ,EAAC,GAAG,CAAC;QACnCC,IAAI,EAAEA,IAAI,GAAI,IAAIA,IAAM,EAAC,GAAG;MAC7B,CAAC;IACF,CAAG;IACHtC,SAAS,EAAGA;EAAW,CACvB,CAAC;AAEJ;AAEO,SAAS2C,iBAAiBA,CAAE;EAAE9C,QAAQ;EAAEC,KAAK;EAAEE;AAAU,CAAC,EAAG;EACnE,oBACC,IAAAL,WAAA,CAAAyB,GAAA,EAACxB,iBAAiB;IACjBC,QAAQ,EAAGA,QAAU;IACrBC,KAAK,EAAGA,KAAK,EAAEmC,OAAO,EAAEW,OAAS;IACjC7C,YAAY,EAAKE,YAAY,KAAQ;MACpCsC,cAAc,EAAEd,cAAc,CAAExB,YAAY,EAAE,aAAc,CAAC;MAC7DuC,gBAAgB,EAAEf,cAAc,CAC/BxB,YAAY,EACZ,eACD,CAAC;MACDwC,iBAAiB,EAAEhB,cAAc,CAChCxB,YAAY,EACZ,gBACD,CAAC;MACDyC,eAAe,EAAEjB,cAAc,CAAExB,YAAY,EAAE,cAAe;IAC/D,CAAC,CAAI;IACLD,SAAS,EAAGA;EAAW,CACvB,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_isShallowEqual","_interopRequireDefault","_cover","_useBlockRefs","_jsxRuntime","SpacingVisualizer","clientId","value","computeStyle","forceShow","blockElement","useBlockElement","style","updateStyle","useReducer","useLayoutEffect","window","requestAnimationFrame","previousValue","useRef","isActive","setIsActive","useState","useEffect","isShallowEqual","current","timeout","setTimeout","clearTimeout","jsx","default","__unstablePopoverSlot","children","className","getComputedCSS","element","property","ownerDocument","defaultView","getComputedStyle","getPropertyValue","MarginVisualizer","spacing","margin","top","right","bottom","left","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","PaddingVisualizer","padding"],"sources":["@wordpress/block-editor/src/hooks/spacing-visualizer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseRef,\n\tuseLayoutEffect,\n\tuseEffect,\n\tuseReducer,\n} from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockPopoverCover from '../components/block-popover/cover';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction SpacingVisualizer( { clientId, value, computeStyle, forceShow } ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst [ style, updateStyle ] = useReducer( () =>\n\t\tcomputeStyle( blockElement )\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! blockElement ) {\n\t\t\treturn;\n\t\t}\n\t\t// It's not sufficient to read the computed spacing value when value.spacing changes as\n\t\t// useEffect may run before the browser recomputes CSS. We therefore combine\n\t\t// useLayoutEffect and two rAF calls to ensure that we read the spacing after the current\n\t\t// paint but before the next paint.\n\t\t// See https://github.com/WordPress/gutenberg/pull/59227.\n\t\twindow.requestAnimationFrame( () =>\n\t\t\twindow.requestAnimationFrame( updateStyle )\n\t\t);\n\t}, [ blockElement, value ] );\n\n\tconst previousValue = useRef( value );\n\tconst [ isActive, setIsActive ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( isShallowEqual( value, previousValue.current ) || forceShow ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsActive( true );\n\t\tpreviousValue.current = value;\n\n\t\tconst timeout = setTimeout( () => {\n\t\t\tsetIsActive( false );\n\t\t}, 400 );\n\n\t\treturn () => {\n\t\t\tsetIsActive( false );\n\t\t\tclearTimeout( timeout );\n\t\t};\n\t}, [ value, forceShow ] );\n\n\tif ( ! isActive && ! forceShow ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopoverCover\n\t\t\tclientId={ clientId }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t>\n\t\t\t<div className=\"block-editor__spacing-visualizer\" style={ style } />\n\t\t</BlockPopoverCover>\n\t);\n}\n\nfunction getComputedCSS( element, property ) {\n\treturn element.ownerDocument.defaultView\n\t\t.getComputedStyle( element )\n\t\t.getPropertyValue( property );\n}\n\nexport function MarginVisualizer( { clientId, value, forceShow } ) {\n\treturn (\n\t\t<SpacingVisualizer\n\t\t\tclientId={ clientId }\n\t\t\tvalue={ value?.spacing?.margin }\n\t\t\tcomputeStyle={ ( blockElement ) => {\n\t\t\t\tconst top = getComputedCSS( blockElement, 'margin-top' );\n\t\t\t\tconst right = getComputedCSS( blockElement, 'margin-right' );\n\t\t\t\tconst bottom = getComputedCSS( blockElement, 'margin-bottom' );\n\t\t\t\tconst left = getComputedCSS( blockElement, 'margin-left' );\n\t\t\t\treturn {\n\t\t\t\t\tborderTopWidth: top,\n\t\t\t\t\tborderRightWidth: right,\n\t\t\t\t\tborderBottomWidth: bottom,\n\t\t\t\t\tborderLeftWidth: left,\n\t\t\t\t\ttop: top ? `-${ top }` : 0,\n\t\t\t\t\tright: right ? `-${ right }` : 0,\n\t\t\t\t\tbottom: bottom ? `-${ bottom }` : 0,\n\t\t\t\t\tleft: left ? `-${ left }` : 0,\n\t\t\t\t};\n\t\t\t} }\n\t\t\tforceShow={ forceShow }\n\t\t/>\n\t);\n}\n\nexport function PaddingVisualizer( { clientId, value, forceShow } ) {\n\treturn (\n\t\t<SpacingVisualizer\n\t\t\tclientId={ clientId }\n\t\t\tvalue={ value?.spacing?.padding }\n\t\t\tcomputeStyle={ ( blockElement ) => ( {\n\t\t\t\tborderTopWidth: getComputedCSS( blockElement, 'padding-top' ),\n\t\t\t\tborderRightWidth: getComputedCSS(\n\t\t\t\t\tblockElement,\n\t\t\t\t\t'padding-right'\n\t\t\t\t),\n\t\t\t\tborderBottomWidth: getComputedCSS(\n\t\t\t\t\tblockElement,\n\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,eAAgB,CAAC;MAC9D,MAAMqC,IAAI,GAAGb,cAAc,CAAExB,YAAY,EAAE,aAAc,CAAC;MAC1D,OAAO;QACNsC,cAAc,EAAEJ,GAAG;QACnBK,gBAAgB,EAAEJ,KAAK;QACvBK,iBAAiB,EAAEJ,MAAM;QACzBK,eAAe,EAAEJ,IAAI;QACrBH,GAAG,EAAEA,GAAG,GAAI,IAAIA,GAAK,EAAC,GAAG,CAAC;QAC1BC,KAAK,EAAEA,KAAK,GAAI,IAAIA,KAAO,EAAC,GAAG,CAAC;QAChCC,MAAM,EAAEA,MAAM,GAAI,IAAIA,MAAQ,EAAC,GAAG,CAAC;QACnCC,IAAI,EAAEA,IAAI,GAAI,IAAIA,IAAM,EAAC,GAAG;MAC7B,CAAC;IACF,CAAG;IACHtC,SAAS,EAAGA;EAAW,CACvB,CAAC;AAEJ;AAEO,SAAS2C,iBAAiBA,CAAE;EAAE9C,QAAQ;EAAEC,KAAK;EAAEE;AAAU,CAAC,EAAG;EACnE,oBACC,IAAAL,WAAA,CAAAyB,GAAA,EAACxB,iBAAiB;IACjBC,QAAQ,EAAGA,QAAU;IACrBC,KAAK,EAAGA,KAAK,EAAEmC,OAAO,EAAEW,OAAS;IACjC7C,YAAY,EAAKE,YAAY,KAAQ;MACpCsC,cAAc,EAAEd,cAAc,CAAExB,YAAY,EAAE,aAAc,CAAC;MAC7DuC,gBAAgB,EAAEf,cAAc,CAC/BxB,YAAY,EACZ,eACD,CAAC;MACDwC,iBAAiB,EAAEhB,cAAc,CAChCxB,YAAY,EACZ,gBACD,CAAC;MACDyC,eAAe,EAAEjB,cAAc,CAAExB,YAAY,EAAE,cAAe;IAC/D,CAAC,CAAI;IACLD,SAAS,EAAGA;EAAW,CACvB,CAAC;AAEJ","ignoreList":[]}
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.canBindAttribute = canBindAttribute;
7
8
  exports.canBindBlock = canBindBlock;
9
+ exports.getBindableAttributes = getBindableAttributes;
8
10
  exports.withBlockBindingSupport = void 0;
9
11
  var _blocks = require("@wordpress/blocks");
10
12
  var _compose = require("@wordpress/compose");
@@ -12,6 +14,7 @@ var _data = require("@wordpress/data");
12
14
  var _element = require("@wordpress/element");
13
15
  var _hooks = require("@wordpress/hooks");
14
16
  var _lockUnlock = require("../lock-unlock");
17
+ var _blockContext = _interopRequireDefault(require("../components/block-context"));
15
18
  var _jsxRuntime = require("react/jsx-runtime");
16
19
  /**
17
20
  * WordPress dependencies
@@ -88,102 +91,134 @@ function canBindBlock(blockName) {
88
91
  function canBindAttribute(blockName, attributeName) {
89
92
  return canBindBlock(blockName) && BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName].includes(attributeName);
90
93
  }
94
+ function getBindableAttributes(blockName) {
95
+ return BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName];
96
+ }
91
97
  const withBlockBindingSupport = exports.withBlockBindingSupport = (0, _compose.createHigherOrderComponent)(BlockEdit => props => {
92
98
  const registry = (0, _data.useRegistry)();
99
+ const blockContext = (0, _element.useContext)(_blockContext.default);
93
100
  const sources = (0, _data.useSelect)(select => (0, _lockUnlock.unlock)(select(_blocks.store)).getAllBlockBindingsSources());
94
101
  const {
95
102
  name,
96
- clientId,
97
- context
103
+ clientId
98
104
  } = props;
99
105
  const hasParentPattern = !!props.context['pattern/overrides'];
100
106
  const hasPatternOverridesDefaultBinding = props.attributes.metadata?.bindings?.[DEFAULT_ATTRIBUTE]?.source === 'core/pattern-overrides';
101
- const bindings = (0, _element.useMemo)(() => replacePatternOverrideDefaultBindings(name, props.attributes.metadata?.bindings), [props.attributes.metadata?.bindings, name]);
107
+ const blockBindings = (0, _element.useMemo)(() => replacePatternOverrideDefaultBindings(name, props.attributes.metadata?.bindings), [props.attributes.metadata?.bindings, name]);
102
108
 
103
109
  // While this hook doesn't directly call any selectors, `useSelect` is
104
110
  // used purposely here to ensure `boundAttributes` is updated whenever
105
111
  // there are attribute updates.
106
112
  // `source.getValues` may also call a selector via `registry.select`.
107
113
  const boundAttributes = (0, _data.useSelect)(() => {
108
- if (!bindings) {
114
+ if (!blockBindings) {
109
115
  return;
110
116
  }
111
117
  const attributes = {};
112
- for (const [attributeName, boundAttribute] of Object.entries(bindings)) {
113
- const source = sources[boundAttribute.source];
114
- if (!source?.getValue || !canBindAttribute(name, attributeName)) {
118
+ const blockBindingsBySource = new Map();
119
+ for (const [attributeName, binding] of Object.entries(blockBindings)) {
120
+ const {
121
+ source: sourceName,
122
+ args: sourceArgs
123
+ } = binding;
124
+ const source = sources[sourceName];
125
+ if (!source?.getValues || !canBindAttribute(name, attributeName)) {
115
126
  continue;
116
127
  }
117
- const args = {
118
- registry,
119
- context,
120
- clientId,
121
- attributeName,
122
- args: boundAttribute.args
123
- };
124
- attributes[attributeName] = source.getValue(args);
125
- if (attributes[attributeName] === undefined) {
126
- if (attributeName === 'url') {
127
- attributes[attributeName] = null;
128
- } else {
129
- attributes[attributeName] = source.getPlaceholder?.(args);
128
+ blockBindingsBySource.set(source, {
129
+ ...blockBindingsBySource.get(source),
130
+ [attributeName]: {
131
+ args: sourceArgs
132
+ }
133
+ });
134
+ }
135
+ if (blockBindingsBySource.size) {
136
+ for (const [source, bindings] of blockBindingsBySource) {
137
+ // Populate context.
138
+ const context = {};
139
+ if (source.usesContext?.length) {
140
+ for (const key of source.usesContext) {
141
+ context[key] = blockContext[key];
142
+ }
143
+ }
144
+
145
+ // Get values in batch if the source supports it.
146
+ const values = source.getValues({
147
+ registry,
148
+ context,
149
+ clientId,
150
+ bindings
151
+ });
152
+ for (const [attributeName, value] of Object.entries(values)) {
153
+ // Use placeholder when value is undefined.
154
+ if (value === undefined) {
155
+ if (attributeName === 'url') {
156
+ attributes[attributeName] = null;
157
+ } else {
158
+ attributes[attributeName] = source.getPlaceholder?.({
159
+ registry,
160
+ context,
161
+ clientId,
162
+ attributeName,
163
+ args: bindings[attributeName].args
164
+ });
165
+ }
166
+ } else {
167
+ attributes[attributeName] = value;
168
+ }
130
169
  }
131
170
  }
132
171
  }
133
172
  return attributes;
134
- }, [bindings, name, clientId, context, registry, sources]);
173
+ }, [blockBindings, name, clientId, blockContext, registry, sources]);
135
174
  const {
136
175
  setAttributes
137
176
  } = props;
138
177
  const _setAttributes = (0, _element.useCallback)(nextAttributes => {
139
178
  registry.batch(() => {
140
- if (!bindings) {
179
+ if (!blockBindings) {
141
180
  setAttributes(nextAttributes);
142
181
  return;
143
182
  }
144
183
  const keptAttributes = {
145
184
  ...nextAttributes
146
185
  };
147
- const updatesBySource = new Map();
186
+ const blockBindingsBySource = new Map();
148
187
 
149
188
  // Loop only over the updated attributes to avoid modifying the bound ones that haven't changed.
150
189
  for (const [attributeName, newValue] of Object.entries(keptAttributes)) {
151
- if (!bindings[attributeName] || !canBindAttribute(name, attributeName)) {
190
+ if (!blockBindings[attributeName] || !canBindAttribute(name, attributeName)) {
152
191
  continue;
153
192
  }
154
- const binding = bindings[attributeName];
193
+ const binding = blockBindings[attributeName];
155
194
  const source = sources[binding?.source];
156
- if (!source?.setValue && !source?.setValues) {
195
+ if (!source?.setValues) {
157
196
  continue;
158
197
  }
159
- updatesBySource.set(source, {
160
- ...updatesBySource.get(source),
161
- [attributeName]: newValue
198
+ blockBindingsBySource.set(source, {
199
+ ...blockBindingsBySource.get(source),
200
+ [attributeName]: {
201
+ args: binding.args,
202
+ newValue
203
+ }
162
204
  });
163
205
  delete keptAttributes[attributeName];
164
206
  }
165
- if (updatesBySource.size) {
166
- for (const [source, attributes] of updatesBySource) {
167
- if (source.setValues) {
168
- source.setValues({
169
- registry,
170
- context,
171
- clientId,
172
- attributes
173
- });
174
- } else {
175
- for (const [attributeName, value] of Object.entries(attributes)) {
176
- const binding = bindings[attributeName];
177
- source.setValue({
178
- registry,
179
- context,
180
- clientId,
181
- attributeName,
182
- args: binding.args,
183
- value
184
- });
207
+ if (blockBindingsBySource.size) {
208
+ for (const [source, bindings] of blockBindingsBySource) {
209
+ // Populate context.
210
+ const context = {};
211
+ if (source.usesContext?.length) {
212
+ for (const key of source.usesContext) {
213
+ context[key] = blockContext[key];
185
214
  }
186
215
  }
216
+ source.setValues({
217
+ registry,
218
+ context,
219
+ clientId,
220
+ bindings
221
+ });
187
222
  }
188
223
  }
189
224
  if (
@@ -198,7 +233,7 @@ const withBlockBindingSupport = exports.withBlockBindingSupport = (0, _compose.c
198
233
  setAttributes(keptAttributes);
199
234
  }
200
235
  });
201
- }, [registry, bindings, name, clientId, context, setAttributes, sources, hasPatternOverridesDefaultBinding, hasParentPattern]);
236
+ }, [registry, blockBindings, name, clientId, blockContext, setAttributes, sources, hasPatternOverridesDefaultBinding, hasParentPattern]);
202
237
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
203
238
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(BlockEdit, {
204
239
  ...props,
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_compose","_data","_element","_hooks","_lockUnlock","_jsxRuntime","BLOCK_BINDINGS_ALLOWED_BLOCKS","DEFAULT_ATTRIBUTE","replacePatternOverrideDefaultBindings","blockName","bindings","source","supportedAttributes","bindingsWithDefaults","attributeName","bindingSource","canBindBlock","canBindAttribute","includes","withBlockBindingSupport","exports","createHigherOrderComponent","BlockEdit","props","registry","useRegistry","sources","useSelect","select","unlock","blocksStore","getAllBlockBindingsSources","name","clientId","context","hasParentPattern","hasPatternOverridesDefaultBinding","attributes","metadata","useMemo","boundAttributes","boundAttribute","Object","entries","getValue","args","undefined","getPlaceholder","setAttributes","_setAttributes","useCallback","nextAttributes","batch","keptAttributes","updatesBySource","Map","newValue","binding","setValue","setValues","set","get","size","value","keys","length","caption","href","jsx","Fragment","children","shimAttributeSource","settings","edit","addFilter"],"sources":["@wordpress/block-editor/src/hooks/use-bindings-attributes.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Given a binding of block attributes, returns a higher order component that\n * overrides its `attributes` and `setAttributes` props to sync any changes needed.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\n\nconst BLOCK_BINDINGS_ALLOWED_BLOCKS = {\n\t'core/paragraph': [ 'content' ],\n\t'core/heading': [ 'content' ],\n\t'core/image': [ 'id', 'url', 'title', 'alt' ],\n\t'core/button': [ 'url', 'text', 'linkTarget', 'rel' ],\n};\n\nconst DEFAULT_ATTRIBUTE = '__default';\n\n/**\n * Returns the bindings with the `__default` binding for pattern overrides\n * replaced with the full-set of supported attributes. e.g.:\n *\n * bindings passed in: `{ __default: { source: 'core/pattern-overrides' } }`\n * bindings returned: `{ content: { source: 'core/pattern-overrides' } }`\n *\n * @param {string} blockName The block name (e.g. 'core/paragraph').\n * @param {Object} bindings A block's bindings from the metadata attribute.\n *\n * @return {Object} The bindings with default replaced for pattern overrides.\n */\nfunction replacePatternOverrideDefaultBindings( blockName, bindings ) {\n\t// The `__default` binding currently only works for pattern overrides.\n\tif (\n\t\tbindings?.[ DEFAULT_ATTRIBUTE ]?.source === 'core/pattern-overrides'\n\t) {\n\t\tconst supportedAttributes = BLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ];\n\t\tconst bindingsWithDefaults = {};\n\t\tfor ( const attributeName of supportedAttributes ) {\n\t\t\t// If the block has mixed binding sources, retain any non pattern override bindings.\n\t\t\tconst bindingSource = bindings[ attributeName ]\n\t\t\t\t? bindings[ attributeName ]\n\t\t\t\t: { source: 'core/pattern-overrides' };\n\t\t\tbindingsWithDefaults[ attributeName ] = bindingSource;\n\t\t}\n\n\t\treturn bindingsWithDefaults;\n\t}\n\n\treturn bindings;\n}\n\n/**\n * Based on the given block name,\n * check if it is possible to bind the block.\n *\n * @param {string} blockName - The block name.\n * @return {boolean} Whether it is possible to bind the block to sources.\n */\nexport function canBindBlock( blockName ) {\n\treturn blockName in BLOCK_BINDINGS_ALLOWED_BLOCKS;\n}\n\n/**\n * Based on the given block name and attribute name,\n * check if it is possible to bind the block attribute.\n *\n * @param {string} blockName - The block name.\n * @param {string} attributeName - The attribute name.\n * @return {boolean} Whether it is possible to bind the block attribute.\n */\nexport function canBindAttribute( blockName, attributeName ) {\n\treturn (\n\t\tcanBindBlock( blockName ) &&\n\t\tBLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ].includes( attributeName )\n\t);\n}\n\nexport const withBlockBindingSupport = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst registry = useRegistry();\n\t\tconst sources = useSelect( ( select ) =>\n\t\t\tunlock( select( blocksStore ) ).getAllBlockBindingsSources()\n\t\t);\n\t\tconst { name, clientId, context } = props;\n\t\tconst hasParentPattern = !! props.context[ 'pattern/overrides' ];\n\t\tconst hasPatternOverridesDefaultBinding =\n\t\t\tprops.attributes.metadata?.bindings?.[ DEFAULT_ATTRIBUTE ]\n\t\t\t\t?.source === 'core/pattern-overrides';\n\t\tconst bindings = useMemo(\n\t\t\t() =>\n\t\t\t\treplacePatternOverrideDefaultBindings(\n\t\t\t\t\tname,\n\t\t\t\t\tprops.attributes.metadata?.bindings\n\t\t\t\t),\n\t\t\t[ props.attributes.metadata?.bindings, name ]\n\t\t);\n\n\t\t// While this hook doesn't directly call any selectors, `useSelect` is\n\t\t// used purposely here to ensure `boundAttributes` is updated whenever\n\t\t// there are attribute updates.\n\t\t// `source.getValues` may also call a selector via `registry.select`.\n\t\tconst boundAttributes = useSelect( () => {\n\t\t\tif ( ! bindings ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst attributes = {};\n\n\t\t\tfor ( const [ attributeName, boundAttribute ] of Object.entries(\n\t\t\t\tbindings\n\t\t\t) ) {\n\t\t\t\tconst source = sources[ boundAttribute.source ];\n\t\t\t\tif (\n\t\t\t\t\t! source?.getValue ||\n\t\t\t\t\t! canBindAttribute( name, attributeName )\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst args = {\n\t\t\t\t\tregistry,\n\t\t\t\t\tcontext,\n\t\t\t\t\tclientId,\n\t\t\t\t\tattributeName,\n\t\t\t\t\targs: boundAttribute.args,\n\t\t\t\t};\n\n\t\t\t\tattributes[ attributeName ] = source.getValue( args );\n\n\t\t\t\tif ( attributes[ attributeName ] === undefined ) {\n\t\t\t\t\tif ( attributeName === 'url' ) {\n\t\t\t\t\t\tattributes[ attributeName ] = null;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tattributes[ attributeName ] =\n\t\t\t\t\t\t\tsource.getPlaceholder?.( args );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn attributes;\n\t\t}, [ bindings, name, clientId, context, registry, sources ] );\n\n\t\tconst { setAttributes } = props;\n\n\t\tconst _setAttributes = useCallback(\n\t\t\t( nextAttributes ) => {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tif ( ! bindings ) {\n\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst keptAttributes = { ...nextAttributes };\n\t\t\t\t\tconst updatesBySource = new Map();\n\n\t\t\t\t\t// Loop only over the updated attributes to avoid modifying the bound ones that haven't changed.\n\t\t\t\t\tfor ( const [ attributeName, newValue ] of Object.entries(\n\t\t\t\t\t\tkeptAttributes\n\t\t\t\t\t) ) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! bindings[ attributeName ] ||\n\t\t\t\t\t\t\t! canBindAttribute( name, attributeName )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst binding = bindings[ attributeName ];\n\t\t\t\t\t\tconst source = sources[ binding?.source ];\n\t\t\t\t\t\tif ( ! source?.setValue && ! source?.setValues ) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tupdatesBySource.set( source, {\n\t\t\t\t\t\t\t...updatesBySource.get( source ),\n\t\t\t\t\t\t\t[ attributeName ]: newValue,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tdelete keptAttributes[ attributeName ];\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( updatesBySource.size ) {\n\t\t\t\t\t\tfor ( const [\n\t\t\t\t\t\t\tsource,\n\t\t\t\t\t\t\tattributes,\n\t\t\t\t\t\t] of updatesBySource ) {\n\t\t\t\t\t\t\tif ( source.setValues ) {\n\t\t\t\t\t\t\t\tsource.setValues( {\n\t\t\t\t\t\t\t\t\tregistry,\n\t\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t\tattributes,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfor ( const [\n\t\t\t\t\t\t\t\t\tattributeName,\n\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t] of Object.entries( attributes ) ) {\n\t\t\t\t\t\t\t\t\tconst binding = bindings[ attributeName ];\n\t\t\t\t\t\t\t\t\tsource.setValue( {\n\t\t\t\t\t\t\t\t\t\tregistry,\n\t\t\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t\t\tattributeName,\n\t\t\t\t\t\t\t\t\t\targs: binding.args,\n\t\t\t\t\t\t\t\t\t\tvalue,\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\n\t\t\t\t\tif (\n\t\t\t\t\t\t// Don't update non-connected attributes if the block is using pattern overrides\n\t\t\t\t\t\t// and the editing is happening while overriding the pattern (not editing the original).\n\t\t\t\t\t\t! (\n\t\t\t\t\t\t\thasPatternOverridesDefaultBinding &&\n\t\t\t\t\t\t\thasParentPattern\n\t\t\t\t\t\t) &&\n\t\t\t\t\t\tObject.keys( keptAttributes ).length\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Don't update caption and href until they are supported.\n\t\t\t\t\t\tif ( hasPatternOverridesDefaultBinding ) {\n\t\t\t\t\t\t\tdelete keptAttributes?.caption;\n\t\t\t\t\t\t\tdelete keptAttributes?.href;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetAttributes( keptAttributes );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\t[\n\t\t\t\tregistry,\n\t\t\t\tbindings,\n\t\t\t\tname,\n\t\t\t\tclientId,\n\t\t\t\tcontext,\n\t\t\t\tsetAttributes,\n\t\t\t\tsources,\n\t\t\t\thasPatternOverridesDefaultBinding,\n\t\t\t\thasParentPattern,\n\t\t\t]\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tattributes={ { ...props.attributes, ...boundAttributes } }\n\t\t\t\t\tsetAttributes={ _setAttributes }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withBlockBindingSupport'\n);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade bound attributes.\n *\n * @param {WPBlockSettings} settings - Registered block settings.\n * @param {string} name - Block name.\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings, name ) {\n\tif ( ! canBindBlock( name ) ) {\n\t\treturn settings;\n\t}\n\n\treturn {\n\t\t...settings,\n\t\tedit: withBlockBindingSupport( settings.edit ),\n\t};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AAAwC,IAAAM,WAAA,GAAAN,OAAA;AAZxC;AACA;AACA;;AAOA;AACA;AACA;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAEA,MAAMO,6BAA6B,GAAG;EACrC,gBAAgB,EAAE,CAAE,SAAS,CAAE;EAC/B,cAAc,EAAE,CAAE,SAAS,CAAE;EAC7B,YAAY,EAAE,CAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAE;EAC7C,aAAa,EAAE,CAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK;AACpD,CAAC;AAED,MAAMC,iBAAiB,GAAG,WAAW;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,qCAAqCA,CAAEC,SAAS,EAAEC,QAAQ,EAAG;EACrE;EACA,IACCA,QAAQ,GAAIH,iBAAiB,CAAE,EAAEI,MAAM,KAAK,wBAAwB,EACnE;IACD,MAAMC,mBAAmB,GAAGN,6BAA6B,CAAEG,SAAS,CAAE;IACtE,MAAMI,oBAAoB,GAAG,CAAC,CAAC;IAC/B,KAAM,MAAMC,aAAa,IAAIF,mBAAmB,EAAG;MAClD;MACA,MAAMG,aAAa,GAAGL,QAAQ,CAAEI,aAAa,CAAE,GAC5CJ,QAAQ,CAAEI,aAAa,CAAE,GACzB;QAAEH,MAAM,EAAE;MAAyB,CAAC;MACvCE,oBAAoB,CAAEC,aAAa,CAAE,GAAGC,aAAa;IACtD;IAEA,OAAOF,oBAAoB;EAC5B;E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,IAAI;gBAClBkB;cACD,CAAE,CAAC;YACJ;UACD;QACD;MACD;MAEA;MACC;MACA;MACA,EACC3B,iCAAiC,IACjCD,gBAAgB,CAChB,IACDO,MAAM,CAACsB,IAAI,CAAEX,cAAe,CAAC,CAACY,MAAM,EACnC;QACD;QACA,IAAK7B,iCAAiC,EAAG;UACxC,OAAOiB,cAAc,EAAEa,OAAO;UAC9B,OAAOb,cAAc,EAAEc,IAAI;QAC5B;QACAnB,aAAa,CAAEK,cAAe,CAAC;MAChC;IACD,CAAE,CAAC;EACJ,CAAC,EACD,CACC7B,QAAQ,EACRd,QAAQ,EACRsB,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPc,aAAa,EACbtB,OAAO,EACPU,iCAAiC,EACjCD,gBAAgB,CAElB,CAAC;EAED,oBACC,IAAA9B,WAAA,CAAA+D,GAAA,EAAA/D,WAAA,CAAAgE,QAAA;IAAAC,QAAA,eACC,IAAAjE,WAAA,CAAA+D,GAAA,EAAC9C,SAAS;MAAA,GACJC,KAAK;MACVc,UAAU,EAAG;QAAE,GAAGd,KAAK,CAACc,UAAU;QAAE,GAAGG;MAAgB,CAAG;MAC1DQ,aAAa,EAAGC;IAAgB,CAChC;EAAC,CACD,CAAC;AAEL,CAAC,EACD,yBACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASsB,mBAAmBA,CAAEC,QAAQ,EAAExC,IAAI,EAAG;EAC9C,IAAK,CAAEhB,YAAY,CAAEgB,IAAK,CAAC,EAAG;IAC7B,OAAOwC,QAAQ;EAChB;EAEA,OAAO;IACN,GAAGA,QAAQ;IACXC,IAAI,EAAEtD,uBAAuB,CAAEqD,QAAQ,CAACC,IAAK;EAC9C,CAAC;AACF;AAEA,IAAAC,gBAAS,EACR,0BAA0B,EAC1B,0EAA0E,EAC1EH,mBACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_blocks","require","_compose","_data","_element","_hooks","_lockUnlock","_blockContext","_interopRequireDefault","_jsxRuntime","BLOCK_BINDINGS_ALLOWED_BLOCKS","DEFAULT_ATTRIBUTE","replacePatternOverrideDefaultBindings","blockName","bindings","source","supportedAttributes","bindingsWithDefaults","attributeName","bindingSource","canBindBlock","canBindAttribute","includes","getBindableAttributes","withBlockBindingSupport","exports","createHigherOrderComponent","BlockEdit","props","registry","useRegistry","blockContext","useContext","BlockContext","sources","useSelect","select","unlock","blocksStore","getAllBlockBindingsSources","name","clientId","hasParentPattern","context","hasPatternOverridesDefaultBinding","attributes","metadata","blockBindings","useMemo","boundAttributes","blockBindingsBySource","Map","binding","Object","entries","sourceName","args","sourceArgs","getValues","set","get","size","usesContext","length","key","values","value","undefined","getPlaceholder","setAttributes","_setAttributes","useCallback","nextAttributes","batch","keptAttributes","newValue","setValues","keys","caption","href","jsx","Fragment","children","shimAttributeSource","settings","edit","addFilter"],"sources":["@wordpress/block-editor/src/hooks/use-bindings-attributes.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { useCallback, useMemo, useContext } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport BlockContext from '../components/block-context';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Given a binding of block attributes, returns a higher order component that\n * overrides its `attributes` and `setAttributes` props to sync any changes needed.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\n\nconst BLOCK_BINDINGS_ALLOWED_BLOCKS = {\n\t'core/paragraph': [ 'content' ],\n\t'core/heading': [ 'content' ],\n\t'core/image': [ 'id', 'url', 'title', 'alt' ],\n\t'core/button': [ 'url', 'text', 'linkTarget', 'rel' ],\n};\n\nconst DEFAULT_ATTRIBUTE = '__default';\n\n/**\n * Returns the bindings with the `__default` binding for pattern overrides\n * replaced with the full-set of supported attributes. e.g.:\n *\n * bindings passed in: `{ __default: { source: 'core/pattern-overrides' } }`\n * bindings returned: `{ content: { source: 'core/pattern-overrides' } }`\n *\n * @param {string} blockName The block name (e.g. 'core/paragraph').\n * @param {Object} bindings A block's bindings from the metadata attribute.\n *\n * @return {Object} The bindings with default replaced for pattern overrides.\n */\nfunction replacePatternOverrideDefaultBindings( blockName, bindings ) {\n\t// The `__default` binding currently only works for pattern overrides.\n\tif (\n\t\tbindings?.[ DEFAULT_ATTRIBUTE ]?.source === 'core/pattern-overrides'\n\t) {\n\t\tconst supportedAttributes = BLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ];\n\t\tconst bindingsWithDefaults = {};\n\t\tfor ( const attributeName of supportedAttributes ) {\n\t\t\t// If the block has mixed binding sources, retain any non pattern override bindings.\n\t\t\tconst bindingSource = bindings[ attributeName ]\n\t\t\t\t? bindings[ attributeName ]\n\t\t\t\t: { source: 'core/pattern-overrides' };\n\t\t\tbindingsWithDefaults[ attributeName ] = bindingSource;\n\t\t}\n\n\t\treturn bindingsWithDefaults;\n\t}\n\n\treturn bindings;\n}\n\n/**\n * Based on the given block name,\n * check if it is possible to bind the block.\n *\n * @param {string} blockName - The block name.\n * @return {boolean} Whether it is possible to bind the block to sources.\n */\nexport function canBindBlock( blockName ) {\n\treturn blockName in BLOCK_BINDINGS_ALLOWED_BLOCKS;\n}\n\n/**\n * Based on the given block name and attribute name,\n * check if it is possible to bind the block attribute.\n *\n * @param {string} blockName - The block name.\n * @param {string} attributeName - The attribute name.\n * @return {boolean} Whether it is possible to bind the block attribute.\n */\nexport function canBindAttribute( blockName, attributeName ) {\n\treturn (\n\t\tcanBindBlock( blockName ) &&\n\t\tBLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ].includes( attributeName )\n\t);\n}\n\nexport function getBindableAttributes( blockName ) {\n\treturn BLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ];\n}\n\nexport const withBlockBindingSupport = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst registry = useRegistry();\n\t\tconst blockContext = useContext( BlockContext );\n\t\tconst sources = useSelect( ( select ) =>\n\t\t\tunlock( select( blocksStore ) ).getAllBlockBindingsSources()\n\t\t);\n\t\tconst { name, clientId } = props;\n\t\tconst hasParentPattern = !! props.context[ 'pattern/overrides' ];\n\t\tconst hasPatternOverridesDefaultBinding =\n\t\t\tprops.attributes.metadata?.bindings?.[ DEFAULT_ATTRIBUTE ]\n\t\t\t\t?.source === 'core/pattern-overrides';\n\t\tconst blockBindings = useMemo(\n\t\t\t() =>\n\t\t\t\treplacePatternOverrideDefaultBindings(\n\t\t\t\t\tname,\n\t\t\t\t\tprops.attributes.metadata?.bindings\n\t\t\t\t),\n\t\t\t[ props.attributes.metadata?.bindings, name ]\n\t\t);\n\n\t\t// While this hook doesn't directly call any selectors, `useSelect` is\n\t\t// used purposely here to ensure `boundAttributes` is updated whenever\n\t\t// there are attribute updates.\n\t\t// `source.getValues` may also call a selector via `registry.select`.\n\t\tconst boundAttributes = useSelect( () => {\n\t\t\tif ( ! blockBindings ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst attributes = {};\n\n\t\t\tconst blockBindingsBySource = new Map();\n\n\t\t\tfor ( const [ attributeName, binding ] of Object.entries(\n\t\t\t\tblockBindings\n\t\t\t) ) {\n\t\t\t\tconst { source: sourceName, args: sourceArgs } = binding;\n\t\t\t\tconst source = sources[ sourceName ];\n\t\t\t\tif (\n\t\t\t\t\t! source?.getValues ||\n\t\t\t\t\t! canBindAttribute( name, attributeName )\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tblockBindingsBySource.set( source, {\n\t\t\t\t\t...blockBindingsBySource.get( source ),\n\t\t\t\t\t[ attributeName ]: {\n\t\t\t\t\t\targs: sourceArgs,\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tif ( blockBindingsBySource.size ) {\n\t\t\t\tfor ( const [ source, bindings ] of blockBindingsBySource ) {\n\t\t\t\t\t// Populate context.\n\t\t\t\t\tconst context = {};\n\n\t\t\t\t\tif ( source.usesContext?.length ) {\n\t\t\t\t\t\tfor ( const key of source.usesContext ) {\n\t\t\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Get values in batch if the source supports it.\n\t\t\t\t\tconst values = source.getValues( {\n\t\t\t\t\t\tregistry,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tbindings,\n\t\t\t\t\t} );\n\t\t\t\t\tfor ( const [ attributeName, value ] of Object.entries(\n\t\t\t\t\t\tvalues\n\t\t\t\t\t) ) {\n\t\t\t\t\t\t// Use placeholder when value is undefined.\n\t\t\t\t\t\tif ( value === undefined ) {\n\t\t\t\t\t\t\tif ( attributeName === 'url' ) {\n\t\t\t\t\t\t\t\tattributes[ attributeName ] = null;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tattributes[ attributeName ] =\n\t\t\t\t\t\t\t\t\tsource.getPlaceholder?.( {\n\t\t\t\t\t\t\t\t\t\tregistry,\n\t\t\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t\t\tattributeName,\n\t\t\t\t\t\t\t\t\t\targs: bindings[ attributeName ].args,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tattributes[ attributeName ] = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn attributes;\n\t\t}, [ blockBindings, name, clientId, blockContext, registry, sources ] );\n\n\t\tconst { setAttributes } = props;\n\n\t\tconst _setAttributes = useCallback(\n\t\t\t( nextAttributes ) => {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tif ( ! blockBindings ) {\n\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst keptAttributes = { ...nextAttributes };\n\t\t\t\t\tconst blockBindingsBySource = new Map();\n\n\t\t\t\t\t// Loop only over the updated attributes to avoid modifying the bound ones that haven't changed.\n\t\t\t\t\tfor ( const [ attributeName, newValue ] of Object.entries(\n\t\t\t\t\t\tkeptAttributes\n\t\t\t\t\t) ) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! blockBindings[ attributeName ] ||\n\t\t\t\t\t\t\t! canBindAttribute( name, attributeName )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst binding = blockBindings[ attributeName ];\n\t\t\t\t\t\tconst source = sources[ binding?.source ];\n\t\t\t\t\t\tif ( ! source?.setValues ) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tblockBindingsBySource.set( source, {\n\t\t\t\t\t\t\t...blockBindingsBySource.get( source ),\n\t\t\t\t\t\t\t[ attributeName ]: {\n\t\t\t\t\t\t\t\targs: binding.args,\n\t\t\t\t\t\t\t\tnewValue,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tdelete keptAttributes[ attributeName ];\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( blockBindingsBySource.size ) {\n\t\t\t\t\t\tfor ( const [\n\t\t\t\t\t\t\tsource,\n\t\t\t\t\t\t\tbindings,\n\t\t\t\t\t\t] of blockBindingsBySource ) {\n\t\t\t\t\t\t\t// Populate context.\n\t\t\t\t\t\t\tconst context = {};\n\n\t\t\t\t\t\t\tif ( source.usesContext?.length ) {\n\t\t\t\t\t\t\t\tfor ( const key of source.usesContext ) {\n\t\t\t\t\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsource.setValues( {\n\t\t\t\t\t\t\t\tregistry,\n\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\tbindings,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t// Don't update non-connected attributes if the block is using pattern overrides\n\t\t\t\t\t\t// and the editing is happening while overriding the pattern (not editing the original).\n\t\t\t\t\t\t! (\n\t\t\t\t\t\t\thasPatternOverridesDefaultBinding &&\n\t\t\t\t\t\t\thasParentPattern\n\t\t\t\t\t\t) &&\n\t\t\t\t\t\tObject.keys( keptAttributes ).length\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Don't update caption and href until they are supported.\n\t\t\t\t\t\tif ( hasPatternOverridesDefaultBinding ) {\n\t\t\t\t\t\t\tdelete keptAttributes?.caption;\n\t\t\t\t\t\t\tdelete keptAttributes?.href;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetAttributes( keptAttributes );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\t[\n\t\t\t\tregistry,\n\t\t\t\tblockBindings,\n\t\t\t\tname,\n\t\t\t\tclientId,\n\t\t\t\tblockContext,\n\t\t\t\tsetAttributes,\n\t\t\t\tsources,\n\t\t\t\thasPatternOverridesDefaultBinding,\n\t\t\t\thasParentPattern,\n\t\t\t]\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tattributes={ { ...props.attributes, ...boundAttributes } }\n\t\t\t\t\tsetAttributes={ _setAttributes }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withBlockBindingSupport'\n);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade bound attributes.\n *\n * @param {WPBlockSettings} settings - Registered block settings.\n * @param {string} name - Block name.\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings, name ) {\n\tif ( ! canBindBlock( name ) ) {\n\t\treturn settings;\n\t}\n\n\treturn {\n\t\t...settings,\n\t\tedit: withBlockBindingSupport( settings.edit ),\n\t};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAC,sBAAA,CAAAP,OAAA;AAAuD,IAAAQ,WAAA,GAAAR,OAAA;AAbvD;AACA;AACA;;AAOA;AACA;AACA;;AAIA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAEA,MAAMS,6BAA6B,GAAG;EACrC,gBAAgB,EAAE,CAAE,SAAS,CAAE;EAC/B,cAAc,EAAE,CAAE,SAAS,CAAE;EAC7B,YAAY,EAAE,CAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAE;EAC7C,aAAa,EAAE,CAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK;AACpD,CAAC;AAED,MAAMC,iBAAiB,GAAG,WAAW;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,qCAAqCA,CAAEC,SAAS,EAAEC,QAAQ,EAAG;EACrE;EACA,IACCA,QAAQ,GAAIH,iBAAiB,CAAE,EAAEI,MAAM,KAAK,wBAAwB,EACnE;IACD,MAAMC,mBAAmB,GAAGN,6BAA6B,CAAEG,SAAS,CAAE;IACtE,MAAMI,oBAAoB,GAAG,CAAC,CAAC;IAC/B,KAAM,MAAMC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W,MAAM,CAACwB,IAAI,CAAEH,cAAe,CAAC,CAACX,MAAM,EACnC;QACD;QACA,IAAKnB,iCAAiC,EAAG;UACxC,OAAO8B,cAAc,EAAEI,OAAO;UAC9B,OAAOJ,cAAc,EAAEK,IAAI;QAC5B;QACAV,aAAa,CAAEK,cAAe,CAAC;MAChC;IACD,CAAE,CAAC;EACJ,CAAC,EACD,CACC7C,QAAQ,EACRkB,aAAa,EACbP,IAAI,EACJC,QAAQ,EACRV,YAAY,EACZsC,aAAa,EACbnC,OAAO,EACPU,iCAAiC,EACjCF,gBAAgB,CAElB,CAAC;EAED,oBACC,IAAAjC,WAAA,CAAAuE,GAAA,EAAAvE,WAAA,CAAAwE,QAAA;IAAAC,QAAA,eACC,IAAAzE,WAAA,CAAAuE,GAAA,EAACrD,SAAS;MAAA,GACJC,KAAK;MACViB,UAAU,EAAG;QAAE,GAAGjB,KAAK,CAACiB,UAAU;QAAE,GAAGI;MAAgB,CAAG;MAC1DoB,aAAa,EAAGC;IAAgB,CAChC;EAAC,CACD,CAAC;AAEL,CAAC,EACD,yBACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASa,mBAAmBA,CAAEC,QAAQ,EAAE5C,IAAI,EAAG;EAC9C,IAAK,CAAEpB,YAAY,CAAEoB,IAAK,CAAC,EAAG;IAC7B,OAAO4C,QAAQ;EAChB;EAEA,OAAO;IACN,GAAGA,QAAQ;IACXC,IAAI,EAAE7D,uBAAuB,CAAE4D,QAAQ,CAACC,IAAK;EAC9C,CAAC;AACF;AAEA,IAAAC,gBAAS,EACR,0BAA0B,EAC1B,0EAA0E,EAC1EH,mBACD,CAAC","ignoreList":[]}
@@ -49,6 +49,6 @@ function useZoomOut(zoomOut = true) {
49
49
  } else if (!zoomOut && __unstableGetEditorMode() === 'zoom-out' && originalEditingMode.current !== mode) {
50
50
  __unstableSetEditorMode(originalEditingMode.current);
51
51
  }
52
- }, [__unstableSetEditorMode, zoomOut, mode]);
52
+ }, [__unstableGetEditorMode, __unstableSetEditorMode, zoomOut]); // Mode is deliberately excluded from the dependencies so that the effect does not run when mode changes.
53
53
  }
54
54
  //# sourceMappingURL=use-zoom-out.js.map