@wordpress/block-editor 7.0.4 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (347) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +31 -0
  3. package/build/components/alignment-control/ui.js +1 -2
  4. package/build/components/alignment-control/ui.js.map +1 -1
  5. package/build/components/block-icon/index.js +5 -1
  6. package/build/components/block-icon/index.js.map +1 -1
  7. package/build/components/block-inspector/index.js +4 -0
  8. package/build/components/block-inspector/index.js.map +1 -1
  9. package/build/components/block-list/index.native.js +1 -1
  10. package/build/components/block-list/index.native.js.map +1 -1
  11. package/build/components/block-list/use-block-props/use-multi-selection.js +21 -8
  12. package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  13. package/build/components/block-navigation/dropdown.js +0 -1
  14. package/build/components/block-navigation/dropdown.js.map +1 -1
  15. package/build/components/block-patterns-list/index.js +1 -8
  16. package/build/components/block-patterns-list/index.js.map +1 -1
  17. package/build/components/block-settings/container.native.js +5 -2
  18. package/build/components/block-settings/container.native.js.map +1 -1
  19. package/build/components/block-settings-menu/block-settings-dropdown.js +22 -2
  20. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  21. package/build/components/block-styles/preview.native.js +2 -2
  22. package/build/components/block-styles/preview.native.js.map +1 -1
  23. package/build/components/colors-gradients/control.js +8 -47
  24. package/build/components/colors-gradients/control.js.map +1 -1
  25. package/build/components/colors-gradients/panel-color-gradient-settings.js +81 -6
  26. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  27. package/build/components/duotone-control/index.js +5 -2
  28. package/build/components/duotone-control/index.js.map +1 -1
  29. package/build/components/font-appearance-control/index.js +27 -15
  30. package/build/components/font-appearance-control/index.js.map +1 -1
  31. package/build/components/iframe/index.js +1 -1
  32. package/build/components/iframe/index.js.map +1 -1
  33. package/build/components/index.js +20 -2
  34. package/build/components/index.js.map +1 -1
  35. package/build/components/index.native.js +2 -2
  36. package/build/components/index.native.js.map +1 -1
  37. package/build/components/inner-blocks/index.js +5 -4
  38. package/build/components/inner-blocks/index.js.map +1 -1
  39. package/build/components/inner-blocks/index.native.js +4 -3
  40. package/build/components/inner-blocks/index.native.js.map +1 -1
  41. package/build/components/inserter/block-patterns-explorer/explorer.js +62 -0
  42. package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
  43. package/build/components/inserter/block-patterns-explorer/patterns-list.js +111 -0
  44. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
  45. package/build/components/inserter/block-patterns-explorer/sidebar.js +78 -0
  46. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
  47. package/build/components/inserter/block-patterns-tab.js +74 -45
  48. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  49. package/build/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
  50. package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  51. package/build/components/inserter/pattern-panel.js +19 -10
  52. package/build/components/inserter/pattern-panel.js.map +1 -1
  53. package/build/components/inspector-controls/groups.js +3 -1
  54. package/build/components/inspector-controls/groups.js.map +1 -1
  55. package/build/components/letter-spacing-control/index.js +9 -6
  56. package/build/components/letter-spacing-control/index.js.map +1 -1
  57. package/build/components/link-control/index.js +88 -35
  58. package/build/components/link-control/index.js.map +1 -1
  59. package/build/components/link-control/link-preview.js +19 -6
  60. package/build/components/link-control/link-preview.js.map +1 -1
  61. package/build/components/link-control/search-input.js +12 -3
  62. package/build/components/link-control/search-input.js.map +1 -1
  63. package/build/components/list-view/block.js +49 -23
  64. package/build/components/list-view/block.js.map +1 -1
  65. package/build/components/list-view/branch.js +92 -73
  66. package/build/components/list-view/branch.js.map +1 -1
  67. package/build/components/list-view/index.js +39 -16
  68. package/build/components/list-view/index.js.map +1 -1
  69. package/build/components/list-view/leaf.js +1 -1
  70. package/build/components/list-view/leaf.js.map +1 -1
  71. package/build/components/list-view/use-list-view-client-ids.js +8 -58
  72. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  73. package/build/components/rich-text/embed-handler-picker.native.js +1 -0
  74. package/build/components/rich-text/embed-handler-picker.native.js.map +1 -1
  75. package/build/components/rich-text/format-edit.js +28 -2
  76. package/build/components/rich-text/format-edit.js.map +1 -1
  77. package/build/components/rich-text/format-toolbar/index.js +2 -1
  78. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  79. package/build/components/url-input/index.js +11 -4
  80. package/build/components/url-input/index.js.map +1 -1
  81. package/build/components/use-setting/index.js +48 -9
  82. package/build/components/use-setting/index.js.map +1 -1
  83. package/build/hooks/border.js +5 -5
  84. package/build/hooks/border.js.map +1 -1
  85. package/build/hooks/color-panel.js +2 -1
  86. package/build/hooks/color-panel.js.map +1 -1
  87. package/build/hooks/duotone.js +16 -5
  88. package/build/hooks/duotone.js.map +1 -1
  89. package/build/hooks/font-appearance.js +49 -6
  90. package/build/hooks/font-appearance.js.map +1 -1
  91. package/build/hooks/font-family.js +37 -16
  92. package/build/hooks/font-family.js.map +1 -1
  93. package/build/hooks/font-size.js +51 -9
  94. package/build/hooks/font-size.js.map +1 -1
  95. package/build/hooks/index.js +8 -0
  96. package/build/hooks/index.js.map +1 -1
  97. package/build/hooks/index.native.js +8 -0
  98. package/build/hooks/index.native.js.map +1 -1
  99. package/build/hooks/letter-spacing.js +44 -7
  100. package/build/hooks/letter-spacing.js.map +1 -1
  101. package/build/hooks/line-height.js +45 -8
  102. package/build/hooks/line-height.js.map +1 -1
  103. package/build/hooks/margin.js +1 -1
  104. package/build/hooks/margin.js.map +1 -1
  105. package/build/hooks/padding.js +1 -1
  106. package/build/hooks/padding.js.map +1 -1
  107. package/build/hooks/text-decoration.js +42 -6
  108. package/build/hooks/text-decoration.js.map +1 -1
  109. package/build/hooks/text-transform.js +42 -6
  110. package/build/hooks/text-transform.js.map +1 -1
  111. package/build/hooks/typography.js +108 -8
  112. package/build/hooks/typography.js.map +1 -1
  113. package/build/hooks/use-cached-truthy.js +29 -0
  114. package/build/hooks/use-cached-truthy.js.map +1 -0
  115. package/build/index.js +7 -0
  116. package/build/index.js.map +1 -1
  117. package/build/layouts/flex.js +120 -28
  118. package/build/layouts/flex.js.map +1 -1
  119. package/build/store/actions.js +303 -265
  120. package/build/store/actions.js.map +1 -1
  121. package/build/store/index.js +1 -3
  122. package/build/store/index.js.map +1 -1
  123. package/build/store/reducer.js +23 -22
  124. package/build/store/reducer.js.map +1 -1
  125. package/build/store/selectors.js +44 -35
  126. package/build/store/selectors.js.map +1 -1
  127. package/build-module/components/alignment-control/ui.js +1 -2
  128. package/build-module/components/alignment-control/ui.js.map +1 -1
  129. package/build-module/components/block-icon/index.js +5 -1
  130. package/build-module/components/block-icon/index.js.map +1 -1
  131. package/build-module/components/block-inspector/index.js +4 -0
  132. package/build-module/components/block-inspector/index.js.map +1 -1
  133. package/build-module/components/block-list/index.native.js +1 -1
  134. package/build-module/components/block-list/index.native.js.map +1 -1
  135. package/build-module/components/block-list/use-block-props/use-multi-selection.js +21 -8
  136. package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  137. package/build-module/components/block-navigation/dropdown.js +0 -1
  138. package/build-module/components/block-navigation/dropdown.js.map +1 -1
  139. package/build-module/components/block-patterns-list/index.js +1 -6
  140. package/build-module/components/block-patterns-list/index.js.map +1 -1
  141. package/build-module/components/block-settings/container.native.js +6 -3
  142. package/build-module/components/block-settings/container.native.js.map +1 -1
  143. package/build-module/components/block-settings-menu/block-settings-dropdown.js +24 -4
  144. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  145. package/build-module/components/block-styles/preview.native.js +2 -2
  146. package/build-module/components/block-styles/preview.native.js.map +1 -1
  147. package/build-module/components/colors-gradients/control.js +12 -53
  148. package/build-module/components/colors-gradients/control.js.map +1 -1
  149. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +82 -6
  150. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  151. package/build-module/components/duotone-control/index.js +5 -2
  152. package/build-module/components/duotone-control/index.js.map +1 -1
  153. package/build-module/components/font-appearance-control/index.js +23 -15
  154. package/build-module/components/font-appearance-control/index.js.map +1 -1
  155. package/build-module/components/iframe/index.js +1 -1
  156. package/build-module/components/iframe/index.js.map +1 -1
  157. package/build-module/components/index.js +3 -1
  158. package/build-module/components/index.js.map +1 -1
  159. package/build-module/components/index.native.js +1 -1
  160. package/build-module/components/index.native.js.map +1 -1
  161. package/build-module/components/inner-blocks/index.js +6 -5
  162. package/build-module/components/inner-blocks/index.js.map +1 -1
  163. package/build-module/components/inner-blocks/index.native.js +5 -4
  164. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  165. package/build-module/components/inserter/block-patterns-explorer/explorer.js +50 -0
  166. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
  167. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +92 -0
  168. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
  169. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +69 -0
  170. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
  171. package/build-module/components/inserter/block-patterns-tab.js +75 -46
  172. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  173. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
  174. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  175. package/build-module/components/inserter/pattern-panel.js +21 -13
  176. package/build-module/components/inserter/pattern-panel.js.map +1 -1
  177. package/build-module/components/inspector-controls/groups.js +3 -1
  178. package/build-module/components/inspector-controls/groups.js.map +1 -1
  179. package/build-module/components/letter-spacing-control/index.js +9 -6
  180. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  181. package/build-module/components/link-control/index.js +88 -36
  182. package/build-module/components/link-control/index.js.map +1 -1
  183. package/build-module/components/link-control/link-preview.js +19 -7
  184. package/build-module/components/link-control/link-preview.js.map +1 -1
  185. package/build-module/components/link-control/search-input.js +11 -3
  186. package/build-module/components/link-control/search-input.js.map +1 -1
  187. package/build-module/components/list-view/block.js +49 -24
  188. package/build-module/components/list-view/block.js.map +1 -1
  189. package/build-module/components/list-view/branch.js +92 -73
  190. package/build-module/components/list-view/branch.js.map +1 -1
  191. package/build-module/components/list-view/index.js +41 -18
  192. package/build-module/components/list-view/index.js.map +1 -1
  193. package/build-module/components/list-view/leaf.js +1 -1
  194. package/build-module/components/list-view/leaf.js.map +1 -1
  195. package/build-module/components/list-view/use-list-view-client-ids.js +8 -58
  196. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  197. package/build-module/components/rich-text/embed-handler-picker.native.js +1 -0
  198. package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -1
  199. package/build-module/components/rich-text/format-edit.js +28 -3
  200. package/build-module/components/rich-text/format-edit.js.map +1 -1
  201. package/build-module/components/rich-text/format-toolbar/index.js +2 -1
  202. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  203. package/build-module/components/url-input/index.js +11 -4
  204. package/build-module/components/url-input/index.js.map +1 -1
  205. package/build-module/components/use-setting/index.js +48 -9
  206. package/build-module/components/use-setting/index.js.map +1 -1
  207. package/build-module/hooks/border.js +5 -5
  208. package/build-module/hooks/border.js.map +1 -1
  209. package/build-module/hooks/color-panel.js +2 -1
  210. package/build-module/hooks/color-panel.js.map +1 -1
  211. package/build-module/hooks/duotone.js +16 -5
  212. package/build-module/hooks/duotone.js.map +1 -1
  213. package/build-module/hooks/font-appearance.js +45 -6
  214. package/build-module/hooks/font-appearance.js.map +1 -1
  215. package/build-module/hooks/font-family.js +33 -16
  216. package/build-module/hooks/font-family.js.map +1 -1
  217. package/build-module/hooks/font-size.js +47 -9
  218. package/build-module/hooks/font-size.js.map +1 -1
  219. package/build-module/hooks/index.js +1 -0
  220. package/build-module/hooks/index.js.map +1 -1
  221. package/build-module/hooks/index.native.js +1 -0
  222. package/build-module/hooks/index.native.js.map +1 -1
  223. package/build-module/hooks/letter-spacing.js +40 -7
  224. package/build-module/hooks/letter-spacing.js.map +1 -1
  225. package/build-module/hooks/line-height.js +41 -8
  226. package/build-module/hooks/line-height.js.map +1 -1
  227. package/build-module/hooks/margin.js +1 -1
  228. package/build-module/hooks/margin.js.map +1 -1
  229. package/build-module/hooks/padding.js +1 -1
  230. package/build-module/hooks/padding.js.map +1 -1
  231. package/build-module/hooks/text-decoration.js +38 -6
  232. package/build-module/hooks/text-decoration.js.map +1 -1
  233. package/build-module/hooks/text-transform.js +38 -6
  234. package/build-module/hooks/text-transform.js.map +1 -1
  235. package/build-module/hooks/typography.js +117 -17
  236. package/build-module/hooks/typography.js.map +1 -1
  237. package/build-module/hooks/use-cached-truthy.js +21 -0
  238. package/build-module/hooks/use-cached-truthy.js.map +1 -0
  239. package/build-module/index.js +1 -1
  240. package/build-module/index.js.map +1 -1
  241. package/build-module/layouts/flex.js +124 -32
  242. package/build-module/layouts/flex.js.map +1 -1
  243. package/build-module/store/actions.js +266 -241
  244. package/build-module/store/actions.js.map +1 -1
  245. package/build-module/store/index.js +1 -2
  246. package/build-module/store/index.js.map +1 -1
  247. package/build-module/store/reducer.js +23 -22
  248. package/build-module/store/reducer.js.map +1 -1
  249. package/build-module/store/selectors.js +42 -30
  250. package/build-module/store/selectors.js.map +1 -1
  251. package/build-style/style-rtl.css +160 -57
  252. package/build-style/style.css +160 -57
  253. package/package.json +13 -14
  254. package/src/components/alignment-control/test/__snapshots__/index.js.snap +0 -2
  255. package/src/components/alignment-control/ui.js +1 -4
  256. package/src/components/block-draggable/style.scss +19 -4
  257. package/src/components/block-icon/index.js +4 -1
  258. package/src/components/block-inspector/index.js +5 -0
  259. package/src/components/block-list/index.native.js +1 -1
  260. package/src/components/block-list/use-block-props/use-multi-selection.js +27 -7
  261. package/src/components/block-navigation/dropdown.js +0 -1
  262. package/src/components/block-patterns-list/index.js +1 -8
  263. package/src/components/block-patterns-list/style.scss +22 -12
  264. package/src/components/block-settings/container.native.js +7 -0
  265. package/src/components/block-settings-menu/block-settings-dropdown.js +19 -7
  266. package/src/components/block-styles/preview.native.js +2 -2
  267. package/src/components/block-switcher/test/__snapshots__/index.js.snap +1 -1
  268. package/src/components/color-palette/test/__snapshots__/control.js.snap +88 -63
  269. package/src/components/colors-gradients/control.js +19 -62
  270. package/src/components/colors-gradients/panel-color-gradient-settings.js +76 -6
  271. package/src/components/colors-gradients/style.scss +3 -14
  272. package/src/components/colors-gradients/test/control.js +0 -16
  273. package/src/components/duotone-control/index.js +6 -0
  274. package/src/components/duotone-control/style.scss +27 -12
  275. package/src/components/font-appearance-control/index.js +22 -14
  276. package/src/components/iframe/index.js +1 -1
  277. package/src/components/index.js +3 -4
  278. package/src/components/index.native.js +1 -4
  279. package/src/components/inner-blocks/index.js +4 -4
  280. package/src/components/inner-blocks/index.native.js +7 -4
  281. package/src/components/inserter/block-patterns-explorer/explorer.js +50 -0
  282. package/src/components/inserter/block-patterns-explorer/patterns-list.js +122 -0
  283. package/src/components/inserter/block-patterns-explorer/sidebar.js +73 -0
  284. package/src/components/inserter/block-patterns-tab.js +107 -80
  285. package/src/components/inserter/hooks/use-block-type-impressions.native.js +14 -21
  286. package/src/components/inserter/pattern-panel.js +33 -16
  287. package/src/components/inserter/style.scss +64 -1
  288. package/src/components/inserter/test/block-types-tab.native.js +1 -1
  289. package/src/components/inserter/test/fixtures/index.native.js +12 -0
  290. package/src/components/inspector-controls/groups.js +4 -0
  291. package/src/components/letter-spacing-control/index.js +12 -6
  292. package/src/components/link-control/README.md +7 -0
  293. package/src/components/link-control/index.js +99 -34
  294. package/src/components/link-control/link-preview.js +21 -9
  295. package/src/components/link-control/search-input.js +9 -3
  296. package/src/components/link-control/style.scss +32 -16
  297. package/src/components/link-control/test/index.js +179 -4
  298. package/src/components/list-view/block.js +67 -23
  299. package/src/components/list-view/branch.js +113 -91
  300. package/src/components/list-view/index.js +58 -19
  301. package/src/components/list-view/leaf.js +1 -1
  302. package/src/components/list-view/style.scss +14 -3
  303. package/src/components/list-view/use-list-view-client-ids.js +7 -66
  304. package/src/components/rich-text/embed-handler-picker.native.js +1 -0
  305. package/src/components/rich-text/format-edit.js +36 -2
  306. package/src/components/rich-text/format-toolbar/index.js +3 -0
  307. package/src/components/url-input/index.js +14 -4
  308. package/src/components/use-setting/index.js +49 -11
  309. package/src/hooks/border.js +8 -11
  310. package/src/hooks/color-panel.js +1 -0
  311. package/src/hooks/duotone.js +21 -7
  312. package/src/hooks/font-appearance.js +38 -7
  313. package/src/hooks/font-family.js +29 -13
  314. package/src/hooks/font-size.js +42 -6
  315. package/src/hooks/index.js +1 -0
  316. package/src/hooks/index.native.js +1 -0
  317. package/src/hooks/layout.scss +3 -1
  318. package/src/hooks/letter-spacing.js +35 -7
  319. package/src/hooks/line-height.js +37 -9
  320. package/src/hooks/margin.js +1 -1
  321. package/src/hooks/padding.js +1 -1
  322. package/src/hooks/text-decoration.js +34 -6
  323. package/src/hooks/text-transform.js +34 -6
  324. package/src/hooks/typography.js +165 -15
  325. package/src/hooks/typography.scss +16 -0
  326. package/src/hooks/use-cached-truthy.js +20 -0
  327. package/src/index.js +1 -0
  328. package/src/layouts/flex.js +137 -41
  329. package/src/store/actions.js +223 -391
  330. package/src/store/index.js +1 -2
  331. package/src/store/reducer.js +36 -18
  332. package/src/store/selectors.js +52 -47
  333. package/src/store/test/actions.js +395 -694
  334. package/src/store/test/selectors.js +79 -21
  335. package/src/style.scss +1 -1
  336. package/src/utils/test/parse-css-unit-to-px.js +127 -167
  337. package/build/components/text-decoration-and-transform/index.js +0 -39
  338. package/build/components/text-decoration-and-transform/index.js.map +0 -1
  339. package/build/store/controls.js +0 -44
  340. package/build/store/controls.js.map +0 -1
  341. package/build-module/components/text-decoration-and-transform/index.js +0 -30
  342. package/build-module/components/text-decoration-and-transform/index.js.map +0 -1
  343. package/build-module/store/controls.js +0 -32
  344. package/build-module/store/controls.js.map +0 -1
  345. package/src/components/text-decoration-and-transform/index.js +0 -36
  346. package/src/components/text-decoration-and-transform/style.scss +0 -3
  347. package/src/store/controls.js +0 -39
