@wordpress/block-editor 12.24.0 → 12.25.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 (510) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +1 -1
  3. package/build/components/alignment-control/ui.js +3 -1
  4. package/build/components/alignment-control/ui.js.map +1 -1
  5. package/build/components/block-inspector/index.js +1 -1
  6. package/build/components/block-inspector/index.js.map +1 -1
  7. package/build/components/block-list/block.js +0 -9
  8. package/build/components/block-list/block.js.map +1 -1
  9. package/build/components/block-list/index.js +4 -3
  10. package/build/components/block-list/index.js.map +1 -1
  11. package/build/components/block-list/index.native.js +1 -9
  12. package/build/components/block-list/index.native.js.map +1 -1
  13. package/build/components/block-list/use-block-props/index.js +6 -6
  14. package/build/components/block-list/use-block-props/index.js.map +1 -1
  15. package/build/components/block-list/use-block-props/use-block-refs.js +17 -46
  16. package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
  17. package/build/components/block-list/use-block-props/use-is-hovered.js +10 -14
  18. package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  19. package/build/components/block-mover/index.native.js +3 -1
  20. package/build/components/block-mover/index.native.js.map +1 -1
  21. package/build/components/block-settings-menu/block-settings-dropdown.js +0 -25
  22. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  23. package/build/components/block-switcher/pattern-transformations-menu.js +3 -1
  24. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  25. package/build/components/block-switcher/use-transformed-patterns.js +6 -2
  26. package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
  27. package/build/components/block-switcher/utils.js +15 -5
  28. package/build/components/block-switcher/utils.js.map +1 -1
  29. package/build/components/block-toolbar/use-has-block-toolbar.js +14 -9
  30. package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
  31. package/build/components/block-tools/index.js +3 -1
  32. package/build/components/block-tools/index.js.map +1 -1
  33. package/build/components/block-tools/use-show-block-tools.js +2 -5
  34. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  35. package/build/components/block-tools/zoom-out-mode-inserters.js +5 -1
  36. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  37. package/build/components/block-variation-picker/index.js +3 -2
  38. package/build/components/block-variation-picker/index.js.map +1 -1
  39. package/build/components/block-variation-transforms/index.js +3 -1
  40. package/build/components/block-variation-transforms/index.js.map +1 -1
  41. package/build/components/floating-toolbar/index.native.js +9 -5
  42. package/build/components/floating-toolbar/index.native.js.map +1 -1
  43. package/build/components/global-styles/background-panel.js +1 -1
  44. package/build/components/global-styles/background-panel.js.map +1 -1
  45. package/build/components/global-styles/color-panel.js +3 -1
  46. package/build/components/global-styles/color-panel.js.map +1 -1
  47. package/build/components/global-styles/dimensions-panel.js +16 -0
  48. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  49. package/build/components/global-styles/hooks.js +3 -2
  50. package/build/components/global-styles/hooks.js.map +1 -1
  51. package/build/components/global-styles/typography-panel.js +23 -23
  52. package/build/components/global-styles/typography-panel.js.map +1 -1
  53. package/build/components/global-styles/use-global-styles-output.js +149 -132
  54. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  55. package/build/components/global-styles/utils.js +45 -0
  56. package/build/components/global-styles/utils.js.map +1 -1
  57. package/build/components/inner-blocks/index.js +16 -2
  58. package/build/components/inner-blocks/index.js.map +1 -1
  59. package/build/components/inserter/block-patterns-tab/index.js +12 -31
  60. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  61. package/build/components/inserter/block-types-tab.js +4 -0
  62. package/build/components/inserter/block-types-tab.js.map +1 -1
  63. package/build/components/inserter/category-tabs/index.js +56 -0
  64. package/build/components/inserter/category-tabs/index.js.map +1 -0
  65. package/build/components/inserter/media-tab/index.js +2 -2
  66. package/build/components/inserter/media-tab/index.js.map +1 -1
  67. package/build/components/inserter/media-tab/media-panel.js +0 -25
  68. package/build/components/inserter/media-tab/media-panel.js.map +1 -1
  69. package/build/components/inserter/media-tab/media-preview.js +13 -3
  70. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  71. package/build/components/inserter/media-tab/media-tab.js +15 -29
  72. package/build/components/inserter/media-tab/media-tab.js.map +1 -1
  73. package/build/components/inserter/menu.js +59 -69
  74. package/build/components/inserter/menu.js.map +1 -1
  75. package/build/components/inserter/tabs.js +6 -6
  76. package/build/components/inserter/tabs.js.map +1 -1
  77. package/build/components/line-height-control/index.js +6 -2
  78. package/build/components/line-height-control/index.js.map +1 -1
  79. package/build/components/link-control/search-item.js +9 -3
  80. package/build/components/link-control/search-item.js.map +1 -1
  81. package/build/components/list-view/block-select-button.js +5 -170
  82. package/build/components/list-view/block-select-button.js.map +1 -1
  83. package/build/components/list-view/block.js +166 -14
  84. package/build/components/list-view/block.js.map +1 -1
  85. package/build/components/list-view/index.js +1 -1
  86. package/build/components/list-view/index.js.map +1 -1
  87. package/build/components/list-view/use-list-view-drop-zone.js +1 -1
  88. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  89. package/build/components/list-view/utils.js +3 -1
  90. package/build/components/list-view/utils.js.map +1 -1
  91. package/build/components/media-placeholder/index.js +3 -3
  92. package/build/components/media-placeholder/index.js.map +1 -1
  93. package/build/components/navigable-toolbar/index.js +3 -1
  94. package/build/components/navigable-toolbar/index.js.map +1 -1
  95. package/build/components/provider/block-refs-provider.js +3 -4
  96. package/build/components/provider/block-refs-provider.js.map +1 -1
  97. package/build/components/provider/use-block-sync.js +3 -12
  98. package/build/components/provider/use-block-sync.js.map +1 -1
  99. package/build/components/rich-text/event-listeners/before-input-rules.js +93 -0
  100. package/build/components/rich-text/event-listeners/before-input-rules.js.map +1 -0
  101. package/build/components/rich-text/event-listeners/delete.js +58 -0
  102. package/build/components/rich-text/event-listeners/delete.js.map +1 -0
  103. package/build/components/rich-text/event-listeners/enter.js +98 -0
  104. package/build/components/rich-text/event-listeners/enter.js.map +1 -0
  105. package/build/components/rich-text/event-listeners/firefox-compat.js +36 -0
  106. package/build/components/rich-text/event-listeners/firefox-compat.js.map +1 -0
  107. package/build/components/rich-text/event-listeners/index.js +44 -0
  108. package/build/components/rich-text/event-listeners/index.js.map +1 -0
  109. package/build/components/rich-text/event-listeners/input-events.js +22 -0
  110. package/build/components/rich-text/event-listeners/input-events.js.map +1 -0
  111. package/build/components/rich-text/event-listeners/input-rules.js +135 -0
  112. package/build/components/rich-text/event-listeners/input-rules.js.map +1 -0
  113. package/build/components/rich-text/event-listeners/insert-replacement-text.js +33 -0
  114. package/build/components/rich-text/event-listeners/insert-replacement-text.js.map +1 -0
  115. package/build/components/rich-text/event-listeners/paste-handler.js +146 -0
  116. package/build/components/rich-text/event-listeners/paste-handler.js.map +1 -0
  117. package/build/components/rich-text/event-listeners/remove-browser-shortcuts.js +27 -0
  118. package/build/components/rich-text/event-listeners/remove-browser-shortcuts.js.map +1 -0
  119. package/build/components/rich-text/event-listeners/shortcuts.js +22 -0
  120. package/build/components/rich-text/event-listeners/shortcuts.js.map +1 -0
  121. package/build/components/rich-text/event-listeners/undo-automatic-change.js +51 -0
  122. package/build/components/rich-text/event-listeners/undo-automatic-change.js.map +1 -0
  123. package/build/components/rich-text/index.js +11 -31
  124. package/build/components/rich-text/index.js.map +1 -1
  125. package/build/components/rich-text/index.native.js +13 -3
  126. package/build/components/rich-text/index.native.js.map +1 -1
  127. package/build/components/rich-text/multiline.js +6 -2
  128. package/build/components/rich-text/multiline.js.map +1 -1
  129. package/build/components/rich-text/native/index.native.js +12 -0
  130. package/build/components/rich-text/native/index.native.js.map +1 -1
  131. package/build/components/rich-text/use-format-types.js +8 -4
  132. package/build/components/rich-text/use-format-types.js.map +1 -1
  133. package/build/components/segmented-text-control/index.js +62 -0
  134. package/build/components/segmented-text-control/index.js.map +1 -0
  135. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +16 -2
  136. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  137. package/build/components/text-alignment-control/index.js +76 -0
  138. package/build/components/text-alignment-control/index.js.map +1 -0
  139. package/build/components/text-decoration-control/index.js +21 -25
  140. package/build/components/text-decoration-control/index.js.map +1 -1
  141. package/build/components/text-transform-control/index.js +18 -22
  142. package/build/components/text-transform-control/index.js.map +1 -1
  143. package/build/components/use-block-display-information/index.js +9 -3
  144. package/build/components/use-block-display-information/index.js.map +1 -1
  145. package/build/components/use-on-block-drop/index.js +3 -1
  146. package/build/components/use-on-block-drop/index.js.map +1 -1
  147. package/build/components/writing-flow/use-drag-selection.js +3 -1
  148. package/build/components/writing-flow/use-drag-selection.js.map +1 -1
  149. package/build/components/writing-flow/use-tab-nav.js +3 -1
  150. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  151. package/build/components/writing-mode-control/index.js +16 -20
  152. package/build/components/writing-mode-control/index.js.map +1 -1
  153. package/build/hooks/duotone.js +3 -1
  154. package/build/hooks/duotone.js.map +1 -1
  155. package/build/hooks/utils.js +11 -6
  156. package/build/hooks/utils.js.map +1 -1
  157. package/build/private-apis.js +4 -2
  158. package/build/private-apis.js.map +1 -1
  159. package/build/store/actions.js +32 -8
  160. package/build/store/actions.js.map +1 -1
  161. package/build/store/private-selectors.js +27 -6
  162. package/build/store/private-selectors.js.map +1 -1
  163. package/build/store/reducer.js +11 -8
  164. package/build/store/reducer.js.map +1 -1
  165. package/build/store/selectors.js +21 -7
  166. package/build/store/selectors.js.map +1 -1
  167. package/build/utils/object.js +17 -0
  168. package/build/utils/object.js.map +1 -1
  169. package/build/utils/order-inserter-block-items.js +6 -2
  170. package/build/utils/order-inserter-block-items.js.map +1 -1
  171. package/build/utils/pasting.js +6 -2
  172. package/build/utils/pasting.js.map +1 -1
  173. package/build-module/components/alignment-control/ui.js +3 -1
  174. package/build-module/components/alignment-control/ui.js.map +1 -1
  175. package/build-module/components/block-inspector/index.js +1 -1
  176. package/build-module/components/block-inspector/index.js.map +1 -1
  177. package/build-module/components/block-list/block.js +0 -9
  178. package/build-module/components/block-list/block.js.map +1 -1
  179. package/build-module/components/block-list/index.js +4 -3
  180. package/build-module/components/block-list/index.js.map +1 -1
  181. package/build-module/components/block-list/index.native.js +1 -9
  182. package/build-module/components/block-list/index.native.js.map +1 -1
  183. package/build-module/components/block-list/use-block-props/index.js +6 -6
  184. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  185. package/build-module/components/block-list/use-block-props/use-block-refs.js +19 -48
  186. package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
  187. package/build-module/components/block-list/use-block-props/use-is-hovered.js +10 -14
  188. package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  189. package/build-module/components/block-mover/index.native.js +3 -1
  190. package/build-module/components/block-mover/index.native.js.map +1 -1
  191. package/build-module/components/block-settings-menu/block-settings-dropdown.js +1 -26
  192. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  193. package/build-module/components/block-switcher/pattern-transformations-menu.js +3 -1
  194. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  195. package/build-module/components/block-switcher/use-transformed-patterns.js +6 -2
  196. package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
  197. package/build-module/components/block-switcher/utils.js +15 -5
  198. package/build-module/components/block-switcher/utils.js.map +1 -1
  199. package/build-module/components/block-toolbar/use-has-block-toolbar.js +14 -9
  200. package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
  201. package/build-module/components/block-tools/index.js +3 -1
  202. package/build-module/components/block-tools/index.js.map +1 -1
  203. package/build-module/components/block-tools/use-show-block-tools.js +2 -5
  204. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  205. package/build-module/components/block-tools/zoom-out-mode-inserters.js +5 -1
  206. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  207. package/build-module/components/block-variation-picker/index.js +3 -2
  208. package/build-module/components/block-variation-picker/index.js.map +1 -1
  209. package/build-module/components/block-variation-transforms/index.js +3 -1
  210. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  211. package/build-module/components/floating-toolbar/index.native.js +9 -5
  212. package/build-module/components/floating-toolbar/index.native.js.map +1 -1
  213. package/build-module/components/global-styles/background-panel.js +1 -1
  214. package/build-module/components/global-styles/background-panel.js.map +1 -1
  215. package/build-module/components/global-styles/color-panel.js +3 -1
  216. package/build-module/components/global-styles/color-panel.js.map +1 -1
  217. package/build-module/components/global-styles/dimensions-panel.js +17 -1
  218. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  219. package/build-module/components/global-styles/hooks.js +3 -2
  220. package/build-module/components/global-styles/hooks.js.map +1 -1
  221. package/build-module/components/global-styles/typography-panel.js +24 -24
  222. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  223. package/build-module/components/global-styles/use-global-styles-output.js +149 -132
  224. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  225. package/build-module/components/global-styles/utils.js +44 -0
  226. package/build-module/components/global-styles/utils.js.map +1 -1
  227. package/build-module/components/inner-blocks/index.js +16 -2
  228. package/build-module/components/inner-blocks/index.js.map +1 -1
  229. package/build-module/components/inserter/block-patterns-tab/index.js +13 -32
  230. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  231. package/build-module/components/inserter/block-types-tab.js +4 -0
  232. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  233. package/build-module/components/inserter/category-tabs/index.js +49 -0
  234. package/build-module/components/inserter/category-tabs/index.js.map +1 -0
  235. package/build-module/components/inserter/media-tab/index.js +1 -1
  236. package/build-module/components/inserter/media-tab/index.js.map +1 -1
  237. package/build-module/components/inserter/media-tab/media-panel.js +0 -24
  238. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
  239. package/build-module/components/inserter/media-tab/media-preview.js +13 -3
  240. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  241. package/build-module/components/inserter/media-tab/media-tab.js +17 -31
  242. package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
  243. package/build-module/components/inserter/menu.js +61 -71
  244. package/build-module/components/inserter/menu.js.map +1 -1
  245. package/build-module/components/inserter/tabs.js +6 -6
  246. package/build-module/components/inserter/tabs.js.map +1 -1
  247. package/build-module/components/line-height-control/index.js +6 -2
  248. package/build-module/components/line-height-control/index.js.map +1 -1
  249. package/build-module/components/link-control/search-item.js +9 -3
  250. package/build-module/components/link-control/search-item.js.map +1 -1
  251. package/build-module/components/list-view/block-select-button.js +7 -172
  252. package/build-module/components/list-view/block-select-button.js.map +1 -1
  253. package/build-module/components/list-view/block.js +167 -15
  254. package/build-module/components/list-view/block.js.map +1 -1
  255. package/build-module/components/list-view/index.js +1 -1
  256. package/build-module/components/list-view/index.js.map +1 -1
  257. package/build-module/components/list-view/use-list-view-drop-zone.js +1 -1
  258. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  259. package/build-module/components/list-view/utils.js +3 -1
  260. package/build-module/components/list-view/utils.js.map +1 -1
  261. package/build-module/components/media-placeholder/index.js +3 -3
  262. package/build-module/components/media-placeholder/index.js.map +1 -1
  263. package/build-module/components/navigable-toolbar/index.js +3 -1
  264. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  265. package/build-module/components/provider/block-refs-provider.js +3 -4
  266. package/build-module/components/provider/block-refs-provider.js.map +1 -1
  267. package/build-module/components/provider/use-block-sync.js +4 -13
  268. package/build-module/components/provider/use-block-sync.js.map +1 -1
  269. package/build-module/components/rich-text/event-listeners/before-input-rules.js +86 -0
  270. package/build-module/components/rich-text/event-listeners/before-input-rules.js.map +1 -0
  271. package/build-module/components/rich-text/event-listeners/delete.js +51 -0
  272. package/build-module/components/rich-text/event-listeners/delete.js.map +1 -0
  273. package/build-module/components/rich-text/event-listeners/enter.js +92 -0
  274. package/build-module/components/rich-text/event-listeners/enter.js.map +1 -0
  275. package/build-module/components/rich-text/event-listeners/firefox-compat.js +29 -0
  276. package/build-module/components/rich-text/event-listeners/firefox-compat.js.map +1 -0
  277. package/build-module/components/rich-text/event-listeners/index.js +36 -0
  278. package/build-module/components/rich-text/event-listeners/index.js.map +1 -0
  279. package/build-module/components/rich-text/event-listeners/input-events.js +15 -0
  280. package/build-module/components/rich-text/event-listeners/input-events.js.map +1 -0
  281. package/build-module/components/rich-text/event-listeners/input-rules.js +127 -0
  282. package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -0
  283. package/build-module/components/rich-text/event-listeners/insert-replacement-text.js +27 -0
  284. package/build-module/components/rich-text/event-listeners/insert-replacement-text.js.map +1 -0
  285. package/build-module/components/rich-text/event-listeners/paste-handler.js +142 -0
  286. package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -0
  287. package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js +21 -0
  288. package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js.map +1 -0
  289. package/build-module/components/rich-text/event-listeners/shortcuts.js +15 -0
  290. package/build-module/components/rich-text/event-listeners/shortcuts.js.map +1 -0
  291. package/build-module/components/rich-text/event-listeners/undo-automatic-change.js +45 -0
  292. package/build-module/components/rich-text/event-listeners/undo-automatic-change.js.map +1 -0
  293. package/build-module/components/rich-text/index.js +12 -32
  294. package/build-module/components/rich-text/index.js.map +1 -1
  295. package/build-module/components/rich-text/index.native.js +13 -3
  296. package/build-module/components/rich-text/index.native.js.map +1 -1
  297. package/build-module/components/rich-text/multiline.js +6 -2
  298. package/build-module/components/rich-text/multiline.js.map +1 -1
  299. package/build-module/components/rich-text/native/index.native.js +12 -0
  300. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  301. package/build-module/components/rich-text/use-format-types.js +8 -4
  302. package/build-module/components/rich-text/use-format-types.js.map +1 -1
  303. package/build-module/components/segmented-text-control/index.js +55 -0
  304. package/build-module/components/segmented-text-control/index.js.map +1 -0
  305. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +16 -2
  306. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  307. package/build-module/components/text-alignment-control/index.js +68 -0
  308. package/build-module/components/text-alignment-control/index.js.map +1 -0
  309. package/build-module/components/text-decoration-control/index.js +21 -25
  310. package/build-module/components/text-decoration-control/index.js.map +1 -1
  311. package/build-module/components/text-transform-control/index.js +18 -22
  312. package/build-module/components/text-transform-control/index.js.map +1 -1
  313. package/build-module/components/use-block-display-information/index.js +9 -3
  314. package/build-module/components/use-block-display-information/index.js.map +1 -1
  315. package/build-module/components/use-on-block-drop/index.js +3 -1
  316. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  317. package/build-module/components/writing-flow/use-drag-selection.js +3 -1
  318. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
  319. package/build-module/components/writing-flow/use-tab-nav.js +3 -1
  320. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  321. package/build-module/components/writing-mode-control/index.js +16 -20
  322. package/build-module/components/writing-mode-control/index.js.map +1 -1
  323. package/build-module/hooks/duotone.js +3 -1
  324. package/build-module/hooks/duotone.js.map +1 -1
  325. package/build-module/hooks/utils.js +11 -6
  326. package/build-module/hooks/utils.js.map +1 -1
  327. package/build-module/private-apis.js +4 -2
  328. package/build-module/private-apis.js.map +1 -1
  329. package/build-module/store/actions.js +32 -8
  330. package/build-module/store/actions.js.map +1 -1
  331. package/build-module/store/private-selectors.js +27 -5
  332. package/build-module/store/private-selectors.js.map +1 -1
  333. package/build-module/store/reducer.js +11 -8
  334. package/build-module/store/reducer.js.map +1 -1
  335. package/build-module/store/selectors.js +21 -7
  336. package/build-module/store/selectors.js.map +1 -1
  337. package/build-module/utils/object.js +16 -0
  338. package/build-module/utils/object.js.map +1 -1
  339. package/build-module/utils/order-inserter-block-items.js +6 -2
  340. package/build-module/utils/order-inserter-block-items.js.map +1 -1
  341. package/build-module/utils/pasting.js +6 -2
  342. package/build-module/utils/pasting.js.map +1 -1
  343. package/build-style/content-rtl.css +41 -68
  344. package/build-style/content.css +41 -68
  345. package/build-style/style-rtl.css +100 -199
  346. package/build-style/style.css +100 -199
  347. package/package.json +31 -31
  348. package/src/components/alignment-control/ui.js +3 -1
  349. package/src/components/block-bindings-toolbar-indicator/style.scss +1 -4
  350. package/src/components/block-canvas/style.scss +1 -3
  351. package/src/components/block-draggable/test/helpers.native.js +8 -8
  352. package/src/components/block-inspector/index.js +1 -2
  353. package/src/components/block-list/block.js +2 -13
  354. package/src/components/block-list/content.scss +9 -1
  355. package/src/components/block-list/index.js +4 -4
  356. package/src/components/block-list/index.native.js +1 -6
  357. package/src/components/block-list/use-block-props/index.js +12 -4
  358. package/src/components/block-list/use-block-props/use-block-refs.js +17 -57
  359. package/src/components/block-list/use-block-props/use-is-hovered.js +11 -16
  360. package/src/components/block-mover/index.native.js +3 -1
  361. package/src/components/block-patterns-list/style.scss +1 -3
  362. package/src/components/block-preview/style.scss +13 -15
  363. package/src/components/block-settings-menu/block-settings-dropdown.js +1 -51
  364. package/src/components/block-switcher/pattern-transformations-menu.js +3 -1
  365. package/src/components/block-switcher/use-transformed-patterns.js +6 -2
  366. package/src/components/block-switcher/utils.js +14 -5
  367. package/src/components/block-toolbar/style.scss +8 -11
  368. package/src/components/block-toolbar/use-has-block-toolbar.js +21 -16
  369. package/src/components/block-tools/index.js +3 -1
  370. package/src/components/block-tools/use-show-block-tools.js +36 -48
  371. package/src/components/block-tools/zoom-out-mode-inserters.js +5 -1
  372. package/src/components/block-variation-picker/content.scss +22 -72
  373. package/src/components/block-variation-picker/index.js +3 -2
  374. package/src/components/block-variation-transforms/index.js +3 -1
  375. package/src/components/floating-toolbar/index.native.js +5 -2
  376. package/src/components/global-styles/background-panel.js +1 -3
  377. package/src/components/global-styles/color-panel.js +3 -1
  378. package/src/components/global-styles/dimensions-panel.js +18 -1
  379. package/src/components/global-styles/hooks.js +2 -0
  380. package/src/components/global-styles/test/utils.js +21 -0
  381. package/src/components/global-styles/typography-panel.js +27 -23
  382. package/src/components/global-styles/use-global-styles-output.js +211 -187
  383. package/src/components/global-styles/utils.js +55 -0
  384. package/src/components/inner-blocks/index.js +14 -1
  385. package/src/components/inserter/block-patterns-tab/index.js +15 -65
  386. package/src/components/inserter/block-types-tab.js +5 -0
  387. package/src/components/inserter/category-tabs/index.js +74 -0
  388. package/src/components/inserter/media-tab/index.js +1 -1
  389. package/src/components/inserter/media-tab/media-panel.js +0 -22
  390. package/src/components/inserter/media-tab/media-preview.js +15 -7
  391. package/src/components/inserter/media-tab/media-tab.js +44 -83
  392. package/src/components/inserter/menu.js +139 -117
  393. package/src/components/inserter/style.scss +90 -170
  394. package/src/components/inserter/tabs.js +5 -13
  395. package/src/components/line-height-control/index.js +6 -2
  396. package/src/components/link-control/search-item.js +9 -3
  397. package/src/components/list-view/block-select-button.js +73 -266
  398. package/src/components/list-view/block.js +218 -28
  399. package/src/components/list-view/index.js +1 -1
  400. package/src/components/list-view/style.scss +20 -28
  401. package/src/components/list-view/use-list-view-drop-zone.js +1 -1
  402. package/src/components/list-view/utils.js +3 -1
  403. package/src/components/media-placeholder/content.scss +0 -11
  404. package/src/components/media-placeholder/index.js +3 -3
  405. package/src/components/navigable-toolbar/index.js +3 -1
  406. package/src/components/provider/block-refs-provider.js +3 -8
  407. package/src/components/provider/test/use-block-sync.js +7 -0
  408. package/src/components/provider/use-block-sync.js +3 -20
  409. package/src/components/rich-text/event-listeners/before-input-rules.js +92 -0
  410. package/src/components/rich-text/event-listeners/delete.js +53 -0
  411. package/src/components/rich-text/event-listeners/enter.js +104 -0
  412. package/src/components/rich-text/event-listeners/firefox-compat.js +31 -0
  413. package/src/components/rich-text/event-listeners/index.js +56 -0
  414. package/src/components/rich-text/event-listeners/input-events.js +13 -0
  415. package/src/components/rich-text/event-listeners/input-rules.js +146 -0
  416. package/src/components/rich-text/event-listeners/insert-replacement-text.js +28 -0
  417. package/src/components/rich-text/event-listeners/paste-handler.js +169 -0
  418. package/src/components/rich-text/event-listeners/remove-browser-shortcuts.js +24 -0
  419. package/src/components/rich-text/event-listeners/shortcuts.js +13 -0
  420. package/src/components/rich-text/event-listeners/undo-automatic-change.js +45 -0
  421. package/src/components/rich-text/index.js +7 -34
  422. package/src/components/rich-text/index.native.js +11 -0
  423. package/src/components/rich-text/multiline.js +6 -2
  424. package/src/components/rich-text/native/index.native.js +11 -0
  425. package/src/components/rich-text/use-format-types.js +6 -2
  426. package/src/components/segmented-text-control/index.js +63 -0
  427. package/src/components/{writing-mode-control → segmented-text-control}/style.scss +2 -5
  428. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +16 -1
  429. package/src/components/text-alignment-control/index.js +91 -0
  430. package/src/components/text-alignment-control/stories/index.story.js +39 -0
  431. package/src/components/text-decoration-control/index.js +20 -33
  432. package/src/components/text-transform-control/index.js +17 -30
  433. package/src/components/use-block-display-information/index.js +9 -3
  434. package/src/components/use-on-block-drop/index.js +3 -1
  435. package/src/components/writing-flow/use-drag-selection.js +3 -1
  436. package/src/components/writing-flow/use-tab-nav.js +3 -1
  437. package/src/components/writing-mode-control/index.js +15 -28
  438. package/src/hooks/duotone.js +3 -1
  439. package/src/hooks/utils.js +16 -2
  440. package/src/private-apis.js +4 -2
  441. package/src/store/actions.js +36 -12
  442. package/src/store/private-selectors.js +28 -4
  443. package/src/store/reducer.js +13 -23
  444. package/src/store/selectors.js +20 -7
  445. package/src/style.scss +1 -2
  446. package/src/utils/object.js +16 -0
  447. package/src/utils/order-inserter-block-items.js +6 -2
  448. package/src/utils/pasting.js +6 -2
  449. package/build/components/block-list/use-block-props/use-block-moving-mode-class-names.js +0 -54
  450. package/build/components/block-list/use-block-props/use-block-moving-mode-class-names.js.map +0 -1
  451. package/build/components/rich-text/use-before-input-rules.js +0 -98
  452. package/build/components/rich-text/use-before-input-rules.js.map +0 -1
  453. package/build/components/rich-text/use-delete.js +0 -64
  454. package/build/components/rich-text/use-delete.js.map +0 -1
  455. package/build/components/rich-text/use-enter.js +0 -109
  456. package/build/components/rich-text/use-enter.js.map +0 -1
  457. package/build/components/rich-text/use-firefox-compat.js +0 -44
  458. package/build/components/rich-text/use-firefox-compat.js.map +0 -1
  459. package/build/components/rich-text/use-input-events.js +0 -25
  460. package/build/components/rich-text/use-input-events.js.map +0 -1
  461. package/build/components/rich-text/use-input-rules.js +0 -139
  462. package/build/components/rich-text/use-input-rules.js.map +0 -1
  463. package/build/components/rich-text/use-insert-replacement-text.js +0 -38
  464. package/build/components/rich-text/use-insert-replacement-text.js.map +0 -1
  465. package/build/components/rich-text/use-paste-handler.js +0 -158
  466. package/build/components/rich-text/use-paste-handler.js.map +0 -1
  467. package/build/components/rich-text/use-remove-browser-shortcuts.js +0 -32
  468. package/build/components/rich-text/use-remove-browser-shortcuts.js.map +0 -1
  469. package/build/components/rich-text/use-shortcuts.js +0 -25
  470. package/build/components/rich-text/use-shortcuts.js.map +0 -1
  471. package/build/components/rich-text/use-undo-automatic-change.js +0 -53
  472. package/build/components/rich-text/use-undo-automatic-change.js.map +0 -1
  473. package/build-module/components/block-list/use-block-props/use-block-moving-mode-class-names.js +0 -47
  474. package/build-module/components/block-list/use-block-props/use-block-moving-mode-class-names.js.map +0 -1
  475. package/build-module/components/rich-text/use-before-input-rules.js +0 -92
  476. package/build-module/components/rich-text/use-before-input-rules.js.map +0 -1
  477. package/build-module/components/rich-text/use-delete.js +0 -57
  478. package/build-module/components/rich-text/use-delete.js.map +0 -1
  479. package/build-module/components/rich-text/use-enter.js +0 -102
  480. package/build-module/components/rich-text/use-enter.js.map +0 -1
  481. package/build-module/components/rich-text/use-firefox-compat.js +0 -37
  482. package/build-module/components/rich-text/use-firefox-compat.js.map +0 -1
  483. package/build-module/components/rich-text/use-input-events.js +0 -18
  484. package/build-module/components/rich-text/use-input-events.js.map +0 -1
  485. package/build-module/components/rich-text/use-input-rules.js +0 -132
  486. package/build-module/components/rich-text/use-input-rules.js.map +0 -1
  487. package/build-module/components/rich-text/use-insert-replacement-text.js +0 -32
  488. package/build-module/components/rich-text/use-insert-replacement-text.js.map +0 -1
  489. package/build-module/components/rich-text/use-paste-handler.js +0 -152
  490. package/build-module/components/rich-text/use-paste-handler.js.map +0 -1
  491. package/build-module/components/rich-text/use-remove-browser-shortcuts.js +0 -26
  492. package/build-module/components/rich-text/use-remove-browser-shortcuts.js.map +0 -1
  493. package/build-module/components/rich-text/use-shortcuts.js +0 -18
  494. package/build-module/components/rich-text/use-shortcuts.js.map +0 -1
  495. package/build-module/components/rich-text/use-undo-automatic-change.js +0 -46
  496. package/build-module/components/rich-text/use-undo-automatic-change.js.map +0 -1
  497. package/src/components/block-list/use-block-props/use-block-moving-mode-class-names.js +0 -55
  498. package/src/components/rich-text/use-before-input-rules.js +0 -99
  499. package/src/components/rich-text/use-delete.js +0 -59
  500. package/src/components/rich-text/use-enter.js +0 -110
  501. package/src/components/rich-text/use-firefox-compat.js +0 -39
  502. package/src/components/rich-text/use-input-events.js +0 -19
  503. package/src/components/rich-text/use-input-rules.js +0 -150
  504. package/src/components/rich-text/use-insert-replacement-text.js +0 -31
  505. package/src/components/rich-text/use-paste-handler.js +0 -180
  506. package/src/components/rich-text/use-remove-browser-shortcuts.js +0 -29
  507. package/src/components/rich-text/use-shortcuts.js +0 -19
  508. package/src/components/rich-text/use-undo-automatic-change.js +0 -46
  509. package/src/components/text-decoration-control/style.scss +0 -18
  510. package/src/components/text-transform-control/style.scss +0 -18
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","useRefEffect","store","blockEditorStore","setContentEditableWrapper","node","value","contentEditable","focus","useDragSelection","startMultiSelect","stopMultiSelect","isSelectionEnabled","hasSelectedBlock","isDraggingBlocks","isMultiSelecting","ownerDocument","defaultView","anchorElement","rafId","onMouseUp","removeEventListener","requestAnimationFrame","selection","getSelection","rangeCount","range","getRangeAt","commonAncestorContainer","clonedRange","cloneRange","contains","removeAllRanges","addRange","onMouseLeave","buttons","target","relatedTarget","getAttribute","addEventListener","cancelAnimationFrame"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-drag-selection.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Sets the `contenteditable` wrapper element to `value`.\n *\n * @param {HTMLElement} node Block element.\n * @param {boolean} value `contentEditable` value (true or false)\n */\nfunction setContentEditableWrapper( node, value ) {\n\tnode.contentEditable = value;\n\t// Firefox doesn't automatically move focus.\n\tif ( value ) node.focus();\n}\n\n/**\n * Sets a multi-selection based on the native selection across blocks.\n */\nexport default function useDragSelection() {\n\tconst { startMultiSelect, stopMultiSelect } =\n\t\tuseDispatch( blockEditorStore );\n\tconst {\n\t\tisSelectionEnabled,\n\t\thasSelectedBlock,\n\t\tisDraggingBlocks,\n\t\tisMultiSelecting,\n\t} = useSelect( blockEditorStore );\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\tlet anchorElement;\n\t\t\tlet rafId;\n\n\t\t\tfunction onMouseUp() {\n\t\t\t\tstopMultiSelect();\n\t\t\t\t// Equivalent to attaching the listener once.\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onMouseUp );\n\t\t\t\t// The browser selection won't have updated yet at this point,\n\t\t\t\t// so wait until the next animation frame to get the browser\n\t\t\t\t// selection.\n\t\t\t\trafId = defaultView.requestAnimationFrame( () => {\n\t\t\t\t\tif ( ! hasSelectedBlock() ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// If the selection is complete (on mouse up), and no\n\t\t\t\t\t// multiple blocks have been selected, set focus back to the\n\t\t\t\t\t// anchor element. if the anchor element contains the\n\t\t\t\t\t// selection. Additionally, the contentEditable wrapper can\n\t\t\t\t\t// now be disabled again.\n\t\t\t\t\tsetContentEditableWrapper( node, false );\n\n\t\t\t\t\tconst selection = defaultView.getSelection();\n\n\t\t\t\t\tif ( selection.rangeCount ) {\n\t\t\t\t\t\tconst range = selection.getRangeAt( 0 );\n\t\t\t\t\t\tconst { commonAncestorContainer } = range;\n\t\t\t\t\t\tconst clonedRange = range.cloneRange();\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tanchorElement.contains( commonAncestorContainer )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tanchorElement.focus();\n\t\t\t\t\t\t\tselection.removeAllRanges();\n\t\t\t\t\t\t\tselection.addRange( clonedRange );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tfunction onMouseLeave( { buttons, target, relatedTarget } ) {\n\t\t\t\t// If we're moving into a child element, ignore. We're tracking\n\t\t\t\t// the mouse leaving the element to a parent, no a child.\n\t\t\t\tif ( target.contains( relatedTarget ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Avoid triggering a multi-selection if the user is already\n\t\t\t\t// dragging blocks.\n\t\t\t\tif ( isDraggingBlocks() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// The primary button must be pressed to initiate selection.\n\t\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n\t\t\t\tif ( buttons !== 1 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Abort if we are already multi-selecting.\n\t\t\t\tif ( isMultiSelecting() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Abort if selection is leaving writing flow.\n\t\t\t\tif ( node === target ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Check the attribute, not the contentEditable attribute. All\n\t\t\t\t// child elements of the content editable wrapper are editable\n\t\t\t\t// and return true for this property. We only want to start\n\t\t\t\t// multi selecting when the mouse leaves the wrapper.\n\t\t\t\tif ( target.getAttribute( 'contenteditable' ) !== 'true' ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( ! isSelectionEnabled() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Do not rely on the active element because it may change after\n\t\t\t\t// the mouse leaves for the first time. See\n\t\t\t\t// https://github.com/WordPress/gutenberg/issues/48747.\n\t\t\t\tanchorElement = target;\n\n\t\t\t\tstartMultiSelect();\n\n\t\t\t\t// `onSelectionStart` is called after `mousedown` and\n\t\t\t\t// `mouseleave` (from a block). The selection ends when\n\t\t\t\t// `mouseup` happens anywhere in the window.\n\t\t\t\tdefaultView.addEventListener( 'mouseup', onMouseUp );\n\n\t\t\t\t// Allow cross contentEditable selection by temporarily making\n\t\t\t\t// all content editable. We can't rely on using the store and\n\t\t\t\t// React because re-rending happens too slowly. We need to be\n\t\t\t\t// able to select across instances immediately.\n\t\t\t\tsetContentEditableWrapper( node, true );\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mouseout', onMouseLeave );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mouseout', onMouseLeave );\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onMouseUp );\n\t\t\t\tdefaultView.cancelAnimationFrame( rafId );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tstartMultiSelect,\n\t\t\tstopMultiSelect,\n\t\t\tisSelectionEnabled,\n\t\t\thasSelectedBlock,\n\t\t]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,yBAAyBA,CAAEC,IAAI,EAAEC,KAAK,EAAG;EACjDD,IAAI,CAACE,eAAe,GAAGD,KAAK;EAC5B;EACA,IAAKA,KAAK,EAAGD,IAAI,CAACG,KAAK,CAAC,CAAC;AAC1B;;AAEA;AACA;AACA;AACA,eAAe,SAASC,gBAAgBA,CAAA,EAAG;EAC1C,MAAM;IAAEC,gBAAgB;IAAEC;EAAgB,CAAC,GAC1CX,WAAW,CAAEG,gBAAiB,CAAC;EAChC,MAAM;IACLS,kBAAkB;IAClBC,gBAAgB;IAChBC,gBAAgB;IA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EA;MACA;MACA,IAAKqB,OAAO,KAAK,CAAC,EAAG;QACpB;MACD;;MAEA;MACA,IAAKpB,gBAAgB,CAAC,CAAC,EAAG;QACzB;MACD;;MAEA;MACA,IAAKV,IAAI,KAAK+B,MAAM,EAAG;QACtB;MACD;;MAEA;MACA;MACA;MACA;MACA,IAAKA,MAAM,CAACE,YAAY,CAAE,iBAAkB,CAAC,KAAK,MAAM,EAAG;QAC1D;MACD;MAEA,IAAK,CAAE1B,kBAAkB,CAAC,CAAC,EAAG;QAC7B;MACD;;MAEA;MACA;MACA;MACAM,aAAa,GAAGkB,MAAM;MAEtB1B,gBAAgB,CAAC,CAAC;;MAElB;MACA;MACA;MACAO,WAAW,CAACsB,gBAAgB,CAAE,SAAS,EAAEnB,SAAU,CAAC;;MAEpD;MACA;MACA;MACA;MACAhB,yBAAyB,CAAEC,IAAI,EAAE,IAAK,CAAC;IACxC;IAEAA,IAAI,CAACkC,gBAAgB,CAAE,UAAU,EAAEL,YAAa,CAAC;IAEjD,OAAO,MAAM;MACZ7B,IAAI,CAACgB,mBAAmB,CAAE,UAAU,EAAEa,YAAa,CAAC;MACpDjB,WAAW,CAACI,mBAAmB,CAAE,SAAS,EAAED,SAAU,CAAC;MACvDH,WAAW,CAACuB,oBAAoB,CAAErB,KAAM,CAAC;IAC1C,CAAC;EACF,CAAC,EACD,CACCT,gBAAgB,EAChBC,eAAe,EACfC,kBAAkB,EAClBC,gBAAgB,CAElB,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useDispatch","useRefEffect","store","blockEditorStore","setContentEditableWrapper","node","value","contentEditable","focus","useDragSelection","startMultiSelect","stopMultiSelect","isSelectionEnabled","hasSelectedBlock","isDraggingBlocks","isMultiSelecting","ownerDocument","defaultView","anchorElement","rafId","onMouseUp","removeEventListener","requestAnimationFrame","selection","getSelection","rangeCount","range","getRangeAt","commonAncestorContainer","clonedRange","cloneRange","contains","removeAllRanges","addRange","onMouseLeave","buttons","target","relatedTarget","getAttribute","addEventListener","cancelAnimationFrame"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-drag-selection.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Sets the `contenteditable` wrapper element to `value`.\n *\n * @param {HTMLElement} node Block element.\n * @param {boolean} value `contentEditable` value (true or false)\n */\nfunction setContentEditableWrapper( node, value ) {\n\tnode.contentEditable = value;\n\t// Firefox doesn't automatically move focus.\n\tif ( value ) {\n\t\tnode.focus();\n\t}\n}\n\n/**\n * Sets a multi-selection based on the native selection across blocks.\n */\nexport default function useDragSelection() {\n\tconst { startMultiSelect, stopMultiSelect } =\n\t\tuseDispatch( blockEditorStore );\n\tconst {\n\t\tisSelectionEnabled,\n\t\thasSelectedBlock,\n\t\tisDraggingBlocks,\n\t\tisMultiSelecting,\n\t} = useSelect( blockEditorStore );\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\tlet anchorElement;\n\t\t\tlet rafId;\n\n\t\t\tfunction onMouseUp() {\n\t\t\t\tstopMultiSelect();\n\t\t\t\t// Equivalent to attaching the listener once.\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onMouseUp );\n\t\t\t\t// The browser selection won't have updated yet at this point,\n\t\t\t\t// so wait until the next animation frame to get the browser\n\t\t\t\t// selection.\n\t\t\t\trafId = defaultView.requestAnimationFrame( () => {\n\t\t\t\t\tif ( ! hasSelectedBlock() ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// If the selection is complete (on mouse up), and no\n\t\t\t\t\t// multiple blocks have been selected, set focus back to the\n\t\t\t\t\t// anchor element. if the anchor element contains the\n\t\t\t\t\t// selection. Additionally, the contentEditable wrapper can\n\t\t\t\t\t// now be disabled again.\n\t\t\t\t\tsetContentEditableWrapper( node, false );\n\n\t\t\t\t\tconst selection = defaultView.getSelection();\n\n\t\t\t\t\tif ( selection.rangeCount ) {\n\t\t\t\t\t\tconst range = selection.getRangeAt( 0 );\n\t\t\t\t\t\tconst { commonAncestorContainer } = range;\n\t\t\t\t\t\tconst clonedRange = range.cloneRange();\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tanchorElement.contains( commonAncestorContainer )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tanchorElement.focus();\n\t\t\t\t\t\t\tselection.removeAllRanges();\n\t\t\t\t\t\t\tselection.addRange( clonedRange );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tfunction onMouseLeave( { buttons, target, relatedTarget } ) {\n\t\t\t\t// If we're moving into a child element, ignore. We're tracking\n\t\t\t\t// the mouse leaving the element to a parent, no a child.\n\t\t\t\tif ( target.contains( relatedTarget ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Avoid triggering a multi-selection if the user is already\n\t\t\t\t// dragging blocks.\n\t\t\t\tif ( isDraggingBlocks() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// The primary button must be pressed to initiate selection.\n\t\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n\t\t\t\tif ( buttons !== 1 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Abort if we are already multi-selecting.\n\t\t\t\tif ( isMultiSelecting() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Abort if selection is leaving writing flow.\n\t\t\t\tif ( node === target ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Check the attribute, not the contentEditable attribute. All\n\t\t\t\t// child elements of the content editable wrapper are editable\n\t\t\t\t// and return true for this property. We only want to start\n\t\t\t\t// multi selecting when the mouse leaves the wrapper.\n\t\t\t\tif ( target.getAttribute( 'contenteditable' ) !== 'true' ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( ! isSelectionEnabled() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Do not rely on the active element because it may change after\n\t\t\t\t// the mouse leaves for the first time. See\n\t\t\t\t// https://github.com/WordPress/gutenberg/issues/48747.\n\t\t\t\tanchorElement = target;\n\n\t\t\t\tstartMultiSelect();\n\n\t\t\t\t// `onSelectionStart` is called after `mousedown` and\n\t\t\t\t// `mouseleave` (from a block). The selection ends when\n\t\t\t\t// `mouseup` happens anywhere in the window.\n\t\t\t\tdefaultView.addEventListener( 'mouseup', onMouseUp );\n\n\t\t\t\t// Allow cross contentEditable selection by temporarily making\n\t\t\t\t// all content editable. We can't rely on using the store and\n\t\t\t\t// React because re-rending happens too slowly. We need to be\n\t\t\t\t// able to select across instances immediately.\n\t\t\t\tsetContentEditableWrapper( node, true );\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mouseout', onMouseLeave );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mouseout', onMouseLeave );\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onMouseUp );\n\t\t\t\tdefaultView.cancelAnimationFrame( rafId );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tstartMultiSelect,\n\t\t\tstopMultiSelect,\n\t\t\tisSelectionEnabled,\n\t\t\thasSelectedBlock,\n\t\t]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,yBAAyBA,CAAEC,IAAI,EAAEC,KAAK,EAAG;EACjDD,IAAI,CAACE,eAAe,GAAGD,KAAK;EAC5B;EACA,IAAKA,KAAK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ClC;QACD;MACD,CAAE,CAAC;IACJ;IAEA,SAASK,YAAYA,CAAE;MAAEC,OAAO;MAAEC,MAAM;MAAEC;IAAc,CAAC,EAAG;MAC3D;MACA;MACA,IAAKD,MAAM,CAACL,QAAQ,CAAEM,aAAc,CAAC,EAAG;QACvC;MACD;;MAEA;MACA;MACA,IAAKvB,gBAAgB,CAAC,CAAC,EAAG;QACzB;MACD;;MAEA;MACA;MACA,IAAKqB,OAAO,KAAK,CAAC,EAAG;QACpB;MACD;;MAEA;MACA,IAAKpB,gBAAgB,CAAC,CAAC,EAAG;QACzB;MACD;;MAEA;MACA,IAAKV,IAAI,KAAK+B,MAAM,EAAG;QACtB;MACD;;MAEA;MACA;MACA;MACA;MACA,IAAKA,MAAM,CAACE,YAAY,CAAE,iBAAkB,CAAC,KAAK,MAAM,EAAG;QAC1D;MACD;MAEA,IAAK,CAAE1B,kBAAkB,CAAC,CAAC,EAAG;QAC7B;MACD;;MAEA;MACA;MACA;MACAM,aAAa,GAAGkB,MAAM;MAEtB1B,gBAAgB,CAAC,CAAC;;MAElB;MACA;MACA;MACAO,WAAW,CAACsB,gBAAgB,CAAE,SAAS,EAAEnB,SAAU,CAAC;;MAEpD;MACA;MACA;MACA;MACAhB,yBAAyB,CAAEC,IAAI,EAAE,IAAK,CAAC;IACxC;IAEAA,IAAI,CAACkC,gBAAgB,CAAE,UAAU,EAAEL,YAAa,CAAC;IAEjD,OAAO,MAAM;MACZ7B,IAAI,CAACgB,mBAAmB,CAAE,UAAU,EAAEa,YAAa,CAAC;MACpDjB,WAAW,CAACI,mBAAmB,CAAE,SAAS,EAAED,SAAU,CAAC;MACvDH,WAAW,CAACuB,oBAAoB,CAAErB,KAAM,CAAC;IAC1C,CAAC;EACF,CAAC,EACD,CACCT,gBAAgB,EAChBC,eAAe,EACfC,kBAAkB,EAClBC,gBAAgB,CAElB,CAAC;AACF","ignoreList":[]}
@@ -98,7 +98,9 @@ export default function useTabNav() {
98
98
  // do it again here because after clearing block selection,
99
99
  // focus land on the writing flow container and pressing Tab
100
100
  // will no longer send focus through the focus capture element.
101
- if (event.target === node) setNavigationMode(true);
101
+ if (event.target === node) {
102
+ setNavigationMode(true);
103
+ }
102
104
  return;
103
105
  }
104
106
  const nextTabbable = focus.tabbable[direction](event.target);
@@ -1 +1 @@
1
- {"version":3,"names":["focus","isFormElement","TAB","ESCAPE","useSelect","useDispatch","useRefEffect","useMergeRefs","useRef","store","blockEditorStore","isInSameBlock","isInsideRootBlock","unlock","useTabNav","container","focusCaptureBeforeRef","focusCaptureAfterRef","hasMultiSelection","getSelectedBlockClientId","getBlockCount","setNavigationMode","setLastFocus","isNavigationMode","select","getLastFocus","focusCaptureTabIndex","undefined","noCapture","onFocusCapture","event","current","canvasElement","ownerDocument","target","defaultView","frameElement","isBefore","compareDocumentPosition","DOCUMENT_POSITION_FOLLOWING","tabbables","tabbable","find","length","next","before","createElement","ref","tabIndex","onFocus","after","node","onKeyDown","defaultPrevented","keyCode","preventDefault","isShift","shiftKey","direction","nextTabbable","currentBlock","closest","isElementPartOfSelectedBlock","preventScroll","onFocusOut","relatedTarget","activeElement","body","preventScrollOnTab","getAttribute","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, ESCAPE } 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 { hasMultiSelection, getSelectedBlockClientId, getBlockCount } =\n\t\tuseSelect( blockEditorStore );\n\tconst { setNavigationMode, setLastFocus } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst isNavigationMode = useSelect(\n\t\t( select ) => select( blockEditorStore ).isNavigationMode(),\n\t\t[]\n\t);\n\n\tconst { getLastFocus } = unlock( useSelect( blockEditorStore ) );\n\n\t// Don't allow tabbing to this element in Navigation mode.\n\tconst focusCaptureTabIndex = ! isNavigationMode ? '0' : undefined;\n\n\t// Reference that holds the a flag for enabling or disabling\n\t// capturing on the focus capture elements.\n\tconst noCapture = useRef();\n\n\tfunction onFocusCapture( event ) {\n\t\t// Do not capture incoming focus if set by us in WritingFlow.\n\t\tif ( noCapture.current ) {\n\t\t\tnoCapture.current = null;\n\t\t} else if ( hasMultiSelection() ) {\n\t\t\tcontainer.current.focus();\n\t\t} else if ( getSelectedBlockClientId() ) {\n\t\t\tgetLastFocus()?.current.focus();\n\t\t} else {\n\t\t\tsetNavigationMode( true );\n\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\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={ focusCaptureTabIndex }\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={ focusCaptureTabIndex }\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\tif ( event.keyCode === ESCAPE && ! hasMultiSelection() ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetNavigationMode( true );\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\n\t\t\tif ( ! hasMultiSelection() && ! getSelectedBlockClientId() ) {\n\t\t\t\t// Preserve the behaviour of entering navigation mode when\n\t\t\t\t// tabbing into the content without a block selection.\n\t\t\t\t// `onFocusCapture` already did this previously, but we need to\n\t\t\t\t// do it again here because after clearing block selection,\n\t\t\t\t// focus land on the writing flow container and pressing Tab\n\t\t\t\t// will no longer send focus through the focus capture element.\n\t\t\t\tif ( event.target === node ) setNavigationMode( true );\n\t\t\t\treturn;\n\t\t\t}\n\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\tnoCapture.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,EAAEC,MAAM,QAAQ,qBAAqB;AACjD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,EAAEC,YAAY,QAAQ,oBAAoB;AAC/D,SAASC,MAAM,QAAQ,oBAAoB;;A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,CAAC;IAC7CD,IAAI,CAACmB,gBAAgB,CAAE,UAAU,EAAEN,UAAW,CAAC;IAC/C,OAAO,MAAM;MACZ7B,WAAW,CAACoC,mBAAmB,CAAE,SAAS,EAAEH,kBAAmB,CAAC;MAChEjB,IAAI,CAACoB,mBAAmB,CAAE,SAAS,EAAEnB,SAAU,CAAC;MAChDD,IAAI,CAACoB,mBAAmB,CAAE,UAAU,EAAEP,UAAW,CAAC;IACnD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMQ,UAAU,GAAGjE,YAAY,CAAE,CAAEQ,SAAS,EAAEgC,GAAG,CAAG,CAAC;EAErD,OAAO,CAAEF,MAAM,EAAE2B,UAAU,EAAEtB,KAAK,CAAE;AACrC","ignoreList":[]}
1
+ {"version":3,"names":["focus","isFormElement","TAB","ESCAPE","useSelect","useDispatch","useRefEffect","useMergeRefs","useRef","store","blockEditorStore","isInSameBlock","isInsideRootBlock","unlock","useTabNav","container","focusCaptureBeforeRef","focusCaptureAfterRef","hasMultiSelection","getSelectedBlockClientId","getBlockCount","setNavigationMode","setLastFocus","isNavigationMode","select","getLastFocus","focusCaptureTabIndex","undefined","noCapture","onFocusCapture","event","current","canvasElement","ownerDocument","target","defaultView","frameElement","isBefore","compareDocumentPosition","DOCUMENT_POSITION_FOLLOWING","tabbables","tabbable","find","length","next","before","createElement","ref","tabIndex","onFocus","after","node","onKeyDown","defaultPrevented","keyCode","preventDefault","isShift","shiftKey","direction","nextTabbable","currentBlock","closest","isElementPartOfSelectedBlock","preventScroll","onFocusOut","relatedTarget","activeElement","body","preventScrollOnTab","getAttribute","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, ESCAPE } 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 { hasMultiSelection, getSelectedBlockClientId, getBlockCount } =\n\t\tuseSelect( blockEditorStore );\n\tconst { setNavigationMode, setLastFocus } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst isNavigationMode = useSelect(\n\t\t( select ) => select( blockEditorStore ).isNavigationMode(),\n\t\t[]\n\t);\n\n\tconst { getLastFocus } = unlock( useSelect( blockEditorStore ) );\n\n\t// Don't allow tabbing to this element in Navigation mode.\n\tconst focusCaptureTabIndex = ! isNavigationMode ? '0' : undefined;\n\n\t// Reference that holds the a flag for enabling or disabling\n\t// capturing on the focus capture elements.\n\tconst noCapture = useRef();\n\n\tfunction onFocusCapture( event ) {\n\t\t// Do not capture incoming focus if set by us in WritingFlow.\n\t\tif ( noCapture.current ) {\n\t\t\tnoCapture.current = null;\n\t\t} else if ( hasMultiSelection() ) {\n\t\t\tcontainer.current.focus();\n\t\t} else if ( getSelectedBlockClientId() ) {\n\t\t\tgetLastFocus()?.current.focus();\n\t\t} else {\n\t\t\tsetNavigationMode( true );\n\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\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={ focusCaptureTabIndex }\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={ focusCaptureTabIndex }\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\tif ( event.keyCode === ESCAPE && ! hasMultiSelection() ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetNavigationMode( true );\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\n\t\t\tif ( ! hasMultiSelection() && ! getSelectedBlockClientId() ) {\n\t\t\t\t// Preserve the behaviour of entering navigation mode when\n\t\t\t\t// tabbing into the content without a block selection.\n\t\t\t\t// `onFocusCapture` already did this previously, but we need to\n\t\t\t\t// do it again here because after clearing block selection,\n\t\t\t\t// focus land on the writing flow container and pressing Tab\n\t\t\t\t// will no longer send focus through the focus capture element.\n\t\t\t\tif ( event.target === node ) {\n\t\t\t\t\tsetNavigationMode( true );\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\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\tnoCapture.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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D,KAAK,CAACyB,cAAc,CAAC,CAAC;QACtBrB,MAAM,CAAClC,KAAK,CAAE;UAAE+D,aAAa,EAAE;QAAK,CAAE,CAAC;MACxC;IACD;IAEA,MAAM;MAAE9B;IAAc,CAAC,GAAGkB,IAAI;IAC9B,MAAM;MAAEhB;IAAY,CAAC,GAAGF,aAAa;IACrCE,WAAW,CAACmC,gBAAgB,CAAE,SAAS,EAAEF,kBAAmB,CAAC;IAC7DjB,IAAI,CAACmB,gBAAgB,CAAE,SAAS,EAAElB,SAAU,CAAC;IAC7CD,IAAI,CAACmB,gBAAgB,CAAE,UAAU,EAAEN,UAAW,CAAC;IAC/C,OAAO,MAAM;MACZ7B,WAAW,CAACoC,mBAAmB,CAAE,SAAS,EAAEH,kBAAmB,CAAC;MAChEjB,IAAI,CAACoB,mBAAmB,CAAE,SAAS,EAAEnB,SAAU,CAAC;MAChDD,IAAI,CAACoB,mBAAmB,CAAE,UAAU,EAAEP,UAAW,CAAC;IACnD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMQ,UAAU,GAAGjE,YAAY,CAAE,CAAEQ,SAAS,EAAEgC,GAAG,CAAG,CAAC;EAErD,OAAO,CAAEF,MAAM,EAAE2B,UAAU,EAAEtB,KAAK,CAAE;AACrC","ignoreList":[]}
@@ -7,15 +7,19 @@ import classnames from 'classnames';
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
10
- import { BaseControl, Button } from '@wordpress/components';
11
10
  import { __, isRTL } from '@wordpress/i18n';
12
11
  import { textHorizontal, textVertical } from '@wordpress/icons';
12
+
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+ import SegmentedTextControl from '../segmented-text-control';
13
17
  const WRITING_MODES = [{
14
- name: __('Horizontal'),
18
+ label: __('Horizontal'),
15
19
  value: 'horizontal-tb',
16
20
  icon: textHorizontal
17
21
  }, {
18
- name: __('Vertical'),
22
+ label: __('Vertical'),
19
23
  value: isRTL() ? 'vertical-lr' : 'vertical-rl',
20
24
  icon: textVertical
21
25
  }];
@@ -35,22 +39,14 @@ export default function WritingModeControl({
35
39
  value,
36
40
  onChange
37
41
  }) {
38
- return createElement("fieldset", {
39
- className: classnames('block-editor-writing-mode-control', className)
40
- }, createElement(BaseControl.VisualLabel, {
41
- as: "legend"
42
- }, __('Orientation')), createElement("div", {
43
- className: "block-editor-writing-mode-control__buttons"
44
- }, WRITING_MODES.map(writingMode => {
45
- return createElement(Button, {
46
- key: writingMode.value,
47
- icon: writingMode.icon,
48
- label: writingMode.name,
49
- isPressed: writingMode.value === value,
50
- onClick: () => {
51
- onChange(writingMode.value === value ? undefined : writingMode.value);
52
- }
53
- });
54
- })));
42
+ return createElement(SegmentedTextControl, {
43
+ label: __('Orientation'),
44
+ options: WRITING_MODES,
45
+ className: classnames('block-editor-writing-mode-control', className),
46
+ value: value,
47
+ onChange: newValue => {
48
+ onChange(newValue === value ? undefined : newValue);
49
+ }
50
+ });
55
51
  }
56
52
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","BaseControl","Button","__","isRTL","textHorizontal","textVertical","WRITING_MODES","name","value","icon","WritingModeControl","className","onChange","createElement","VisualLabel","as","map","writingMode","key","label","isPressed","onClick","undefined"],"sources":["@wordpress/block-editor/src/components/writing-mode-control/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { textHorizontal, textVertical } from '@wordpress/icons';\n\nconst WRITING_MODES = [\n\t{\n\t\tname: __( 'Horizontal' ),\n\t\tvalue: 'horizontal-tb',\n\t\ticon: textHorizontal,\n\t},\n\t{\n\t\tname: __( 'Vertical' ),\n\t\tvalue: isRTL() ? 'vertical-lr' : 'vertical-rl',\n\t\ticon: textVertical,\n\t},\n];\n\n/**\n * Control to facilitate writing mode selections.\n *\n * @param {Object} props Component props.\n * @param {string} props.className Class name to add to the control.\n * @param {string} props.value Currently selected writing mode.\n * @param {Function} props.onChange Handles change in the writing mode selection.\n *\n * @return {Element} Writing Mode control.\n */\nexport default function WritingModeControl( { className, value, onChange } ) {\n\treturn (\n\t\t<fieldset\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-writing-mode-control',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t{ __( 'Orientation' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<div className=\"block-editor-writing-mode-control__buttons\">\n\t\t\t\t{ WRITING_MODES.map( ( writingMode ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey={ writingMode.value }\n\t\t\t\t\t\t\ticon={ writingMode.icon }\n\t\t\t\t\t\t\tlabel={ writingMode.name }\n\t\t\t\t\t\t\tisPressed={ writingMode.value === value }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\twritingMode.value === value\n\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t: writingMode.value\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,WAAW,EAAEC,MAAM,QAAQ,uBAAuB;AAC3D,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,cAAc,EAAEC,YAAY,QAAQ,kBAAkB;AAE/D,MAAMC,aAAa,GAAG,CACrB;EACCC,IAAI,EAAEL,EAAE,CAAE,YAAa,CAAC;EACxBM,KAAK,EAAE,eAAe;EACtBC,IAAI,EAAEL;AACP,CAAC,EACD;EACCG,IAAI,EAAEL,EAAE,CAAE,UAAW,CAAC;EACtBM,KAAK,EAAEL,KAAK,CAAC,CAAC,GAAG,aAAa,GAAG,aAAa;EAC9CM,IAAI,EAAEJ;AACP,CAAC,CACD;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASK,kBAAkBA,CAAE;EAAEC,SAAS;EAAEH,KAAK;EAAEI;AAAS,CAAC,EAAG;EAC5E,OACCC,aAAA;IACCF,SAAS,EAAGZ,UAAU,CACrB,mCAAmC,EACnCY,SACD;EAAG,GAEHE,aAAA,CAACb,WAAW,CAACc,WAAW;IAACC,EAAE,EAAC;EAAQ,GACjCb,EAAE,CAAE,aAAc,CACI,CAAC,EAC1BW,aAAA;IAAKF,SAAS,EAAC;EAA4C,GACxDL,aAAa,CAACU,GAAG,CAAIC,WAAW,IAAM;IACvC,OACCJ,aAAA,CAACZ,MAAM;MACNiB,GAAG,EAAGD,WAAW,CAACT,KAAO;MACzBC,IAAI,EAAGQ,WAAW,CAACR,IAAM;MACzBU,KAAK,EAAGF,WAAW,CAACV,IAAM;MAC1Ba,SAAS,EAAGH,WAAW,CAACT,KAAK,KAAKA,KAAO;MACzCa,OAAO,EAAGA,CAAA,KAAM;QACfT,QAAQ,CACPK,WAAW,CAACT,KAAK,KAAKA,KAAK,GACxBc,SAAS,GACTL,WAAW,CAACT,KAChB,CAAC;MACF;IAAG,CACH,CAAC;EAEJ,CAAE,CACE,CACI,CAAC;AAEb","ignoreList":[]}
1
+ {"version":3,"names":["classnames","__","isRTL","textHorizontal","textVertical","SegmentedTextControl","WRITING_MODES","label","value","icon","WritingModeControl","className","onChange","createElement","options","newValue","undefined"],"sources":["@wordpress/block-editor/src/components/writing-mode-control/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { textHorizontal, textVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SegmentedTextControl from '../segmented-text-control';\n\nconst WRITING_MODES = [\n\t{\n\t\tlabel: __( 'Horizontal' ),\n\t\tvalue: 'horizontal-tb',\n\t\ticon: textHorizontal,\n\t},\n\t{\n\t\tlabel: __( 'Vertical' ),\n\t\tvalue: isRTL() ? 'vertical-lr' : 'vertical-rl',\n\t\ticon: textVertical,\n\t},\n];\n\n/**\n * Control to facilitate writing mode selections.\n *\n * @param {Object} props Component props.\n * @param {string} props.className Class name to add to the control.\n * @param {string} props.value Currently selected writing mode.\n * @param {Function} props.onChange Handles change in the writing mode selection.\n *\n * @return {Element} Writing Mode control.\n */\nexport default function WritingModeControl( { className, value, onChange } ) {\n\treturn (\n\t\t<SegmentedTextControl\n\t\t\tlabel={ __( 'Orientation' ) }\n\t\t\toptions={ WRITING_MODES }\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-writing-mode-control',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\tvalue={ value }\n\t\t\tonChange={ ( newValue ) => {\n\t\t\t\tonChange( newValue === value ? undefined : newValue );\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,cAAc,EAAEC,YAAY,QAAQ,kBAAkB;;AAE/D;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,2BAA2B;AAE5D,MAAMC,aAAa,GAAG,CACrB;EACCC,KAAK,EAAEN,EAAE,CAAE,YAAa,CAAC;EACzBO,KAAK,EAAE,eAAe;EACtBC,IAAI,EAAEN;AACP,CAAC,EACD;EACCI,KAAK,EAAEN,EAAE,CAAE,UAAW,CAAC;EACvBO,KAAK,EAAEN,KAAK,CAAC,CAAC,GAAG,aAAa,GAAG,aAAa;EAC9CO,IAAI,EAAEL;AACP,CAAC,CACD;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASM,kBAAkBA,CAAE;EAAEC,SAAS;EAAEH,KAAK;EAAEI;AAAS,CAAC,EAAG;EAC5E,OACCC,aAAA,CAACR,oBAAoB;IACpBE,KAAK,EAAGN,EAAE,CAAE,aAAc,CAAG;IAC7Ba,OAAO,EAAGR,aAAe;IACzBK,SAAS,EAAGX,UAAU,CACrB,mCAAmC,EACnCW,SACD,CAAG;IACHH,KAAK,EAAGA,KAAO;IACfI,QAAQ,EAAKG,QAAQ,IAAM;MAC1BH,QAAQ,CAAEG,QAAQ,KAAKP,KAAK,GAAGQ,SAAS,GAAGD,QAAS,CAAC;IACtD;EAAG,CACH,CAAC;AAEJ","ignoreList":[]}
@@ -223,7 +223,9 @@ function useDuotoneStyles({
223
223
  } : undefined);
224
224
  const blockElement = useBlockElement(clientId);
225
225
  useEffect(() => {
226
- if (!isValidFilter) return;
226
+ if (!isValidFilter) {
227
+ return;
228
+ }
227
229
 
228
230
  // Safari does not always update the duotone filter when the duotone colors
229
231
  // are changed. When using Safari, force the block element to be repainted by
@@ -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","useStyleOverride","default","StylesFiltersPanel","useBlockEditingMode","__unstableUseBlockElement","useBlockElement","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","createElement","Fragment","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","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, useStyleOverride } from './utils';\nimport { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { __unstableUseBlockElement as useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nconst EMPTY_ARRAY = [];\n\n// Safari does not always update the duotone filter when the duotone colors\n// are changed. This browser check is later used to force a re-render of the block\n// element to ensure the duotone filter is updated. The check is included at the\n// root of this file as it only needs to be run once per page load.\nconst isSafari =\n\twindow?.navigator.userAgent &&\n\twindow.navigator.userAgent.includes( 'Safari' ) &&\n\t! window.navigator.userAgent.includes( 'Chrome' ) &&\n\t! window.navigator.userAgent.includes( 'Chromium' );\n\nextend( [ namesPlugin ] );\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst [ enableDefault, userPresets, themePresets, defaultPresets ] =\n\t\tuseSettings(\n\t\t\tdefaultSetting,\n\t\t\t`${ presetSetting }.custom`,\n\t\t\t`${ presetSetting }.theme`,\n\t\t\t`${ presetSetting }.default`\n\t\t);\n\treturn useMemo(\n\t\t() => [\n\t\t\t...( userPresets || EMPTY_ARRAY ),\n\t\t\t...( themePresets || EMPTY_ARRAY ),\n\t\t\t...( ( enableDefault && defaultPresets ) || EMPTY_ARRAY ),\n\t\t],\n\t\t[ enableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function getColorsFromDuotonePreset( duotone, duotonePalette ) {\n\tif ( ! duotone ) {\n\t\treturn;\n\t}\n\tconst preset = duotonePalette?.find( ( { slug } ) => {\n\t\treturn duotone === `var:preset|duotone|${ slug }`;\n\t} );\n\n\treturn preset ? preset.colors : undefined;\n}\n\nexport function getDuotonePresetFromColors( colors, duotonePalette ) {\n\tif ( ! colors || ! Array.isArray( colors ) ) {\n\t\treturn;\n\t}\n\n\tconst preset = duotonePalette?.find( ( duotonePreset ) => {\n\t\treturn duotonePreset?.colors?.every(\n\t\t\t( val, index ) => val === colors[ index ]\n\t\t);\n\t} );\n\n\treturn preset ? `var:preset|duotone|${ preset.slug }` : undefined;\n}\n\nfunction DuotonePanelPure( { style, setAttributes, name } ) {\n\tconst duotoneStyle = style?.color?.duotone;\n\tconst settings = useBlockSettings( name );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst [ enableCustomColors, enableCustomDuotone ] = useSettings(\n\t\t'color.custom',\n\t\t'color.customDuotone'\n\t);\n\tconst disableCustomColors = ! enableCustomColors;\n\tconst disableCustomDuotone =\n\t\t! enableCustomDuotone ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst duotonePresetOrColors = ! Array.isArray( duotoneStyle )\n\t\t? getColorsFromDuotonePreset( duotoneStyle, duotonePalette )\n\t\t: duotoneStyle;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"filter\">\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tvalue={ { filter: { duotone: duotonePresetOrColors } } }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...newDuotone?.filter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<DuotoneControl\n\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tvalue={ duotonePresetOrColors }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst maybePreset = getDuotonePresetFromColors(\n\t\t\t\t\t\t\tnewDuotone,\n\t\t\t\t\t\t\tduotonePalette\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\t\tduotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: DuotonePanelPure,\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'filter.duotone' );\n\t},\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\tif ( ! hasBlockSupport( settings, 'filter.duotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\nfunction useDuotoneStyles( {\n\tclientId,\n\tid: filterId,\n\tselector: duotoneSelector,\n\tattribute: duotoneAttr,\n} ) {\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\n\t// Possible values for duotone attribute:\n\t// 1. Array of colors - e.g. ['#000000', '#ffffff'].\n\t// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''\n\t// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.\n\tconst isCustom = Array.isArray( duotoneAttr );\n\tconst duotonePreset = isCustom\n\t\t? undefined\n\t\t: getColorsFromDuotonePreset( duotoneAttr, duotonePalette );\n\tconst isPreset = typeof duotoneAttr === 'string' && duotonePreset;\n\tconst isCSS = typeof duotoneAttr === 'string' && ! isPreset;\n\n\t// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.\n\tlet colors = null;\n\tif ( isPreset ) {\n\t\t// Array of colors.\n\t\tcolors = duotonePreset;\n\t} else if ( isCSS ) {\n\t\t// CSS filter property string (e.g. 'unset').\n\t\tcolors = duotoneAttr;\n\t} else if ( isCustom ) {\n\t\t// Array of colors.\n\t\tcolors = duotoneAttr;\n\t}\n\n\t// Build the CSS selectors to which the filter will be applied.\n\tconst selectors = duotoneSelector.split( ',' );\n\n\tconst selectorsScoped = selectors.map( ( selectorPart ) => {\n\t\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t\t// since we're not using inline styles to apply the filter. We need to\n\t\t// override duotone applied by global styles and theme.json.\n\n\t\t// Assuming the selector part is a subclass selector (not a tag name)\n\t\t// so we can prepend the filter id class. If we want to support elements\n\t\t// such as `img` or namespaces, we'll need to add a case for that here.\n\t\treturn `.${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\tuseStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tcss:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneStylesheet( selector, filterId )\n\t\t\t\t\t\t\t: getDuotoneUnsetStylesheet( selector ),\n\t\t\t\t\t__unstableType: 'presets',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\tuseStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tassets:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneFilter( filterId, colors )\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t__unstableType: 'svgs',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\n\tconst blockElement = useBlockElement( clientId );\n\n\tuseEffect( () => {\n\t\tif ( ! isValidFilter ) return;\n\n\t\t// Safari does not always update the duotone filter when the duotone colors\n\t\t// are changed. When using Safari, force the block element to be repainted by\n\t\t// the browser to ensure any changes are reflected visually. This logic matches\n\t\t// that used on the site frontend in `block-supports/duotone.php`.\n\t\tif ( blockElement && isSafari ) {\n\t\t\tconst display = blockElement.style.display;\n\t\t\t// Switch to `inline-block` to force a repaint. In the editor, `inline-block`\n\t\t\t// is used instead of `none` to ensure that scroll position is not affected,\n\t\t\t// as `none` results in the editor scrolling to the top of the block.\n\t\t\tblockElement.style.display = 'inline-block';\n\t\t\t// Simply accessing el.offsetHeight flushes layout and style\n\t\t\t// changes in WebKit without having to wait for setTimeout.\n\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\tblockElement.offsetHeight;\n\t\t\tblockElement.style.display = display;\n\t\t}\n\t}, [ isValidFilter, blockElement ] );\n}\n\nfunction useBlockProps( { name, style } ) {\n\tconst id = useInstanceId( useBlockProps );\n\tconst selector = useMemo( () => {\n\t\tconst blockType = getBlockType( name );\n\n\t\tif ( blockType ) {\n\t\t\t// Backwards compatibility for `supports.color.__experimentalDuotone`\n\t\t\t// is provided via the `block_type_metadata_settings` filter. If\n\t\t\t// `supports.filter.duotone` has not been set and the\n\t\t\t// experimental property has been, the experimental property\n\t\t\t// value is copied into `supports.filter.duotone`.\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'filter.duotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( ! duotoneSupport ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// If the experimental duotone support was set, that value is\n\t\t\t// to be treated as a selector and requires scoping.\n\t\t\tconst experimentalDuotone = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( experimentalDuotone ) {\n\t\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\t\treturn typeof experimentalDuotone === 'string'\n\t\t\t\t\t? scopeSelector( rootSelector, experimentalDuotone )\n\t\t\t\t\t: rootSelector;\n\t\t\t}\n\n\t\t\t// Regular filter.duotone support uses filter.duotone selectors with fallbacks.\n\t\t\treturn getBlockCSSSelector( blockType, 'filter.duotone', {\n\t\t\t\tfallback: true,\n\t\t\t} );\n\t\t}\n\t}, [ name ] );\n\n\tconst attribute = style?.color?.duotone;\n\n\tconst filterClass = `wp-duotone-${ id }`;\n\n\tconst shouldRender = selector && attribute;\n\n\tuseDuotoneStyles( {\n\t\tclientId: id,\n\t\tid: filterClass,\n\t\tselector,\n\t\tattribute,\n\t} );\n\n\treturn {\n\t\tclassName: shouldRender ? filterClass : '',\n\t};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\n"],"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,gBAAgB,QAAQ,SAAS;AAC5D,SAASC,OAAO,IAAIC,kBAAkB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;MACX,CAAE,CAAC;IACJ;EACD,CAAC,EAAE,CAAE7D,IAAI,CAAG,CAAC;EAEb,MAAMsC,SAAS,GAAGxC,KAAK,EAAEI,KAAK,EAAEnB,OAAO;EAEvC,MAAM+E,WAAW,GAAI,cAAc5B,EAAI,EAAC;EAExC,MAAM6B,YAAY,GAAG3B,QAAQ,IAAIE,SAAS;EAE1CN,gBAAgB,CAAE;IACjBC,QAAQ,EAAEC,EAAE;IACZA,EAAE,EAAE4B,WAAW;IACf1B,QAAQ;IACRE;EACD,CAAE,CAAC;EAEH,OAAO;IACN0B,SAAS,EAAED,YAAY,GAAGD,WAAW,GAAG;EACzC,CAAC;AACF;AAEAjH,SAAS,CACR,0BAA0B,EAC1B,oCAAoC,EACpC8E,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","useStyleOverride","default","StylesFiltersPanel","useBlockEditingMode","__unstableUseBlockElement","useBlockElement","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","createElement","Fragment","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","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, useStyleOverride } from './utils';\nimport { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { __unstableUseBlockElement as useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nconst EMPTY_ARRAY = [];\n\n// Safari does not always update the duotone filter when the duotone colors\n// are changed. This browser check is later used to force a re-render of the block\n// element to ensure the duotone filter is updated. The check is included at the\n// root of this file as it only needs to be run once per page load.\nconst isSafari =\n\twindow?.navigator.userAgent &&\n\twindow.navigator.userAgent.includes( 'Safari' ) &&\n\t! window.navigator.userAgent.includes( 'Chrome' ) &&\n\t! window.navigator.userAgent.includes( 'Chromium' );\n\nextend( [ namesPlugin ] );\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst [ enableDefault, userPresets, themePresets, defaultPresets ] =\n\t\tuseSettings(\n\t\t\tdefaultSetting,\n\t\t\t`${ presetSetting }.custom`,\n\t\t\t`${ presetSetting }.theme`,\n\t\t\t`${ presetSetting }.default`\n\t\t);\n\treturn useMemo(\n\t\t() => [\n\t\t\t...( userPresets || EMPTY_ARRAY ),\n\t\t\t...( themePresets || EMPTY_ARRAY ),\n\t\t\t...( ( enableDefault && defaultPresets ) || EMPTY_ARRAY ),\n\t\t],\n\t\t[ enableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function getColorsFromDuotonePreset( duotone, duotonePalette ) {\n\tif ( ! duotone ) {\n\t\treturn;\n\t}\n\tconst preset = duotonePalette?.find( ( { slug } ) => {\n\t\treturn duotone === `var:preset|duotone|${ slug }`;\n\t} );\n\n\treturn preset ? preset.colors : undefined;\n}\n\nexport function getDuotonePresetFromColors( colors, duotonePalette ) {\n\tif ( ! colors || ! Array.isArray( colors ) ) {\n\t\treturn;\n\t}\n\n\tconst preset = duotonePalette?.find( ( duotonePreset ) => {\n\t\treturn duotonePreset?.colors?.every(\n\t\t\t( val, index ) => val === colors[ index ]\n\t\t);\n\t} );\n\n\treturn preset ? `var:preset|duotone|${ preset.slug }` : undefined;\n}\n\nfunction DuotonePanelPure( { style, setAttributes, name } ) {\n\tconst duotoneStyle = style?.color?.duotone;\n\tconst settings = useBlockSettings( name );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst [ enableCustomColors, enableCustomDuotone ] = useSettings(\n\t\t'color.custom',\n\t\t'color.customDuotone'\n\t);\n\tconst disableCustomColors = ! enableCustomColors;\n\tconst disableCustomDuotone =\n\t\t! enableCustomDuotone ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst duotonePresetOrColors = ! Array.isArray( duotoneStyle )\n\t\t? getColorsFromDuotonePreset( duotoneStyle, duotonePalette )\n\t\t: duotoneStyle;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"filter\">\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tvalue={ { filter: { duotone: duotonePresetOrColors } } }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...newDuotone?.filter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<DuotoneControl\n\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tvalue={ duotonePresetOrColors }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst maybePreset = getDuotonePresetFromColors(\n\t\t\t\t\t\t\tnewDuotone,\n\t\t\t\t\t\t\tduotonePalette\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\t\tduotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: DuotonePanelPure,\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'filter.duotone' );\n\t},\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\tif ( ! hasBlockSupport( settings, 'filter.duotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\nfunction useDuotoneStyles( {\n\tclientId,\n\tid: filterId,\n\tselector: duotoneSelector,\n\tattribute: duotoneAttr,\n} ) {\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\n\t// Possible values for duotone attribute:\n\t// 1. Array of colors - e.g. ['#000000', '#ffffff'].\n\t// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''\n\t// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.\n\tconst isCustom = Array.isArray( duotoneAttr );\n\tconst duotonePreset = isCustom\n\t\t? undefined\n\t\t: getColorsFromDuotonePreset( duotoneAttr, duotonePalette );\n\tconst isPreset = typeof duotoneAttr === 'string' && duotonePreset;\n\tconst isCSS = typeof duotoneAttr === 'string' && ! isPreset;\n\n\t// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.\n\tlet colors = null;\n\tif ( isPreset ) {\n\t\t// Array of colors.\n\t\tcolors = duotonePreset;\n\t} else if ( isCSS ) {\n\t\t// CSS filter property string (e.g. 'unset').\n\t\tcolors = duotoneAttr;\n\t} else if ( isCustom ) {\n\t\t// Array of colors.\n\t\tcolors = duotoneAttr;\n\t}\n\n\t// Build the CSS selectors to which the filter will be applied.\n\tconst selectors = duotoneSelector.split( ',' );\n\n\tconst selectorsScoped = selectors.map( ( selectorPart ) => {\n\t\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t\t// since we're not using inline styles to apply the filter. We need to\n\t\t// override duotone applied by global styles and theme.json.\n\n\t\t// Assuming the selector part is a subclass selector (not a tag name)\n\t\t// so we can prepend the filter id class. If we want to support elements\n\t\t// such as `img` or namespaces, we'll need to add a case for that here.\n\t\treturn `.${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\tuseStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tcss:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneStylesheet( selector, filterId )\n\t\t\t\t\t\t\t: getDuotoneUnsetStylesheet( selector ),\n\t\t\t\t\t__unstableType: 'presets',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\tuseStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tassets:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneFilter( filterId, colors )\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t__unstableType: 'svgs',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\n\tconst blockElement = useBlockElement( clientId );\n\n\tuseEffect( () => {\n\t\tif ( ! isValidFilter ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Safari does not always update the duotone filter when the duotone colors\n\t\t// are changed. When using Safari, force the block element to be repainted by\n\t\t// the browser to ensure any changes are reflected visually. This logic matches\n\t\t// that used on the site frontend in `block-supports/duotone.php`.\n\t\tif ( blockElement && isSafari ) {\n\t\t\tconst display = blockElement.style.display;\n\t\t\t// Switch to `inline-block` to force a repaint. In the editor, `inline-block`\n\t\t\t// is used instead of `none` to ensure that scroll position is not affected,\n\t\t\t// as `none` results in the editor scrolling to the top of the block.\n\t\t\tblockElement.style.display = 'inline-block';\n\t\t\t// Simply accessing el.offsetHeight flushes layout and style\n\t\t\t// changes in WebKit without having to wait for setTimeout.\n\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\tblockElement.offsetHeight;\n\t\t\tblockElement.style.display = display;\n\t\t}\n\t}, [ isValidFilter, blockElement ] );\n}\n\nfunction useBlockProps( { name, style } ) {\n\tconst id = useInstanceId( useBlockProps );\n\tconst selector = useMemo( () => {\n\t\tconst blockType = getBlockType( name );\n\n\t\tif ( blockType ) {\n\t\t\t// Backwards compatibility for `supports.color.__experimentalDuotone`\n\t\t\t// is provided via the `block_type_metadata_settings` filter. If\n\t\t\t// `supports.filter.duotone` has not been set and the\n\t\t\t// experimental property has been, the experimental property\n\t\t\t// value is copied into `supports.filter.duotone`.\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'filter.duotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( ! duotoneSupport ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// If the experimental duotone support was set, that value is\n\t\t\t// to be treated as a selector and requires scoping.\n\t\t\tconst experimentalDuotone = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( experimentalDuotone ) {\n\t\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\t\treturn typeof experimentalDuotone === 'string'\n\t\t\t\t\t? scopeSelector( rootSelector, experimentalDuotone )\n\t\t\t\t\t: rootSelector;\n\t\t\t}\n\n\t\t\t// Regular filter.duotone support uses filter.duotone selectors with fallbacks.\n\t\t\treturn getBlockCSSSelector( blockType, 'filter.duotone', {\n\t\t\t\tfallback: true,\n\t\t\t} );\n\t\t}\n\t}, [ name ] );\n\n\tconst attribute = style?.color?.duotone;\n\n\tconst filterClass = `wp-duotone-${ id }`;\n\n\tconst shouldRender = selector && attribute;\n\n\tuseDuotoneStyles( {\n\t\tclientId: id,\n\t\tid: filterClass,\n\t\tselector,\n\t\tattribute,\n\t} );\n\n\treturn {\n\t\tclassName: shouldRender ? filterClass : '',\n\t};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\n"],"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,gBAAgB,QAAQ,SAAS;AAC5D,SAASC,OAAO,IAAIC,kBAAkB,QAAQ,2CAA2C;AACzF,SAASC,mBAAmB,QAAQ,kCAAkC;AACtE,SAASC,yBAAyB,IAAIC,eAAe,QAAQ,yDAAyD;AAEtH,MAAMC,WAAW,GAAG,EAAE;;AAEtB;A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C,MAAM+E,WAAW,GAAI,cAAc5B,EAAI,EAAC;EAExC,MAAM6B,YAAY,GAAG3B,QAAQ,IAAIE,SAAS;EAE1CN,gBAAgB,CAAE;IACjBC,QAAQ,EAAEC,EAAE;IACZA,EAAE,EAAE4B,WAAW;IACf1B,QAAQ;IACRE;EACD,CAAE,CAAC;EAEH,OAAO;IACN0B,SAAS,EAAED,YAAY,GAAGD,WAAW,GAAG;EACzC,CAAC;AACF;AAEAjH,SAAS,CACR,0BAA0B,EAC1B,oCAAoC,EACpC8E,oBACD,CAAC","ignoreList":[]}
@@ -100,7 +100,8 @@ export function useStyleOverride({
100
100
  id,
101
101
  css,
102
102
  assets,
103
- __unstableType
103
+ __unstableType,
104
+ clientId
104
105
  } = {}) {
105
106
  const {
106
107
  setStyleOverride,
@@ -110,13 +111,16 @@ export function useStyleOverride({
110
111
  const fallbackId = useId();
111
112
  useEffect(() => {
112
113
  // Unmount if there is CSS and assets are empty.
113
- if (!css && !assets) return;
114
+ if (!css && !assets) {
115
+ return;
116
+ }
114
117
  const _id = id || fallbackId;
115
118
  const override = {
116
119
  id,
117
120
  css,
118
121
  assets,
119
- __unstableType
122
+ __unstableType,
123
+ clientId
120
124
  };
121
125
  // Batch updates to style overrides to avoid triggering cascading renders
122
126
  // for each style override block included in a tree and optimize initial render.
@@ -142,7 +146,7 @@ export function useStyleOverride({
142
146
  deleteStyleOverride(_id);
143
147
  }
144
148
  };
145
- }, [id, css, assets, __unstableType, fallbackId, setStyleOverride, deleteStyleOverride, registry]);
149
+ }, [id, css, clientId, assets, __unstableType, fallbackId, setStyleOverride, deleteStyleOverride, registry]);
146
150
  }
147
151
 
148
152
  /**
@@ -156,7 +160,7 @@ export function useStyleOverride({
156
160
  * @return {Object} Settings object.
157
161
  */
158
162
  export function useBlockSettings(name, parentLayout) {
159
- const [backgroundImage, backgroundSize, customFontFamilies, defaultFontFamilies, themeFontFamilies, customFontSizes, defaultFontSizes, themeFontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textAlign, textColumns, textDecoration, writingMode, textTransform, letterSpacing, padding, margin, blockGap, spacingSizes, units, aspectRatio, minHeight, layout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled, shadow] = useSettings('background.backgroundImage', 'background.backgroundSize', 'typography.fontFamilies.custom', 'typography.fontFamilies.default', 'typography.fontFamilies.theme', 'typography.fontSizes.custom', 'typography.fontSizes.default', 'typography.fontSizes.theme', 'typography.customFontSize', 'typography.fontStyle', 'typography.fontWeight', 'typography.lineHeight', 'typography.textAlign', 'typography.textColumns', 'typography.textDecoration', 'typography.writingMode', 'typography.textTransform', 'typography.letterSpacing', 'spacing.padding', 'spacing.margin', 'spacing.blockGap', 'spacing.spacingSizes', 'spacing.units', 'dimensions.aspectRatio', 'dimensions.minHeight', 'layout', 'border.color', 'border.radius', 'border.style', 'border.width', 'color.custom', 'color.palette.custom', 'color.customDuotone', 'color.palette.theme', 'color.palette.default', 'color.defaultPalette', 'color.defaultDuotone', 'color.duotone.custom', 'color.duotone.theme', 'color.duotone.default', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default', 'color.defaultGradients', 'color.customGradient', 'color.background', 'color.link', 'color.text', 'color.heading', 'color.button', 'shadow');
163
+ const [backgroundImage, backgroundSize, customFontFamilies, defaultFontFamilies, themeFontFamilies, defaultFontSizesEnabled, customFontSizes, defaultFontSizes, themeFontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textAlign, textColumns, textDecoration, writingMode, textTransform, letterSpacing, padding, margin, blockGap, spacingSizes, units, aspectRatio, minHeight, layout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled, shadow] = useSettings('background.backgroundImage', 'background.backgroundSize', 'typography.fontFamilies.custom', 'typography.fontFamilies.default', 'typography.fontFamilies.theme', 'typography.defaultFontSizes', 'typography.fontSizes.custom', 'typography.fontSizes.default', 'typography.fontSizes.theme', 'typography.customFontSize', 'typography.fontStyle', 'typography.fontWeight', 'typography.lineHeight', 'typography.textAlign', 'typography.textColumns', 'typography.textDecoration', 'typography.writingMode', 'typography.textTransform', 'typography.letterSpacing', 'spacing.padding', 'spacing.margin', 'spacing.blockGap', 'spacing.spacingSizes', 'spacing.units', 'dimensions.aspectRatio', 'dimensions.minHeight', 'layout', 'border.color', 'border.radius', 'border.style', 'border.width', 'color.custom', 'color.palette.custom', 'color.customDuotone', 'color.palette.theme', 'color.palette.default', 'color.defaultPalette', 'color.defaultDuotone', 'color.duotone.custom', 'color.duotone.theme', 'color.duotone.default', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default', 'color.defaultGradients', 'color.customGradient', 'color.background', 'color.link', 'color.text', 'color.heading', 'color.button', 'shadow');
160
164
  const rawSettings = useMemo(() => {
161
165
  return {
162
166
  background: {
@@ -203,6 +207,7 @@ export function useBlockSettings(name, parentLayout) {
203
207
  theme: themeFontSizes
204
208
  },
205
209
  customFontSize,
210
+ defaultFontSizes: defaultFontSizesEnabled,
206
211
  fontStyle,
207
212
  fontWeight,
208
213
  lineHeight,
@@ -236,7 +241,7 @@ export function useBlockSettings(name, parentLayout) {
236
241
  parentLayout,
237
242
  shadow
238
243
  };
239
- }, [backgroundImage, backgroundSize, customFontFamilies, defaultFontFamilies, themeFontFamilies, customFontSizes, defaultFontSizes, themeFontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textAlign, textColumns, textDecoration, textTransform, letterSpacing, writingMode, padding, margin, blockGap, spacingSizes, units, aspectRatio, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled, shadow]);
244
+ }, [backgroundImage, backgroundSize, customFontFamilies, defaultFontFamilies, themeFontFamilies, defaultFontSizesEnabled, customFontSizes, defaultFontSizes, themeFontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textAlign, textColumns, textDecoration, textTransform, letterSpacing, writingMode, padding, margin, blockGap, spacingSizes, units, aspectRatio, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled, shadow]);
240
245
  return useSettingsForBlockElement(rawSettings, name);
241
246
  }
242
247
  export function createBlockEditFilter(features) {
@@ -1 +1 @@
1
- {"version":3,"names":["getBlockSupport","memo","useMemo","useEffect","useId","useState","useDispatch","useRegistry","createHigherOrderComponent","addFilter","useBlockEditContext","mayDisplayControlsKey","mayDisplayParentControlsKey","useSettings","useSettingsForBlockElement","getValueFromObjectPath","setImmutably","store","blockEditorStore","unlock","classnames","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","entries","map","key","value","filter","undefined","length","fromEntries","transformStyles","activeSupports","migrationPaths","result","source","index","results","values","every","isActive","innerBlocks","referenceBlockAttributes","attributes","returnBlock","forEach","support","path","styleValue","shouldSkipSerialization","blockNameOrType","featureSet","feature","skipSerialization","__experimentalSkipSerialization","includes","pendingStyleOverrides","WeakMap","useStyleOverride","id","css","assets","__unstableType","setStyleOverride","deleteStyleOverride","registry","fallbackId","_id","override","get","set","push","window","queueMicrotask","batch","args","isPending","find","currentId","useBlockSettings","name","parentLayout","backgroundImage","backgroundSize","customFontFamilies","defaultFontFamilies","themeFontFamilies","customFontSizes","defaultFontSizes","themeFontSizes","customFontSize","fontStyle","fontWeight","lineHeight","textAlign","textColumns","textDecoration","writingMode","textTransform","letterSpacing","padding","margin","blockGap","spacingSizes","units","aspectRatio","minHeight","layout","borderColor","borderRadius","borderStyle","borderWidth","customColorsEnabled","customColors","customDuotone","themeColors","defaultColors","defaultPalette","defaultDuotone","userDuotonePalette","themeDuotonePalette","defaultDuotonePalette","userGradientPalette","themeGradientPalette","defaultGradientPalette","defaultGradients","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","isHeadingEnabled","isButtonEnabled","shadow","rawSettings","background","color","palette","custom","theme","default","gradients","duotone","customGradient","link","heading","button","text","typography","fontFamilies","fontSizes","spacing","border","radius","style","width","dimensions","createBlockEditFilter","features","settings","Edit","edit","withBlockEditHooks","OriginalBlockEdit","props","context","i","hasSupport","attributeKeys","shareWithChildBlocks","shouldDisplayControls","neededProps","createElement","isSelected","clientId","setAttributes","__unstableParentLayout","BlockProps","useBlockProps","setAllWrapperProps","wrapperProps","setWrapperProps","next","prev","nextAll","BlockPropsPure","createBlockListBlockFilter","withBlockListBlockHooks","BlockListBlock","allWrapperProps","fill","keys","Boolean","reduce","acc","className","createBlockSaveFilter","extraPropsFromHooks","accu","addSaveProps","neededAttributes","hasOwnProperty"],"sources":["@wordpress/block-editor/src/hooks/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { memo, useMemo, useEffect, useId, useState } from '@wordpress/element';\nimport { useDispatch, useRegistry } from '@wordpress/data';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseBlockEditContext,\n\tmayDisplayControlsKey,\n\tmayDisplayParentControlsKey,\n} from '../components/block-edit/context';\nimport { useSettings } from '../components';\nimport { useSettingsForBlockElement } from '../components/global-styles/hooks';\nimport { getValueFromObjectPath, setImmutably } from '../utils/object';\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * Removed falsy values from nested object.\n *\n * @param {*} object\n * @return {*} Object cleaned from falsy values\n */\nexport const cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\n\tconst cleanedNestedObjects = Object.entries( object )\n\t\t.map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )\n\t\t.filter( ( [ , value ] ) => value !== undefined );\n\treturn ! cleanedNestedObjects.length\n\t\t? undefined\n\t\t: Object.fromEntries( cleanedNestedObjects );\n};\n\nexport function transformStyles(\n\tactiveSupports,\n\tmigrationPaths,\n\tresult,\n\tsource,\n\tindex,\n\tresults\n) {\n\t// If there are no active supports return early.\n\tif (\n\t\tObject.values( activeSupports ?? {} ).every(\n\t\t\t( isActive ) => ! isActive\n\t\t)\n\t) {\n\t\treturn result;\n\t}\n\t// If the condition verifies we are probably in the presence of a wrapping transform\n\t// e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed.\n\tif ( results.length === 1 && result.innerBlocks.length === source.length ) {\n\t\treturn result;\n\t}\n\t// For cases where we have a transform from one block to multiple blocks\n\t// or multiple blocks to one block we apply the styles of the first source block\n\t// to the result(s).\n\tlet referenceBlockAttributes = source[ 0 ]?.attributes;\n\t// If we are in presence of transform between more than one block in the source\n\t// that has more than one block in the result\n\t// we apply the styles on source N to the result N,\n\t// if source N does not exists we do nothing.\n\tif ( results.length > 1 && source.length > 1 ) {\n\t\tif ( source[ index ] ) {\n\t\t\treferenceBlockAttributes = source[ index ]?.attributes;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n\tlet returnBlock = result;\n\tObject.entries( activeSupports ).forEach( ( [ support, isActive ] ) => {\n\t\tif ( isActive ) {\n\t\t\tmigrationPaths[ support ].forEach( ( path ) => {\n\t\t\t\tconst styleValue = getValueFromObjectPath(\n\t\t\t\t\treferenceBlockAttributes,\n\t\t\t\t\tpath\n\t\t\t\t);\n\t\t\t\tif ( styleValue ) {\n\t\t\t\t\treturnBlock = {\n\t\t\t\t\t\t...returnBlock,\n\t\t\t\t\t\tattributes: setImmutably(\n\t\t\t\t\t\t\treturnBlock.attributes,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tstyleValue\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\treturn returnBlock;\n}\n\n/**\n * Check whether serialization of specific block support feature or set should\n * be skipped.\n *\n * @param {string|Object} blockNameOrType Block name or block type object.\n * @param {string} featureSet Name of block support feature set.\n * @param {string} feature Name of the individual feature to check.\n *\n * @return {boolean} Whether serialization should occur.\n */\nexport function shouldSkipSerialization(\n\tblockNameOrType,\n\tfeatureSet,\n\tfeature\n) {\n\tconst support = getBlockSupport( blockNameOrType, featureSet );\n\tconst skipSerialization = support?.__experimentalSkipSerialization;\n\n\tif ( Array.isArray( skipSerialization ) ) {\n\t\treturn skipSerialization.includes( feature );\n\t}\n\n\treturn skipSerialization;\n}\n\nconst pendingStyleOverrides = new WeakMap();\n\nexport function useStyleOverride( { id, css, assets, __unstableType } = {} ) {\n\tconst { setStyleOverride, deleteStyleOverride } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst registry = useRegistry();\n\tconst fallbackId = useId();\n\tuseEffect( () => {\n\t\t// Unmount if there is CSS and assets are empty.\n\t\tif ( ! css && ! assets ) return;\n\n\t\tconst _id = id || fallbackId;\n\t\tconst override = {\n\t\t\tid,\n\t\t\tcss,\n\t\t\tassets,\n\t\t\t__unstableType,\n\t\t};\n\t\t// Batch updates to style overrides to avoid triggering cascading renders\n\t\t// for each style override block included in a tree and optimize initial render.\n\t\tif ( ! pendingStyleOverrides.get( registry ) ) {\n\t\t\tpendingStyleOverrides.set( registry, [] );\n\t\t}\n\t\tpendingStyleOverrides.get( registry ).push( [ _id, override ] );\n\t\twindow.queueMicrotask( () => {\n\t\t\tif ( pendingStyleOverrides.get( registry )?.length ) {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tpendingStyleOverrides.get( registry ).forEach( ( args ) => {\n\t\t\t\t\t\tsetStyleOverride( ...args );\n\t\t\t\t\t} );\n\t\t\t\t\tpendingStyleOverrides.set( registry, [] );\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tconst isPending = pendingStyleOverrides\n\t\t\t\t.get( registry )\n\t\t\t\t?.find( ( [ currentId ] ) => currentId === _id );\n\t\t\tif ( isPending ) {\n\t\t\t\tpendingStyleOverrides.set(\n\t\t\t\t\tregistry,\n\t\t\t\t\tpendingStyleOverrides\n\t\t\t\t\t\t.get( registry )\n\t\t\t\t\t\t.filter( ( [ currentId ] ) => currentId !== _id )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tdeleteStyleOverride( _id );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tid,\n\t\tcss,\n\t\tassets,\n\t\t__unstableType,\n\t\tfallbackId,\n\t\tsetStyleOverride,\n\t\tdeleteStyleOverride,\n\t\tregistry,\n\t] );\n}\n\n/**\n * Based on the block and its context, returns an object of all the block settings.\n * This object can be passed as a prop to all the Styles UI components\n * (TypographyPanel, DimensionsPanel...).\n *\n * @param {string} name Block name.\n * @param {*} parentLayout Parent layout.\n *\n * @return {Object} Settings object.\n */\nexport function useBlockSettings( name, parentLayout ) {\n\tconst [\n\t\tbackgroundImage,\n\t\tbackgroundSize,\n\t\tcustomFontFamilies,\n\t\tdefaultFontFamilies,\n\t\tthemeFontFamilies,\n\t\tcustomFontSizes,\n\t\tdefaultFontSizes,\n\t\tthemeFontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextAlign,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\twritingMode,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tspacingSizes,\n\t\tunits,\n\t\taspectRatio,\n\t\tminHeight,\n\t\tlayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tcustomDuotone,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tdefaultDuotone,\n\t\tuserDuotonePalette,\n\t\tthemeDuotonePalette,\n\t\tdefaultDuotonePalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t\tisHeadingEnabled,\n\t\tisButtonEnabled,\n\t\tshadow,\n\t] = useSettings(\n\t\t'background.backgroundImage',\n\t\t'background.backgroundSize',\n\t\t'typography.fontFamilies.custom',\n\t\t'typography.fontFamilies.default',\n\t\t'typography.fontFamilies.theme',\n\t\t'typography.fontSizes.custom',\n\t\t'typography.fontSizes.default',\n\t\t'typography.fontSizes.theme',\n\t\t'typography.customFontSize',\n\t\t'typography.fontStyle',\n\t\t'typography.fontWeight',\n\t\t'typography.lineHeight',\n\t\t'typography.textAlign',\n\t\t'typography.textColumns',\n\t\t'typography.textDecoration',\n\t\t'typography.writingMode',\n\t\t'typography.textTransform',\n\t\t'typography.letterSpacing',\n\t\t'spacing.padding',\n\t\t'spacing.margin',\n\t\t'spacing.blockGap',\n\t\t'spacing.spacingSizes',\n\t\t'spacing.units',\n\t\t'dimensions.aspectRatio',\n\t\t'dimensions.minHeight',\n\t\t'layout',\n\t\t'border.color',\n\t\t'border.radius',\n\t\t'border.style',\n\t\t'border.width',\n\t\t'color.custom',\n\t\t'color.palette.custom',\n\t\t'color.customDuotone',\n\t\t'color.palette.theme',\n\t\t'color.palette.default',\n\t\t'color.defaultPalette',\n\t\t'color.defaultDuotone',\n\t\t'color.duotone.custom',\n\t\t'color.duotone.theme',\n\t\t'color.duotone.default',\n\t\t'color.gradients.custom',\n\t\t'color.gradients.theme',\n\t\t'color.gradients.default',\n\t\t'color.defaultGradients',\n\t\t'color.customGradient',\n\t\t'color.background',\n\t\t'color.link',\n\t\t'color.text',\n\t\t'color.heading',\n\t\t'color.button',\n\t\t'shadow'\n\t);\n\n\tconst rawSettings = useMemo( () => {\n\t\treturn {\n\t\t\tbackground: {\n\t\t\t\tbackgroundImage,\n\t\t\t\tbackgroundSize,\n\t\t\t},\n\t\t\tcolor: {\n\t\t\t\tpalette: {\n\t\t\t\t\tcustom: customColors,\n\t\t\t\t\ttheme: themeColors,\n\t\t\t\t\tdefault: defaultColors,\n\t\t\t\t},\n\t\t\t\tgradients: {\n\t\t\t\t\tcustom: userGradientPalette,\n\t\t\t\t\ttheme: themeGradientPalette,\n\t\t\t\t\tdefault: defaultGradientPalette,\n\t\t\t\t},\n\t\t\t\tduotone: {\n\t\t\t\t\tcustom: userDuotonePalette,\n\t\t\t\t\ttheme: themeDuotonePalette,\n\t\t\t\t\tdefault: defaultDuotonePalette,\n\t\t\t\t},\n\t\t\t\tdefaultGradients,\n\t\t\t\tdefaultPalette,\n\t\t\t\tdefaultDuotone,\n\t\t\t\tcustom: customColorsEnabled,\n\t\t\t\tcustomGradient: areCustomGradientsEnabled,\n\t\t\t\tcustomDuotone,\n\t\t\t\tbackground: isBackgroundEnabled,\n\t\t\t\tlink: isLinkEnabled,\n\t\t\t\theading: isHeadingEnabled,\n\t\t\t\tbutton: isButtonEnabled,\n\t\t\t\ttext: isTextEnabled,\n\t\t\t},\n\t\t\ttypography: {\n\t\t\t\tfontFamilies: {\n\t\t\t\t\tcustom: customFontFamilies,\n\t\t\t\t\tdefault: defaultFontFamilies,\n\t\t\t\t\ttheme: themeFontFamilies,\n\t\t\t\t},\n\t\t\t\tfontSizes: {\n\t\t\t\t\tcustom: customFontSizes,\n\t\t\t\t\tdefault: defaultFontSizes,\n\t\t\t\t\ttheme: themeFontSizes,\n\t\t\t\t},\n\t\t\t\tcustomFontSize,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tlineHeight,\n\t\t\t\ttextAlign,\n\t\t\t\ttextColumns,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t\twritingMode,\n\t\t\t},\n\t\t\tspacing: {\n\t\t\t\tspacingSizes: {\n\t\t\t\t\tcustom: spacingSizes,\n\t\t\t\t},\n\t\t\t\tpadding,\n\t\t\t\tmargin,\n\t\t\t\tblockGap,\n\t\t\t\tunits,\n\t\t\t},\n\t\t\tborder: {\n\t\t\t\tcolor: borderColor,\n\t\t\t\tradius: borderRadius,\n\t\t\t\tstyle: borderStyle,\n\t\t\t\twidth: borderWidth,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\taspectRatio,\n\t\t\t\tminHeight,\n\t\t\t},\n\t\t\tlayout,\n\t\t\tparentLayout,\n\t\t\tshadow,\n\t\t};\n\t}, [\n\t\tbackgroundImage,\n\t\tbackgroundSize,\n\t\tcustomFontFamilies,\n\t\tdefaultFontFamilies,\n\t\tthemeFontFamilies,\n\t\tcustomFontSizes,\n\t\tdefaultFontSizes,\n\t\tthemeFontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextAlign,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\twritingMode,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tspacingSizes,\n\t\tunits,\n\t\taspectRatio,\n\t\tminHeight,\n\t\tlayout,\n\t\tparentLayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tcustomDuotone,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tdefaultDuotone,\n\t\tuserDuotonePalette,\n\t\tthemeDuotonePalette,\n\t\tdefaultDuotonePalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t\tisHeadingEnabled,\n\t\tisButtonEnabled,\n\t\tshadow,\n\t] );\n\n\treturn useSettingsForBlockElement( rawSettings, name );\n}\n\nexport function createBlockEditFilter( features ) {\n\t// We don't want block controls to re-render when typing inside a block.\n\t// `memo` will prevent re-renders unless props change, so only pass the\n\t// needed props and not the whole attributes object.\n\tfeatures = features.map( ( settings ) => {\n\t\treturn { ...settings, Edit: memo( settings.edit ) };\n\t} );\n\tconst withBlockEditHooks = createHigherOrderComponent(\n\t\t( OriginalBlockEdit ) => ( props ) => {\n\t\t\tconst context = useBlockEditContext();\n\t\t\t// CAUTION: code added before this line will be executed for all\n\t\t\t// blocks, not just those that support the feature! Code added\n\t\t\t// above this line should be carefully evaluated for its impact on\n\t\t\t// performance.\n\t\t\treturn [\n\t\t\t\t...features.map( ( feature, i ) => {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tEdit,\n\t\t\t\t\t\thasSupport,\n\t\t\t\t\t\tattributeKeys = [],\n\t\t\t\t\t\tshareWithChildBlocks,\n\t\t\t\t\t} = feature;\n\t\t\t\t\tconst shouldDisplayControls =\n\t\t\t\t\t\tcontext[ mayDisplayControlsKey ] ||\n\t\t\t\t\t\t( context[ mayDisplayParentControlsKey ] &&\n\t\t\t\t\t\t\tshareWithChildBlocks );\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! shouldDisplayControls ||\n\t\t\t\t\t\t! hasSupport( props.name )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst neededProps = {};\n\t\t\t\t\tfor ( const key of attributeKeys ) {\n\t\t\t\t\t\tif ( props.attributes[ key ] ) {\n\t\t\t\t\t\t\tneededProps[ key ] = props.attributes[ key ];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Edit\n\t\t\t\t\t\t\t// We can use the index because the array length\n\t\t\t\t\t\t\t// is fixed per page load right now.\n\t\t\t\t\t\t\tkey={ i }\n\t\t\t\t\t\t\tname={ props.name }\n\t\t\t\t\t\t\tisSelected={ props.isSelected }\n\t\t\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\t\t\tsetAttributes={ props.setAttributes }\n\t\t\t\t\t\t\t__unstableParentLayout={\n\t\t\t\t\t\t\t\tprops.__unstableParentLayout\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// This component is pure, so only pass needed\n\t\t\t\t\t\t\t// props!!!\n\t\t\t\t\t\t\t{ ...neededProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t\t\t<OriginalBlockEdit key=\"edit\" { ...props } />,\n\t\t\t];\n\t\t},\n\t\t'withBlockEditHooks'\n\t);\n\taddFilter( 'editor.BlockEdit', 'core/editor/hooks', withBlockEditHooks );\n}\n\nfunction BlockProps( { index, useBlockProps, setAllWrapperProps, ...props } ) {\n\tconst wrapperProps = useBlockProps( props );\n\tconst setWrapperProps = ( next ) =>\n\t\tsetAllWrapperProps( ( prev ) => {\n\t\t\tconst nextAll = [ ...prev ];\n\t\t\tnextAll[ index ] = next;\n\t\t\treturn nextAll;\n\t\t} );\n\t// Setting state after every render is fine because this component is\n\t// pure and will only re-render when needed props change.\n\tuseEffect( () => {\n\t\t// We could shallow compare the props, but since this component only\n\t\t// changes when needed attributes change, the benefit is probably small.\n\t\tsetWrapperProps( wrapperProps );\n\t\treturn () => {\n\t\t\tsetWrapperProps( undefined );\n\t\t};\n\t} );\n\treturn null;\n}\n\nconst BlockPropsPure = memo( BlockProps );\n\nexport function createBlockListBlockFilter( features ) {\n\tconst withBlockListBlockHooks = createHigherOrderComponent(\n\t\t( BlockListBlock ) => ( props ) => {\n\t\t\tconst [ allWrapperProps, setAllWrapperProps ] = useState(\n\t\t\t\tArray( features.length ).fill( undefined )\n\t\t\t);\n\t\t\treturn [\n\t\t\t\t...features.map( ( feature, i ) => {\n\t\t\t\t\tconst {\n\t\t\t\t\t\thasSupport,\n\t\t\t\t\t\tattributeKeys = [],\n\t\t\t\t\t\tuseBlockProps,\n\t\t\t\t\t} = feature;\n\n\t\t\t\t\tconst neededProps = {};\n\t\t\t\t\tfor ( const key of attributeKeys ) {\n\t\t\t\t\t\tif ( props.attributes[ key ] ) {\n\t\t\t\t\t\t\tneededProps[ key ] = props.attributes[ key ];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t// Skip rendering if none of the needed attributes are\n\t\t\t\t\t\t// set.\n\t\t\t\t\t\t! Object.keys( neededProps ).length ||\n\t\t\t\t\t\t! hasSupport( props.name )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<BlockPropsPure\n\t\t\t\t\t\t\t// We can use the index because the array length\n\t\t\t\t\t\t\t// is fixed per page load right now.\n\t\t\t\t\t\t\tkey={ i }\n\t\t\t\t\t\t\tindex={ i }\n\t\t\t\t\t\t\tuseBlockProps={ useBlockProps }\n\t\t\t\t\t\t\t// This component is pure, so we must pass a stable\n\t\t\t\t\t\t\t// function reference.\n\t\t\t\t\t\t\tsetAllWrapperProps={ setAllWrapperProps }\n\t\t\t\t\t\t\tname={ props.name }\n\t\t\t\t\t\t\t// This component is pure, so only pass needed\n\t\t\t\t\t\t\t// props!!!\n\t\t\t\t\t\t\t{ ...neededProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t\t\t<BlockListBlock\n\t\t\t\t\tkey=\"edit\"\n\t\t\t\t\t{ ...props }\n\t\t\t\t\twrapperProps={ allWrapperProps\n\t\t\t\t\t\t.filter( Boolean )\n\t\t\t\t\t\t.reduce( ( acc, wrapperProps ) => {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t\t...wrapperProps,\n\t\t\t\t\t\t\t\tclassName: classnames(\n\t\t\t\t\t\t\t\t\tacc.className,\n\t\t\t\t\t\t\t\t\twrapperProps.className\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\t...acc.style,\n\t\t\t\t\t\t\t\t\t...wrapperProps.style,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}, props.wrapperProps || {} ) }\n\t\t\t\t/>,\n\t\t\t];\n\t\t},\n\t\t'withBlockListBlockHooks'\n\t);\n\taddFilter(\n\t\t'editor.BlockListBlock',\n\t\t'core/editor/hooks',\n\t\twithBlockListBlockHooks\n\t);\n}\n\nexport function createBlockSaveFilter( features ) {\n\tfunction extraPropsFromHooks( props, name, attributes ) {\n\t\treturn features.reduce( ( accu, feature ) => {\n\t\t\tconst { hasSupport, attributeKeys = [], addSaveProps } = feature;\n\n\t\t\tconst neededAttributes = {};\n\t\t\tfor ( const key of attributeKeys ) {\n\t\t\t\tif ( attributes[ key ] ) {\n\t\t\t\t\tneededAttributes[ key ] = attributes[ key ];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t// Skip rendering if none of the needed attributes are\n\t\t\t\t// set.\n\t\t\t\t! Object.keys( neededAttributes ).length ||\n\t\t\t\t! hasSupport( name )\n\t\t\t) {\n\t\t\t\treturn accu;\n\t\t\t}\n\n\t\t\treturn addSaveProps( accu, name, neededAttributes );\n\t\t}, props );\n\t}\n\taddFilter(\n\t\t'blocks.getSaveContent.extraProps',\n\t\t'core/editor/hooks',\n\t\textraPropsFromHooks,\n\t\t0\n\t);\n\taddFilter(\n\t\t'blocks.getSaveContent.extraProps',\n\t\t'core/editor/hooks',\n\t\t( props ) => {\n\t\t\t// Previously we had a filter deleting the className if it was an empty\n\t\t\t// string. That filter is no longer running, so now we need to delete it\n\t\t\t// here.\n\t\t\tif ( props.hasOwnProperty( 'className' ) && ! props.className ) {\n\t\t\t\tdelete props.className;\n\t\t\t}\n\n\t\t\treturn props;\n\t\t}\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,SAASC,IAAI,EAAEC,OAAO,EAAEC,SAAS,EAAEC,KAAK,EAAEC,QAAQ,QAAQ,oBAAoB;AAC9E,SAASC,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;AAC1D,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SAASC,SAAS,QAAQ,kBAAkB;;AAE5C;AACA;AACA;AACA,SACCC,mBAAmB,EACnBC,qBAAqB,EACrBC,2BAA2B,QACrB,kCAAkC;AACzC,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,0BAA0B,QAAQ,mCAAmC;AAC9E,SAASC,sBAAsB,EAAEC,YAAY,QAAQ,iBAAiB;AACtE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SAASC,MAAM,QAAQ,gBAAgB;AACvC;AACA;AACA;AACA,OAAOC,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAKC,MAAM,IAAM;EAC7C,IACCA,MAAM,KAAK,IAAI,IACf,OAAOA,MAAM,KAAK,QAAQ,IAC1BC,KAAK,CAACC,OAAO,CAAEF,MAAO,CAAC,EACtB;IACD,OAAOA,MAAM;EACd;EAE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ClC,mBAAmB,EACjB8J,KAAK,IAAM;IACZ;IACA;IACA;IACA,IAAKA,KAAK,CAACqC,cAAc,CAAE,WAAY,CAAC,IAAI,CAAErC,KAAK,CAAC+B,SAAS,EAAG;MAC/D,OAAO/B,KAAK,CAAC+B,SAAS;IACvB;IAEA,OAAO/B,KAAK;EACb,CACD,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["getBlockSupport","memo","useMemo","useEffect","useId","useState","useDispatch","useRegistry","createHigherOrderComponent","addFilter","useBlockEditContext","mayDisplayControlsKey","mayDisplayParentControlsKey","useSettings","useSettingsForBlockElement","getValueFromObjectPath","setImmutably","store","blockEditorStore","unlock","classnames","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","entries","map","key","value","filter","undefined","length","fromEntries","transformStyles","activeSupports","migrationPaths","result","source","index","results","values","every","isActive","innerBlocks","referenceBlockAttributes","attributes","returnBlock","forEach","support","path","styleValue","shouldSkipSerialization","blockNameOrType","featureSet","feature","skipSerialization","__experimentalSkipSerialization","includes","pendingStyleOverrides","WeakMap","useStyleOverride","id","css","assets","__unstableType","clientId","setStyleOverride","deleteStyleOverride","registry","fallbackId","_id","override","get","set","push","window","queueMicrotask","batch","args","isPending","find","currentId","useBlockSettings","name","parentLayout","backgroundImage","backgroundSize","customFontFamilies","defaultFontFamilies","themeFontFamilies","defaultFontSizesEnabled","customFontSizes","defaultFontSizes","themeFontSizes","customFontSize","fontStyle","fontWeight","lineHeight","textAlign","textColumns","textDecoration","writingMode","textTransform","letterSpacing","padding","margin","blockGap","spacingSizes","units","aspectRatio","minHeight","layout","borderColor","borderRadius","borderStyle","borderWidth","customColorsEnabled","customColors","customDuotone","themeColors","defaultColors","defaultPalette","defaultDuotone","userDuotonePalette","themeDuotonePalette","defaultDuotonePalette","userGradientPalette","themeGradientPalette","defaultGradientPalette","defaultGradients","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","isHeadingEnabled","isButtonEnabled","shadow","rawSettings","background","color","palette","custom","theme","default","gradients","duotone","customGradient","link","heading","button","text","typography","fontFamilies","fontSizes","spacing","border","radius","style","width","dimensions","createBlockEditFilter","features","settings","Edit","edit","withBlockEditHooks","OriginalBlockEdit","props","context","i","hasSupport","attributeKeys","shareWithChildBlocks","shouldDisplayControls","neededProps","createElement","isSelected","setAttributes","__unstableParentLayout","BlockProps","useBlockProps","setAllWrapperProps","wrapperProps","setWrapperProps","next","prev","nextAll","BlockPropsPure","createBlockListBlockFilter","withBlockListBlockHooks","BlockListBlock","allWrapperProps","fill","keys","Boolean","reduce","acc","className","createBlockSaveFilter","extraPropsFromHooks","accu","addSaveProps","neededAttributes","hasOwnProperty"],"sources":["@wordpress/block-editor/src/hooks/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { memo, useMemo, useEffect, useId, useState } from '@wordpress/element';\nimport { useDispatch, useRegistry } from '@wordpress/data';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseBlockEditContext,\n\tmayDisplayControlsKey,\n\tmayDisplayParentControlsKey,\n} from '../components/block-edit/context';\nimport { useSettings } from '../components';\nimport { useSettingsForBlockElement } from '../components/global-styles/hooks';\nimport { getValueFromObjectPath, setImmutably } from '../utils/object';\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * Removed falsy values from nested object.\n *\n * @param {*} object\n * @return {*} Object cleaned from falsy values\n */\nexport const cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\n\tconst cleanedNestedObjects = Object.entries( object )\n\t\t.map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )\n\t\t.filter( ( [ , value ] ) => value !== undefined );\n\treturn ! cleanedNestedObjects.length\n\t\t? undefined\n\t\t: Object.fromEntries( cleanedNestedObjects );\n};\n\nexport function transformStyles(\n\tactiveSupports,\n\tmigrationPaths,\n\tresult,\n\tsource,\n\tindex,\n\tresults\n) {\n\t// If there are no active supports return early.\n\tif (\n\t\tObject.values( activeSupports ?? {} ).every(\n\t\t\t( isActive ) => ! isActive\n\t\t)\n\t) {\n\t\treturn result;\n\t}\n\t// If the condition verifies we are probably in the presence of a wrapping transform\n\t// e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed.\n\tif ( results.length === 1 && result.innerBlocks.length === source.length ) {\n\t\treturn result;\n\t}\n\t// For cases where we have a transform from one block to multiple blocks\n\t// or multiple blocks to one block we apply the styles of the first source block\n\t// to the result(s).\n\tlet referenceBlockAttributes = source[ 0 ]?.attributes;\n\t// If we are in presence of transform between more than one block in the source\n\t// that has more than one block in the result\n\t// we apply the styles on source N to the result N,\n\t// if source N does not exists we do nothing.\n\tif ( results.length > 1 && source.length > 1 ) {\n\t\tif ( source[ index ] ) {\n\t\t\treferenceBlockAttributes = source[ index ]?.attributes;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n\tlet returnBlock = result;\n\tObject.entries( activeSupports ).forEach( ( [ support, isActive ] ) => {\n\t\tif ( isActive ) {\n\t\t\tmigrationPaths[ support ].forEach( ( path ) => {\n\t\t\t\tconst styleValue = getValueFromObjectPath(\n\t\t\t\t\treferenceBlockAttributes,\n\t\t\t\t\tpath\n\t\t\t\t);\n\t\t\t\tif ( styleValue ) {\n\t\t\t\t\treturnBlock = {\n\t\t\t\t\t\t...returnBlock,\n\t\t\t\t\t\tattributes: setImmutably(\n\t\t\t\t\t\t\treturnBlock.attributes,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tstyleValue\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\treturn returnBlock;\n}\n\n/**\n * Check whether serialization of specific block support feature or set should\n * be skipped.\n *\n * @param {string|Object} blockNameOrType Block name or block type object.\n * @param {string} featureSet Name of block support feature set.\n * @param {string} feature Name of the individual feature to check.\n *\n * @return {boolean} Whether serialization should occur.\n */\nexport function shouldSkipSerialization(\n\tblockNameOrType,\n\tfeatureSet,\n\tfeature\n) {\n\tconst support = getBlockSupport( blockNameOrType, featureSet );\n\tconst skipSerialization = support?.__experimentalSkipSerialization;\n\n\tif ( Array.isArray( skipSerialization ) ) {\n\t\treturn skipSerialization.includes( feature );\n\t}\n\n\treturn skipSerialization;\n}\n\nconst pendingStyleOverrides = new WeakMap();\n\nexport function useStyleOverride( {\n\tid,\n\tcss,\n\tassets,\n\t__unstableType,\n\tclientId,\n} = {} ) {\n\tconst { setStyleOverride, deleteStyleOverride } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst registry = useRegistry();\n\tconst fallbackId = useId();\n\tuseEffect( () => {\n\t\t// Unmount if there is CSS and assets are empty.\n\t\tif ( ! css && ! assets ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst _id = id || fallbackId;\n\t\tconst override = {\n\t\t\tid,\n\t\t\tcss,\n\t\t\tassets,\n\t\t\t__unstableType,\n\t\t\tclientId,\n\t\t};\n\t\t// Batch updates to style overrides to avoid triggering cascading renders\n\t\t// for each style override block included in a tree and optimize initial render.\n\t\tif ( ! pendingStyleOverrides.get( registry ) ) {\n\t\t\tpendingStyleOverrides.set( registry, [] );\n\t\t}\n\t\tpendingStyleOverrides.get( registry ).push( [ _id, override ] );\n\t\twindow.queueMicrotask( () => {\n\t\t\tif ( pendingStyleOverrides.get( registry )?.length ) {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tpendingStyleOverrides.get( registry ).forEach( ( args ) => {\n\t\t\t\t\t\tsetStyleOverride( ...args );\n\t\t\t\t\t} );\n\t\t\t\t\tpendingStyleOverrides.set( registry, [] );\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tconst isPending = pendingStyleOverrides\n\t\t\t\t.get( registry )\n\t\t\t\t?.find( ( [ currentId ] ) => currentId === _id );\n\t\t\tif ( isPending ) {\n\t\t\t\tpendingStyleOverrides.set(\n\t\t\t\t\tregistry,\n\t\t\t\t\tpendingStyleOverrides\n\t\t\t\t\t\t.get( registry )\n\t\t\t\t\t\t.filter( ( [ currentId ] ) => currentId !== _id )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tdeleteStyleOverride( _id );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tid,\n\t\tcss,\n\t\tclientId,\n\t\tassets,\n\t\t__unstableType,\n\t\tfallbackId,\n\t\tsetStyleOverride,\n\t\tdeleteStyleOverride,\n\t\tregistry,\n\t] );\n}\n\n/**\n * Based on the block and its context, returns an object of all the block settings.\n * This object can be passed as a prop to all the Styles UI components\n * (TypographyPanel, DimensionsPanel...).\n *\n * @param {string} name Block name.\n * @param {*} parentLayout Parent layout.\n *\n * @return {Object} Settings object.\n */\nexport function useBlockSettings( name, parentLayout ) {\n\tconst [\n\t\tbackgroundImage,\n\t\tbackgroundSize,\n\t\tcustomFontFamilies,\n\t\tdefaultFontFamilies,\n\t\tthemeFontFamilies,\n\t\tdefaultFontSizesEnabled,\n\t\tcustomFontSizes,\n\t\tdefaultFontSizes,\n\t\tthemeFontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextAlign,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\twritingMode,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tspacingSizes,\n\t\tunits,\n\t\taspectRatio,\n\t\tminHeight,\n\t\tlayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tcustomDuotone,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tdefaultDuotone,\n\t\tuserDuotonePalette,\n\t\tthemeDuotonePalette,\n\t\tdefaultDuotonePalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t\tisHeadingEnabled,\n\t\tisButtonEnabled,\n\t\tshadow,\n\t] = useSettings(\n\t\t'background.backgroundImage',\n\t\t'background.backgroundSize',\n\t\t'typography.fontFamilies.custom',\n\t\t'typography.fontFamilies.default',\n\t\t'typography.fontFamilies.theme',\n\t\t'typography.defaultFontSizes',\n\t\t'typography.fontSizes.custom',\n\t\t'typography.fontSizes.default',\n\t\t'typography.fontSizes.theme',\n\t\t'typography.customFontSize',\n\t\t'typography.fontStyle',\n\t\t'typography.fontWeight',\n\t\t'typography.lineHeight',\n\t\t'typography.textAlign',\n\t\t'typography.textColumns',\n\t\t'typography.textDecoration',\n\t\t'typography.writingMode',\n\t\t'typography.textTransform',\n\t\t'typography.letterSpacing',\n\t\t'spacing.padding',\n\t\t'spacing.margin',\n\t\t'spacing.blockGap',\n\t\t'spacing.spacingSizes',\n\t\t'spacing.units',\n\t\t'dimensions.aspectRatio',\n\t\t'dimensions.minHeight',\n\t\t'layout',\n\t\t'border.color',\n\t\t'border.radius',\n\t\t'border.style',\n\t\t'border.width',\n\t\t'color.custom',\n\t\t'color.palette.custom',\n\t\t'color.customDuotone',\n\t\t'color.palette.theme',\n\t\t'color.palette.default',\n\t\t'color.defaultPalette',\n\t\t'color.defaultDuotone',\n\t\t'color.duotone.custom',\n\t\t'color.duotone.theme',\n\t\t'color.duotone.default',\n\t\t'color.gradients.custom',\n\t\t'color.gradients.theme',\n\t\t'color.gradients.default',\n\t\t'color.defaultGradients',\n\t\t'color.customGradient',\n\t\t'color.background',\n\t\t'color.link',\n\t\t'color.text',\n\t\t'color.heading',\n\t\t'color.button',\n\t\t'shadow'\n\t);\n\n\tconst rawSettings = useMemo( () => {\n\t\treturn {\n\t\t\tbackground: {\n\t\t\t\tbackgroundImage,\n\t\t\t\tbackgroundSize,\n\t\t\t},\n\t\t\tcolor: {\n\t\t\t\tpalette: {\n\t\t\t\t\tcustom: customColors,\n\t\t\t\t\ttheme: themeColors,\n\t\t\t\t\tdefault: defaultColors,\n\t\t\t\t},\n\t\t\t\tgradients: {\n\t\t\t\t\tcustom: userGradientPalette,\n\t\t\t\t\ttheme: themeGradientPalette,\n\t\t\t\t\tdefault: defaultGradientPalette,\n\t\t\t\t},\n\t\t\t\tduotone: {\n\t\t\t\t\tcustom: userDuotonePalette,\n\t\t\t\t\ttheme: themeDuotonePalette,\n\t\t\t\t\tdefault: defaultDuotonePalette,\n\t\t\t\t},\n\t\t\t\tdefaultGradients,\n\t\t\t\tdefaultPalette,\n\t\t\t\tdefaultDuotone,\n\t\t\t\tcustom: customColorsEnabled,\n\t\t\t\tcustomGradient: areCustomGradientsEnabled,\n\t\t\t\tcustomDuotone,\n\t\t\t\tbackground: isBackgroundEnabled,\n\t\t\t\tlink: isLinkEnabled,\n\t\t\t\theading: isHeadingEnabled,\n\t\t\t\tbutton: isButtonEnabled,\n\t\t\t\ttext: isTextEnabled,\n\t\t\t},\n\t\t\ttypography: {\n\t\t\t\tfontFamilies: {\n\t\t\t\t\tcustom: customFontFamilies,\n\t\t\t\t\tdefault: defaultFontFamilies,\n\t\t\t\t\ttheme: themeFontFamilies,\n\t\t\t\t},\n\t\t\t\tfontSizes: {\n\t\t\t\t\tcustom: customFontSizes,\n\t\t\t\t\tdefault: defaultFontSizes,\n\t\t\t\t\ttheme: themeFontSizes,\n\t\t\t\t},\n\t\t\t\tcustomFontSize,\n\t\t\t\tdefaultFontSizes: defaultFontSizesEnabled,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tlineHeight,\n\t\t\t\ttextAlign,\n\t\t\t\ttextColumns,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t\twritingMode,\n\t\t\t},\n\t\t\tspacing: {\n\t\t\t\tspacingSizes: {\n\t\t\t\t\tcustom: spacingSizes,\n\t\t\t\t},\n\t\t\t\tpadding,\n\t\t\t\tmargin,\n\t\t\t\tblockGap,\n\t\t\t\tunits,\n\t\t\t},\n\t\t\tborder: {\n\t\t\t\tcolor: borderColor,\n\t\t\t\tradius: borderRadius,\n\t\t\t\tstyle: borderStyle,\n\t\t\t\twidth: borderWidth,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\taspectRatio,\n\t\t\t\tminHeight,\n\t\t\t},\n\t\t\tlayout,\n\t\t\tparentLayout,\n\t\t\tshadow,\n\t\t};\n\t}, [\n\t\tbackgroundImage,\n\t\tbackgroundSize,\n\t\tcustomFontFamilies,\n\t\tdefaultFontFamilies,\n\t\tthemeFontFamilies,\n\t\tdefaultFontSizesEnabled,\n\t\tcustomFontSizes,\n\t\tdefaultFontSizes,\n\t\tthemeFontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextAlign,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\twritingMode,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tspacingSizes,\n\t\tunits,\n\t\taspectRatio,\n\t\tminHeight,\n\t\tlayout,\n\t\tparentLayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tcustomDuotone,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tdefaultDuotone,\n\t\tuserDuotonePalette,\n\t\tthemeDuotonePalette,\n\t\tdefaultDuotonePalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t\tisHeadingEnabled,\n\t\tisButtonEnabled,\n\t\tshadow,\n\t] );\n\n\treturn useSettingsForBlockElement( rawSettings, name );\n}\n\nexport function createBlockEditFilter( features ) {\n\t// We don't want block controls to re-render when typing inside a block.\n\t// `memo` will prevent re-renders unless props change, so only pass the\n\t// needed props and not the whole attributes object.\n\tfeatures = features.map( ( settings ) => {\n\t\treturn { ...settings, Edit: memo( settings.edit ) };\n\t} );\n\tconst withBlockEditHooks = createHigherOrderComponent(\n\t\t( OriginalBlockEdit ) => ( props ) => {\n\t\t\tconst context = useBlockEditContext();\n\t\t\t// CAUTION: code added before this line will be executed for all\n\t\t\t// blocks, not just those that support the feature! Code added\n\t\t\t// above this line should be carefully evaluated for its impact on\n\t\t\t// performance.\n\t\t\treturn [\n\t\t\t\t...features.map( ( feature, i ) => {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tEdit,\n\t\t\t\t\t\thasSupport,\n\t\t\t\t\t\tattributeKeys = [],\n\t\t\t\t\t\tshareWithChildBlocks,\n\t\t\t\t\t} = feature;\n\t\t\t\t\tconst shouldDisplayControls =\n\t\t\t\t\t\tcontext[ mayDisplayControlsKey ] ||\n\t\t\t\t\t\t( context[ mayDisplayParentControlsKey ] &&\n\t\t\t\t\t\t\tshareWithChildBlocks );\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! shouldDisplayControls ||\n\t\t\t\t\t\t! hasSupport( props.name )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst neededProps = {};\n\t\t\t\t\tfor ( const key of attributeKeys ) {\n\t\t\t\t\t\tif ( props.attributes[ key ] ) {\n\t\t\t\t\t\t\tneededProps[ key ] = props.attributes[ key ];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Edit\n\t\t\t\t\t\t\t// We can use the index because the array length\n\t\t\t\t\t\t\t// is fixed per page load right now.\n\t\t\t\t\t\t\tkey={ i }\n\t\t\t\t\t\t\tname={ props.name }\n\t\t\t\t\t\t\tisSelected={ props.isSelected }\n\t\t\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\t\t\tsetAttributes={ props.setAttributes }\n\t\t\t\t\t\t\t__unstableParentLayout={\n\t\t\t\t\t\t\t\tprops.__unstableParentLayout\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// This component is pure, so only pass needed\n\t\t\t\t\t\t\t// props!!!\n\t\t\t\t\t\t\t{ ...neededProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t\t\t<OriginalBlockEdit key=\"edit\" { ...props } />,\n\t\t\t];\n\t\t},\n\t\t'withBlockEditHooks'\n\t);\n\taddFilter( 'editor.BlockEdit', 'core/editor/hooks', withBlockEditHooks );\n}\n\nfunction BlockProps( { index, useBlockProps, setAllWrapperProps, ...props } ) {\n\tconst wrapperProps = useBlockProps( props );\n\tconst setWrapperProps = ( next ) =>\n\t\tsetAllWrapperProps( ( prev ) => {\n\t\t\tconst nextAll = [ ...prev ];\n\t\t\tnextAll[ index ] = next;\n\t\t\treturn nextAll;\n\t\t} );\n\t// Setting state after every render is fine because this component is\n\t// pure and will only re-render when needed props change.\n\tuseEffect( () => {\n\t\t// We could shallow compare the props, but since this component only\n\t\t// changes when needed attributes change, the benefit is probably small.\n\t\tsetWrapperProps( wrapperProps );\n\t\treturn () => {\n\t\t\tsetWrapperProps( undefined );\n\t\t};\n\t} );\n\treturn null;\n}\n\nconst BlockPropsPure = memo( BlockProps );\n\nexport function createBlockListBlockFilter( features ) {\n\tconst withBlockListBlockHooks = createHigherOrderComponent(\n\t\t( BlockListBlock ) => ( props ) => {\n\t\t\tconst [ allWrapperProps, setAllWrapperProps ] = useState(\n\t\t\t\tArray( features.length ).fill( undefined )\n\t\t\t);\n\t\t\treturn [\n\t\t\t\t...features.map( ( feature, i ) => {\n\t\t\t\t\tconst {\n\t\t\t\t\t\thasSupport,\n\t\t\t\t\t\tattributeKeys = [],\n\t\t\t\t\t\tuseBlockProps,\n\t\t\t\t\t} = feature;\n\n\t\t\t\t\tconst neededProps = {};\n\t\t\t\t\tfor ( const key of attributeKeys ) {\n\t\t\t\t\t\tif ( props.attributes[ key ] ) {\n\t\t\t\t\t\t\tneededProps[ key ] = props.attributes[ key ];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t// Skip rendering if none of the needed attributes are\n\t\t\t\t\t\t// set.\n\t\t\t\t\t\t! Object.keys( neededProps ).length ||\n\t\t\t\t\t\t! hasSupport( props.name )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<BlockPropsPure\n\t\t\t\t\t\t\t// We can use the index because the array length\n\t\t\t\t\t\t\t// is fixed per page load right now.\n\t\t\t\t\t\t\tkey={ i }\n\t\t\t\t\t\t\tindex={ i }\n\t\t\t\t\t\t\tuseBlockProps={ useBlockProps }\n\t\t\t\t\t\t\t// This component is pure, so we must pass a stable\n\t\t\t\t\t\t\t// function reference.\n\t\t\t\t\t\t\tsetAllWrapperProps={ setAllWrapperProps }\n\t\t\t\t\t\t\tname={ props.name }\n\t\t\t\t\t\t\t// This component is pure, so only pass needed\n\t\t\t\t\t\t\t// props!!!\n\t\t\t\t\t\t\t{ ...neededProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t\t\t<BlockListBlock\n\t\t\t\t\tkey=\"edit\"\n\t\t\t\t\t{ ...props }\n\t\t\t\t\twrapperProps={ allWrapperProps\n\t\t\t\t\t\t.filter( Boolean )\n\t\t\t\t\t\t.reduce( ( acc, wrapperProps ) => {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t\t...wrapperProps,\n\t\t\t\t\t\t\t\tclassName: classnames(\n\t\t\t\t\t\t\t\t\tacc.className,\n\t\t\t\t\t\t\t\t\twrapperProps.className\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\t...acc.style,\n\t\t\t\t\t\t\t\t\t...wrapperProps.style,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}, props.wrapperProps || {} ) }\n\t\t\t\t/>,\n\t\t\t];\n\t\t},\n\t\t'withBlockListBlockHooks'\n\t);\n\taddFilter(\n\t\t'editor.BlockListBlock',\n\t\t'core/editor/hooks',\n\t\twithBlockListBlockHooks\n\t);\n}\n\nexport function createBlockSaveFilter( features ) {\n\tfunction extraPropsFromHooks( props, name, attributes ) {\n\t\treturn features.reduce( ( accu, feature ) => {\n\t\t\tconst { hasSupport, attributeKeys = [], addSaveProps } = feature;\n\n\t\t\tconst neededAttributes = {};\n\t\t\tfor ( const key of attributeKeys ) {\n\t\t\t\tif ( attributes[ key ] ) {\n\t\t\t\t\tneededAttributes[ key ] = attributes[ key ];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t// Skip rendering if none of the needed attributes are\n\t\t\t\t// set.\n\t\t\t\t! Object.keys( neededAttributes ).length ||\n\t\t\t\t! hasSupport( name )\n\t\t\t) {\n\t\t\t\treturn accu;\n\t\t\t}\n\n\t\t\treturn addSaveProps( accu, name, neededAttributes );\n\t\t}, props );\n\t}\n\taddFilter(\n\t\t'blocks.getSaveContent.extraProps',\n\t\t'core/editor/hooks',\n\t\textraPropsFromHooks,\n\t\t0\n\t);\n\taddFilter(\n\t\t'blocks.getSaveContent.extraProps',\n\t\t'core/editor/hooks',\n\t\t( props ) => {\n\t\t\t// Previously we had a filter deleting the className if it was an empty\n\t\t\t// string. That filter is no longer running, so now we need to delete it\n\t\t\t// here.\n\t\t\tif ( props.hasOwnProperty( 'className' ) && ! props.className ) {\n\t\t\t\tdelete props.className;\n\t\t\t}\n\n\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