@wordpress/block-editor 9.3.0 → 9.6.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 (449) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -8
  3. package/build/components/block-list/block-invalid-warning.native.js +54 -6
  4. package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
  5. package/build/components/block-list/block.js +2 -2
  6. package/build/components/block-list/block.js.map +1 -1
  7. package/build/components/block-list/block.native.js +2 -1
  8. package/build/components/block-list/block.native.js.map +1 -1
  9. package/build/components/block-list/index.native.js +4 -3
  10. package/build/components/block-list/index.native.js.map +1 -1
  11. package/build/components/block-list/layout.js +20 -5
  12. package/build/components/block-list/layout.js.map +1 -1
  13. package/build/components/block-list/use-block-props/use-block-class-names.js +5 -2
  14. package/build/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
  15. package/build/components/block-lock/modal.js +37 -7
  16. package/build/components/block-lock/modal.js.map +1 -1
  17. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
  18. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  19. package/build/components/block-mover/mover-description.js +95 -32
  20. package/build/components/block-mover/mover-description.js.map +1 -1
  21. package/build/components/block-pattern-setup/index.js +8 -26
  22. package/build/components/block-pattern-setup/index.js.map +1 -1
  23. package/build/components/block-pattern-setup/setup-toolbar.js +3 -8
  24. package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  25. package/build/components/block-popover/inbetween.js +1 -1
  26. package/build/components/block-popover/inbetween.js.map +1 -1
  27. package/build/components/block-popover/index.js +1 -1
  28. package/build/components/block-popover/index.js.map +1 -1
  29. package/build/components/block-preview/auto.js +21 -5
  30. package/build/components/block-preview/auto.js.map +1 -1
  31. package/build/components/block-settings-menu/block-edit-visually-button.js +70 -0
  32. package/build/components/block-settings-menu/block-edit-visually-button.js.map +1 -0
  33. package/build/components/block-settings-menu/block-mode-toggle.js +1 -1
  34. package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  35. package/build/components/block-settings-menu/block-settings-dropdown.js +5 -2
  36. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  37. package/build/components/block-settings-menu/index.js +6 -2
  38. package/build/components/block-settings-menu/index.js.map +1 -1
  39. package/build/components/block-settings-menu-controls/index.js +5 -2
  40. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  41. package/build/components/block-styles/preview.native.js.map +1 -1
  42. package/build/components/block-switcher/index.js +7 -1
  43. package/build/components/block-switcher/index.js.map +1 -1
  44. package/build/components/block-title/index.js +8 -2
  45. package/build/components/block-title/index.js.map +1 -1
  46. package/build/components/block-title/use-block-display-title.js +15 -15
  47. package/build/components/block-title/use-block-display-title.js.map +1 -1
  48. package/build/components/block-tools/block-contextual-toolbar.js +1 -1
  49. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  50. package/build/components/block-tools/block-selection-button.js +1 -7
  51. package/build/components/block-tools/block-selection-button.js.map +1 -1
  52. package/build/components/block-tools/index.js +4 -1
  53. package/build/components/block-tools/index.js.map +1 -1
  54. package/build/components/block-types-list/index.native.js +65 -23
  55. package/build/components/block-types-list/index.native.js.map +1 -1
  56. package/build/components/border-radius-control/index.js +2 -0
  57. package/build/components/border-radius-control/index.js.map +1 -1
  58. package/build/components/colors/with-colors.js +1 -1
  59. package/build/components/colors/with-colors.js.map +1 -1
  60. package/build/components/colors-gradients/control.js +46 -39
  61. package/build/components/colors-gradients/control.js.map +1 -1
  62. package/build/components/colors-gradients/dropdown.js +7 -3
  63. package/build/components/colors-gradients/dropdown.js.map +1 -1
  64. package/build/components/date-format-picker/index.js +1 -1
  65. package/build/components/date-format-picker/index.js.map +1 -1
  66. package/build/components/duotone/components.js +145 -0
  67. package/build/components/duotone/components.js.map +1 -0
  68. package/build/components/duotone/index.js +40 -0
  69. package/build/components/duotone/index.js.map +1 -0
  70. package/build/components/duotone/utils.js +38 -0
  71. package/build/components/duotone/utils.js.map +1 -0
  72. package/build/components/duotone-control/index.js +17 -5
  73. package/build/components/duotone-control/index.js.map +1 -1
  74. package/build/components/iframe/index.js +19 -6
  75. package/build/components/iframe/index.js.map +1 -1
  76. package/build/components/image-editor/cropper.js +4 -3
  77. package/build/components/image-editor/cropper.js.map +1 -1
  78. package/build/components/image-editor/index.js +3 -1
  79. package/build/components/image-editor/index.js.map +1 -1
  80. package/build/components/index.js +14 -0
  81. package/build/components/index.js.map +1 -1
  82. package/build/components/inserter/block-types-tab.native.js +30 -16
  83. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  84. package/build/components/inserter/index.js +3 -3
  85. package/build/components/inserter/index.js.map +1 -1
  86. package/build/components/inserter/preview-panel.js +8 -8
  87. package/build/components/inserter/preview-panel.js.map +1 -1
  88. package/build/components/inserter/reusable-blocks-tab.native.js +5 -1
  89. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  90. package/build/components/inserter/search-results.native.js +5 -2
  91. package/build/components/inserter/search-results.native.js.map +1 -1
  92. package/build/components/inserter/utils.native.js +21 -0
  93. package/build/components/inserter/utils.native.js.map +1 -1
  94. package/build/components/inserter-list-item/index.js +5 -1
  95. package/build/components/inserter-list-item/index.js.map +1 -1
  96. package/build/components/link-control/index.js +1 -1
  97. package/build/components/link-control/index.js.map +1 -1
  98. package/build/components/list-view/block-select-button.js +15 -7
  99. package/build/components/list-view/block-select-button.js.map +1 -1
  100. package/build/components/list-view/branch.js +1 -7
  101. package/build/components/list-view/branch.js.map +1 -1
  102. package/build/components/list-view/drop-indicator.js +1 -1
  103. package/build/components/list-view/drop-indicator.js.map +1 -1
  104. package/build/components/media-placeholder/index.js +14 -2
  105. package/build/components/media-placeholder/index.js.map +1 -1
  106. package/build/components/media-placeholder/index.native.js +4 -4
  107. package/build/components/media-placeholder/index.native.js.map +1 -1
  108. package/build/components/media-replace-flow/index.js +6 -13
  109. package/build/components/media-replace-flow/index.js.map +1 -1
  110. package/build/components/observe-typing/index.js +22 -8
  111. package/build/components/observe-typing/index.js.map +1 -1
  112. package/build/components/publish-date-time-picker/index.js +3 -0
  113. package/build/components/publish-date-time-picker/index.js.map +1 -1
  114. package/build/components/rich-text/format-toolbar-container.js +61 -12
  115. package/build/components/rich-text/format-toolbar-container.js.map +1 -1
  116. package/build/components/rich-text/index.js +2 -1
  117. package/build/components/rich-text/index.js.map +1 -1
  118. package/build/components/rich-text/use-format-types.js +36 -16
  119. package/build/components/rich-text/use-format-types.js.map +1 -1
  120. package/build/components/rich-text/use-input-rules.js +4 -13
  121. package/build/components/rich-text/use-input-rules.js.map +1 -1
  122. package/build/components/rich-text/use-paste-handler.js +20 -5
  123. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  124. package/build/components/url-popover/index.js +2 -1
  125. package/build/components/url-popover/index.js.map +1 -1
  126. package/build/components/writing-flow/use-arrow-nav.js +34 -2
  127. package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
  128. package/build/components/writing-flow/use-multi-selection.js +3 -47
  129. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  130. package/build/components/writing-flow/use-selection-observer.js +1 -3
  131. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  132. package/build/components/writing-flow/use-tab-nav.js +1 -1
  133. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  134. package/build/elements/index.js +11 -3
  135. package/build/elements/index.js.map +1 -1
  136. package/build/hooks/aria-label.js +71 -0
  137. package/build/hooks/aria-label.js.map +1 -0
  138. package/build/hooks/color.js +2 -4
  139. package/build/hooks/color.js.map +1 -1
  140. package/build/hooks/duotone.js +33 -160
  141. package/build/hooks/duotone.js.map +1 -1
  142. package/build/hooks/index.js +11 -7
  143. package/build/hooks/index.js.map +1 -1
  144. package/build/hooks/layout.js +59 -18
  145. package/build/hooks/layout.js.map +1 -1
  146. package/build/hooks/style.js +41 -31
  147. package/build/hooks/style.js.map +1 -1
  148. package/build/hooks/utils.js +5 -3
  149. package/build/hooks/utils.js.map +1 -1
  150. package/build/index.js +7 -7
  151. package/build/index.js.map +1 -1
  152. package/build/layouts/flex.js +42 -38
  153. package/build/layouts/flex.js.map +1 -1
  154. package/build/layouts/flow.js +35 -37
  155. package/build/layouts/flow.js.map +1 -1
  156. package/build/layouts/utils.js +35 -3
  157. package/build/layouts/utils.js.map +1 -1
  158. package/build/store/actions.js +24 -31
  159. package/build/store/actions.js.map +1 -1
  160. package/build/store/index.js +0 -4
  161. package/build/store/index.js.map +1 -1
  162. package/build/store/reducer.js +23 -12
  163. package/build/store/reducer.js.map +1 -1
  164. package/build/store/selectors.js +3 -3
  165. package/build/store/selectors.js.map +1 -1
  166. package/build/utils/selection.js +34 -0
  167. package/build/utils/selection.js.map +1 -0
  168. package/build-module/components/block-list/block-invalid-warning.native.js +50 -6
  169. package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
  170. package/build-module/components/block-list/block.js +2 -2
  171. package/build-module/components/block-list/block.js.map +1 -1
  172. package/build-module/components/block-list/block.native.js +2 -1
  173. package/build-module/components/block-list/block.native.js.map +1 -1
  174. package/build-module/components/block-list/index.native.js +3 -1
  175. package/build-module/components/block-list/index.native.js.map +1 -1
  176. package/build-module/components/block-list/layout.js +19 -4
  177. package/build-module/components/block-list/layout.js.map +1 -1
  178. package/build-module/components/block-list/use-block-props/use-block-class-names.js +5 -2
  179. package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
  180. package/build-module/components/block-lock/modal.js +39 -8
  181. package/build-module/components/block-lock/modal.js.map +1 -1
  182. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +2 -2
  183. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  184. package/build-module/components/block-mover/mover-description.js +97 -33
  185. package/build-module/components/block-mover/mover-description.js.map +1 -1
  186. package/build-module/components/block-pattern-setup/index.js +9 -27
  187. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  188. package/build-module/components/block-pattern-setup/setup-toolbar.js +3 -8
  189. package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  190. package/build-module/components/block-popover/inbetween.js +1 -1
  191. package/build-module/components/block-popover/inbetween.js.map +1 -1
  192. package/build-module/components/block-popover/index.js +1 -1
  193. package/build-module/components/block-popover/index.js.map +1 -1
  194. package/build-module/components/block-preview/auto.js +20 -5
  195. package/build-module/components/block-preview/auto.js.map +1 -1
  196. package/build-module/components/block-settings-menu/block-edit-visually-button.js +56 -0
  197. package/build-module/components/block-settings-menu/block-edit-visually-button.js.map +1 -0
  198. package/build-module/components/block-settings-menu/block-mode-toggle.js +1 -1
  199. package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  200. package/build-module/components/block-settings-menu/block-settings-dropdown.js +6 -5
  201. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  202. package/build-module/components/block-settings-menu/index.js +6 -3
  203. package/build-module/components/block-settings-menu/index.js.map +1 -1
  204. package/build-module/components/block-settings-menu-controls/index.js +7 -4
  205. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  206. package/build-module/components/block-styles/preview.native.js.map +1 -1
  207. package/build-module/components/block-switcher/index.js +7 -1
  208. package/build-module/components/block-switcher/index.js.map +1 -1
  209. package/build-module/components/block-title/index.js +8 -2
  210. package/build-module/components/block-title/index.js.map +1 -1
  211. package/build-module/components/block-title/use-block-display-title.js +15 -14
  212. package/build-module/components/block-title/use-block-display-title.js.map +1 -1
  213. package/build-module/components/block-tools/block-contextual-toolbar.js +1 -1
  214. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  215. package/build-module/components/block-tools/block-selection-button.js +1 -7
  216. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  217. package/build-module/components/block-tools/index.js +4 -1
  218. package/build-module/components/block-tools/index.js.map +1 -1
  219. package/build-module/components/block-types-list/index.native.js +67 -25
  220. package/build-module/components/block-types-list/index.native.js.map +1 -1
  221. package/build-module/components/border-radius-control/index.js +2 -0
  222. package/build-module/components/border-radius-control/index.js.map +1 -1
  223. package/build-module/components/colors/with-colors.js +2 -2
  224. package/build-module/components/colors/with-colors.js.map +1 -1
  225. package/build-module/components/colors-gradients/control.js +47 -40
  226. package/build-module/components/colors-gradients/control.js.map +1 -1
  227. package/build-module/components/colors-gradients/dropdown.js +8 -4
  228. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  229. package/build-module/components/date-format-picker/index.js +1 -1
  230. package/build-module/components/date-format-picker/index.js.map +1 -1
  231. package/build-module/components/duotone/components.js +130 -0
  232. package/build-module/components/duotone/components.js.map +1 -0
  233. package/build-module/components/duotone/index.js +3 -0
  234. package/build-module/components/duotone/index.js.map +1 -0
  235. package/build-module/components/duotone/utils.js +30 -0
  236. package/build-module/components/duotone/utils.js.map +1 -0
  237. package/build-module/components/duotone-control/index.js +18 -6
  238. package/build-module/components/duotone-control/index.js.map +1 -1
  239. package/build-module/components/iframe/index.js +19 -6
  240. package/build-module/components/iframe/index.js.map +1 -1
  241. package/build-module/components/image-editor/cropper.js +4 -3
  242. package/build-module/components/image-editor/cropper.js.map +1 -1
  243. package/build-module/components/image-editor/index.js +3 -1
  244. package/build-module/components/image-editor/index.js.map +1 -1
  245. package/build-module/components/index.js +1 -0
  246. package/build-module/components/index.js.map +1 -1
  247. package/build-module/components/inserter/block-types-tab.native.js +31 -15
  248. package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
  249. package/build-module/components/inserter/index.js +3 -2
  250. package/build-module/components/inserter/index.js.map +1 -1
  251. package/build-module/components/inserter/preview-panel.js +9 -9
  252. package/build-module/components/inserter/preview-panel.js.map +1 -1
  253. package/build-module/components/inserter/reusable-blocks-tab.native.js +6 -2
  254. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  255. package/build-module/components/inserter/search-results.native.js +6 -3
  256. package/build-module/components/inserter/search-results.native.js.map +1 -1
  257. package/build-module/components/inserter/utils.native.js +19 -0
  258. package/build-module/components/inserter/utils.native.js.map +1 -1
  259. package/build-module/components/inserter-list-item/index.js +4 -1
  260. package/build-module/components/inserter-list-item/index.js.map +1 -1
  261. package/build-module/components/link-control/index.js +1 -1
  262. package/build-module/components/link-control/index.js.map +1 -1
  263. package/build-module/components/list-view/block-select-button.js +16 -8
  264. package/build-module/components/list-view/block-select-button.js.map +1 -1
  265. package/build-module/components/list-view/branch.js +1 -6
  266. package/build-module/components/list-view/branch.js.map +1 -1
  267. package/build-module/components/list-view/drop-indicator.js +1 -1
  268. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  269. package/build-module/components/media-placeholder/index.js +14 -2
  270. package/build-module/components/media-placeholder/index.js.map +1 -1
  271. package/build-module/components/media-placeholder/index.native.js +5 -3
  272. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  273. package/build-module/components/media-replace-flow/index.js +7 -13
  274. package/build-module/components/media-replace-flow/index.js.map +1 -1
  275. package/build-module/components/observe-typing/index.js +22 -8
  276. package/build-module/components/observe-typing/index.js.map +1 -1
  277. package/build-module/components/publish-date-time-picker/index.js +2 -0
  278. package/build-module/components/publish-date-time-picker/index.js.map +1 -1
  279. package/build-module/components/rich-text/format-toolbar-container.js +58 -12
  280. package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
  281. package/build-module/components/rich-text/index.js +2 -1
  282. package/build-module/components/rich-text/index.js.map +1 -1
  283. package/build-module/components/rich-text/use-format-types.js +37 -18
  284. package/build-module/components/rich-text/use-format-types.js.map +1 -1
  285. package/build-module/components/rich-text/use-input-rules.js +3 -11
  286. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  287. package/build-module/components/rich-text/use-paste-handler.js +20 -5
  288. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  289. package/build-module/components/url-popover/index.js +2 -1
  290. package/build-module/components/url-popover/index.js.map +1 -1
  291. package/build-module/components/writing-flow/use-arrow-nav.js +35 -3
  292. package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
  293. package/build-module/components/writing-flow/use-multi-selection.js +3 -45
  294. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  295. package/build-module/components/writing-flow/use-selection-observer.js +1 -3
  296. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  297. package/build-module/components/writing-flow/use-tab-nav.js +1 -1
  298. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  299. package/build-module/elements/index.js +7 -1
  300. package/build-module/elements/index.js.map +1 -1
  301. package/build-module/hooks/aria-label.js +59 -0
  302. package/build-module/hooks/aria-label.js.map +1 -0
  303. package/build-module/hooks/color.js +2 -3
  304. package/build-module/hooks/color.js.map +1 -1
  305. package/build-module/hooks/duotone.js +22 -140
  306. package/build-module/hooks/duotone.js.map +1 -1
  307. package/build-module/hooks/index.js +2 -1
  308. package/build-module/hooks/index.js.map +1 -1
  309. package/build-module/hooks/layout.js +60 -19
  310. package/build-module/hooks/layout.js.map +1 -1
  311. package/build-module/hooks/style.js +44 -35
  312. package/build-module/hooks/style.js.map +1 -1
  313. package/build-module/hooks/utils.js +5 -2
  314. package/build-module/hooks/utils.js.map +1 -1
  315. package/build-module/index.js +1 -1
  316. package/build-module/index.js.map +1 -1
  317. package/build-module/layouts/flex.js +43 -35
  318. package/build-module/layouts/flex.js.map +1 -1
  319. package/build-module/layouts/flow.js +35 -38
  320. package/build-module/layouts/flow.js.map +1 -1
  321. package/build-module/layouts/utils.js +33 -3
  322. package/build-module/layouts/utils.js.map +1 -1
  323. package/build-module/store/actions.js +14 -20
  324. package/build-module/store/actions.js.map +1 -1
  325. package/build-module/store/index.js +0 -4
  326. package/build-module/store/index.js.map +1 -1
  327. package/build-module/store/reducer.js +23 -11
  328. package/build-module/store/reducer.js.map +1 -1
  329. package/build-module/store/selectors.js +4 -4
  330. package/build-module/store/selectors.js.map +1 -1
  331. package/build-module/utils/selection.js +24 -0
  332. package/build-module/utils/selection.js.map +1 -0
  333. package/build-style/style-rtl.css +43 -13
  334. package/build-style/style.css +43 -13
  335. package/package.json +28 -28
  336. package/src/components/block-draggable/test/helpers.native.js +3 -3
  337. package/src/components/block-list/block-invalid-warning.native.js +42 -7
  338. package/src/components/block-list/block.js +2 -2
  339. package/src/components/block-list/block.native.js +1 -0
  340. package/src/components/block-list/index.native.js +1 -1
  341. package/src/components/block-list/layout.js +15 -3
  342. package/src/components/block-list/style.scss +2 -2
  343. package/src/components/block-list/use-block-props/use-block-class-names.js +5 -1
  344. package/src/components/block-lock/modal.js +47 -9
  345. package/src/components/block-lock/style.scss +10 -0
  346. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
  347. package/src/components/block-mover/mover-description.js +131 -48
  348. package/src/components/block-mover/test/mover-description.js +55 -3
  349. package/src/components/block-pattern-setup/index.js +5 -25
  350. package/src/components/block-pattern-setup/setup-toolbar.js +2 -9
  351. package/src/components/block-pattern-setup/style.scss +4 -2
  352. package/src/components/block-popover/inbetween.js +1 -1
  353. package/src/components/block-popover/index.js +1 -1
  354. package/src/components/block-preview/auto.js +17 -3
  355. package/src/components/block-settings-menu/block-edit-visually-button.js +52 -0
  356. package/src/components/block-settings-menu/block-mode-toggle.js +1 -0
  357. package/src/components/block-settings-menu/block-settings-dropdown.js +7 -3
  358. package/src/components/block-settings-menu/index.js +15 -11
  359. package/src/components/block-settings-menu-controls/index.js +5 -4
  360. package/src/components/block-styles/preview.native.js +1 -0
  361. package/src/components/block-switcher/index.js +7 -1
  362. package/src/components/block-title/index.js +3 -2
  363. package/src/components/block-title/use-block-display-title.js +20 -12
  364. package/src/components/block-tools/block-contextual-toolbar.js +3 -1
  365. package/src/components/block-tools/block-selection-button.js +0 -5
  366. package/src/components/block-tools/index.js +4 -1
  367. package/src/components/block-types-list/index.native.js +76 -24
  368. package/src/components/block-types-list/style.native.scss +18 -0
  369. package/src/components/border-radius-control/index.js +2 -0
  370. package/src/components/color-palette/test/__snapshots__/control.js.snap +0 -4
  371. package/src/components/colors/test/__snapshots__/with-colors.js.snap +1 -1
  372. package/src/components/colors/test/with-colors.js +1 -1
  373. package/src/components/colors/with-colors.js +2 -2
  374. package/src/components/colors-gradients/control.js +78 -65
  375. package/src/components/colors-gradients/dropdown.js +9 -2
  376. package/src/components/colors-gradients/style.scss +11 -8
  377. package/src/components/colors-gradients/test/control.js +16 -23
  378. package/src/components/date-format-picker/index.js +1 -0
  379. package/src/components/duotone/components.js +133 -0
  380. package/src/components/duotone/index.js +7 -0
  381. package/src/components/duotone/utils.js +25 -0
  382. package/src/components/duotone-control/index.js +12 -7
  383. package/src/components/duotone-control/style.scss +5 -0
  384. package/src/components/iframe/index.js +25 -6
  385. package/src/components/image-editor/cropper.js +9 -3
  386. package/src/components/image-editor/index.js +2 -0
  387. package/src/components/index.js +1 -0
  388. package/src/components/inserter/block-types-tab.native.js +42 -21
  389. package/src/components/inserter/index.js +3 -5
  390. package/src/components/inserter/preview-panel.js +6 -14
  391. package/src/components/inserter/reusable-blocks-tab.native.js +4 -2
  392. package/src/components/inserter/search-results.native.js +4 -2
  393. package/src/components/inserter/style.scss +1 -1
  394. package/src/components/inserter/test/block-types-tab.native.js +2 -0
  395. package/src/components/inserter/test/utils.native.js +37 -0
  396. package/src/components/inserter/utils.native.js +11 -0
  397. package/src/components/inserter-list-item/index.js +4 -1
  398. package/src/components/link-control/index.js +1 -0
  399. package/src/components/link-control/test/fixtures/index.js +3 -4
  400. package/src/components/link-control/test/index.js +64 -73
  401. package/src/components/list-view/block-select-button.js +29 -14
  402. package/src/components/list-view/branch.js +1 -6
  403. package/src/components/list-view/drop-indicator.js +1 -1
  404. package/src/components/list-view/style.scss +18 -4
  405. package/src/components/media-placeholder/index.js +20 -0
  406. package/src/components/media-placeholder/index.native.js +9 -5
  407. package/src/components/media-replace-flow/index.js +5 -14
  408. package/src/components/media-replace-flow/test/index.js +14 -4
  409. package/src/components/media-upload/README.md +8 -0
  410. package/src/components/observe-typing/index.js +17 -14
  411. package/src/components/publish-date-time-picker/index.js +2 -0
  412. package/src/components/responsive-block-control/README.md +3 -1
  413. package/src/components/responsive-block-control/test/index.js +1 -2
  414. package/src/components/rich-text/format-toolbar-container.js +63 -14
  415. package/src/components/rich-text/index.js +1 -0
  416. package/src/components/rich-text/use-format-types.js +38 -17
  417. package/src/components/rich-text/use-input-rules.js +6 -15
  418. package/src/components/rich-text/use-paste-handler.js +17 -5
  419. package/src/components/url-popover/index.js +1 -0
  420. package/src/components/url-popover/test/__snapshots__/index.js.snap +3 -0
  421. package/src/components/writing-flow/use-arrow-nav.js +32 -1
  422. package/src/components/writing-flow/use-multi-selection.js +1 -48
  423. package/src/components/writing-flow/use-selection-observer.js +2 -3
  424. package/src/components/writing-flow/use-tab-nav.js +1 -1
  425. package/src/elements/index.js +8 -1
  426. package/src/elements/test/index.js +18 -0
  427. package/src/hooks/aria-label.js +67 -0
  428. package/src/hooks/color.js +10 -3
  429. package/src/hooks/duotone.js +18 -139
  430. package/src/hooks/index.js +2 -1
  431. package/src/hooks/layout.js +77 -29
  432. package/src/hooks/style.js +46 -39
  433. package/src/hooks/utils.js +7 -3
  434. package/src/index.js +1 -1
  435. package/src/layouts/flex.js +49 -43
  436. package/src/layouts/flow.js +35 -34
  437. package/src/layouts/test/flex.js +21 -0
  438. package/src/layouts/test/flow.js +21 -0
  439. package/src/layouts/test/utils.js +138 -0
  440. package/src/layouts/utils.js +44 -3
  441. package/src/store/actions.js +17 -31
  442. package/src/store/index.js +0 -4
  443. package/src/store/reducer.js +24 -11
  444. package/src/store/selectors.js +3 -4
  445. package/src/store/test/reducer.js +138 -10
  446. package/src/store/test/selectors.js +3 -6
  447. package/src/utils/selection.js +26 -0
  448. package/src/utils/test/selection.js +39 -0
  449. package/tsconfig.json +2 -1
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { findKey } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -17,21 +12,17 @@ import { useDispatch } from '@wordpress/data';
17
12
  */
