@wordpress/block-editor 10.3.0 → 10.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 (460) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +0 -1
  3. package/build/components/alignment-control/ui.js +1 -1
  4. package/build/components/alignment-control/ui.js.map +1 -1
  5. package/build/components/block-alignment-control/constants.js +1 -1
  6. package/build/components/block-alignment-control/constants.js.map +1 -1
  7. package/build/components/block-alignment-matrix-control/index.js +1 -1
  8. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  9. package/build/components/block-compare/index.js +1 -3
  10. package/build/components/block-compare/index.js.map +1 -1
  11. package/build/components/block-edit/index.js +4 -2
  12. package/build/components/block-edit/index.js.map +1 -1
  13. package/build/components/block-list/block.js +3 -1
  14. package/build/components/block-list/block.js.map +1 -1
  15. package/build/components/block-lock/menu-item.js +1 -1
  16. package/build/components/block-lock/menu-item.js.map +1 -1
  17. package/build/components/block-lock/modal.js +16 -9
  18. package/build/components/block-lock/modal.js.map +1 -1
  19. package/build/components/block-popover/inbetween.js +2 -1
  20. package/build/components/block-popover/inbetween.js.map +1 -1
  21. package/build/components/block-popover/index.js +2 -1
  22. package/build/components/block-popover/index.js.map +1 -1
  23. package/build/components/block-preview/index.js +2 -4
  24. package/build/components/block-preview/index.js.map +1 -1
  25. package/build/components/block-settings-menu/block-settings-dropdown.js +2 -8
  26. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  27. package/build/components/block-styles/utils.js +3 -3
  28. package/build/components/block-styles/utils.js.map +1 -1
  29. package/build/components/block-switcher/index.js +21 -12
  30. package/build/components/block-switcher/index.js.map +1 -1
  31. package/build/components/block-switcher/preview-block-popover.js +1 -1
  32. package/build/components/block-switcher/preview-block-popover.js.map +1 -1
  33. package/build/components/block-tools/insertion-point.js +12 -2
  34. package/build/components/block-tools/insertion-point.js.map +1 -1
  35. package/build/components/block-tools/selected-block-popover.js +27 -4
  36. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  37. package/build/components/block-vertical-alignment-control/ui.js +1 -1
  38. package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
  39. package/build/components/border-radius-control/all-input-control.js +2 -1
  40. package/build/components/border-radius-control/all-input-control.js.map +1 -1
  41. package/build/components/border-radius-control/index.js +2 -1
  42. package/build/components/border-radius-control/index.js.map +1 -1
  43. package/build/components/border-radius-control/input-controls.js +2 -1
  44. package/build/components/border-radius-control/input-controls.js.map +1 -1
  45. package/build/components/colors/with-colors.js +4 -3
  46. package/build/components/colors/with-colors.js.map +1 -1
  47. package/build/components/duotone-control/index.js +1 -1
  48. package/build/components/duotone-control/index.js.map +1 -1
  49. package/build/components/font-sizes/fluid-utils.js +24 -40
  50. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  51. package/build/components/font-sizes/with-font-sizes.js +8 -6
  52. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  53. package/build/components/iframe/index.js +1 -1
  54. package/build/components/iframe/index.js.map +1 -1
  55. package/build/components/image-editor/constants.js +1 -1
  56. package/build/components/image-editor/constants.js.map +1 -1
  57. package/build/components/index.js +9 -0
  58. package/build/components/index.js.map +1 -1
  59. package/build/components/inner-blocks/index.js +10 -4
  60. package/build/components/inner-blocks/index.js.map +1 -1
  61. package/build/components/inserter/hooks/use-insertion-point.js +2 -7
  62. package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
  63. package/build/components/inserter/reusable-blocks-tab.js +4 -1
  64. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  65. package/build/components/inserter/search-items.js +23 -2
  66. package/build/components/inserter/search-items.js.map +1 -1
  67. package/build/components/line-height-control/index.js +2 -1
  68. package/build/components/line-height-control/index.js.map +1 -1
  69. package/build/components/link-control/index.js +18 -34
  70. package/build/components/link-control/index.js.map +1 -1
  71. package/build/components/link-control/search-input.js +1 -1
  72. package/build/components/link-control/search-input.js.map +1 -1
  73. package/build/components/link-control/use-internal-input-value.js +26 -0
  74. package/build/components/link-control/use-internal-input-value.js.map +1 -0
  75. package/build/components/list-view/block.js +5 -3
  76. package/build/components/list-view/block.js.map +1 -1
  77. package/build/components/list-view/branch.js +9 -3
  78. package/build/components/list-view/branch.js.map +1 -1
  79. package/build/components/list-view/drop-indicator.js +2 -1
  80. package/build/components/list-view/drop-indicator.js.map +1 -1
  81. package/build/components/media-replace-flow/index.js +1 -1
  82. package/build/components/media-replace-flow/index.js.map +1 -1
  83. package/build/components/off-canvas-editor/block-contents.js +100 -0
  84. package/build/components/off-canvas-editor/block-contents.js.map +1 -0
  85. package/build/components/off-canvas-editor/block-select-button.js +119 -0
  86. package/build/components/off-canvas-editor/block-select-button.js.map +1 -0
  87. package/build/components/off-canvas-editor/block.js +292 -0
  88. package/build/components/off-canvas-editor/block.js.map +1 -0
  89. package/build/components/off-canvas-editor/branch.js +181 -0
  90. package/build/components/off-canvas-editor/branch.js.map +1 -0
  91. package/build/components/off-canvas-editor/context.js +19 -0
  92. package/build/components/off-canvas-editor/context.js.map +1 -0
  93. package/build/components/off-canvas-editor/drop-indicator.js +118 -0
  94. package/build/components/off-canvas-editor/drop-indicator.js.map +1 -0
  95. package/build/components/off-canvas-editor/expander.js +41 -0
  96. package/build/components/off-canvas-editor/expander.js.map +1 -0
  97. package/build/components/off-canvas-editor/index.js +204 -0
  98. package/build/components/off-canvas-editor/index.js.map +1 -0
  99. package/build/components/off-canvas-editor/leaf.js +60 -0
  100. package/build/components/off-canvas-editor/leaf.js.map +1 -0
  101. package/build/components/off-canvas-editor/use-block-selection.js +139 -0
  102. package/build/components/off-canvas-editor/use-block-selection.js.map +1 -0
  103. package/build/components/off-canvas-editor/use-list-view-client-ids.js +33 -0
  104. package/build/components/off-canvas-editor/use-list-view-client-ids.js.map +1 -0
  105. package/build/components/off-canvas-editor/use-list-view-drop-zone.js +235 -0
  106. package/build/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -0
  107. package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js +60 -0
  108. package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +1 -0
  109. package/build/components/off-canvas-editor/utils.js +60 -0
  110. package/build/components/off-canvas-editor/utils.js.map +1 -0
  111. package/build/components/rich-text/format-toolbar/index.js +1 -1
  112. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  113. package/build/components/rich-text/format-toolbar-container.js +1 -1
  114. package/build/components/rich-text/format-toolbar-container.js.map +1 -1
  115. package/build/components/rich-text/use-paste-handler.js +1 -1
  116. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  117. package/build/components/spacing-sizes-control/all-input-control.js +6 -2
  118. package/build/components/spacing-sizes-control/all-input-control.js.map +1 -1
  119. package/build/components/spacing-sizes-control/axial-input-controls.js +6 -2
  120. package/build/components/spacing-sizes-control/axial-input-controls.js.map +1 -1
  121. package/build/components/spacing-sizes-control/index.js +6 -2
  122. package/build/components/spacing-sizes-control/index.js.map +1 -1
  123. package/build/components/spacing-sizes-control/input-controls.js +6 -2
  124. package/build/components/spacing-sizes-control/input-controls.js.map +1 -1
  125. package/build/components/spacing-sizes-control/spacing-input-control.js +12 -5
  126. package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  127. package/build/components/url-input/index.js +1 -1
  128. package/build/components/url-input/index.js.map +1 -1
  129. package/build/components/url-popover/index.js +31 -2
  130. package/build/components/url-popover/index.js.map +1 -1
  131. package/build/components/use-setting/index.js +1 -1
  132. package/build/components/use-setting/index.js.map +1 -1
  133. package/build/hooks/border.js +1 -0
  134. package/build/hooks/border.js.map +1 -1
  135. package/build/hooks/color-panel.js +17 -1
  136. package/build/hooks/color-panel.js.map +1 -1
  137. package/build/hooks/color.js +1 -1
  138. package/build/hooks/color.js.map +1 -1
  139. package/build/hooks/content-lock-ui.js +13 -6
  140. package/build/hooks/content-lock-ui.js.map +1 -1
  141. package/build/hooks/dimensions.js +72 -13
  142. package/build/hooks/dimensions.js.map +1 -1
  143. package/build/hooks/font-size.js +1 -0
  144. package/build/hooks/font-size.js.map +1 -1
  145. package/build/hooks/layout.js +5 -4
  146. package/build/hooks/layout.js.map +1 -1
  147. package/build/hooks/margin.js +26 -18
  148. package/build/hooks/margin.js.map +1 -1
  149. package/build/hooks/min-height.js +145 -0
  150. package/build/hooks/min-height.js.map +1 -0
  151. package/build/hooks/padding.js +22 -13
  152. package/build/hooks/padding.js.map +1 -1
  153. package/build/hooks/style.js +3 -2
  154. package/build/hooks/style.js.map +1 -1
  155. package/build/hooks/utils.js +7 -6
  156. package/build/hooks/utils.js.map +1 -1
  157. package/build/layouts/constrained.js +0 -1
  158. package/build/layouts/constrained.js.map +1 -1
  159. package/build/layouts/flex.js +23 -22
  160. package/build/layouts/flex.js.map +1 -1
  161. package/build/store/actions.js +30 -0
  162. package/build/store/actions.js.map +1 -1
  163. package/build/store/array.js +1 -7
  164. package/build/store/array.js.map +1 -1
  165. package/build/store/reducer.js +46 -14
  166. package/build/store/reducer.js.map +1 -1
  167. package/build/store/selectors.js +62 -31
  168. package/build/store/selectors.js.map +1 -1
  169. package/build-module/components/alignment-control/ui.js +1 -1
  170. package/build-module/components/alignment-control/ui.js.map +1 -1
  171. package/build-module/components/block-alignment-control/constants.js +1 -1
  172. package/build-module/components/block-alignment-control/constants.js.map +1 -1
  173. package/build-module/components/block-alignment-matrix-control/index.js +1 -1
  174. package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
  175. package/build-module/components/block-compare/index.js +2 -3
  176. package/build-module/components/block-compare/index.js.map +1 -1
  177. package/build-module/components/block-edit/index.js +4 -2
  178. package/build-module/components/block-edit/index.js.map +1 -1
  179. package/build-module/components/block-list/block.js +3 -1
  180. package/build-module/components/block-list/block.js.map +1 -1
  181. package/build-module/components/block-lock/menu-item.js +2 -2
  182. package/build-module/components/block-lock/menu-item.js.map +1 -1
  183. package/build-module/components/block-lock/modal.js +17 -10
  184. package/build-module/components/block-lock/modal.js.map +1 -1
  185. package/build-module/components/block-popover/inbetween.js +2 -1
  186. package/build-module/components/block-popover/inbetween.js.map +1 -1
  187. package/build-module/components/block-popover/index.js +2 -1
  188. package/build-module/components/block-popover/index.js.map +1 -1
  189. package/build-module/components/block-preview/index.js +2 -3
  190. package/build-module/components/block-preview/index.js.map +1 -1
  191. package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -7
  192. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  193. package/build-module/components/block-styles/utils.js +3 -3
  194. package/build-module/components/block-styles/utils.js.map +1 -1
  195. package/build-module/components/block-switcher/index.js +21 -11
  196. package/build-module/components/block-switcher/index.js.map +1 -1
  197. package/build-module/components/block-switcher/preview-block-popover.js +1 -1
  198. package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
  199. package/build-module/components/block-tools/insertion-point.js +12 -2
  200. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  201. package/build-module/components/block-tools/selected-block-popover.js +27 -5
  202. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  203. package/build-module/components/block-vertical-alignment-control/ui.js +1 -1
  204. package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
  205. package/build-module/components/border-radius-control/all-input-control.js +2 -1
  206. package/build-module/components/border-radius-control/all-input-control.js.map +1 -1
  207. package/build-module/components/border-radius-control/index.js +2 -1
  208. package/build-module/components/border-radius-control/index.js.map +1 -1
  209. package/build-module/components/border-radius-control/input-controls.js +2 -1
  210. package/build-module/components/border-radius-control/input-controls.js.map +1 -1
  211. package/build-module/components/colors/with-colors.js +5 -4
  212. package/build-module/components/colors/with-colors.js.map +1 -1
  213. package/build-module/components/duotone-control/index.js +1 -1
  214. package/build-module/components/duotone-control/index.js.map +1 -1
  215. package/build-module/components/font-sizes/fluid-utils.js +24 -40
  216. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  217. package/build-module/components/font-sizes/with-font-sizes.js +9 -7
  218. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  219. package/build-module/components/iframe/index.js +1 -1
  220. package/build-module/components/iframe/index.js.map +1 -1
  221. package/build-module/components/image-editor/constants.js +1 -1
  222. package/build-module/components/image-editor/constants.js.map +1 -1
  223. package/build-module/components/index.js +1 -0
  224. package/build-module/components/index.js.map +1 -1
  225. package/build-module/components/inner-blocks/index.js +10 -4
  226. package/build-module/components/inner-blocks/index.js.map +1 -1
  227. package/build-module/components/inserter/hooks/use-insertion-point.js +2 -6
  228. package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
  229. package/build-module/components/inserter/reusable-blocks-tab.js +3 -1
  230. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  231. package/build-module/components/inserter/search-items.js +23 -3
  232. package/build-module/components/inserter/search-items.js.map +1 -1
  233. package/build-module/components/line-height-control/index.js +2 -1
  234. package/build-module/components/line-height-control/index.js.map +1 -1
  235. package/build-module/components/link-control/index.js +17 -34
  236. package/build-module/components/link-control/index.js.map +1 -1
  237. package/build-module/components/link-control/search-input.js +1 -1
  238. package/build-module/components/link-control/search-input.js.map +1 -1
  239. package/build-module/components/link-control/use-internal-input-value.js +18 -0
  240. package/build-module/components/link-control/use-internal-input-value.js.map +1 -0
  241. package/build-module/components/list-view/block.js +5 -3
  242. package/build-module/components/list-view/block.js.map +1 -1
  243. package/build-module/components/list-view/branch.js +9 -3
  244. package/build-module/components/list-view/branch.js.map +1 -1
  245. package/build-module/components/list-view/drop-indicator.js +2 -1
  246. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  247. package/build-module/components/media-replace-flow/index.js +1 -1
  248. package/build-module/components/media-replace-flow/index.js.map +1 -1
  249. package/build-module/components/off-canvas-editor/block-contents.js +85 -0
  250. package/build-module/components/off-canvas-editor/block-contents.js.map +1 -0
  251. package/build-module/components/off-canvas-editor/block-select-button.js +101 -0
  252. package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -0
  253. package/build-module/components/off-canvas-editor/block.js +268 -0
  254. package/build-module/components/off-canvas-editor/block.js.map +1 -0
  255. package/build-module/components/off-canvas-editor/branch.js +165 -0
  256. package/build-module/components/off-canvas-editor/branch.js.map +1 -0
  257. package/build-module/components/off-canvas-editor/context.js +7 -0
  258. package/build-module/components/off-canvas-editor/context.js.map +1 -0
  259. package/build-module/components/off-canvas-editor/drop-indicator.js +111 -0
  260. package/build-module/components/off-canvas-editor/drop-indicator.js.map +1 -0
  261. package/build-module/components/off-canvas-editor/expander.js +32 -0
  262. package/build-module/components/off-canvas-editor/expander.js.map +1 -0
  263. package/build-module/components/off-canvas-editor/index.js +181 -0
  264. package/build-module/components/off-canvas-editor/index.js.map +1 -0
  265. package/build-module/components/off-canvas-editor/leaf.js +45 -0
  266. package/build-module/components/off-canvas-editor/leaf.js.map +1 -0
  267. package/build-module/components/off-canvas-editor/use-block-selection.js +124 -0
  268. package/build-module/components/off-canvas-editor/use-block-selection.js.map +1 -0
  269. package/build-module/components/off-canvas-editor/use-list-view-client-ids.js +24 -0
  270. package/build-module/components/off-canvas-editor/use-list-view-client-ids.js.map +1 -0
  271. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js +220 -0
  272. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -0
  273. package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js +50 -0
  274. package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +1 -0
  275. package/build-module/components/off-canvas-editor/utils.js +44 -0
  276. package/build-module/components/off-canvas-editor/utils.js.map +1 -0
  277. package/build-module/components/rich-text/format-toolbar/index.js +1 -1
  278. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  279. package/build-module/components/rich-text/format-toolbar-container.js +1 -1
  280. package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
  281. package/build-module/components/rich-text/use-paste-handler.js +1 -1
  282. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  283. package/build-module/components/spacing-sizes-control/all-input-control.js +6 -2
  284. package/build-module/components/spacing-sizes-control/all-input-control.js.map +1 -1
  285. package/build-module/components/spacing-sizes-control/axial-input-controls.js +6 -2
  286. package/build-module/components/spacing-sizes-control/axial-input-controls.js.map +1 -1
  287. package/build-module/components/spacing-sizes-control/index.js +6 -2
  288. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  289. package/build-module/components/spacing-sizes-control/input-controls.js +6 -2
  290. package/build-module/components/spacing-sizes-control/input-controls.js.map +1 -1
  291. package/build-module/components/spacing-sizes-control/spacing-input-control.js +12 -5
  292. package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  293. package/build-module/components/url-input/index.js +1 -1
  294. package/build-module/components/url-input/index.js.map +1 -1
  295. package/build-module/components/url-popover/index.js +30 -3
  296. package/build-module/components/url-popover/index.js.map +1 -1
  297. package/build-module/components/use-setting/index.js +1 -1
  298. package/build-module/components/use-setting/index.js.map +1 -1
  299. package/build-module/hooks/border.js +1 -0
  300. package/build-module/hooks/border.js.map +1 -1
  301. package/build-module/hooks/color-panel.js +17 -1
  302. package/build-module/hooks/color-panel.js.map +1 -1
  303. package/build-module/hooks/color.js +1 -1
  304. package/build-module/hooks/color.js.map +1 -1
  305. package/build-module/hooks/content-lock-ui.js +15 -8
  306. package/build-module/hooks/content-lock-ui.js.map +1 -1
  307. package/build-module/hooks/dimensions.js +67 -12
  308. package/build-module/hooks/dimensions.js.map +1 -1
  309. package/build-module/hooks/font-size.js +1 -0
  310. package/build-module/hooks/font-size.js.map +1 -1
  311. package/build-module/hooks/layout.js +6 -5
  312. package/build-module/hooks/layout.js.map +1 -1
  313. package/build-module/hooks/margin.js +27 -19
  314. package/build-module/hooks/margin.js.map +1 -1
  315. package/build-module/hooks/min-height.js +122 -0
  316. package/build-module/hooks/min-height.js.map +1 -0
  317. package/build-module/hooks/padding.js +23 -14
  318. package/build-module/hooks/padding.js.map +1 -1
  319. package/build-module/hooks/style.js +4 -3
  320. package/build-module/hooks/style.js.map +1 -1
  321. package/build-module/hooks/utils.js +7 -7
  322. package/build-module/hooks/utils.js.map +1 -1
  323. package/build-module/layouts/constrained.js +0 -1
  324. package/build-module/layouts/constrained.js.map +1 -1
  325. package/build-module/layouts/flex.js +24 -23
  326. package/build-module/layouts/flex.js.map +1 -1
  327. package/build-module/store/actions.js +26 -0
  328. package/build-module/store/actions.js.map +1 -1
  329. package/build-module/store/array.js +1 -6
  330. package/build-module/store/array.js.map +1 -1
  331. package/build-module/store/reducer.js +44 -14
  332. package/build-module/store/reducer.js.map +1 -1
  333. package/build-module/store/selectors.js +59 -31
  334. package/build-module/store/selectors.js.map +1 -1
  335. package/build-style/style-rtl.css +88 -88
  336. package/build-style/style.css +84 -84
  337. package/package.json +29 -28
  338. package/src/components/alignment-control/README.md +1 -1
  339. package/src/components/alignment-control/ui.js +1 -1
  340. package/src/components/block-alignment-control/constants.js +1 -1
  341. package/src/components/block-alignment-control/test/index.native.js +4 -4
  342. package/src/components/block-alignment-matrix-control/index.js +1 -1
  343. package/src/components/block-breadcrumb/test/__snapshots__/index.js.snap +13 -11
  344. package/src/components/block-breadcrumb/test/index.js +1 -1
  345. package/src/components/block-compare/index.js +3 -2
  346. package/src/components/block-draggable/test/helpers.native.js +3 -3
  347. package/src/components/block-draggable/test/index.native.js +27 -27
  348. package/src/components/block-edit/index.js +2 -1
  349. package/src/components/block-list/block.js +2 -0
  350. package/src/components/block-list/style.scss +11 -6
  351. package/src/components/block-lock/menu-item.js +5 -2
  352. package/src/components/block-lock/modal.js +19 -36
  353. package/src/components/block-lock/style.scss +8 -17
  354. package/src/components/block-mover/stories/index.js +1 -1
  355. package/src/components/block-mover/style.scss +35 -1
  356. package/src/components/block-popover/inbetween.js +1 -0
  357. package/src/components/block-popover/index.js +1 -0
  358. package/src/components/block-popover/style.scss +1 -5
  359. package/src/components/block-preview/index.js +8 -3
  360. package/src/components/block-settings-menu/block-settings-dropdown.js +4 -7
  361. package/src/components/block-styles/utils.js +3 -3
  362. package/src/components/block-switcher/index.js +21 -11
  363. package/src/components/block-switcher/preview-block-popover.js +1 -1
  364. package/src/components/block-tools/insertion-point.js +10 -1
  365. package/src/components/block-tools/selected-block-popover.js +80 -34
  366. package/src/components/block-tools/style.scss +15 -0
  367. package/src/components/block-variation-picker/README.md +1 -1
  368. package/src/components/block-vertical-alignment-control/ui.js +1 -1
  369. package/src/components/border-radius-control/all-input-control.js +1 -0
  370. package/src/components/border-radius-control/index.js +1 -0
  371. package/src/components/border-radius-control/input-controls.js +1 -0
  372. package/src/components/border-radius-control/style.scss +15 -24
  373. package/src/components/color-palette/test/__snapshots__/control.js.snap +85 -83
  374. package/src/components/color-palette/test/control.js +1 -1
  375. package/src/components/colors/with-colors.js +13 -23
  376. package/src/components/default-block-appender/style.scss +1 -0
  377. package/src/components/duotone-control/index.js +1 -1
  378. package/src/components/font-sizes/fluid-utils.js +37 -64
  379. package/src/components/font-sizes/test/fluid-utils.js +5 -5
  380. package/src/components/font-sizes/with-font-sizes.js +15 -13
  381. package/src/components/iframe/index.js +1 -1
  382. package/src/components/image-editor/constants.js +1 -1
  383. package/src/components/index.js +1 -0
  384. package/src/components/inner-blocks/index.js +11 -4
  385. package/src/components/inner-blocks/test/index.js +4 -0
  386. package/src/components/inserter/hooks/use-insertion-point.js +3 -11
  387. package/src/components/inserter/reusable-blocks-tab.js +4 -2
  388. package/src/components/inserter/search-items.js +23 -3
  389. package/src/components/inserter/style.scss +8 -7
  390. package/src/components/inserter/test/reusable-blocks-tab.js +14 -57
  391. package/src/components/inserter/test/search-items.js +6 -0
  392. package/src/components/inserter-list-item/style.scss +2 -0
  393. package/src/components/letter-spacing-control/README.md +55 -0
  394. package/src/components/line-height-control/index.js +1 -0
  395. package/src/components/link-control/README.md +3 -3
  396. package/src/components/link-control/index.js +23 -39
  397. package/src/components/link-control/search-input.js +1 -1
  398. package/src/components/link-control/test/index.js +272 -241
  399. package/src/components/link-control/use-internal-input-value.js +22 -0
  400. package/src/components/list-view/block.js +4 -3
  401. package/src/components/list-view/branch.js +11 -6
  402. package/src/components/list-view/drop-indicator.js +1 -0
  403. package/src/components/list-view/style.scss +1 -36
  404. package/src/components/media-replace-flow/index.js +1 -1
  405. package/src/components/media-replace-flow/test/index.js +69 -51
  406. package/src/components/off-canvas-editor/README.md +5 -0
  407. package/src/components/off-canvas-editor/block-contents.js +89 -0
  408. package/src/components/off-canvas-editor/block-select-button.js +113 -0
  409. package/src/components/off-canvas-editor/block.js +335 -0
  410. package/src/components/off-canvas-editor/branch.js +210 -0
  411. package/src/components/off-canvas-editor/context.js +8 -0
  412. package/src/components/off-canvas-editor/drop-indicator.js +126 -0
  413. package/src/components/off-canvas-editor/expander.js +26 -0
  414. package/src/components/off-canvas-editor/index.js +216 -0
  415. package/src/components/off-canvas-editor/leaf.js +48 -0
  416. package/src/components/off-canvas-editor/style.scss +397 -0
  417. package/src/components/off-canvas-editor/test/utils.js +50 -0
  418. package/src/components/off-canvas-editor/use-block-selection.js +169 -0
  419. package/src/components/off-canvas-editor/use-list-view-client-ids.js +29 -0
  420. package/src/components/off-canvas-editor/use-list-view-drop-zone.js +260 -0
  421. package/src/components/off-canvas-editor/use-list-view-expand-selected-item.js +58 -0
  422. package/src/components/off-canvas-editor/utils.js +58 -0
  423. package/src/components/responsive-block-control/test/index.js +69 -92
  424. package/src/components/rich-text/format-toolbar/index.js +1 -1
  425. package/src/components/rich-text/format-toolbar-container.js +1 -1
  426. package/src/components/rich-text/use-paste-handler.js +1 -1
  427. package/src/components/spacing-sizes-control/all-input-control.js +4 -0
  428. package/src/components/spacing-sizes-control/axial-input-controls.js +4 -0
  429. package/src/components/spacing-sizes-control/index.js +4 -0
  430. package/src/components/spacing-sizes-control/input-controls.js +4 -0
  431. package/src/components/spacing-sizes-control/spacing-input-control.js +10 -1
  432. package/src/components/spacing-sizes-control/style.scss +1 -0
  433. package/src/components/url-input/index.js +1 -1
  434. package/src/components/url-popover/README.md +12 -3
  435. package/src/components/url-popover/index.js +33 -3
  436. package/src/components/use-setting/index.js +7 -1
  437. package/src/hooks/border.js +1 -0
  438. package/src/hooks/color-panel.js +13 -1
  439. package/src/hooks/color.js +2 -0
  440. package/src/hooks/content-lock-ui.js +46 -34
  441. package/src/hooks/dimensions.js +106 -19
  442. package/src/hooks/font-size.js +1 -0
  443. package/src/hooks/layout.js +8 -11
  444. package/src/hooks/margin.js +23 -17
  445. package/src/hooks/min-height.js +121 -0
  446. package/src/hooks/padding.js +23 -19
  447. package/src/hooks/style.js +10 -2
  448. package/src/hooks/test/align.js +96 -72
  449. package/src/hooks/test/style.js +4 -0
  450. package/src/hooks/test/use-typography-props.js +1 -1
  451. package/src/hooks/utils.js +5 -6
  452. package/src/layouts/constrained.js +0 -1
  453. package/src/layouts/flex.js +44 -39
  454. package/src/store/actions.js +26 -0
  455. package/src/store/array.js +1 -6
  456. package/src/store/reducer.js +50 -40
  457. package/src/store/selectors.js +43 -29
  458. package/src/store/test/actions.js +18 -0
  459. package/src/store/test/reducer.js +40 -0
  460. package/src/store/test/selectors.js +20 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/border.js"],"names":["classnames","getBlockSupport","__experimentalBorderBoxControl","BorderBoxControl","__experimentalHasSplitBorders","hasSplitBorders","__experimentalIsDefinedBorder","isDefinedBorder","__experimentalToolsPanelItem","ToolsPanelItem","createHigherOrderComponent","Platform","addFilter","__","BorderRadiusEdit","hasBorderRadiusValue","resetBorderRadius","getColorClassName","InspectorControls","useMultipleOriginColorsAndGradients","useSetting","cleanEmptyObject","shouldSkipSerialization","BORDER_SUPPORT_KEY","borderSides","hasBorderValue","props","borderColor","style","attributes","border","resetBorder","setAttributes","undefined","radius","resetBorderFilter","newAttributes","getColorByProperty","colors","property","value","matchedColor","some","origin","color","getMultiOriginColor","namedColor","customColor","colorObject","getBorderObject","borderStyles","hydratedBorderStyles","forEach","side","colorSlug","getColorSlugFromVariable","exec","BorderPanel","clientId","isSupported","hasBorderSupport","name","isColorSupported","isRadiusSupported","isStyleSupported","isWidthSupported","isDisabled","every","Boolean","defaultBorderControls","showBorderByDefault","width","onBorderChange","newBorder","newBorderStyles","newBorderColor","top","right","bottom","left","slug","newStyle","hydratedBorder","blockName","feature","OS","support","removeBorderAttribute","attribute","addAttributes","settings","type","addSaveProps","blockType","borderClasses","getBorderClasses","newClassName","className","borderColorClass","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","withBorderColorPaletteStyles","BlockListBlock","borderColorValue","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","extraStyles","wrapperProps"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SACCC,8BAA8B,IAAIC,gBADnC,EAECC,6BAA6B,IAAIC,eAFlC,EAGCC,6BAA6B,IAAIC,eAHlC,EAICC,4BAA4B,IAAIC,cAJjC,QAKO,uBALP;AAMA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SACCC,gBADD,EAECC,oBAFD,EAGCC,iBAHD,QAIO,iBAJP;AAKA,SAASC,iBAAT,QAAkC,sBAAlC;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,OAAOC,mCAAP,MAAgD,yEAAhD;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,SAASC,gBAAT,EAA2BC,uBAA3B,QAA0D,SAA1D;AAEA,OAAO,MAAMC,kBAAkB,GAAG,sBAA3B;AAEP,MAAMC,WAAW,GAAG,CAAE,KAAF,EAAS,OAAT,EAAkB,QAAlB,EAA4B,MAA5B,CAApB;;AAEA,MAAMC,cAAc,GAAKC,KAAF,IAAa;AACnC,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,MAAyBF,KAAK,CAACG,UAArC;AACA,SAAOtB,eAAe,CAAEqB,KAAF,aAAEA,KAAF,uBAAEA,KAAK,CAAEE,MAAT,CAAf,IAAoC,CAAC,CAAEH,WAA9C;AACA,CAHD,C,CAKA;AACA;;;AACA,MAA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AEA,cAAc,IAAID,gBADf;AAEnBE,IAAAA,gBAAgB,EAAEA,gBAAgB,IAAIF,gBAFnB;AAGnBG,IAAAA,iBAAiB,EAAEA,iBAAiB,IAAIH,gBAHrB;AAInBI,IAAAA,eAAe,EAAEA,eAAe,IAAIJ;AAJjB,GAApB;AAOA,MAAIM,YAAY,GAAGpF,KAAK,CAACoF,YAAzB;AACAA,EAAAA,YAAY,GAAG,EACd,GAAGpF,KAAK,CAACoF,YADK;AAEdlF,IAAAA,KAAK,EAAE,EACN,2BAAGF,KAAK,CAACoF,YAAT,wDAAG,oBAAoBlF,KAAvB,CADM;AAEN,SAAGiF;AAFG;AAFO,GAAf;AAQA,SAAO,cAAC,cAAD,eAAqBnF,KAArB;AAA6B,IAAA,YAAY,EAAGoF;AAA5C,KAAP;AACA,CAtDoE,CAA/D;AAyDPlG,SAAS,CACR,0BADQ,EAER,2BAFQ,EAGR6E,aAHQ,CAAT;AAMA7E,SAAS,CACR,kCADQ,EAER,0BAFQ,EAGRgF,YAHQ,CAAT;AAMAhF,SAAS,CACR,0BADQ,EAER,0BAFQ,EAGRuF,YAHQ,CAAT;AAMAvF,SAAS,CACR,uBADQ,EAER,8CAFQ,EAGR0F,4BAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalBorderBoxControl as BorderBoxControl,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalIsDefinedBorder as isDefinedBorder,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { Platform } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBorderRadiusEdit,\n\thasBorderRadiusValue,\n\tresetBorderRadius,\n} from './border-radius';\nimport { getColorClassName } from '../components/colors';\nimport InspectorControls from '../components/inspector-controls';\nimport useMultipleOriginColorsAndGradients from '../components/colors-gradients/use-multiple-origin-colors-and-gradients';\nimport useSetting from '../components/use-setting';\nimport { cleanEmptyObject, shouldSkipSerialization } from './utils';\n\nexport const BORDER_SUPPORT_KEY = '__experimentalBorder';\n\nconst borderSides = [ 'top', 'right', 'bottom', 'left' ];\n\nconst hasBorderValue = ( props ) => {\n\tconst { borderColor, style } = props.attributes;\n\treturn isDefinedBorder( style?.border ) || !! borderColor;\n};\n\n// The border color, style, and width are omitted so they get undefined. The\n// border radius is separate and must retain its selection.\nconst resetBorder = ( { attributes = {}, setAttributes } ) => {\n\tconst { style } = attributes;\n\tsetAttributes( {\n\t\tborderColor: undefined,\n\t\tstyle: {\n\t\t\t...style,\n\t\t\tborder: cleanEmptyObject( {\n\t\t\t\tradius: style?.border?.radius,\n\t\t\t} ),\n\t\t},\n\t} );\n};\n\nconst resetBorderFilter = ( newAttributes ) => ( {\n\t...newAttributes,\n\tborderColor: undefined,\n\tstyle: {\n\t\t...newAttributes.style,\n\t\tborder: {\n\t\t\tradius: newAttributes.style?.border?.radius,\n\t\t},\n\t},\n} );\n\nconst getColorByProperty = ( colors, property, value ) => {\n\tlet matchedColor;\n\n\tcolors.some( ( origin ) =>\n\t\torigin.colors.some( ( color ) => {\n\t\t\tif ( color[ property ] === value ) {\n\t\t\t\tmatchedColor = color;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t} )\n\t);\n\n\treturn matchedColor;\n};\n\nexport const getMultiOriginColor = ( { colors, namedColor, customColor } ) => {\n\t// Search each origin (default, theme, or user) for matching color by name.\n\tif ( namedColor ) {\n\t\tconst colorObject = getColorByProperty( colors, 'slug', namedColor );\n\t\tif ( colorObject ) {\n\t\t\treturn colorObject;\n\t\t}\n\t}\n\n\t// Skip if no custom color or matching named color.\n\tif ( ! customColor ) {\n\t\treturn { color: undefined };\n\t}\n\n\t// Attempt to find color via custom color value or build new object.\n\tconst colorObject = getColorByProperty( colors, 'color', customColor );\n\treturn colorObject ? colorObject : { color: customColor };\n};\n\nconst getBorderObject = ( attributes, colors ) => {\n\tconst { borderColor, style } = attributes;\n\tconst { border: borderStyles } = style || {};\n\n\t// If we have a named color for a flat border. Fetch that color object and\n\t// apply that color's value to the color property within the style object.\n\tif ( borderColor ) {\n\t\tconst { color } = getMultiOriginColor( {\n\t\t\tcolors,\n\t\t\tnamedColor: borderColor,\n\t\t} );\n\n\t\treturn color ? { ...borderStyles, color } : borderStyles;\n\t}\n\n\t// Individual side border color slugs are stored within the border style\n\t// object. If we don't have a border styles object we have nothing further\n\t// to hydrate.\n\tif ( ! borderStyles ) {\n\t\treturn borderStyles;\n\t}\n\n\t// If we have named colors for the individual side borders, retrieve their\n\t// related color objects and apply the real color values to the split\n\t// border objects.\n\tconst hydratedBorderStyles = { ...borderStyles };\n\tborderSides.forEach( ( side ) => {\n\t\tconst colorSlug = getColorSlugFromVariable(\n\t\t\thydratedBorderStyles[ side ]?.color\n\t\t);\n\t\tif ( colorSlug ) {\n\t\t\tconst { color } = getMultiOriginColor( {\n\t\t\t\tcolors,\n\t\t\t\tnamedColor: colorSlug,\n\t\t\t} );\n\t\t\thydratedBorderStyles[ side ] = {\n\t\t\t\t...hydratedBorderStyles[ side ],\n\t\t\t\tcolor,\n\t\t\t};\n\t\t}\n\t} );\n\n\treturn hydratedBorderStyles;\n};\n\nfunction getColorSlugFromVariable( value ) {\n\tconst namedColor = /var:preset\\|color\\|(.+)/.exec( value );\n\tif ( namedColor && namedColor[ 1 ] ) {\n\t\treturn namedColor[ 1 ];\n\t}\n\treturn null;\n}\n\nexport function BorderPanel( props ) {\n\tconst { attributes, clientId, setAttributes } = props;\n\tconst { style } = attributes;\n\tconst { colors } = useMultipleOriginColorsAndGradients();\n\n\tconst isSupported = hasBorderSupport( props.name );\n\tconst isColorSupported =\n\t\tuseSetting( 'border.color' ) && hasBorderSupport( props.name, 'color' );\n\tconst isRadiusSupported =\n\t\tuseSetting( 'border.radius' ) &&\n\t\thasBorderSupport( props.name, 'radius' );\n\tconst isStyleSupported =\n\t\tuseSetting( 'border.style' ) && hasBorderSupport( props.name, 'style' );\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 || ! isSupported ) {\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 showBorderByDefault =\n\t\tdefaultBorderControls?.color || defaultBorderControls?.width;\n\n\tconst onBorderChange = ( newBorder ) => {\n\t\t// Filter out named colors and apply them to appropriate block\n\t\t// attributes so that CSS classes can be used to apply those colors.\n\t\t// e.g. has-primary-border-top-color.\n\n\t\tlet newBorderStyles = { ...newBorder };\n\t\tlet newBorderColor;\n\n\t\tif ( hasSplitBorders( newBorder ) ) {\n\t\t\t// For each side check if the side has a color value set\n\t\t\t// If so, determine if it belongs to a named color, in which case\n\t\t\t// we update the color property.\n\t\t\t//\n\t\t\t// This deliberately overwrites `newBorderStyles` to avoid mutating\n\t\t\t// the passed object which causes problems otherwise.\n\t\t\tnewBorderStyles = {\n\t\t\t\ttop: { ...newBorder.top },\n\t\t\t\tright: { ...newBorder.right },\n\t\t\t\tbottom: { ...newBorder.bottom },\n\t\t\t\tleft: { ...newBorder.left },\n\t\t\t};\n\n\t\t\tborderSides.forEach( ( side ) => {\n\t\t\t\tif ( newBorder[ side ]?.color ) {\n\t\t\t\t\tconst colorObject = getMultiOriginColor( {\n\t\t\t\t\t\tcolors,\n\t\t\t\t\t\tcustomColor: newBorder[ side ]?.color,\n\t\t\t\t\t} );\n\n\t\t\t\t\tif ( colorObject.slug ) {\n\t\t\t\t\t\tnewBorderStyles[\n\t\t\t\t\t\t\tside\n\t\t\t\t\t\t].color = `var:preset|color|${ colorObject.slug }`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t} else if ( newBorder?.color ) {\n\t\t\t// We have a flat border configuration. Apply named color slug to\n\t\t\t// `borderColor` attribute and clear color style property if found.\n\t\t\tconst customColor = newBorder?.color;\n\t\t\tconst colorObject = getMultiOriginColor( { colors, customColor } );\n\n\t\t\tif ( colorObject.slug ) {\n\t\t\t\tnewBorderColor = colorObject.slug;\n\t\t\t\tnewBorderStyles.color = undefined;\n\t\t\t}\n\t\t}\n\n\t\t// Ensure previous border radius styles are maintained and clean\n\t\t// overall result for empty objects or properties.\n\t\tconst newStyle = cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tborder: { radius: style?.border?.radius, ...newBorderStyles },\n\t\t} );\n\n\t\tsetAttributes( {\n\t\t\tstyle: newStyle,\n\t\t\tborderColor: newBorderColor,\n\t\t} );\n\t};\n\n\tconst hydratedBorder = getBorderObject( attributes, colors );\n\n\treturn (\n\t\t<InspectorControls __experimentalGroup=\"border\">\n\t\t\t{ ( isWidthSupported || isColorSupported ) && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasBorderValue( props ) }\n\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\tonDeselect={ () => resetBorder( props ) }\n\t\t\t\t\tisShownByDefault={ showBorderByDefault }\n\t\t\t\t\tresetAllFilter={ resetBorderFilter }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<BorderBoxControl\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tenableAlpha={ true }\n\t\t\t\t\t\tenableStyle={ isStyleSupported }\n\t\t\t\t\t\tonChange={ onBorderChange }\n\t\t\t\t\t\tpopoverOffset={ 40 }\n\t\t\t\t\t\tpopoverPlacement=\"left-start\"\n\t\t\t\t\t\tvalue={ hydratedBorder }\n\t\t\t\t\t\t__experimentalHasMultipleOrigins={ true }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={ true }\n\t\t\t\t\t/>\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={ ( newAttributes ) => ( {\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...newAttributes.style,\n\t\t\t\t\t\t\tborder: {\n\t\t\t\t\t\t\t\t...newAttributes.style?.border,\n\t\t\t\t\t\t\t\tradius: undefined,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t} ) }\n\t\t\t\t\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\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 borderClasses = getBorderClasses( attributes );\n\tconst newClassName = classnames( props.className, borderClasses );\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 * Generates a CSS class name consisting of all the applicable border color\n * classes given the current block attributes.\n *\n * @param {Object} attributes Block's attributes.\n *\n * @return {string} CSS class name.\n */\nexport function getBorderClasses( attributes ) {\n\tconst { borderColor, style } = attributes;\n\tconst borderColorClass = getColorClassName( 'border-color', borderColor );\n\n\treturn classnames( {\n\t\t'has-border-color': borderColor || style?.border?.color,\n\t\t[ borderColorClass ]: !! borderColorClass,\n\t} );\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, style } = attributes;\n\t\tconst { colors } = useMultipleOriginColorsAndGradients();\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 { color: borderColorValue } = getMultiOriginColor( {\n\t\t\tcolors,\n\t\t\tnamedColor: borderColor,\n\t\t} );\n\t\tconst { color: borderTopColor } = getMultiOriginColor( {\n\t\t\tcolors,\n\t\t\tnamedColor: getColorSlugFromVariable( style?.border?.top?.color ),\n\t\t} );\n\t\tconst { color: borderRightColor } = getMultiOriginColor( {\n\t\t\tcolors,\n\t\t\tnamedColor: getColorSlugFromVariable( style?.border?.right?.color ),\n\t\t} );\n\n\t\tconst { color: borderBottomColor } = getMultiOriginColor( {\n\t\t\tcolors,\n\t\t\tnamedColor: getColorSlugFromVariable(\n\t\t\t\tstyle?.border?.bottom?.color\n\t\t\t),\n\t\t} );\n\t\tconst { color: borderLeftColor } = getMultiOriginColor( {\n\t\t\tcolors,\n\t\t\tnamedColor: getColorSlugFromVariable( style?.border?.left?.color ),\n\t\t} );\n\n\t\tconst extraStyles = {\n\t\t\tborderTopColor: borderTopColor || borderColorValue,\n\t\t\tborderRightColor: borderRightColor || borderColorValue,\n\t\t\tborderBottomColor: borderBottomColor || borderColorValue,\n\t\t\tborderLeftColor: borderLeftColor || borderColorValue,\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...props.wrapperProps?.style,\n\t\t\t\t...extraStyles,\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.js"],"names":["classnames","getBlockSupport","__experimentalBorderBoxControl","BorderBoxControl","__experimentalHasSplitBorders","hasSplitBorders","__experimentalIsDefinedBorder","isDefinedBorder","__experimentalToolsPanelItem","ToolsPanelItem","createHigherOrderComponent","Platform","addFilter","__","BorderRadiusEdit","hasBorderRadiusValue","resetBorderRadius","getColorClassName","InspectorControls","useMultipleOriginColorsAndGradients","useSetting","cleanEmptyObject","shouldSkipSerialization","BORDER_SUPPORT_KEY","borderSides","hasBorderValue","props","borderColor","style","attributes","border","resetBorder","setAttributes","undefined","radius","resetBorderFilter","newAttributes","getColorByProperty","colors","property","value","matchedColor","some","origin","color","getMultiOriginColor","namedColor","customColor","colorObject","getBorderObject","borderStyles","hydratedBorderStyles","forEach","side","colorSlug","getColorSlugFromVariable","exec","BorderPanel","clientId","isSupported","hasBorderSupport","name","isColorSupported","isRadiusSupported","isStyleSupported","isWidthSupported","isDisabled","every","Boolean","defaultBorderControls","showBorderByDefault","width","onBorderChange","newBorder","newBorderStyles","newBorderColor","top","right","bottom","left","slug","newStyle","hydratedBorder","blockName","feature","OS","support","removeBorderAttribute","attribute","addAttributes","settings","type","addSaveProps","blockType","borderClasses","getBorderClasses","newClassName","className","borderColorClass","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","withBorderColorPaletteStyles","BlockListBlock","borderColorValue","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","extraStyles","wrapperProps"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SACCC,8BAA8B,IAAIC,gBADnC,EAECC,6BAA6B,IAAIC,eAFlC,EAGCC,6BAA6B,IAAIC,eAHlC,EAICC,4BAA4B,IAAIC,cAJjC,QAKO,uBALP;AAMA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SACCC,gBADD,EAECC,oBAFD,EAGCC,iBAHD,QAIO,iBAJP;AAKA,SAASC,iBAAT,QAAkC,sBAAlC;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,OAAOC,mCAAP,MAAgD,yEAAhD;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,SAASC,gBAAT,EAA2BC,uBAA3B,QAA0D,SAA1D;AAEA,OAAO,MAAMC,kBAAkB,GAAG,sBAA3B;AAEP,MAAMC,WAAW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AAegD,MADoB,0DACnC,sBAAuBlC,KADY;AAFqB,GAAF,CAAxD;AAMA,QAAM;AAAEA,IAAAA,KAAK,EAAEgE;AAAT,MAA6B/D,mBAAmB,CAAE;AACvDP,IAAAA,MADuD;AAEvDQ,IAAAA,UAAU,EAAES,wBAAwB,CAAE3B,KAAF,aAAEA,KAAF,yCAAEA,KAAK,CAAEE,MAAT,0EAAE,eAAeiD,IAAjB,wDAAE,oBAAqBnC,KAAvB;AAFmB,GAAF,CAAtD;AAKA,QAAMiE,WAAW,GAAG;AACnBJ,IAAAA,cAAc,EAAEA,cAAc,IAAID,gBADf;AAEnBE,IAAAA,gBAAgB,EAAEA,gBAAgB,IAAIF,gBAFnB;AAGnBG,IAAAA,iBAAiB,EAAEA,iBAAiB,IAAIH,gBAHrB;AAInBI,IAAAA,eAAe,EAAEA,eAAe,IAAIJ;AAJjB,GAApB;AAOA,MAAIM,YAAY,GAAGpF,KAAK,CAACoF,YAAzB;AACAA,EAAAA,YAAY,GAAG,EACd,GAAGpF,KAAK,CAACoF,YADK;AAEdlF,IAAAA,KAAK,EAAE,EACN,2BAAGF,KAAK,CAACoF,YAAT,wDAAG,oBAAoBlF,KAAvB,CADM;AAEN,SAAGiF;AAFG;AAFO,GAAf;AAQA,SAAO,cAAC,cAAD,eAAqBnF,KAArB;AAA6B,IAAA,YAAY,EAAGoF;AAA5C,KAAP;AACA,CAtDoE,CAA/D;AAyDPlG,SAAS,CACR,0BADQ,EAER,2BAFQ,EAGR6E,aAHQ,CAAT;AAMA7E,SAAS,CACR,kCADQ,EAER,0BAFQ,EAGRgF,YAHQ,CAAT;AAMAhF,SAAS,CACR,0BADQ,EAER,0BAFQ,EAGRuF,YAHQ,CAAT;AAMAvF,SAAS,CACR,uBADQ,EAER,8CAFQ,EAGR0F,4BAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalBorderBoxControl as BorderBoxControl,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalIsDefinedBorder as isDefinedBorder,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { Platform } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBorderRadiusEdit,\n\thasBorderRadiusValue,\n\tresetBorderRadius,\n} from './border-radius';\nimport { getColorClassName } from '../components/colors';\nimport InspectorControls from '../components/inspector-controls';\nimport useMultipleOriginColorsAndGradients from '../components/colors-gradients/use-multiple-origin-colors-and-gradients';\nimport useSetting from '../components/use-setting';\nimport { cleanEmptyObject, shouldSkipSerialization } from './utils';\n\nexport const BORDER_SUPPORT_KEY = '__experimentalBorder';\n\nconst borderSides = [ 'top', 'right', 'bottom', 'left' ];\n\nconst hasBorderValue = ( props ) => {\n\tconst { borderColor, style } = props.attributes;\n\treturn isDefinedBorder( style?.border ) || !! borderColor;\n};\n\n// The border color, style, and width are omitted so they get undefined. The\n// border radius is separate and must retain its selection.\nconst resetBorder = ( { attributes = {}, setAttributes } ) => {\n\tconst { style } = attributes;\n\tsetAttributes( {\n\t\tborderColor: undefined,\n\t\tstyle: {\n\t\t\t...style,\n\t\t\tborder: cleanEmptyObject( {\n\t\t\t\tradius: style?.border?.radius,\n\t\t\t} ),\n\t\t},\n\t} );\n};\n\nconst resetBorderFilter = ( newAttributes ) => ( {\n\t...newAttributes,\n\tborderColor: undefined,\n\tstyle: {\n\t\t...newAttributes.style,\n\t\tborder: {\n\t\t\tradius: newAttributes.style?.border?.radius,\n\t\t},\n\t},\n} );\n\nconst getColorByProperty = ( colors, property, value ) => {\n\tlet matchedColor;\n\n\tcolors.some( ( origin ) =>\n\t\torigin.colors.some( ( color ) => {\n\t\t\tif ( color[ property ] === value ) {\n\t\t\t\tmatchedColor = color;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t} )\n\t);\n\n\treturn matchedColor;\n};\n\nexport const getMultiOriginColor = ( { colors, namedColor, customColor } ) => {\n\t// Search each origin (default, theme, or user) for matching color by name.\n\tif ( namedColor ) {\n\t\tconst colorObject = getColorByProperty( colors, 'slug', namedColor );\n\t\tif ( colorObject ) {\n\t\t\treturn colorObject;\n\t\t}\n\t}\n\n\t// Skip if no custom color or matching named color.\n\tif ( ! customColor ) {\n\t\treturn { color: undefined };\n\t}\n\n\t// Attempt to find color via custom color value or build new object.\n\tconst colorObject = getColorByProperty( colors, 'color', customColor );\n\treturn colorObject ? colorObject : { color: customColor };\n};\n\nconst getBorderObject = ( attributes, colors ) => {\n\tconst { borderColor, style } = attributes;\n\tconst { border: borderStyles } = style || {};\n\n\t// If we have a named color for a flat border. Fetch that color object and\n\t// apply that color's value to the color property within the style object.\n\tif ( borderColor ) {\n\t\tconst { color } = getMultiOriginColor( {\n\t\t\tcolors,\n\t\t\tnamedColor: borderColor,\n\t\t} );\n\n\t\treturn color ? { ...borderStyles, color } : borderStyles;\n\t}\n\n\t// Individual side border color slugs are stored within the border style\n\t// object. If we don't have a border styles object we have nothing further\n\t// to hydrate.\n\tif ( ! borderStyles ) {\n\t\treturn borderStyles;\n\t}\n\n\t// If we have named colors for the individual side borders, retrieve their\n\t// related color objects and apply the real color values to the split\n\t// border objects.\n\tconst hydratedBorderStyles = { ...borderStyles };\n\tborderSides.forEach( ( side ) => {\n\t\tconst colorSlug = getColorSlugFromVariable(\n\t\t\thydratedBorderStyles[ side ]?.color\n\t\t);\n\t\tif ( colorSlug ) {\n\t\t\tconst { color } = getMultiOriginColor( {\n\t\t\t\tcolors,\n\t\t\t\tnamedColor: colorSlug,\n\t\t\t} );\n\t\t\thydratedBorderStyles[ side ] = {\n\t\t\t\t...hydratedBorderStyles[ side ],\n\t\t\t\tcolor,\n\t\t\t};\n\t\t}\n\t} );\n\n\treturn hydratedBorderStyles;\n};\n\nfunction getColorSlugFromVariable( value ) {\n\tconst namedColor = /var:preset\\|color\\|(.+)/.exec( value );\n\tif ( namedColor && namedColor[ 1 ] ) {\n\t\treturn namedColor[ 1 ];\n\t}\n\treturn null;\n}\n\nexport function BorderPanel( props ) {\n\tconst { attributes, clientId, setAttributes } = props;\n\tconst { style } = attributes;\n\tconst { colors } = useMultipleOriginColorsAndGradients();\n\n\tconst isSupported = hasBorderSupport( props.name );\n\tconst isColorSupported =\n\t\tuseSetting( 'border.color' ) && hasBorderSupport( props.name, 'color' );\n\tconst isRadiusSupported =\n\t\tuseSetting( 'border.radius' ) &&\n\t\thasBorderSupport( props.name, 'radius' );\n\tconst isStyleSupported =\n\t\tuseSetting( 'border.style' ) && hasBorderSupport( props.name, 'style' );\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 || ! isSupported ) {\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 showBorderByDefault =\n\t\tdefaultBorderControls?.color || defaultBorderControls?.width;\n\n\tconst onBorderChange = ( newBorder ) => {\n\t\t// Filter out named colors and apply them to appropriate block\n\t\t// attributes so that CSS classes can be used to apply those colors.\n\t\t// e.g. has-primary-border-top-color.\n\n\t\tlet newBorderStyles = { ...newBorder };\n\t\tlet newBorderColor;\n\n\t\tif ( hasSplitBorders( newBorder ) ) {\n\t\t\t// For each side check if the side has a color value set\n\t\t\t// If so, determine if it belongs to a named color, in which case\n\t\t\t// we update the color property.\n\t\t\t//\n\t\t\t// This deliberately overwrites `newBorderStyles` to avoid mutating\n\t\t\t// the passed object which causes problems otherwise.\n\t\t\tnewBorderStyles = {\n\t\t\t\ttop: { ...newBorder.top },\n\t\t\t\tright: { ...newBorder.right },\n\t\t\t\tbottom: { ...newBorder.bottom },\n\t\t\t\tleft: { ...newBorder.left },\n\t\t\t};\n\n\t\t\tborderSides.forEach( ( side ) => {\n\t\t\t\tif ( newBorder[ side ]?.color ) {\n\t\t\t\t\tconst colorObject = getMultiOriginColor( {\n\t\t\t\t\t\tcolors,\n\t\t\t\t\t\tcustomColor: newBorder[ side ]?.color,\n\t\t\t\t\t} );\n\n\t\t\t\t\tif ( colorObject.slug ) {\n\t\t\t\t\t\tnewBorderStyles[\n\t\t\t\t\t\t\tside\n\t\t\t\t\t\t].color = `var:preset|color|${ colorObject.slug }`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t} else if ( newBorder?.color ) {\n\t\t\t// We have a flat border configuration. Apply named color slug to\n\t\t\t// `borderColor` attribute and clear color style property if found.\n\t\t\tconst customColor = newBorder?.color;\n\t\t\tconst colorObject = getMultiOriginColor( { colors, customColor } );\n\n\t\t\tif ( colorObject.slug ) {\n\t\t\t\tnewBorderColor = colorObject.slug;\n\t\t\t\tnewBorderStyles.color = undefined;\n\t\t\t}\n\t\t}\n\n\t\t// Ensure previous border radius styles are maintained and clean\n\t\t// overall result for empty objects or properties.\n\t\tconst newStyle = cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tborder: { radius: style?.border?.radius, ...newBorderStyles },\n\t\t} );\n\n\t\tsetAttributes( {\n\t\t\tstyle: newStyle,\n\t\t\tborderColor: newBorderColor,\n\t\t} );\n\t};\n\n\tconst hydratedBorder = getBorderObject( attributes, colors );\n\n\treturn (\n\t\t<InspectorControls __experimentalGroup=\"border\">\n\t\t\t{ ( isWidthSupported || isColorSupported ) && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasBorderValue( props ) }\n\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\tonDeselect={ () => resetBorder( props ) }\n\t\t\t\t\tisShownByDefault={ showBorderByDefault }\n\t\t\t\t\tresetAllFilter={ resetBorderFilter }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<BorderBoxControl\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tenableAlpha={ true }\n\t\t\t\t\t\tenableStyle={ isStyleSupported }\n\t\t\t\t\t\tonChange={ onBorderChange }\n\t\t\t\t\t\tpopoverOffset={ 40 }\n\t\t\t\t\t\tpopoverPlacement=\"left-start\"\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\tvalue={ hydratedBorder }\n\t\t\t\t\t\t__experimentalHasMultipleOrigins={ true }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={ true }\n\t\t\t\t\t/>\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={ ( newAttributes ) => ( {\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...newAttributes.style,\n\t\t\t\t\t\t\tborder: {\n\t\t\t\t\t\t\t\t...newAttributes.style?.border,\n\t\t\t\t\t\t\t\tradius: undefined,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t} ) }\n\t\t\t\t\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\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 borderClasses = getBorderClasses( attributes );\n\tconst newClassName = classnames( props.className, borderClasses );\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 * Generates a CSS class name consisting of all the applicable border color\n * classes given the current block attributes.\n *\n * @param {Object} attributes Block's attributes.\n *\n * @return {string} CSS class name.\n */\nexport function getBorderClasses( attributes ) {\n\tconst { borderColor, style } = attributes;\n\tconst borderColorClass = getColorClassName( 'border-color', borderColor );\n\n\treturn classnames( {\n\t\t'has-border-color': borderColor || style?.border?.color,\n\t\t[ borderColorClass ]: !! borderColorClass,\n\t} );\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, style } = attributes;\n\t\tconst { colors } = useMultipleOriginColorsAndGradients();\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 { color: borderColorValue } = getMultiOriginColor( {\n\t\t\tcolors,\n\t\t\tnamedColor: borderColor,\n\t\t} );\n\t\tconst { color: borderTopColor } = getMultiOriginColor( {\n\t\t\tcolors,\n\t\t\tnamedColor: getColorSlugFromVariable( style?.border?.top?.color ),\n\t\t} );\n\t\tconst { color: borderRightColor } = getMultiOriginColor( {\n\t\t\tcolors,\n\t\t\tnamedColor: getColorSlugFromVariable( style?.border?.right?.color ),\n\t\t} );\n\n\t\tconst { color: borderBottomColor } = getMultiOriginColor( {\n\t\t\tcolors,\n\t\t\tnamedColor: getColorSlugFromVariable(\n\t\t\t\tstyle?.border?.bottom?.color\n\t\t\t),\n\t\t} );\n\t\tconst { color: borderLeftColor } = getMultiOriginColor( {\n\t\t\tcolors,\n\t\t\tnamedColor: getColorSlugFromVariable( style?.border?.left?.color ),\n\t\t} );\n\n\t\tconst extraStyles = {\n\t\t\tborderTopColor: borderTopColor || borderColorValue,\n\t\t\tborderRightColor: borderRightColor || borderColorValue,\n\t\t\tborderBottomColor: borderBottomColor || borderColorValue,\n\t\t\tborderLeftColor: borderLeftColor || borderColorValue,\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...props.wrapperProps?.style,\n\t\t\t\t...extraStyles,\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"]}
