@wordpress/block-editor 8.3.0 → 8.5.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 (443) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +56 -18
  3. package/build/components/alignment-control/index.js +13 -6
  4. package/build/components/alignment-control/index.js.map +1 -1
  5. package/build/components/block-alignment-control/index.js +13 -6
  6. package/build/components/block-alignment-control/index.js.map +1 -1
  7. package/build/components/block-draggable/index.js +2 -3
  8. package/build/components/block-draggable/index.js.map +1 -1
  9. package/build/components/block-icon/index.js +4 -0
  10. package/build/components/block-icon/index.js.map +1 -1
  11. package/build/components/block-inspector/index.js +6 -1
  12. package/build/components/block-inspector/index.js.map +1 -1
  13. package/build/components/block-list/block-html.js +4 -1
  14. package/build/components/block-list/block-html.js.map +1 -1
  15. package/build/components/block-list/block.js +4 -1
  16. package/build/components/block-list/block.js.map +1 -1
  17. package/build/components/block-list/use-block-props/index.js +1 -6
  18. package/build/components/block-list/use-block-props/index.js.map +1 -1
  19. package/build/components/block-list/use-block-props/use-focus-first-element.js +22 -6
  20. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  21. package/build/components/block-list/use-block-props/use-focus-handler.js +7 -1
  22. package/build/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
  23. package/build/components/block-list-appender/index.js +6 -1
  24. package/build/components/block-list-appender/index.js.map +1 -1
  25. package/build/components/block-lock/index.js +32 -0
  26. package/build/components/block-lock/index.js.map +1 -0
  27. package/build/components/block-lock/menu-item.js +67 -0
  28. package/build/components/block-lock/menu-item.js.map +1 -0
  29. package/build/components/block-lock/modal.js +134 -0
  30. package/build/components/block-lock/modal.js.map +1 -0
  31. package/build/components/block-lock/toolbar.js +78 -0
  32. package/build/components/block-lock/toolbar.js.map +1 -0
  33. package/build/components/block-mover/index.js +4 -0
  34. package/build/components/block-mover/index.js.map +1 -1
  35. package/build/components/block-settings-menu/block-settings-dropdown.js +75 -10
  36. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  37. package/build/components/block-settings-menu-controls/index.js +19 -9
  38. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  39. package/build/components/block-switcher/index.js +1 -1
  40. package/build/components/block-switcher/index.js.map +1 -1
  41. package/build/components/block-title/index.js +2 -2
  42. package/build/components/block-title/index.js.map +1 -1
  43. package/build/components/block-title/use-block-display-title.js +8 -6
  44. package/build/components/block-title/use-block-display-title.js.map +1 -1
  45. package/build/components/block-toolbar/block-name-context.js +17 -0
  46. package/build/components/block-toolbar/block-name-context.js.map +1 -0
  47. package/build/components/block-toolbar/block-toolbar-last-item.js +20 -0
  48. package/build/components/block-toolbar/block-toolbar-last-item.js.map +1 -0
  49. package/build/components/block-toolbar/index.js +24 -5
  50. package/build/components/block-toolbar/index.js.map +1 -1
  51. package/build/components/block-tools/index.js +0 -16
  52. package/build/components/block-tools/index.js.map +1 -1
  53. package/build/components/block-variation-transforms/index.js +92 -47
  54. package/build/components/block-variation-transforms/index.js.map +1 -1
  55. package/build/components/block-vertical-alignment-control/index.js +13 -6
  56. package/build/components/block-vertical-alignment-control/index.js.map +1 -1
  57. package/build/components/border-radius-control/index.js +0 -1
  58. package/build/components/border-radius-control/index.js.map +1 -1
  59. package/build/components/border-radius-control/utils.js +1 -1
  60. package/build/components/border-radius-control/utils.js.map +1 -1
  61. package/build/components/colors-gradients/control.js +3 -1
  62. package/build/components/colors-gradients/control.js.map +1 -1
  63. package/build/components/contrast-checker/index.js +4 -0
  64. package/build/components/contrast-checker/index.js.map +1 -1
  65. package/build/components/convert-to-group-buttons/index.js +8 -0
  66. package/build/components/convert-to-group-buttons/index.js.map +1 -1
  67. package/build/components/convert-to-group-buttons/toolbar.js +105 -0
  68. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -0
  69. package/build/components/copy-handler/index.js +4 -0
  70. package/build/components/copy-handler/index.js.map +1 -1
  71. package/build/components/date-format-picker/index.js +132 -0
  72. package/build/components/date-format-picker/index.js.map +1 -0
  73. package/build/components/font-sizes/font-size-picker.js +4 -0
  74. package/build/components/font-sizes/font-size-picker.js.map +1 -1
  75. package/build/components/iframe/index.js +6 -9
  76. package/build/components/iframe/index.js.map +1 -1
  77. package/build/components/index.js +27 -0
  78. package/build/components/index.js.map +1 -1
  79. package/build/components/justify-content-control/index.js +13 -6
  80. package/build/components/justify-content-control/index.js.map +1 -1
  81. package/build/components/keyboard-shortcuts/index.js +1 -1
  82. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  83. package/build/components/line-height-control/index.js +15 -6
  84. package/build/components/line-height-control/index.js.map +1 -1
  85. package/build/components/list-view/block-select-button.js +24 -23
  86. package/build/components/list-view/block-select-button.js.map +1 -1
  87. package/build/components/list-view/block.js +38 -13
  88. package/build/components/list-view/block.js.map +1 -1
  89. package/build/components/list-view/branch.js +16 -13
  90. package/build/components/list-view/branch.js.map +1 -1
  91. package/build/components/list-view/index.js +7 -1
  92. package/build/components/list-view/index.js.map +1 -1
  93. package/build/components/list-view/use-block-selection.js +9 -2
  94. package/build/components/list-view/use-block-selection.js.map +1 -1
  95. package/build/components/media-replace-flow/index.js +4 -0
  96. package/build/components/media-replace-flow/index.js.map +1 -1
  97. package/build/components/multi-selection-inspector/index.js +1 -1
  98. package/build/components/multi-selection-inspector/index.js.map +1 -1
  99. package/build/components/rich-text/index.js +27 -5
  100. package/build/components/rich-text/index.js.map +1 -1
  101. package/build/components/rich-text/index.native.js +13 -9
  102. package/build/components/rich-text/index.native.js.map +1 -1
  103. package/build/components/rich-text/split-value.js +12 -2
  104. package/build/components/rich-text/split-value.js.map +1 -1
  105. package/build/components/rich-text/use-firefox-compat.js +49 -0
  106. package/build/components/rich-text/use-firefox-compat.js.map +1 -0
  107. package/build/components/rich-text/use-input-rules.js +34 -2
  108. package/build/components/rich-text/use-input-rules.js.map +1 -1
  109. package/build/components/skip-to-selected-block/index.js +4 -0
  110. package/build/components/skip-to-selected-block/index.js.map +1 -1
  111. package/build/components/url-popover/image-url-input-ui.js +11 -27
  112. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  113. package/build/components/writing-flow/index.js +9 -1
  114. package/build/components/writing-flow/index.js.map +1 -1
  115. package/build/components/writing-flow/use-arrow-nav.js +3 -44
  116. package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
  117. package/build/components/writing-flow/use-click-selection.js +68 -0
  118. package/build/components/writing-flow/use-click-selection.js.map +1 -0
  119. package/build/components/writing-flow/use-drag-selection.js +134 -0
  120. package/build/components/writing-flow/use-drag-selection.js.map +1 -0
  121. package/build/components/writing-flow/use-input.js +116 -0
  122. package/build/components/writing-flow/use-input.js.map +1 -0
  123. package/build/components/writing-flow/use-multi-selection.js +18 -38
  124. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  125. package/build/components/writing-flow/use-selection-observer.js +161 -0
  126. package/build/components/writing-flow/use-selection-observer.js.map +1 -0
  127. package/build/components/writing-flow/use-tab-nav.js +1 -8
  128. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  129. package/build/hooks/anchor.js +7 -6
  130. package/build/hooks/anchor.js.map +1 -1
  131. package/build/hooks/border-color.js +3 -3
  132. package/build/hooks/border-color.js.map +1 -1
  133. package/build/hooks/border.js +0 -14
  134. package/build/hooks/border.js.map +1 -1
  135. package/build/hooks/color.js +20 -17
  136. package/build/hooks/color.js.map +1 -1
  137. package/build/hooks/font-family.js +5 -1
  138. package/build/hooks/font-family.js.map +1 -1
  139. package/build/hooks/font-size.js +4 -2
  140. package/build/hooks/font-size.js.map +1 -1
  141. package/build/hooks/gap.js +77 -5
  142. package/build/hooks/gap.js.map +1 -1
  143. package/build/hooks/layout.js +7 -2
  144. package/build/hooks/layout.js.map +1 -1
  145. package/build/hooks/style.js +34 -3
  146. package/build/hooks/style.js.map +1 -1
  147. package/build/hooks/utils.js +29 -0
  148. package/build/hooks/utils.js.map +1 -1
  149. package/build/layouts/flex.js +82 -15
  150. package/build/layouts/flex.js.map +1 -1
  151. package/build/layouts/flow.js +22 -13
  152. package/build/layouts/flow.js.map +1 -1
  153. package/build/store/actions.js +297 -51
  154. package/build/store/actions.js.map +1 -1
  155. package/build/store/defaults.js +5 -1
  156. package/build/store/defaults.js.map +1 -1
  157. package/build/store/reducer.js +25 -13
  158. package/build/store/reducer.js.map +1 -1
  159. package/build/store/selectors.js +171 -21
  160. package/build/store/selectors.js.map +1 -1
  161. package/build/utils/dom.js +2 -1
  162. package/build/utils/dom.js.map +1 -1
  163. package/build-module/components/alignment-control/index.js +12 -4
  164. package/build-module/components/alignment-control/index.js.map +1 -1
  165. package/build-module/components/block-alignment-control/index.js +12 -4
  166. package/build-module/components/block-alignment-control/index.js.map +1 -1
  167. package/build-module/components/block-draggable/index.js +2 -3
  168. package/build-module/components/block-draggable/index.js.map +1 -1
  169. package/build-module/components/block-icon/index.js +4 -0
  170. package/build-module/components/block-icon/index.js.map +1 -1
  171. package/build-module/components/block-inspector/index.js +6 -1
  172. package/build-module/components/block-inspector/index.js.map +1 -1
  173. package/build-module/components/block-list/block-html.js +5 -2
  174. package/build-module/components/block-list/block-html.js.map +1 -1
  175. package/build-module/components/block-list/block.js +5 -2
  176. package/build-module/components/block-list/block.js.map +1 -1
  177. package/build-module/components/block-list/use-block-props/index.js +1 -4
  178. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  179. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +22 -6
  180. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  181. package/build-module/components/block-list/use-block-props/use-focus-handler.js +7 -1
  182. package/build-module/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
  183. package/build-module/components/block-list-appender/index.js +6 -1
  184. package/build-module/components/block-list-appender/index.js.map +1 -1
  185. package/build-module/components/block-lock/index.js +4 -0
  186. package/build-module/components/block-lock/index.js.map +1 -0
  187. package/build-module/components/block-lock/menu-item.js +53 -0
  188. package/build-module/components/block-lock/menu-item.js.map +1 -0
  189. package/build-module/components/block-lock/modal.js +119 -0
  190. package/build-module/components/block-lock/modal.js.map +1 -0
  191. package/build-module/components/block-lock/toolbar.js +63 -0
  192. package/build-module/components/block-lock/toolbar.js.map +1 -0
  193. package/build-module/components/block-mover/index.js +4 -0
  194. package/build-module/components/block-mover/index.js.map +1 -1
  195. package/build-module/components/block-settings-menu/block-settings-dropdown.js +75 -12
  196. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  197. package/build-module/components/block-settings-menu-controls/index.js +18 -9
  198. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  199. package/build-module/components/block-switcher/index.js +2 -2
  200. package/build-module/components/block-switcher/index.js.map +1 -1
  201. package/build-module/components/block-title/index.js +2 -2
  202. package/build-module/components/block-title/index.js.map +1 -1
  203. package/build-module/components/block-title/use-block-display-title.js +8 -6
  204. package/build-module/components/block-title/use-block-display-title.js.map +1 -1
  205. package/build-module/components/block-toolbar/block-name-context.js +9 -0
  206. package/build-module/components/block-toolbar/block-name-context.js.map +1 -0
  207. package/build-module/components/block-toolbar/block-toolbar-last-item.js +11 -0
  208. package/build-module/components/block-toolbar/block-toolbar-last-item.js.map +1 -0
  209. package/build-module/components/block-toolbar/index.js +19 -4
  210. package/build-module/components/block-toolbar/index.js.map +1 -1
  211. package/build-module/components/block-tools/index.js +0 -16
  212. package/build-module/components/block-tools/index.js.map +1 -1
  213. package/build-module/components/block-variation-transforms/index.js +95 -49
  214. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  215. package/build-module/components/block-vertical-alignment-control/index.js +12 -4
  216. package/build-module/components/block-vertical-alignment-control/index.js.map +1 -1
  217. package/build-module/components/border-radius-control/index.js +0 -1
  218. package/build-module/components/border-radius-control/index.js.map +1 -1
  219. package/build-module/components/border-radius-control/utils.js +1 -1
  220. package/build-module/components/border-radius-control/utils.js.map +1 -1
  221. package/build-module/components/colors-gradients/control.js +3 -1
  222. package/build-module/components/colors-gradients/control.js.map +1 -1
  223. package/build-module/components/contrast-checker/index.js +4 -0
  224. package/build-module/components/contrast-checker/index.js.map +1 -1
  225. package/build-module/components/convert-to-group-buttons/index.js +2 -1
  226. package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
  227. package/build-module/components/convert-to-group-buttons/toolbar.js +90 -0
  228. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -0
  229. package/build-module/components/copy-handler/index.js +4 -0
  230. package/build-module/components/copy-handler/index.js.map +1 -1
  231. package/build-module/components/date-format-picker/index.js +122 -0
  232. package/build-module/components/date-format-picker/index.js.map +1 -0
  233. package/build-module/components/font-sizes/font-size-picker.js +4 -0
  234. package/build-module/components/font-sizes/font-size-picker.js.map +1 -1
  235. package/build-module/components/iframe/index.js +6 -9
  236. package/build-module/components/iframe/index.js.map +1 -1
  237. package/build-module/components/index.js +3 -0
  238. package/build-module/components/index.js.map +1 -1
  239. package/build-module/components/justify-content-control/index.js +12 -4
  240. package/build-module/components/justify-content-control/index.js.map +1 -1
  241. package/build-module/components/keyboard-shortcuts/index.js +1 -1
  242. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  243. package/build-module/components/line-height-control/index.js +14 -5
  244. package/build-module/components/line-height-control/index.js.map +1 -1
  245. package/build-module/components/list-view/block-select-button.js +24 -23
  246. package/build-module/components/list-view/block-select-button.js.map +1 -1
  247. package/build-module/components/list-view/block.js +36 -13
  248. package/build-module/components/list-view/block.js.map +1 -1
  249. package/build-module/components/list-view/branch.js +16 -13
  250. package/build-module/components/list-view/branch.js.map +1 -1
  251. package/build-module/components/list-view/index.js +7 -1
  252. package/build-module/components/list-view/index.js.map +1 -1
  253. package/build-module/components/list-view/use-block-selection.js +10 -3
  254. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  255. package/build-module/components/media-replace-flow/index.js +4 -0
  256. package/build-module/components/media-replace-flow/index.js.map +1 -1
  257. package/build-module/components/multi-selection-inspector/index.js +2 -2
  258. package/build-module/components/multi-selection-inspector/index.js.map +1 -1
  259. package/build-module/components/rich-text/index.js +26 -5
  260. package/build-module/components/rich-text/index.js.map +1 -1
  261. package/build-module/components/rich-text/index.native.js +13 -9
  262. package/build-module/components/rich-text/index.native.js.map +1 -1
  263. package/build-module/components/rich-text/split-value.js +12 -2
  264. package/build-module/components/rich-text/split-value.js.map +1 -1
  265. package/build-module/components/rich-text/use-firefox-compat.js +39 -0
  266. package/build-module/components/rich-text/use-firefox-compat.js.map +1 -0
  267. package/build-module/components/rich-text/use-input-rules.js +35 -4
  268. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  269. package/build-module/components/skip-to-selected-block/index.js +4 -0
  270. package/build-module/components/skip-to-selected-block/index.js.map +1 -1
  271. package/build-module/components/url-popover/image-url-input-ui.js +12 -28
  272. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  273. package/build-module/components/writing-flow/index.js +5 -1
  274. package/build-module/components/writing-flow/index.js.map +1 -1
  275. package/build-module/components/writing-flow/use-arrow-nav.js +4 -45
  276. package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
  277. package/build-module/components/writing-flow/use-click-selection.js +57 -0
  278. package/build-module/components/writing-flow/use-click-selection.js.map +1 -0
  279. package/build-module/components/writing-flow/use-drag-selection.js +124 -0
  280. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -0
  281. package/build-module/components/writing-flow/use-input.js +104 -0
  282. package/build-module/components/writing-flow/use-input.js.map +1 -0
  283. package/build-module/components/writing-flow/use-multi-selection.js +18 -37
  284. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  285. package/build-module/components/writing-flow/use-selection-observer.js +150 -0
  286. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -0
  287. package/build-module/components/writing-flow/use-tab-nav.js +1 -9
  288. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  289. package/build-module/hooks/anchor.js +7 -6
  290. package/build-module/hooks/anchor.js.map +1 -1
  291. package/build-module/hooks/border-color.js +5 -5
  292. package/build-module/hooks/border-color.js.map +1 -1
  293. package/build-module/hooks/border.js +0 -12
  294. package/build-module/hooks/border.js.map +1 -1
  295. package/build-module/hooks/color.js +19 -18
  296. package/build-module/hooks/color.js.map +1 -1
  297. package/build-module/hooks/font-family.js +3 -1
  298. package/build-module/hooks/font-family.js.map +1 -1
  299. package/build-module/hooks/font-size.js +4 -3
  300. package/build-module/hooks/font-size.js.map +1 -1
  301. package/build-module/hooks/gap.js +75 -7
  302. package/build-module/hooks/gap.js.map +1 -1
  303. package/build-module/hooks/layout.js +7 -2
  304. package/build-module/hooks/layout.js.map +1 -1
  305. package/build-module/hooks/style.js +33 -3
  306. package/build-module/hooks/style.js.map +1 -1
  307. package/build-module/hooks/utils.js +26 -0
  308. package/build-module/hooks/utils.js.map +1 -1
  309. package/build-module/layouts/flex.js +81 -16
  310. package/build-module/layouts/flex.js.map +1 -1
  311. package/build-module/layouts/flow.js +20 -13
  312. package/build-module/layouts/flow.js.map +1 -1
  313. package/build-module/store/actions.js +286 -49
  314. package/build-module/store/actions.js.map +1 -1
  315. package/build-module/store/defaults.js +5 -1
  316. package/build-module/store/defaults.js.map +1 -1
  317. package/build-module/store/reducer.js +25 -13
  318. package/build-module/store/reducer.js.map +1 -1
  319. package/build-module/store/selectors.js +162 -20
  320. package/build-module/store/selectors.js.map +1 -1
  321. package/build-module/utils/dom.js +2 -1
  322. package/build-module/utils/dom.js.map +1 -1
  323. package/build-style/style-rtl.css +214 -24
  324. package/build-style/style.css +214 -24
  325. package/build-types/utils/dom.d.ts.map +1 -1
  326. package/package.json +28 -27
  327. package/src/components/alignment-control/index.js +9 -4
  328. package/src/components/block-alignment-control/index.js +9 -4
  329. package/src/components/block-draggable/index.js +2 -5
  330. package/src/components/block-icon/index.js +3 -0
  331. package/src/components/block-inspector/index.js +4 -0
  332. package/src/components/block-list/block-html.js +8 -4
  333. package/src/components/block-list/block.js +5 -1
  334. package/src/components/block-list/style.scss +4 -5
  335. package/src/components/block-list/use-block-props/index.js +0 -5
  336. package/src/components/block-list/use-block-props/use-focus-first-element.js +27 -6
  337. package/src/components/block-list/use-block-props/use-focus-handler.js +8 -0
  338. package/src/components/block-list-appender/index.js +5 -0
  339. package/src/components/block-lock/index.js +3 -0
  340. package/src/components/block-lock/menu-item.js +59 -0
  341. package/src/components/block-lock/modal.js +170 -0
  342. package/src/components/block-lock/style.scss +70 -0
  343. package/src/components/block-lock/toolbar.js +68 -0
  344. package/src/components/block-mover/index.js +3 -0
  345. package/src/components/block-mover/style.scss +4 -0
  346. package/src/components/block-settings-menu/block-settings-dropdown.js +109 -9
  347. package/src/components/block-settings-menu-controls/index.js +33 -12
  348. package/src/components/block-switcher/index.js +2 -2
  349. package/src/components/block-switcher/style.scss +8 -1
  350. package/src/components/block-switcher/test/index.js +2 -2
  351. package/src/components/block-title/README.md +6 -1
  352. package/src/components/block-title/index.js +2 -2
  353. package/src/components/block-title/test/index.js +43 -1
  354. package/src/components/block-title/use-block-display-title.js +10 -7
  355. package/src/components/block-toolbar/block-name-context.js +8 -0
  356. package/src/components/block-toolbar/block-toolbar-last-item.js +12 -0
  357. package/src/components/block-toolbar/index.js +24 -2
  358. package/src/components/block-toolbar/style.scss +10 -0
  359. package/src/components/block-tools/index.js +0 -19
  360. package/src/components/block-tools/style.scss +27 -0
  361. package/src/components/block-variation-transforms/index.js +105 -36
  362. package/src/components/block-variation-transforms/style.scss +1 -1
  363. package/src/components/block-vertical-alignment-control/index.js +9 -4
  364. package/src/components/border-radius-control/index.js +0 -1
  365. package/src/components/border-radius-control/test/utils.js +4 -0
  366. package/src/components/border-radius-control/utils.js +2 -1
  367. package/src/components/button-block-appender/style.scss +5 -1
  368. package/src/components/color-palette/test/__snapshots__/control.js.snap +70 -4
  369. package/src/components/colors-gradients/control.js +1 -1
  370. package/src/components/colors-gradients/style.scss +6 -0
  371. package/src/components/contrast-checker/index.js +3 -0
  372. package/src/components/convert-to-group-buttons/index.js +6 -1
  373. package/src/components/convert-to-group-buttons/toolbar.js +87 -0
  374. package/src/components/copy-handler/index.js +3 -0
  375. package/src/components/date-format-picker/README.md +58 -0
  376. package/src/components/date-format-picker/index.js +161 -0
  377. package/src/components/date-format-picker/style.scss +31 -0
  378. package/src/components/font-sizes/font-size-picker.js +3 -0
  379. package/src/components/iframe/index.js +5 -7
  380. package/src/components/index.js +3 -0
  381. package/src/components/justify-content-control/index.js +9 -4
  382. package/src/components/keyboard-shortcuts/index.js +1 -1
  383. package/src/components/line-height-control/index.js +11 -6
  384. package/src/components/link-control/README.md +1 -1
  385. package/src/components/list-view/block-select-button.js +21 -30
  386. package/src/components/list-view/block.js +55 -13
  387. package/src/components/list-view/branch.js +37 -15
  388. package/src/components/list-view/index.js +6 -0
  389. package/src/components/list-view/style.scss +56 -14
  390. package/src/components/list-view/use-block-selection.js +15 -2
  391. package/src/components/media-placeholder/README.md +8 -0
  392. package/src/components/media-replace-flow/index.js +3 -0
  393. package/src/components/multi-selection-inspector/index.js +2 -2
  394. package/src/components/rich-text/index.js +25 -2
  395. package/src/components/rich-text/index.native.js +24 -8
  396. package/src/components/rich-text/split-value.js +5 -1
  397. package/src/components/rich-text/use-firefox-compat.js +39 -0
  398. package/src/components/rich-text/use-input-rules.js +40 -3
  399. package/src/components/skip-to-selected-block/index.js +3 -0
  400. package/src/components/url-input/style.scss +3 -2
  401. package/src/components/url-popover/image-url-input-ui.js +16 -29
  402. package/src/components/writing-flow/index.js +8 -0
  403. package/src/components/writing-flow/readme.md +28 -0
  404. package/src/components/writing-flow/use-arrow-nav.js +4 -53
  405. package/src/components/writing-flow/use-click-selection.js +65 -0
  406. package/src/components/writing-flow/use-drag-selection.js +126 -0
  407. package/src/components/writing-flow/use-input.js +112 -0
  408. package/src/components/writing-flow/use-multi-selection.js +13 -36
  409. package/src/components/writing-flow/use-selection-observer.js +153 -0
  410. package/src/components/writing-flow/use-tab-nav.js +1 -11
  411. package/src/hooks/anchor.js +8 -6
  412. package/src/hooks/border-color.js +5 -5
  413. package/src/hooks/border.js +0 -13
  414. package/src/hooks/color.js +51 -24
  415. package/src/hooks/font-family.js +5 -2
  416. package/src/hooks/font-size.js +10 -7
  417. package/src/hooks/gap.js +91 -12
  418. package/src/hooks/layout.js +11 -1
  419. package/src/hooks/style.js +40 -4
  420. package/src/hooks/test/gap.js +66 -0
  421. package/src/hooks/test/style.js +94 -0
  422. package/src/hooks/test/utils.js +1 -1
  423. package/src/hooks/utils.js +26 -0
  424. package/src/layouts/flex.js +93 -6
  425. package/src/layouts/flow.js +28 -12
  426. package/src/store/actions.js +349 -32
  427. package/src/store/defaults.js +7 -1
  428. package/src/store/reducer.js +25 -10
  429. package/src/store/selectors.js +207 -25
  430. package/src/store/test/selectors.js +305 -5
  431. package/src/style.scss +2 -0
  432. package/src/utils/dom.js +2 -1
  433. package/tsconfig.tsbuildinfo +1 -1
  434. package/build/components/block-list/use-block-props/use-multi-selection.js +0 -205
  435. package/build/components/block-list/use-block-props/use-multi-selection.js.map +0 -1
  436. package/build/components/block-list/use-block-props/use-scroll-into-view.js +0 -77
  437. package/build/components/block-list/use-block-props/use-scroll-into-view.js.map +0 -1
  438. package/build-module/components/block-list/use-block-props/use-multi-selection.js +0 -192
  439. package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +0 -1
  440. package/build-module/components/block-list/use-block-props/use-scroll-into-view.js +0 -63
  441. package/build-module/components/block-list/use-block-props/use-scroll-into-view.js.map +0 -1
  442. package/src/components/block-list/use-block-props/use-multi-selection.js +0 -227
  443. package/src/components/block-list/use-block-props/use-scroll-into-view.js +0 -73