18
13
  import { store as blockEditorStore } from '../../store';
19
14
  import { preventEventDiscovery } from './prevent-event-discovery';
20
-
21
- // A robust way to retain selection position through various
22
- // transforms is to insert a special character at the position and
23
- // then recover it.
24
- const START_OF_SELECTED_AREA = '\u0086';
15
+ import {
16
+ retrieveSelectedAttribute,
17
+ START_OF_SELECTED_AREA,
18
+ } from '../../utils/selection';
25
19
 
26
20
  function findSelection( blocks ) {
27
21
  let i = blocks.length;
28
22
 
29
23
  while ( i-- ) {
30
- const attributeKey = findKey(
31
- blocks[ i ].attributes,
32
- ( v ) =>
33
- typeof v === 'string' &&
34
- v.indexOf( START_OF_SELECTED_AREA ) !== -1
24
+ const attributeKey = retrieveSelectedAttribute(
25
+ blocks[ i ].attributes
35
26
  );
36
27
 
37
28
  if ( attributeKey ) {
@@ -254,17 +254,29 @@ export function usePasteHandler( props ) {
254
254
  }
255
255
 
256
256
  /**
257
- * Normalizes a given string of HTML to remove the Windows specific "Fragment" comments
258
- * and any preceeding and trailing whitespace.
257
+ * Normalizes a given string of HTML to remove the Windows-specific "Fragment"
258
+ * comments and any preceeding and trailing content.
259
259
  *
260
260
  * @param {string} html the html to be normalized
261
261
  * @return {string} the normalized html
262
262
  */
263
263
  function removeWindowsFragments( html ) {
264
- const startReg = /.*<!--StartFragment-->/s;
265
- const endReg = /<!--EndFragment-->.*/s;
264
+ const startStr = '<!--StartFragment-->';
265
+ const startIdx = html.indexOf( startStr );
266
+ if ( startIdx > -1 ) {
267
+ html = html.substring( startIdx + startStr.length );
268
+ } else {
269
+ // No point looking for EndFragment
270
+ return html;
271
+ }
272
+
273
+ const endStr = '<!--EndFragment-->';
274
+ const endIdx = html.indexOf( endStr );
275
+ if ( endIdx > -1 ) {
276
+ html = html.substring( 0, endIdx );
277
+ }
266
278
 
267
- return html.replace( startReg, '' ).replace( endReg, '' );
279
+ return html;
268
280
  }
269
281
 
270
282
  /**
@@ -33,6 +33,7 @@ function URLPopover( {
33
33
  className="block-editor-url-popover"
34
34
  focusOnMount={ focusOnMount }
35
35
  position={ position }
36
+ __unstableShift
36
37
  { ...popoverProps }
37
38
  >
38
39
  <div className="block-editor-url-popover__input-container">
@@ -2,6 +2,7 @@
2
2
 
3
3
  exports[`URLPopover matches the snapshot in its default state 1`] = `
4
4
  <ForwardRef(Popover)
5
+ __unstableShift={true}
5
6
  className="block-editor-url-popover"
6
7
  focusOnMount="firstElement"
7
8
  position="bottom center"
@@ -38,6 +39,7 @@ exports[`URLPopover matches the snapshot in its default state 1`] = `
38
39
 
39
40
  exports[`URLPopover matches the snapshot when the settings are toggled open 1`] = `
40
41
  <ForwardRef(Popover)
42
+ __unstableShift={true}
41
43
  className="block-editor-url-popover"
42
44
  focusOnMount="firstElement"
43
45
  position="bottom center"
@@ -81,6 +83,7 @@ exports[`URLPopover matches the snapshot when the settings are toggled open 1`]
81
83
 
82
84
  exports[`URLPopover matches the snapshot when there are no settings 1`] = `
83
85
  <ForwardRef(Popover)
86
+ __unstableShift={true}
84
87
  className="block-editor-url-popover"
85
88
  focusOnMount="firstElement"
86
89
  position="bottom center"
@@ -11,7 +11,7 @@ import {
11
11
  isRTL,
12
12
  } from '@wordpress/dom';
13
13
  import { UP, DOWN, LEFT, RIGHT } from '@wordpress/keycodes';
14
- import { useSelect } from '@wordpress/data';
14
+ import { useDispatch, useSelect } from '@wordpress/data';
15
15
  import { useRefEffect } from '@wordpress/compose';
16
16
 
17
17
  /**
@@ -131,12 +131,15 @@ export function getClosestTabbable(
131
131
  export default function useArrowNav() {
132
132
  const {
133
133
  getSelectedBlockClientId,
134
+ getMultiSelectedBlocksStartClientId,
134
135
  getMultiSelectedBlocksEndClientId,
135
136
  getPreviousBlockClientId,
136
137
  getNextBlockClientId,
137
138
  getSettings,
138
139
  hasMultiSelection,
140
+ __unstableIsFullySelected,
139
141
  } = useSelect( blockEditorStore );
142
+ const { selectBlock } = useDispatch( blockEditorStore );
140
143
  return useRefEffect( ( node ) => {
141
144
  // Here a DOMRect is stored while moving the caret vertically so
142
145
  // vertical position of the start position can be restored. This is to
@@ -186,7 +189,35 @@ export default function useArrowNav() {
186
189
  const { ownerDocument } = node;
187
190
  const { defaultView } = ownerDocument;
188
191
 
192
+ // If there is a multi-selection, the arrow keys should collapse the
193
+ // selection to the start or end of the selection.
189
194
  if ( hasMultiSelection() ) {
195
+ // Only handle if we have a full selection (not a native partial
196
+ // selection).
197
+ if ( ! __unstableIsFullySelected() ) {
198
+ return;
199
+ }
200
+
201
+ if ( event.defaultPrevented ) {
202
+ return;
203
+ }
204
+
205
+ if ( ! isNav ) {
206
+ return;
207
+ }
208
+
209
+ if ( isShift ) {
210
+ return;
211
+ }
212
+
213
+ event.preventDefault();
214
+
215
+ if ( isReverse ) {
216
+ selectBlock( getMultiSelectedBlocksStartClientId() );
217
+ } else {
218
+ selectBlock( getMultiSelectedBlocksEndClientId(), -1 );
219
+ }
220
+
190
221
  return;
191
222
  }
192
223
 
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { first, last } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -13,7 +8,6 @@ import { useSelect } from '@wordpress/data';
13
8
  * Internal dependencies
14
9
  */
15
10
  import { store as blockEditorStore } from '../../store';
16
- import { __unstableUseBlockRef as useBlockRef } from '../block-list/use-block-props/use-block-refs';
17
11
 
18
12
  function selector( select ) {
19
13
  const {
@@ -44,10 +38,6 @@ export default function useMultiSelection() {
44
38
  selectedBlockClientId,
45
39
  isFullSelection,
46
40
  } = useSelect( selector, [] );
47
- const selectedRef = useBlockRef( selectedBlockClientId );
48
- // These must be in the right DOM order.
49
- const startRef = useBlockRef( first( multiSelectedBlockClientIds ) );
50
- const endRef = useBlockRef( last( multiSelectedBlockClientIds ) );
51
41
 
52
42
  /**
53
43
  * When the component updates, and there is multi selection, we need to
@@ -66,26 +56,6 @@ export default function useMultiSelection() {
66
56
  }
67
57
 
68
58
  if ( ! hasMultiSelection || isMultiSelecting ) {
69
- if ( ! selectedBlockClientId || isMultiSelecting ) {
70
- return;
71
- }
72
-
73
- const selection = defaultView.getSelection();
74
-
75
- if ( selection.rangeCount && ! selection.isCollapsed ) {
76
- const blockNode = selectedRef.current;
77
- const { startContainer, endContainer } =
78
- selection.getRangeAt( 0 );
79
-
80
- if (
81
- !! blockNode &&
82
- ( ! blockNode.contains( startContainer ) ||
83
- ! blockNode.contains( endContainer ) )
84
- ) {
85
- selection.removeAllRanges();
86
- }
87
- }
88
-
89
59
  return;
90
60
  }
91
61
 
@@ -105,25 +75,8 @@ export default function useMultiSelection() {
105
75
  // able to select across instances immediately.
106
76
  node.contentEditable = true;
107
77
 
108
- // For some browsers, like Safari, it is important that focus happens
109
- // BEFORE selection.
78
+ defaultView.getSelection().removeAllRanges();
110
79
  node.focus();
111
-
112
- // The block refs might not be immediately available
113
- // when dragging blocks into another block.
114
- if ( ! startRef.current || ! endRef.current ) {
115
- return;
116
- }
117
-
118
- const selection = defaultView.getSelection();
119
- const range = ownerDocument.createRange();
120
-
121
- // These must be in the right DOM order.
122
- range.setStartBefore( startRef.current );
123
- range.setEndAfter( endRef.current );
124
-
125
- selection.removeAllRanges();
126
- selection.addRange( range );
127
80
  },
128
81
  [
129
82
  hasMultiSelection,
@@ -84,12 +84,11 @@ export default function useSelectionObserver() {
84
84
 
85
85
  function onSelectionChange( event ) {
86
86
  const selection = defaultView.getSelection();
87
- // If no selection is found, end multi selection and disable the
88
- // contentEditable wrapper.
87
+
89
88
  if ( ! selection.rangeCount ) {
90
- setContentEditableWrapper( node, false );
91
89
  return;
92
90
  }
91
+
93
92
  // If selection is collapsed and we haven't used `shift+click`,
94
93
  // end multi selection and disable the contentEditable wrapper.
95
94
  // We have to check about `shift+click` case because elements
@@ -75,7 +75,7 @@ export default function useTabNav() {
75
75
  return;
76
76
  }
77
77
 
78
- if ( event.keyCode === ESCAPE && ! hasMultiSelection() ) {
78
+ if ( event.keyCode === ESCAPE ) {
79
79
  event.preventDefault();
80
80
  setNavigationMode( true );
81
81
  return;
@@ -1 +1,8 @@
1
- export const __experimentalElementButtonClassName = 'wp-element-button';
1
+ const ELEMENT_CLASS_NAMES = {
2
+ button: 'wp-element-button',
3
+ caption: 'wp-element-caption',
4
+ };
5
+
6
+ export const __experimentalGetElementClassName = ( element ) => {
7
+ return ELEMENT_CLASS_NAMES[ element ] ? ELEMENT_CLASS_NAMES[ element ] : '';
8
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __experimentalGetElementClassName } from '@wordpress/block-editor';
5
+
6
+ describe( 'element class names', () => {
7
+ it( 'should return the correct class name for button', () => {
8
+ expect( __experimentalGetElementClassName( 'button' ) ).toEqual(
9
+ 'wp-element-button'
10
+ );
11
+ } );
12
+
13
+ it( 'should return an empty string for an unknown element', () => {
14
+ expect(
15
+ __experimentalGetElementClassName( 'unknown-element' )
16
+ ).toEqual( '' );
17
+ } );
18
+ } );
@@ -0,0 +1,67 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { addFilter } from '@wordpress/hooks';
5
+ import { hasBlockSupport } from '@wordpress/blocks';
6
+
7
+ const ARIA_LABEL_SCHEMA = {
8
+ type: 'string',
9
+ source: 'attribute',
10
+ attribute: 'aria-label',
11
+ selector: '*',
12
+ };
13
+
14
+ /**
15
+ * Filters registered block settings, extending attributes with ariaLabel using aria-label
16
+ * of the first node.
17
+ *
18
+ * @param {Object} settings Original block settings.
19
+ *
20
+ * @return {Object} Filtered block settings.
21
+ */
22
+ export function addAttribute( settings ) {
23
+ // Allow blocks to specify their own attribute definition with default values if needed.
24
+ if ( settings?.attributes?.ariaLabel?.type ) {
25
+ return settings;
26
+ }
27
+ if ( hasBlockSupport( settings, 'ariaLabel' ) ) {
28
+ // Gracefully handle if settings.attributes is undefined.
29
+ settings.attributes = {
30
+ ...settings.attributes,
31
+ ariaLabel: ARIA_LABEL_SCHEMA,
32
+ };
33
+ }
34
+
35
+ return settings;
36
+ }
37
+
38
+ /**
39
+ * Override props assigned to save component to inject aria-label, if block
40
+ * supports ariaLabel. This is only applied if the block's save result is an
41
+ * element and not a markup string.
42
+ *
43
+ * @param {Object} extraProps Additional props applied to save element.
44
+ * @param {Object} blockType Block type.
45
+ * @param {Object} attributes Current block attributes.
46
+ *
47
+ * @return {Object} Filtered props applied to save element.
48
+ */
49
+ export function addSaveProps( extraProps, blockType, attributes ) {
50
+ if ( hasBlockSupport( blockType, 'ariaLabel' ) ) {
51
+ extraProps[ 'aria-label' ] =
52
+ attributes.ariaLabel === '' ? null : attributes.ariaLabel;
53
+ }
54
+
55
+ return extraProps;
56
+ }
57
+
58
+ addFilter(
59
+ 'blocks.registerBlockType',
60
+ 'core/ariaLabel/attribute',
61
+ addAttribute
62
+ );
63
+ addFilter(
64
+ 'blocks.getSaveContent.extraProps',
65
+ 'core/ariaLabel/save-props',
66
+ addSaveProps
67
+ );
@@ -2,7 +2,6 @@
2
2
  * External dependencies
3
3
  */
4
4
  import classnames from 'classnames';
5
- import { isObject } from 'lodash';
6
5
 
7
6
  /**
8
7
  * WordPress dependencies
@@ -55,13 +54,21 @@ const hasLinkColorSupport = ( blockType ) => {
55
54
 
56
55
  const colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );
57
56
 
58
- return isObject( colorSupport ) && !! colorSupport.link;
57
+ return (
58
+ colorSupport !== null &&
59
+ typeof colorSupport === 'object' &&
60
+ !! colorSupport.link
61
+ );
59
62
  };
60
63
 
61
64
  const hasGradientSupport = ( blockType ) => {
62
65
  const colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );
63
66
 
64
- return isObject( colorSupport ) && !! colorSupport.gradients;
67
+ return (
68
+ colorSupport !== null &&
69
+ typeof colorSupport === 'object' &&
70
+ !! colorSupport.gradients
71
+ );
65
72
  };
66
73
 
67
74
  const hasBackgroundColorSupport = ( blockType ) => {
@@ -2,14 +2,13 @@
2
2
  * External dependencies
3
3
  */
4
4
  import classnames from 'classnames';
5
- import { colord, extend } from 'colord';
5
+ import { extend } from 'colord';
6
6
  import namesPlugin from 'colord/plugins/names';
7
7
 
8
8
  /**
9
9
  * WordPress dependencies
10
10
  */
11
11
  import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
12
- import { SVG } from '@wordpress/components';
13
12
  import { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';
14
13
  import { addFilter } from '@wordpress/hooks';
15
14
  import { useMemo, useContext, createPortal } from '@wordpress/element';
@@ -23,145 +22,34 @@ import {
23
22
  useSetting,
24
23
  } from '../components';
25
24
  import BlockList from '../components/block-list';
25
+ import {
26
+ __unstableDuotoneFilter as DuotoneFilter,
27
+ __unstableDuotoneStylesheet as DuotoneStylesheet,
28
+ __unstableDuotoneUnsetStylesheet as DuotoneUnsetStylesheet,
29
+ } from '../components/duotone';
26
30
 
27
31
  const EMPTY_ARRAY = [];
28
32
 
29
33
  extend( [ namesPlugin ] );
30
34
 
31
- /**
32
- * Convert a list of colors to an object of R, G, and B values.
33
- *
34
- * @param {string[]} colors Array of RBG color strings.
35
- *
36
- * @return {Object} R, G, and B values.
37
- */
38
- export function getValuesFromColors( colors = [] ) {
39
- const values = { r: [], g: [], b: [], a: [] };
40
-
41
- colors.forEach( ( color ) => {
42
- const rgbColor = colord( color ).toRgb();
43
- values.r.push( rgbColor.r / 255 );
44
- values.g.push( rgbColor.g / 255 );
45
- values.b.push( rgbColor.b / 255 );
46
- values.a.push( rgbColor.a );
47
- } );
48
-
49
- return values;
50
- }
51
-
52
- /**
53
- * Values for the SVG `feComponentTransfer`.
54
- *
55
- * @typedef Values {Object}
56
- * @property {number[]} r Red values.
57
- * @property {number[]} g Green values.
58
- * @property {number[]} b Blue values.
59
- * @property {number[]} a Alpha values.
60
- */
61
-
62
- /**
63
- * Stylesheet for rendering the duotone filter.
64
- *
65
- * @param {Object} props Duotone props.
66
- * @param {string} props.selector Selector to apply the filter to.
67
- * @param {string} props.id Unique id for this duotone filter.
68
- *
69
- * @return {WPElement} Duotone element.
70
- */
71
- function DuotoneStylesheet( { selector, id } ) {
72
- const css = `
73
- ${ selector } {
74
- filter: url( #${ id } );
75
- }
76
- `;
77
- return <style>{ css }</style>;
78
- }
79
-
80
- /**
81
- * SVG for rendering the duotone filter.
82
- *
83
- * @param {Object} props Duotone props.
84
- * @param {string} props.id Unique id for this duotone filter.
85
- * @param {Values} props.values R, G, B, and A values to filter with.
86
- *
87
- * @return {WPElement} Duotone element.
88
- */
89
- function DuotoneFilter( { id, values } ) {
90
- return (
91
- <SVG
92
- xmlnsXlink="http://www.w3.org/1999/xlink"
93
- viewBox="0 0 0 0"
94
- width="0"
95
- height="0"
96
- focusable="false"
97
- role="none"
98
- style={ {
99
- visibility: 'hidden',
100
- position: 'absolute',
101
- left: '-9999px',
102
- overflow: 'hidden',
103
- } }
104
- >
105
- <defs>
106
- <filter id={ id }>
107
- <feColorMatrix
108
- // Use sRGB instead of linearRGB so transparency looks correct.
109
- colorInterpolationFilters="sRGB"
110
- type="matrix"
111
- // Use perceptual brightness to convert to grayscale.
112
- values="
113
- .299 .587 .114 0 0
114
- .299 .587 .114 0 0
115
- .299 .587 .114 0 0
116
- .299 .587 .114 0 0
117
- "
118
- />
119
- <feComponentTransfer
120
- // Use sRGB instead of linearRGB to be consistent with how CSS gradients work.
121
- colorInterpolationFilters="sRGB"
122
- >
123
- <feFuncR
124
- type="table"
125
- tableValues={ values.r.join( ' ' ) }
126
- />
127
- <feFuncG
128
- type="table"
129
- tableValues={ values.g.join( ' ' ) }
130
- />
131
- <feFuncB
132
- type="table"
133
- tableValues={ values.b.join( ' ' ) }
134
- />
135
- <feFuncA
136
- type="table"
137
- tableValues={ values.a.join( ' ' ) }
138
- />
139
- </feComponentTransfer>
140
- <feComposite
141
- // Re-mask the image with the original transparency since the feColorMatrix above loses that information.
142
- in2="SourceGraphic"
143
- operator="in"
144
- />
145
- </filter>
146
- </defs>
147
- </SVG>
148
- );
149
- }
150
-
151
35
  /**
152
36
  * SVG and stylesheet needed for rendering the duotone filter.
153
37
  *
154
- * @param {Object} props Duotone props.
38
+ * @param {Object} props Duotone props.
155
39
  * @param {string} props.selector Selector to apply the filter to.
156
- * @param {string} props.id Unique id for this duotone filter.
157
- * @param {Values} props.values R, G, B, and A values to filter with.
40
+ * @param {string} props.id Unique id for this duotone filter.
41
+ * @param {string[]|"unset"} props.colors Array of RGB color strings ordered from dark to light.
158
42
  *
159
43
  * @return {WPElement} Duotone element.
160
44
  */
161
- function InlineDuotone( { selector, id, values } ) {
45
+ function InlineDuotone( { selector, id, colors } ) {
46
+ if ( colors === 'unset' ) {
47
+ return <DuotoneUnsetStylesheet selector={ selector } />;
48
+ }
49
+
162
50
  return (
163
51
  <>
164
- <DuotoneFilter id={ id } values={ values } />
52
+ <DuotoneFilter id={ id } colors={ colors } />
165
53
  <DuotoneStylesheet id={ id } selector={ selector } />
166
54
  </>
167
55
  );
@@ -324,9 +212,9 @@ const withDuotoneStyles = createHigherOrderComponent(
324
212
  props.name,
325
213
  'color.__experimentalDuotone'
326
214
  );
327
- const values = props?.attributes?.style?.color?.duotone;
215
+ const colors = props?.attributes?.style?.color?.duotone;
328
216
 
329
- if ( ! duotoneSupport || ! values ) {
217
+ if ( ! duotoneSupport || ! colors ) {
330
218
  return <BlockListBlock { ...props } />;
331
219
  }
332
220
 
@@ -351,7 +239,7 @@ const withDuotoneStyles = createHigherOrderComponent(
351
239
  <InlineDuotone
352
240
  selector={ selectorsGroup }
353
241
  id={ id }
354
- values={ getValuesFromColors( values ) }
242
+ colors={ colors }
355
243
  />,
356
244
  element
357
245
  ) }
@@ -362,15 +250,6 @@ const withDuotoneStyles = createHigherOrderComponent(
362
250
  'withDuotoneStyles'
363
251
  );
364
252
 
365
- export function PresetDuotoneFilter( { preset } ) {
366
- return (
367
- <DuotoneFilter
368
- id={ `wp-duotone-${ preset.slug }` }
369
- values={ getValuesFromColors( preset.colors ) }
370
- />
371
- );
372
- }
373
-
374
253
  addFilter(
375
254
  'blocks.registerBlockType',
376
255
  'core/editor/duotone/add-attributes',
@@ -5,6 +5,7 @@ import './compat';
5
5
  import './align';
6
6
  import './lock';
7
7
  import './anchor';
8
+ import './aria-label';
8
9
  import './custom-class-name';
9
10
  import './generated-class-name';
10
11
  import './style';
@@ -19,5 +20,5 @@ export { useCustomSides } from './dimensions';
19
20
  export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
20
21
  export { getColorClassesAndStyles, useColorProps } from './use-color-props';
21
22
  export { getSpacingClassesAndStyles } from './use-spacing-props';
23
+ export { getGapCSSValue } from './gap';
22
24
  export { useCachedTruthy } from './use-cached-truthy';
23
- export { PresetDuotoneFilter } from './duotone';