@@ -34,7 +34,23 @@ export default function ColorPanel(_ref) {
34
34
  useEffect(() => {
35
35
  var _ref$current;
36
36
 
37
- if (!enableContrastChecking || !definedColors.length) {
37
+ if (!enableContrastChecking) {
38
+ return;
39
+ }
40
+
41
+ if (!definedColors.length) {
42
+ if (detectedBackgroundColor) {
43
+ setDetectedBackgroundColor();
44
+ }
45
+
46
+ if (detectedColor) {
47
+ setDetectedColor();
48
+ }
49
+
50
+ if (detectedLinkColor) {
51
+ setDetectedColor();
52
+ }
53
+
38
54
  return;
39
55
  }
40
56
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/color-panel.js"],"names":["useState","useEffect","ColorGradientSettingsDropdown","ContrastChecker","InspectorControls","useMultipleOriginColorsAndGradients","__unstableUseBlockRef","useBlockRef","getComputedStyle","node","ownerDocument","defaultView","ColorPanel","enableAlpha","settings","clientId","enableContrastChecking","detectedBackgroundColor","setDetectedBackgroundColor","detectedColor","setDetectedColor","detectedLinkColor","setDetectedLinkColor","ref","definedColors","filter","setting","colorValue","length","current","color","firstLinkElement","querySelector","innerText","backgroundColorNode","backgroundColor","parentNode","nodeType","ELEMENT_NODE","colorGradientSettings"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AAEA;AACA;AACA;;AACA,OAAOC,6BAAP,MAA0C,yCAA1C;AACA,OAAOC,eAAP,MAA4B,gCAA5B;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,OAAOC,mCAAP,MAAgD,yEAAhD;AACA,SAASC,qBAAqB,IAAIC,WAAlC,QAAqD,yDAArD;;AAEA,SAASC,gBAAT,CAA2BC,IAA3B,EAAkC;AACjC,SAAOA,IAAI,CAACC,aAAL,CAAmBC,WAAnB,CAA+BH,gBAA/B,CAAiDC,IAAjD,CAAP;AACA;;AAED,eAAe,SAASG,UAAT,OAKX;AAAA,MALgC;AACnCC,IAAAA,WAAW,GAAG,KADqB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A+BE,YAJjC,EAKE;AACDJ,MAAAA,mBAAmB,GAAGA,mBAAmB,CAACE,UAA1C;AACAD,MAAAA,eAAe,GACd3B,gBAAgB,CAAE0B,mBAAF,CAAhB,CAAwCC,eADzC;AAEA;;AAEDjB,IAAAA,0BAA0B,CAAEiB,eAAF,CAA1B;AACA,GA9BQ,CAAT;AAgCA,QAAMI,qBAAqB,GAAGlC,mCAAmC,EAAjE;AAEA,SACC,cAAC,iBAAD;AAAmB,IAAA,mBAAmB,EAAC;AAAvC,KACC,cAAC,6BAAD;AACC,IAAA,WAAW,EAAGQ,WADf;AAEC,IAAA,OAAO,EAAGE,QAFX;AAGC,IAAA,QAAQ,EAAGD,QAHZ;AAIC,IAAA,yBAAyB,EAAG,KAJ7B;AAKC,IAAA,gCAAgC,MALjC;AAMC,IAAA,iCAAiC;AANlC,KAOMyB,qBAPN,EADD,EAUGvB,sBAAsB,IACvB,cAAC,eAAD;AACC,IAAA,eAAe,EAAGC,uBADnB;AAEC,IAAA,SAAS,EAAGE,aAFb;AAGC,IAAA,kBAAkB,EAAGN,WAHtB;AAIC,IAAA,SAAS,EAAGQ;AAJb,IAXF,CADD;AAqBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientSettingsDropdown from '../components/colors-gradients/dropdown';\nimport ContrastChecker from '../components/contrast-checker';\nimport InspectorControls from '../components/inspector-controls';\nimport useMultipleOriginColorsAndGradients from '../components/colors-gradients/use-multiple-origin-colors-and-gradients';\nimport { __unstableUseBlockRef as useBlockRef } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction getComputedStyle( node ) {\n\treturn node.ownerDocument.defaultView.getComputedStyle( node );\n}\n\nexport default function ColorPanel( {\n\tenableAlpha = false,\n\tsettings,\n\tclientId,\n\tenableContrastChecking = true,\n} ) {\n\tconst [ detectedBackgroundColor, setDetectedBackgroundColor ] = useState();\n\tconst [ detectedColor, setDetectedColor ] = useState();\n\tconst [ detectedLinkColor, setDetectedLinkColor ] = useState();\n\tconst ref = useBlockRef( clientId );\n\tconst definedColors = settings.filter( ( setting ) => setting?.colorValue );\n\n\tuseEffect( () => {\n\t\tif ( ! enableContrastChecking || ! definedColors.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\t\tsetDetectedColor( getComputedStyle( ref.current ).color );\n\n\t\tconst firstLinkElement = ref.current?.querySelector( 'a' );\n\t\tif ( firstLinkElement && !! firstLinkElement.innerText ) {\n\t\t\tsetDetectedLinkColor( getComputedStyle( firstLinkElement ).color );\n\t\t}\n\n\t\tlet backgroundColorNode = ref.current;\n\t\tlet backgroundColor =\n\t\t\tgetComputedStyle( backgroundColorNode ).backgroundColor;\n\t\twhile (\n\t\t\tbackgroundColor === 'rgba(0, 0, 0, 0)' &&\n\t\t\tbackgroundColorNode.parentNode &&\n\t\t\tbackgroundColorNode.parentNode.nodeType ===\n\t\t\t\tbackgroundColorNode.parentNode.ELEMENT_NODE\n\t\t) {\n\t\t\tbackgroundColorNode = backgroundColorNode.parentNode;\n\t\t\tbackgroundColor =\n\t\t\t\tgetComputedStyle( backgroundColorNode ).backgroundColor;\n\t\t}\n\n\t\tsetDetectedBackgroundColor( backgroundColor );\n\t} );\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\treturn (\n\t\t<InspectorControls __experimentalGroup=\"color\">\n\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\tpanelId={ clientId }\n\t\t\t\tsettings={ settings }\n\t\t\t\t__experimentalIsItemGroup={ false }\n\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t{ ...colorGradientSettings }\n\t\t\t/>\n\t\t\t{ enableContrastChecking && (\n\t\t\t\t<ContrastChecker\n\t\t\t\t\tbackgroundColor={ detectedBackgroundColor }\n\t\t\t\t\ttextColor={ detectedColor }\n\t\t\t\t\tenableAlphaChecker={ enableAlpha }\n\t\t\t\t\tlinkColor={ detectedLinkColor }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/color-panel.js"],"names":["useState","useEffect","ColorGradientSettingsDropdown","ContrastChecker","InspectorControls","useMultipleOriginColorsAndGradients","__unstableUseBlockRef","useBlockRef","getComputedStyle","node","ownerDocument","defaultView","ColorPanel","enableAlpha","settings","clientId","enableContrastChecking","detectedBackgroundColor","setDetectedBackgroundColor","detectedColor","setDetectedColor","detectedLinkColor","setDetectedLinkColor","ref","definedColors","filter","setting","colorValue","length","current","color","firstLinkElement","querySelector","innerText","backgroundColorNode","backgroundColor","parentNode","nodeType","ELEMENT_NODE","colorGradientSettings"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AAEA;AACA;AACA;;AACA,OAAOC,6BAAP,MAA0C,yCAA1C;AACA,OAAOC,eAAP,MAA4B,gCAA5B;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,OAAOC,mCAAP,MAAgD,yEAAhD;AACA,SAASC,qBAAqB,IAAIC,WAAlC,QAAqD,yDAArD;;AAEA,SAASC,gBAAT,CAA2BC,IAA3B,EAAkC;AACjC,SAAOA,IAAI,CAACC,aAAL,CAAmBC,WAAnB,CAA+BH,gBAA/B,CAAiDC,IAAjD,CAAP;AACA;;AAED,eAAe,SAASG,UAAT,OAKX;AAAA,MALgC;AACnCC,IAAAA,WAAW,GAAG,KADqB;AAEnCC,IAAAA,QAFmC;AAGnCC,IAAAA,QAHmC;AAInCC,IAAAA,sBAAsB,GAAG;AAJU,GAKhC;AACH,QAAM,CAAEC,uBAAF,EAA2BC,0BAA3B,IAA0DlB,QAAQ,EAAxE;AACA,QAAM,CAAEmB,aAAF,EAAiBC,gBAAjB,IAAsCpB,QAAQ,EAApD;AACA,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AA,mBAAmB,GAAGA,mBAAmB,CAACE,UAA1C;AACAD,MAAAA,eAAe,GACd3B,gBAAgB,CAAE0B,mBAAF,CAAhB,CAAwCC,eADzC;AAEA;;AAEDjB,IAAAA,0BAA0B,CAAEiB,eAAF,CAA1B;AACA,GA1CQ,CAAT;AA4CA,QAAMI,qBAAqB,GAAGlC,mCAAmC,EAAjE;AAEA,SACC,cAAC,iBAAD;AAAmB,IAAA,mBAAmB,EAAC;AAAvC,KACC,cAAC,6BAAD;AACC,IAAA,WAAW,EAAGQ,WADf;AAEC,IAAA,OAAO,EAAGE,QAFX;AAGC,IAAA,QAAQ,EAAGD,QAHZ;AAIC,IAAA,yBAAyB,EAAG,KAJ7B;AAKC,IAAA,gCAAgC,MALjC;AAMC,IAAA,iCAAiC;AANlC,KAOMyB,qBAPN,EADD,EAUGvB,sBAAsB,IACvB,cAAC,eAAD;AACC,IAAA,eAAe,EAAGC,uBADnB;AAEC,IAAA,SAAS,EAAGE,aAFb;AAGC,IAAA,kBAAkB,EAAGN,WAHtB;AAIC,IAAA,SAAS,EAAGQ;AAJb,IAXF,CADD;AAqBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientSettingsDropdown from '../components/colors-gradients/dropdown';\nimport ContrastChecker from '../components/contrast-checker';\nimport InspectorControls from '../components/inspector-controls';\nimport useMultipleOriginColorsAndGradients from '../components/colors-gradients/use-multiple-origin-colors-and-gradients';\nimport { __unstableUseBlockRef as useBlockRef } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction getComputedStyle( node ) {\n\treturn node.ownerDocument.defaultView.getComputedStyle( node );\n}\n\nexport default function ColorPanel( {\n\tenableAlpha = false,\n\tsettings,\n\tclientId,\n\tenableContrastChecking = true,\n} ) {\n\tconst [ detectedBackgroundColor, setDetectedBackgroundColor ] = useState();\n\tconst [ detectedColor, setDetectedColor ] = useState();\n\tconst [ detectedLinkColor, setDetectedLinkColor ] = useState();\n\tconst ref = useBlockRef( clientId );\n\tconst definedColors = settings.filter( ( setting ) => setting?.colorValue );\n\n\tuseEffect( () => {\n\t\tif ( ! enableContrastChecking ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( ! definedColors.length ) {\n\t\t\tif ( detectedBackgroundColor ) {\n\t\t\t\tsetDetectedBackgroundColor();\n\t\t\t}\n\t\t\tif ( detectedColor ) {\n\t\t\t\tsetDetectedColor();\n\t\t\t}\n\t\t\tif ( detectedLinkColor ) {\n\t\t\t\tsetDetectedColor();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\t\tsetDetectedColor( getComputedStyle( ref.current ).color );\n\n\t\tconst firstLinkElement = ref.current?.querySelector( 'a' );\n\t\tif ( firstLinkElement && !! firstLinkElement.innerText ) {\n\t\t\tsetDetectedLinkColor( getComputedStyle( firstLinkElement ).color );\n\t\t}\n\n\t\tlet backgroundColorNode = ref.current;\n\t\tlet backgroundColor =\n\t\t\tgetComputedStyle( backgroundColorNode ).backgroundColor;\n\t\twhile (\n\t\t\tbackgroundColor === 'rgba(0, 0, 0, 0)' &&\n\t\t\tbackgroundColorNode.parentNode &&\n\t\t\tbackgroundColorNode.parentNode.nodeType ===\n\t\t\t\tbackgroundColorNode.parentNode.ELEMENT_NODE\n\t\t) {\n\t\t\tbackgroundColorNode = backgroundColorNode.parentNode;\n\t\t\tbackgroundColor =\n\t\t\t\tgetComputedStyle( backgroundColorNode ).backgroundColor;\n\t\t}\n\n\t\tsetDetectedBackgroundColor( backgroundColor );\n\t} );\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\treturn (\n\t\t<InspectorControls __experimentalGroup=\"color\">\n\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\tpanelId={ clientId }\n\t\t\t\tsettings={ settings }\n\t\t\t\t__experimentalIsItemGroup={ false }\n\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t{ ...colorGradientSettings }\n\t\t\t/>\n\t\t\t{ enableContrastChecking && (\n\t\t\t\t<ContrastChecker\n\t\t\t\t\tbackgroundColor={ detectedBackgroundColor }\n\t\t\t\t\ttextColor={ detectedColor }\n\t\t\t\t\tenableAlphaChecker={ enableAlpha }\n\t\t\t\t\tlinkColor={ detectedLinkColor }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n"]}
@@ -382,7 +382,7 @@ export function ColorEdit(props) {
382
382
  };
383
383
 
384
384
  const defaultColorControls = getBlockSupport(props.name, [COLOR_SUPPORT_KEY, '__experimentalDefaultControls']);
385
- const enableContrastChecking = Platform.OS === 'web' && !gradient && !(style !== null && style !== void 0 && (_style$color6 = style.color) !== null && _style$color6 !== void 0 && _style$color6.gradient) && // Contrast checking is enabled by default.
385
+ const enableContrastChecking = Platform.OS === 'web' && !gradient && !(style !== null && style !== void 0 && (_style$color6 = style.color) !== null && _style$color6 !== void 0 && _style$color6.gradient) && hasBackgroundColor && (hasLinkColor || hasTextColor) && // Contrast checking is enabled by default.
386
386
  // Deactivating it requires `enableContrastChecker` to have
387
387
  // an explicit value of `false`.
388
388
  false !== getBlockSupport(props.name, [COLOR_SUPPORT_KEY, 'enableContrastChecker']);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/color.js"],"names":["classnames","addFilter","getBlockSupport","__","useRef","useEffect","useMemo","Platform","createHigherOrderComponent","getColorClassName","getColorObjectByColorValue","getColorObjectByAttributeValues","__experimentalGetGradientClass","getGradientValueBySlug","getGradientSlugByValue","cleanEmptyObject","transformStyles","immutableSet","shouldSkipSerialization","ColorPanel","useSetting","COLOR_SUPPORT_KEY","hasColorSupport","blockType","colorSupport","link","gradient","background","text","hasLinkColorSupport","OS","hasGradientSupport","gradients","hasBackgroundColorSupport","hasTextColorSupport","clearColorFromStyles","path","style","undefined","resetAllTextFilter","attributes","textColor","resetAllLinkFilter","clearBackgroundAndGradient","backgroundColor","color","addAttributes","settings","Object","assign","type","addSaveProps","props","hasGradient","shouldSerialize","feature","textClass","gradientClass","backgroundClass","serializeHasBackground","hasBackground","newClassName","className","elements","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","getLinkColorFromAttributeValue","colors","value","attributeParsed","exec","ColorEdit","name","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","setAttributes","onChangeGradient","onChangeLinkColor","newLinkColorValue","defaultColorControls","enableContrastChecking","clientId","label","onColorChange","colorValue","isShownByDefault","resetAllFilter","onGradientChange","clearable","withColorPaletteStyles","BlockListBlock","extraStyles","wrapperProps","MIGRATION_PATHS","linkColor","addTransforms","result","source","index","results","destinationBlockType","activeSupports"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,SAAjB,EAA4BC,OAA5B,EAAqCC,QAArC,QAAqD,oBAArD;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AAEA;AACA;AACA;;AACA,SACCC,iBADD,EAECC,0BAFD,EAGCC,+BAHD,QAIO,sBAJP;AAKA,SACCC,8BADD,EAECC,sBAFD,EAGCC,sBAHD,QAIO,yBAJP;AAKA,SACCC,gBADD,EAECC,eAFD,EAGCC,YAHD,EAICC,uBAJD,QAKO,SALP;AAMA,OAAOC,UAAP,MAAuB,eAAvB;AAC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AACrD,IAApC;AACA,QAAM0D,cAAc,GAAG;AACtBP,IAAAA,SAAS,EAAE/F,mBAAmB,CAAEqG,oBAAF,CADR;AAEtBzF,IAAAA,SAAS,EAAEP,mBAAmB,CAAEgG,oBAAF,CAFR;AAGtBtF,IAAAA,eAAe,EAAEX,yBAAyB,CAAEiG,oBAAF,CAHpB;AAItBxG,IAAAA,QAAQ,EAAEK,kBAAkB,CAAEmG,oBAAF;AAJN,GAAvB;AAMA,SAAOlH,eAAe,CACrBmH,cADqB,EAErBR,eAFqB,EAGrBG,MAHqB,EAIrBC,MAJqB,EAKrBC,KALqB,EAMrBC,OANqB,CAAtB;AAQA;AAEDhI,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGR6C,aAHQ,CAAT;AAMA7C,SAAS,CACR,kCADQ,EAER,yBAFQ,EAGRkD,YAHQ,CAAT;AAMAlD,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGR+D,YAHQ,CAAT;AAMA/D,SAAS,CACR,uBADQ,EAER,sCAFQ,EAGRsH,sBAHQ,CAAT;AAMAtH,SAAS,CACR,2CADQ,EAER,0BAFQ,EAGR4H,aAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\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 (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.link\n\t);\n};\n\nconst hasGradientSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.gradients\n\t);\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 * 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 * 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 * 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 * 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\tlocalAttributes.current?.style,\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\tlocalAttributes.current = {\n\t\t\t...localAttributes.current,\n\t\t\t...{ style: newStyle },\n\t\t};\n\t};\n\n\tconst defaultColorControls = getBlockSupport( props.name, [\n\t\tCOLOR_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst enableContrastChecking =\n\t\tPlatform.OS === 'web' &&\n\t\t! gradient &&\n\t\t! style?.color?.gradient &&\n\t\t// Contrast checking is enabled by default.\n\t\t// Deactivating it requires `enableContrastChecker` to have\n\t\t// an explicit value of `false`.\n\t\tfalse !==\n\t\t\tgetBlockSupport( props.name, [\n\t\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t\t'enableContrastChecker',\n\t\t\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\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\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:\n\t\t\t\t\t\t\t\t\t!! style?.elements?.link?.color?.text,\n\t\t\t\t\t\t\t\tisShownByDefault: defaultColorControls?.link,\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"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/color.js"],"names":["classnames","addFilter","getBlockSupport","__","useRef","useEffect","useMemo","Platform","createHigherOrderComponent","getColorClassName","getColorObjectByColorValue","getColorObjectByAttributeValues","__experimentalGetGradientClass","getGradientValueBySlug","getGradientSlugByValue","cleanEmptyObject","transformStyles","immutableSet","shouldSkipSerialization","ColorPanel","useSetting","COLOR_SUPPORT_KEY","hasColorSupport","blockType","colorSupport","link","gradient","background","text","hasLinkColorSupport","OS","hasGradientSupport","gradients","hasBackgroundColorSupport","hasTextColorSupport","clearColorFromStyles","path","style","undefined","resetAllTextFilter","attributes","textColor","resetAllLinkFilter","clearBackgroundAndGradient","backgroundColor","color","addAttributes","settings","Object","assign","type","addSaveProps","props","hasGradient","shouldSerialize","feature","textClass","gradientClass","backgroundClass","serializeHasBackground","hasBackground","newClassName","className","elements","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","getLinkColorFromAttributeValue","colors","value","attributeParsed","exec","ColorEdit","name","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","setAttributes","onChangeGradient","onChangeLinkColor","newLinkColorValue","defaultColorControls","enableContrastChecking","clientId","label","onColorChange","colorValue","isShownByDefault","resetAllFilter","onGradientChange","clearable","withColorPaletteStyles","BlockListBlock","extraStyles","wrapperProps","MIGRATION_PATHS","linkColor","addTransforms","result","source","index","results","destinationBlockType","activeSupports"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,SAAjB,EAA4BC,OAA5B,EAAqCC,QAArC,QAAqD,oBAArD;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AAEA;AACA;AACA;;AACA,SACCC,iBADD,EAECC,0BAFD,EAGCC,+BAHD,QAIO,sBAJP;AAKA,SACCC,8BADD,EAECC,sBAFD,EAGCC,sBAHD,QAIO,yBAJP;AAKA,SACCC,gBADD,EAECC,eAFD,EAGCC,YAHD,EAICC,uBAJD,QAKO,S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MAAhC,EAAwCC,KAAxC,EAA+CC,OAA/C,EAAyD;AAC/D,QAAMC,oBAAoB,GAAGJ,MAAM,CAACrD,IAApC;AACA,QAAM0D,cAAc,GAAG;AACtBP,IAAAA,SAAS,EAAE/F,mBAAmB,CAAEqG,oBAAF,CADR;AAEtBzF,IAAAA,SAAS,EAAEP,mBAAmB,CAAEgG,oBAAF,CAFR;AAGtBtF,IAAAA,eAAe,EAAEX,yBAAyB,CAAEiG,oBAAF,CAHpB;AAItBxG,IAAAA,QAAQ,EAAEK,kBAAkB,CAAEmG,oBAAF;AAJN,GAAvB;AAMA,SAAOlH,eAAe,CACrBmH,cADqB,EAErBR,eAFqB,EAGrBG,MAHqB,EAIrBC,MAJqB,EAKrBC,KALqB,EAMrBC,OANqB,CAAtB;AAQA;AAEDhI,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGR6C,aAHQ,CAAT;AAMA7C,SAAS,CACR,kCADQ,EAER,yBAFQ,EAGRkD,YAHQ,CAAT;AAMAlD,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGR+D,YAHQ,CAAT;AAMA/D,SAAS,CACR,uBADQ,EAER,sCAFQ,EAGRsH,sBAHQ,CAAT;AAMAtH,SAAS,CACR,2CADQ,EAER,0BAFQ,EAGR4H,aAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\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 (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.link\n\t);\n};\n\nconst hasGradientSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.gradients\n\t);\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 * 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 * 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 * 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 * 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\tlocalAttributes.current?.style,\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\tlocalAttributes.current = {\n\t\t\t...localAttributes.current,\n\t\t\t...{ style: newStyle },\n\t\t};\n\t};\n\n\tconst defaultColorControls = getBlockSupport( props.name, [\n\t\tCOLOR_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst enableContrastChecking =\n\t\tPlatform.OS === 'web' &&\n\t\t! gradient &&\n\t\t! style?.color?.gradient &&\n\t\thasBackgroundColor &&\n\t\t( hasLinkColor || hasTextColor ) &&\n\t\t// Contrast checking is enabled by default.\n\t\t// Deactivating it requires `enableContrastChecker` to have\n\t\t// an explicit value of `false`.\n\t\tfalse !==\n\t\t\tgetBlockSupport( props.name, [\n\t\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t\t'enableContrastChecker',\n\t\t\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\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\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:\n\t\t\t\t\t\t\t\t\t!! style?.elements?.link?.color?.text,\n\t\t\t\t\t\t\t\tisShownByDefault: defaultColorControls?.link,\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"]}
@@ -4,7 +4,7 @@ import { createElement, Fragment } from "@wordpress/element";
4
4
  /**
5
5
  * WordPress dependencies
6
6
  */
7
- import { ToolbarButton } from '@wordpress/components';
7
+ import { ToolbarButton, MenuItem } from '@wordpress/components';
8
8
  import { createHigherOrderComponent } from '@wordpress/compose';
9
9
  import { useDispatch, useSelect } from '@wordpress/data';
10
10
  import { addFilter } from '@wordpress/hooks';
@@ -15,7 +15,7 @@ import { useEffect, useRef, useCallback } from '@wordpress/element';
15
15
  */
16
16
 
17
17
  import { store as blockEditorStore } from '../store';
18
- import { BlockControls } from '../components';
18
+ import { BlockControls, BlockSettingsMenuControls } from '../components';
19
19
  /**
20
20
  * External dependencies
21
21
  */
@@ -94,16 +94,21 @@ export const withBlockControls = createHigherOrderComponent(BlockEdit => props =
94
94
  return createElement(BlockEdit, props);
95
95
  }
96
96
 
97
- return createElement(Fragment, null, isEditingAsBlocks && !isContentLocked && createElement(StopEditingAsBlocksOnOutsideSelect, {
97
+ return createElement(Fragment, null, isEditingAsBlocks && !isContentLocked && createElement(Fragment, null, createElement(StopEditingAsBlocksOnOutsideSelect, {
98
98
  clientId: props.clientId,
99
99
  stopEditingAsBlock: stopEditingAsBlock
100
100
  }), createElement(BlockControls, {
101
101
  group: "other"
102
102
  }, createElement(ToolbarButton, {
103
103
  onClick: () => {
104
- if (isEditingAsBlocks && !isContentLocked) {
105
- stopEditingAsBlock();
106
- } else {
104
+ stopEditingAsBlock();
105
+ }
106
+ }, __('Done')))), !isEditingAsBlocks && isContentLocked && props.isSelected && createElement(BlockSettingsMenuControls, null, _ref2 => {
107
+ let {
108
+ onClose
109
+ } = _ref2;
110
+ return createElement(MenuItem, {
111
+ onClick: () => {
107
112
  __unstableMarkNextChangeAsNotPersistent();
108
113
 
109
114
  updateBlockAttributes(props.clientId, {
@@ -118,9 +123,11 @@ export const withBlockControls = createHigherOrderComponent(BlockEdit => props =
118
123
  });
119
124
 
120
125
  __unstableSetTemporarilyEditingAsBlocks(props.clientId);
126
+
127
+ onClose();
121
128
  }
122
- }
123
- }, isEditingAsBlocks && !isContentLocked ? __('Done') : __('Modify'))), createElement(BlockEdit, _extends({}, props, {
129
+ }, __('Modify'));
130
+ }), createElement(BlockEdit, _extends({}, props, {
124
131
  className: classnames(props.className, isEditingAsBlocks && 'is-content-locked-editing-as-blocks')
125
132
  })));
126
133
  }, 'withToolbarControls');
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/content-lock-ui.js"],"names":["ToolbarButton","createHigherOrderComponent","useDispatch","useSelect","addFilter","__","useEffect","useRef","useCallback","store","blockEditorStore","BlockControls","classnames","StopEditingAsBlocksOnOutsideSelect","clientId","stopEditingAsBlock","isBlockOrDescendantSelected","select","isBlockSelected","hasSelectedInnerBlock","withBlockControls","BlockEdit","props","getBlockListSettings","getSettings","focusModeToRevert","templateLock","isLockedByParent","isEditingAsBlocks","__unstableGetContentLockingParent","getTemplateLock","__unstableGetTemporarilyEditingAsBlocks","updateSettings","updateBlockListSettings","__unstableSetTemporarilyEditingAsBlocks","isContentLocked","__unstableMarkNextChangeAsNotPersistent","updateBlockAttributes","focusMode","current","undefined","className"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,aAAT,QAA8B,uBAA9B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,EAAoBC,MAApB,EAA4BC,WAA5B,QAA+C,oBAA/C;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AACA,SAASC,aAAT,QAA8B,eAA9B;AACA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,YAAvB;;AAEA,SAASC,kCAAT,OAGI;AAAA,MAHyC;AAC5CC,IAAAA,QAD4C;AAE5CC,IAAAA;AAF4C,GAGzC;AACH,QAAMC,2BAA2B,GAAGb,SAAS,CAC1Cc,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QACLF,MAAM,CAAEP,gBAAF,CADP;AAEA,WACCQ,eAAe,CAAEJ,QAAF,CAAf,IACAK,qBAAqB,CAAEL,QAAF,EAAY,IAAZ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ACR,QAAR,CADiB;AAExCY,UAAAA,YAAY,EAAE;AAF0B,SAAlB,CAAvB;AAIAD,QAAAA,iBAAiB,CAACc,OAAlB,GACCf,WAAW,GAAGc,SADf;AAEAN,QAAAA,cAAc,CAAE;AAAEM,UAAAA,SAAS,EAAE;AAAb,SAAF,CAAd;;AACAJ,QAAAA,uCAAuC,CACtCZ,KAAK,CAACR,QADgC,CAAvC;AAGA;AACD;AApBF,KAsBGc,iBAAiB,IAAI,CAAEO,eAAvB,GACC9B,EAAE,CAAE,MAAF,CADH,GAECA,EAAE,CAAE,QAAF,CAxBN,CADD,CAPD,EAmCC,cAAC,SAAD,eACMiB,KADN;AAEC,IAAA,SAAS,EAAGV,UAAU,CACrBU,KAAK,CAACmB,SADe,EAErBb,iBAAiB,IAChB,qCAHoB;AAFvB,KAnCD,CADD;AA8CA,CA7GyD,EA8G1D,qBA9G0D,CAApD;AAiHPxB,SAAS,CACR,kBADQ,EAER,gCAFQ,EAGRgB,iBAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { BlockControls } from '../components';\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\nfunction StopEditingAsBlocksOnOutsideSelect( {\n\tclientId,\n\tstopEditingAsBlock,\n} ) {\n\tconst isBlockOrDescendantSelected = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isBlockSelected, hasSelectedInnerBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\tisBlockSelected( clientId ) ||\n\t\t\t\thasSelectedInnerBlock( clientId, true )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tuseEffect( () => {\n\t\tif ( ! isBlockOrDescendantSelected ) {\n\t\t\tstopEditingAsBlock();\n\t\t}\n\t}, [ isBlockOrDescendantSelected ] );\n\treturn null;\n}\n\nexport const withBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { getBlockListSettings, getSettings } =\n\t\t\tuseSelect( blockEditorStore );\n\t\tconst focusModeToRevert = useRef();\n\t\tconst { templateLock, isLockedByParent, isEditingAsBlocks } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\t__unstableGetContentLockingParent,\n\t\t\t\t\tgetTemplateLock,\n\t\t\t\t\t__unstableGetTemporarilyEditingAsBlocks,\n\t\t\t\t} = select( blockEditorStore );\n\t\t\t\treturn {\n\t\t\t\t\ttemplateLock: getTemplateLock( props.clientId ),\n\t\t\t\t\tisLockedByParent: !! __unstableGetContentLockingParent(\n\t\t\t\t\t\tprops.clientId\n\t\t\t\t\t),\n\t\t\t\t\tisEditingAsBlocks:\n\t\t\t\t\t\t__unstableGetTemporarilyEditingAsBlocks() ===\n\t\t\t\t\t\tprops.clientId,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ props.clientId ]\n\t\t);\n\n\t\tconst {\n\t\t\tupdateSettings,\n\t\t\tupdateBlockListSettings,\n\t\t\t__unstableSetTemporarilyEditingAsBlocks,\n\t\t} = useDispatch( blockEditorStore );\n\t\tconst isContentLocked =\n\t\t\t! isLockedByParent && templateLock === 'contentOnly';\n\t\tconst {\n\t\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\t\tupdateBlockAttributes,\n\t\t} = useDispatch( blockEditorStore );\n\n\t\tconst stopEditingAsBlock = useCallback( () => {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateBlockAttributes( props.clientId, {\n\t\t\t\ttemplateLock: 'contentOnly',\n\t\t\t} );\n\t\t\tupdateBlockListSettings( props.clientId, {\n\t\t\t\t...getBlockListSettings( props.clientId ),\n\t\t\t\ttemplateLock: 'contentOnly',\n\t\t\t} );\n\t\t\tupdateSettings( { focusMode: focusModeToRevert.current } );\n\t\t\t__unstableSetTemporarilyEditingAsBlocks();\n\t\t}, [\n\t\t\tprops.clientId,\n\t\t\tfocusModeToRevert,\n\t\t\tupdateSettings,\n\t\t\tupdateBlockListSettings,\n\t\t\tgetBlockListSettings,\n\t\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\t\tupdateBlockAttributes,\n\t\t\t__unstableSetTemporarilyEditingAsBlocks,\n\t\t] );\n\n\t\tif ( ! isContentLocked && ! isEditingAsBlocks ) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ isEditingAsBlocks && ! isContentLocked && (\n\t\t\t\t\t<StopEditingAsBlocksOnOutsideSelect\n\t\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\t\tstopEditingAsBlock={ stopEditingAsBlock }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( isEditingAsBlocks && ! isContentLocked ) {\n\t\t\t\t\t\t\t\tstopEditingAsBlock();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tupdateBlockAttributes( props.clientId, {\n\t\t\t\t\t\t\t\t\ttemplateLock: undefined,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\tupdateBlockListSettings( props.clientId, {\n\t\t\t\t\t\t\t\t\t...getBlockListSettings( props.clientId ),\n\t\t\t\t\t\t\t\t\ttemplateLock: false,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\tfocusModeToRevert.current =\n\t\t\t\t\t\t\t\t\tgetSettings().focusMode;\n\t\t\t\t\t\t\t\tupdateSettings( { focusMode: true } );\n\t\t\t\t\t\t\t\t__unstableSetTemporarilyEditingAsBlocks(\n\t\t\t\t\t\t\t\t\tprops.clientId\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isEditingAsBlocks && ! isContentLocked\n\t\t\t\t\t\t\t? __( 'Done' )\n\t\t\t\t\t\t\t: __( 'Modify' ) }\n\t\t\t\t\t</ToolbarButton>\n\t\t\t\t</BlockControls>\n\t\t\t\t<BlockEdit\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\tisEditingAsBlocks &&\n\t\t\t\t\t\t\t'is-content-locked-editing-as-blocks'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/style/with-block-controls',\n\twithBlockControls\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/content-lock-ui.js"],"names":["ToolbarButton","MenuItem","createHigherOrderComponent","useDispatch","useSelect","addFilter","__","useEffect","useRef","useCallback","store","blockEditorStore","BlockControls","BlockSettingsMenuControls","classnames","StopEditingAsBlocksOnOutsideSelect","clientId","stopEditingAsBlock","isBlockOrDescendantSelected","select","isBlockSelected","hasSelectedInnerBlock","withBlockControls","BlockEdit","props","getBlockListSettings","getSettings","focusModeToRevert","templateLock","isLockedByParent","isEditingAsBlocks","__unstableGetContentLockingParent","getTemplateLock","__unstableGetTemporarilyEditingAsBlocks","updateSettings","updateBlockListSettings","__unstableSetTemporarilyEditingAsBlocks","isContentLocked","__unstableMarkNextChangeAsNotPersistent","updateBlockAttributes","focusMode","current","isSelected","onClose","undefined","className"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,uBAAxC;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,WAAT,EAAsBC,SAAtB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BAAiB,IAChB,qCAHoB;AAFvB,KA/CD,CADD;AA0DA,CAzHyD,EA0H1D,qBA1H0D,CAApD;AA6HPzB,SAAS,CACR,kBADQ,EAER,gCAFQ,EAGRiB,iBAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarButton, MenuItem } from '@wordpress/components';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { BlockControls, BlockSettingsMenuControls } from '../components';\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\nfunction StopEditingAsBlocksOnOutsideSelect( {\n\tclientId,\n\tstopEditingAsBlock,\n} ) {\n\tconst isBlockOrDescendantSelected = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isBlockSelected, hasSelectedInnerBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\tisBlockSelected( clientId ) ||\n\t\t\t\thasSelectedInnerBlock( clientId, true )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tuseEffect( () => {\n\t\tif ( ! isBlockOrDescendantSelected ) {\n\t\t\tstopEditingAsBlock();\n\t\t}\n\t}, [ isBlockOrDescendantSelected ] );\n\treturn null;\n}\n\nexport const withBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { getBlockListSettings, getSettings } =\n\t\t\tuseSelect( blockEditorStore );\n\t\tconst focusModeToRevert = useRef();\n\t\tconst { templateLock, isLockedByParent, isEditingAsBlocks } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\t__unstableGetContentLockingParent,\n\t\t\t\t\tgetTemplateLock,\n\t\t\t\t\t__unstableGetTemporarilyEditingAsBlocks,\n\t\t\t\t} = select( blockEditorStore );\n\t\t\t\treturn {\n\t\t\t\t\ttemplateLock: getTemplateLock( props.clientId ),\n\t\t\t\t\tisLockedByParent: !! __unstableGetContentLockingParent(\n\t\t\t\t\t\tprops.clientId\n\t\t\t\t\t),\n\t\t\t\t\tisEditingAsBlocks:\n\t\t\t\t\t\t__unstableGetTemporarilyEditingAsBlocks() ===\n\t\t\t\t\t\tprops.clientId,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ props.clientId ]\n\t\t);\n\n\t\tconst {\n\t\t\tupdateSettings,\n\t\t\tupdateBlockListSettings,\n\t\t\t__unstableSetTemporarilyEditingAsBlocks,\n\t\t} = useDispatch( blockEditorStore );\n\t\tconst isContentLocked =\n\t\t\t! isLockedByParent && templateLock === 'contentOnly';\n\t\tconst {\n\t\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\t\tupdateBlockAttributes,\n\t\t} = useDispatch( blockEditorStore );\n\n\t\tconst stopEditingAsBlock = useCallback( () => {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateBlockAttributes( props.clientId, {\n\t\t\t\ttemplateLock: 'contentOnly',\n\t\t\t} );\n\t\t\tupdateBlockListSettings( props.clientId, {\n\t\t\t\t...getBlockListSettings( props.clientId ),\n\t\t\t\ttemplateLock: 'contentOnly',\n\t\t\t} );\n\t\t\tupdateSettings( { focusMode: focusModeToRevert.current } );\n\t\t\t__unstableSetTemporarilyEditingAsBlocks();\n\t\t}, [\n\t\t\tprops.clientId,\n\t\t\tfocusModeToRevert,\n\t\t\tupdateSettings,\n\t\t\tupdateBlockListSettings,\n\t\t\tgetBlockListSettings,\n\t\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\t\tupdateBlockAttributes,\n\t\t\t__unstableSetTemporarilyEditingAsBlocks,\n\t\t] );\n\n\t\tif ( ! isContentLocked && ! isEditingAsBlocks ) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ isEditingAsBlocks && ! isContentLocked && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<StopEditingAsBlocksOnOutsideSelect\n\t\t\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\t\t\tstopEditingAsBlock={ stopEditingAsBlock }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tstopEditingAsBlock();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Done' ) }\n\t\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t\t</BlockControls>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ ! isEditingAsBlocks && isContentLocked && props.isSelected && (\n\t\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\t\tupdateBlockAttributes( props.clientId, {\n\t\t\t\t\t\t\t\t\t\ttemplateLock: undefined,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\tupdateBlockListSettings( props.clientId, {\n\t\t\t\t\t\t\t\t\t\t...getBlockListSettings(\n\t\t\t\t\t\t\t\t\t\t\tprops.clientId\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\ttemplateLock: false,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\tfocusModeToRevert.current =\n\t\t\t\t\t\t\t\t\t\tgetSettings().focusMode;\n\t\t\t\t\t\t\t\t\tupdateSettings( { focusMode: true } );\n\t\t\t\t\t\t\t\t\t__unstableSetTemporarilyEditingAsBlocks(\n\t\t\t\t\t\t\t\t\t\tprops.clientId\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Modify' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</BlockSettingsMenuControls>\n\t\t\t\t) }\n\t\t\t\t<BlockEdit\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\tisEditingAsBlocks &&\n\t\t\t\t\t\t\t'is-content-locked-editing-as-blocks'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/style/with-block-controls',\n\twithBlockControls\n);\n"]}