@@ -34,8 +34,7 @@ const deprecatedFlags = {
34
34
  settings.disableCustomFontSizes === undefined
35
35
  ? undefined
36
36
  : ! settings.disableCustomFontSizes,
37
- 'typography.customLineHeight': ( settings ) =>
38
- settings.enableCustomLineHeight,
37
+ 'typography.lineHeight': ( settings ) => settings.enableCustomLineHeight,
39
38
  'spacing.units': ( settings ) => {
40
39
  if ( settings.enableCustomUnits === undefined ) {
41
40
  return;
@@ -47,7 +46,46 @@ const deprecatedFlags = {
47
46
 
48
47
  return settings.enableCustomUnits;
49
48
  },
50
- 'spacing.customPadding': ( settings ) => settings.enableCustomSpacing,
49
+ 'spacing.padding': ( settings ) => settings.enableCustomSpacing,
50
+ };
51
+
52
+ const prefixedFlags = {
53
+ /*
54
+ * These were only available in the plugin
55
+ * and can be removed when the minimum WordPress version
56
+ * for the plugin is 5.9.
57
+ */
58
+ 'border.customColor': 'border.color',
59
+ 'border.customStyle': 'border.style',
60
+ 'border.customWidth': 'border.width',
61
+ 'typography.customFontStyle': 'typography.fontStyle',
62
+ 'typography.customFontWeight': 'typography.fontWeight',
63
+ 'typography.customLetterSpacing': 'typography.letterSpacing',
64
+ 'typography.customTextDecorations': 'typography.textDecoration',
65
+ 'typography.customTextTransforms': 'typography.textTransform',
66
+ /*
67
+ * These were part of WordPress 5.8 and we need to keep them.
68
+ */
69
+ 'border.customRadius': 'border.radius',
70
+ 'spacing.customMargin': 'spacing.margin',
71
+ 'spacing.customPadding': 'spacing.padding',
72
+ 'typography.customLineHeight': 'typography.lineHeight',
73
+ };
74
+
75
+ /**
76
+ * Remove `custom` prefixes for flags that did not land in 5.8.
77
+ *
78
+ * This provides continued support for `custom` prefixed properties. It will
79
+ * be removed once third party devs have had sufficient time to update themes,
80
+ * plugins, etc.
81
+ *
82
+ * @see https://github.com/WordPress/gutenberg/pull/34485
83
+ *
84
+ * @param {string} path Path to desired value in settings.
85
+ * @return {string} The value for defined setting.
86
+ */
87
+ const removeCustomPrefixes = ( path ) => {
88
+ return prefixedFlags[ path ] || path;
51
89
  };
52
90
 
53
91
  /**
@@ -55,9 +93,7 @@ const deprecatedFlags = {
55
93
  * It works with nested objects using by finding the value at path.
56
94
  *
57
95
  * @param {string} path The path to the setting.
58
- *
59
96
  * @return {any} Returns the value defined for the setting.
60
- *
61
97
  * @example
62
98
  * ```js
63
99
  * const isEnabled = useSetting( 'typography.dropCap' );
@@ -72,12 +108,14 @@ export default function useSetting( path ) {
72
108
 
73
109
  // 1 - Use __experimental features, if available.
74
110
  // We cascade to the all value if the block one is not available.
75
- const defaultsPath = `__experimentalFeatures.${ path }`;
76
- const blockPath = `__experimentalFeatures.blocks.${ blockName }.${ path }`;
111
+ const normalizedPath = removeCustomPrefixes( path );
112
+ const defaultsPath = `__experimentalFeatures.${ normalizedPath }`;
113
+ const blockPath = `__experimentalFeatures.blocks.${ blockName }.${ normalizedPath }`;
77
114
  const experimentalFeaturesResult =
78
115
  get( settings, blockPath ) ?? get( settings, defaultsPath );
116
+
79
117
  if ( experimentalFeaturesResult !== undefined ) {
80
- if ( PATHS_WITH_MERGE[ path ] ) {
118
+ if ( PATHS_WITH_MERGE[ normalizedPath ] ) {
81
119
  return (
82
120
  experimentalFeaturesResult.user ??
83
121
  experimentalFeaturesResult.theme ??
@@ -88,8 +126,8 @@ export default function useSetting( path ) {
88
126
  }
89
127
 
90
128
  // 2 - Use deprecated settings, otherwise.
91
- const deprecatedSettingsValue = deprecatedFlags[ path ]
92
- ? deprecatedFlags[ path ]( settings )
129
+ const deprecatedSettingsValue = deprecatedFlags[ normalizedPath ]
130
+ ? deprecatedFlags[ normalizedPath ]( settings )
93
131
  : undefined;
94
132
  if ( deprecatedSettingsValue !== undefined ) {
95
133
  return deprecatedSettingsValue;
@@ -99,7 +137,7 @@ export default function useSetting( path ) {
99
137
  // This is only necessary to support typography.dropCap.
100
138
  // when __experimentalFeatures are not present (core without plugin).
101
139
  // To remove when __experimentalFeatures are ported to core.
102
- return path === 'typography.dropCap' ? true : undefined;
140
+ return normalizedPath === 'typography.dropCap' ? true : undefined;
103
141
  },
104
142
  [ blockName, path ]
105
143
  );
@@ -23,20 +23,17 @@ export function BorderPanel( props ) {
23
23
  const isSupported = hasBorderSupport( props.name );
24
24
 
25
25
  const isColorSupported =
26
- useSetting( 'border.customColor' ) &&
27
- hasBorderSupport( props.name, 'color' );
26
+ useSetting( 'border.color' ) && hasBorderSupport( props.name, 'color' );
28
27
 
29
28
  const isRadiusSupported =
30
- useSetting( 'border.customRadius' ) &&
29
+ useSetting( 'border.radius' ) &&
31
30
  hasBorderSupport( props.name, 'radius' );
32
31
 
33
32
  const isStyleSupported =
34
- useSetting( 'border.customStyle' ) &&
35
- hasBorderSupport( props.name, 'style' );
33
+ useSetting( 'border.style' ) && hasBorderSupport( props.name, 'style' );
36
34
 
37
35
  const isWidthSupported =
38
- useSetting( 'border.customWidth' ) &&
39
- hasBorderSupport( props.name, 'width' );
36
+ useSetting( 'border.width' ) && hasBorderSupport( props.name, 'width' );
40
37
 
41
38
  if ( isDisabled || ! isSupported ) {
42
39
  return null;
@@ -113,10 +110,10 @@ export function shouldSkipSerialization( blockType ) {
113
110
  */
114
111
  const useIsBorderDisabled = () => {
115
112
  const configs = [
116
- ! useSetting( 'border.customColor' ),
117
- ! useSetting( 'border.customRadius' ),
118
- ! useSetting( 'border.customStyle' ),
119
- ! useSetting( 'border.customWidth' ),
113
+ ! useSetting( 'border.color' ),
114
+ ! useSetting( 'border.radius' ),
115
+ ! useSetting( 'border.style' ),
116
+ ! useSetting( 'border.width' ),
120
117
  ];
121
118
 
122
119
  return configs.every( Boolean );
@@ -60,6 +60,7 @@ export default function ColorPanel( {
60
60
  initialOpen={ false }
61
61
  settings={ settings }
62
62
  showTitle={ showTitle }
63
+ __experimentalHasMultipleOrigins
63
64
  >
64
65
  { enableContrastChecking && (
65
66
  <ContrastChecker
@@ -36,13 +36,14 @@ extend( [ namesPlugin ] );
36
36
  * @return {Object} R, G, and B values.
37
37
  */
38
38
  export function getValuesFromColors( colors = [] ) {
39
- const values = { r: [], g: [], b: [] };
39
+ const values = { r: [], g: [], b: [], a: [] };
40
40
 
41
41
  colors.forEach( ( color ) => {
42
42
  const rgbColor = colord( color ).toRgb();
43
43
  values.r.push( rgbColor.r / 255 );
44
44
  values.g.push( rgbColor.g / 255 );
45
45
  values.b.push( rgbColor.b / 255 );
46
+ values.a.push( rgbColor.a );
46
47
  } );
47
48
 
48
49
  return values;
@@ -55,6 +56,7 @@ export function getValuesFromColors( colors = [] ) {
55
56
  * @property {number[]} r Red values.
56
57
  * @property {number[]} g Green values.
57
58
  * @property {number[]} b Blue values.
59
+ * @property {number[]} a Alpha values.
58
60
  */
59
61
 
60
62
  /**
@@ -63,7 +65,7 @@ export function getValuesFromColors( colors = [] ) {
63
65
  * @param {Object} props Duotone props.
64
66
  * @param {string} props.selector Selector to apply the filter to.
65
67
  * @param {string} props.id Unique id for this duotone filter.
66
- * @param {Values} props.values R, G, and B values to filter with.
68
+ * @param {Values} props.values R, G, B, and A values to filter with.
67
69
  *
68
70
  * @return {WPElement} Duotone element.
69
71
  */
@@ -93,13 +95,16 @@ ${ selector } {
93
95
  <defs>
94
96
  <filter id={ id }>
95
97
  <feColorMatrix
98
+ // Use sRGB instead of linearRGB so transparency looks correct.
99
+ colorInterpolationFilters="sRGB"
96
100
  type="matrix"
97
101
  // Use perceptual brightness to convert to grayscale.
98
- // prettier-ignore
99
- values=".299 .587 .114 0 0
100
- .299 .587 .114 0 0
101
- .299 .587 .114 0 0
102
- 0 0 0 1 0"
102
+ values="
103
+ .299 .587 .114 0 0
104
+ .299 .587 .114 0 0
105
+ .299 .587 .114 0 0
106
+ .299 .587 .114 0 0
107
+ "
103
108
  />
104
109
  <feComponentTransfer
105
110
  // Use sRGB instead of linearRGB to be consistent with how CSS gradients work.
@@ -117,7 +122,16 @@ ${ selector } {
117
122
  type="table"
118
123
  tableValues={ values.b.join( ' ' ) }
119
124
  />
125
+ <feFuncA
126
+ type="table"
127
+ tableValues={ values.a.join( ' ' ) }
128
+ />
120
129
  </feComponentTransfer>
130
+ <feComposite
131
+ // Re-mask the image with the original transparency since the feColorMatrix above loses that information.
132
+ in2="SourceGraphic"
133
+ operator="in"
134
+ />
121
135
  </filter>
122
136
  </defs>
123
137
  </SVG>
@@ -36,10 +36,6 @@ export function FontAppearanceEdit( props ) {
36
36
  const hasFontStyles = ! useIsFontStyleDisabled( props );
37
37
  const hasFontWeights = ! useIsFontWeightDisabled( props );
38
38
 
39
- if ( ! hasFontStyles && ! hasFontWeights ) {
40
- return null;
41
- }
42
-
43
39
  const onChange = ( newStyles ) => {
44
40
  setAttributes( {
45
41
  style: cleanEmptyObject( {
@@ -54,7 +50,6 @@ export function FontAppearanceEdit( props ) {
54
50
  };
55
51
 
56
52
  const fontStyle = style?.typography?.fontStyle;
57
-
58
53
  const fontWeight = style?.typography?.fontWeight;
59
54
 
60
55
  return (
@@ -78,7 +73,7 @@ export function FontAppearanceEdit( props ) {
78
73
  */
79
74
  export function useIsFontStyleDisabled( { name: blockName } = {} ) {
80
75
  const styleSupport = hasBlockSupport( blockName, FONT_STYLE_SUPPORT_KEY );
81
- const hasFontStyles = useSetting( 'typography.customFontStyle' );
76
+ const hasFontStyles = useSetting( 'typography.fontStyle' );
82
77
 
83
78
  return ! styleSupport || ! hasFontStyles;
84
79
  }
@@ -94,7 +89,7 @@ export function useIsFontStyleDisabled( { name: blockName } = {} ) {
94
89
  */
95
90
  export function useIsFontWeightDisabled( { name: blockName } = {} ) {
96
91
  const weightSupport = hasBlockSupport( blockName, FONT_WEIGHT_SUPPORT_KEY );
97
- const hasFontWeights = useSetting( 'typography.customFontWeight' );
92
+ const hasFontWeights = useSetting( 'typography.fontWeight' );
98
93
 
99
94
  return ! weightSupport || ! hasFontWeights;
100
95
  }
@@ -112,3 +107,39 @@ export function useIsFontAppearanceDisabled( props ) {
112
107
 
113
108
  return stylesDisabled && weightsDisabled;
114
109
  }
110
+
111
+ /**
112
+ * Checks if there is either a font style or weight value set within the
113
+ * typography styles.
114
+ *
115
+ * @param {Object} props Block props.
116
+ * @return {boolean} Whether or not the block has a font style or weight.
117
+ */
118
+ export function hasFontAppearanceValue( props ) {
119
+ const { fontStyle, fontWeight } = props.attributes.style?.typography || {};
120
+ return !! fontStyle || !! fontWeight;
121
+ }
122
+
123
+ /**
124
+ * Resets the font style and weight block support attributes. This can be used
125
+ * when disabling the font appearance support controls for a block via a
126
+ * progressive discovery panel.
127
+ *
128
+ * @param {Object} props Block props.
129
+ * @param {Object} props.attributes Block's attributes.
130
+ * @param {Object} props.setAttributes Function to set block's attributes.
131
+ */
132
+ export function resetFontAppearance( { attributes = {}, setAttributes } ) {
133
+ const { style } = attributes;
134
+
135
+ setAttributes( {
136
+ style: cleanEmptyObject( {
137
+ ...style,
138
+ typography: {
139
+ ...style?.typography,
140
+ fontStyle: undefined,
141
+ fontWeight: undefined,
142
+ },
143
+ } ),
144
+ } );
145
+ }
@@ -22,8 +22,8 @@ export const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';
22
22
  * Filters registered block settings, extending attributes to include
23
23
  * the `fontFamily` attribute.
24
24
  *
25
- * @param {Object} settings Original block settings
26
- * @return {Object} Filtered block settings
25
+ * @param {Object} settings Original block settings
26
+ * @return {Object} Filtered block settings
27
27
  */
28
28
  function addAttributes( settings ) {
29
29
  if ( ! hasBlockSupport( settings, FONT_FAMILY_SUPPORT_KEY ) ) {
@@ -45,10 +45,10 @@ function addAttributes( settings ) {
45
45
  /**
46
46
  * Override props assigned to save component to inject font family.
47
47
  *
48
- * @param {Object} props Additional props applied to save element
49
- * @param {Object} blockType Block type
50
- * @param {Object} attributes Block attributes
51
- * @return {Object} Filtered props applied to save element
48
+ * @param {Object} props Additional props applied to save element
49
+ * @param {Object} blockType Block type
50
+ * @param {Object} attributes Block attributes
51
+ * @return {Object} Filtered props applied to save element
52
52
  */
53
53
  function addSaveProps( props, blockType, attributes ) {
54
54
  if ( ! hasBlockSupport( blockType, FONT_FAMILY_SUPPORT_KEY ) ) {
@@ -58,7 +58,7 @@ function addSaveProps( props, blockType, attributes ) {
58
58
  if (
59
59
  hasBlockSupport(
60
60
  blockType,
61
- '__experimentalSkipTypographySerialization'
61
+ 'typography.__experimentalSkipSerialization'
62
62
  )
63
63
  ) {
64
64
  return props;
@@ -103,16 +103,10 @@ function addEditProps( settings ) {
103
103
  }
104
104
 
105
105
  export function FontFamilyEdit( {
106
- name,
107
106
  setAttributes,
108
107
  attributes: { fontFamily },
109
108
  } ) {
110
109
  const fontFamilies = useSetting( 'typography.fontFamilies' );
111
- const isDisable = useIsFontFamilyDisabled( { name } );
112
-
113
- if ( isDisable ) {
114
- return null;
115
- }
116
110
 
117
111
  const value = find( fontFamilies, ( { slug } ) => fontFamily === slug )
118
112
  ?.fontFamily;
@@ -152,6 +146,28 @@ export function useIsFontFamilyDisabled( { name } ) {
152
146
  );
153
147
  }
154
148
 
149
+ /**
150
+ * Checks if there is a current value set for the font family block support.
151
+ *
152
+ * @param {Object} props Block props.
153
+ * @return {boolean} Whether or not the block has a font family value set.
154
+ */
155
+ export function hasFontFamilyValue( props ) {
156
+ return !! props.attributes.fontFamily;
157
+ }
158
+
159
+ /**
160
+ * Resets the font family block support attribute. This can be used when
161
+ * disabling the font family support controls for a block via a progressive
162
+ * discovery panel.
163
+ *
164
+ * @param {Object} props Block props.
165
+ * @param {Object} props.setAttributes Function to set block's attributes.
166
+ */
167
+ export function resetFontFamily( { setAttributes } ) {
168
+ setAttributes( { fontFamily: undefined } );
169
+ }
170
+
155
171
  addFilter(
156
172
  'blocks.registerBlockType',
157
173
  'core/fontFamily/addAttribute',
@@ -114,7 +114,6 @@ export function FontSizeEdit( props ) {
114
114
  attributes: { fontSize, style },
115
115
  setAttributes,
116
116
  } = props;
117
- const isDisabled = useIsFontSizeDisabled( props );
118
117
  const fontSizes = useSetting( 'typography.fontSizes' );
119
118
 
120
119
  const onChange = ( value ) => {
@@ -132,10 +131,6 @@ export function FontSizeEdit( props ) {
132
131
  } );
133
132
  };
134
133
 
135
- if ( isDisabled ) {
136
- return null;
137
- }
138
-
139
134
  const fontSizeObject = getFontSize(
140
135
  fontSizes,
141
136
  fontSize,
@@ -145,7 +140,48 @@ export function FontSizeEdit( props ) {
145
140
  const fontSizeValue =
146
141
  fontSizeObject?.size || style?.typography?.fontSize || fontSize;
147
142
 
148
- return <FontSizePicker onChange={ onChange } value={ fontSizeValue } />;
143
+ return (
144
+ <FontSizePicker
145
+ onChange={ onChange }
146
+ value={ fontSizeValue }
147
+ withReset={ false }
148
+ />
149
+ );
150
+ }
151
+
152
+ /**
153
+ * Checks if there is a current value set for the font size block support.
154
+ *
155
+ * @param {Object} props Block props.
156
+ * @return {boolean} Whether or not the block has a font size value set.
157
+ */
158
+ export function hasFontSizeValue( props ) {
159
+ const { fontSize, style } = props.attributes;
160
+ return !! fontSize || !! style?.typography?.fontSize;
161
+ }
162
+
163
+ /**
164
+ * Resets the font size block support attribute. This can be used when
165
+ * disabling the font size support controls for a block via a progressive
166
+ * discovery panel.
167
+ *
168
+ * @param {Object} props Block props.
169
+ * @param {Object} props.attributes Block's attributes.
170
+ * @param {Object} props.setAttributes Function to set block's attributes.
171
+ */
172
+ export function resetFontSize( { attributes = {}, setAttributes } ) {
173
+ const { style } = attributes;
174
+
175
+ setAttributes( {
176
+ fontSize: undefined,
177
+ style: cleanEmptyObject( {
178
+ ...style,
179
+ typography: {
180
+ ...style?.typography,
181
+ fontSize: undefined,
182
+ },
183
+ } ),
184
+ } );
149
185
  }
150
186
 
151
187
  /**
@@ -18,3 +18,4 @@ export { useCustomSides } from './dimensions';
18
18
  export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
19
19
  export { getColorClassesAndStyles, useColorProps } from './use-color-props';
20
20
  export { getSpacingClassesAndStyles } from './use-spacing-props';
21
+ export { useCachedTruthy } from './use-cached-truthy';
@@ -13,3 +13,4 @@ import './font-size';
13
13
  export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
14
14
  export { getColorClassesAndStyles, useColorProps } from './use-color-props';
15
15
  export { getSpacingClassesAndStyles } from './use-spacing-props';
16
+ export { useCachedTruthy } from './use-cached-truthy';
@@ -22,7 +22,9 @@
22
22
  font-size: $helptext-font-size;
23
23
  }
24
24
 
25
- .block-editor-hooks__flex-layout-justification-controls {
25
+ .block-editor-hooks__flex-layout-justification-controls,
26
+ .block-editor-hooks__flex-layout-orientation-controls {
27
+ margin-bottom: $grid-unit-15;
26
28
  legend {
27
29
  margin-bottom: $grid-unit-10;
28
30
  }
@@ -29,12 +29,6 @@ export function LetterSpacingEdit( props ) {
29
29
  setAttributes,
30
30
  } = props;
31
31
 
32
- const isDisabled = useIsLetterSpacingDisabled( props );
33
-
34
- if ( isDisabled ) {
35
- return null;
36
- }
37
-
38
32
  function onChange( newSpacing ) {
39
33
  setAttributes( {
40
34
  style: cleanEmptyObject( {
@@ -51,6 +45,7 @@ export function LetterSpacingEdit( props ) {
51
45
  <LetterSpacingControl
52
46
  value={ style?.typography?.letterSpacing }
53
47
  onChange={ onChange }
48
+ __unstableInputWidth={ false }
54
49
  />
55
50
  );
56
51
  }
@@ -66,7 +61,40 @@ export function useIsLetterSpacingDisabled( { name: blockName } = {} ) {
66
61
  blockName,
67
62
  LETTER_SPACING_SUPPORT_KEY
68
63
  );
69
- const hasLetterSpacing = useSetting( 'typography.customLetterSpacing' );
64
+ const hasLetterSpacing = useSetting( 'typography.letterSpacing' );
70
65
 
71
66
  return notSupported || ! hasLetterSpacing;
72
67
  }
68
+
69
+ /**
70
+ * Checks if there is a current value set for the letter spacing block support.
71
+ *
72
+ * @param {Object} props Block props.
73
+ * @return {boolean} Whether or not the block has a letter spacing set.
74
+ */
75
+ export function hasLetterSpacingValue( props ) {
76
+ return !! props.attributes.style?.typography?.letterSpacing;
77
+ }
78
+
79
+ /**
80
+ * Resets the letter spacing block support attribute. This can be used when
81
+ * disabling the letter spacing support controls for a block via a progressive
82
+ * discovery panel.
83
+ *
84
+ * @param {Object} props Block props.
85
+ * @param {Object} props.attributes Block's attributes.
86
+ * @param {Object} props.setAttributes Function to set block's attributes.
87
+ */
88
+ export function resetLetterSpacing( { attributes = {}, setAttributes } ) {
89
+ const { style } = attributes;
90
+
91
+ setAttributes( {
92
+ style: cleanEmptyObject( {
93
+ ...style,
94
+ typography: {
95
+ ...style?.typography,
96
+ letterSpacing: undefined,
97
+ },
98
+ } ),
99
+ } );
100
+ }
@@ -22,12 +22,8 @@ export const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';
22
22
  export function LineHeightEdit( props ) {
23
23
  const {
24
24
  attributes: { style },
25
+ setAttributes,
25
26
  } = props;
26
- const isDisabled = useIsLineHeightDisabled( props );
27
-
28
- if ( isDisabled ) {
29
- return null;
30
- }
31
27
 
32
28
  const onChange = ( newLineHeightValue ) => {
33
29
  const newStyle = {
@@ -37,9 +33,8 @@ export function LineHeightEdit( props ) {
37
33
  lineHeight: newLineHeightValue,
38
34
  },
39
35
  };
40
- props.setAttributes( {
41
- style: cleanEmptyObject( newStyle ),
42
- } );
36
+
37
+ setAttributes( { style: cleanEmptyObject( newStyle ) } );
43
38
  };
44
39
  return (
45
40
  <LineHeightControl
@@ -56,9 +51,42 @@ export function LineHeightEdit( props ) {
56
51
  * @return {boolean} Whether setting is disabled.
57
52
  */
58
53
  export function useIsLineHeightDisabled( { name: blockName } = {} ) {
59
- const isDisabled = ! useSetting( 'typography.customLineHeight' );
54
+ const isDisabled = ! useSetting( 'typography.lineHeight' );
60
55
 
61
56
  return (
62
57
  ! hasBlockSupport( blockName, LINE_HEIGHT_SUPPORT_KEY ) || isDisabled
63
58
  );
64
59
  }
60
+
61
+ /**
62
+ * Checks if there is a current value set for the line height block support.
63
+ *
64
+ * @param {Object} props Block props.
65
+ * @return {boolean} Whether or not the block has a line height value set.
66
+ */
67
+ export function hasLineHeightValue( props ) {
68
+ return !! props.attributes.style?.typography?.lineHeight;
69
+ }
70
+
71
+ /**
72
+ * Resets the line height block support attribute. This can be used when
73
+ * disabling the line height support controls for a block via a progressive
74
+ * discovery panel.
75
+ *
76
+ * @param {Object} props Block props.
77
+ * @param {Object} props.attributes Block's attributes.
78
+ * @param {Object} props.setAttributes Function to set block's attributes.
79
+ */
80
+ export function resetLineHeight( { attributes = {}, setAttributes } ) {
81
+ const { style } = attributes;
82
+
83
+ setAttributes( {
84
+ style: cleanEmptyObject( {
85
+ ...style,
86
+ typography: {
87
+ ...style?.typography,
88
+ lineHeight: undefined,
89
+ },
90
+ } ),
91
+ } );
92
+ }
@@ -73,7 +73,7 @@ export function resetMargin( { attributes = {}, setAttributes } ) {
73
73
  * @return {boolean} Whether margin setting is disabled.
74
74
  */
75
75
  export function useIsMarginDisabled( { name: blockName } = {} ) {
76
- const isDisabled = ! useSetting( 'spacing.customMargin' );
76
+ const isDisabled = ! useSetting( 'spacing.margin' );
77
77
  const isInvalid = ! useIsDimensionsSupportValid( blockName, 'margin' );
78
78
 
79
79
  return ! hasMarginSupport( blockName ) || isDisabled || isInvalid;
@@ -73,7 +73,7 @@ export function resetPadding( { attributes = {}, setAttributes } ) {
73
73
  * @return {boolean} Whether padding setting is disabled.
74
74
  */
75
75
  export function useIsPaddingDisabled( { name: blockName } = {} ) {
76
- const isDisabled = ! useSetting( 'spacing.customPadding' );
76
+ const isDisabled = ! useSetting( 'spacing.padding' );
77
77
  const isInvalid = ! useIsDimensionsSupportValid( blockName, 'padding' );
78
78
 
79
79
  return ! hasPaddingSupport( blockName ) || isDisabled || isInvalid;
@@ -29,11 +29,6 @@ export function TextDecorationEdit( props ) {
29
29
  attributes: { style },
30
30
  setAttributes,
31
31
  } = props;
32
- const isDisabled = useIsTextDecorationDisabled( props );
33
-
34
- if ( isDisabled ) {
35
- return null;
36
- }
37
32
 
38
33
  function onChange( newDecoration ) {
39
34
  setAttributes( {
@@ -67,7 +62,40 @@ export function useIsTextDecorationDisabled( { name: blockName } = {} ) {
67
62
  blockName,
68
63
  TEXT_DECORATION_SUPPORT_KEY
69
64
  );
70
- const hasTextDecoration = useSetting( 'typography.customTextDecorations' );
65
+ const hasTextDecoration = useSetting( 'typography.textDecoration' );
71
66
 
72
67
  return notSupported || ! hasTextDecoration;
73
68
  }
69
+
70
+ /**
71
+ * Checks if there is a current value set for the text decoration block support.
72
+ *
73
+ * @param {Object} props Block props.
74
+ * @return {boolean} Whether or not the block has a text decoration set.
75
+ */
76
+ export function hasTextDecorationValue( props ) {
77
+ return !! props.attributes.style?.typography?.textDecoration;
78
+ }
79
+
80
+ /**
81
+ * Resets the text decoration block support attribute. This can be used when
82
+ * disabling the text decoration support controls for a block via a progressive
83
+ * discovery panel.
84
+ *
85
+ * @param {Object} props Block props.
86
+ * @param {Object} props.attributes Block's attributes.
87
+ * @param {Object} props.setAttributes Function to set block's attributes.
88
+ */
89
+ export function resetTextDecoration( { attributes = {}, setAttributes } ) {
90
+ const { style } = attributes;
91
+
92
+ setAttributes( {
93
+ style: cleanEmptyObject( {
94
+ ...style,
95
+ typography: {
96
+ ...style?.typography,
97
+ textDecoration: undefined,
98
+ },
99
+ } ),
100
+ } );
101
+ }