@@ -208,7 +208,7 @@ function addAttributes(settings) {
208
208
  function addSaveProps(props, blockType, attributes) {
209
209
  var _style$border2;
210
210
 
211
- if (!(0, _border.hasBorderSupport)(blockType, 'color') || (0, _border.shouldSkipSerialization)(blockType)) {
211
+ if (!(0, _border.hasBorderSupport)(blockType, 'color') || (0, _utils.shouldSkipSerialization)(blockType, _border.BORDER_SUPPORT_KEY, 'color')) {
212
212
  return props;
213
213
  }
214
214
 
@@ -237,7 +237,7 @@ function addSaveProps(props, blockType, attributes) {
237
237
 
238
238
 
239
239
  function addEditProps(settings) {
240
- if (!(0, _border.hasBorderSupport)(settings, 'color') || (0, _border.shouldSkipSerialization)(settings)) {
240
+ if (!(0, _border.hasBorderSupport)(settings, 'color') || (0, _utils.shouldSkipSerialization)(settings, _border.BORDER_SUPPORT_KEY, 'color')) {
241
241
  return settings;
242
242
  }
243
243
 
@@ -277,7 +277,7 @@ const withBorderColorPaletteStyles = (0, _compose.createHigherOrderComponent)(Bl
277
277
  } = attributes;
278
278
  const colors = (0, _useSetting.default)('color.palette') || EMPTY_ARRAY;
279
279
 
280
- if (!(0, _border.hasBorderSupport)(name, 'color') || (0, _border.shouldSkipSerialization)(name)) {
280
+ if (!(0, _border.hasBorderSupport)(name, 'color') || (0, _utils.shouldSkipSerialization)(name, _border.BORDER_SUPPORT_KEY, 'color')) {
281
281
  return (0, _element.createElement)(BlockListBlock, props);
282
282
  }
283
283
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/border-color.js"],"names":["EMPTY_ARRAY","BorderColorEdit","props","attributes","borderColor","style","setAttributes","colorGradientSettings","availableColors","colors","reduce","origin","concat","color","customBorderColor","border","colorValue","setColorValue","onChangeColor","value","colorObject","newStyle","slug","undefined","newNamedColor","settings","label","onColorChange","clearable","hasBorderColorValue","resetBorderColor","addAttributes","type","addSaveProps","blockType","borderColorClass","newClassName","className","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","withBorderColorPaletteStyles","BlockListBlock","name","extraStyles","wrapperProps"],"mappings":";;;;;;;;;;;;AAWA;;;;AARA;;AAKA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AAKA;;AACA;;AAKA;;AA7BA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAgBA;AACA;AACA,MAAMA,WAAW,GAAG,EAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,eAAT,CAA0BC,KAA1B,EAAkC;AACxC,QAAM;AACLC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,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xC,IAAAA,KAAK,EAAE,EACN,GAAGuC,WADG;AAEN,iCAAG1C,KAAK,CAAC2C,YAAT,wDAAG,oBAAoBxC,KAAvB;AAFM;AAFO,GAAf;AAQA,SAAO,4BAAC,cAAD,6BAAqBH,KAArB;AAA6B,IAAA,YAAY,EAAG2C;AAA5C,KAAP;AACA,CA7B0C,CAArC;;AAgCP,sBACC,0BADD,EAEC,2BAFD,EAGCd,aAHD;AAMA,sBACC,kCADD,EAEC,0BAFD,EAGCE,YAHD;AAMA,sBACC,0BADD,EAEC,0BAFD,EAGCK,YAHD;AAMA,sBACC,uBADD,EAEC,8CAFD,EAGCG,4BAHD","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientSettingsDropdown from '../components/colors-gradients/dropdown';\nimport useMultipleOriginColorsAndGradients from '../components/colors-gradients/use-multiple-origin-colors-and-gradients';\nimport {\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n} from '../components/colors';\nimport useSetting from '../components/use-setting';\nimport {\n\thasBorderSupport,\n\tremoveBorderAttribute,\n\tshouldSkipSerialization,\n} from './border';\nimport { cleanEmptyObject } from './utils';\n\n// Defining empty array here instead of inline avoids unnecessary re-renders of\n// color control.\nconst EMPTY_ARRAY = [];\n\n/**\n * Inspector control panel containing the border color related configuration.\n *\n * There is deliberate overlap between the colors and borders block supports\n * relating to border color. It can be argued the border color controls could\n * be included within either, or both, the colors and borders panels in the\n * inspector controls. If they share the same block attributes it should not\n * matter.\n *\n * @param {Object} props Block properties.\n *\n * @return {WPElement} Border color edit element.\n */\nexport function BorderColorEdit( props ) {\n\tconst {\n\t\tattributes: { borderColor, style },\n\t\tsetAttributes,\n\t} = props;\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\tconst availableColors = colorGradientSettings.colors.reduce(\n\t\t( colors, origin ) => colors.concat( origin.colors ),\n\t\t[]\n\t);\n\tconst { color: customBorderColor } = style?.border || {};\n\tconst [ colorValue, setColorValue ] = useState(\n\t\t() =>\n\t\t\tgetColorObjectByAttributeValues(\n\t\t\t\tavailableColors,\n\t\t\t\tborderColor,\n\t\t\t\tcustomBorderColor\n\t\t\t)?.color\n\t);\n\n\t// Detect changes in the color attributes and update the colorValue to keep the\n\t// UI in sync. This is necessary for situations when border controls interact with\n\t// each other: eg, setting the border width to zero causes the color and style\n\t// selections to be cleared.\n\tuseEffect( () => {\n\t\tsetColorValue(\n\t\t\tgetColorObjectByAttributeValues(\n\t\t\t\tavailableColors,\n\t\t\t\tborderColor,\n\t\t\t\tcustomBorderColor\n\t\t\t)?.color\n\t\t);\n\t}, [ borderColor, customBorderColor, availableColors ] );\n\n\tconst onChangeColor = ( value ) => {\n\t\tsetColorValue( value );\n\n\t\tconst colorObject = getColorObjectByColorValue(\n\t\t\tavailableColors,\n\t\t\tvalue\n\t\t);\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tborder: {\n\t\t\t\t...style?.border,\n\t\t\t\tcolor: colorObject?.slug ? undefined : value,\n\t\t\t},\n\t\t};\n\n\t\t// If empty slug, ensure undefined to remove attribute.\n\t\tconst newNamedColor = colorObject?.slug ? colorObject.slug : undefined;\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\tborderColor: newNamedColor,\n\t\t} );\n\t};\n\n\tconst settings = [\n\t\t{\n\t\t\tlabel: __( 'Color' ),\n\t\t\tonColorChange: onChangeColor,\n\t\t\tcolorValue,\n\t\t\tclearable: false,\n\t\t},\n\t];\n\treturn (\n\t\t<ColorGradientSettingsDropdown\n\t\t\tsettings={ settings }\n\t\t\tdisableCustomColors\n\t\t\tdisableCustomGradients\n\t\t\t__experimentalHasMultipleOrigins\n\t\t\t__experimentalIsRenderedInSidebar\n\t\t\tenableAlpha\n\t\t\t{ ...colorGradientSettings }\n\t\t/>\n\t);\n}\n\n/**\n * Checks if there is a current value in the border color block support\n * attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a border color value set.\n */\nexport function hasBorderColorValue( props ) {\n\tconst {\n\t\tattributes: { borderColor, style },\n\t} = props;\n\n\treturn !! borderColor || !! style?.border?.color;\n}\n\n/**\n * Resets the border color block support attributes. This can be used when\n * disabling the border color support controls for a block via a progressive\n * discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetBorderColor( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tborderColor: undefined,\n\t\tstyle: removeBorderAttribute( style, 'color' ),\n\t} );\n}\n\n/**\n * Filters registered block settings, extending attributes to include\n * `borderColor` if needed.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Updated block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBorderSupport( settings, 'color' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify default value if needed.\n\tif ( settings.attributes.borderColor ) {\n\t\treturn settings;\n\t}\n\n\t// Add new borderColor attribute to block settings.\n\treturn {\n\t\t...settings,\n\t\tattributes: {\n\t\t\t...settings.attributes,\n\t\t\tborderColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t},\n\t};\n}\n\n/**\n * Override props assigned to save component to inject border color.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type definition.\n * @param {Object} attributes Block's attributes.\n *\n * @return {Object} Filtered props to apply to save element.\n */\nfunction addSaveProps( props, blockType, attributes ) {\n\tif (\n\t\t! hasBorderSupport( blockType, 'color' ) ||\n\t\tshouldSkipSerialization( blockType )\n\t) {\n\t\treturn props;\n\t}\n\n\tconst { borderColor, style } = attributes;\n\tconst borderColorClass = getColorClassName( 'border-color', borderColor );\n\n\tconst newClassName = classnames( props.className, {\n\t\t'has-border-color': borderColor || style?.border?.color,\n\t\t[ borderColorClass ]: !! borderColorClass,\n\t} );\n\n\t// If we are clearing the last of the previous classes in `className`\n\t// set it to `undefined` to avoid rendering empty DOM attributes.\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters the registered block settings to apply border color styles and\n * classnames to the block edit wrapper.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addEditProps( settings ) {\n\tif (\n\t\t! hasBorderSupport( settings, 'color' ) ||\n\t\tshouldSkipSerialization( settings )\n\t) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\n\t\treturn addSaveProps( props, settings, attributes );\n\t};\n\n\treturn settings;\n}\n\n/**\n * This adds inline styles for color palette colors.\n * Ideally, this is not needed and themes should load their palettes on the editor.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withBorderColorPaletteStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst { borderColor } = attributes;\n\t\tconst colors = useSetting( 'color.palette' ) || EMPTY_ARRAY;\n\n\t\tif (\n\t\t\t! hasBorderSupport( name, 'color' ) ||\n\t\t\tshouldSkipSerialization( name )\n\t\t) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tconst extraStyles = {\n\t\t\tborderColor: borderColor\n\t\t\t\t? getColorObjectByAttributeValues( colors, borderColor )?.color\n\t\t\t\t: undefined,\n\t\t};\n\n\t\tlet wrapperProps = props.wrapperProps;\n\t\twrapperProps = {\n\t\t\t...props.wrapperProps,\n\t\t\tstyle: {\n\t\t\t\t...extraStyles,\n\t\t\t\t...props.wrapperProps?.style,\n\t\t\t},\n\t\t};\n\n\t\treturn <BlockListBlock { ...props } wrapperProps={ wrapperProps } />;\n\t}\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/border/addAttributes',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/border/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/border/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/border/with-border-color-palette-styles',\n\twithBorderColorPaletteStyles\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/border-color.js"],"names":["EMPTY_ARRAY","BorderColorEdit","props","attributes","borderColor","style","setAttributes","colorGradientSettings","availableColors","colors","reduce","origin","concat","color","customBorderColor","border","colorValue","setColorValue","onChangeColor","value","colorObject","newStyle","slug","undefined","newNamedColor","settings","label","onColorChange","clearable","hasBorderColorValue","resetBorderColor","addAttributes","type","addSaveProps","blockType","BORDER_SUPPORT_KEY","borderColorClass","newClassName","className","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","withBorderColorPaletteStyles","BlockListBlock","name","extraStyles","wrapperProps"],"mappings":";;;;;;;;;;;;AAWA;;;;AARA;;AAKA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AAKA;;AACA;;AAKA;;AA7BA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAgBA;AACA;AACA,MAAMA,WAAW,GAAG,EAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,eAAT,CAA0BC,KAA1B,EAAkC;AACxC,QAAM;AACLC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,WAAF;AAAeC,MAAAA;AAAf,KADP;AAELC,IAAAA;AAFK,MAGFJ,KAHJ;AAIA,QAAMK,qBAAqB,GAAG,mDAA9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AAA,KAAK,EAAE,EACN,GAAGwC,WADG;AAEN,iCAAG3C,KAAK,CAAC4C,YAAT,wDAAG,oBAAoBzC,KAAvB;AAFM;AAFO,GAAf;AAQA,SAAO,4BAAC,cAAD,6BAAqBH,KAArB;AAA6B,IAAA,YAAY,EAAG4C;AAA5C,KAAP;AACA,CA7B0C,CAArC;;AAgCP,sBACC,0BADD,EAEC,2BAFD,EAGCf,aAHD;AAMA,sBACC,kCADD,EAEC,0BAFD,EAGCE,YAHD;AAMA,sBACC,0BADD,EAEC,0BAFD,EAGCM,YAHD;AAMA,sBACC,uBADD,EAEC,8CAFD,EAGCG,4BAHD","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientSettingsDropdown from '../components/colors-gradients/dropdown';\nimport useMultipleOriginColorsAndGradients from '../components/colors-gradients/use-multiple-origin-colors-and-gradients';\nimport {\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n} from '../components/colors';\nimport useSetting from '../components/use-setting';\nimport {\n\tBORDER_SUPPORT_KEY,\n\thasBorderSupport,\n\tremoveBorderAttribute,\n} from './border';\nimport { cleanEmptyObject, shouldSkipSerialization } from './utils';\n\n// Defining empty array here instead of inline avoids unnecessary re-renders of\n// color control.\nconst EMPTY_ARRAY = [];\n\n/**\n * Inspector control panel containing the border color related configuration.\n *\n * There is deliberate overlap between the colors and borders block supports\n * relating to border color. It can be argued the border color controls could\n * be included within either, or both, the colors and borders panels in the\n * inspector controls. If they share the same block attributes it should not\n * matter.\n *\n * @param {Object} props Block properties.\n *\n * @return {WPElement} Border color edit element.\n */\nexport function BorderColorEdit( props ) {\n\tconst {\n\t\tattributes: { borderColor, style },\n\t\tsetAttributes,\n\t} = props;\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\tconst availableColors = colorGradientSettings.colors.reduce(\n\t\t( colors, origin ) => colors.concat( origin.colors ),\n\t\t[]\n\t);\n\tconst { color: customBorderColor } = style?.border || {};\n\tconst [ colorValue, setColorValue ] = useState(\n\t\t() =>\n\t\t\tgetColorObjectByAttributeValues(\n\t\t\t\tavailableColors,\n\t\t\t\tborderColor,\n\t\t\t\tcustomBorderColor\n\t\t\t)?.color\n\t);\n\n\t// Detect changes in the color attributes and update the colorValue to keep the\n\t// UI in sync. This is necessary for situations when border controls interact with\n\t// each other: eg, setting the border width to zero causes the color and style\n\t// selections to be cleared.\n\tuseEffect( () => {\n\t\tsetColorValue(\n\t\t\tgetColorObjectByAttributeValues(\n\t\t\t\tavailableColors,\n\t\t\t\tborderColor,\n\t\t\t\tcustomBorderColor\n\t\t\t)?.color\n\t\t);\n\t}, [ borderColor, customBorderColor, availableColors ] );\n\n\tconst onChangeColor = ( value ) => {\n\t\tsetColorValue( value );\n\n\t\tconst colorObject = getColorObjectByColorValue(\n\t\t\tavailableColors,\n\t\t\tvalue\n\t\t);\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tborder: {\n\t\t\t\t...style?.border,\n\t\t\t\tcolor: colorObject?.slug ? undefined : value,\n\t\t\t},\n\t\t};\n\n\t\t// If empty slug, ensure undefined to remove attribute.\n\t\tconst newNamedColor = colorObject?.slug ? colorObject.slug : undefined;\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\tborderColor: newNamedColor,\n\t\t} );\n\t};\n\n\tconst settings = [\n\t\t{\n\t\t\tlabel: __( 'Color' ),\n\t\t\tonColorChange: onChangeColor,\n\t\t\tcolorValue,\n\t\t\tclearable: false,\n\t\t},\n\t];\n\treturn (\n\t\t<ColorGradientSettingsDropdown\n\t\t\tsettings={ settings }\n\t\t\tdisableCustomColors\n\t\t\tdisableCustomGradients\n\t\t\t__experimentalHasMultipleOrigins\n\t\t\t__experimentalIsRenderedInSidebar\n\t\t\tenableAlpha\n\t\t\t{ ...colorGradientSettings }\n\t\t/>\n\t);\n}\n\n/**\n * Checks if there is a current value in the border color block support\n * attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a border color value set.\n */\nexport function hasBorderColorValue( props ) {\n\tconst {\n\t\tattributes: { borderColor, style },\n\t} = props;\n\n\treturn !! borderColor || !! style?.border?.color;\n}\n\n/**\n * Resets the border color block support attributes. This can be used when\n * disabling the border color support controls for a block via a progressive\n * discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetBorderColor( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tborderColor: undefined,\n\t\tstyle: removeBorderAttribute( style, 'color' ),\n\t} );\n}\n\n/**\n * Filters registered block settings, extending attributes to include\n * `borderColor` if needed.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Updated block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBorderSupport( settings, 'color' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify default value if needed.\n\tif ( settings.attributes.borderColor ) {\n\t\treturn settings;\n\t}\n\n\t// Add new borderColor attribute to block settings.\n\treturn {\n\t\t...settings,\n\t\tattributes: {\n\t\t\t...settings.attributes,\n\t\t\tborderColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t},\n\t};\n}\n\n/**\n * Override props assigned to save component to inject border color.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type definition.\n * @param {Object} attributes Block's attributes.\n *\n * @return {Object} Filtered props to apply to save element.\n */\nfunction addSaveProps( props, blockType, attributes ) {\n\tif (\n\t\t! hasBorderSupport( blockType, 'color' ) ||\n\t\tshouldSkipSerialization( blockType, BORDER_SUPPORT_KEY, 'color' )\n\t) {\n\t\treturn props;\n\t}\n\n\tconst { borderColor, style } = attributes;\n\tconst borderColorClass = getColorClassName( 'border-color', borderColor );\n\n\tconst newClassName = classnames( props.className, {\n\t\t'has-border-color': borderColor || style?.border?.color,\n\t\t[ borderColorClass ]: !! borderColorClass,\n\t} );\n\n\t// If we are clearing the last of the previous classes in `className`\n\t// set it to `undefined` to avoid rendering empty DOM attributes.\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters the registered block settings to apply border color styles and\n * classnames to the block edit wrapper.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addEditProps( settings ) {\n\tif (\n\t\t! hasBorderSupport( settings, 'color' ) ||\n\t\tshouldSkipSerialization( settings, BORDER_SUPPORT_KEY, 'color' )\n\t) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\n\t\treturn addSaveProps( props, settings, attributes );\n\t};\n\n\treturn settings;\n}\n\n/**\n * This adds inline styles for color palette colors.\n * Ideally, this is not needed and themes should load their palettes on the editor.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withBorderColorPaletteStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst { borderColor } = attributes;\n\t\tconst colors = useSetting( 'color.palette' ) || EMPTY_ARRAY;\n\n\t\tif (\n\t\t\t! hasBorderSupport( name, 'color' ) ||\n\t\t\tshouldSkipSerialization( name, BORDER_SUPPORT_KEY, 'color' )\n\t\t) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tconst extraStyles = {\n\t\t\tborderColor: borderColor\n\t\t\t\t? getColorObjectByAttributeValues( colors, borderColor )?.color\n\t\t\t\t: undefined,\n\t\t};\n\n\t\tlet wrapperProps = props.wrapperProps;\n\t\twrapperProps = {\n\t\t\t...props.wrapperProps,\n\t\t\tstyle: {\n\t\t\t\t...extraStyles,\n\t\t\t\t...props.wrapperProps?.style,\n\t\t\t},\n\t\t};\n\n\t\treturn <BlockListBlock { ...props } wrapperProps={ wrapperProps } />;\n\t}\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/border/addAttributes',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/border/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/border/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/border/with-border-color-palette-styles',\n\twithBorderColorPaletteStyles\n);\n"]}
@@ -9,7 +9,6 @@ exports.BORDER_SUPPORT_KEY = void 0;
9
9
  exports.BorderPanel = BorderPanel;
10
10
  exports.hasBorderSupport = hasBorderSupport;
11
11
  exports.removeBorderAttribute = removeBorderAttribute;
12
- exports.shouldSkipSerialization = shouldSkipSerialization;
13
12
 
14
13
  var _element = require("@wordpress/element");
15
14
 
@@ -140,19 +139,6 @@ function hasBorderSupport(blockName) {
140
139
 
141
140
  return !!(support !== null && support !== void 0 && support[feature]);
142
141
  }
143
- /**
144
- * Check whether serialization of border classes and styles should be skipped.
145
- *
146
- * @param {string|Object} blockType Block name or block type object.
147
- *
148
- * @return {boolean} Whether serialization of border properties should occur.
149
- */
150
-
151
-
152
- function shouldSkipSerialization(blockType) {
153
- const support = (0, _blocks.getBlockSupport)(blockType, BORDER_SUPPORT_KEY);
154
- return support === null || support === void 0 ? void 0 : support.__experimentalSkipSerialization;
155
- }
156
142
  /**
157
143
  * Returns a new style object where the specified border attribute has been
158
144
  * removed.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/border.js"],"names":["BORDER_SUPPORT_KEY","BorderPanel","props","clientId","isColorSupported","hasBorderSupport","name","isRadiusSupported","isStyleSupported","isWidthSupported","isDisabled","every","Boolean","defaultBorderControls","createResetAllFilter","borderAttribute","topLevelAttributes","newAttributes","style","border","undefined","width","color","borderColor","radius","blockName","feature","Platform","OS","support","shouldSkipSerialization","blockType","__experimentalSkipSerialization","removeBorderAttribute","attribute"],"mappings":";;;;;;;;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AAKA;;AAKA;;AAKA;;AAKA;;AAKA;;AACA;;AACA;;AAjCA;AACA;AACA;;AAMA;AACA;AACA;AAyBO,MAAMA,kBAAkB,GAAG,sBAA3B;;;AAEA,SAASC,WAAT,CAAsBC,KAAtB,EAA8B;AACpC,QAAM;AAAEC,IAAAA;AAAF,MAAeD,KAArB;AAEA,QAAME,gBAAgB,GACrB,yBAAY,cAAZ,KAAgCC,gBAAgB,CAAEH,KAAK,CAACI,IAAR,EAAc,OAAd,CADjD;AAGA,QAAMC,iBAAiB,GACtB,yBAAY,eAAZ,KACAF,gBAAgB,CAAEH,KAAK,CAACI,IAAR,EAAc,QAAd,CAFjB;AAIA,QAAME,gBAAgB,GACrB,yBAAY,cAAZ,KAAgCH,gBAAgB,CAAEH,KAAK,CAACI,IAAR,EAAc,OAAd,CADjD;AAGA,QAAMG,gBAAgB,GACrB,yBAAY,cAAZ,KAAgCJ,gBAAgB,CAAEH,KAAK,CAACI,IAAR,EAAc,OAAd,CADjD;AAGA,QAAMI,UAAU,GAAG,CAClB,CAAEN,gBADgB,EAElB,CAAEG,iBAFgB,EAGlB,CAAEC,gBAHgB,EAIlB,CAAEC,gBAJgB,EAKjBE,KALiB,CAKVC,OALU,CAAnB;;AAOA,MAAKF,UAAL,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,QAAMG,qBAAqB,GAAG,6BAAiBX,KAAK,CAACI,IAAvB,EAA6B,CAC1DN,kBAD0D,EAE1D,+BAF0D,CAA7B,CAA9B;;AAKA,QAAMc,oBAAoB,GAAG,UAC5BC,eAD4B;AAAA,QAE5BC,kBAF4B,uEAEP,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AAC,EACPG,OAAO,SAAP,IAAAA,OAAO,WAAP,IAAAA,OAAO,CAAEP,KAAT,IACAO,OADA,aACAA,OADA,eACAA,OAAO,CAAEL,MADT,IAEAK,OAFA,aAEAA,OAFA,eAEAA,OAAO,CAAER,KAFT,IAGAQ,OAHA,aAGAA,OAHA,eAGAA,OAAO,CAAEX,KAJF,CAAR;AAMA;;AAED,SAAO,CAAC,EAAEW,OAAF,aAAEA,OAAF,eAAEA,OAAO,CAAIH,OAAJ,CAAT,CAAR;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,uBAAT,CAAkCC,SAAlC,EAA8C;AACpD,QAAMF,OAAO,GAAG,6BAAiBE,SAAjB,EAA4B/B,kBAA5B,CAAhB;AAEA,SAAO6B,OAAP,aAAOA,OAAP,uBAAOA,OAAO,CAAEG,+BAAhB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,qBAAT,CAAgCf,KAAhC,EAAuCgB,SAAvC,EAAmD;AACzD,SAAO,6BAAkB,EACxB,GAAGhB,KADqB;AAExBC,IAAAA,MAAM,EAAE,EACP,IAAGD,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEC,MAAV,CADO;AAEP,OAAEe,SAAF,GAAed;AAFR;AAFgB,GAAlB,CAAP;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';\nimport { Platform } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBorderColorEdit,\n\thasBorderColorValue,\n\tresetBorderColor,\n} from './border-color';\nimport {\n\tBorderRadiusEdit,\n\thasBorderRadiusValue,\n\tresetBorderRadius,\n} from './border-radius';\nimport {\n\tBorderStyleEdit,\n\thasBorderStyleValue,\n\tresetBorderStyle,\n} from './border-style';\nimport {\n\tBorderWidthEdit,\n\thasBorderWidthValue,\n\tresetBorderWidth,\n} from './border-width';\nimport InspectorControls from '../components/inspector-controls';\nimport useSetting from '../components/use-setting';\nimport { cleanEmptyObject } from './utils';\n\nexport const BORDER_SUPPORT_KEY = '__experimentalBorder';\n\nexport function BorderPanel( props ) {\n\tconst { clientId } = props;\n\n\tconst isColorSupported =\n\t\tuseSetting( 'border.color' ) && hasBorderSupport( props.name, 'color' );\n\n\tconst isRadiusSupported =\n\t\tuseSetting( 'border.radius' ) &&\n\t\thasBorderSupport( props.name, 'radius' );\n\n\tconst isStyleSupported =\n\t\tuseSetting( 'border.style' ) && hasBorderSupport( props.name, 'style' );\n\n\tconst isWidthSupported =\n\t\tuseSetting( 'border.width' ) && hasBorderSupport( props.name, 'width' );\n\n\tconst isDisabled = [\n\t\t! isColorSupported,\n\t\t! isRadiusSupported,\n\t\t! isStyleSupported,\n\t\t! isWidthSupported,\n\t].every( Boolean );\n\n\tif ( isDisabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultBorderControls = getBlockSupport( props.name, [\n\t\tBORDER_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst createResetAllFilter = (\n\t\tborderAttribute,\n\t\ttopLevelAttributes = {}\n\t) => ( newAttributes ) => ( {\n\t\t...newAttributes,\n\t\t...topLevelAttributes,\n\t\tstyle: {\n\t\t\t...newAttributes.style,\n\t\t\tborder: {\n\t\t\t\t...newAttributes.style?.border,\n\t\t\t\t[ borderAttribute ]: undefined,\n\t\t\t},\n\t\t},\n\t} );\n\n\treturn (\n\t\t<InspectorControls __experimentalGroup=\"border\">\n\t\t\t{ isWidthSupported && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasBorderWidthValue( props ) }\n\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\tonDeselect={ () => resetBorderWidth( props ) }\n\t\t\t\t\tisShownByDefault={ defaultBorderControls?.width }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'width' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<BorderWidthEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ isStyleSupported && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasBorderStyleValue( props ) }\n\t\t\t\t\tlabel={ __( 'Style' ) }\n\t\t\t\t\tonDeselect={ () => resetBorderStyle( props ) }\n\t\t\t\t\tisShownByDefault={ defaultBorderControls?.style }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'style' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<BorderStyleEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ isColorSupported && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasBorderColorValue( props ) }\n\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\tonDeselect={ () => resetBorderColor( props ) }\n\t\t\t\t\tisShownByDefault={ defaultBorderControls?.color }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'color', {\n\t\t\t\t\t\tborderColor: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<BorderColorEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ isRadiusSupported && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasBorderRadiusValue( props ) }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\tonDeselect={ () => resetBorderRadius( props ) }\n\t\t\t\t\tisShownByDefault={ defaultBorderControls?.radius }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'radius' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n\n/**\n * Determine whether there is block support for border properties.\n *\n * @param {string} blockName Block name.\n * @param {string} feature Border feature to check support for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasBorderSupport( blockName, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( blockName, BORDER_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn !! (\n\t\t\tsupport?.color ||\n\t\t\tsupport?.radius ||\n\t\t\tsupport?.width ||\n\t\t\tsupport?.style\n\t\t);\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\n/**\n * Check whether serialization of border classes and styles should be skipped.\n *\n * @param {string|Object} blockType Block name or block type object.\n *\n * @return {boolean} Whether serialization of border properties should occur.\n */\nexport function shouldSkipSerialization( blockType ) {\n\tconst support = getBlockSupport( blockType, BORDER_SUPPORT_KEY );\n\n\treturn support?.__experimentalSkipSerialization;\n}\n\n/**\n * Returns a new style object where the specified border attribute has been\n * removed.\n *\n * @param {Object} style Styles from block attributes.\n * @param {string} attribute The border style attribute to clear.\n *\n * @return {Object} Style object with the specified attribute removed.\n */\nexport function removeBorderAttribute( style, attribute ) {\n\treturn cleanEmptyObject( {\n\t\t...style,\n\t\tborder: {\n\t\t\t...style?.border,\n\t\t\t[ attribute ]: undefined,\n\t\t},\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/border.js"],"names":["BORDER_SUPPORT_KEY","BorderPanel","props","clientId","isColorSupported","hasBorderSupport","name","isRadiusSupported","isStyleSupported","isWidthSupported","isDisabled","every","Boolean","defaultBorderControls","createResetAllFilter","borderAttribute","topLevelAttributes","newAttributes","style","border","undefined","width","color","borderColor","radius","blockName","feature","Platform","OS","support","removeBorderAttribute","attribute"],"mappings":";;;;;;;;;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AO,CAAEX,KAJF,CAAR;AAMA;;AAED,SAAO,CAAC,EAAEW,OAAF,aAAEA,OAAF,eAAEA,OAAO,CAAIH,OAAJ,CAAT,CAAR;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,qBAAT,CAAgCZ,KAAhC,EAAuCa,SAAvC,EAAmD;AACzD,SAAO,6BAAkB,EACxB,GAAGb,KADqB;AAExBC,IAAAA,MAAM,EAAE,EACP,IAAGD,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEC,MAAV,CADO;AAEP,OAAEY,SAAF,GAAeX;AAFR;AAFgB,GAAlB,CAAP;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';\nimport { Platform } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBorderColorEdit,\n\thasBorderColorValue,\n\tresetBorderColor,\n} from './border-color';\nimport {\n\tBorderRadiusEdit,\n\thasBorderRadiusValue,\n\tresetBorderRadius,\n} from './border-radius';\nimport {\n\tBorderStyleEdit,\n\thasBorderStyleValue,\n\tresetBorderStyle,\n} from './border-style';\nimport {\n\tBorderWidthEdit,\n\thasBorderWidthValue,\n\tresetBorderWidth,\n} from './border-width';\nimport InspectorControls from '../components/inspector-controls';\nimport useSetting from '../components/use-setting';\nimport { cleanEmptyObject } from './utils';\n\nexport const BORDER_SUPPORT_KEY = '__experimentalBorder';\n\nexport function BorderPanel( props ) {\n\tconst { clientId } = props;\n\n\tconst isColorSupported =\n\t\tuseSetting( 'border.color' ) && hasBorderSupport( props.name, 'color' );\n\n\tconst isRadiusSupported =\n\t\tuseSetting( 'border.radius' ) &&\n\t\thasBorderSupport( props.name, 'radius' );\n\n\tconst isStyleSupported =\n\t\tuseSetting( 'border.style' ) && hasBorderSupport( props.name, 'style' );\n\n\tconst isWidthSupported =\n\t\tuseSetting( 'border.width' ) && hasBorderSupport( props.name, 'width' );\n\n\tconst isDisabled = [\n\t\t! isColorSupported,\n\t\t! isRadiusSupported,\n\t\t! isStyleSupported,\n\t\t! isWidthSupported,\n\t].every( Boolean );\n\n\tif ( isDisabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultBorderControls = getBlockSupport( props.name, [\n\t\tBORDER_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst createResetAllFilter = (\n\t\tborderAttribute,\n\t\ttopLevelAttributes = {}\n\t) => ( newAttributes ) => ( {\n\t\t...newAttributes,\n\t\t...topLevelAttributes,\n\t\tstyle: {\n\t\t\t...newAttributes.style,\n\t\t\tborder: {\n\t\t\t\t...newAttributes.style?.border,\n\t\t\t\t[ borderAttribute ]: undefined,\n\t\t\t},\n\t\t},\n\t} );\n\n\treturn (\n\t\t<InspectorControls __experimentalGroup=\"border\">\n\t\t\t{ isWidthSupported && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasBorderWidthValue( props ) }\n\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\tonDeselect={ () => resetBorderWidth( props ) }\n\t\t\t\t\tisShownByDefault={ defaultBorderControls?.width }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'width' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<BorderWidthEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ isStyleSupported && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasBorderStyleValue( props ) }\n\t\t\t\t\tlabel={ __( 'Style' ) }\n\t\t\t\t\tonDeselect={ () => resetBorderStyle( props ) }\n\t\t\t\t\tisShownByDefault={ defaultBorderControls?.style }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'style' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<BorderStyleEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ isColorSupported && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasBorderColorValue( props ) }\n\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\tonDeselect={ () => resetBorderColor( props ) }\n\t\t\t\t\tisShownByDefault={ defaultBorderControls?.color }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'color', {\n\t\t\t\t\t\tborderColor: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<BorderColorEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ isRadiusSupported && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasBorderRadiusValue( props ) }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\tonDeselect={ () => resetBorderRadius( props ) }\n\t\t\t\t\tisShownByDefault={ defaultBorderControls?.radius }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'radius' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n\n/**\n * Determine whether there is block support for border properties.\n *\n * @param {string} blockName Block name.\n * @param {string} feature Border feature to check support for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasBorderSupport( blockName, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( blockName, BORDER_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn !! (\n\t\t\tsupport?.color ||\n\t\t\tsupport?.radius ||\n\t\t\tsupport?.width ||\n\t\t\tsupport?.style\n\t\t);\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\n/**\n * Returns a new style object where the specified border attribute has been\n * removed.\n *\n * @param {Object} style Styles from block attributes.\n * @param {string} attribute The border style attribute to clear.\n *\n * @return {Object} Style object with the specified attribute removed.\n */\nexport function removeBorderAttribute( style, attribute ) {\n\treturn cleanEmptyObject( {\n\t\t...style,\n\t\tborder: {\n\t\t\t...style?.border,\n\t\t\t[ attribute ]: undefined,\n\t\t},\n\t} );\n}\n"]}
@@ -57,11 +57,6 @@ const hasColorSupport = blockType => {
57
57
  return colorSupport && (colorSupport.link === true || colorSupport.gradient === true || colorSupport.background !== false || colorSupport.text !== false);
58
58
  };
59
59
 
60
- const shouldSkipSerialization = blockType => {
61
- const colorSupport = (0, _blocks.getBlockSupport)(blockType, COLOR_SUPPORT_KEY);
62
- return colorSupport === null || colorSupport === void 0 ? void 0 : colorSupport.__experimentalSkipSerialization;
63
- };
64
-
65
60
  const hasLinkColorSupport = blockType => {
66
61
  if (_element.Platform.OS !== 'web') {
67
62
  return false;
@@ -278,7 +273,7 @@ function addAttributes(settings) {
278
273
  function addSaveProps(props, blockType, attributes) {
279
274
  var _style$color, _style$color2, _style$color3, _style$color4, _style$elements, _style$elements$link;
280
275
 
281
- if (!hasColorSupport(blockType) || shouldSkipSerialization(blockType)) {
276
+ if (!hasColorSupport(blockType) || (0, _utils.shouldSkipSerialization)(blockType, COLOR_SUPPORT_KEY)) {
282
277
  return props;
283
278
  }
284
279
 
@@ -290,15 +285,23 @@ function addSaveProps(props, blockType, attributes) {
290
285
  gradient,
291
286
  style
292
287
  } = attributes;
293
- const backgroundClass = (0, _colors.getColorClassName)('background-color', backgroundColor);
294
- const gradientClass = (0, _gradients.__experimentalGetGradientClass)(gradient);
295
- const textClass = (0, _colors.getColorClassName)('color', textColor);
288
+
289
+ const shouldSerialize = feature => !(0, _utils.shouldSkipSerialization)(blockType, COLOR_SUPPORT_KEY, feature); // Primary color classes must come before the `has-text-color`,
290
+ // `has-background` and `has-link-color` classes to maintain backwards
291
+ // compatibility and avoid block invalidations.
292
+
293
+
294
+ const textClass = shouldSerialize('text') ? (0, _colors.getColorClassName)('color', textColor) : undefined;
295
+ const gradientClass = shouldSerialize('gradients') ? (0, _gradients.__experimentalGetGradientClass)(gradient) : undefined;
296
+ const backgroundClass = shouldSerialize('background') ? (0, _colors.getColorClassName)('background-color', backgroundColor) : undefined;
297
+ const serializeHasBackground = shouldSerialize('background') || shouldSerialize('gradients');
298
+ const hasBackground = backgroundColor || (style === null || style === void 0 ? void 0 : (_style$color = style.color) === null || _style$color === void 0 ? void 0 : _style$color.background) || hasGradient && (gradient || (style === null || style === void 0 ? void 0 : (_style$color2 = style.color) === null || _style$color2 === void 0 ? void 0 : _style$color2.gradient));
296
299
  const newClassName = (0, _classnames.default)(props.className, textClass, gradientClass, {
297
300
  // Don't apply the background class if there's a custom gradient.
298
- [backgroundClass]: (!hasGradient || !(style !== null && style !== void 0 && (_style$color = style.color) !== null && _style$color !== void 0 && _style$color.gradient)) && !!backgroundClass,
299
- 'has-text-color': textColor || (style === null || style === void 0 ? void 0 : (_style$color2 = style.color) === null || _style$color2 === void 0 ? void 0 : _style$color2.text),
300
- 'has-background': backgroundColor || (style === null || style === void 0 ? void 0 : (_style$color3 = style.color) === null || _style$color3 === void 0 ? void 0 : _style$color3.background) || hasGradient && (gradient || (style === null || style === void 0 ? void 0 : (_style$color4 = style.color) === null || _style$color4 === void 0 ? void 0 : _style$color4.gradient)),
301
- 'has-link-color': style === null || style === void 0 ? void 0 : (_style$elements = style.elements) === null || _style$elements === void 0 ? void 0 : (_style$elements$link = _style$elements.link) === null || _style$elements$link === void 0 ? void 0 : _style$elements$link.color
301
+ [backgroundClass]: (!hasGradient || !(style !== null && style !== void 0 && (_style$color3 = style.color) !== null && _style$color3 !== void 0 && _style$color3.gradient)) && !!backgroundClass,
302
+ 'has-text-color': shouldSerialize('text') && (textColor || (style === null || style === void 0 ? void 0 : (_style$color4 = style.color) === null || _style$color4 === void 0 ? void 0 : _style$color4.text)),
303
+ 'has-background': serializeHasBackground && hasBackground,
304
+ 'has-link-color': shouldSerialize('link') && (style === null || style === void 0 ? void 0 : (_style$elements = style.elements) === null || _style$elements === void 0 ? void 0 : (_style$elements$link = _style$elements.link) === null || _style$elements$link === void 0 ? void 0 : _style$elements$link.color)
302
305
  });
303
306
  props.className = newClassName ? newClassName : undefined;
304
307
  return props;
@@ -314,7 +317,7 @@ function addSaveProps(props, blockType, attributes) {
314
317
 
315
318
 
316
319
  function addEditProps(settings) {
317
- if (!hasColorSupport(settings) || shouldSkipSerialization(settings)) {
320
+ if (!hasColorSupport(settings) || (0, _utils.shouldSkipSerialization)(settings, COLOR_SUPPORT_KEY)) {
318
321
  return settings;
319
322
  }
320
323
 
@@ -542,19 +545,19 @@ const withColorPaletteStyles = (0, _compose.createHigherOrderComponent)(BlockLis
542
545
  const defaultPalette = (0, _useSetting.default)('color.palette.default') || [];
543
546
  const colors = (0, _element.useMemo)(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]);
544
547
 
545
- if (!hasColorSupport(name) || shouldSkipSerialization(name)) {
548
+ if (!hasColorSupport(name) || (0, _utils.shouldSkipSerialization)(name, COLOR_SUPPORT_KEY)) {
546
549
  return (0, _element.createElement)(BlockListBlock, props);
547
550
  }
548
551
 
549
552
  const extraStyles = {};
550
553
 
551
- if (textColor) {
554
+ if (textColor && !(0, _utils.shouldSkipSerialization)(name, COLOR_SUPPORT_KEY, 'text')) {
552
555
  var _getColorObjectByAttr;
553
556
 
554
557
  extraStyles.color = (_getColorObjectByAttr = (0, _colors.getColorObjectByAttributeValues)(colors, textColor)) === null || _getColorObjectByAttr === void 0 ? void 0 : _getColorObjectByAttr.color;
555
558
  }
556
559
 
557
- if (backgroundColor) {
560
+ if (backgroundColor && !(0, _utils.shouldSkipSerialization)(name, COLOR_SUPPORT_KEY, 'background')) {
558
561
  var _getColorObjectByAttr2;
559
562
 
560
563
  extraStyles.backgroundColor = (_getColorObjectByAttr2 = (0, _colors.getColorObjectByAttributeValues)(colors, backgroundColor)) === null || _getColorObjectByAttr2 === void 0 ? void 0 : _getColorObjectByAttr2.color;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/color.js"],"names":["COLOR_SUPPORT_KEY","hasColorSupport","blockType","colorSupport","link","gradient","background","text","shouldSkipSerialization","__experimentalSkipSerialization","hasLinkColorSupport","Platform","OS","hasGradientSupport","gradients","hasBackgroundColorSupport","hasTextColorSupport","hasColor","name","props","attributes","backgroundColor","style","color","elements","clearColorFromStyles","path","undefined","resetTextColor","setAttributes","textColor","resetAllTextFilter","resetLinkColor","resetAllLinkFilter","clearBackgroundAndGradient","resetBackgroundAndGradient","addAttributes","settings","Object","assign","type","addSaveProps","hasGradient","backgroundClass","gradientClass","textClass","newClassName","className","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","getLinkColorFromAttributeValue","colors","value","attributeParsed","exec","ColorEdit","blockName","userPalette","themePalette","defaultPalette","allSolids","userGradientPalette","themeGradientPalette","defaultGradientPalette","allGradients","areCustomSolidsEnabled","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","solidsEnabled","length","gradientsEnabled","localAttributes","current","hasLinkColor","hasTextColor","hasBackgroundColor","hasGradientColor","gradientValue","onChangeColor","colorObject","attributeName","newStyle","slug","newNamedColor","newAttributes","onChangeGradient","onChangeLinkColor","newLinkColorValue","enableContrastChecking","defaultColorControls","clientId","label","onColorChange","colorValue","isShownByDefault","hasValue","onDeselect","resetAllFilter","onGradientChange","clearable","withColorPaletteStyles","BlockListBlock","extraStyles","wrapperProps","MIGRATION_PATHS","linkColor","addTransforms","result","source","index","results","destinationBlockType","activeSupports"],"mappings":";;;;;;;;;;;;;;AAYA;;;;AATA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AAKA;;AAKA;;AAKA;;AACA;;AACA;;AA9BA;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,EAINC,MAJM,EAKNC,KALM,EAMNC,OANM,CAAP;AAQA;;AAED,sBACC,0BADD,EAEC,yBAFD,EAGC7E,aAHD;AAMA,sBACC,kCADD,EAEC,yBAFD,EAGCK,YAHD;AAMA,sBACC,0BADD,EAEC,yBAFD,EAGCO,YAHD;AAMA,sBACC,uBADD,EAEC,sCAFD,EAGCuD,sBAHD;AAMA,sBACC,2CADD,EAEC,0BAFD,EAGCM,aAHD","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { isObject } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useEffect, useMemo, Platform } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n} from '../components/colors';\nimport {\n\t__experimentalGetGradientClass,\n\tgetGradientValueBySlug,\n\tgetGradientSlugByValue,\n} from '../components/gradients';\nimport { cleanEmptyObject, transformStyles, immutableSet } from './utils';\nimport ColorPanel from './color-panel';\nimport useSetting from '../components/use-setting';\n\nexport const COLOR_SUPPORT_KEY = 'color';\n\nconst hasColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\treturn (\n\t\tcolorSupport &&\n\t\t( colorSupport.link === true ||\n\t\t\tcolorSupport.gradient === true ||\n\t\t\tcolorSupport.background !== false ||\n\t\t\tcolorSupport.text !== false )\n\t);\n};\n\nconst shouldSkipSerialization = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport?.__experimentalSkipSerialization;\n};\n\nconst hasLinkColorSupport = ( blockType ) => {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn isObject( colorSupport ) && !! colorSupport.link;\n};\n\nconst hasGradientSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn isObject( colorSupport ) && !! colorSupport.gradients;\n};\n\nconst hasBackgroundColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.background !== false;\n};\n\nconst hasTextColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.text !== false;\n};\n\n/**\n * Checks whether a color has been set either with a named preset color in\n * a top level block attribute or as a custom value within the style attribute\n * object.\n *\n * @param {string} name Name of the color to check.\n * @return {boolean} Whether or not a color has a value.\n */\nconst hasColor = ( name ) => ( props ) => {\n\tif ( name === 'background' ) {\n\t\treturn (\n\t\t\t!! props.attributes.backgroundColor ||\n\t\t\t!! props.attributes.style?.color?.background ||\n\t\t\t!! props.attributes.gradient ||\n\t\t\t!! props.attributes.style?.color?.gradient\n\t\t);\n\t}\n\n\tif ( name === 'link' ) {\n\t\treturn !! props.attributes.style?.elements?.link?.color?.text;\n\t}\n\n\treturn (\n\t\t!! props.attributes[ `${ name }Color` ] ||\n\t\t!! props.attributes.style?.color?.[ name ]\n\t);\n};\n\n/**\n * Clears a single color property from a style object.\n *\n * @param {Array} path Path to color property to clear within styles object.\n * @param {Object} style Block attributes style object.\n * @return {Object} Styles with the color property omitted.\n */\nconst clearColorFromStyles = ( path, style ) =>\n\tcleanEmptyObject( immutableSet( style, path, undefined ) );\n\n/**\n * Resets the block attributes for text color.\n *\n * @param {Object} props Current block props.\n * @param {Object} props.attributes Block attributes.\n * @param {Function} props.setAttributes Block's setAttributes prop used to apply reset.\n */\nconst resetTextColor = ( { attributes, setAttributes } ) => {\n\tsetAttributes( {\n\t\ttextColor: undefined,\n\t\tstyle: clearColorFromStyles( [ 'color', 'text' ], attributes.style ),\n\t} );\n};\n\n/**\n * Clears text color related properties from supplied attributes.\n *\n * @param {Object} attributes Block attributes.\n * @return {Object} Update block attributes with text color properties omitted.\n */\nconst resetAllTextFilter = ( attributes ) => ( {\n\ttextColor: undefined,\n\tstyle: clearColorFromStyles( [ 'color', 'text' ], attributes.style ),\n} );\n\n/**\n * Resets the block attributes for link color.\n *\n * @param {Object} props Current block props.\n * @param {Object} props.attributes Block attributes.\n * @param {Function} props.setAttributes Block's setAttributes prop used to apply reset.\n */\nconst resetLinkColor = ( { attributes, setAttributes } ) => {\n\tconst path = [ 'elements', 'link', 'color', 'text' ];\n\tsetAttributes( { style: clearColorFromStyles( path, attributes.style ) } );\n};\n\n/**\n * Clears link color related properties from supplied attributes.\n *\n * @param {Object} attributes Block attributes.\n * @return {Object} Update block attributes with link color properties omitted.\n */\nconst resetAllLinkFilter = ( attributes ) => ( {\n\tstyle: clearColorFromStyles(\n\t\t[ 'elements', 'link', 'color', 'text' ],\n\t\tattributes.style\n\t),\n} );\n\n/**\n * Clears all background color related properties including gradients from\n * supplied block attributes.\n *\n * @param {Object} attributes Block attributes.\n * @return {Object} Block attributes with background and gradient omitted.\n */\nconst clearBackgroundAndGradient = ( attributes ) => ( {\n\tbackgroundColor: undefined,\n\tgradient: undefined,\n\tstyle: {\n\t\t...attributes.style,\n\t\tcolor: {\n\t\t\t...attributes.style?.color,\n\t\t\tbackground: undefined,\n\t\t\tgradient: undefined,\n\t\t},\n\t},\n} );\n\n/**\n * Resets the block attributes for both background color and gradient.\n *\n * @param {Object} props Current block props.\n * @param {Object} props.attributes Block attributes.\n * @param {Function} props.setAttributes Block's setAttributes prop used to apply reset.\n */\nconst resetBackgroundAndGradient = ( { attributes, setAttributes } ) => {\n\tsetAttributes( clearBackgroundAndGradient( attributes ) );\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * `backgroundColor` and `textColor` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasColorSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.backgroundColor ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tbackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\tif ( ! settings.attributes.textColor ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\ttextColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( hasGradientSupport( settings ) && ! settings.attributes.gradient ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tgradient: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject colors classnames.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( props, blockType, attributes ) {\n\tif (\n\t\t! hasColorSupport( blockType ) ||\n\t\tshouldSkipSerialization( blockType )\n\t) {\n\t\treturn props;\n\t}\n\n\tconst hasGradient = hasGradientSupport( blockType );\n\n\t// I'd have preferred to avoid the \"style\" attribute usage here\n\tconst { backgroundColor, textColor, gradient, style } = attributes;\n\n\tconst backgroundClass = getColorClassName(\n\t\t'background-color',\n\t\tbackgroundColor\n\t);\n\tconst gradientClass = __experimentalGetGradientClass( gradient );\n\tconst textClass = getColorClassName( 'color', textColor );\n\tconst newClassName = classnames(\n\t\tprops.className,\n\t\ttextClass,\n\t\tgradientClass,\n\t\t{\n\t\t\t// Don't apply the background class if there's a custom gradient.\n\t\t\t[ backgroundClass ]:\n\t\t\t\t( ! hasGradient || ! style?.color?.gradient ) &&\n\t\t\t\t!! backgroundClass,\n\t\t\t'has-text-color': textColor || style?.color?.text,\n\t\t\t'has-background':\n\t\t\t\tbackgroundColor ||\n\t\t\t\tstyle?.color?.background ||\n\t\t\t\t( hasGradient && ( gradient || style?.color?.gradient ) ),\n\t\t\t'has-link-color': style?.elements?.link?.color,\n\t\t}\n\t);\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extend the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif (\n\t\t! hasColorSupport( settings ) ||\n\t\tshouldSkipSerialization( settings )\n\t) {\n\t\treturn settings;\n\t}\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\t\treturn addSaveProps( props, settings, attributes );\n\t};\n\n\treturn settings;\n}\n\nconst getLinkColorFromAttributeValue = ( colors, value ) => {\n\tconst attributeParsed = /var:preset\\|color\\|(.+)/.exec( value );\n\tif ( attributeParsed && attributeParsed[ 1 ] ) {\n\t\treturn getColorObjectByAttributeValues( colors, attributeParsed[ 1 ] )\n\t\t\t.color;\n\t}\n\treturn value;\n};\n\n/**\n * Inspector control panel containing the color related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Color edit element.\n */\nexport function ColorEdit( props ) {\n\tconst { name: blockName, attributes } = props;\n\t// Some color settings have a special handling for deprecated flags in `useSetting`,\n\t// so we can't unwrap them by doing const { ... } = useSetting('color')\n\t// until https://github.com/WordPress/gutenberg/issues/37094 is fixed.\n\tconst userPalette = useSetting( 'color.palette.custom' );\n\tconst themePalette = useSetting( 'color.palette.theme' );\n\tconst defaultPalette = useSetting( 'color.palette.default' );\n\tconst allSolids = useMemo(\n\t\t() => [\n\t\t\t...( userPalette || [] ),\n\t\t\t...( themePalette || [] ),\n\t\t\t...( defaultPalette || [] ),\n\t\t],\n\t\t[ userPalette, themePalette, defaultPalette ]\n\t);\n\tconst userGradientPalette = useSetting( 'color.gradients.custom' );\n\tconst themeGradientPalette = useSetting( 'color.gradients.theme' );\n\tconst defaultGradientPalette = useSetting( 'color.gradients.default' );\n\tconst allGradients = useMemo(\n\t\t() => [\n\t\t\t...( userGradientPalette || [] ),\n\t\t\t...( themeGradientPalette || [] ),\n\t\t\t...( defaultGradientPalette || [] ),\n\t\t],\n\t\t[ userGradientPalette, themeGradientPalette, defaultGradientPalette ]\n\t);\n\tconst areCustomSolidsEnabled = useSetting( 'color.custom' );\n\tconst areCustomGradientsEnabled = useSetting( 'color.customGradient' );\n\tconst isBackgroundEnabled = useSetting( 'color.background' );\n\tconst isLinkEnabled = useSetting( 'color.link' );\n\tconst isTextEnabled = useSetting( 'color.text' );\n\n\tconst solidsEnabled =\n\t\tareCustomSolidsEnabled || ! themePalette || themePalette?.length > 0;\n\n\tconst gradientsEnabled =\n\t\tareCustomGradientsEnabled ||\n\t\t! themeGradientPalette ||\n\t\tthemeGradientPalette?.length > 0;\n\n\t// Shouldn't be needed but right now the ColorGradientsPanel\n\t// can trigger both onChangeColor and onChangeBackground\n\t// synchronously causing our two callbacks to override changes\n\t// from each other.\n\tconst localAttributes = useRef( attributes );\n\tuseEffect( () => {\n\t\tlocalAttributes.current = attributes;\n\t}, [ attributes ] );\n\n\tif ( ! hasColorSupport( blockName ) ) {\n\t\treturn null;\n\t}\n\n\tconst hasLinkColor =\n\t\thasLinkColorSupport( blockName ) && isLinkEnabled && solidsEnabled;\n\tconst hasTextColor =\n\t\thasTextColorSupport( blockName ) && isTextEnabled && solidsEnabled;\n\tconst hasBackgroundColor =\n\t\thasBackgroundColorSupport( blockName ) &&\n\t\tisBackgroundEnabled &&\n\t\tsolidsEnabled;\n\tconst hasGradientColor =\n\t\thasGradientSupport( blockName ) && gradientsEnabled;\n\n\tif (\n\t\t! hasLinkColor &&\n\t\t! hasTextColor &&\n\t\t! hasBackgroundColor &&\n\t\t! hasGradientColor\n\t) {\n\t\treturn null;\n\t}\n\n\tconst { style, textColor, backgroundColor, gradient } = attributes;\n\tlet gradientValue;\n\tif ( hasGradientColor && gradient ) {\n\t\tgradientValue = getGradientValueBySlug( allGradients, gradient );\n\t} else if ( hasGradientColor ) {\n\t\tgradientValue = style?.color?.gradient;\n\t}\n\n\tconst onChangeColor = ( name ) => ( value ) => {\n\t\tconst colorObject = getColorObjectByColorValue( allSolids, value );\n\t\tconst attributeName = name + 'Color';\n\t\tconst newStyle = {\n\t\t\t...localAttributes.current.style,\n\t\t\tcolor: {\n\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t[ name ]: colorObject?.slug ? undefined : value,\n\t\t\t},\n\t\t};\n\n\t\tconst newNamedColor = colorObject?.slug ? colorObject.slug : undefined;\n\t\tconst newAttributes = {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t[ attributeName ]: newNamedColor,\n\t\t};\n\n\t\tprops.setAttributes( newAttributes );\n\t\tlocalAttributes.current = {\n\t\t\t...localAttributes.current,\n\t\t\t...newAttributes,\n\t\t};\n\t};\n\n\tconst onChangeGradient = ( value ) => {\n\t\tconst slug = getGradientSlugByValue( allGradients, value );\n\t\tlet newAttributes;\n\t\tif ( slug ) {\n\t\t\tconst newStyle = {\n\t\t\t\t...localAttributes.current?.style,\n\t\t\t\tcolor: {\n\t\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t\tgradient: undefined,\n\t\t\t\t},\n\t\t\t};\n\t\t\tnewAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t\tgradient: slug,\n\t\t\t};\n\t\t} else {\n\t\t\tconst newStyle = {\n\t\t\t\t...localAttributes.current?.style,\n\t\t\t\tcolor: {\n\t\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t\tgradient: value,\n\t\t\t\t},\n\t\t\t};\n\t\t\tnewAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t\tgradient: undefined,\n\t\t\t};\n\t\t}\n\t\tprops.setAttributes( newAttributes );\n\t\tlocalAttributes.current = {\n\t\t\t...localAttributes.current,\n\t\t\t...newAttributes,\n\t\t};\n\t};\n\n\tconst onChangeLinkColor = ( value ) => {\n\t\tconst colorObject = getColorObjectByColorValue( allSolids, value );\n\t\tconst newLinkColorValue = colorObject?.slug\n\t\t\t? `var:preset|color|${ colorObject.slug }`\n\t\t\t: value;\n\n\t\tconst newStyle = cleanEmptyObject(\n\t\t\timmutableSet(\n\t\t\t\tstyle,\n\t\t\t\t[ 'elements', 'link', 'color', 'text' ],\n\t\t\t\tnewLinkColorValue\n\t\t\t)\n\t\t);\n\t\tprops.setAttributes( { style: newStyle } );\n\t};\n\n\tconst enableContrastChecking =\n\t\tPlatform.OS === 'web' && ! gradient && ! style?.color?.gradient;\n\n\tconst defaultColorControls = getBlockSupport( props.name, [\n\t\tCOLOR_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\treturn (\n\t\t<ColorPanel\n\t\t\tenableContrastChecking={ enableContrastChecking }\n\t\t\tclientId={ props.clientId }\n\t\t\tenableAlpha={ true }\n\t\t\tsettings={ [\n\t\t\t\t...( hasTextColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Text' ),\n\t\t\t\t\t\t\t\tonColorChange: onChangeColor( 'text' ),\n\t\t\t\t\t\t\t\tcolorValue: getColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\t\tallSolids,\n\t\t\t\t\t\t\t\t\ttextColor,\n\t\t\t\t\t\t\t\t\tstyle?.color?.text\n\t\t\t\t\t\t\t\t).color,\n\t\t\t\t\t\t\t\tisShownByDefault: defaultColorControls?.text,\n\t\t\t\t\t\t\t\thasValue: () => hasColor( 'text' )( props ),\n\t\t\t\t\t\t\t\tonDeselect: () => resetTextColor( props ),\n\t\t\t\t\t\t\t\tresetAllFilter: resetAllTextFilter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t\t...( hasBackgroundColor || hasGradientColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Background' ),\n\t\t\t\t\t\t\t\tonColorChange: hasBackgroundColor\n\t\t\t\t\t\t\t\t\t? onChangeColor( 'background' )\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\tcolorValue: getColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\t\tallSolids,\n\t\t\t\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t\t\t\t\tstyle?.color?.background\n\t\t\t\t\t\t\t\t).color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tonGradientChange: hasGradientColor\n\t\t\t\t\t\t\t\t\t? onChangeGradient\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\tisShownByDefault:\n\t\t\t\t\t\t\t\t\tdefaultColorControls?.background,\n\t\t\t\t\t\t\t\thasValue: () =>\n\t\t\t\t\t\t\t\t\thasColor( 'background' )( props ),\n\t\t\t\t\t\t\t\tonDeselect: () =>\n\t\t\t\t\t\t\t\t\tresetBackgroundAndGradient( props ),\n\t\t\t\t\t\t\t\tresetAllFilter: clearBackgroundAndGradient,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t\t...( hasLinkColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Link' ),\n\t\t\t\t\t\t\t\tonColorChange: onChangeLinkColor,\n\t\t\t\t\t\t\t\tcolorValue: getLinkColorFromAttributeValue(\n\t\t\t\t\t\t\t\t\tallSolids,\n\t\t\t\t\t\t\t\t\tstyle?.elements?.link?.color?.text\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tclearable: !! style?.elements?.link?.color\n\t\t\t\t\t\t\t\t\t?.text,\n\t\t\t\t\t\t\t\tisShownByDefault: defaultColorControls?.link,\n\t\t\t\t\t\t\t\thasValue: () => hasColor( 'link' )( props ),\n\t\t\t\t\t\t\t\tonDeselect: () => resetLinkColor( props ),\n\t\t\t\t\t\t\t\tresetAllFilter: resetAllLinkFilter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t] }\n\t\t/>\n\t);\n}\n\n/**\n * This adds inline styles for color palette colors.\n * Ideally, this is not needed and themes should load their palettes on the editor.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withColorPaletteStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst { backgroundColor, textColor } = attributes;\n\t\tconst userPalette = useSetting( 'color.palette.custom' ) || [];\n\t\tconst themePalette = useSetting( 'color.palette.theme' ) || [];\n\t\tconst defaultPalette = useSetting( 'color.palette.default' ) || [];\n\t\tconst colors = useMemo(\n\t\t\t() => [\n\t\t\t\t...( userPalette || [] ),\n\t\t\t\t...( themePalette || [] ),\n\t\t\t\t...( defaultPalette || [] ),\n\t\t\t],\n\t\t\t[ userPalette, themePalette, defaultPalette ]\n\t\t);\n\t\tif ( ! hasColorSupport( name ) || shouldSkipSerialization( name ) ) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\t\tconst extraStyles = {};\n\n\t\tif ( textColor ) {\n\t\t\textraStyles.color = getColorObjectByAttributeValues(\n\t\t\t\tcolors,\n\t\t\t\ttextColor\n\t\t\t)?.color;\n\t\t}\n\t\tif ( backgroundColor ) {\n\t\t\textraStyles.backgroundColor = getColorObjectByAttributeValues(\n\t\t\t\tcolors,\n\t\t\t\tbackgroundColor\n\t\t\t)?.color;\n\t\t}\n\n\t\tlet wrapperProps = props.wrapperProps;\n\t\twrapperProps = {\n\t\t\t...props.wrapperProps,\n\t\t\tstyle: {\n\t\t\t\t...extraStyles,\n\t\t\t\t...props.wrapperProps?.style,\n\t\t\t},\n\t\t};\n\n\t\treturn <BlockListBlock { ...props } wrapperProps={ wrapperProps } />;\n\t}\n);\n\nconst MIGRATION_PATHS = {\n\tlinkColor: [ [ 'style', 'elements', 'link', 'color', 'text' ] ],\n\ttextColor: [ [ 'textColor' ], [ 'style', 'color', 'text' ] ],\n\tbackgroundColor: [\n\t\t[ 'backgroundColor' ],\n\t\t[ 'style', 'color', 'background' ],\n\t],\n\tgradient: [ [ 'gradient' ], [ 'style', 'color', 'gradient' ] ],\n};\n\nexport function addTransforms( result, source, index, results ) {\n\tconst destinationBlockType = result.name;\n\tconst activeSupports = {\n\t\tlinkColor: hasLinkColorSupport( destinationBlockType ),\n\t\ttextColor: hasTextColorSupport( destinationBlockType ),\n\t\tbackgroundColor: hasBackgroundColorSupport( destinationBlockType ),\n\t\tgradient: hasGradientSupport( destinationBlockType ),\n\t};\n\treturn transformStyles(\n\t\tactiveSupports,\n\t\tMIGRATION_PATHS,\n\t\tresult,\n\t\tsource,\n\t\tindex,\n\t\tresults\n\t);\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/color/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/color/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/color/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/color/with-color-palette-styles',\n\twithColorPaletteStyles\n);\n\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/color/addTransforms',\n\taddTransforms\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/color.js"],"names":["COLOR_SUPPORT_KEY","hasColorSupport","blockType","colorSupport","link","gradient","background","text","hasLinkColorSupport","Platform","OS","hasGradientSupport","gradients","hasBackgroundColorSupport","hasTextColorSupport","hasColor","name","props","attributes","backgroundColor","style","color","elements","clearColorFromStyles","path","undefined","resetTextColor","setAttributes","textColor","resetAllTextFilter","resetLinkColor","resetAllLinkFilter","clearBackgroundAndGradient","resetBackgroundAndGradient","addAttributes","settings","Object","assign","type","addSaveProps","hasGradient","shouldSerialize","feature","textClass","gradientClass","backgroundClass","serializeHasBackground","hasBackground","newClassName","className","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","getLinkColorFromAttributeValue","colors","value","attributeParsed","exec","ColorEdit","blockName","userPalette","themePalette","defaultPalette","allSolids","userGradientPalette","themeGradientPalette","defaultGradientPalette","allGradients","areCustomSolidsEnabled","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","solidsEnabled","length","gradientsEnabled","localAttributes","current","hasLinkColor","hasTextColor","hasBackgroundColor","hasGradientColor","gradientValue","onChangeColor","colorObject","attributeName","newStyle","slug","newNamedColor","newAttributes","onChangeGradient","onChangeLinkColor","newLinkColorValue","enableContrastChecking","defaultColorControls","clientId","label","onColorChange","colorValue","isShownByDefault","hasValue","onDeselect","resetAllFilter","onGradientChange","clearable","withColorPaletteStyles","BlockListBlock","extraStyles","wrapperProps","MIGRATION_PATHS","linkColor","addTransforms","result","source","index","results","destinationBlockType","activeSupports"],"mappings":";;;;;;;;;;;;;;AAYA;;;;AATA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AAKA;;AAKA;;AAKA;;AAMA;;AACA;;AAnCA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;AAoBO,MAAMA,iBAAiB,GAAG,OAA1B;;;AAEP,MAAMC,eAAe,GAAKC,SAAF,IAAiB;AACxC,QAAMC,YAAY,GAAG,6BAAiBD,SAAjB,EAA4BF,iBAA5B,CAArB;AACA,SACCG,YAAY,KACVA,YAAY,CAACC,IAAb,KAAsB,IAAtB,IACDD,YAAY,CAACE,QAAb,KAA0B,IADzB,IAEDF,YAAY,CAACG,UAAb,KAA4B,KAF3B,IAGDH,YAAY,CAACI,IAAb,KAAsB,KAJX,CADb;AAOA,CATD;;AAWA,MAAMC,mBAAmB,GAAKN,SAAF,IAA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,EAENR,eAFM,EAGNG,MAHM,EAINC,MAJM,EAKNC,KALM,EAMNC,OANM,CAAP;AAQA;;AAED,sBACC,0BADD,EAEC,yBAFD,EAGCjF,aAHD;AAMA,sBACC,kCADD,EAEC,yBAFD,EAGCK,YAHD;AAMA,sBACC,0BADD,EAEC,yBAFD,EAGCW,YAHD;AAMA,sBACC,uBADD,EAEC,sCAFD,EAGCuD,sBAHD;AAMA,sBACC,2CADD,EAEC,0BAFD,EAGCM,aAHD","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { isObject } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useEffect, useMemo, Platform } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n} from '../components/colors';\nimport {\n\t__experimentalGetGradientClass,\n\tgetGradientValueBySlug,\n\tgetGradientSlugByValue,\n} from '../components/gradients';\nimport {\n\tcleanEmptyObject,\n\ttransformStyles,\n\timmutableSet,\n\tshouldSkipSerialization,\n} from './utils';\nimport ColorPanel from './color-panel';\nimport useSetting from '../components/use-setting';\n\nexport const COLOR_SUPPORT_KEY = 'color';\n\nconst hasColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\treturn (\n\t\tcolorSupport &&\n\t\t( colorSupport.link === true ||\n\t\t\tcolorSupport.gradient === true ||\n\t\t\tcolorSupport.background !== false ||\n\t\t\tcolorSupport.text !== false )\n\t);\n};\n\nconst hasLinkColorSupport = ( blockType ) => {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn isObject( colorSupport ) && !! colorSupport.link;\n};\n\nconst hasGradientSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn isObject( colorSupport ) && !! colorSupport.gradients;\n};\n\nconst hasBackgroundColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.background !== false;\n};\n\nconst hasTextColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.text !== false;\n};\n\n/**\n * Checks whether a color has been set either with a named preset color in\n * a top level block attribute or as a custom value within the style attribute\n * object.\n *\n * @param {string} name Name of the color to check.\n * @return {boolean} Whether or not a color has a value.\n */\nconst hasColor = ( name ) => ( props ) => {\n\tif ( name === 'background' ) {\n\t\treturn (\n\t\t\t!! props.attributes.backgroundColor ||\n\t\t\t!! props.attributes.style?.color?.background ||\n\t\t\t!! props.attributes.gradient ||\n\t\t\t!! props.attributes.style?.color?.gradient\n\t\t);\n\t}\n\n\tif ( name === 'link' ) {\n\t\treturn !! props.attributes.style?.elements?.link?.color?.text;\n\t}\n\n\treturn (\n\t\t!! props.attributes[ `${ name }Color` ] ||\n\t\t!! props.attributes.style?.color?.[ name ]\n\t);\n};\n\n/**\n * Clears a single color property from a style object.\n *\n * @param {Array} path Path to color property to clear within styles object.\n * @param {Object} style Block attributes style object.\n * @return {Object} Styles with the color property omitted.\n */\nconst clearColorFromStyles = ( path, style ) =>\n\tcleanEmptyObject( immutableSet( style, path, undefined ) );\n\n/**\n * Resets the block attributes for text color.\n *\n * @param {Object} props Current block props.\n * @param {Object} props.attributes Block attributes.\n * @param {Function} props.setAttributes Block's setAttributes prop used to apply reset.\n */\nconst resetTextColor = ( { attributes, setAttributes } ) => {\n\tsetAttributes( {\n\t\ttextColor: undefined,\n\t\tstyle: clearColorFromStyles( [ 'color', 'text' ], attributes.style ),\n\t} );\n};\n\n/**\n * Clears text color related properties from supplied attributes.\n *\n * @param {Object} attributes Block attributes.\n * @return {Object} Update block attributes with text color properties omitted.\n */\nconst resetAllTextFilter = ( attributes ) => ( {\n\ttextColor: undefined,\n\tstyle: clearColorFromStyles( [ 'color', 'text' ], attributes.style ),\n} );\n\n/**\n * Resets the block attributes for link color.\n *\n * @param {Object} props Current block props.\n * @param {Object} props.attributes Block attributes.\n * @param {Function} props.setAttributes Block's setAttributes prop used to apply reset.\n */\nconst resetLinkColor = ( { attributes, setAttributes } ) => {\n\tconst path = [ 'elements', 'link', 'color', 'text' ];\n\tsetAttributes( { style: clearColorFromStyles( path, attributes.style ) } );\n};\n\n/**\n * Clears link color related properties from supplied attributes.\n *\n * @param {Object} attributes Block attributes.\n * @return {Object} Update block attributes with link color properties omitted.\n */\nconst resetAllLinkFilter = ( attributes ) => ( {\n\tstyle: clearColorFromStyles(\n\t\t[ 'elements', 'link', 'color', 'text' ],\n\t\tattributes.style\n\t),\n} );\n\n/**\n * Clears all background color related properties including gradients from\n * supplied block attributes.\n *\n * @param {Object} attributes Block attributes.\n * @return {Object} Block attributes with background and gradient omitted.\n */\nconst clearBackgroundAndGradient = ( attributes ) => ( {\n\tbackgroundColor: undefined,\n\tgradient: undefined,\n\tstyle: {\n\t\t...attributes.style,\n\t\tcolor: {\n\t\t\t...attributes.style?.color,\n\t\t\tbackground: undefined,\n\t\t\tgradient: undefined,\n\t\t},\n\t},\n} );\n\n/**\n * Resets the block attributes for both background color and gradient.\n *\n * @param {Object} props Current block props.\n * @param {Object} props.attributes Block attributes.\n * @param {Function} props.setAttributes Block's setAttributes prop used to apply reset.\n */\nconst resetBackgroundAndGradient = ( { attributes, setAttributes } ) => {\n\tsetAttributes( clearBackgroundAndGradient( attributes ) );\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * `backgroundColor` and `textColor` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasColorSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.backgroundColor ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tbackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\tif ( ! settings.attributes.textColor ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\ttextColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( hasGradientSupport( settings ) && ! settings.attributes.gradient ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tgradient: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject colors classnames.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( props, blockType, attributes ) {\n\tif (\n\t\t! hasColorSupport( blockType ) ||\n\t\tshouldSkipSerialization( blockType, COLOR_SUPPORT_KEY )\n\t) {\n\t\treturn props;\n\t}\n\n\tconst hasGradient = hasGradientSupport( blockType );\n\n\t// I'd have preferred to avoid the \"style\" attribute usage here\n\tconst { backgroundColor, textColor, gradient, style } = attributes;\n\n\tconst shouldSerialize = ( feature ) =>\n\t\t! shouldSkipSerialization( blockType, COLOR_SUPPORT_KEY, feature );\n\n\t// Primary color classes must come before the `has-text-color`,\n\t// `has-background` and `has-link-color` classes to maintain backwards\n\t// compatibility and avoid block invalidations.\n\tconst textClass = shouldSerialize( 'text' )\n\t\t? getColorClassName( 'color', textColor )\n\t\t: undefined;\n\n\tconst gradientClass = shouldSerialize( 'gradients' )\n\t\t? __experimentalGetGradientClass( gradient )\n\t\t: undefined;\n\n\tconst backgroundClass = shouldSerialize( 'background' )\n\t\t? getColorClassName( 'background-color', backgroundColor )\n\t\t: undefined;\n\n\tconst serializeHasBackground =\n\t\tshouldSerialize( 'background' ) || shouldSerialize( 'gradients' );\n\tconst hasBackground =\n\t\tbackgroundColor ||\n\t\tstyle?.color?.background ||\n\t\t( hasGradient && ( gradient || style?.color?.gradient ) );\n\n\tconst newClassName = classnames(\n\t\tprops.className,\n\t\ttextClass,\n\t\tgradientClass,\n\t\t{\n\t\t\t// Don't apply the background class if there's a custom gradient.\n\t\t\t[ backgroundClass ]:\n\t\t\t\t( ! hasGradient || ! style?.color?.gradient ) &&\n\t\t\t\t!! backgroundClass,\n\t\t\t'has-text-color':\n\t\t\t\tshouldSerialize( 'text' ) &&\n\t\t\t\t( textColor || style?.color?.text ),\n\t\t\t'has-background': serializeHasBackground && hasBackground,\n\t\t\t'has-link-color':\n\t\t\t\tshouldSerialize( 'link' ) && style?.elements?.link?.color,\n\t\t}\n\t);\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extend the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif (\n\t\t! hasColorSupport( settings ) ||\n\t\tshouldSkipSerialization( settings, COLOR_SUPPORT_KEY )\n\t) {\n\t\treturn settings;\n\t}\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\t\treturn addSaveProps( props, settings, attributes );\n\t};\n\n\treturn settings;\n}\n\nconst getLinkColorFromAttributeValue = ( colors, value ) => {\n\tconst attributeParsed = /var:preset\\|color\\|(.+)/.exec( value );\n\tif ( attributeParsed && attributeParsed[ 1 ] ) {\n\t\treturn getColorObjectByAttributeValues( colors, attributeParsed[ 1 ] )\n\t\t\t.color;\n\t}\n\treturn value;\n};\n\n/**\n * Inspector control panel containing the color related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Color edit element.\n */\nexport function ColorEdit( props ) {\n\tconst { name: blockName, attributes } = props;\n\t// Some color settings have a special handling for deprecated flags in `useSetting`,\n\t// so we can't unwrap them by doing const { ... } = useSetting('color')\n\t// until https://github.com/WordPress/gutenberg/issues/37094 is fixed.\n\tconst userPalette = useSetting( 'color.palette.custom' );\n\tconst themePalette = useSetting( 'color.palette.theme' );\n\tconst defaultPalette = useSetting( 'color.palette.default' );\n\tconst allSolids = useMemo(\n\t\t() => [\n\t\t\t...( userPalette || [] ),\n\t\t\t...( themePalette || [] ),\n\t\t\t...( defaultPalette || [] ),\n\t\t],\n\t\t[ userPalette, themePalette, defaultPalette ]\n\t);\n\tconst userGradientPalette = useSetting( 'color.gradients.custom' );\n\tconst themeGradientPalette = useSetting( 'color.gradients.theme' );\n\tconst defaultGradientPalette = useSetting( 'color.gradients.default' );\n\tconst allGradients = useMemo(\n\t\t() => [\n\t\t\t...( userGradientPalette || [] ),\n\t\t\t...( themeGradientPalette || [] ),\n\t\t\t...( defaultGradientPalette || [] ),\n\t\t],\n\t\t[ userGradientPalette, themeGradientPalette, defaultGradientPalette ]\n\t);\n\tconst areCustomSolidsEnabled = useSetting( 'color.custom' );\n\tconst areCustomGradientsEnabled = useSetting( 'color.customGradient' );\n\tconst isBackgroundEnabled = useSetting( 'color.background' );\n\tconst isLinkEnabled = useSetting( 'color.link' );\n\tconst isTextEnabled = useSetting( 'color.text' );\n\n\tconst solidsEnabled =\n\t\tareCustomSolidsEnabled || ! themePalette || themePalette?.length > 0;\n\n\tconst gradientsEnabled =\n\t\tareCustomGradientsEnabled ||\n\t\t! themeGradientPalette ||\n\t\tthemeGradientPalette?.length > 0;\n\n\t// Shouldn't be needed but right now the ColorGradientsPanel\n\t// can trigger both onChangeColor and onChangeBackground\n\t// synchronously causing our two callbacks to override changes\n\t// from each other.\n\tconst localAttributes = useRef( attributes );\n\tuseEffect( () => {\n\t\tlocalAttributes.current = attributes;\n\t}, [ attributes ] );\n\n\tif ( ! hasColorSupport( blockName ) ) {\n\t\treturn null;\n\t}\n\n\tconst hasLinkColor =\n\t\thasLinkColorSupport( blockName ) && isLinkEnabled && solidsEnabled;\n\tconst hasTextColor =\n\t\thasTextColorSupport( blockName ) && isTextEnabled && solidsEnabled;\n\tconst hasBackgroundColor =\n\t\thasBackgroundColorSupport( blockName ) &&\n\t\tisBackgroundEnabled &&\n\t\tsolidsEnabled;\n\tconst hasGradientColor =\n\t\thasGradientSupport( blockName ) && gradientsEnabled;\n\n\tif (\n\t\t! hasLinkColor &&\n\t\t! hasTextColor &&\n\t\t! hasBackgroundColor &&\n\t\t! hasGradientColor\n\t) {\n\t\treturn null;\n\t}\n\n\tconst { style, textColor, backgroundColor, gradient } = attributes;\n\tlet gradientValue;\n\tif ( hasGradientColor && gradient ) {\n\t\tgradientValue = getGradientValueBySlug( allGradients, gradient );\n\t} else if ( hasGradientColor ) {\n\t\tgradientValue = style?.color?.gradient;\n\t}\n\n\tconst onChangeColor = ( name ) => ( value ) => {\n\t\tconst colorObject = getColorObjectByColorValue( allSolids, value );\n\t\tconst attributeName = name + 'Color';\n\t\tconst newStyle = {\n\t\t\t...localAttributes.current.style,\n\t\t\tcolor: {\n\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t[ name ]: colorObject?.slug ? undefined : value,\n\t\t\t},\n\t\t};\n\n\t\tconst newNamedColor = colorObject?.slug ? colorObject.slug : undefined;\n\t\tconst newAttributes = {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t[ attributeName ]: newNamedColor,\n\t\t};\n\n\t\tprops.setAttributes( newAttributes );\n\t\tlocalAttributes.current = {\n\t\t\t...localAttributes.current,\n\t\t\t...newAttributes,\n\t\t};\n\t};\n\n\tconst onChangeGradient = ( value ) => {\n\t\tconst slug = getGradientSlugByValue( allGradients, value );\n\t\tlet newAttributes;\n\t\tif ( slug ) {\n\t\t\tconst newStyle = {\n\t\t\t\t...localAttributes.current?.style,\n\t\t\t\tcolor: {\n\t\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t\tgradient: undefined,\n\t\t\t\t},\n\t\t\t};\n\t\t\tnewAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t\tgradient: slug,\n\t\t\t};\n\t\t} else {\n\t\t\tconst newStyle = {\n\t\t\t\t...localAttributes.current?.style,\n\t\t\t\tcolor: {\n\t\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t\tgradient: value,\n\t\t\t\t},\n\t\t\t};\n\t\t\tnewAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t\tgradient: undefined,\n\t\t\t};\n\t\t}\n\t\tprops.setAttributes( newAttributes );\n\t\tlocalAttributes.current = {\n\t\t\t...localAttributes.current,\n\t\t\t...newAttributes,\n\t\t};\n\t};\n\n\tconst onChangeLinkColor = ( value ) => {\n\t\tconst colorObject = getColorObjectByColorValue( allSolids, value );\n\t\tconst newLinkColorValue = colorObject?.slug\n\t\t\t? `var:preset|color|${ colorObject.slug }`\n\t\t\t: value;\n\n\t\tconst newStyle = cleanEmptyObject(\n\t\t\timmutableSet(\n\t\t\t\tstyle,\n\t\t\t\t[ 'elements', 'link', 'color', 'text' ],\n\t\t\t\tnewLinkColorValue\n\t\t\t)\n\t\t);\n\t\tprops.setAttributes( { style: newStyle } );\n\t};\n\n\tconst enableContrastChecking =\n\t\tPlatform.OS === 'web' && ! gradient && ! style?.color?.gradient;\n\n\tconst defaultColorControls = getBlockSupport( props.name, [\n\t\tCOLOR_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\treturn (\n\t\t<ColorPanel\n\t\t\tenableContrastChecking={ enableContrastChecking }\n\t\t\tclientId={ props.clientId }\n\t\t\tenableAlpha={ true }\n\t\t\tsettings={ [\n\t\t\t\t...( hasTextColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Text' ),\n\t\t\t\t\t\t\t\tonColorChange: onChangeColor( 'text' ),\n\t\t\t\t\t\t\t\tcolorValue: getColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\t\tallSolids,\n\t\t\t\t\t\t\t\t\ttextColor,\n\t\t\t\t\t\t\t\t\tstyle?.color?.text\n\t\t\t\t\t\t\t\t).color,\n\t\t\t\t\t\t\t\tisShownByDefault: defaultColorControls?.text,\n\t\t\t\t\t\t\t\thasValue: () => hasColor( 'text' )( props ),\n\t\t\t\t\t\t\t\tonDeselect: () => resetTextColor( props ),\n\t\t\t\t\t\t\t\tresetAllFilter: resetAllTextFilter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t\t...( hasBackgroundColor || hasGradientColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Background' ),\n\t\t\t\t\t\t\t\tonColorChange: hasBackgroundColor\n\t\t\t\t\t\t\t\t\t? onChangeColor( 'background' )\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\tcolorValue: getColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\t\tallSolids,\n\t\t\t\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t\t\t\t\tstyle?.color?.background\n\t\t\t\t\t\t\t\t).color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tonGradientChange: hasGradientColor\n\t\t\t\t\t\t\t\t\t? onChangeGradient\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\tisShownByDefault:\n\t\t\t\t\t\t\t\t\tdefaultColorControls?.background,\n\t\t\t\t\t\t\t\thasValue: () =>\n\t\t\t\t\t\t\t\t\thasColor( 'background' )( props ),\n\t\t\t\t\t\t\t\tonDeselect: () =>\n\t\t\t\t\t\t\t\t\tresetBackgroundAndGradient( props ),\n\t\t\t\t\t\t\t\tresetAllFilter: clearBackgroundAndGradient,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t\t...( hasLinkColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Link' ),\n\t\t\t\t\t\t\t\tonColorChange: onChangeLinkColor,\n\t\t\t\t\t\t\t\tcolorValue: getLinkColorFromAttributeValue(\n\t\t\t\t\t\t\t\t\tallSolids,\n\t\t\t\t\t\t\t\t\tstyle?.elements?.link?.color?.text\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tclearable: !! style?.elements?.link?.color\n\t\t\t\t\t\t\t\t\t?.text,\n\t\t\t\t\t\t\t\tisShownByDefault: defaultColorControls?.link,\n\t\t\t\t\t\t\t\thasValue: () => hasColor( 'link' )( props ),\n\t\t\t\t\t\t\t\tonDeselect: () => resetLinkColor( props ),\n\t\t\t\t\t\t\t\tresetAllFilter: resetAllLinkFilter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t] }\n\t\t/>\n\t);\n}\n\n/**\n * This adds inline styles for color palette colors.\n * Ideally, this is not needed and themes should load their palettes on the editor.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withColorPaletteStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst { backgroundColor, textColor } = attributes;\n\t\tconst userPalette = useSetting( 'color.palette.custom' ) || [];\n\t\tconst themePalette = useSetting( 'color.palette.theme' ) || [];\n\t\tconst defaultPalette = useSetting( 'color.palette.default' ) || [];\n\t\tconst colors = useMemo(\n\t\t\t() => [\n\t\t\t\t...( userPalette || [] ),\n\t\t\t\t...( themePalette || [] ),\n\t\t\t\t...( defaultPalette || [] ),\n\t\t\t],\n\t\t\t[ userPalette, themePalette, defaultPalette ]\n\t\t);\n\t\tif (\n\t\t\t! hasColorSupport( name ) ||\n\t\t\tshouldSkipSerialization( name, COLOR_SUPPORT_KEY )\n\t\t) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\t\tconst extraStyles = {};\n\n\t\tif (\n\t\t\ttextColor &&\n\t\t\t! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'text' )\n\t\t) {\n\t\t\textraStyles.color = getColorObjectByAttributeValues(\n\t\t\t\tcolors,\n\t\t\t\ttextColor\n\t\t\t)?.color;\n\t\t}\n\t\tif (\n\t\t\tbackgroundColor &&\n\t\t\t! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'background' )\n\t\t) {\n\t\t\textraStyles.backgroundColor = getColorObjectByAttributeValues(\n\t\t\t\tcolors,\n\t\t\t\tbackgroundColor\n\t\t\t)?.color;\n\t\t}\n\n\t\tlet wrapperProps = props.wrapperProps;\n\t\twrapperProps = {\n\t\t\t...props.wrapperProps,\n\t\t\tstyle: {\n\t\t\t\t...extraStyles,\n\t\t\t\t...props.wrapperProps?.style,\n\t\t\t},\n\t\t};\n\n\t\treturn <BlockListBlock { ...props } wrapperProps={ wrapperProps } />;\n\t}\n);\n\nconst MIGRATION_PATHS = {\n\tlinkColor: [ [ 'style', 'elements', 'link', 'color', 'text' ] ],\n\ttextColor: [ [ 'textColor' ], [ 'style', 'color', 'text' ] ],\n\tbackgroundColor: [\n\t\t[ 'backgroundColor' ],\n\t\t[ 'style', 'color', 'background' ],\n\t],\n\tgradient: [ [ 'gradient' ], [ 'style', 'color', 'gradient' ] ],\n};\n\nexport function addTransforms( result, source, index, results ) {\n\tconst destinationBlockType = result.name;\n\tconst activeSupports = {\n\t\tlinkColor: hasLinkColorSupport( destinationBlockType ),\n\t\ttextColor: hasTextColorSupport( destinationBlockType ),\n\t\tbackgroundColor: hasBackgroundColorSupport( destinationBlockType ),\n\t\tgradient: hasGradientSupport( destinationBlockType ),\n\t};\n\treturn transformStyles(\n\t\tactiveSupports,\n\t\tMIGRATION_PATHS,\n\t\tresult,\n\t\tsource,\n\t\tindex,\n\t\tresults\n\t);\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/color/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/color/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/color/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/color/with-color-palette-styles',\n\twithColorPaletteStyles\n);\n\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/color/addTransforms',\n\taddTransforms\n);\n"]}
@@ -25,6 +25,10 @@ var _useSetting = _interopRequireDefault(require("../components/use-setting"));
25
25
 
26
26
  var _fontFamily = _interopRequireDefault(require("../components/font-family"));
27
27
 
28
+ var _utils = require("./utils");
29
+
30
+ var _typography = require("./typography");
31
+
28
32
  /**
29
33
  * External dependencies
30
34
  */
@@ -78,7 +82,7 @@ function addSaveProps(props, blockType, attributes) {
78
82
  return props;
79
83
  }
80
84
 
81
- if ((0, _blocks.hasBlockSupport)(blockType, 'typography.__experimentalSkipSerialization')) {
85
+ if ((0, _utils.shouldSkipSerialization)(blockType, _typography.TYPOGRAPHY_SUPPORT_KEY, 'fontFamily')) {
82
86
  return props;
83
87
  }
84
88
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/font-family.js"],"names":["FONT_FAMILY_SUPPORT_KEY","addAttributes","settings","attributes","fontFamily","Object","assign","type","addSaveProps","props","blockType","classes","TokenList","className","add","newClassName","value","undefined","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","FontFamilyEdit","setAttributes","fontFamilies","slug","onChange","newValue","predefinedFontFamily","f","useIsFontFamilyDisabled","name","length","hasFontFamilyValue","resetFontFamily"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAIO,MAAMA,uBAAuB,GAAG,qCAAhC;AAEP;AACA;AACA;AAC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A;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,uBAAT,QAA6C;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACnD,QAAMP,YAAY,GAAG,yBAAY,yBAAZ,CAArB;AACA,SACC,CAAEA,YAAF,IACAA,YAAY,CAACQ,MAAb,KAAwB,CADxB,IAEA,CAAE,6BAAiBD,IAAjB,EAAuB9B,uBAAvB,CAHH;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASgC,kBAAT,CAA6BvB,KAA7B,EAAqC;AAC3C,SAAO,CAAC,CAAEA,KAAK,CAACN,UAAN,CAAiBC,UAA3B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAAS6B,eAAT,QAA8C;AAAA,MAApB;AAAEX,IAAAA;AAAF,GAAoB;AACpDA,EAAAA,aAAa,CAAE;AAAElB,IAAAA,UAAU,EAAEa;AAAd,GAAF,CAAb;AACA;;AAED,sBACC,0BADD,EAEC,8BAFD,EAGChB,aAHD;AAMA,sBACC,kCADD,EAEC,8BAFD,EAGCO,YAHD;AAMA,sBACC,0BADD,EAEC,8BAFD,EAGCU,YAHD","sourcesContent":["/**\n * External dependencies\n */\nimport { find, kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport TokenList from '@wordpress/token-list';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../components/use-setting';\nimport FontFamilyControl from '../components/font-family';\n\nexport const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `fontFamily` attribute.\n *\n * @param {Object} settings Original block settings\n * @return {Object} Filtered block settings\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_FAMILY_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify a default value if needed.\n\tif ( ! settings.attributes.fontFamily ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tfontFamily: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject font family.\n *\n * @param {Object} props Additional props applied to save element\n * @param {Object} blockType Block type\n * @param {Object} attributes Block attributes\n * @return {Object} Filtered props applied to save element\n */\nfunction addSaveProps( props, blockType, attributes ) {\n\tif ( ! hasBlockSupport( blockType, FONT_FAMILY_SUPPORT_KEY ) ) {\n\t\treturn props;\n\t}\n\n\tif (\n\t\thasBlockSupport(\n\t\t\tblockType,\n\t\t\t'typography.__experimentalSkipSerialization'\n\t\t)\n\t) {\n\t\treturn props;\n\t}\n\n\tif ( ! attributes?.fontFamily ) {\n\t\treturn props;\n\t}\n\n\t// Use TokenList to dedupe classes.\n\tconst classes = new TokenList( props.className );\n\tclasses.add( `has-${ kebabCase( attributes?.fontFamily ) }-font-family` );\n\tconst newClassName = classes.value;\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to expand the block edit wrapper\n * by applying the desired styles and classnames.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addEditProps( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_FAMILY_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\t\treturn addSaveProps( props, settings, attributes );\n\t};\n\n\treturn settings;\n}\n\nexport function FontFamilyEdit( {\n\tsetAttributes,\n\tattributes: { fontFamily },\n} ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\n\tconst value = find( fontFamilies, ( { slug } ) => fontFamily === slug )\n\t\t?.fontFamily;\n\n\tfunction onChange( newValue ) {\n\t\tconst predefinedFontFamily = find(\n\t\t\tfontFamilies,\n\t\t\t( { fontFamily: f } ) => f === newValue\n\t\t);\n\t\tsetAttributes( {\n\t\t\tfontFamily: predefinedFontFamily?.slug,\n\t\t} );\n\t}\n\n\treturn (\n\t\t<FontFamilyControl\n\t\t\tclassName=\"block-editor-hooks-font-family-control\"\n\t\t\tfontFamilies={ fontFamilies }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\n/**\n * Custom hook that checks if font-family functionality is disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsFontFamilyDisabled( { name } ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\treturn (\n\t\t! fontFamilies ||\n\t\tfontFamilies.length === 0 ||\n\t\t! hasBlockSupport( name, FONT_FAMILY_SUPPORT_KEY )\n\t);\n}\n\n/**\n * Checks if there is a current value set for the font family block support.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a font family value set.\n */\nexport function hasFontFamilyValue( props ) {\n\treturn !! props.attributes.fontFamily;\n}\n\n/**\n * Resets the font family block support attribute. This can be used when\n * disabling the font family support controls for a block via a progressive\n * discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetFontFamily( { setAttributes } ) {\n\tsetAttributes( { fontFamily: undefined } );\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/fontFamily/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/fontFamily/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/fontFamily/addEditProps',\n\taddEditProps\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/font-family.js"],"names":["FONT_FAMILY_SUPPORT_KEY","addAttributes","settings","attributes","fontFamily","Object","assign","type","addSaveProps","props","blockType","TYPOGRAPHY_SUPPORT_KEY","classes","TokenList","className","add","newClassName","value","undefined","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","FontFamilyEdit","setAttributes","fontFamilies","slug","onChange","newValue","predefinedFontFamily","f","useIsFontFamilyDisabled","name","length","hasFontFamilyValue","resetFontFamily"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAMO,MAAMA,uBAAuB,GAAG,qCAAhC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACA,SAASC,aAAT,CAAwBC,QAAxB,EAAmC;AAClC,MAAK,CAAE,6BAAiBA,QAAjB,EAA2BF,uBAA3B,CAAP,EAA8D;AAC7D,WAAOE,QAAP;AACA,GAHiC,CAKlC;;;AACA,MAAK,CAAEA,QAAQ,CAACC,UAAT,CAAoBC,UAA3B,EAAwC;AACvCC,IAAAA,MAAM,CAACC,MAAP,CAAeJ,QAAQ,CAACC,UAAxB,EAAoC;AACnCC,MAAAA,UAAU,EAAE;AACXG,QAAAA,IAAI,EAAE;AADK;AADuB,KAApC;AAKA;;AAED,SAAOL,QAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASM,YAAT,CAAuBC,KAAvB,EAA8BC,SAA9B,EAAyCP,UAAzC,EAAsD;AACrD,MAAK,CAAE,6BAAiBO,SAAjB,EAA4BV,uBAA5B,CAAP,EAA+D;AAC9D,WAAOS,KAAP;AACA;;AAED,MACC,oCACCC,SADD,EAECC,kCAFD,EAGC,YAHD,CADD,EAME;AACD,WAAOF,KAAP;AACA;;AAED,MAAK,EAAEN,UAAF,aAAEA,UAAF,eAAEA,UAAU,CAAEC,UAAd,CAAL,EAAgC;AAC/B,WAAOK,KAAP;AACA,GAjBoD,CAmBrD;;;AACA,QAAMG,OAAO,GAAG,IAAIC,kBAAJ,CAAeJ,KAAK,CAACK,SAArB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EpB,QAAAA,UAAU,EAAEyB;AAAd,OAAF;AAAA,aAAyBA,CAAC,KAAKF,QAA/B;AAAA,KAF4B,CAA7B;AAIAJ,IAAAA,aAAa,CAAE;AACdnB,MAAAA,UAAU,EAAEwB,oBAAF,aAAEA,oBAAF,uBAAEA,oBAAoB,CAAEH;AADpB,KAAF,CAAb;AAGA;;AAED,SACC,4BAAC,mBAAD;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,YAAY,EAAGD,YAFhB;AAGC,IAAA,KAAK,EAAGP,KAHT;AAIC,IAAA,QAAQ,EAAGS;AAJZ,IADD;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,uBAAT,QAA6C;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACnD,QAAMP,YAAY,GAAG,yBAAY,yBAAZ,CAArB;AACA,SACC,CAAEA,YAAF,IACAA,YAAY,CAACQ,MAAb,KAAwB,CADxB,IAEA,CAAE,6BAAiBD,IAAjB,EAAuB/B,uBAAvB,CAHH;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASiC,kBAAT,CAA6BxB,KAA7B,EAAqC;AAC3C,SAAO,CAAC,CAAEA,KAAK,CAACN,UAAN,CAAiBC,UAA3B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAAS8B,eAAT,QAA8C;AAAA,MAApB;AAAEX,IAAAA;AAAF,GAAoB;AACpDA,EAAAA,aAAa,CAAE;AAAEnB,IAAAA,UAAU,EAAEc;AAAd,GAAF,CAAb;AACA;;AAED,sBACC,0BADD,EAEC,8BAFD,EAGCjB,aAHD;AAMA,sBACC,kCADD,EAEC,8BAFD,EAGCO,YAHD;AAMA,sBACC,0BADD,EAEC,8BAFD,EAGCW,YAHD","sourcesContent":["/**\n * External dependencies\n */\nimport { find, kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport TokenList from '@wordpress/token-list';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../components/use-setting';\nimport FontFamilyControl from '../components/font-family';\nimport { shouldSkipSerialization } from './utils';\nimport { TYPOGRAPHY_SUPPORT_KEY } from './typography';\n\nexport const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `fontFamily` attribute.\n *\n * @param {Object} settings Original block settings\n * @return {Object} Filtered block settings\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_FAMILY_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify a default value if needed.\n\tif ( ! settings.attributes.fontFamily ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tfontFamily: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject font family.\n *\n * @param {Object} props Additional props applied to save element\n * @param {Object} blockType Block type\n * @param {Object} attributes Block attributes\n * @return {Object} Filtered props applied to save element\n */\nfunction addSaveProps( props, blockType, attributes ) {\n\tif ( ! hasBlockSupport( blockType, FONT_FAMILY_SUPPORT_KEY ) ) {\n\t\treturn props;\n\t}\n\n\tif (\n\t\tshouldSkipSerialization(\n\t\t\tblockType,\n\t\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t\t'fontFamily'\n\t\t)\n\t) {\n\t\treturn props;\n\t}\n\n\tif ( ! attributes?.fontFamily ) {\n\t\treturn props;\n\t}\n\n\t// Use TokenList to dedupe classes.\n\tconst classes = new TokenList( props.className );\n\tclasses.add( `has-${ kebabCase( attributes?.fontFamily ) }-font-family` );\n\tconst newClassName = classes.value;\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to expand the block edit wrapper\n * by applying the desired styles and classnames.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addEditProps( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_FAMILY_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\t\treturn addSaveProps( props, settings, attributes );\n\t};\n\n\treturn settings;\n}\n\nexport function FontFamilyEdit( {\n\tsetAttributes,\n\tattributes: { fontFamily },\n} ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\n\tconst value = find( fontFamilies, ( { slug } ) => fontFamily === slug )\n\t\t?.fontFamily;\n\n\tfunction onChange( newValue ) {\n\t\tconst predefinedFontFamily = find(\n\t\t\tfontFamilies,\n\t\t\t( { fontFamily: f } ) => f === newValue\n\t\t);\n\t\tsetAttributes( {\n\t\t\tfontFamily: predefinedFontFamily?.slug,\n\t\t} );\n\t}\n\n\treturn (\n\t\t<FontFamilyControl\n\t\t\tclassName=\"block-editor-hooks-font-family-control\"\n\t\t\tfontFamilies={ fontFamilies }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\n/**\n * Custom hook that checks if font-family functionality is disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsFontFamilyDisabled( { name } ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\treturn (\n\t\t! fontFamilies ||\n\t\tfontFamilies.length === 0 ||\n\t\t! hasBlockSupport( name, FONT_FAMILY_SUPPORT_KEY )\n\t);\n}\n\n/**\n * Checks if there is a current value set for the font family block support.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a font family value set.\n */\nexport function hasFontFamilyValue( props ) {\n\treturn !! props.attributes.fontFamily;\n}\n\n/**\n * Resets the font family block support attribute. This can be used when\n * disabling the font family support controls for a block via a progressive\n * discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetFontFamily( { setAttributes } ) {\n\tsetAttributes( { fontFamily: undefined } );\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/fontFamily/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/fontFamily/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/fontFamily/addEditProps',\n\taddEditProps\n);\n"]}
@@ -24,6 +24,8 @@ var _compose = require("@wordpress/compose");
24
24
 
25
25
  var _fontSizes = require("../components/font-sizes");
26
26
 
27
+ var _typography = require("./typography");
28
+
27
29
  var _utils = require("./utils");
28
30
 
29
31
  var _useSetting = _interopRequireDefault(require("../components/use-setting"));
@@ -79,7 +81,7 @@ function addSaveProps(props, blockType, attributes) {
79
81
  return props;
80
82
  }
81
83
 
82
- if ((0, _blocks.hasBlockSupport)(blockType, 'typography.__experimentalSkipSerialization')) {
84
+ if ((0, _utils.shouldSkipSerialization)(blockType, _typography.TYPOGRAPHY_SUPPORT_KEY, 'fontSize')) {
83
85
  return props;
84
86
  } // Use TokenList to dedupe classes.
85
87
 
@@ -248,7 +250,7 @@ const withFontSizeInlineStyles = (0, _compose.createHigherOrderComponent)(BlockL
248
250
  // doesn't already have an inline font size,
249
251
  // and does have a class to extract the font size from.
250
252
 
251
- if (!(0, _blocks.hasBlockSupport)(blockName, FONT_SIZE_SUPPORT_KEY) || (0, _blocks.hasBlockSupport)(blockName, 'typography.__experimentalSkipSerialization') || !fontSize || style !== null && style !== void 0 && (_style$typography4 = style.typography) !== null && _style$typography4 !== void 0 && _style$typography4.fontSize) {
253
+ if (!(0, _blocks.hasBlockSupport)(blockName, FONT_SIZE_SUPPORT_KEY) || (0, _utils.shouldSkipSerialization)(blockName, _typography.TYPOGRAPHY_SUPPORT_KEY, 'fontSize') || !fontSize || style !== null && style !== void 0 && (_style$typography4 = style.typography) !== null && _style$typography4 !== void 0 && _style$typography4.fontSize) {
252
254
  return (0, _element.createElement)(BlockListBlock, props);
253
255
  }
254
256