@wordpress/block-editor 14.5.0 → 14.7.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 (541) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +0 -8
  3. package/build/autocompleters/block.js +13 -5
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/components/block-canvas/index.js +10 -0
  6. package/build/components/block-canvas/index.js.map +1 -1
  7. package/build/components/block-card/index.js +2 -2
  8. package/build/components/block-card/index.js.map +1 -1
  9. package/build/components/block-full-height-alignment-control/index.js +1 -1
  10. package/build/components/block-full-height-alignment-control/index.js.map +1 -1
  11. package/build/components/block-list/block.js +15 -29
  12. package/build/components/block-list/block.js.map +1 -1
  13. package/build/components/block-list/block.native.js +1 -7
  14. package/build/components/block-list/block.native.js.map +1 -1
  15. package/build/components/block-list/index.js +5 -5
  16. package/build/components/block-list/index.js.map +1 -1
  17. package/build/components/block-list/use-block-props/index.js +1 -2
  18. package/build/components/block-list/use-block-props/index.js.map +1 -1
  19. package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -3
  20. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  21. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -6
  22. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  23. package/build/components/block-list/use-in-between-inserter.js +1 -1
  24. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  25. package/build/components/block-patterns-list/index.js +23 -26
  26. package/build/components/block-patterns-list/index.js.map +1 -1
  27. package/build/components/block-patterns-paging/index.js +1 -1
  28. package/build/components/block-patterns-paging/index.js.map +1 -1
  29. package/build/components/block-popover/index.js +3 -46
  30. package/build/components/block-popover/index.js.map +1 -1
  31. package/build/components/block-preview/async.js +51 -0
  32. package/build/components/block-preview/async.js.map +1 -0
  33. package/build/components/block-preview/index.js +6 -3
  34. package/build/components/block-preview/index.js.map +1 -1
  35. package/build/components/block-settings-menu/block-settings-dropdown.js +5 -0
  36. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  37. package/build/components/block-settings-menu/index.js +4 -3
  38. package/build/components/block-settings-menu/index.js.map +1 -1
  39. package/build/components/block-toolbar/change-design.js +119 -0
  40. package/build/components/block-toolbar/change-design.js.map +1 -0
  41. package/build/components/block-toolbar/index.js +19 -7
  42. package/build/components/block-toolbar/index.js.map +1 -1
  43. package/build/components/block-tools/index.js +16 -19
  44. package/build/components/block-tools/index.js.map +1 -1
  45. package/build/components/block-tools/insertion-point.js +4 -3
  46. package/build/components/block-tools/insertion-point.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 -10
  50. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  51. package/build/components/block-tools/zoom-out-mode-inserters.js +20 -29
  52. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  53. package/build/components/block-variation-transforms/index.js +2 -2
  54. package/build/components/block-variation-transforms/index.js.map +1 -1
  55. package/build/components/block-vertical-alignment-control/ui.js +6 -10
  56. package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
  57. package/build/components/border-radius-control/linked-button.js +7 -10
  58. package/build/components/border-radius-control/linked-button.js.map +1 -1
  59. package/build/components/collab/block-comment-icon-slot.js +18 -0
  60. package/build/components/collab/block-comment-icon-slot.js.map +1 -0
  61. package/build/components/collab/block-comment-icon-toolbar-slot.js +18 -0
  62. package/build/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
  63. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
  64. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  65. package/build/components/convert-to-group-buttons/toolbar.js +4 -4
  66. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
  67. package/build/components/global-styles/color-panel.js +1 -4
  68. package/build/components/global-styles/color-panel.js.map +1 -1
  69. package/build/components/global-styles/dimensions-panel.js +26 -14
  70. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  71. package/build/components/global-styles/use-global-styles-context.native.js +6 -0
  72. package/build/components/global-styles/use-global-styles-context.native.js.map +1 -1
  73. package/build/components/iframe/get-compatibility-styles.js +4 -4
  74. package/build/components/iframe/get-compatibility-styles.js.map +1 -1
  75. package/build/components/iframe/index.js +33 -22
  76. package/build/components/iframe/index.js.map +1 -1
  77. package/build/components/image-size-control/index.js +61 -20
  78. package/build/components/image-size-control/index.js.map +1 -1
  79. package/build/components/inner-blocks/index.js +9 -5
  80. package/build/components/inner-blocks/index.js.map +1 -1
  81. package/build/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  82. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  83. package/build/components/inserter/block-patterns-tab/index.js +1 -2
  84. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  85. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +5 -3
  86. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  87. package/build/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  88. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  89. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +3 -0
  90. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  91. package/build/components/inserter/block-patterns-tab/utils.js +5 -1
  92. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
  93. package/build/components/inserter/category-tabs/index.js +15 -2
  94. package/build/components/inserter/category-tabs/index.js.map +1 -1
  95. package/build/components/inserter/hooks/use-block-types-state.js +1 -1
  96. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  97. package/build/components/inserter/hooks/use-patterns-paging.js +0 -5
  98. package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -1
  99. package/build/components/inserter/menu.js +4 -2
  100. package/build/components/inserter/menu.js.map +1 -1
  101. package/build/components/inserter/search-results.js +0 -2
  102. package/build/components/inserter/search-results.js.map +1 -1
  103. package/build/components/inserter-button/index.native.js +1 -1
  104. package/build/components/inserter-button/index.native.js.map +1 -1
  105. package/build/components/inspector-controls-tabs/index.js +0 -2
  106. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  107. package/build/components/inspector-controls-tabs/utils.js +3 -6
  108. package/build/components/inspector-controls-tabs/utils.js.map +1 -1
  109. package/build/components/link-control/link-preview.js +12 -9
  110. package/build/components/link-control/link-preview.js.map +1 -1
  111. package/build/components/list-view/appender.js +4 -3
  112. package/build/components/list-view/appender.js.map +1 -1
  113. package/build/components/list-view/branch.js +6 -5
  114. package/build/components/list-view/branch.js.map +1 -1
  115. package/build/components/list-view/index.js +1 -2
  116. package/build/components/list-view/index.js.map +1 -1
  117. package/build/components/media-placeholder/index.js +4 -4
  118. package/build/components/media-placeholder/index.js.map +1 -1
  119. package/build/components/provider/index.js +1 -1
  120. package/build/components/provider/index.js.map +1 -1
  121. package/build/components/rich-text/event-listeners/index.js +3 -1
  122. package/build/components/rich-text/event-listeners/index.js.map +1 -1
  123. package/build/components/rich-text/index.js +1 -1
  124. package/build/components/rich-text/index.js.map +1 -1
  125. package/build/components/rich-text/index.native.js +2 -6
  126. package/build/components/rich-text/index.native.js.map +1 -1
  127. package/build/components/spacing-sizes-control/index.js +2 -2
  128. package/build/components/spacing-sizes-control/index.js.map +1 -1
  129. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -3
  130. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  131. package/build/components/spacing-sizes-control/linked-button.js +1 -5
  132. package/build/components/spacing-sizes-control/linked-button.js.map +1 -1
  133. package/build/components/tabbed-sidebar/index.js +1 -1
  134. package/build/components/tabbed-sidebar/index.js.map +1 -1
  135. package/build/components/tool-selector/index.js +1 -4
  136. package/build/components/tool-selector/index.js.map +1 -1
  137. package/build/components/url-input/index.js +4 -2
  138. package/build/components/url-input/index.js.map +1 -1
  139. package/build/components/use-block-commands/index.js +6 -7
  140. package/build/components/use-block-commands/index.js.map +1 -1
  141. package/build/components/use-block-drop-zone/index.js +5 -5
  142. package/build/components/use-block-drop-zone/index.js.map +1 -1
  143. package/build/components/use-block-drop-zone/index.native.js +0 -1
  144. package/build/components/use-block-drop-zone/index.native.js.map +1 -1
  145. package/build/components/use-moving-animation/index.js +1 -3
  146. package/build/components/use-moving-animation/index.js.map +1 -1
  147. package/build/components/use-settings/index.js +1 -3
  148. package/build/components/use-settings/index.js.map +1 -1
  149. package/build/components/writing-flow/index.js +5 -3
  150. package/build/components/writing-flow/index.js.map +1 -1
  151. package/build/components/writing-flow/use-tab-nav.js +2 -3
  152. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  153. package/build/hooks/block-bindings.js +19 -8
  154. package/build/hooks/block-bindings.js.map +1 -1
  155. package/build/hooks/contrast-checker.js +0 -1
  156. package/build/hooks/contrast-checker.js.map +1 -1
  157. package/build/hooks/duotone.js +2 -2
  158. package/build/hooks/duotone.js.map +1 -1
  159. package/build/hooks/font-family.js +1 -1
  160. package/build/hooks/font-family.js.map +1 -1
  161. package/build/hooks/style.js +4 -1
  162. package/build/hooks/style.js.map +1 -1
  163. package/build/hooks/supports.js +6 -6
  164. package/build/hooks/supports.js.map +1 -1
  165. package/build/hooks/typography.js +5 -5
  166. package/build/hooks/typography.js.map +1 -1
  167. package/build/hooks/use-zoom-out.js +13 -22
  168. package/build/hooks/use-zoom-out.js.map +1 -1
  169. package/build/hooks/utils.js +2 -2
  170. package/build/hooks/utils.js.map +1 -1
  171. package/build/index.js +0 -7
  172. package/build/index.js.map +1 -1
  173. package/build/lock-unlock.js.map +1 -1
  174. package/build/private-apis.js +6 -3
  175. package/build/private-apis.js.map +1 -1
  176. package/build/store/actions.js +2 -33
  177. package/build/store/actions.js.map +1 -1
  178. package/build/store/defaults.js +1 -1
  179. package/build/store/defaults.js.map +1 -1
  180. package/build/store/private-actions.js +57 -8
  181. package/build/store/private-actions.js.map +1 -1
  182. package/build/store/private-selectors.js +10 -22
  183. package/build/store/private-selectors.js.map +1 -1
  184. package/build/store/reducer.js +16 -6
  185. package/build/store/reducer.js.map +1 -1
  186. package/build/store/selectors.js +53 -15
  187. package/build/store/selectors.js.map +1 -1
  188. package/build/store/utils.js +5 -4
  189. package/build/store/utils.js.map +1 -1
  190. package/build/utils/dom.js +37 -17
  191. package/build/utils/dom.js.map +1 -1
  192. package/build/utils/get-font-styles-and-weights.js +1 -1
  193. package/build/utils/get-font-styles-and-weights.js.map +1 -1
  194. package/build/utils/transform-styles/index.js +4 -3
  195. package/build/utils/transform-styles/index.js.map +1 -1
  196. package/build-module/autocompleters/block.js +14 -6
  197. package/build-module/autocompleters/block.js.map +1 -1
  198. package/build-module/components/block-canvas/index.js +11 -1
  199. package/build-module/components/block-canvas/index.js.map +1 -1
  200. package/build-module/components/block-card/index.js +3 -3
  201. package/build-module/components/block-card/index.js.map +1 -1
  202. package/build-module/components/block-full-height-alignment-control/index.js +1 -1
  203. package/build-module/components/block-full-height-alignment-control/index.js.map +1 -1
  204. package/build-module/components/block-list/block.js +16 -28
  205. package/build-module/components/block-list/block.js.map +1 -1
  206. package/build-module/components/block-list/block.native.js +1 -7
  207. package/build-module/components/block-list/block.native.js.map +1 -1
  208. package/build-module/components/block-list/index.js +5 -5
  209. package/build-module/components/block-list/index.js.map +1 -1
  210. package/build-module/components/block-list/use-block-props/index.js +1 -2
  211. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  212. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -3
  213. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  214. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -6
  215. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  216. package/build-module/components/block-list/use-in-between-inserter.js +1 -1
  217. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  218. package/build-module/components/block-patterns-list/index.js +23 -26
  219. package/build-module/components/block-patterns-list/index.js.map +1 -1
  220. package/build-module/components/block-patterns-paging/index.js +1 -1
  221. package/build-module/components/block-patterns-paging/index.js.map +1 -1
  222. package/build-module/components/block-popover/index.js +4 -47
  223. package/build-module/components/block-popover/index.js.map +1 -1
  224. package/build-module/components/block-preview/async.js +44 -0
  225. package/build-module/components/block-preview/async.js.map +1 -0
  226. package/build-module/components/block-preview/index.js +6 -3
  227. package/build-module/components/block-preview/index.js.map +1 -1
  228. package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -0
  229. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  230. package/build-module/components/block-settings-menu/index.js +5 -4
  231. package/build-module/components/block-settings-menu/index.js.map +1 -1
  232. package/build-module/components/block-toolbar/change-design.js +111 -0
  233. package/build-module/components/block-toolbar/change-design.js.map +1 -0
  234. package/build-module/components/block-toolbar/index.js +19 -7
  235. package/build-module/components/block-toolbar/index.js.map +1 -1
  236. package/build-module/components/block-tools/index.js +17 -20
  237. package/build-module/components/block-tools/index.js.map +1 -1
  238. package/build-module/components/block-tools/insertion-point.js +4 -3
  239. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  240. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +2 -2
  241. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  242. package/build-module/components/block-tools/use-show-block-tools.js +7 -10
  243. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  244. package/build-module/components/block-tools/zoom-out-mode-inserters.js +20 -29
  245. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  246. package/build-module/components/block-variation-transforms/index.js +2 -2
  247. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  248. package/build-module/components/block-vertical-alignment-control/ui.js +6 -10
  249. package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
  250. package/build-module/components/border-radius-control/linked-button.js +8 -11
  251. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  252. package/build-module/components/collab/block-comment-icon-slot.js +11 -0
  253. package/build-module/components/collab/block-comment-icon-slot.js.map +1 -0
  254. package/build-module/components/collab/block-comment-icon-toolbar-slot.js +11 -0
  255. package/build-module/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
  256. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
  257. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  258. package/build-module/components/convert-to-group-buttons/toolbar.js +4 -4
  259. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
  260. package/build-module/components/global-styles/color-panel.js +2 -5
  261. package/build-module/components/global-styles/color-panel.js.map +1 -1
  262. package/build-module/components/global-styles/dimensions-panel.js +26 -14
  263. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  264. package/build-module/components/global-styles/use-global-styles-context.native.js +6 -0
  265. package/build-module/components/global-styles/use-global-styles-context.native.js.map +1 -1
  266. package/build-module/components/iframe/get-compatibility-styles.js +4 -4
  267. package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
  268. package/build-module/components/iframe/index.js +33 -22
  269. package/build-module/components/iframe/index.js.map +1 -1
  270. package/build-module/components/image-size-control/index.js +62 -21
  271. package/build-module/components/image-size-control/index.js.map +1 -1
  272. package/build-module/components/inner-blocks/index.js +9 -5
  273. package/build-module/components/inner-blocks/index.js.map +1 -1
  274. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  275. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  276. package/build-module/components/inserter/block-patterns-tab/index.js +1 -2
  277. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  278. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +6 -4
  279. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  280. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  281. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  282. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +4 -1
  283. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  284. package/build-module/components/inserter/block-patterns-tab/utils.js +4 -0
  285. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
  286. package/build-module/components/inserter/category-tabs/index.js +15 -2
  287. package/build-module/components/inserter/category-tabs/index.js.map +1 -1
  288. package/build-module/components/inserter/hooks/use-block-types-state.js +1 -1
  289. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  290. package/build-module/components/inserter/hooks/use-patterns-paging.js +1 -6
  291. package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -1
  292. package/build-module/components/inserter/menu.js +5 -3
  293. package/build-module/components/inserter/menu.js.map +1 -1
  294. package/build-module/components/inserter/search-results.js +0 -2
  295. package/build-module/components/inserter/search-results.js.map +1 -1
  296. package/build-module/components/inserter-button/index.native.js +1 -1
  297. package/build-module/components/inserter-button/index.native.js.map +1 -1
  298. package/build-module/components/inspector-controls-tabs/index.js +0 -2
  299. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  300. package/build-module/components/inspector-controls-tabs/utils.js +3 -6
  301. package/build-module/components/inspector-controls-tabs/utils.js.map +1 -1
  302. package/build-module/components/link-control/link-preview.js +13 -10
  303. package/build-module/components/link-control/link-preview.js.map +1 -1
  304. package/build-module/components/list-view/appender.js +4 -3
  305. package/build-module/components/list-view/appender.js.map +1 -1
  306. package/build-module/components/list-view/branch.js +7 -6
  307. package/build-module/components/list-view/branch.js.map +1 -1
  308. package/build-module/components/list-view/index.js +1 -2
  309. package/build-module/components/list-view/index.js.map +1 -1
  310. package/build-module/components/media-placeholder/index.js +4 -4
  311. package/build-module/components/media-placeholder/index.js.map +1 -1
  312. package/build-module/components/provider/index.js +1 -1
  313. package/build-module/components/provider/index.js.map +1 -1
  314. package/build-module/components/rich-text/event-listeners/index.js +4 -2
  315. package/build-module/components/rich-text/event-listeners/index.js.map +1 -1
  316. package/build-module/components/rich-text/index.js +1 -1
  317. package/build-module/components/rich-text/index.js.map +1 -1
  318. package/build-module/components/rich-text/index.native.js +2 -6
  319. package/build-module/components/rich-text/index.native.js.map +1 -1
  320. package/build-module/components/spacing-sizes-control/index.js +3 -3
  321. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  322. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
  323. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  324. package/build-module/components/spacing-sizes-control/linked-button.js +2 -6
  325. package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -1
  326. package/build-module/components/tabbed-sidebar/index.js +1 -1
  327. package/build-module/components/tabbed-sidebar/index.js.map +1 -1
  328. package/build-module/components/tool-selector/index.js +1 -4
  329. package/build-module/components/tool-selector/index.js.map +1 -1
  330. package/build-module/components/url-input/index.js +4 -2
  331. package/build-module/components/url-input/index.js.map +1 -1
  332. package/build-module/components/use-block-commands/index.js +5 -5
  333. package/build-module/components/use-block-commands/index.js.map +1 -1
  334. package/build-module/components/use-block-drop-zone/index.js +5 -5
  335. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  336. package/build-module/components/use-block-drop-zone/index.native.js +0 -1
  337. package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
  338. package/build-module/components/use-moving-animation/index.js +1 -3
  339. package/build-module/components/use-moving-animation/index.js.map +1 -1
  340. package/build-module/components/use-settings/index.js +1 -3
  341. package/build-module/components/use-settings/index.js.map +1 -1
  342. package/build-module/components/writing-flow/index.js +5 -3
  343. package/build-module/components/writing-flow/index.js.map +1 -1
  344. package/build-module/components/writing-flow/use-tab-nav.js +2 -3
  345. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  346. package/build-module/hooks/block-bindings.js +20 -9
  347. package/build-module/hooks/block-bindings.js.map +1 -1
  348. package/build-module/hooks/contrast-checker.js +0 -1
  349. package/build-module/hooks/contrast-checker.js.map +1 -1
  350. package/build-module/hooks/duotone.js +2 -2
  351. package/build-module/hooks/duotone.js.map +1 -1
  352. package/build-module/hooks/font-family.js +1 -1
  353. package/build-module/hooks/font-family.js.map +1 -1
  354. package/build-module/hooks/style.js +4 -1
  355. package/build-module/hooks/style.js.map +1 -1
  356. package/build-module/hooks/supports.js +6 -6
  357. package/build-module/hooks/supports.js.map +1 -1
  358. package/build-module/hooks/typography.js +5 -5
  359. package/build-module/hooks/typography.js.map +1 -1
  360. package/build-module/hooks/use-zoom-out.js +15 -23
  361. package/build-module/hooks/use-zoom-out.js.map +1 -1
  362. package/build-module/hooks/utils.js +2 -2
  363. package/build-module/hooks/utils.js.map +1 -1
  364. package/build-module/index.js +1 -1
  365. package/build-module/index.js.map +1 -1
  366. package/build-module/lock-unlock.js.map +1 -1
  367. package/build-module/private-apis.js +7 -5
  368. package/build-module/private-apis.js.map +1 -1
  369. package/build-module/store/actions.js +2 -33
  370. package/build-module/store/actions.js.map +1 -1
  371. package/build-module/store/defaults.js +1 -1
  372. package/build-module/store/defaults.js.map +1 -1
  373. package/build-module/store/private-actions.js +54 -7
  374. package/build-module/store/private-actions.js.map +1 -1
  375. package/build-module/store/private-selectors.js +10 -21
  376. package/build-module/store/private-selectors.js.map +1 -1
  377. package/build-module/store/reducer.js +16 -6
  378. package/build-module/store/reducer.js.map +1 -1
  379. package/build-module/store/selectors.js +54 -16
  380. package/build-module/store/selectors.js.map +1 -1
  381. package/build-module/store/utils.js +3 -3
  382. package/build-module/store/utils.js.map +1 -1
  383. package/build-module/utils/dom.js +35 -16
  384. package/build-module/utils/dom.js.map +1 -1
  385. package/build-module/utils/get-font-styles-and-weights.js +2 -2
  386. package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
  387. package/build-module/utils/transform-styles/index.js +3 -2
  388. package/build-module/utils/transform-styles/index.js.map +1 -1
  389. package/build-style/content-rtl.css +16 -10
  390. package/build-style/content.css +16 -10
  391. package/build-style/style-rtl.css +47 -25
  392. package/build-style/style.css +47 -25
  393. package/build-types/utils/dom.d.ts +7 -9
  394. package/build-types/utils/dom.d.ts.map +1 -1
  395. package/package.json +34 -32
  396. package/src/autocompleters/block.js +16 -7
  397. package/src/components/block-canvas/index.js +17 -1
  398. package/src/components/block-canvas/style.scss +3 -1
  399. package/src/components/block-card/index.js +3 -3
  400. package/src/components/block-full-height-alignment-control/index.js +1 -1
  401. package/src/components/block-inspector/style.scss +2 -7
  402. package/src/components/block-list/block.js +29 -50
  403. package/src/components/block-list/block.native.js +0 -4
  404. package/src/components/block-list/content.scss +1 -1
  405. package/src/components/block-list/index.js +4 -4
  406. package/src/components/block-list/use-block-props/index.js +0 -2
  407. package/src/components/block-list/use-block-props/use-focus-first-element.js +5 -3
  408. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +7 -20
  409. package/src/components/block-list/use-in-between-inserter.js +1 -1
  410. package/src/components/block-patterns-list/README.md +8 -8
  411. package/src/components/block-patterns-list/index.js +35 -51
  412. package/src/components/block-patterns-list/stories/fixtures.js +834 -0
  413. package/src/components/block-patterns-list/stories/index.story.js +64 -0
  414. package/src/components/block-patterns-list/style.scss +2 -0
  415. package/src/components/block-patterns-paging/index.js +1 -1
  416. package/src/components/block-popover/index.js +4 -66
  417. package/src/components/block-preview/async.js +43 -0
  418. package/src/components/block-preview/index.js +8 -3
  419. package/src/components/block-settings-menu/block-settings-dropdown.js +4 -0
  420. package/src/components/block-settings-menu/index.js +3 -0
  421. package/src/components/block-toolbar/change-design.js +127 -0
  422. package/src/components/block-toolbar/index.js +25 -8
  423. package/src/components/block-toolbar/style.scss +16 -0
  424. package/src/components/block-tools/index.js +30 -27
  425. package/src/components/block-tools/insertion-point.js +4 -3
  426. package/src/components/block-tools/style.scss +12 -20
  427. package/src/components/block-tools/use-block-toolbar-popover-props.js +2 -2
  428. package/src/components/block-tools/use-show-block-tools.js +3 -14
  429. package/src/components/block-tools/zoom-out-mode-inserters.js +25 -40
  430. package/src/components/block-variation-transforms/index.js +2 -2
  431. package/src/components/block-vertical-alignment-control/ui.js +11 -15
  432. package/src/components/border-radius-control/linked-button.js +9 -11
  433. package/src/components/collab/block-comment-icon-slot.js +12 -0
  434. package/src/components/collab/block-comment-icon-toolbar-slot.js +12 -0
  435. package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
  436. package/src/components/convert-to-group-buttons/toolbar.js +4 -4
  437. package/src/components/default-block-appender/content.scss +13 -19
  438. package/src/components/global-styles/color-panel.js +2 -10
  439. package/src/components/global-styles/dimensions-panel.js +22 -16
  440. package/src/components/global-styles/test/use-global-styles-context.native.js +1 -0
  441. package/src/components/global-styles/use-global-styles-context.native.js +6 -0
  442. package/src/components/iframe/content.scss +4 -9
  443. package/src/components/iframe/get-compatibility-styles.js +4 -9
  444. package/src/components/iframe/index.js +48 -34
  445. package/src/components/iframe/style.scss +2 -3
  446. package/src/components/image-size-control/index.js +74 -43
  447. package/src/components/image-size-control/test/index.js +5 -63
  448. package/src/components/inner-blocks/index.js +12 -6
  449. package/src/components/inserter/block-patterns-explorer/pattern-list.js +3 -6
  450. package/src/components/inserter/block-patterns-tab/index.js +0 -1
  451. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +10 -4
  452. package/src/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  453. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +8 -0
  454. package/src/components/inserter/block-patterns-tab/utils.js +5 -0
  455. package/src/components/inserter/category-tabs/index.js +16 -2
  456. package/src/components/inserter/hooks/use-block-types-state.js +6 -1
  457. package/src/components/inserter/hooks/use-patterns-paging.js +1 -6
  458. package/src/components/inserter/menu.js +6 -4
  459. package/src/components/inserter/search-results.js +0 -6
  460. package/src/components/inserter/style.scss +13 -0
  461. package/src/components/inserter-button/index.native.js +1 -1
  462. package/src/components/inspector-controls-tabs/index.js +1 -6
  463. package/src/components/inspector-controls-tabs/utils.js +0 -3
  464. package/src/components/link-control/link-preview.js +15 -8
  465. package/src/components/link-control/test/index.js +63 -24
  466. package/src/components/list-view/appender.js +5 -6
  467. package/src/components/list-view/branch.js +8 -6
  468. package/src/components/list-view/index.js +1 -2
  469. package/src/components/media-placeholder/index.js +4 -4
  470. package/src/components/provider/index.js +1 -3
  471. package/src/components/provider/test/experimental-provider.js +43 -1
  472. package/src/components/rich-text/event-listeners/index.js +4 -2
  473. package/src/components/rich-text/index.js +8 -1
  474. package/src/components/rich-text/index.native.js +0 -2
  475. package/src/components/spacing-sizes-control/index.js +3 -3
  476. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
  477. package/src/components/spacing-sizes-control/linked-button.js +2 -12
  478. package/src/components/tabbed-sidebar/index.js +1 -1
  479. package/src/components/tabbed-sidebar/style.scss +1 -1
  480. package/src/components/tool-selector/index.js +1 -5
  481. package/src/components/url-input/index.js +4 -5
  482. package/src/components/use-block-commands/index.js +245 -234
  483. package/src/components/use-block-drop-zone/index.js +5 -5
  484. package/src/components/use-block-drop-zone/index.native.js +0 -1
  485. package/src/components/use-moving-animation/index.js +0 -1
  486. package/src/components/use-settings/index.js +0 -1
  487. package/src/components/writing-flow/index.js +5 -3
  488. package/src/components/writing-flow/use-tab-nav.js +1 -2
  489. package/src/hooks/block-bindings.js +48 -31
  490. package/src/hooks/contrast-checker.js +0 -1
  491. package/src/hooks/duotone.js +2 -2
  492. package/src/hooks/font-family.js +1 -1
  493. package/src/hooks/style.js +7 -3
  494. package/src/hooks/supports.js +6 -6
  495. package/src/hooks/typography.js +5 -5
  496. package/src/hooks/use-zoom-out.js +14 -34
  497. package/src/hooks/utils.js +7 -2
  498. package/src/index.js +0 -1
  499. package/src/private-apis.js +6 -3
  500. package/src/store/actions.js +3 -52
  501. package/src/store/defaults.js +2 -1
  502. package/src/store/private-actions.js +71 -8
  503. package/src/store/private-selectors.js +14 -25
  504. package/src/store/reducer.js +25 -11
  505. package/src/store/selectors.js +116 -53
  506. package/src/store/test/actions.js +41 -0
  507. package/src/store/test/private-selectors.js +5 -0
  508. package/src/store/test/reducer.js +23 -0
  509. package/src/store/utils.js +12 -11
  510. package/src/utils/dom.js +42 -17
  511. package/src/utils/get-font-styles-and-weights.js +2 -2
  512. package/src/utils/test/dom.js +224 -0
  513. package/src/utils/transform-styles/index.js +3 -2
  514. package/tsconfig.json +1 -0
  515. package/tsconfig.tsbuildinfo +1 -1
  516. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -57
  517. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
  518. package/build/components/block-toolbar/shuffle.js +0 -110
  519. package/build/components/block-toolbar/shuffle.js.map +0 -1
  520. package/build/components/block-tools/zoom-out-popover.js +0 -58
  521. package/build/components/block-tools/zoom-out-popover.js.map +0 -1
  522. package/build/components/block-tools/zoom-out-toolbar.js +0 -132
  523. package/build/components/block-tools/zoom-out-toolbar.js.map +0 -1
  524. package/build/components/block-vertical-alignment-control/icons.js +0 -48
  525. package/build/components/block-vertical-alignment-control/icons.js.map +0 -1
  526. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -51
  527. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
  528. package/build-module/components/block-toolbar/shuffle.js +0 -103
  529. package/build-module/components/block-toolbar/shuffle.js.map +0 -1
  530. package/build-module/components/block-tools/zoom-out-popover.js +0 -49
  531. package/build-module/components/block-tools/zoom-out-popover.js.map +0 -1
  532. package/build-module/components/block-tools/zoom-out-toolbar.js +0 -124
  533. package/build-module/components/block-tools/zoom-out-toolbar.js.map +0 -1
  534. package/build-module/components/block-vertical-alignment-control/icons.js +0 -41
  535. package/build-module/components/block-vertical-alignment-control/icons.js.map +0 -1
  536. package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -65
  537. package/src/components/block-toolbar/shuffle.js +0 -111
  538. package/src/components/block-tools/zoom-out-popover.js +0 -47
  539. package/src/components/block-tools/zoom-out-toolbar.js +0 -135
  540. package/src/components/block-vertical-alignment-control/icons.js +0 -34
  541. /package/src/{lock-unlock.js → lock-unlock.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["Controller","useLayoutEffect","useMemo","useRef","getScrollContainer","useSelect","store","blockEditorStore","BLOCK_ANIMATION_THRESHOLD","getAbsolutePosition","element","top","offsetTop","left","offsetLeft","useMovingAnimation","triggerAnimationOnChange","clientId","ref","isTyping","getGlobalBlockCount","isBlockSelected","isFirstMultiSelectedBlock","isBlockMultiSelected","isAncestorMultiSelected","previous","prevRect","current","getBoundingClientRect","scrollContainer","isSelected","adjustScrolling","preserveScrollPosition","blockRect","diff","scrollTop","disableAnimation","window","matchMedia","matches","isPartOfSelection","zIndex","controller","x","y","config","mass","tension","friction","onChange","value","Math","round","finishedMoving","style","transformOrigin","transform","undefined","destination","start","from","stop","set"],"sources":["@wordpress/block-editor/src/components/use-moving-animation/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Controller } from '@react-spring/web';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\nfunction getAbsolutePosition( element ) {\n\treturn {\n\t\ttop: element.offsetTop,\n\t\tleft: element.offsetLeft,\n\t};\n}\n\n/**\n * Hook used to compute the styles required to move a div into a new position.\n *\n * The way this animation works is the following:\n * - It first renders the element as if there was no animation.\n * - It takes a snapshot of the position of the block to use it\n * as a destination point for the animation.\n * - It restores the element to the previous position using a CSS transform\n * - It uses the \"resetAnimation\" flag to reset the animation\n * from the beginning in order to animate to the new destination point.\n *\n * @param {Object} $1 Options\n * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.\n * @param {string} $1.clientId\n */\nfunction useMovingAnimation( { triggerAnimationOnChange, clientId } ) {\n\tconst ref = useRef();\n\tconst {\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t} = useSelect( blockEditorStore );\n\n\t// Whenever the trigger changes, we need to take a snapshot of the current\n\t// position of the block to use it as a destination point for the animation.\n\tconst { previous, prevRect } = useMemo(\n\t\t() => ( {\n\t\t\tprevious: ref.current && getAbsolutePosition( ref.current ),\n\t\t\tprevRect: ref.current && ref.current.getBoundingClientRect(),\n\t\t} ),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ triggerAnimationOnChange ]\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previous || ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst scrollContainer = getScrollContainer( ref.current );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst adjustScrolling =\n\t\t\tisSelected || isFirstMultiSelectedBlock( clientId );\n\n\t\tfunction preserveScrollPosition() {\n\t\t\tif ( adjustScrolling && prevRect ) {\n\t\t\t\tconst blockRect = ref.current.getBoundingClientRect();\n\t\t\t\tconst diff = blockRect.top - prevRect.top;\n\n\t\t\t\tif ( diff ) {\n\t\t\t\t\tscrollContainer.scrollTop += diff;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// We disable the animation if the user has a preference for reduced\n\t\t// motion, if the user is typing (insertion by Enter), or if the block\n\t\t// count exceeds the threshold (insertion caused all the blocks that\n\t\t// follow to animate).\n\t\t// To do: consider enableing the _moving_ animation even for large\n\t\t// posts, while only disabling the _insertion_ animation?\n\t\tconst disableAnimation =\n\t\t\twindow.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||\n\t\t\tisTyping() ||\n\t\t\tgetGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;\n\n\t\tif ( disableAnimation ) {\n\t\t\t// If the animation is disabled and the scroll needs to be adjusted,\n\t\t\t// just move directly to the final scroll position.\n\t\t\tpreserveScrollPosition();\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPartOfSelection =\n\t\t\tisSelected ||\n\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\tisAncestorMultiSelected( clientId );\n\t\t// Make sure the other blocks move under the selected block(s).\n\t\tconst zIndex = isPartOfSelection ? '1' : '';\n\n\t\tconst controller = new Controller( {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tconfig: { mass: 5, tension: 2000, friction: 200 },\n\t\t\tonChange( { value } ) {\n\t\t\t\tif ( ! ref.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet { x, y } = value;\n\t\t\t\tx = Math.round( x );\n\t\t\t\ty = Math.round( y );\n\t\t\t\tconst finishedMoving = x === 0 && y === 0;\n\t\t\t\tref.current.style.transformOrigin = 'center center';\n\t\t\t\tref.current.style.transform = finishedMoving\n\t\t\t\t\t? null // Set to `null` to explicitly remove the transform.\n\t\t\t\t\t: `translate3d(${ x }px,${ y }px,0)`;\n\t\t\t\tref.current.style.zIndex = zIndex;\n\t\t\t\tpreserveScrollPosition();\n\t\t\t},\n\t\t} );\n\n\t\tref.current.style.transform = undefined;\n\t\tconst destination = getAbsolutePosition( ref.current );\n\n\t\tconst x = Math.round( previous.left - destination.left );\n\t\tconst y = Math.round( previous.top - destination.top );\n\n\t\tcontroller.start( { x: 0, y: 0, from: { x, y } } );\n\n\t\treturn () => {\n\t\t\tcontroller.stop();\n\t\t\tcontroller.set( { x: 0, y: 0 } );\n\t\t};\n\t}, [\n\t\tprevious,\n\t\tprevRect,\n\t\tclientId,\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t] );\n\n\treturn ref;\n}\n\nexport default useMovingAnimation;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,mBAAmB;;AAE9C;AACA;AACA;AACA,SAASC,eAAe,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tB,CAAC;EAEH,OAAON,GAAG;AACX;AAEA,eAAeH,kBAAkB","ignoreList":[]}
1
+ {"version":3,"names":["Controller","useLayoutEffect","useMemo","useRef","getScrollContainer","useSelect","store","blockEditorStore","BLOCK_ANIMATION_THRESHOLD","getAbsolutePosition","element","top","offsetTop","left","offsetLeft","useMovingAnimation","triggerAnimationOnChange","clientId","ref","isTyping","getGlobalBlockCount","isBlockSelected","isFirstMultiSelectedBlock","isBlockMultiSelected","isAncestorMultiSelected","previous","prevRect","current","getBoundingClientRect","scrollContainer","isSelected","adjustScrolling","preserveScrollPosition","blockRect","diff","scrollTop","disableAnimation","window","matchMedia","matches","isPartOfSelection","zIndex","controller","x","y","config","mass","tension","friction","onChange","value","Math","round","finishedMoving","style","transformOrigin","transform","undefined","destination","start","from","stop","set"],"sources":["@wordpress/block-editor/src/components/use-moving-animation/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Controller } from '@react-spring/web';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\nfunction getAbsolutePosition( element ) {\n\treturn {\n\t\ttop: element.offsetTop,\n\t\tleft: element.offsetLeft,\n\t};\n}\n\n/**\n * Hook used to compute the styles required to move a div into a new position.\n *\n * The way this animation works is the following:\n * - It first renders the element as if there was no animation.\n * - It takes a snapshot of the position of the block to use it\n * as a destination point for the animation.\n * - It restores the element to the previous position using a CSS transform\n * - It uses the \"resetAnimation\" flag to reset the animation\n * from the beginning in order to animate to the new destination point.\n *\n * @param {Object} $1 Options\n * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.\n * @param {string} $1.clientId\n */\nfunction useMovingAnimation( { triggerAnimationOnChange, clientId } ) {\n\tconst ref = useRef();\n\tconst {\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t} = useSelect( blockEditorStore );\n\n\t// Whenever the trigger changes, we need to take a snapshot of the current\n\t// position of the block to use it as a destination point for the animation.\n\tconst { previous, prevRect } = useMemo(\n\t\t() => ( {\n\t\t\tprevious: ref.current && getAbsolutePosition( ref.current ),\n\t\t\tprevRect: ref.current && ref.current.getBoundingClientRect(),\n\t\t} ),\n\t\t[ triggerAnimationOnChange ]\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previous || ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst scrollContainer = getScrollContainer( ref.current );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst adjustScrolling =\n\t\t\tisSelected || isFirstMultiSelectedBlock( clientId );\n\n\t\tfunction preserveScrollPosition() {\n\t\t\tif ( adjustScrolling && prevRect ) {\n\t\t\t\tconst blockRect = ref.current.getBoundingClientRect();\n\t\t\t\tconst diff = blockRect.top - prevRect.top;\n\n\t\t\t\tif ( diff ) {\n\t\t\t\t\tscrollContainer.scrollTop += diff;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// We disable the animation if the user has a preference for reduced\n\t\t// motion, if the user is typing (insertion by Enter), or if the block\n\t\t// count exceeds the threshold (insertion caused all the blocks that\n\t\t// follow to animate).\n\t\t// To do: consider enableing the _moving_ animation even for large\n\t\t// posts, while only disabling the _insertion_ animation?\n\t\tconst disableAnimation =\n\t\t\twindow.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||\n\t\t\tisTyping() ||\n\t\t\tgetGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;\n\n\t\tif ( disableAnimation ) {\n\t\t\t// If the animation is disabled and the scroll needs to be adjusted,\n\t\t\t// just move directly to the final scroll position.\n\t\t\tpreserveScrollPosition();\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPartOfSelection =\n\t\t\tisSelected ||\n\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\tisAncestorMultiSelected( clientId );\n\t\t// Make sure the other blocks move under the selected block(s).\n\t\tconst zIndex = isPartOfSelection ? '1' : '';\n\n\t\tconst controller = new Controller( {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tconfig: { mass: 5, tension: 2000, friction: 200 },\n\t\t\tonChange( { value } ) {\n\t\t\t\tif ( ! ref.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet { x, y } = value;\n\t\t\t\tx = Math.round( x );\n\t\t\t\ty = Math.round( y );\n\t\t\t\tconst finishedMoving = x === 0 && y === 0;\n\t\t\t\tref.current.style.transformOrigin = 'center center';\n\t\t\t\tref.current.style.transform = finishedMoving\n\t\t\t\t\t? null // Set to `null` to explicitly remove the transform.\n\t\t\t\t\t: `translate3d(${ x }px,${ y }px,0)`;\n\t\t\t\tref.current.style.zIndex = zIndex;\n\t\t\t\tpreserveScrollPosition();\n\t\t\t},\n\t\t} );\n\n\t\tref.current.style.transform = undefined;\n\t\tconst destination = getAbsolutePosition( ref.current );\n\n\t\tconst x = Math.round( previous.left - destination.left );\n\t\tconst y = Math.round( previous.top - destination.top );\n\n\t\tcontroller.start( { x: 0, y: 0, from: { x, y } } );\n\n\t\treturn () => {\n\t\t\tcontroller.stop();\n\t\t\tcontroller.set( { x: 0, y: 0 } );\n\t\t};\n\t}, [\n\t\tprevious,\n\t\tprevRect,\n\t\tclientId,\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t] );\n\n\treturn ref;\n}\n\nexport default useMovingAnimation;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,mBAAmB;;AAE9C;AACA;AACA;AACA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AAuB,CACtB,CAAC;EAEH,OAAON,GAAG;AACX;AAEA,eAAeH,kBAAkB","ignoreList":[]}
@@ -28,9 +28,7 @@ export function useSettings(...paths) {
28
28
  const {
29
29
  clientId = null
30
30
  } = useBlockEditContext();
31
- return useSelect(select => unlock(select(blockEditorStore)).getBlockSettings(clientId, ...paths),
32
- // eslint-disable-next-line react-hooks/exhaustive-deps
33
- [clientId, ...paths]);
31
+ return useSelect(select => unlock(select(blockEditorStore)).getBlockSettings(clientId, ...paths), [clientId, ...paths]);
34
32
  }
35
33
 
36
34
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","deprecated","useBlockEditContext","store","blockEditorStore","unlock","useSettings","paths","clientId","select","getBlockSettings","useSetting","path","since","alternative","note","value"],"sources":["@wordpress/block-editor/src/components/use-settings/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Hook that retrieves the given settings for the block instance in use.\n *\n * It looks up the settings first in the block instance hierarchy.\n * If none are found, it'll look them up in the block editor settings.\n *\n * @param {string[]} paths The paths to the settings.\n * @return {any[]} Returns the values defined for the settings.\n * @example\n * ```js\n * const [ fixed, sticky ] = useSettings( 'position.fixed', 'position.sticky' );\n * ```\n */\nexport function useSettings( ...paths ) {\n\tconst { clientId = null } = useBlockEditContext();\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getBlockSettings(\n\t\t\t\tclientId,\n\t\t\t\t...paths\n\t\t\t),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ clientId, ...paths ]\n\t);\n}\n\n/**\n * Hook that retrieves the given setting for the block instance in use.\n *\n * It looks up the setting first in the block instance hierarchy.\n * If none is found, it'll look it up in the block editor settings.\n *\n * @deprecated 6.5.0 Use useSettings instead.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport function useSetting( path ) {\n\tdeprecated( 'wp.blockEditor.useSetting', {\n\t\tsince: '6.5',\n\t\talternative: 'wp.blockEditor.useSettings',\n\t\tnote: 'The new useSettings function can retrieve multiple settings at once, with better performance.',\n\t} );\n\n\tconst [ value ] = useSettings( path );\n\treturn value;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAE,GAAGC,KAAK,EAAG;EACvC,MAAM;IAAEC,QAAQ,GAAG;EAAK,CAAC,GAAGN,mBAAmB,CAAC,CAAC;EACjD,OAAOF,SAAS,CACbS,MAAM,IACPJ,MAAM,CAAEI,MAAM,CAAEL,gBAAiB,CAAE,CAAC,CAACM,gBAAgB,CACpDF,QAAQ,EACR,GAAGD,KACJ,CAAC;EACF;EACA,CAAEC,QAAQ,EAAE,GAAGD,KAAK,CACrB,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,UAAUA,CAAEC,IAAI,EAAG;EAClCX,UAAU,CAAE,2BAA2B,EAAE;IACxCY,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE,4BAA4B;IACzCC,IAAI,EAAE;EACP,CAAE,CAAC;EAEH,MAAM,CAAEC,KAAK,CAAE,GAAGV,WAAW,CAAEM,IAAK,CAAC;EACrC,OAAOI,KAAK;AACb","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","deprecated","useBlockEditContext","store","blockEditorStore","unlock","useSettings","paths","clientId","select","getBlockSettings","useSetting","path","since","alternative","note","value"],"sources":["@wordpress/block-editor/src/components/use-settings/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Hook that retrieves the given settings for the block instance in use.\n *\n * It looks up the settings first in the block instance hierarchy.\n * If none are found, it'll look them up in the block editor settings.\n *\n * @param {string[]} paths The paths to the settings.\n * @return {any[]} Returns the values defined for the settings.\n * @example\n * ```js\n * const [ fixed, sticky ] = useSettings( 'position.fixed', 'position.sticky' );\n * ```\n */\nexport function useSettings( ...paths ) {\n\tconst { clientId = null } = useBlockEditContext();\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getBlockSettings(\n\t\t\t\tclientId,\n\t\t\t\t...paths\n\t\t\t),\n\t\t[ clientId, ...paths ]\n\t);\n}\n\n/**\n * Hook that retrieves the given setting for the block instance in use.\n *\n * It looks up the setting first in the block instance hierarchy.\n * If none is found, it'll look it up in the block editor settings.\n *\n * @deprecated 6.5.0 Use useSettings instead.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport function useSetting( path ) {\n\tdeprecated( 'wp.blockEditor.useSetting', {\n\t\tsince: '6.5',\n\t\talternative: 'wp.blockEditor.useSettings',\n\t\tnote: 'The new useSettings function can retrieve multiple settings at once, with better performance.',\n\t} );\n\n\tconst [ value ] = useSettings( path );\n\treturn value;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAE,GAAGC,KAAK,EAAG;EACvC,MAAM;IAAEC,QAAQ,GAAG;EAAK,CAAC,GAAGN,mBAAmB,CAAC,CAAC;EACjD,OAAOF,SAAS,CACbS,MAAM,IACPJ,MAAM,CAAEI,MAAM,CAAEL,gBAAiB,CAAE,CAAC,CAACM,gBAAgB,CACpDF,QAAQ,EACR,GAAGD,KACJ,CAAC,EACF,CAAEC,QAAQ,EAAE,GAAGD,KAAK,CACrB,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,UAAUA,CAAEC,IAAI,EAAG;EAClCX,UAAU,CAAE,2BAA2B,EAAE;IACxCY,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE,4BAA4B;IACzCC,IAAI,EAAE;EACP,CAAE,CAAC;EAEH,MAAM,CAAEC,KAAK,CAAE,GAAGV,WAAW,CAAEM,IAAK,CAAC;EACrC,OAAOI,KAAK;AACb","ignoreList":[]}
@@ -30,13 +30,15 @@ export function useWritingFlow() {
30
30
  const hasMultiSelection = useSelect(select => select(blockEditorStore).hasMultiSelection(), []);
31
31
  return [before, useMergeRefs([ref, useClipboardHandler(), useInput(), useDragSelection(), useSelectionObserver(), useClickSelection(), useMultiSelection(), useSelectAll(), useArrowNav(), useRefEffect(node => {
32
32
  node.tabIndex = 0;
33
+ node.dataset.hasMultiSelection = hasMultiSelection;
33
34
  if (!hasMultiSelection) {
34
- return;
35
+ return () => {
36
+ delete node.dataset.hasMultiSelection;
37
+ };
35
38
  }
36
- node.classList.add('has-multi-selection');
37
39
  node.setAttribute('aria-label', __('Multiple selected blocks'));
38
40
  return () => {
39
- node.classList.remove('has-multi-selection');
41
+ delete node.dataset.hasMultiSelection;
40
42
  node.removeAttribute('aria-label');
41
43
  };
42
44
  }, [hasMultiSelection])]), after];
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useSelect","__","useMergeRefs","useRefEffect","forwardRef","useMultiSelection","useTabNav","useArrowNav","useSelectAll","useDragSelection","useSelectionObserver","useClickSelection","useInput","useClipboardHandler","store","blockEditorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useWritingFlow","before","ref","after","hasMultiSelection","select","node","tabIndex","classList","add","setAttribute","remove","removeAttribute","WritingFlow","children","props","forwardedRef","className"],"sources":["@wordpress/block-editor/src/components/writing-flow/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useMergeRefs, useRefEffect } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useMultiSelection from './use-multi-selection';\nimport useTabNav from './use-tab-nav';\nimport useArrowNav from './use-arrow-nav';\nimport useSelectAll from './use-select-all';\nimport useDragSelection from './use-drag-selection';\nimport useSelectionObserver from './use-selection-observer';\nimport useClickSelection from './use-click-selection';\nimport useInput from './use-input';\nimport useClipboardHandler from './use-clipboard-handler';\nimport { store as blockEditorStore } from '../../store';\n\nexport function useWritingFlow() {\n\tconst [ before, ref, after ] = useTabNav();\n\tconst hasMultiSelection = useSelect(\n\t\t( select ) => select( blockEditorStore ).hasMultiSelection(),\n\t\t[]\n\t);\n\n\treturn [\n\t\tbefore,\n\t\tuseMergeRefs( [\n\t\t\tref,\n\t\t\tuseClipboardHandler(),\n\t\t\tuseInput(),\n\t\t\tuseDragSelection(),\n\t\t\tuseSelectionObserver(),\n\t\t\tuseClickSelection(),\n\t\t\tuseMultiSelection(),\n\t\t\tuseSelectAll(),\n\t\t\tuseArrowNav(),\n\t\t\tuseRefEffect(\n\t\t\t\t( node ) => {\n\t\t\t\t\tnode.tabIndex = 0;\n\n\t\t\t\t\tif ( ! hasMultiSelection ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tnode.classList.add( 'has-multi-selection' );\n\t\t\t\t\tnode.setAttribute(\n\t\t\t\t\t\t'aria-label',\n\t\t\t\t\t\t__( 'Multiple selected blocks' )\n\t\t\t\t\t);\n\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tnode.classList.remove( 'has-multi-selection' );\n\t\t\t\t\t\tnode.removeAttribute( 'aria-label' );\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t[ hasMultiSelection ]\n\t\t\t),\n\t\t] ),\n\t\tafter,\n\t];\n}\n\nfunction WritingFlow( { children, ...props }, forwardedRef ) {\n\tconst [ before, ref, after ] = useWritingFlow();\n\treturn (\n\t\t<>\n\t\t\t{ before }\n\t\t\t<div\n\t\t\t\t{ ...props }\n\t\t\t\tref={ useMergeRefs( [ ref, forwardedRef ] ) }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'block-editor-writing-flow'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t\t{ after }\n\t\t</>\n\t);\n}\n\n/**\n * Handles selection and navigation across blocks. This component should be\n * wrapped around BlockList.\n *\n * @param {Object} props Component properties.\n * @param {Element} props.children Children to be rendered.\n */\nexport default forwardRef( WritingFlow );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,EAAEC,YAAY,QAAQ,oBAAoB;AAC/D,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,OAAOC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2B,IAAI,CAACE,SAAS,CAACG,MAAM,CAAE,qBAAsB,CAAC;MAC9CL,IAAI,CAACM,eAAe,CAAE,YAAa,CAAC;IACrC,CAAC;EACF,CAAC,EACD,CAAER,iBAAiB,CACpB,CAAC,CACA,CAAC,EACHD,KAAK,CACL;AACF;AAEA,SAASU,WAAWA,CAAE;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,YAAY,EAAG;EAC5D,MAAM,CAAEf,MAAM,EAAEC,GAAG,EAAEC,KAAK,CAAE,GAAGH,cAAc,CAAC,CAAC;EAC/C,oBACCD,KAAA,CAAAF,SAAA;IAAAiB,QAAA,GACGb,MAAM,eACRN,IAAA;MAAA,GACMoB,KAAK;MACVb,GAAG,EAAGtB,YAAY,CAAE,CAAEsB,GAAG,EAAEc,YAAY,CAAG,CAAG;MAC7CC,SAAS,EAAGxC,IAAI,CACfsC,KAAK,CAACE,SAAS,EACf,2BACD,CAAG;MAAAH,QAAA,EAEDA;IAAQ,CACN,CAAC,EACJX,KAAK;EAAA,CACN,CAAC;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAerB,UAAU,CAAE+B,WAAY,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useSelect","__","useMergeRefs","useRefEffect","forwardRef","useMultiSelection","useTabNav","useArrowNav","useSelectAll","useDragSelection","useSelectionObserver","useClickSelection","useInput","useClipboardHandler","store","blockEditorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useWritingFlow","before","ref","after","hasMultiSelection","select","node","tabIndex","dataset","setAttribute","removeAttribute","WritingFlow","children","props","forwardedRef","className"],"sources":["@wordpress/block-editor/src/components/writing-flow/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useMergeRefs, useRefEffect } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useMultiSelection from './use-multi-selection';\nimport useTabNav from './use-tab-nav';\nimport useArrowNav from './use-arrow-nav';\nimport useSelectAll from './use-select-all';\nimport useDragSelection from './use-drag-selection';\nimport useSelectionObserver from './use-selection-observer';\nimport useClickSelection from './use-click-selection';\nimport useInput from './use-input';\nimport useClipboardHandler from './use-clipboard-handler';\nimport { store as blockEditorStore } from '../../store';\n\nexport function useWritingFlow() {\n\tconst [ before, ref, after ] = useTabNav();\n\tconst hasMultiSelection = useSelect(\n\t\t( select ) => select( blockEditorStore ).hasMultiSelection(),\n\t\t[]\n\t);\n\n\treturn [\n\t\tbefore,\n\t\tuseMergeRefs( [\n\t\t\tref,\n\t\t\tuseClipboardHandler(),\n\t\t\tuseInput(),\n\t\t\tuseDragSelection(),\n\t\t\tuseSelectionObserver(),\n\t\t\tuseClickSelection(),\n\t\t\tuseMultiSelection(),\n\t\t\tuseSelectAll(),\n\t\t\tuseArrowNav(),\n\t\t\tuseRefEffect(\n\t\t\t\t( node ) => {\n\t\t\t\t\tnode.tabIndex = 0;\n\t\t\t\t\tnode.dataset.hasMultiSelection = hasMultiSelection;\n\n\t\t\t\t\tif ( ! hasMultiSelection ) {\n\t\t\t\t\t\treturn () => {\n\t\t\t\t\t\t\tdelete node.dataset.hasMultiSelection;\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\tnode.setAttribute(\n\t\t\t\t\t\t'aria-label',\n\t\t\t\t\t\t__( 'Multiple selected blocks' )\n\t\t\t\t\t);\n\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tdelete node.dataset.hasMultiSelection;\n\t\t\t\t\t\tnode.removeAttribute( 'aria-label' );\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t[ hasMultiSelection ]\n\t\t\t),\n\t\t] ),\n\t\tafter,\n\t];\n}\n\nfunction WritingFlow( { children, ...props }, forwardedRef ) {\n\tconst [ before, ref, after ] = useWritingFlow();\n\treturn (\n\t\t<>\n\t\t\t{ before }\n\t\t\t<div\n\t\t\t\t{ ...props }\n\t\t\t\tref={ useMergeRefs( [ ref, forwardedRef ] ) }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'block-editor-writing-flow'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t\t{ after }\n\t\t</>\n\t);\n}\n\n/**\n * Handles selection and navigation across blocks. This component should be\n * wrapped around BlockList.\n *\n * @param {Object} props Component properties.\n * @param {Element} props.children Children to be rendered.\n */\nexport default forwardRef( WritingFlow );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,EAAEC,YAAY,QAAQ,oBAAoB;AAC/D,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,OAAOC,SAAS,MAAM,eAAe;AACrC,OAAOC,WAAW,MAAM,iBAAiB;AACzC,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,OAAOC,QAAQ,MAAM,aAAa;AAClC,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAExD,OAAO,SAASC,cAAcA,CAAA,EAAG;EAChC,MAAM,CAAEC,MAAM,EAAEC,GAAG,EAAEC,KAAK,CAAE,GAAGnB,SAAS,CAAC,CAAC;EAC1C,MAAMoB,iBAAiB,GAAG1B,SAAS,CAChC2B,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CACfoC,KAAK,CAACE,SAAS,EACf,2BACD,CAAG;MAAAH,QAAA,EAEDA;IAAQ,CACN,CAAC,EACJT,KAAK;EAAA,CACN,CAAC;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAerB,UAAU,CAAE6B,WAAY,CAAC","ignoreList":[]}
@@ -25,8 +25,7 @@ export default function useTabNav() {
25
25
  getBlockOrder,
26
26
  getLastFocus,
27
27
  getSectionRootClientId,
28
- isZoomOut,
29
- __unstableGetEditorMode
28
+ isZoomOut
30
29
  } = unlock(useSelect(blockEditorStore));
31
30
  const {
32
31
  setLastFocus
@@ -50,7 +49,7 @@ export default function useTabNav() {
50
49
  }
51
50
  }
52
51
  // In "compose" mode without a selected ID, we want to place focus on the section root when tabbing to the canvas.
53
- else if (__unstableGetEditorMode() === 'zoom-out' && isZoomOut()) {
52
+ else if (isZoomOut()) {
54
53
  const sectionRootClientId = getSectionRootClientId();
55
54
  const sectionBlocks = getBlockOrder(sectionRootClientId);
56
55
 
@@ -1 +1 @@
1
- {"version":3,"names":["focus","isFormElement","TAB","useSelect","useDispatch","useRefEffect","useMergeRefs","useRef","store","blockEditorStore","isInSameBlock","isInsideRootBlock","unlock","jsx","_jsx","useTabNav","container","focusCaptureBeforeRef","focusCaptureAfterRef","hasMultiSelection","getSelectedBlockClientId","getBlockCount","getBlockOrder","getLastFocus","getSectionRootClientId","isZoomOut","__unstableGetEditorMode","setLastFocus","noCaptureRef","onFocusCapture","event","current","querySelector","sectionRootClientId","sectionBlocks","length","canvasElement","ownerDocument","target","defaultView","frameElement","isBefore","compareDocumentPosition","DOCUMENT_POSITION_FOLLOWING","tabbables","tabbable","find","next","before","ref","tabIndex","onFocus","after","node","onKeyDown","defaultPrevented","keyCode","isShift","shiftKey","direction","nextTabbable","currentBlock","closest","isElementPartOfSelectedBlock","preventScroll","onFocusOut","relatedTarget","activeElement","body","preventScrollOnTab","getAttribute","preventDefault","addEventListener","removeEventListener","mergedRefs"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-tab-nav.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { focus, isFormElement } from '@wordpress/dom';\nimport { TAB } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { isInSameBlock, isInsideRootBlock } from '../../utils/dom';\nimport { unlock } from '../../lock-unlock';\n\nexport default function useTabNav() {\n\tconst container = useRef();\n\tconst focusCaptureBeforeRef = useRef();\n\tconst focusCaptureAfterRef = useRef();\n\n\tconst {\n\t\thasMultiSelection,\n\t\tgetSelectedBlockClientId,\n\t\tgetBlockCount,\n\t\tgetBlockOrder,\n\t\tgetLastFocus,\n\t\tgetSectionRootClientId,\n\t\tisZoomOut,\n\t\t__unstableGetEditorMode,\n\t} = unlock( useSelect( blockEditorStore ) );\n\tconst { setLastFocus } = unlock( useDispatch( blockEditorStore ) );\n\n\t// Reference that holds the a flag for enabling or disabling\n\t// capturing on the focus capture elements.\n\tconst noCaptureRef = useRef();\n\n\tfunction onFocusCapture( event ) {\n\t\t// Do not capture incoming focus if set by us in WritingFlow.\n\t\tif ( noCaptureRef.current ) {\n\t\t\tnoCaptureRef.current = null;\n\t\t} else if ( hasMultiSelection() ) {\n\t\t\tcontainer.current.focus();\n\t\t} else if ( getSelectedBlockClientId() ) {\n\t\t\tif ( getLastFocus()?.current ) {\n\t\t\t\tgetLastFocus().current.focus();\n\t\t\t} else {\n\t\t\t\t// Handles when the last focus has not been set yet, or has been cleared by new blocks being added via the inserter.\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector(\n\t\t\t\t\t\t`[data-block=\"${ getSelectedBlockClientId() }\"]`\n\t\t\t\t\t)\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t}\n\t\t// In \"compose\" mode without a selected ID, we want to place focus on the section root when tabbing to the canvas.\n\t\telse if ( __unstableGetEditorMode() === 'zoom-out' && isZoomOut() ) {\n\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\t\t\tconst sectionBlocks = getBlockOrder( sectionRootClientId );\n\n\t\t\t// If we have section within the section root, focus the first one.\n\t\t\tif ( sectionBlocks.length ) {\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector( `[data-block=\"${ sectionBlocks[ 0 ] }\"]` )\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t\t// If we don't have any section blocks, focus the section root.\n\t\t\telse {\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector( `[data-block=\"${ sectionRootClientId }\"]` )\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t} else {\n\t\t\tconst canvasElement =\n\t\t\t\tcontainer.current.ownerDocument === event.target.ownerDocument\n\t\t\t\t\t? container.current\n\t\t\t\t\t: container.current.ownerDocument.defaultView.frameElement;\n\n\t\t\tconst isBefore =\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tevent.target.compareDocumentPosition( canvasElement ) &\n\t\t\t\tevent.target.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tconst tabbables = focus.tabbable.find( container.current );\n\n\t\t\tif ( tabbables.length ) {\n\t\t\t\tconst next = isBefore\n\t\t\t\t\t? tabbables[ 0 ]\n\t\t\t\t\t: tabbables[ tabbables.length - 1 ];\n\t\t\t\tnext.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst before = (\n\t\t<div\n\t\t\tref={ focusCaptureBeforeRef }\n\t\t\ttabIndex=\"0\"\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst after = (\n\t\t<div\n\t\t\tref={ focusCaptureAfterRef }\n\t\t\ttabIndex=\"0\"\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst ref = useRefEffect( ( node ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// In Edit mode, Tab should focus the first tabbable element after\n\t\t\t// the content, which is normally the sidebar (with block controls)\n\t\t\t// and Shift+Tab should focus the first tabbable element before the\n\t\t\t// content, which is normally the block toolbar.\n\t\t\t// Arrow keys can be used, and Tab and arrow keys can be used in\n\t\t\t// Navigation mode (press Esc), to navigate through blocks.\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst nextTabbable = focus.tabbable[ direction ]( event.target );\n\n\t\t\t// We want to constrain the tabbing to the block and its child blocks.\n\t\t\t// If the preceding form element is within a different block,\n\t\t\t// such as two sibling image blocks in the placeholder state,\n\t\t\t// we want shift + tab from the first form element to move to the image\n\t\t\t// block toolbar and not the previous image block's form element.\n\t\t\tconst currentBlock = event.target.closest( '[data-block]' );\n\t\t\tconst isElementPartOfSelectedBlock =\n\t\t\t\tcurrentBlock &&\n\t\t\t\tnextTabbable &&\n\t\t\t\t( isInSameBlock( currentBlock, nextTabbable ) ||\n\t\t\t\t\tisInsideRootBlock( currentBlock, nextTabbable ) );\n\n\t\t\t// Allow tabbing from the block wrapper to a form element,\n\t\t\t// and between form elements rendered in a block and its child blocks,\n\t\t\t// such as inside a placeholder. Form elements are generally\n\t\t\t// meant to be UI rather than part of the content. Ideally\n\t\t\t// these are not rendered in the content and perhaps in the\n\t\t\t// future they can be rendered in an iframe or shadow DOM.\n\t\t\tif (\n\t\t\t\tisFormElement( nextTabbable ) &&\n\t\t\t\tisElementPartOfSelectedBlock\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef;\n\n\t\t\t// Disable focus capturing on the focus capture element, so it\n\t\t\t// doesn't refocus this block and so it allows default behaviour\n\t\t\t// (moving focus to the next tabbable element).\n\t\t\tnoCaptureRef.current = true;\n\n\t\t\t// Focusing the focus capture element, which is located above and\n\t\t\t// below the editor, should not scroll the page all the way up or\n\t\t\t// down.\n\t\t\tnext.current.focus( { preventScroll: true } );\n\t\t}\n\n\t\tfunction onFocusOut( event ) {\n\t\t\tsetLastFocus( { ...getLastFocus(), current: event.target } );\n\n\t\t\tconst { ownerDocument } = node;\n\n\t\t\t// If focus disappears due to there being no blocks, move focus to\n\t\t\t// the writing flow wrapper.\n\t\t\tif (\n\t\t\t\t! event.relatedTarget &&\n\t\t\t\townerDocument.activeElement === ownerDocument.body &&\n\t\t\t\tgetBlockCount() === 0\n\t\t\t) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t}\n\n\t\t// When tabbing back to an element in block list, this event handler prevents scrolling if the\n\t\t// focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph\n\t\t// when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the\n\t\t// top or bottom of the document.\n\t\t//\n\t\t// Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this\n\t\t// earlier in the keypress handler, and call focus( { preventScroll: true } ) instead.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters\n\t\tfunction preventScrollOnTab( event ) {\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.target?.getAttribute( 'role' ) === 'region' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( container.current === event.target ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst target = focus.tabbable[ direction ]( event.target );\n\t\t\t// Only do something when the next tabbable is a focus capture div (before/after)\n\t\t\tif (\n\t\t\t\ttarget === focusCaptureBeforeRef.current ||\n\t\t\t\ttarget === focusCaptureAfterRef.current\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttarget.focus( { preventScroll: true } );\n\t\t\t}\n\t\t}\n\n\t\tconst { ownerDocument } = node;\n\t\tconst { defaultView } = ownerDocument;\n\t\tdefaultView.addEventListener( 'keydown', preventScrollOnTab );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\tnode.addEventListener( 'focusout', onFocusOut );\n\t\treturn () => {\n\t\t\tdefaultView.removeEventListener( 'keydown', preventScrollOnTab );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tnode.removeEventListener( 'focusout', onFocusOut );\n\t\t};\n\t}, [] );\n\n\tconst mergedRefs = useMergeRefs( [ container, ref ] );\n\n\treturn [ before, mergedRefs, after ];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,aAAa,QAAQ,gBAAgB;AACrD,SAASC,GAAG,QAAQ,qBAAqB;AACzC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,EAAEC,YAAY,QAAQ,oBAAoB;AAC/D,SAASC,MAAM,QAAQ,oBAAoB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,iBAAiB;AAClE,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,eAAe,SAASC,SAASA,CAAA,EAAG;EACnC,MAAMC,SAAS,GAAGT,MAAM,CAAC,CAAC;EAC1B,MAAMU,qBAAqB,GAAGV,MAAM,CAAC,CAAC;EACtC,MAAMW,oBAAoB,GAAGX,MAAM,CAAC,CAAC;EAErC,MAAM;IACLY,iBAAiB;IACjBC,wBAAwB;IACxBC,aAAa;IACbC,aAAa;IACbC,YAAY;IACZC,sBAAsB;IACtBC,SAAS;IACTC;EACD,CAAC,GAAGd,MAAM,CAAET,SAAS,CAAEM,gBAAiB,CAAE,CAAC;EAC3C,MAAM;IAAEkB;EAAa,CAAC,GAAGf,MAAM,CAAER,WAAW,CAAEK,gBAAiB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ergeRefs","useRef","store","blockEditorStore","isInSameBlock","isInsideRootBlock","unlock","jsx","_jsx","useTabNav","container","focusCaptureBeforeRef","focusCaptureAfterRef","hasMultiSelection","getSelectedBlockClientId","getBlockCount","getBlockOrder","getLastFocus","getSectionRootClientId","isZoomOut","setLastFocus","noCaptureRef","onFocusCapture","event","current","querySelector","sectionRootClientId","sectionBlocks","length","canvasElement","ownerDocument","target","defaultView","frameElement","isBefore","compareDocumentPosition","DOCUMENT_POSITION_FOLLOWING","tabbables","tabbable","find","next","before","ref","tabIndex","onFocus","after","node","onKeyDown","defaultPrevented","keyCode","isShift","shiftKey","direction","nextTabbable","currentBlock","closest","isElementPartOfSelectedBlock","preventScroll","onFocusOut","relatedTarget","activeElement","body","preventScrollOnTab","getAttribute","preventDefault","addEventListener","removeEventListener","mergedRefs"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-tab-nav.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { focus, isFormElement } from '@wordpress/dom';\nimport { TAB } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { isInSameBlock, isInsideRootBlock } from '../../utils/dom';\nimport { unlock } from '../../lock-unlock';\n\nexport default function useTabNav() {\n\tconst container = useRef();\n\tconst focusCaptureBeforeRef = useRef();\n\tconst focusCaptureAfterRef = useRef();\n\n\tconst {\n\t\thasMultiSelection,\n\t\tgetSelectedBlockClientId,\n\t\tgetBlockCount,\n\t\tgetBlockOrder,\n\t\tgetLastFocus,\n\t\tgetSectionRootClientId,\n\t\tisZoomOut,\n\t} = unlock( useSelect( blockEditorStore ) );\n\tconst { setLastFocus } = unlock( useDispatch( blockEditorStore ) );\n\n\t// Reference that holds the a flag for enabling or disabling\n\t// capturing on the focus capture elements.\n\tconst noCaptureRef = useRef();\n\n\tfunction onFocusCapture( event ) {\n\t\t// Do not capture incoming focus if set by us in WritingFlow.\n\t\tif ( noCaptureRef.current ) {\n\t\t\tnoCaptureRef.current = null;\n\t\t} else if ( hasMultiSelection() ) {\n\t\t\tcontainer.current.focus();\n\t\t} else if ( getSelectedBlockClientId() ) {\n\t\t\tif ( getLastFocus()?.current ) {\n\t\t\t\tgetLastFocus().current.focus();\n\t\t\t} else {\n\t\t\t\t// Handles when the last focus has not been set yet, or has been cleared by new blocks being added via the inserter.\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector(\n\t\t\t\t\t\t`[data-block=\"${ getSelectedBlockClientId() }\"]`\n\t\t\t\t\t)\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t}\n\t\t// In \"compose\" mode without a selected ID, we want to place focus on the section root when tabbing to the canvas.\n\t\telse if ( isZoomOut() ) {\n\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\t\t\tconst sectionBlocks = getBlockOrder( sectionRootClientId );\n\n\t\t\t// If we have section within the section root, focus the first one.\n\t\t\tif ( sectionBlocks.length ) {\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector( `[data-block=\"${ sectionBlocks[ 0 ] }\"]` )\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t\t// If we don't have any section blocks, focus the section root.\n\t\t\telse {\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector( `[data-block=\"${ sectionRootClientId }\"]` )\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t} else {\n\t\t\tconst canvasElement =\n\t\t\t\tcontainer.current.ownerDocument === event.target.ownerDocument\n\t\t\t\t\t? container.current\n\t\t\t\t\t: container.current.ownerDocument.defaultView.frameElement;\n\n\t\t\tconst isBefore =\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tevent.target.compareDocumentPosition( canvasElement ) &\n\t\t\t\tevent.target.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tconst tabbables = focus.tabbable.find( container.current );\n\n\t\t\tif ( tabbables.length ) {\n\t\t\t\tconst next = isBefore\n\t\t\t\t\t? tabbables[ 0 ]\n\t\t\t\t\t: tabbables[ tabbables.length - 1 ];\n\t\t\t\tnext.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst before = (\n\t\t<div\n\t\t\tref={ focusCaptureBeforeRef }\n\t\t\ttabIndex=\"0\"\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst after = (\n\t\t<div\n\t\t\tref={ focusCaptureAfterRef }\n\t\t\ttabIndex=\"0\"\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst ref = useRefEffect( ( node ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// In Edit mode, Tab should focus the first tabbable element after\n\t\t\t// the content, which is normally the sidebar (with block controls)\n\t\t\t// and Shift+Tab should focus the first tabbable element before the\n\t\t\t// content, which is normally the block toolbar.\n\t\t\t// Arrow keys can be used, and Tab and arrow keys can be used in\n\t\t\t// Navigation mode (press Esc), to navigate through blocks.\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst nextTabbable = focus.tabbable[ direction ]( event.target );\n\n\t\t\t// We want to constrain the tabbing to the block and its child blocks.\n\t\t\t// If the preceding form element is within a different block,\n\t\t\t// such as two sibling image blocks in the placeholder state,\n\t\t\t// we want shift + tab from the first form element to move to the image\n\t\t\t// block toolbar and not the previous image block's form element.\n\t\t\tconst currentBlock = event.target.closest( '[data-block]' );\n\t\t\tconst isElementPartOfSelectedBlock =\n\t\t\t\tcurrentBlock &&\n\t\t\t\tnextTabbable &&\n\t\t\t\t( isInSameBlock( currentBlock, nextTabbable ) ||\n\t\t\t\t\tisInsideRootBlock( currentBlock, nextTabbable ) );\n\n\t\t\t// Allow tabbing from the block wrapper to a form element,\n\t\t\t// and between form elements rendered in a block and its child blocks,\n\t\t\t// such as inside a placeholder. Form elements are generally\n\t\t\t// meant to be UI rather than part of the content. Ideally\n\t\t\t// these are not rendered in the content and perhaps in the\n\t\t\t// future they can be rendered in an iframe or shadow DOM.\n\t\t\tif (\n\t\t\t\tisFormElement( nextTabbable ) &&\n\t\t\t\tisElementPartOfSelectedBlock\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef;\n\n\t\t\t// Disable focus capturing on the focus capture element, so it\n\t\t\t// doesn't refocus this block and so it allows default behaviour\n\t\t\t// (moving focus to the next tabbable element).\n\t\t\tnoCaptureRef.current = true;\n\n\t\t\t// Focusing the focus capture element, which is located above and\n\t\t\t// below the editor, should not scroll the page all the way up or\n\t\t\t// down.\n\t\t\tnext.current.focus( { preventScroll: true } );\n\t\t}\n\n\t\tfunction onFocusOut( event ) {\n\t\t\tsetLastFocus( { ...getLastFocus(), current: event.target } );\n\n\t\t\tconst { ownerDocument } = node;\n\n\t\t\t// If focus disappears due to there being no blocks, move focus to\n\t\t\t// the writing flow wrapper.\n\t\t\tif (\n\t\t\t\t! event.relatedTarget &&\n\t\t\t\townerDocument.activeElement === ownerDocument.body &&\n\t\t\t\tgetBlockCount() === 0\n\t\t\t) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t}\n\n\t\t// When tabbing back to an element in block list, this event handler prevents scrolling if the\n\t\t// focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph\n\t\t// when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the\n\t\t// top or bottom of the document.\n\t\t//\n\t\t// Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this\n\t\t// earlier in the keypress handler, and call focus( { preventScroll: true } ) instead.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters\n\t\tfunction preventScrollOnTab( event ) {\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.target?.getAttribute( 'role' ) === 'region' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( container.current === event.target ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst target = focus.tabbable[ direction ]( event.target );\n\t\t\t// Only do something when the next tabbable is a focus capture div (before/after)\n\t\t\tif (\n\t\t\t\ttarget === focusCaptureBeforeRef.current ||\n\t\t\t\ttarget === focusCaptureAfterRef.current\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttarget.focus( { preventScroll: true } );\n\t\t\t}\n\t\t}\n\n\t\tconst { ownerDocument } = node;\n\t\tconst { defaultView } = ownerDocument;\n\t\tdefaultView.addEventListener( 'keydown', preventScrollOnTab );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\tnode.addEventListener( 'focusout', onFocusOut );\n\t\treturn () => {\n\t\t\tdefaultView.removeEventListener( 'keydown', preventScrollOnTab );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tnode.removeEventListener( 'focusout', onFocusOut );\n\t\t};\n\t}, [] );\n\n\tconst mergedRefs = useMergeRefs( [ container, ref ] );\n\n\treturn [ before, mergedRefs, after ];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,aAAa,QAAQ,gBAAgB;AACrD,SAASC,GAAG,QAAQ,qBAAqB;AACzC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,EAAEC,YAAY,QAAQ,oBAAoB;AAC/D,SAASC,MAAM,QAAQ,oBAAoB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,iBAAiB;AAClE,SAASC,MAAM,QAA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,CAAE,SAAS,EAAEJ,kBAAmB,CAAC;MAChEhB,IAAI,CAACoB,mBAAmB,CAAE,SAAS,EAAEnB,SAAU,CAAC;MAChDD,IAAI,CAACoB,mBAAmB,CAAE,UAAU,EAAER,UAAW,CAAC;IACnD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMS,UAAU,GAAGnE,YAAY,CAAE,CAAEU,SAAS,EAAEgC,GAAG,CAAG,CAAC;EAErD,OAAO,CAAED,MAAM,EAAE0B,UAAU,EAAEtB,KAAK,CAAE;AACrC","ignoreList":[]}
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { getBlockBindingsSource, getBlockBindingsSources } from '@wordpress/blocks';
5
+ import { getBlockBindingsSource, getBlockBindingsSources, getBlockType } from '@wordpress/blocks';
6
6
  import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item, __experimentalText as Text, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, __experimentalVStack as VStack, privateApis as componentsPrivateApis } from '@wordpress/components';
7
7
  import { useSelect } from '@wordpress/data';
8
8
  import { useContext, Fragment } from '@wordpress/element';
@@ -15,11 +15,12 @@ import { canBindAttribute, getBindableAttributes } from '../hooks/use-bindings-a
15
15
  import { unlock } from '../lock-unlock';
16
16
  import InspectorControls from '../components/inspector-controls';
17
17
  import BlockContext from '../components/block-context';
18
+ import { useBlockEditContext } from '../components/block-edit';
18
19
  import { useBlockBindingsUtils } from '../utils/block-bindings';
19
20
  import { store as blockEditorStore } from '../store';
20
21
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
21
22
  const {
22
- DropdownMenuV2
23
+ Menu
23
24
  } = unlock(componentsPrivateApis);
24
25
  const EMPTY_OBJECT = {};
25
26
  const useToolsPanelDropdownMenuProps = () => {
@@ -37,17 +38,27 @@ function BlockBindingsPanelDropdown({
37
38
  attribute,
38
39
  binding
39
40
  }) {
41
+ const {
42
+ clientId
43
+ } = useBlockEditContext();
40
44
  const registeredSources = getBlockBindingsSources();
41
45
  const {
42
46
  updateBlockBindings
43
47
  } = useBlockBindingsUtils();
44
48
  const currentKey = binding?.args?.key;
49
+ const attributeType = useSelect(select => {
50
+ const {
51
+ name: blockName
52
+ } = select(blockEditorStore).getBlock(clientId);
53
+ const _attributeType = getBlockType(blockName).attributes?.[attribute]?.type;
54
+ return _attributeType === 'rich-text' ? 'string' : _attributeType;
55
+ }, [clientId, attribute]);
45
56
  return /*#__PURE__*/_jsx(_Fragment, {
46
57
  children: Object.entries(fieldsList).map(([name, fields], i) => /*#__PURE__*/_jsxs(Fragment, {
47
- children: [/*#__PURE__*/_jsxs(DropdownMenuV2.Group, {
48
- children: [Object.keys(fieldsList).length > 1 && /*#__PURE__*/_jsx(DropdownMenuV2.GroupLabel, {
58
+ children: [/*#__PURE__*/_jsxs(Menu.Group, {
59
+ children: [Object.keys(fieldsList).length > 1 && /*#__PURE__*/_jsx(Menu.GroupLabel, {
49
60
  children: registeredSources[name].label
50
- }), Object.entries(fields).map(([key, args]) => /*#__PURE__*/_jsxs(DropdownMenuV2.RadioItem, {
61
+ }), Object.entries(fields).filter(([, args]) => args?.type === attributeType).map(([key, args]) => /*#__PURE__*/_jsxs(Menu.RadioItem, {
51
62
  onChange: () => updateBlockBindings({
52
63
  [attribute]: {
53
64
  source: name,
@@ -59,13 +70,13 @@ function BlockBindingsPanelDropdown({
59
70
  name: attribute + '-binding',
60
71
  value: key,
61
72
  checked: key === currentKey,
62
- children: [/*#__PURE__*/_jsx(DropdownMenuV2.ItemLabel, {
73
+ children: [/*#__PURE__*/_jsx(Menu.ItemLabel, {
63
74
  children: args?.label
64
- }), /*#__PURE__*/_jsx(DropdownMenuV2.ItemHelpText, {
75
+ }), /*#__PURE__*/_jsx(Menu.ItemHelpText, {
65
76
  children: args?.value
66
77
  })]
67
78
  }, key))]
68
- }), i !== Object.keys(fieldsList).length - 1 && /*#__PURE__*/_jsx(DropdownMenuV2.Separator, {})]
79
+ }), i !== Object.keys(fieldsList).length - 1 && /*#__PURE__*/_jsx(Menu.Separator, {})]
69
80
  }, name))
70
81
  });
71
82
  }
@@ -128,7 +139,7 @@ function EditableBlockBindingsPanelItems({
128
139
  [attribute]: undefined
129
140
  });
130
141
  },
131
- children: /*#__PURE__*/_jsx(DropdownMenuV2, {
142
+ children: /*#__PURE__*/_jsx(Menu, {
132
143
  placement: isMobile ? 'bottom-start' : 'left-start',
133
144
  gutter: isMobile ? 8 : 36,
134
145
  trigger: /*#__PURE__*/_jsx(Item, {
@@ -1 +1 @@
1
- {"version":3,"names":["__","getBlockBindingsSource","getBlockBindingsSources","__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalText","Text","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalVStack","VStack","privateApis","componentsPrivateApis","useSelect","useContext","Fragment","useViewportMatch","canBindAttribute","getBindableAttributes","unlock","InspectorControls","BlockContext","useBlockBindingsUtils","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","_Fragment","DropdownMenuV2","EMPTY_OBJECT","useToolsPanelDropdownMenuProps","isMobile","popoverProps","placement","offset","BlockBindingsPanelDropdown","fieldsList","attribute","binding","registeredSources","updateBlockBindings","currentKey","args","key","children","Object","entries","map","name","fields","i","Group","keys","length","GroupLabel","label","RadioItem","onChange","source","value","checked","ItemLabel","ItemHelpText","Separator","BlockBindingsAttribute","sourceName","sourceProps","isSourceInvalid","className","spacing","truncate","variant","isDestructive","ReadOnlyBlockBindingsPanelItems","bindings","EditableBlockBindingsPanelItems","attributes","hasValue","onDeselect","undefined","gutter","trigger","BlockBindingsPanel","blockName","metadata","blockContext","removeAllBlockBindings","bindableAttributes","dropdownMenuProps","_fieldsList","canUpdateBlockBindings","select","forEach","getFieldsList","usesContext","context","sourceList","values","getSettings","filteredBindings","readOnly","group","resetAll","isBordered","isSeparated","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tgetBlockBindingsSource,\n\tgetBlockBindingsSources,\n} from '@wordpress/blocks';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalText as Text,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, Fragment } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcanBindAttribute,\n\tgetBindableAttributes,\n} from '../hooks/use-bindings-attributes';\nimport { unlock } from '../lock-unlock';\nimport InspectorControls from '../components/inspector-controls';\nimport BlockContext from '../components/block-context';\nimport { useBlockBindingsUtils } from '../utils/block-bindings';\nimport { store as blockEditorStore } from '../store';\n\nconst { DropdownMenuV2 } = unlock( componentsPrivateApis );\n\nconst EMPTY_OBJECT = {};\n\nconst useToolsPanelDropdownMenuProps = () => {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n};\n\nfunction BlockBindingsPanelDropdown( { fieldsList, attribute, binding } ) {\n\tconst registeredSources = getBlockBindingsSources();\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst currentKey = binding?.args?.key;\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( fieldsList ).map( ( [ name, fields ], i ) => (\n\t\t\t\t<Fragment key={ name }>\n\t\t\t\t\t<DropdownMenuV2.Group>\n\t\t\t\t\t\t{ Object.keys( fieldsList ).length > 1 && (\n\t\t\t\t\t\t\t<DropdownMenuV2.GroupLabel>\n\t\t\t\t\t\t\t\t{ registeredSources[ name ].label }\n\t\t\t\t\t\t\t</DropdownMenuV2.GroupLabel>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ Object.entries( fields ).map( ( [ key, args ] ) => (\n\t\t\t\t\t\t\t<DropdownMenuV2.RadioItem\n\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t\t\t[ attribute ]: {\n\t\t\t\t\t\t\t\t\t\t\tsource: name,\n\t\t\t\t\t\t\t\t\t\t\targs: { key },\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tname={ attribute + '-binding' }\n\t\t\t\t\t\t\t\tvalue={ key }\n\t\t\t\t\t\t\t\tchecked={ key === currentKey }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t\t{ args?.label }\n\t\t\t\t\t\t\t\t</DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t<DropdownMenuV2.ItemHelpText>\n\t\t\t\t\t\t\t\t\t{ args?.value }\n\t\t\t\t\t\t\t\t</DropdownMenuV2.ItemHelpText>\n\t\t\t\t\t\t\t</DropdownMenuV2.RadioItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</DropdownMenuV2.Group>\n\t\t\t\t\t{ i !== Object.keys( fieldsList ).length - 1 && (\n\t\t\t\t\t\t<DropdownMenuV2.Separator />\n\t\t\t\t\t) }\n\t\t\t\t</Fragment>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction BlockBindingsAttribute( { attribute, binding, fieldsList } ) {\n\tconst { source: sourceName, args } = binding || {};\n\tconst sourceProps = getBlockBindingsSource( sourceName );\n\tconst isSourceInvalid = ! sourceProps;\n\treturn (\n\t\t<VStack className=\"block-editor-bindings__item\" spacing={ 0 }>\n\t\t\t<Text truncate>{ attribute }</Text>\n\t\t\t{ !! binding && (\n\t\t\t\t<Text\n\t\t\t\t\ttruncate\n\t\t\t\t\tvariant={ ! isSourceInvalid && 'muted' }\n\t\t\t\t\tisDestructive={ isSourceInvalid }\n\t\t\t\t>\n\t\t\t\t\t{ isSourceInvalid\n\t\t\t\t\t\t? __( 'Invalid source' )\n\t\t\t\t\t\t: fieldsList?.[ sourceName ]?.[ args?.key ]?.label ||\n\t\t\t\t\t\t sourceProps?.label ||\n\t\t\t\t\t\t sourceName }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nfunction ReadOnlyBlockBindingsPanelItems( { bindings, fieldsList } ) {\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( bindings ).map( ( [ attribute, binding ] ) => (\n\t\t\t\t<Item key={ attribute }>\n\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t/>\n\t\t\t\t</Item>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction EditableBlockBindingsPanelItems( {\n\tattributes,\n\tbindings,\n\tfieldsList,\n} ) {\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn (\n\t\t<>\n\t\t\t{ attributes.map( ( attribute ) => {\n\t\t\t\tconst binding = bindings[ attribute ];\n\t\t\t\treturn (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tkey={ attribute }\n\t\t\t\t\t\thasValue={ () => !! binding }\n\t\t\t\t\t\tlabel={ attribute }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t[ attribute ]: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<DropdownMenuV2\n\t\t\t\t\t\t\tplacement={\n\t\t\t\t\t\t\t\tisMobile ? 'bottom-start' : 'left-start'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgutter={ isMobile ? 8 : 36 }\n\t\t\t\t\t\t\ttrigger={\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockBindingsPanelDropdown\n\t\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</DropdownMenuV2>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport const BlockBindingsPanel = ( { name: blockName, metadata } ) => {\n\tconst blockContext = useContext( BlockContext );\n\tconst { removeAllBlockBindings } = useBlockBindingsUtils();\n\tconst bindableAttributes = getBindableAttributes( blockName );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// `useSelect` is used purposely here to ensure `getFieldsList`\n\t// is updated whenever there are updates in block context.\n\t// `source.getFieldsList` may also call a selector via `select`.\n\tconst _fieldsList = {};\n\tconst { fieldsList, canUpdateBlockBindings } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! bindableAttributes || bindableAttributes.length === 0 ) {\n\t\t\t\treturn EMPTY_OBJECT;\n\t\t\t}\n\t\t\tconst registeredSources = getBlockBindingsSources();\n\t\t\tObject.entries( registeredSources ).forEach(\n\t\t\t\t( [ sourceName, { getFieldsList, usesContext } ] ) => {\n\t\t\t\t\tif ( getFieldsList ) {\n\t\t\t\t\t\t// Populate context.\n\t\t\t\t\t\tconst context = {};\n\t\t\t\t\t\tif ( usesContext?.length ) {\n\t\t\t\t\t\t\tfor ( const key of usesContext ) {\n\t\t\t\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst sourceList = getFieldsList( {\n\t\t\t\t\t\t\tselect,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\t// Only add source if the list is not empty.\n\t\t\t\t\t\tif ( Object.keys( sourceList || {} ).length ) {\n\t\t\t\t\t\t\t_fieldsList[ sourceName ] = { ...sourceList };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tfieldsList:\n\t\t\t\t\tObject.values( _fieldsList ).length > 0\n\t\t\t\t\t\t? _fieldsList\n\t\t\t\t\t\t: EMPTY_OBJECT,\n\t\t\t\tcanUpdateBlockBindings:\n\t\t\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t\t\t.canUpdateBlockBindings,\n\t\t\t};\n\t\t},\n\t\t[ blockContext, bindableAttributes ]\n\t);\n\t// Return early if there are no bindable attributes.\n\tif ( ! bindableAttributes || bindableAttributes.length === 0 ) {\n\t\treturn null;\n\t}\n\t// Filter bindings to only show bindable attributes and remove pattern overrides.\n\tconst { bindings } = metadata || {};\n\tconst filteredBindings = { ...bindings };\n\tObject.keys( filteredBindings ).forEach( ( key ) => {\n\t\tif (\n\t\t\t! canBindAttribute( blockName, key ) ||\n\t\t\tfilteredBindings[ key ].source === 'core/pattern-overrides'\n\t\t) {\n\t\t\tdelete filteredBindings[ key ];\n\t\t}\n\t} );\n\n\t// Lock the UI when the user can't update bindings or there are no fields to connect to.\n\tconst readOnly =\n\t\t! canUpdateBlockBindings || ! Object.keys( fieldsList ).length;\n\n\tif ( readOnly && Object.keys( filteredBindings ).length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorControls group=\"bindings\">\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Attributes' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tremoveAllBlockBindings();\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\tclassName=\"block-editor-bindings__panel\"\n\t\t\t>\n\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t{ readOnly ? (\n\t\t\t\t\t\t<ReadOnlyBlockBindingsPanelItems\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<EditableBlockBindingsPanelItems\n\t\t\t\t\t\t\tattributes={ bindableAttributes }\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ItemGroup>\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Attributes connected to custom fields or other dynamic data.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t</ItemGroup>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n};\n\nexport default {\n\tedit: BlockBindingsPanel,\n\tattributeKeys: [ 'metadata' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SACCC,sBAAsB,EACtBC,uBAAuB,QACjB,mBAAmB;AAC1B,SACCC,uBAAuB,IAAIC,SAAS,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,CAAC;MACzB,CAAG;MACHE,iBAAiB,EAAGA,iBAAmB;MACvCpB,SAAS,EAAC,8BAA8B;MAAAxB,QAAA,gBAExCpB,IAAA,CAAC1B,SAAS;QAACyG,UAAU;QAACC,WAAW;QAAA5D,QAAA,EAC9BwD,QAAQ,gBACT5E,IAAA,CAACiD,+BAA+B;UAC/BC,QAAQ,EAAGyB,gBAAkB;UAC7B/D,UAAU,EAAGA;QAAY,CACzB,CAAC,gBAEFZ,IAAA,CAACmD,+BAA+B;UAC/BC,UAAU,EAAGW,kBAAoB;UACjCb,QAAQ,EAAGyB,gBAAkB;UAC7B/D,UAAU,EAAGA;QAAY,CACzB;MACD,CACS,CAAC,eACZZ,IAAA,CAAC1B,SAAS;QAAA8C,QAAA,eACTpB,IAAA,CAACtB,IAAI;UAACqE,OAAO,EAAC,OAAO;UAAA3B,QAAA,EAClBlD,EAAE,CACH,8DACD;QAAC,CACI;MAAC,CACG,CAAC;IAAA,CACD;EAAC,CACK,CAAC;AAEtB,CAAC;AAED,eAAe;EACd+G,IAAI,EAAEvB,kBAAkB;EACxBwB,aAAa,EAAE,CAAE,UAAU,CAAE;EAC7BC,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__","getBlockBindingsSource","getBlockBindingsSources","getBlockType","__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalText","Text","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalVStack","VStack","privateApis","componentsPrivateApis","useSelect","useContext","Fragment","useViewportMatch","canBindAttribute","getBindableAttributes","unlock","InspectorControls","BlockContext","useBlockEditContext","useBlockBindingsUtils","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","_Fragment","Menu","EMPTY_OBJECT","useToolsPanelDropdownMenuProps","isMobile","popoverProps","placement","offset","BlockBindingsPanelDropdown","fieldsList","attribute","binding","clientId","registeredSources","updateBlockBindings","currentKey","args","key","attributeType","select","name","blockName","getBlock","_attributeType","attributes","type","children","Object","entries","map","fields","i","Group","keys","length","GroupLabel","label","filter","RadioItem","onChange","source","value","checked","ItemLabel","ItemHelpText","Separator","BlockBindingsAttribute","sourceName","sourceProps","isSourceInvalid","className","spacing","truncate","variant","isDestructive","ReadOnlyBlockBindingsPanelItems","bindings","EditableBlockBindingsPanelItems","hasValue","onDeselect","undefined","gutter","trigger","BlockBindingsPanel","metadata","blockContext","removeAllBlockBindings","bindableAttributes","dropdownMenuProps","_fieldsList","canUpdateBlockBindings","forEach","getFieldsList","usesContext","context","sourceList","values","getSettings","filteredBindings","readOnly","group","resetAll","isBordered","isSeparated","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tgetBlockBindingsSource,\n\tgetBlockBindingsSources,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalText as Text,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, Fragment } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcanBindAttribute,\n\tgetBindableAttributes,\n} from '../hooks/use-bindings-attributes';\nimport { unlock } from '../lock-unlock';\nimport InspectorControls from '../components/inspector-controls';\nimport BlockContext from '../components/block-context';\nimport { useBlockEditContext } from '../components/block-edit';\nimport { useBlockBindingsUtils } from '../utils/block-bindings';\nimport { store as blockEditorStore } from '../store';\n\nconst { Menu } = unlock( componentsPrivateApis );\n\nconst EMPTY_OBJECT = {};\n\nconst useToolsPanelDropdownMenuProps = () => {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n};\n\nfunction BlockBindingsPanelDropdown( { fieldsList, attribute, binding } ) {\n\tconst { clientId } = useBlockEditContext();\n\tconst registeredSources = getBlockBindingsSources();\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst currentKey = binding?.args?.key;\n\tconst attributeType = useSelect(\n\t\t( select ) => {\n\t\t\tconst { name: blockName } =\n\t\t\t\tselect( blockEditorStore ).getBlock( clientId );\n\t\t\tconst _attributeType =\n\t\t\t\tgetBlockType( blockName ).attributes?.[ attribute ]?.type;\n\t\t\treturn _attributeType === 'rich-text' ? 'string' : _attributeType;\n\t\t},\n\t\t[ clientId, attribute ]\n\t);\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( fieldsList ).map( ( [ name, fields ], i ) => (\n\t\t\t\t<Fragment key={ name }>\n\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t{ Object.keys( fieldsList ).length > 1 && (\n\t\t\t\t\t\t\t<Menu.GroupLabel>\n\t\t\t\t\t\t\t\t{ registeredSources[ name ].label }\n\t\t\t\t\t\t\t</Menu.GroupLabel>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ Object.entries( fields )\n\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t( [ , args ] ) => args?.type === attributeType\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.map( ( [ key, args ] ) => (\n\t\t\t\t\t\t\t\t<Menu.RadioItem\n\t\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t\t\t\t[ attribute ]: {\n\t\t\t\t\t\t\t\t\t\t\t\tsource: name,\n\t\t\t\t\t\t\t\t\t\t\t\targs: { key },\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tname={ attribute + '-binding' }\n\t\t\t\t\t\t\t\t\tvalue={ key }\n\t\t\t\t\t\t\t\t\tchecked={ key === currentKey }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t{ args?.label }\n\t\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t<Menu.ItemHelpText>\n\t\t\t\t\t\t\t\t\t\t{ args?.value }\n\t\t\t\t\t\t\t\t\t</Menu.ItemHelpText>\n\t\t\t\t\t\t\t\t</Menu.RadioItem>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Menu.Group>\n\t\t\t\t\t{ i !== Object.keys( fieldsList ).length - 1 && (\n\t\t\t\t\t\t<Menu.Separator />\n\t\t\t\t\t) }\n\t\t\t\t</Fragment>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction BlockBindingsAttribute( { attribute, binding, fieldsList } ) {\n\tconst { source: sourceName, args } = binding || {};\n\tconst sourceProps = getBlockBindingsSource( sourceName );\n\tconst isSourceInvalid = ! sourceProps;\n\treturn (\n\t\t<VStack className=\"block-editor-bindings__item\" spacing={ 0 }>\n\t\t\t<Text truncate>{ attribute }</Text>\n\t\t\t{ !! binding && (\n\t\t\t\t<Text\n\t\t\t\t\ttruncate\n\t\t\t\t\tvariant={ ! isSourceInvalid && 'muted' }\n\t\t\t\t\tisDestructive={ isSourceInvalid }\n\t\t\t\t>\n\t\t\t\t\t{ isSourceInvalid\n\t\t\t\t\t\t? __( 'Invalid source' )\n\t\t\t\t\t\t: fieldsList?.[ sourceName ]?.[ args?.key ]?.label ||\n\t\t\t\t\t\t sourceProps?.label ||\n\t\t\t\t\t\t sourceName }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nfunction ReadOnlyBlockBindingsPanelItems( { bindings, fieldsList } ) {\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( bindings ).map( ( [ attribute, binding ] ) => (\n\t\t\t\t<Item key={ attribute }>\n\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t/>\n\t\t\t\t</Item>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction EditableBlockBindingsPanelItems( {\n\tattributes,\n\tbindings,\n\tfieldsList,\n} ) {\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn (\n\t\t<>\n\t\t\t{ attributes.map( ( attribute ) => {\n\t\t\t\tconst binding = bindings[ attribute ];\n\t\t\t\treturn (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tkey={ attribute }\n\t\t\t\t\t\thasValue={ () => !! binding }\n\t\t\t\t\t\tlabel={ attribute }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t[ attribute ]: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Menu\n\t\t\t\t\t\t\tplacement={\n\t\t\t\t\t\t\t\tisMobile ? 'bottom-start' : 'left-start'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgutter={ isMobile ? 8 : 36 }\n\t\t\t\t\t\t\ttrigger={\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockBindingsPanelDropdown\n\t\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Menu>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport const BlockBindingsPanel = ( { name: blockName, metadata } ) => {\n\tconst blockContext = useContext( BlockContext );\n\tconst { removeAllBlockBindings } = useBlockBindingsUtils();\n\tconst bindableAttributes = getBindableAttributes( blockName );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// `useSelect` is used purposely here to ensure `getFieldsList`\n\t// is updated whenever there are updates in block context.\n\t// `source.getFieldsList` may also call a selector via `select`.\n\tconst _fieldsList = {};\n\tconst { fieldsList, canUpdateBlockBindings } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! bindableAttributes || bindableAttributes.length === 0 ) {\n\t\t\t\treturn EMPTY_OBJECT;\n\t\t\t}\n\t\t\tconst registeredSources = getBlockBindingsSources();\n\t\t\tObject.entries( registeredSources ).forEach(\n\t\t\t\t( [ sourceName, { getFieldsList, usesContext } ] ) => {\n\t\t\t\t\tif ( getFieldsList ) {\n\t\t\t\t\t\t// Populate context.\n\t\t\t\t\t\tconst context = {};\n\t\t\t\t\t\tif ( usesContext?.length ) {\n\t\t\t\t\t\t\tfor ( const key of usesContext ) {\n\t\t\t\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst sourceList = getFieldsList( {\n\t\t\t\t\t\t\tselect,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\t// Only add source if the list is not empty.\n\t\t\t\t\t\tif ( Object.keys( sourceList || {} ).length ) {\n\t\t\t\t\t\t\t_fieldsList[ sourceName ] = { ...sourceList };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tfieldsList:\n\t\t\t\t\tObject.values( _fieldsList ).length > 0\n\t\t\t\t\t\t? _fieldsList\n\t\t\t\t\t\t: EMPTY_OBJECT,\n\t\t\t\tcanUpdateBlockBindings:\n\t\t\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t\t\t.canUpdateBlockBindings,\n\t\t\t};\n\t\t},\n\t\t[ blockContext, bindableAttributes ]\n\t);\n\t// Return early if there are no bindable attributes.\n\tif ( ! bindableAttributes || bindableAttributes.length === 0 ) {\n\t\treturn null;\n\t}\n\t// Filter bindings to only show bindable attributes and remove pattern overrides.\n\tconst { bindings } = metadata || {};\n\tconst filteredBindings = { ...bindings };\n\tObject.keys( filteredBindings ).forEach( ( key ) => {\n\t\tif (\n\t\t\t! canBindAttribute( blockName, key ) ||\n\t\t\tfilteredBindings[ key ].source === 'core/pattern-overrides'\n\t\t) {\n\t\t\tdelete filteredBindings[ key ];\n\t\t}\n\t} );\n\n\t// Lock the UI when the user can't update bindings or there are no fields to connect to.\n\tconst readOnly =\n\t\t! canUpdateBlockBindings || ! Object.keys( fieldsList ).length;\n\n\tif ( readOnly && Object.keys( filteredBindings ).length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorControls group=\"bindings\">\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Attributes' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tremoveAllBlockBindings();\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\tclassName=\"block-editor-bindings__panel\"\n\t\t\t>\n\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t{ readOnly ? (\n\t\t\t\t\t\t<ReadOnlyBlockBindingsPanelItems\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<EditableBlockBindingsPanelItems\n\t\t\t\t\t\t\tattributes={ bindableAttributes }\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ItemGroup>\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Attributes connected to custom fields or other dynamic data.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t</ItemGroup>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n};\n\nexport default {\n\tedit: BlockBindingsPanel,\n\tattributeKeys: [ 'metadata' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SACCC,sBAAsB,EACtBC,uBAAuB,EACvBC,YAAY,QACN,mBAAmB;AAC1B,SACCC,uBAAuB,IAAIC,SAAS,EACpCC,kBAAkB,IAAIC,IAAI,EAC1BC,kBAAkB,IAAIC,IAAI,EAC1BC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,EAC9CC,oBAAoB,IAAIC,MAAM,EAC9BC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,UAAU,EAAEC,QAAQ,QAAQ,oBAAoB;AACzD,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,SACCC,gBAAgB,EAChBC,qBAAqB,QACf,kCAAkC;AACzC,SAASC,MAAM,QAAQ,gBAAgB;AACvC,O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IAAC0F,KAAK,EAAC,UAAU;IAAAtD,QAAA,eAClC3B,KAAA,CAACvB,UAAU;MACV4D,KAAK,EAAGvE,EAAE,CAAE,YAAa,CAAG;MAC5BoH,QAAQ,EAAGA,CAAA,KAAM;QAChBf,sBAAsB,CAAC,CAAC;MACzB,CAAG;MACHE,iBAAiB,EAAGA,iBAAmB;MACvClB,SAAS,EAAC,8BAA8B;MAAAxB,QAAA,gBAExC7B,IAAA,CAAC3B,SAAS;QAACgH,UAAU;QAACC,WAAW;QAAAzD,QAAA,EAC9BqD,QAAQ,gBACTlF,IAAA,CAAC0D,+BAA+B;UAC/BC,QAAQ,EAAGsB,gBAAkB;UAC7BrE,UAAU,EAAGA;QAAY,CACzB,CAAC,gBAEFZ,IAAA,CAAC4D,+BAA+B;UAC/BjC,UAAU,EAAG2C,kBAAoB;UACjCX,QAAQ,EAAGsB,gBAAkB;UAC7BrE,UAAU,EAAGA;QAAY,CACzB;MACD,CACS,CAAC,eACZZ,IAAA,CAAC3B,SAAS;QAAAwD,QAAA,eACT7B,IAAA,CAACvB,IAAI;UAAC+E,OAAO,EAAC,OAAO;UAAA3B,QAAA,EAClB7D,EAAE,CACH,8DACD;QAAC,CACI;MAAC,CACG,CAAC;IAAA,CACD;EAAC,CACK,CAAC;AAEtB,CAAC;AAED,eAAe;EACduH,IAAI,EAAErB,kBAAkB;EACxBsB,aAAa,EAAE,CAAE,UAAU,CAAE;EAC7BC,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
@@ -22,7 +22,6 @@ export default function BlockColorContrastChecker({
22
22
 
23
23
  // There are so many things that can change the color of a block
24
24
  // So we perform this check on every render.
25
- // eslint-disable-next-line react-hooks/exhaustive-deps
26
25
  useEffect(() => {
27
26
  if (!blockEl) {
28
27
  return;
@@ -1 +1 @@
1
- {"version":3,"names":["useState","useEffect","ContrastChecker","useBlockElement","jsx","_jsx","getComputedStyle","node","ownerDocument","defaultView","BlockColorContrastChecker","clientId","detectedBackgroundColor","setDetectedBackgroundColor","detectedColor","setDetectedColor","detectedLinkColor","setDetectedLinkColor","blockEl","color","firstLinkElement","querySelector","innerText","backgroundColorNode","backgroundColor","parentNode","nodeType","ELEMENT_NODE","textColor","enableAlphaChecker","linkColor"],"sources":["@wordpress/block-editor/src/hooks/contrast-checker.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ContrastChecker from '../components/contrast-checker';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction getComputedStyle( node ) {\n\treturn node.ownerDocument.defaultView.getComputedStyle( node );\n}\n\nexport default function BlockColorContrastChecker( { clientId } ) {\n\tconst [ detectedBackgroundColor, setDetectedBackgroundColor ] = useState();\n\tconst [ detectedColor, setDetectedColor ] = useState();\n\tconst [ detectedLinkColor, setDetectedLinkColor ] = useState();\n\tconst blockEl = useBlockElement( clientId );\n\n\t// There are so many things that can change the color of a block\n\t// So we perform this check on every render.\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tuseEffect( () => {\n\t\tif ( ! blockEl ) {\n\t\t\treturn;\n\t\t}\n\t\tsetDetectedColor( getComputedStyle( blockEl ).color );\n\n\t\tconst firstLinkElement = blockEl.querySelector( 'a' );\n\t\tif ( firstLinkElement && !! firstLinkElement.innerText ) {\n\t\t\tsetDetectedLinkColor( getComputedStyle( firstLinkElement ).color );\n\t\t}\n\n\t\tlet backgroundColorNode = blockEl;\n\t\tlet backgroundColor =\n\t\t\tgetComputedStyle( backgroundColorNode ).backgroundColor;\n\t\twhile (\n\t\t\tbackgroundColor === 'rgba(0, 0, 0, 0)' &&\n\t\t\tbackgroundColorNode.parentNode &&\n\t\t\tbackgroundColorNode.parentNode.nodeType ===\n\t\t\t\tbackgroundColorNode.parentNode.ELEMENT_NODE\n\t\t) {\n\t\t\tbackgroundColorNode = backgroundColorNode.parentNode;\n\t\t\tbackgroundColor =\n\t\t\t\tgetComputedStyle( backgroundColorNode ).backgroundColor;\n\t\t}\n\n\t\tsetDetectedBackgroundColor( backgroundColor );\n\t}, [ blockEl ] );\n\n\treturn (\n\t\t<ContrastChecker\n\t\t\tbackgroundColor={ detectedBackgroundColor }\n\t\t\ttextColor={ detectedColor }\n\t\t\tenableAlphaChecker\n\t\t\tlinkColor={ detectedLinkColor }\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;;AAExD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,gCAAgC;AAC5D,SAASC,eAAe,QAAQ,yDAAyD;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1F,SAASC,gBAAgBA,CAAEC,IAAI,EAAG;EACjC,OAAOA,IAAI,CAACC,aAAa,CAACC,WAAW,CAACH,gBAAgB,CAAEC,IAAK,CAAC;AAC/D;AAEA,eAAe,SAASG,yBAAyBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACjE,MAAM,CAAEC,uBAAuB,EAAEC,0BAA0B,CAAE,GAAGb,QAAQ,CAAC,CAAC;EAC1E,MAAM,CAAEc,aAAa,EAAEC,gBAAgB,CAAE,GAAGf,QAAQ,CAAC,CAAC;EACtD,MAAM,CAAEgB,iBAAiB,EAAEC,oBAAoB,CAAE,GAAGjB,QAAQ,CAAC,CAAC;EAC9D,MAAMkB,OAAO,GAAGf,eAAe,CAAEQ,QAAS,CAAC;;EAE3C;EACA;EACA;EACAV,SAAS,CAAE,MAAM;IAChB,IAAK,CAAEiB,OAAO,EAAG;MAChB;IACD;IACAH,gBAAgB,CAAET,gBAAgB,CAAEY,OAAQ,CAAC,CAACC,KAAM,CAAC;IAErD,MAAMC,gBAAgB,GAAGF,OAAO,CAACG,aAAa,CAAE,GAAI,CAAC;IACrD,IAAKD,gBAAgB,IAAI,CAAC,CAAEA,gBAAgB,CAACE,SAAS,EAAG;MACxDL,oBAAoB,CAAEX,gBAAgB,CAAEc,gBAAiB,CAAC,CAACD,KAAM,CAAC;IACnE;IAEA,IAAII,mBAAmB,GAAGL,OAAO;IACjC,IAAIM,eAAe,GAClBlB,gBAAgB,CAAEiB,mBAAoB,CAAC,CAACC,eAAe;IACxD,OACCA,eAAe,KAAK,kBAAkB,IACtCD,mBAAmB,CAACE,UAAU,IAC9BF,mBAAmB,CAACE,UAAU,CAACC,QAAQ,KACtCH,mBAAmB,CAACE,UAAU,CAACE,YAAY,EAC3C;MACDJ,mBAAmB,GAAGA,mBAAmB,CAACE,UAAU;MACpDD,eAAe,GACdlB,gBAAgB,CAAEiB,mBAAoB,CAAC,CAACC,eAAe;IACzD;IAEAX,0BAA0B,CAAEW,eAAgB,CAAC;EAC9C,CAAC,EAAE,CAAEN,OAAO,CAAG,CAAC;EAEhB,oBACCb,IAAA,CAACH,eAAe;IACfsB,eAAe,EAAGZ,uBAAyB;IAC3CgB,SAAS,EAAGd,aAAe;IAC3Be,kBAAkB;IAClBC,SAAS,EAAGd;EAAmB,CAC/B,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["useState","useEffect","ContrastChecker","useBlockElement","jsx","_jsx","getComputedStyle","node","ownerDocument","defaultView","BlockColorContrastChecker","clientId","detectedBackgroundColor","setDetectedBackgroundColor","detectedColor","setDetectedColor","detectedLinkColor","setDetectedLinkColor","blockEl","color","firstLinkElement","querySelector","innerText","backgroundColorNode","backgroundColor","parentNode","nodeType","ELEMENT_NODE","textColor","enableAlphaChecker","linkColor"],"sources":["@wordpress/block-editor/src/hooks/contrast-checker.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ContrastChecker from '../components/contrast-checker';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction getComputedStyle( node ) {\n\treturn node.ownerDocument.defaultView.getComputedStyle( node );\n}\n\nexport default function BlockColorContrastChecker( { clientId } ) {\n\tconst [ detectedBackgroundColor, setDetectedBackgroundColor ] = useState();\n\tconst [ detectedColor, setDetectedColor ] = useState();\n\tconst [ detectedLinkColor, setDetectedLinkColor ] = useState();\n\tconst blockEl = useBlockElement( clientId );\n\n\t// There are so many things that can change the color of a block\n\t// So we perform this check on every render.\n\tuseEffect( () => {\n\t\tif ( ! blockEl ) {\n\t\t\treturn;\n\t\t}\n\t\tsetDetectedColor( getComputedStyle( blockEl ).color );\n\n\t\tconst firstLinkElement = blockEl.querySelector( 'a' );\n\t\tif ( firstLinkElement && !! firstLinkElement.innerText ) {\n\t\t\tsetDetectedLinkColor( getComputedStyle( firstLinkElement ).color );\n\t\t}\n\n\t\tlet backgroundColorNode = blockEl;\n\t\tlet backgroundColor =\n\t\t\tgetComputedStyle( backgroundColorNode ).backgroundColor;\n\t\twhile (\n\t\t\tbackgroundColor === 'rgba(0, 0, 0, 0)' &&\n\t\t\tbackgroundColorNode.parentNode &&\n\t\t\tbackgroundColorNode.parentNode.nodeType ===\n\t\t\t\tbackgroundColorNode.parentNode.ELEMENT_NODE\n\t\t) {\n\t\t\tbackgroundColorNode = backgroundColorNode.parentNode;\n\t\t\tbackgroundColor =\n\t\t\t\tgetComputedStyle( backgroundColorNode ).backgroundColor;\n\t\t}\n\n\t\tsetDetectedBackgroundColor( backgroundColor );\n\t}, [ blockEl ] );\n\n\treturn (\n\t\t<ContrastChecker\n\t\t\tbackgroundColor={ detectedBackgroundColor }\n\t\t\ttextColor={ detectedColor }\n\t\t\tenableAlphaChecker\n\t\t\tlinkColor={ detectedLinkColor }\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;;AAExD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,gCAAgC;AAC5D,SAASC,eAAe,QAAQ,yDAAyD;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1F,SAASC,gBAAgBA,CAAEC,IAAI,EAAG;EACjC,OAAOA,IAAI,CAACC,aAAa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e;IACfsB,eAAe,EAAGZ,uBAAyB;IAC3CgB,SAAS,EAAGd,aAAe;IAC3Be,kBAAkB;IAClBC,SAAS,EAAGd;EAAmB,CAC/B,CAAC;AAEJ","ignoreList":[]}
@@ -238,12 +238,12 @@ function useDuotoneStyles({
238
238
  // `inline-block` is used instead of `none` to ensure that scroll
239
239
  // position is not affected, as `none` results in the editor
240
240
  // scrolling to the top of the block.
241
- blockElement.style.display = 'inline-block';
241
+ blockElement.style.setProperty('display', 'inline-block');
242
242
  // Simply accessing el.offsetHeight flushes layout and style changes
243
243
  // in WebKit without having to wait for setTimeout.
244
244
  // eslint-disable-next-line no-unused-expressions
245
245
  blockElement.offsetHeight;
246
- blockElement.style.display = display;
246
+ blockElement.style.setProperty('display', display);
247
247
  }
248
248
  // `colors` must be a dependency so this effect runs when the colors
249
249
  // change in Safari.
@@ -1 +1 @@
1
- {"version":3,"names":["extend","namesPlugin","getBlockSupport","getBlockType","hasBlockSupport","useInstanceId","addFilter","useMemo","useEffect","BlockControls","InspectorControls","__experimentalDuotoneControl","DuotoneControl","useSettings","getDuotoneFilter","getDuotoneStylesheet","getDuotoneUnsetStylesheet","getBlockCSSSelector","scopeSelector","useBlockSettings","usePrivateStyleOverride","default","StylesFiltersPanel","useBlockEditingMode","useBlockElement","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","EMPTY_ARRAY","isSafari","window","navigator","userAgent","includes","useMultiOriginPresets","presetSetting","defaultSetting","enableDefault","userPresets","themePresets","defaultPresets","getColorsFromDuotonePreset","duotone","duotonePalette","preset","find","slug","colors","undefined","getDuotonePresetFromColors","Array","isArray","duotonePreset","every","val","index","DuotonePanelPure","style","setAttributes","name","duotoneStyle","color","settings","blockEditingMode","colorPalette","enableCustomColors","enableCustomDuotone","disableCustomColors","disableCustomDuotone","length","duotonePresetOrColors","children","group","value","filter","onChange","newDuotone","newStyle","__experimentalShareWithChildBlocks","maybePreset","shareWithChildBlocks","edit","useBlockProps","attributeKeys","hasSupport","addDuotoneAttributes","attributes","Object","assign","type","useDuotoneStyles","clientId","id","filterId","selector","duotoneSelector","attribute","duotoneAttr","isCustom","isPreset","isCSS","selectors","split","selectorsScoped","map","selectorPart","trim","join","isValidFilter","css","__unstableType","assets","blockElement","display","offsetHeight","DUOTONE_BLOCK_PROPS_REFERENCE","blockType","duotoneSupport","experimentalDuotone","rootSelector","fallback","filterClass","shouldRender","className"],"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSettings,\n} from '../components';\nimport {\n\tgetDuotoneFilter,\n\tgetDuotoneStylesheet,\n\tgetDuotoneUnsetStylesheet,\n} from '../components/duotone/utils';\nimport { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockSettings, usePrivateStyleOverride } from './utils';\nimport { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nconst EMPTY_ARRAY = [];\n\n// Safari does not always update the duotone filter when the duotone colors\n// are changed. This browser check is later used to force a re-render of the block\n// element to ensure the duotone filter is updated. The check is included at the\n// root of this file as it only needs to be run once per page load.\nconst isSafari =\n\twindow?.navigator.userAgent &&\n\twindow.navigator.userAgent.includes( 'Safari' ) &&\n\t! window.navigator.userAgent.includes( 'Chrome' ) &&\n\t! window.navigator.userAgent.includes( 'Chromium' );\n\nextend( [ namesPlugin ] );\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst [ enableDefault, userPresets, themePresets, defaultPresets ] =\n\t\tuseSettings(\n\t\t\tdefaultSetting,\n\t\t\t`${ presetSetting }.custom`,\n\t\t\t`${ presetSetting }.theme`,\n\t\t\t`${ presetSetting }.default`\n\t\t);\n\treturn useMemo(\n\t\t() => [\n\t\t\t...( userPresets || EMPTY_ARRAY ),\n\t\t\t...( themePresets || EMPTY_ARRAY ),\n\t\t\t...( ( enableDefault && defaultPresets ) || EMPTY_ARRAY ),\n\t\t],\n\t\t[ enableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function getColorsFromDuotonePreset( duotone, duotonePalette ) {\n\tif ( ! duotone ) {\n\t\treturn;\n\t}\n\tconst preset = duotonePalette?.find( ( { slug } ) => {\n\t\treturn duotone === `var:preset|duotone|${ slug }`;\n\t} );\n\n\treturn preset ? preset.colors : undefined;\n}\n\nexport function getDuotonePresetFromColors( colors, duotonePalette ) {\n\tif ( ! colors || ! Array.isArray( colors ) ) {\n\t\treturn;\n\t}\n\n\tconst preset = duotonePalette?.find( ( duotonePreset ) => {\n\t\treturn duotonePreset?.colors?.every(\n\t\t\t( val, index ) => val === colors[ index ]\n\t\t);\n\t} );\n\n\treturn preset ? `var:preset|duotone|${ preset.slug }` : undefined;\n}\n\nfunction DuotonePanelPure( { style, setAttributes, name } ) {\n\tconst duotoneStyle = style?.color?.duotone;\n\tconst settings = useBlockSettings( name );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst [ enableCustomColors, enableCustomDuotone ] = useSettings(\n\t\t'color.custom',\n\t\t'color.customDuotone'\n\t);\n\tconst disableCustomColors = ! enableCustomColors;\n\tconst disableCustomDuotone =\n\t\t! enableCustomDuotone ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst duotonePresetOrColors = ! Array.isArray( duotoneStyle )\n\t\t? getColorsFromDuotonePreset( duotoneStyle, duotonePalette )\n\t\t: duotoneStyle;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"filter\">\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tvalue={ { filter: { duotone: duotonePresetOrColors } } }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...newDuotone?.filter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<DuotoneControl\n\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tvalue={ duotonePresetOrColors }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst maybePreset = getDuotonePresetFromColors(\n\t\t\t\t\t\t\tnewDuotone,\n\t\t\t\t\t\t\tduotonePalette\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\t\tduotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: DuotonePanelPure,\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'filter.duotone' );\n\t},\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\tif ( ! hasBlockSupport( settings, 'filter.duotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\nfunction useDuotoneStyles( {\n\tclientId,\n\tid: filterId,\n\tselector: duotoneSelector,\n\tattribute: duotoneAttr,\n} ) {\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\n\t// Possible values for duotone attribute:\n\t// 1. Array of colors - e.g. ['#000000', '#ffffff'].\n\t// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''\n\t// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.\n\tconst isCustom = Array.isArray( duotoneAttr );\n\tconst duotonePreset = isCustom\n\t\t? undefined\n\t\t: getColorsFromDuotonePreset( duotoneAttr, duotonePalette );\n\tconst isPreset = typeof duotoneAttr === 'string' && duotonePreset;\n\tconst isCSS = typeof duotoneAttr === 'string' && ! isPreset;\n\n\t// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.\n\tlet colors = null;\n\tif ( isPreset ) {\n\t\t// Array of colors.\n\t\tcolors = duotonePreset;\n\t} else if ( isCSS ) {\n\t\t// CSS filter property string (e.g. 'unset').\n\t\tcolors = duotoneAttr;\n\t} else if ( isCustom ) {\n\t\t// Array of colors.\n\t\tcolors = duotoneAttr;\n\t}\n\n\t// Build the CSS selectors to which the filter will be applied.\n\tconst selectors = duotoneSelector.split( ',' );\n\n\tconst selectorsScoped = selectors.map( ( selectorPart ) => {\n\t\t// Assuming the selector part is a subclass selector (not a tag name)\n\t\t// so we can prepend the filter id class. If we want to support elements\n\t\t// such as `img` or namespaces, we'll need to add a case for that here.\n\t\treturn `.${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\tusePrivateStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tcss:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneStylesheet( selector, filterId )\n\t\t\t\t\t\t\t: getDuotoneUnsetStylesheet( selector ),\n\t\t\t\t\t__unstableType: 'presets',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\tusePrivateStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tassets:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneFilter( filterId, colors )\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t__unstableType: 'svgs',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\n\tconst blockElement = useBlockElement( clientId );\n\n\tuseEffect( () => {\n\t\tif ( ! isValidFilter ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Safari does not always update the duotone filter when the duotone\n\t\t// colors are changed. When using Safari, force the block element to be\n\t\t// repainted by the browser to ensure any changes are reflected\n\t\t// visually. This logic matches that used on the site frontend in\n\t\t// `block-supports/duotone.php`.\n\t\tif ( blockElement && isSafari ) {\n\t\t\tconst display = blockElement.style.display;\n\t\t\t// Switch to `inline-block` to force a repaint. In the editor,\n\t\t\t// `inline-block` is used instead of `none` to ensure that scroll\n\t\t\t// position is not affected, as `none` results in the editor\n\t\t\t// scrolling to the top of the block.\n\t\t\tblockElement.style.display = 'inline-block';\n\t\t\t// Simply accessing el.offsetHeight flushes layout and style changes\n\t\t\t// in WebKit without having to wait for setTimeout.\n\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\tblockElement.offsetHeight;\n\t\t\tblockElement.style.display = display;\n\t\t}\n\t\t// `colors` must be a dependency so this effect runs when the colors\n\t\t// change in Safari.\n\t}, [ isValidFilter, blockElement, colors ] );\n}\n\n// Used for generating the instance ID\nconst DUOTONE_BLOCK_PROPS_REFERENCE = {};\n\nfunction useBlockProps( { clientId, name, style } ) {\n\tconst id = useInstanceId( DUOTONE_BLOCK_PROPS_REFERENCE );\n\tconst selector = useMemo( () => {\n\t\tconst blockType = getBlockType( name );\n\n\t\tif ( blockType ) {\n\t\t\t// Backwards compatibility for `supports.color.__experimentalDuotone`\n\t\t\t// is provided via the `block_type_metadata_settings` filter. If\n\t\t\t// `supports.filter.duotone` has not been set and the\n\t\t\t// experimental property has been, the experimental property\n\t\t\t// value is copied into `supports.filter.duotone`.\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'filter.duotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( ! duotoneSupport ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// If the experimental duotone support was set, that value is\n\t\t\t// to be treated as a selector and requires scoping.\n\t\t\tconst experimentalDuotone = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( experimentalDuotone ) {\n\t\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\t\treturn typeof experimentalDuotone === 'string'\n\t\t\t\t\t? scopeSelector( rootSelector, experimentalDuotone )\n\t\t\t\t\t: rootSelector;\n\t\t\t}\n\n\t\t\t// Regular filter.duotone support uses filter.duotone selectors with fallbacks.\n\t\t\treturn getBlockCSSSelector( blockType, 'filter.duotone', {\n\t\t\t\tfallback: true,\n\t\t\t} );\n\t\t}\n\t}, [ name ] );\n\n\tconst attribute = style?.color?.duotone;\n\n\tconst filterClass = `wp-duotone-${ id }`;\n\n\tconst shouldRender = selector && attribute;\n\n\tuseDuotoneStyles( {\n\t\tclientId,\n\t\tid: filterClass,\n\t\tselector,\n\t\tattribute,\n\t} );\n\n\treturn {\n\t\tclassName: shouldRender ? filterClass : '',\n\t};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,QAAQ;AAC/B,OAAOC,WAAW,MAAM,sBAAsB;;AAE9C;AACA;AACA;AACA,SACCC,eAAe,EACfC,YAAY,EACZC,eAAe,QACT,mBAAmB;AAC1B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA,SACCC,aAAa,EACbC,iBAAiB,EACjBC,4BAA4B,IAAIC,cAAc,EAC9CC,WAAW,QACL,eAAe;AACtB,SACCC,gBAAgB,EAChBC,oBAAoB,EACpBC,yBAAyB,QACnB,6BAA6B;AACpC,SAASC,mBAAmB,QAAQ,oDAAoD;AACxF,SAASC,aAAa,QAAQ,mCAAmC;AACjE,SAASC,gBAAgB,EAAEC,uBAAuB,QAAQ,SAAS;AACnE,SAASC,OAAO,IAAIC,kBAA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mB,CAAEsG,SAAU,CAAC;QACrD,OAAO,OAAOE,mBAAmB,KAAK,QAAQ,GAC3CvG,aAAa,CAAEwG,YAAY,EAAED,mBAAoB,CAAC,GAClDC,YAAY;MAChB;;MAEA;MACA,OAAOzG,mBAAmB,CAAEsG,SAAS,EAAE,gBAAgB,EAAE;QACxDI,QAAQ,EAAE;MACX,CAAE,CAAC;IACJ;EACD,CAAC,EAAE,CAAE7D,IAAI,CAAG,CAAC;EAEb,MAAMqC,SAAS,GAAGvC,KAAK,EAAEI,KAAK,EAAEnB,OAAO;EAEvC,MAAM+E,WAAW,GAAG,cAAe7B,EAAE,EAAG;EAExC,MAAM8B,YAAY,GAAG5B,QAAQ,IAAIE,SAAS;EAE1CN,gBAAgB,CAAE;IACjBC,QAAQ;IACRC,EAAE,EAAE6B,WAAW;IACf3B,QAAQ;IACRE;EACD,CAAE,CAAC;EAEH,OAAO;IACN2B,SAAS,EAAED,YAAY,GAAGD,WAAW,GAAG;EACzC,CAAC;AACF;AAEAtH,SAAS,CACR,0BAA0B,EAC1B,oCAAoC,EACpCkF,oBACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["extend","namesPlugin","getBlockSupport","getBlockType","hasBlockSupport","useInstanceId","addFilter","useMemo","useEffect","BlockControls","InspectorControls","__experimentalDuotoneControl","DuotoneControl","useSettings","getDuotoneFilter","getDuotoneStylesheet","getDuotoneUnsetStylesheet","getBlockCSSSelector","scopeSelector","useBlockSettings","usePrivateStyleOverride","default","StylesFiltersPanel","useBlockEditingMode","useBlockElement","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","EMPTY_ARRAY","isSafari","window","navigator","userAgent","includes","useMultiOriginPresets","presetSetting","defaultSetting","enableDefault","userPresets","themePresets","defaultPresets","getColorsFromDuotonePreset","duotone","duotonePalette","preset","find","slug","colors","undefined","getDuotonePresetFromColors","Array","isArray","duotonePreset","every","val","index","DuotonePanelPure","style","setAttributes","name","duotoneStyle","color","settings","blockEditingMode","colorPalette","enableCustomColors","enableCustomDuotone","disableCustomColors","disableCustomDuotone","length","duotonePresetOrColors","children","group","value","filter","onChange","newDuotone","newStyle","__experimentalShareWithChildBlocks","maybePreset","shareWithChildBlocks","edit","useBlockProps","attributeKeys","hasSupport","addDuotoneAttributes","attributes","Object","assign","type","useDuotoneStyles","clientId","id","filterId","selector","duotoneSelector","attribute","duotoneAttr","isCustom","isPreset","isCSS","selectors","split","selectorsScoped","map","selectorPart","trim","join","isValidFilter","css","__unstableType","assets","blockElement","display","setProperty","offsetHeight","DUOTONE_BLOCK_PROPS_REFERENCE","blockType","duotoneSupport","experimentalDuotone","rootSelector","fallback","filterClass","shouldRender","className"],"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSettings,\n} from '../components';\nimport {\n\tgetDuotoneFilter,\n\tgetDuotoneStylesheet,\n\tgetDuotoneUnsetStylesheet,\n} from '../components/duotone/utils';\nimport { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockSettings, usePrivateStyleOverride } from './utils';\nimport { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nconst EMPTY_ARRAY = [];\n\n// Safari does not always update the duotone filter when the duotone colors\n// are changed. This browser check is later used to force a re-render of the block\n// element to ensure the duotone filter is updated. The check is included at the\n// root of this file as it only needs to be run once per page load.\nconst isSafari =\n\twindow?.navigator.userAgent &&\n\twindow.navigator.userAgent.includes( 'Safari' ) &&\n\t! window.navigator.userAgent.includes( 'Chrome' ) &&\n\t! window.navigator.userAgent.includes( 'Chromium' );\n\nextend( [ namesPlugin ] );\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst [ enableDefault, userPresets, themePresets, defaultPresets ] =\n\t\tuseSettings(\n\t\t\tdefaultSetting,\n\t\t\t`${ presetSetting }.custom`,\n\t\t\t`${ presetSetting }.theme`,\n\t\t\t`${ presetSetting }.default`\n\t\t);\n\treturn useMemo(\n\t\t() => [\n\t\t\t...( userPresets || EMPTY_ARRAY ),\n\t\t\t...( themePresets || EMPTY_ARRAY ),\n\t\t\t...( ( enableDefault && defaultPresets ) || EMPTY_ARRAY ),\n\t\t],\n\t\t[ enableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function getColorsFromDuotonePreset( duotone, duotonePalette ) {\n\tif ( ! duotone ) {\n\t\treturn;\n\t}\n\tconst preset = duotonePalette?.find( ( { slug } ) => {\n\t\treturn duotone === `var:preset|duotone|${ slug }`;\n\t} );\n\n\treturn preset ? preset.colors : undefined;\n}\n\nexport function getDuotonePresetFromColors( colors, duotonePalette ) {\n\tif ( ! colors || ! Array.isArray( colors ) ) {\n\t\treturn;\n\t}\n\n\tconst preset = duotonePalette?.find( ( duotonePreset ) => {\n\t\treturn duotonePreset?.colors?.every(\n\t\t\t( val, index ) => val === colors[ index ]\n\t\t);\n\t} );\n\n\treturn preset ? `var:preset|duotone|${ preset.slug }` : undefined;\n}\n\nfunction DuotonePanelPure( { style, setAttributes, name } ) {\n\tconst duotoneStyle = style?.color?.duotone;\n\tconst settings = useBlockSettings( name );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst [ enableCustomColors, enableCustomDuotone ] = useSettings(\n\t\t'color.custom',\n\t\t'color.customDuotone'\n\t);\n\tconst disableCustomColors = ! enableCustomColors;\n\tconst disableCustomDuotone =\n\t\t! enableCustomDuotone ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst duotonePresetOrColors = ! Array.isArray( duotoneStyle )\n\t\t? getColorsFromDuotonePreset( duotoneStyle, duotonePalette )\n\t\t: duotoneStyle;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"filter\">\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tvalue={ { filter: { duotone: duotonePresetOrColors } } }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...newDuotone?.filter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<DuotoneControl\n\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tvalue={ duotonePresetOrColors }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst maybePreset = getDuotonePresetFromColors(\n\t\t\t\t\t\t\tnewDuotone,\n\t\t\t\t\t\t\tduotonePalette\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\t\tduotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: DuotonePanelPure,\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'filter.duotone' );\n\t},\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\tif ( ! hasBlockSupport( settings, 'filter.duotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\nfunction useDuotoneStyles( {\n\tclientId,\n\tid: filterId,\n\tselector: duotoneSelector,\n\tattribute: duotoneAttr,\n} ) {\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\n\t// Possible values for duotone attribute:\n\t// 1. Array of colors - e.g. ['#000000', '#ffffff'].\n\t// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''\n\t// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.\n\tconst isCustom = Array.isArray( duotoneAttr );\n\tconst duotonePreset = isCustom\n\t\t? undefined\n\t\t: getColorsFromDuotonePreset( duotoneAttr, duotonePalette );\n\tconst isPreset = typeof duotoneAttr === 'string' && duotonePreset;\n\tconst isCSS = typeof duotoneAttr === 'string' && ! isPreset;\n\n\t// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.\n\tlet colors = null;\n\tif ( isPreset ) {\n\t\t// Array of colors.\n\t\tcolors = duotonePreset;\n\t} else if ( isCSS ) {\n\t\t// CSS filter property string (e.g. 'unset').\n\t\tcolors = duotoneAttr;\n\t} else if ( isCustom ) {\n\t\t// Array of colors.\n\t\tcolors = duotoneAttr;\n\t}\n\n\t// Build the CSS selectors to which the filter will be applied.\n\tconst selectors = duotoneSelector.split( ',' );\n\n\tconst selectorsScoped = selectors.map( ( selectorPart ) => {\n\t\t// Assuming the selector part is a subclass selector (not a tag name)\n\t\t// so we can prepend the filter id class. If we want to support elements\n\t\t// such as `img` or namespaces, we'll need to add a case for that here.\n\t\treturn `.${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\tusePrivateStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tcss:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneStylesheet( selector, filterId )\n\t\t\t\t\t\t\t: getDuotoneUnsetStylesheet( selector ),\n\t\t\t\t\t__unstableType: 'presets',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\tusePrivateStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tassets:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneFilter( filterId, colors )\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t__unstableType: 'svgs',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\n\tconst blockElement = useBlockElement( clientId );\n\n\tuseEffect( () => {\n\t\tif ( ! isValidFilter ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Safari does not always update the duotone filter when the duotone\n\t\t// colors are changed. When using Safari, force the block element to be\n\t\t// repainted by the browser to ensure any changes are reflected\n\t\t// visually. This logic matches that used on the site frontend in\n\t\t// `block-supports/duotone.php`.\n\t\tif ( blockElement && isSafari ) {\n\t\t\tconst display = blockElement.style.display;\n\t\t\t// Switch to `inline-block` to force a repaint. In the editor,\n\t\t\t// `inline-block` is used instead of `none` to ensure that scroll\n\t\t\t// position is not affected, as `none` results in the editor\n\t\t\t// scrolling to the top of the block.\n\t\t\tblockElement.style.setProperty( 'display', 'inline-block' );\n\t\t\t// Simply accessing el.offsetHeight flushes layout and style changes\n\t\t\t// in WebKit without having to wait for setTimeout.\n\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\tblockElement.offsetHeight;\n\t\t\tblockElement.style.setProperty( 'display', display );\n\t\t}\n\t\t// `colors` must be a dependency so this effect runs when the colors\n\t\t// change in Safari.\n\t}, [ isValidFilter, blockElement, colors ] );\n}\n\n// Used for generating the instance ID\nconst DUOTONE_BLOCK_PROPS_REFERENCE = {};\n\nfunction useBlockProps( { clientId, name, style } ) {\n\tconst id = useInstanceId( DUOTONE_BLOCK_PROPS_REFERENCE );\n\tconst selector = useMemo( () => {\n\t\tconst blockType = getBlockType( name );\n\n\t\tif ( blockType ) {\n\t\t\t// Backwards compatibility for `supports.color.__experimentalDuotone`\n\t\t\t// is provided via the `block_type_metadata_settings` filter. If\n\t\t\t// `supports.filter.duotone` has not been set and the\n\t\t\t// experimental property has been, the experimental property\n\t\t\t// value is copied into `supports.filter.duotone`.\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'filter.duotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( ! duotoneSupport ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// If the experimental duotone support was set, that value is\n\t\t\t// to be treated as a selector and requires scoping.\n\t\t\tconst experimentalDuotone = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( experimentalDuotone ) {\n\t\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\t\treturn typeof experimentalDuotone === 'string'\n\t\t\t\t\t? scopeSelector( rootSelector, experimentalDuotone )\n\t\t\t\t\t: rootSelector;\n\t\t\t}\n\n\t\t\t// Regular filter.duotone support uses filter.duotone selectors with fallbacks.\n\t\t\treturn getBlockCSSSelector( blockType, 'filter.duotone', {\n\t\t\t\tfallback: true,\n\t\t\t} );\n\t\t}\n\t}, [ name ] );\n\n\tconst attribute = style?.color?.duotone;\n\n\tconst filterClass = `wp-duotone-${ id }`;\n\n\tconst shouldRender = selector && attribute;\n\n\tuseDuotoneStyles( {\n\t\tclientId,\n\t\tid: filterClass,\n\t\tselector,\n\t\tattribute,\n\t} );\n\n\treturn {\n\t\tclassName: shouldRender ? filterClass : '',\n\t};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,QAAQ;AAC/B,OAAOC,WAAW,MAAM,sBAAsB;;AAE9C;AACA;AACA;AACA,SACCC,eAAe,EACfC,YAAY,EACZC,eAAe,QACT,mBAAmB;AAC1B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA,SACCC,aAAa,EACbC,iBAAiB,EACjBC,4BAA4B,IAAIC,cAAc,EAC9CC,WAAW,QACL,eAAe;AACtB,SACCC,gBAAgB,EAChBC,oBAAoB,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,CAAC;MACD,IAAK,CAAEC,cAAc,EAAG;QACvB,OAAO,IAAI;MACZ;;MAEA;MACA;MACA,MAAMC,mBAAmB,GAAGxH,eAAe,CAC1CsH,SAAS,EACT,6BAA6B,EAC7B,KACD,CAAC;MACD,IAAKE,mBAAmB,EAAG;QAC1B,MAAMC,YAAY,GAAG1G,mBAAmB,CAAEuG,SAAU,CAAC;QACrD,OAAO,OAAOE,mBAAmB,KAAK,QAAQ,GAC3CxG,aAAa,CAAEyG,YAAY,EAAED,mBAAoB,CAAC,GAClDC,YAAY;MAChB;;MAEA;MACA,OAAO1G,mBAAmB,CAAEuG,SAAS,EAAE,gBAAgB,EAAE;QACxDI,QAAQ,EAAE;MACX,CAAE,CAAC;IACJ;EACD,CAAC,EAAE,CAAE9D,IAAI,CAAG,CAAC;EAEb,MAAMqC,SAAS,GAAGvC,KAAK,EAAEI,KAAK,EAAEnB,OAAO;EAEvC,MAAMgF,WAAW,GAAG,cAAe9B,EAAE,EAAG;EAExC,MAAM+B,YAAY,GAAG7B,QAAQ,IAAIE,SAAS;EAE1CN,gBAAgB,CAAE;IACjBC,QAAQ;IACRC,EAAE,EAAE8B,WAAW;IACf5B,QAAQ;IACRE;EACD,CAAE,CAAC;EAEH,OAAO;IACN4B,SAAS,EAAED,YAAY,GAAGD,WAAW,GAAG;EACzC,CAAC;AACF;AAEAvH,SAAS,CACR,0BAA0B,EAC1B,oCAAoC,EACpCkF,oBACD,CAAC","ignoreList":[]}
@@ -12,7 +12,7 @@ import { privateApis as componentsPrivateApis } from '@wordpress/components';
12
12
  import { shouldSkipSerialization } from './utils';
13
13
  import { TYPOGRAPHY_SUPPORT_KEY } from './typography';
14
14
  import { unlock } from '../lock-unlock';
15
- export const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';
15
+ export const FONT_FAMILY_SUPPORT_KEY = 'typography.fontFamily';
16
16
  const {
17
17
  kebabCase
18
18
  } = unlock(componentsPrivateApis);