@wordpress/block-editor 11.0.0 → 11.1.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 (326) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/README.md +2 -1
  3. package/build/components/alignment-control/ui.js +1 -7
  4. package/build/components/alignment-control/ui.js.map +1 -1
  5. package/build/components/block-alignment-control/use-available-alignments.js +4 -3
  6. package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
  7. package/build/components/block-icon/index.js +4 -2
  8. package/build/components/block-icon/index.js.map +1 -1
  9. package/build/components/block-inspector/index.js +55 -4
  10. package/build/components/block-inspector/index.js.map +1 -1
  11. package/build/components/block-list-appender/index.js +46 -34
  12. package/build/components/block-list-appender/index.js.map +1 -1
  13. package/build/components/block-list-appender/index.native.js +39 -34
  14. package/build/components/block-list-appender/index.native.js.map +1 -1
  15. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +18 -18
  16. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  17. package/build/components/block-mobile-toolbar/index.native.js +1 -1
  18. package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
  19. package/build/components/block-pattern-setup/index.js +14 -7
  20. package/build/components/block-pattern-setup/index.js.map +1 -1
  21. package/build/components/block-styles/index.native.js +1 -3
  22. package/build/components/block-styles/index.native.js.map +1 -1
  23. package/build/components/block-styles/utils.js +7 -10
  24. package/build/components/block-styles/utils.js.map +1 -1
  25. package/build/components/block-toolbar/index.native.js +6 -8
  26. package/build/components/block-toolbar/index.native.js.map +1 -1
  27. package/build/components/block-tools/selected-block-popover.js +1 -3
  28. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  29. package/build/components/block-variation-picker/index.js +1 -1
  30. package/build/components/block-variation-picker/index.js.map +1 -1
  31. package/build/components/colors/utils.js +2 -6
  32. package/build/components/colors/utils.js.map +1 -1
  33. package/build/components/colors-gradients/control.js +0 -3
  34. package/build/components/colors-gradients/control.js.map +1 -1
  35. package/build/components/colors-gradients/dropdown.js +0 -2
  36. package/build/components/colors-gradients/dropdown.js.map +1 -1
  37. package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -19
  38. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  39. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -3
  40. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  41. package/build/components/copy-handler/index.js +37 -9
  42. package/build/components/copy-handler/index.js.map +1 -1
  43. package/build/components/font-sizes/fluid-utils.js +5 -2
  44. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  45. package/build/components/font-sizes/utils.js +10 -4
  46. package/build/components/font-sizes/utils.js.map +1 -1
  47. package/build/components/font-sizes/with-font-sizes.js +11 -6
  48. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  49. package/build/components/gradients/use-gradient.js +2 -8
  50. package/build/components/gradients/use-gradient.js.map +1 -1
  51. package/build/components/iframe/index.js +13 -95
  52. package/build/components/iframe/index.js.map +1 -1
  53. package/build/components/iframe/use-compatibility-styles.js +93 -0
  54. package/build/components/iframe/use-compatibility-styles.js.map +1 -0
  55. package/build/components/inner-blocks/index.js +6 -2
  56. package/build/components/inner-blocks/index.js.map +1 -1
  57. package/build/components/inserter/hooks/use-insertion-point.js +4 -3
  58. package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
  59. package/build/components/inserter/index.js +13 -4
  60. package/build/components/inserter/index.js.map +1 -1
  61. package/build/components/inserter/media-tab/hooks.js +8 -5
  62. package/build/components/inserter/media-tab/hooks.js.map +1 -1
  63. package/build/components/inserter/quick-inserter.js +6 -3
  64. package/build/components/inserter/quick-inserter.js.map +1 -1
  65. package/build/components/inserter/search-items.js +15 -14
  66. package/build/components/inserter/search-items.js.map +1 -1
  67. package/build/components/inserter/search-results.js +4 -2
  68. package/build/components/inserter/search-results.js.map +1 -1
  69. package/build/components/list-view/block-select-button.js +1 -1
  70. package/build/components/list-view/block-select-button.js.map +1 -1
  71. package/build/components/off-canvas-editor/appender.js +21 -26
  72. package/build/components/off-canvas-editor/appender.js.map +1 -1
  73. package/build/components/off-canvas-editor/block-select-button.js +3 -2
  74. package/build/components/off-canvas-editor/block-select-button.js.map +1 -1
  75. package/build/components/off-canvas-editor/block.js +57 -45
  76. package/build/components/off-canvas-editor/block.js.map +1 -1
  77. package/build/components/off-canvas-editor/index.js +5 -1
  78. package/build/components/off-canvas-editor/index.js.map +1 -1
  79. package/build/components/off-canvas-editor/use-inserted-block.js +58 -0
  80. package/build/components/off-canvas-editor/use-inserted-block.js.map +1 -0
  81. package/build/components/responsive-block-control/label.js.map +1 -1
  82. package/build/components/rich-text/format-edit.js +12 -10
  83. package/build/components/rich-text/format-edit.js.map +1 -1
  84. package/build/components/rich-text/index.js.map +1 -1
  85. package/build/components/rich-text/use-paste-handler.js +21 -12
  86. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  87. package/build/components/spacing-sizes-control/index.js +0 -1
  88. package/build/components/spacing-sizes-control/index.js.map +1 -1
  89. package/build/components/spacing-sizes-control/utils.js +1 -1
  90. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  91. package/build/components/typewriter/index.js +1 -1
  92. package/build/components/typewriter/index.js.map +1 -1
  93. package/build/components/url-popover/image-url-input-ui.js +2 -2
  94. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  95. package/build/components/writing-flow/index.js +1 -1
  96. package/build/components/writing-flow/index.js.map +1 -1
  97. package/build/hooks/border.js +0 -1
  98. package/build/hooks/border.js.map +1 -1
  99. package/build/hooks/color-panel.js +0 -1
  100. package/build/hooks/color-panel.js.map +1 -1
  101. package/build/hooks/color.js +1 -2
  102. package/build/hooks/color.js.map +1 -1
  103. package/build/hooks/font-family.js +4 -4
  104. package/build/hooks/font-family.js.map +1 -1
  105. package/build/hooks/font-size.js +5 -3
  106. package/build/hooks/font-size.js.map +1 -1
  107. package/build/hooks/use-typography-props.js +11 -8
  108. package/build/hooks/use-typography-props.js.map +1 -1
  109. package/build/store/reducer.js +21 -7
  110. package/build/store/reducer.js.map +1 -1
  111. package/build/store/selectors.js +1 -1
  112. package/build/store/selectors.js.map +1 -1
  113. package/build/utils/pasting.js +6 -11
  114. package/build/utils/pasting.js.map +1 -1
  115. package/build-module/components/alignment-control/ui.js +1 -6
  116. package/build-module/components/alignment-control/ui.js.map +1 -1
  117. package/build-module/components/block-alignment-control/use-available-alignments.js +4 -3
  118. package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
  119. package/build-module/components/block-icon/index.js +4 -2
  120. package/build-module/components/block-icon/index.js.map +1 -1
  121. package/build-module/components/block-inspector/index.js +56 -5
  122. package/build-module/components/block-inspector/index.js.map +1 -1
  123. package/build-module/components/block-list-appender/index.js +46 -34
  124. package/build-module/components/block-list-appender/index.js.map +1 -1
  125. package/build-module/components/block-list-appender/index.native.js +39 -32
  126. package/build-module/components/block-list-appender/index.native.js.map +1 -1
  127. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +18 -18
  128. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  129. package/build-module/components/block-mobile-toolbar/index.native.js +1 -1
  130. package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
  131. package/build-module/components/block-pattern-setup/index.js +14 -7
  132. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  133. package/build-module/components/block-styles/index.native.js +1 -2
  134. package/build-module/components/block-styles/index.native.js.map +1 -1
  135. package/build-module/components/block-styles/utils.js +7 -9
  136. package/build-module/components/block-styles/utils.js.map +1 -1
  137. package/build-module/components/block-toolbar/index.native.js +6 -8
  138. package/build-module/components/block-toolbar/index.native.js.map +1 -1
  139. package/build-module/components/block-tools/selected-block-popover.js +1 -2
  140. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  141. package/build-module/components/block-variation-picker/index.js +1 -1
  142. package/build-module/components/block-variation-picker/index.js.map +1 -1
  143. package/build-module/components/colors/utils.js +3 -7
  144. package/build-module/components/colors/utils.js.map +1 -1
  145. package/build-module/components/colors-gradients/control.js +0 -3
  146. package/build-module/components/colors-gradients/control.js.map +1 -1
  147. package/build-module/components/colors-gradients/dropdown.js +0 -2
  148. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  149. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +4 -19
  150. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  151. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
  152. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  153. package/build-module/components/copy-handler/index.js +38 -10
  154. package/build-module/components/copy-handler/index.js.map +1 -1
  155. package/build-module/components/font-sizes/fluid-utils.js +5 -2
  156. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  157. package/build-module/components/font-sizes/utils.js +11 -5
  158. package/build-module/components/font-sizes/utils.js.map +1 -1
  159. package/build-module/components/font-sizes/with-font-sizes.js +12 -7
  160. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  161. package/build-module/components/gradients/use-gradient.js +2 -7
  162. package/build-module/components/gradients/use-gradient.js.map +1 -1
  163. package/build-module/components/iframe/index.js +12 -95
  164. package/build-module/components/iframe/index.js.map +1 -1
  165. package/build-module/components/iframe/use-compatibility-styles.js +85 -0
  166. package/build-module/components/iframe/use-compatibility-styles.js.map +1 -0
  167. package/build-module/components/inner-blocks/index.js +6 -2
  168. package/build-module/components/inner-blocks/index.js.map +1 -1
  169. package/build-module/components/inserter/hooks/use-insertion-point.js +4 -3
  170. package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
  171. package/build-module/components/inserter/index.js +13 -4
  172. package/build-module/components/inserter/index.js.map +1 -1
  173. package/build-module/components/inserter/media-tab/hooks.js +8 -5
  174. package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
  175. package/build-module/components/inserter/quick-inserter.js +6 -3
  176. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  177. package/build-module/components/inserter/search-items.js +15 -13
  178. package/build-module/components/inserter/search-items.js.map +1 -1
  179. package/build-module/components/inserter/search-results.js +4 -2
  180. package/build-module/components/inserter/search-results.js.map +1 -1
  181. package/build-module/components/list-view/block-select-button.js +1 -1
  182. package/build-module/components/list-view/block-select-button.js.map +1 -1
  183. package/build-module/components/off-canvas-editor/appender.js +21 -27
  184. package/build-module/components/off-canvas-editor/appender.js.map +1 -1
  185. package/build-module/components/off-canvas-editor/block-select-button.js +3 -2
  186. package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -1
  187. package/build-module/components/off-canvas-editor/block.js +58 -46
  188. package/build-module/components/off-canvas-editor/block.js.map +1 -1
  189. package/build-module/components/off-canvas-editor/index.js +5 -1
  190. package/build-module/components/off-canvas-editor/index.js.map +1 -1
  191. package/build-module/components/off-canvas-editor/use-inserted-block.js +47 -0
  192. package/build-module/components/off-canvas-editor/use-inserted-block.js.map +1 -0
  193. package/build-module/components/responsive-block-control/label.js +1 -2
  194. package/build-module/components/responsive-block-control/label.js.map +1 -1
  195. package/build-module/components/rich-text/format-edit.js +12 -9
  196. package/build-module/components/rich-text/format-edit.js.map +1 -1
  197. package/build-module/components/rich-text/index.js.map +1 -1
  198. package/build-module/components/rich-text/use-paste-handler.js +22 -12
  199. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  200. package/build-module/components/spacing-sizes-control/index.js +0 -1
  201. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  202. package/build-module/components/spacing-sizes-control/utils.js +1 -1
  203. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  204. package/build-module/components/typewriter/index.js +1 -1
  205. package/build-module/components/typewriter/index.js.map +1 -1
  206. package/build-module/components/url-popover/image-url-input-ui.js +3 -3
  207. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  208. package/build-module/components/writing-flow/index.js +1 -1
  209. package/build-module/components/writing-flow/index.js.map +1 -1
  210. package/build-module/hooks/border.js +0 -1
  211. package/build-module/hooks/border.js.map +1 -1
  212. package/build-module/hooks/color-panel.js +0 -1
  213. package/build-module/hooks/color-panel.js.map +1 -1
  214. package/build-module/hooks/color.js +1 -2
  215. package/build-module/hooks/color.js.map +1 -1
  216. package/build-module/hooks/font-family.js +5 -5
  217. package/build-module/hooks/font-family.js.map +1 -1
  218. package/build-module/hooks/font-size.js +5 -3
  219. package/build-module/hooks/font-size.js.map +1 -1
  220. package/build-module/hooks/use-typography-props.js +11 -8
  221. package/build-module/hooks/use-typography-props.js.map +1 -1
  222. package/build-module/store/reducer.js +21 -6
  223. package/build-module/store/reducer.js.map +1 -1
  224. package/build-module/store/selectors.js +2 -2
  225. package/build-module/store/selectors.js.map +1 -1
  226. package/build-module/utils/pasting.js +6 -10
  227. package/build-module/utils/pasting.js.map +1 -1
  228. package/build-style/content-rtl.css +3 -3
  229. package/build-style/content.css +3 -3
  230. package/build-style/default-editor-styles-rtl.css +3 -3
  231. package/build-style/default-editor-styles.css +3 -3
  232. package/build-style/style-rtl.css +35 -11
  233. package/build-style/style.css +35 -11
  234. package/package.json +29 -29
  235. package/src/components/alignment-control/test/index.js +2 -0
  236. package/src/components/alignment-control/ui.js +1 -7
  237. package/src/components/block-alignment-control/test/index.js +2 -0
  238. package/src/components/block-alignment-control/use-available-alignments.js +4 -3
  239. package/src/components/block-icon/index.js +4 -2
  240. package/src/components/block-icon/test/index.js +9 -5
  241. package/src/components/block-inspector/index.js +77 -4
  242. package/src/components/block-inspector/style.scss +7 -0
  243. package/src/components/block-list-appender/index.js +65 -54
  244. package/src/components/block-list-appender/index.native.js +45 -34
  245. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +18 -22
  246. package/src/components/block-mobile-toolbar/index.native.js +1 -1
  247. package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +125 -0
  248. package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +439 -0
  249. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +42 -0
  250. package/src/components/block-mover/test/index.native.js +157 -1
  251. package/src/components/block-pattern-setup/index.js +15 -6
  252. package/src/components/block-pattern-setup/style.scss +29 -1
  253. package/src/components/block-styles/index.native.js +1 -2
  254. package/src/components/block-styles/utils.js +5 -7
  255. package/src/components/block-switcher/test/index.js +3 -2
  256. package/src/components/block-toolbar/index.native.js +8 -11
  257. package/src/components/block-tools/selected-block-popover.js +1 -3
  258. package/src/components/block-variation-picker/index.js +5 -1
  259. package/src/components/block-vertical-alignment-control/test/index.js +2 -0
  260. package/src/components/colors/test/with-colors.js +2 -0
  261. package/src/components/colors/utils.js +5 -3
  262. package/src/components/colors-gradients/control.js +0 -7
  263. package/src/components/colors-gradients/dropdown.js +0 -2
  264. package/src/components/colors-gradients/panel-color-gradient-settings.js +4 -22
  265. package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
  266. package/src/components/copy-handler/index.js +53 -7
  267. package/src/components/default-block-appender/test/index.js +2 -0
  268. package/src/components/font-sizes/fluid-utils.js +7 -1
  269. package/src/components/font-sizes/utils.js +5 -3
  270. package/src/components/font-sizes/with-font-sizes.js +4 -4
  271. package/src/components/gradients/use-gradient.js +2 -7
  272. package/src/components/iframe/index.js +8 -103
  273. package/src/components/iframe/use-compatibility-styles.js +95 -0
  274. package/src/components/image-size-control/test/index.js +147 -79
  275. package/src/components/inner-blocks/index.js +4 -2
  276. package/src/components/inserter/hooks/use-insertion-point.js +3 -2
  277. package/src/components/inserter/index.js +15 -2
  278. package/src/components/inserter/media-tab/hooks.js +5 -4
  279. package/src/components/inserter/quick-inserter.js +3 -0
  280. package/src/components/inserter/search-items.js +1 -2
  281. package/src/components/inserter/search-results.js +2 -0
  282. package/src/components/link-control/test/index.js +18 -4
  283. package/src/components/list-view/block-select-button.js +1 -1
  284. package/src/components/list-view/style.scss +1 -7
  285. package/src/components/media-replace-flow/test/index.js +2 -0
  286. package/src/components/off-canvas-editor/appender.js +30 -25
  287. package/src/components/off-canvas-editor/block-select-button.js +6 -2
  288. package/src/components/off-canvas-editor/block.js +93 -76
  289. package/src/components/off-canvas-editor/index.js +9 -0
  290. package/src/components/off-canvas-editor/style.scss +5 -1
  291. package/src/components/off-canvas-editor/test/use-inserted-block.js +108 -0
  292. package/src/components/off-canvas-editor/use-inserted-block.js +47 -0
  293. package/src/components/responsive-block-control/label.js +2 -3
  294. package/src/components/responsive-block-control/test/index.js +4 -2
  295. package/src/components/rich-text/format-edit.js +6 -10
  296. package/src/components/rich-text/index.js +1 -0
  297. package/src/components/rich-text/use-paste-handler.js +33 -14
  298. package/src/components/spacing-sizes-control/index.js +0 -1
  299. package/src/components/spacing-sizes-control/utils.js +1 -1
  300. package/src/components/typewriter/index.js +3 -1
  301. package/src/components/url-input/test/button.js +2 -0
  302. package/src/components/url-popover/image-url-input-ui.js +5 -4
  303. package/src/components/url-popover/test/index.js +21 -5
  304. package/src/components/warning/test/index.js +2 -0
  305. package/src/components/writing-flow/index.js +1 -1
  306. package/src/hooks/border.js +0 -1
  307. package/src/hooks/color-panel.js +0 -1
  308. package/src/hooks/color.js +0 -2
  309. package/src/hooks/font-family.js +3 -5
  310. package/src/hooks/font-size.js +13 -4
  311. package/src/hooks/test/use-typography-props.js +26 -0
  312. package/src/hooks/use-typography-props.js +15 -7
  313. package/src/store/reducer.js +13 -6
  314. package/src/store/selectors.js +2 -3
  315. package/src/utils/pasting.js +3 -9
  316. package/tsconfig.tsbuildinfo +1 -1
  317. package/build/components/colors-gradients/use-common-single-multiple-selects.js +0 -21
  318. package/build/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
  319. package/build/components/rich-text/file-paste-handler.js +0 -21
  320. package/build/components/rich-text/file-paste-handler.js.map +0 -1
  321. package/build-module/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
  322. package/build-module/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
  323. package/build-module/components/rich-text/file-paste-handler.js +0 -13
  324. package/build-module/components/rich-text/file-paste-handler.js.map +0 -1
  325. package/src/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
  326. package/src/components/rich-text/file-paste-handler.js +0 -13
@@ -1,11 +1,6 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { find } from 'lodash';
5
1
  /**
6
2
  * WordPress dependencies
7
3
  */
8
-
9
4
  import TokenList from '@wordpress/token-list';
10
5
  import { _x } from '@wordpress/i18n';
11
6
  /**
@@ -24,8 +19,11 @@ export function getActiveStyle(styles, className) {
24
19
  }
25
20
 
26
21
  const potentialStyleName = style.substring(9);
27
- const activeStyle = find(styles, {
28
- name: potentialStyleName
22
+ const activeStyle = styles === null || styles === void 0 ? void 0 : styles.find(_ref => {
23
+ let {
24
+ name
25
+ } = _ref;
26
+ return name === potentialStyleName;
29
27
  });
30
28
 
31
29
  if (activeStyle) {
@@ -33,7 +31,7 @@ export function getActiveStyle(styles, className) {
33
31
  }
34
32
  }
35
33
 
36
- return find(styles, 'isDefault');
34
+ return getDefaultStyle(styles);
37
35
  }
38
36
  /**
39
37
  * Replaces the active style in the block's className.
@@ -86,6 +84,6 @@ export function getRenderedStyles(styles) {
86
84
  */
87
85
 
88
86
  export function getDefaultStyle(styles) {
89
- return find(styles, 'isDefault');
87
+ return styles === null || styles === void 0 ? void 0 : styles.find(style => style.isDefault);
90
88
  }
91
89
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/utils.js"],"names":["find","TokenList","_x","getActiveStyle","styles","className","style","values","indexOf","potentialStyleName","substring","activeStyle","name","replaceActiveStyle","newStyle","list","remove","add","value","getRenderedStyles","length","getDefaultStyle","label","isDefault"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AACA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,uBAAtB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,cAAT,CAAyBC,MAAzB,EAAiCC,SAAjC,EAA6C;AACnD,OAAM,MAAMC,KA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UA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASiB,eAAT,CAA0BjB,MAA1B,EAAmC;AACzC,SAAOJ,IAAI,CAAEI,MAAF,EAAU,WAAV,CAAX;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { find } from 'lodash';\n/**\n * WordPress dependencies\n */\nimport TokenList from '@wordpress/token-list';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Returns the active style from the given className.\n *\n * @param {Array} styles Block styles.\n * @param {string} className Class name\n *\n * @return {Object?} The active style.\n */\nexport function getActiveStyle( styles, className ) {\n\tfor ( const style of new TokenList( className ).values() ) {\n\t\tif ( style.indexOf( 'is-style-' ) === -1 ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst potentialStyleName = style.substring( 9 );\n\t\tconst activeStyle = find( styles, { name: potentialStyleName } );\n\t\tif ( activeStyle ) {\n\t\t\treturn activeStyle;\n\t\t}\n\t}\n\n\treturn find( styles, 'isDefault' );\n}\n\n/**\n * Replaces the active style in the block's className.\n *\n * @param {string} className Class name.\n * @param {Object?} activeStyle The replaced style.\n * @param {Object} newStyle The replacing style.\n *\n * @return {string} The updated className.\n */\nexport function replaceActiveStyle( className, activeStyle, newStyle ) {\n\tconst list = new TokenList( className );\n\n\tif ( activeStyle ) {\n\t\tlist.remove( 'is-style-' + activeStyle.name );\n\t}\n\n\tlist.add( 'is-style-' + newStyle.name );\n\n\treturn list.value;\n}\n\n/**\n * Returns a collection of styles that can be represented on the frontend.\n * The function checks a style collection for a default style. If none is found, it adds one to\n * act as a fallback for when there is no active style applied to a block. The default item also serves\n * as a switch on the frontend to deactivate non-default styles.\n *\n * @param {Array} styles Block styles.\n *\n * @return {Array<Object?>} The style collection.\n */\nexport function getRenderedStyles( styles ) {\n\tif ( ! styles || styles.length === 0 ) {\n\t\treturn [];\n\t}\n\n\treturn getDefaultStyle( styles )\n\t\t? styles\n\t\t: [\n\t\t\t\t{\n\t\t\t\t\tname: 'default',\n\t\t\t\t\tlabel: _x( 'Default', 'block style' ),\n\t\t\t\t\tisDefault: true,\n\t\t\t\t},\n\t\t\t\t...styles,\n\t\t ];\n}\n\n/**\n * Returns a style object from a collection of styles where that style object is the default block style.\n *\n * @param {Array} styles Block styles.\n *\n * @return {Object?} The default style object, if found.\n */\nexport function getDefaultStyle( styles ) {\n\treturn find( styles, 'isDefault' );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/utils.js"],"names":["TokenList","_x","getActiveStyle","styles","className","style","values","indexOf","potentialStyleName","substring","activeStyle","find","name","getDefaultStyle","replaceActiveStyle","newStyle","list","remove","add","value","getRenderedStyles","length","label","isDefault"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,SAAP,MAAsB,uBAAtB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,cAAT,CAAyBC,MAAzB,EAAiCC,SAAjC,EAA6C;AACnD,OAAM,MAAMC,KAAZ,IAAqB,IAAIL,SAAJ,CAAeI,SAAf,EAA2BE,MAA3B,EAArB,EAA2D;AAC1D,QAAKD,KAAK,CAACE,OAAN,CAAe,WAAf,MAAiC,CAAC,CAAvC,EAA2C;AAC1C;AACA;;AAED,UAAMC,kBAAkB,GAAGH,KAAK,CAACI,SAAN,CAAiB,CAAjB,CAA3B;AACA,UAAMC,WAAW,GAAGP,MAAH,aAAGA,MAAH,uBAAGA,MAAM,CAAEQ,IAAR,CACnB;AAAA,UAAE;AAAEC,QAAAA;AAAF,OAAF;AAAA,aAAgBA,IAAI,KAAKJ,kBAAzB;AAAA,KADmB,CAApB;;AAGA,QAAKE,WAAL,EAAmB;AAClB,aAAOA,WAAP;AACA;AACD;;AAED,SAAOG,eAAe,CAAEV,MAAF,CAAtB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASW,kBAAT,CAA6BV,SAA7B,EAAwCM,WAAxC,EAAqDK,QAArD,EAAgE;AACtE,QAAMC,IAAI,GAAG,IAAIhB,SAAJ,CAAeI,SAAf,CAAb;;AAEA,MAAKM,WAAL,EAAmB;AAClBM,IAAAA,IAAI,CAACC,MAAL,CAAa,cAAcP,WAAW,CAACE,IAAvC;AACA;;AAEDI,EAAAA,IAAI,CAACE,GAAL,CAAU,cAAcH,QAAQ,CAACH,IAAjC;AAEA,SAAOI,IAAI,CAACG,KAAZ;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,iBAAT,CAA4BjB,MAA5B,EAAqC;AAC3C,MAAK,CAAEA,MAAF,IAAYA,MAAM,CAACkB,MAAP,KAAkB,CAAnC,EAAuC;AACtC,WAAO,EAAP;AACA;;AAED,SAAOR,eAAe,CAAEV,MAAF,CAAf,GACJA,MADI,GAEJ,CACA;AACCS,IAAAA,IAAI,EAAE,SADP;AAECU,IAAAA,KAAK,EAAErB,EAAE,CAAE,SAAF,EAAa,aAAb,CAFV;AAGCsB,IAAAA,SAAS,EAAE;AAHZ,GADA,EAMA,GAAGpB,MANH,CAFH;AAUA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASU,eAAT,CAA0BV,MAA1B,EAAmC;AACzC,SAAOA,MAAP,aAAOA,MAAP,uBAAOA,MAAM,CAAEQ,IAAR,CAAgBN,KAAF,IAAaA,KAAK,CAACkB,SAAjC,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport TokenList from '@wordpress/token-list';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Returns the active style from the given className.\n *\n * @param {Array} styles Block styles.\n * @param {string} className Class name\n *\n * @return {Object?} The active style.\n */\nexport function getActiveStyle( styles, className ) {\n\tfor ( const style of new TokenList( className ).values() ) {\n\t\tif ( style.indexOf( 'is-style-' ) === -1 ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst potentialStyleName = style.substring( 9 );\n\t\tconst activeStyle = styles?.find(\n\t\t\t( { name } ) => name === potentialStyleName\n\t\t);\n\t\tif ( activeStyle ) {\n\t\t\treturn activeStyle;\n\t\t}\n\t}\n\n\treturn getDefaultStyle( styles );\n}\n\n/**\n * Replaces the active style in the block's className.\n *\n * @param {string} className Class name.\n * @param {Object?} activeStyle The replaced style.\n * @param {Object} newStyle The replacing style.\n *\n * @return {string} The updated className.\n */\nexport function replaceActiveStyle( className, activeStyle, newStyle ) {\n\tconst list = new TokenList( className );\n\n\tif ( activeStyle ) {\n\t\tlist.remove( 'is-style-' + activeStyle.name );\n\t}\n\n\tlist.add( 'is-style-' + newStyle.name );\n\n\treturn list.value;\n}\n\n/**\n * Returns a collection of styles that can be represented on the frontend.\n * The function checks a style collection for a default style. If none is found, it adds one to\n * act as a fallback for when there is no active style applied to a block. The default item also serves\n * as a switch on the frontend to deactivate non-default styles.\n *\n * @param {Array} styles Block styles.\n *\n * @return {Array<Object?>} The style collection.\n */\nexport function getRenderedStyles( styles ) {\n\tif ( ! styles || styles.length === 0 ) {\n\t\treturn [];\n\t}\n\n\treturn getDefaultStyle( styles )\n\t\t? styles\n\t\t: [\n\t\t\t\t{\n\t\t\t\t\tname: 'default',\n\t\t\t\t\tlabel: _x( 'Default', 'block style' ),\n\t\t\t\t\tisDefault: true,\n\t\t\t\t},\n\t\t\t\t...styles,\n\t\t ];\n}\n\n/**\n * Returns a style object from a collection of styles where that style object is the default block style.\n *\n * @param {Array} styles Block styles.\n *\n * @return {Object?} The default style object, if found.\n */\nexport function getDefaultStyle( styles ) {\n\treturn styles?.find( ( style ) => style.isDefault );\n}\n"]}
@@ -13,9 +13,8 @@ import UngroupButton from '../ungroup-button';
13
13
  import { store as blockEditorStore } from '../../store';
14
14
  export default function BlockToolbar() {
15
15
  const {
16
- blockClientIds,
17
- isValid,
18
- mode
16
+ isSelected,
17
+ isValidAndVisual
19
18
  } = useSelect(select => {
20
19
  const {
21
20
  getBlockMode,
@@ -24,17 +23,16 @@ export default function BlockToolbar() {
24
23
  } = select(blockEditorStore);
25
24
  const selectedBlockClientIds = getSelectedBlockClientIds();
26
25
  return {
27
- blockClientIds: selectedBlockClientIds,
28
- isValid: selectedBlockClientIds.length === 1 ? isBlockValid(selectedBlockClientIds[0]) : null,
29
- mode: selectedBlockClientIds.length === 1 ? getBlockMode(selectedBlockClientIds[0]) : null
26
+ isSelected: selectedBlockClientIds.length > 0,
27
+ isValidAndVisual: selectedBlockClientIds.length === 1 ? isBlockValid(selectedBlockClientIds[0]) && getBlockMode(selectedBlockClientIds[0]) === 'visual' : false
30
28
  };
31
29
  }, []);
32
30
 
33
- if (blockClientIds.length === 0) {
31
+ if (!isSelected) {
34
32
  return null;
35
33
  }
36
34
 
37
- return createElement(Fragment, null, mode === 'visual' && isValid && createElement(Fragment, null, createElement(UngroupButton, null), createElement(BlockControls.Slot, {
35
+ return createElement(Fragment, null, isValidAndVisual && createElement(Fragment, null, createElement(UngroupButton, null), createElement(BlockControls.Slot, {
38
36
  group: "block"
39
37
  }), createElement(BlockControls.Slot, null), createElement(BlockControls.Slot, {
40
38
  group: "inline"
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/block-toolbar/index.native.js"],"names":["useSelect","BlockControls","UngroupButton","store","blockEditorStore","BlockToolbar","blockClientIds","isValid","mode","select","getBlockMode","getSelectedBlockClientIds","isBlockValid","selectedBlockClientIds","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,eAAe,SAASC,YAAT,GAAwB;AACtC,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,OAAlB;AAA2BC,IAAAA;AAA3B,MAAoCR,SAAS,CAAIS,MAAF,IAAc;AAClE,UAAM;AAAEC,MAAAA,YAAF;AAAgBC,MAAAA,yBAAhB;AAA2CC,MAAAA;AAA3C,QACLH,MAAM,CAAEL,gBAAF,CADP;AAEA,UAAMS,sBAAsB,GAAGF,yBAAyB,EAAxD;AAEA,WAAO;AACNL,MAAAA,cAAc,EAAEO,sBADV;AAENN,MAAAA,OAAO,EACNM,sBAAsB,CAACC,MAAvB,KAAkC,CAAlC,GACGF,YAAY,CAAEC,sBAAsB,CAAE,CAAF,CAAxB,CADf,GAEG,IALE;AAMNL,MAAAA,IAAI,EACHK,sBAAsB,CAACC,MAAvB,KAAkC,CAAlC,GACGJ,YAAY,CAAEG,sBAAsB,CAAE,CAAF,CAAxB,CADf,GAEG;AATE,KAAP;AAWA,GAhBkD,EAgBhD,EAhBgD,CAAnD;;AAkBA,MAAKP,cAAc,CAACQ,MAAf,KAA0B,CAA/B,EAAmC;AAClC,WAAO,IAAP;AACA;;AAED,SACC,8BACGN,IAAI,KAAK,QAAT,IAAqBD,OAArB,IACD,8BACC,cAAC,aAAD,OADD,EAEC,cAAC,aAAD,CAAe,IAAf;AAAoB,IAAA,KAAK,EAAC;AAA1B,IAFD,EAGC,cAAC,aAAD,CAAe,IAAf,OAHD,EAIC,cAAC,aAAD,CAAe,IAAf;AAAoB,IAAA,KAAK,EAAC;AAA1B,IAJD,EAKC,cAAC,aAAD,CAAe,IAAf;AAAoB,IAAA,KAAK,EAAC;AAA1B,IALD,CAFF,CADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockControls from '../block-controls';\nimport UngroupButton from '../ungroup-button';\nimport { store as blockEditorStore } from '../../store';\n\nexport default function BlockToolbar() {\n\tconst { blockClientIds, isValid, mode } = useSelect( ( select ) => {\n\t\tconst { getBlockMode, getSelectedBlockClientIds, isBlockValid } =\n\t\t\tselect( blockEditorStore );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\n\t\treturn {\n\t\t\tblockClientIds: selectedBlockClientIds,\n\t\t\tisValid:\n\t\t\t\tselectedBlockClientIds.length === 1\n\t\t\t\t\t? isBlockValid( selectedBlockClientIds[ 0 ] )\n\t\t\t\t\t: null,\n\t\t\tmode:\n\t\t\t\tselectedBlockClientIds.length === 1\n\t\t\t\t\t? getBlockMode( selectedBlockClientIds[ 0 ] )\n\t\t\t\t\t: null,\n\t\t};\n\t}, [] );\n\n\tif ( blockClientIds.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ mode === 'visual' && isValid && (\n\t\t\t\t<>\n\t\t\t\t\t<UngroupButton />\n\t\t\t\t\t<BlockControls.Slot group=\"block\" />\n\t\t\t\t\t<BlockControls.Slot />\n\t\t\t\t\t<BlockControls.Slot group=\"inline\" />\n\t\t\t\t\t<BlockControls.Slot group=\"other\" />\n\t\t\t\t</>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/block-toolbar/index.native.js"],"names":["useSelect","BlockControls","UngroupButton","store","blockEditorStore","BlockToolbar","isSelected","isValidAndVisual","select","getBlockMode","getSelectedBlockClientIds","isBlockValid","selectedBlockClientIds","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,eAAe,SAASC,YAAT,GAAwB;AACtC,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAAmCP,SAAS,CAAIQ,MAAF,IAAc;AACjE,UAAM;AAAEC,MAAAA,YAAF;AAAgBC,MAAAA,yBAAhB;AAA2CC,MAAAA;AAA3C,QACLH,MAAM,CAAEJ,gBAAF,CADP;AAEA,UAAMQ,sBAAsB,GAAGF,yBAAyB,EAAxD;AAEA,WAAO;AACNJ,MAAAA,UAAU,EAAEM,sBAAsB,CAACC,MAAvB,GAAgC,CADtC;AAENN,MAAAA,gBAAgB,EACfK,sBAAsB,CAACC,MAAvB,KAAkC,CAAlC,GACGF,YAAY,CAAEC,sBAAsB,CAAE,CAAF,CAAxB,CAAZ,IACAH,YAAY,CAAEG,sBAAsB,CAAE,CAAF,CAAxB,CAAZ,KAAgD,QAFnD,GAGG;AANE,KAAP;AAQA,GAbiD,EAa/C,EAb+C,CAAlD;;AAeA,MAAK,CAAEN,UAAP,EAAoB;AACnB,WAAO,IAAP;AACA;;AAED,SACC,8BACGC,gBAAgB,IACjB,8BACC,cAAC,aAAD,OADD,EAEC,cAAC,aAAD,CAAe,IAAf;AAAoB,IAAA,KAAK,EAAC;AAA1B,IAFD,EAGC,cAAC,aAAD,CAAe,IAAf,OAHD,EAIC,cAAC,aAAD,CAAe,IAAf;AAAoB,IAAA,KAAK,EAAC;AAA1B,IAJD,EAKC,cAAC,aAAD,CAAe,IAAf;AAAoB,IAAA,KAAK,EAAC;AAA1B,IALD,CAFF,CADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockControls from '../block-controls';\nimport UngroupButton from '../ungroup-button';\nimport { store as blockEditorStore } from '../../store';\n\nexport default function BlockToolbar() {\n\tconst { isSelected, isValidAndVisual } = useSelect( ( select ) => {\n\t\tconst { getBlockMode, getSelectedBlockClientIds, isBlockValid } =\n\t\t\tselect( blockEditorStore );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\n\t\treturn {\n\t\t\tisSelected: selectedBlockClientIds.length > 0,\n\t\t\tisValidAndVisual:\n\t\t\t\tselectedBlockClientIds.length === 1\n\t\t\t\t\t? isBlockValid( selectedBlockClientIds[ 0 ] ) &&\n\t\t\t\t\t getBlockMode( selectedBlockClientIds[ 0 ] ) === 'visual'\n\t\t\t\t\t: false,\n\t\t};\n\t}, [] );\n\n\tif ( ! isSelected ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isValidAndVisual && (\n\t\t\t\t<>\n\t\t\t\t\t<UngroupButton />\n\t\t\t\t\t<BlockControls.Slot group=\"block\" />\n\t\t\t\t\t<BlockControls.Slot />\n\t\t\t\t\t<BlockControls.Slot group=\"inline\" />\n\t\t\t\t\t<BlockControls.Slot group=\"other\" />\n\t\t\t\t</>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
@@ -4,7 +4,6 @@ import { createElement, Fragment } from "@wordpress/element";
4
4
  /**
5
5
  * External dependencies
6
6
  */
7
- import { find } from 'lodash';
8
7
  import classnames from 'classnames';
9
8
  /**
10
9
  * WordPress dependencies
@@ -182,7 +181,7 @@ function wrapperSelector(select) {
182
181
  const parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(blockParentsClientIds); // Get the clientId of the topmost parent with the capture toolbars setting.
183
182
 
184
183
 
185
- const capturingClientId = find(blockParentsClientIds, parentClientId => {
184
+ const capturingClientId = blockParentsClientIds.find(parentClientId => {
186
185
  var _parentBlockListSetti;
187
186
 
188
187
  return (_parentBlockListSetti = parentBlockListSettings[parentClientId]) === null || _parentBlockListSetti === void 0 ? void 0 : _parentBlockListSetti.__experimentalCaptureToolbars;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/selected-block-popover.js"],"names":["find","classnames","useRef","useEffect","isUnmodifiedDefaultBlock","useDispatch","useSelect","useShortcut","useViewportMatch","BlockSelectionButton","BlockContextualToolbar","store","blockEditorStore","BlockPopover","useBlockToolbarPopoverProps","Inserter","selector","select","__unstableGetEditorMode","isMultiSelecting","hasMultiSelection","isTyping","__experimentalIsBlockInterfaceHidden","isBlockInterfaceHidden","getSettings","getLastMultiSelectedBlockClientId","editorMode","hasFixedToolbar","isDistractionFree","lastClientId","SelectedBlockPopover","clientId","rootClientId","isEmptyDefaultBlock","showContents","capturingClientId","__unstablePopoverSlot","__unstableContentRef","isInsertionPointVisible","isBlockInsertionPointVisible","getBlockInsertionPoint","getBlockOrder","insertionPoint","order","index","isLargeViewport","isToolbarForced","stopTyping","showEmptyBlockSideInserter","shouldShowBreadcrumb","shouldShowContextualToolbar","canFocusHiddenToolbar","current","isDisabled","initialToolbarItemIndexRef","popoverProps","contentElement","wrapperSelector","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlockRootClientId","getBlock","getBlockParents","isNavigationMode","_isNavigationMode","__experimentalGetBlockListSettingsForBlocks","name","attributes","blockParentsClientIds","parentBlockListSettings","parentClientId","__experimentalCaptureToolbars","settings","WrappedBlockPopover","selected"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,SAAjB,QAAkC,oBAAlC;AACA,SAASC,wBAAT,QAAyC,mBAAzC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,WAAT,QAA4B,+BAA5B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AACA,OAAOC,sBAAP,MAAmC,4BAAnC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,2BAAP,MAAwC,mCAAxC;AACA,OAAOC,QAAP,MAAqB,aAArB;;AAEA,SAASC,QAAT,CAAmBC,MAAnB,EAA4B;AAC3B,QAAM;AACLC,IAAAA,uBADK;AAELC,IAAAA,gBAFK;AAGLC,IAAAA,iBAHK;AAILC,IAAAA,QAJK;AAKLC,IAAAA,oCAAoC,EAAEC,sBALjC;AAMLC,IAAAA,WANK;AAOLC,IAAAA;AAPK,MAQFR,MAAM,CAAEL,gBAAF,CARV;AAUA,SAAO;AACNc,IAAAA,UAAU,EAAER,uBAAuB,EAD7B;AAENC,IAAAA,gBAAgB,EAAEA,gBAAgB,EAF5B;AAGNE,IAAAA,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;AAUA;;AAED,eAAe,SAASsC,mBAAT,QAGX;AAAA,MAHyC;AAC5CrC,IAAAA,qBAD4C;AAE5CC,IAAAA;AAF4C,GAGzC;AACH,QAAMqC,QAAQ,GAAGpE,SAAS,CAAEmD,eAAF,EAAmB,EAAnB,CAA1B;;AAEA,MAAK,CAAEiB,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,QAAM;AACL3C,IAAAA,QADK;AAELC,IAAAA,YAFK;AAGLkC,IAAAA,IAHK;AAILjC,IAAAA,mBAJK;AAKLE,IAAAA,iBALK;AAMLP,IAAAA,iBANK;AAOLmC,IAAAA;AAPK,MAQFW,QARJ;;AAUA,MAAK,CAAER,IAAP,EAAc;AACb,WAAO,IAAP;AACA;;AAED,SACC,cAAC,oBAAD;AACC,IAAA,QAAQ,EAAGnC,QADZ;AAEC,IAAA,YAAY,EAAGC,YAFhB;AAGC,IAAA,mBAAmB,EAAGC,mBAHvB;AAIC,IAAA,YAAY,EAAG,CAAEL,iBAAF,IAAuBmC,gBAJvC;AAKC,IAAA,iBAAiB,EAAG5B,iBALrB;AAMC,IAAA,qBAAqB,EAAGC,qBANzB;AAOC,IAAA,oBAAoB,EAAGC;AAPxB,IADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport { find } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockSelectionButton from './block-selection-button';\nimport BlockContextualToolbar from './block-contextual-toolbar';\nimport { store as blockEditorStore } from '../../store';\nimport BlockPopover from '../block-popover';\nimport useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';\nimport Inserter from '../inserter';\n\nfunction selector( select ) {\n\tconst {\n\t\t__unstableGetEditorMode,\n\t\tisMultiSelecting,\n\t\thasMultiSelection,\n\t\tisTyping,\n\t\t__experimentalIsBlockInterfaceHidden: isBlockInterfaceHidden,\n\t\tgetSettings,\n\t\tgetLastMultiSelectedBlockClientId,\n\t} = select( blockEditorStore );\n\n\treturn {\n\t\teditorMode: __unstableGetEditorMode(),\n\t\tisMultiSelecting: isMultiSelecting(),\n\t\tisTyping: isTyping(),\n\t\tisBlockInterfaceHidden: isBlockInterfaceHidden(),\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisDistractionFree: getSettings().isDistractionFree,\n\t\tlastClientId: hasMultiSelection()\n\t\t\t? getLastMultiSelectedBlockClientId()\n\t\t\t: null,\n\t};\n}\n\nfunction SelectedBlockPopover( {\n\tclientId,\n\trootClientId,\n\tisEmptyDefaultBlock,\n\tshowContents, // we may need to mount an empty popover because we reuse\n\tcapturingClientId,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst {\n\t\teditorMode,\n\t\tisMultiSelecting,\n\t\tisTyping,\n\t\tisBlockInterfaceHidden,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tlastClientId,\n\t} = useSelect( selector, [] );\n\tconst isInsertionPointVisible = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tif ( ! isBlockInsertionPointVisible() ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\t\t\treturn order[ insertionPoint.index ] === clientId;\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isToolbarForced = useRef( false );\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\n\tconst showEmptyBlockSideInserter =\n\t\t! isTyping && editorMode === 'edit' && isEmptyDefaultBlock;\n\tconst shouldShowBreadcrumb =\n\t\teditorMode === 'navigation' || editorMode === 'zoom-out';\n\tconst shouldShowContextualToolbar =\n\t\teditorMode === 'edit' &&\n\t\t! hasFixedToolbar &&\n\t\tisLargeViewport &&\n\t\t! isMultiSelecting &&\n\t\t! showEmptyBlockSideInserter &&\n\t\t! isTyping &&\n\t\t! isBlockInterfaceHidden;\n\tconst canFocusHiddenToolbar =\n\t\teditorMode === 'edit' &&\n\t\t! shouldShowContextualToolbar &&\n\t\t! hasFixedToolbar &&\n\t\t! isDistractionFree &&\n\t\t! isEmptyDefaultBlock;\n\n\tuseShortcut(\n\t\t'core/block-editor/focus-toolbar',\n\t\t() => {\n\t\t\tisToolbarForced.current = true;\n\t\t\tstopTyping( true );\n\t\t},\n\t\t{\n\t\t\tisDisabled: ! canFocusHiddenToolbar,\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tisToolbarForced.current = false;\n\t} );\n\n\t// Stores the active toolbar item index so the block toolbar can return focus\n\t// to it when re-mounting.\n\tconst initialToolbarItemIndexRef = useRef();\n\n\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\tif (\n\t\t! shouldShowBreadcrumb &&\n\t\t! shouldShowContextualToolbar &&\n\t\t! showEmptyBlockSideInserter\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t<BlockPopover\n\t\t\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t\t\t__unstableCoverTarget\n\t\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-block-list__block-side-inserter-popover',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-insertion-point-visible':\n\t\t\t\t\t\t\t\tisInsertionPointVisible,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\tresize={ false }\n\t\t\t\t\tshift={ false }\n\t\t\t\t\t{ ...popoverProps }\n\t\t\t\t>\n\t\t\t\t\t<div className=\"block-editor-block-list__empty-block-inserter\">\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\tposition=\"bottom right\"\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</BlockPopover>\n\t\t\t) }\n\t\t\t{ ( shouldShowBreadcrumb || shouldShowContextualToolbar ) && (\n\t\t\t\t<BlockPopover\n\t\t\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-block-list__block-popover',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-insertion-point-visible':\n\t\t\t\t\t\t\t\tisInsertionPointVisible,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\tresize={ false }\n\t\t\t\t\t{ ...popoverProps }\n\t\t\t\t>\n\t\t\t\t\t{ shouldShowContextualToolbar && showContents && (\n\t\t\t\t\t\t<BlockContextualToolbar\n\t\t\t\t\t\t\t// If the toolbar is being shown because of being forced\n\t\t\t\t\t\t\t// it should focus the toolbar right after the mount.\n\t\t\t\t\t\t\tfocusOnMount={ isToolbarForced.current }\n\t\t\t\t\t\t\t__experimentalInitialIndex={\n\t\t\t\t\t\t\t\tinitialToolbarItemIndexRef.current\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t__experimentalOnIndexChange={ ( index ) => {\n\t\t\t\t\t\t\t\tinitialToolbarItemIndexRef.current = index;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t// Resets the index whenever the active block changes so\n\t\t\t\t\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\t\t\t\t\tkey={ clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ shouldShowBreadcrumb && (\n\t\t\t\t\t\t<BlockSelectionButton\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockPopover>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction wrapperSelector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetBlockRootClientId,\n\t\tgetBlock,\n\t\tgetBlockParents,\n\t\tgetSettings,\n\t\tisNavigationMode: _isNavigationMode,\n\t\t__experimentalGetBlockListSettingsForBlocks,\n\t} = select( blockEditorStore );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\tif ( ! clientId ) {\n\t\treturn;\n\t}\n\n\tconst { name, attributes = {} } = getBlock( clientId ) || {};\n\tconst blockParentsClientIds = getBlockParents( clientId );\n\n\t// Get Block List Settings for all ancestors of the current Block clientId.\n\tconst parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(\n\t\tblockParentsClientIds\n\t);\n\n\t// Get the clientId of the topmost parent with the capture toolbars setting.\n\tconst capturingClientId = find(\n\t\tblockParentsClientIds,\n\t\t( parentClientId ) =>\n\t\t\tparentBlockListSettings[ parentClientId ]\n\t\t\t\t?.__experimentalCaptureToolbars\n\t);\n\n\tconst settings = getSettings();\n\n\treturn {\n\t\tclientId,\n\t\trootClientId: getBlockRootClientId( clientId ),\n\t\tname,\n\t\tisDistractionFree: settings.isDistractionFree,\n\t\tisNavigationMode: _isNavigationMode(),\n\t\tisEmptyDefaultBlock:\n\t\t\tname && isUnmodifiedDefaultBlock( { name, attributes } ),\n\t\tcapturingClientId,\n\t};\n}\n\nexport default function WrappedBlockPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst selected = useSelect( wrapperSelector, [] );\n\n\tif ( ! selected ) {\n\t\treturn null;\n\t}\n\n\tconst {\n\t\tclientId,\n\t\trootClientId,\n\t\tname,\n\t\tisEmptyDefaultBlock,\n\t\tcapturingClientId,\n\t\tisDistractionFree,\n\t\tisNavigationMode,\n\t} = selected;\n\n\tif ( ! name ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SelectedBlockPopover\n\t\t\tclientId={ clientId }\n\t\t\trootClientId={ rootClientId }\n\t\t\tisEmptyDefaultBlock={ isEmptyDefaultBlock }\n\t\t\tshowContents={ ! isDistractionFree || isNavigationMode }\n\t\t\tcapturingClientId={ capturingClientId }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/selected-block-popover.js"],"names":["classnames","useRef","useEffect","isUnmodifiedDefaultBlock","useDispatch","useSelect","useShortcut","useViewportMatch","BlockSelectionButton","BlockContextualToolbar","store","blockEditorStore","BlockPopover","useBlockToolbarPopoverProps","Inserter","selector","select","__unstableGetEditorMode","isMultiSelecting","hasMultiSelection","isTyping","__experimentalIsBlockInterfaceHidden","isBlockInterfaceHidden","getSettings","getLastMultiSelectedBlockClientId","editorMode","hasFixedToolbar","isDistractionFree","lastClientId","SelectedBlockPopover","clientId","rootClientId","isEmptyDefaultBlock","showContents","capturingClientId","__unstablePopoverSlot","__unstableContentRef","isInsertionPointVisible","isBlockInsertionPointVisible","getBlockInsertionPoint","getBlockOrder","insertionPoint","order","index","isLargeViewport","isToolbarForced","stopTyping","showEmptyBlockSideInserter","shouldShowBreadcrumb","shouldShowContextualToolbar","canFocusHiddenToolbar","current","isDisabled","initialToolbarItemIndexRef","popoverProps","contentElement","wrapperSelector","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlockRootClientId","getBlock","getBlockParents","isNavigationMode","_isNavigationMode","__experimentalGetBlockListSettingsForBlocks","name","attributes","blockParentsClientIds","parentBlockListSettings","find","parentClientId","__experimentalCaptureToolbars","settings","WrappedBlockPopover","selected"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,SAAjB,QAAkC,oBAAlC;AACA,SAASC,wBAAT,QAAyC,mBAAzC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,WAAT,QAA4B,+BAA5B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AACA,OAAOC,sBAAP,MAAmC,4BAAnC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,2BAAP,MAAwC,mCAAxC;AACA,OAAOC,QAAP,MAAqB,aAArB;;AAEA,SAASC,QAAT,CAAmBC,MAAnB,EAA4B;AAC3B,QAAM;AACLC,IAAAA,uBADK;AAELC,IAAAA,gBAFK;AAGLC,IAAAA,iBAHK;AAILC,IAAAA,QAJK;AAKLC,IAAAA,oCAAoC,EAAEC,sBALjC;AAMLC,IAAAA,WANK;AAOLC,IAAAA;AAPK,MAQFR,MAAM,CAAEL,gBAAF,CARV;AAUA,SAAO;AACNc,IAAAA,UAAU,EAAER,uBAAuB,EAD7B;AAENC,IAAAA,gBAAgB,EAAEA,gBAAgB,EAF5B;AAGNE,IAAAA,QAAQ,EAAEA,QAAQ,EAHZ;AAINE,IAAAA,sBAAsB,EAAEA,sBAAsB,EAJxC;AAKNI,IAAAA,eAAe,EA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GAGzC;AACH,QAAMsC,QAAQ,GAAGrE,SAAS,CAAEmD,eAAF,EAAmB,EAAnB,CAA1B;;AAEA,MAAK,CAAEkB,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,QAAM;AACL5C,IAAAA,QADK;AAELC,IAAAA,YAFK;AAGLkC,IAAAA,IAHK;AAILjC,IAAAA,mBAJK;AAKLE,IAAAA,iBALK;AAMLP,IAAAA,iBANK;AAOLmC,IAAAA;AAPK,MAQFY,QARJ;;AAUA,MAAK,CAAET,IAAP,EAAc;AACb,WAAO,IAAP;AACA;;AAED,SACC,cAAC,oBAAD;AACC,IAAA,QAAQ,EAAGnC,QADZ;AAEC,IAAA,YAAY,EAAGC,YAFhB;AAGC,IAAA,mBAAmB,EAAGC,mBAHvB;AAIC,IAAA,YAAY,EAAG,CAAEL,iBAAF,IAAuBmC,gBAJvC;AAKC,IAAA,iBAAiB,EAAG5B,iBALrB;AAMC,IAAA,qBAAqB,EAAGC,qBANzB;AAOC,IAAA,oBAAoB,EAAGC;AAPxB,IADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockSelectionButton from './block-selection-button';\nimport BlockContextualToolbar from './block-contextual-toolbar';\nimport { store as blockEditorStore } from '../../store';\nimport BlockPopover from '../block-popover';\nimport useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';\nimport Inserter from '../inserter';\n\nfunction selector( select ) {\n\tconst {\n\t\t__unstableGetEditorMode,\n\t\tisMultiSelecting,\n\t\thasMultiSelection,\n\t\tisTyping,\n\t\t__experimentalIsBlockInterfaceHidden: isBlockInterfaceHidden,\n\t\tgetSettings,\n\t\tgetLastMultiSelectedBlockClientId,\n\t} = select( blockEditorStore );\n\n\treturn {\n\t\teditorMode: __unstableGetEditorMode(),\n\t\tisMultiSelecting: isMultiSelecting(),\n\t\tisTyping: isTyping(),\n\t\tisBlockInterfaceHidden: isBlockInterfaceHidden(),\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisDistractionFree: getSettings().isDistractionFree,\n\t\tlastClientId: hasMultiSelection()\n\t\t\t? getLastMultiSelectedBlockClientId()\n\t\t\t: null,\n\t};\n}\n\nfunction SelectedBlockPopover( {\n\tclientId,\n\trootClientId,\n\tisEmptyDefaultBlock,\n\tshowContents, // we may need to mount an empty popover because we reuse\n\tcapturingClientId,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst {\n\t\teditorMode,\n\t\tisMultiSelecting,\n\t\tisTyping,\n\t\tisBlockInterfaceHidden,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tlastClientId,\n\t} = useSelect( selector, [] );\n\tconst isInsertionPointVisible = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tif ( ! isBlockInsertionPointVisible() ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\t\t\treturn order[ insertionPoint.index ] === clientId;\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isToolbarForced = useRef( false );\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\n\tconst showEmptyBlockSideInserter =\n\t\t! isTyping && editorMode === 'edit' && isEmptyDefaultBlock;\n\tconst shouldShowBreadcrumb =\n\t\teditorMode === 'navigation' || editorMode === 'zoom-out';\n\tconst shouldShowContextualToolbar =\n\t\teditorMode === 'edit' &&\n\t\t! hasFixedToolbar &&\n\t\tisLargeViewport &&\n\t\t! isMultiSelecting &&\n\t\t! showEmptyBlockSideInserter &&\n\t\t! isTyping &&\n\t\t! isBlockInterfaceHidden;\n\tconst canFocusHiddenToolbar =\n\t\teditorMode === 'edit' &&\n\t\t! shouldShowContextualToolbar &&\n\t\t! hasFixedToolbar &&\n\t\t! isDistractionFree &&\n\t\t! isEmptyDefaultBlock;\n\n\tuseShortcut(\n\t\t'core/block-editor/focus-toolbar',\n\t\t() => {\n\t\t\tisToolbarForced.current = true;\n\t\t\tstopTyping( true );\n\t\t},\n\t\t{\n\t\t\tisDisabled: ! canFocusHiddenToolbar,\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tisToolbarForced.current = false;\n\t} );\n\n\t// Stores the active toolbar item index so the block toolbar can return focus\n\t// to it when re-mounting.\n\tconst initialToolbarItemIndexRef = useRef();\n\n\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\tif (\n\t\t! shouldShowBreadcrumb &&\n\t\t! shouldShowContextualToolbar &&\n\t\t! showEmptyBlockSideInserter\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t<BlockPopover\n\t\t\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t\t\t__unstableCoverTarget\n\t\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-block-list__block-side-inserter-popover',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-insertion-point-visible':\n\t\t\t\t\t\t\t\tisInsertionPointVisible,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\tresize={ false }\n\t\t\t\t\tshift={ false }\n\t\t\t\t\t{ ...popoverProps }\n\t\t\t\t>\n\t\t\t\t\t<div className=\"block-editor-block-list__empty-block-inserter\">\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\tposition=\"bottom right\"\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</BlockPopover>\n\t\t\t) }\n\t\t\t{ ( shouldShowBreadcrumb || shouldShowContextualToolbar ) && (\n\t\t\t\t<BlockPopover\n\t\t\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-block-list__block-popover',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-insertion-point-visible':\n\t\t\t\t\t\t\t\tisInsertionPointVisible,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\tresize={ false }\n\t\t\t\t\t{ ...popoverProps }\n\t\t\t\t>\n\t\t\t\t\t{ shouldShowContextualToolbar && showContents && (\n\t\t\t\t\t\t<BlockContextualToolbar\n\t\t\t\t\t\t\t// If the toolbar is being shown because of being forced\n\t\t\t\t\t\t\t// it should focus the toolbar right after the mount.\n\t\t\t\t\t\t\tfocusOnMount={ isToolbarForced.current }\n\t\t\t\t\t\t\t__experimentalInitialIndex={\n\t\t\t\t\t\t\t\tinitialToolbarItemIndexRef.current\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t__experimentalOnIndexChange={ ( index ) => {\n\t\t\t\t\t\t\t\tinitialToolbarItemIndexRef.current = index;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t// Resets the index whenever the active block changes so\n\t\t\t\t\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\t\t\t\t\tkey={ clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ shouldShowBreadcrumb && (\n\t\t\t\t\t\t<BlockSelectionButton\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockPopover>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction wrapperSelector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetBlockRootClientId,\n\t\tgetBlock,\n\t\tgetBlockParents,\n\t\tgetSettings,\n\t\tisNavigationMode: _isNavigationMode,\n\t\t__experimentalGetBlockListSettingsForBlocks,\n\t} = select( blockEditorStore );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\tif ( ! clientId ) {\n\t\treturn;\n\t}\n\n\tconst { name, attributes = {} } = getBlock( clientId ) || {};\n\tconst blockParentsClientIds = getBlockParents( clientId );\n\n\t// Get Block List Settings for all ancestors of the current Block clientId.\n\tconst parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(\n\t\tblockParentsClientIds\n\t);\n\n\t// Get the clientId of the topmost parent with the capture toolbars setting.\n\tconst capturingClientId = blockParentsClientIds.find(\n\t\t( parentClientId ) =>\n\t\t\tparentBlockListSettings[ parentClientId ]\n\t\t\t\t?.__experimentalCaptureToolbars\n\t);\n\n\tconst settings = getSettings();\n\n\treturn {\n\t\tclientId,\n\t\trootClientId: getBlockRootClientId( clientId ),\n\t\tname,\n\t\tisDistractionFree: settings.isDistractionFree,\n\t\tisNavigationMode: _isNavigationMode(),\n\t\tisEmptyDefaultBlock:\n\t\t\tname && isUnmodifiedDefaultBlock( { name, attributes } ),\n\t\tcapturingClientId,\n\t};\n}\n\nexport default function WrappedBlockPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst selected = useSelect( wrapperSelector, [] );\n\n\tif ( ! selected ) {\n\t\treturn null;\n\t}\n\n\tconst {\n\t\tclientId,\n\t\trootClientId,\n\t\tname,\n\t\tisEmptyDefaultBlock,\n\t\tcapturingClientId,\n\t\tisDistractionFree,\n\t\tisNavigationMode,\n\t} = selected;\n\n\tif ( ! name ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SelectedBlockPopover\n\t\t\tclientId={ clientId }\n\t\t\trootClientId={ rootClientId }\n\t\t\tisEmptyDefaultBlock={ isEmptyDefaultBlock }\n\t\t\tshowContents={ ! isDistractionFree || isNavigationMode }\n\t\t\tcapturingClientId={ capturingClientId }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t/>\n\t);\n}\n"]}
@@ -37,7 +37,7 @@ function BlockVariationPicker(_ref) {
37
37
  key: variation.name
38
38
  }, createElement(Button, {
39
39
  variant: "secondary",
40
- icon: variation.icon,
40
+ icon: variation.icon && variation.icon.src ? variation.icon.src : variation.icon,
41
41
  iconSize: 48,
42
42
  onClick: () => onSelect(variation),
43
43
  className: "block-editor-block-variation-picker__variation",
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/block-variation-picker/index.js"],"names":["classnames","__","Button","Placeholder","layout","BlockVariationPicker","icon","label","instructions","variations","onSelect","allowSkip","classes","length","map","variation","name","description","title"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,WAAjB,QAAoC,uBAApC;AACA,SAASC,MAAT,QAAuB,kBAAvB;;AAEA,SAASC,oBAAT,OAOI;AAAA,MAP2B;AAC9BC,IAAAA,IAAI,GAAGF,MADuB;AAE9BG,IAAAA,KAAK,GAAGN,EAAE,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classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button, Placeholder } from '@wordpress/components';\nimport { layout } from '@wordpress/icons';\n\nfunction BlockVariationPicker( {\n\ticon = layout,\n\tlabel = __( 'Choose variation' ),\n\tinstructions = __( 'Select a variation to start with.' ),\n\tvariations,\n\tonSelect,\n\tallowSkip,\n} ) {\n\tconst classes = classnames( 'block-editor-block-variation-picker', {\n\t\t'has-many-variations': variations.length > 4,\n\t} );\n\n\treturn (\n\t\t<Placeholder\n\t\t\ticon={ icon }\n\t\t\tlabel={ label }\n\t\t\tinstructions={ instructions }\n\t\t\tclassName={ classes }\n\t\t>\n\t\t\t{ /*\n\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t */\n\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t<ul\n\t\t\t\tclassName=\"block-editor-block-variation-picker__variations\"\n\t\t\t\trole=\"list\"\n\t\t\t\taria-label={ __( 'Block variations' ) }\n\t\t\t>\n\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t<li key={ variation.name }>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\ticon={ variation.icon }\n\t\t\t\t\t\t\ticonSize={ 48 }\n\t\t\t\t\t\t\tonClick={ () => onSelect( variation ) }\n\t\t\t\t\t\t\tclassName=\"block-editor-block-variation-picker__variation\"\n\t\t\t\t\t\t\tlabel={ variation.description || variation.title }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<span className=\"block-editor-block-variation-picker__variation-label\">\n\t\t\t\t\t\t\t{ variation.title }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t\t{ allowSkip && (\n\t\t\t\t<div className=\"block-editor-block-variation-picker__skip\">\n\t\t\t\t\t<Button variant=\"link\" onClick={ () => onSelect() }>\n\t\t\t\t\t\t{ __( 'Skip' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</Placeholder>\n\t);\n}\n\nexport default BlockVariationPicker;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/block-variation-picker/index.js"],"names":["classnames","__","Button","Placeholder","layout","BlockVariationPicker","icon","label","instructions","variations","onSelect","allowSkip","classes","length","map","variation","name","src","description","title"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,WAAjB,QAAoC,uBAApC;AACA,SAASC,MAAT,QAAuB,kBAAvB;;AAEA,SAASC,oBAAT,OAOI;AAAA,MAP2B;AAC9BC,IAAAA,IAAI,GAAGF,MADuB;AAE9BG,IAAAA,KAAK,GAAGN,EAAE,CAAE,kBAAF,CAFoB;AAG9BO,IAAAA,YAAY,GAAGP,EAAE,CAAE,mCAAF,CAHa;AAI9BQ,IAAAA,UAJ8B;AAK9BC,IAAAA,QAL8B;AAM9BC,IAAAA;AAN8B,GAO3B;AACH,QAAMC,OAAO,GAAGZ,UAAU,CAAE,qCAAF,EAAyC;AAClE,2BAAuBS,UAAU,CAACI,MAAX,GAAoB;AADuB,GAAzC,CAA1B;AAIA,SACC,cAAC,WAAD;AACC,IAAA,IAAI,EAAGP,IADR;AAEC,IAAA,KAAK,EAAGC,KAFT;AAGC,IAAA,YAAY,EAAGC,YAHhB;AAIC,IAAA,SAAS,EAAGI;AAJb,KAWC;AACC,IAAA,SAAS,EAAC,iDADX;AAEC,IAAA,IAAI,EAAC,MAFN;AAGC,kBAAaX,EAAE,CAAE,kBAAF;AAHhB,KAKGQ,UAAU,CAACK,GAAX,CAAkBC,SAAF,IACjB;AAAI,IAAA,GAAG,EAAGA,SAAS,CAACC;AAApB,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,WADT;AAEC,IAAA,IAAI,EACHD,SAAS,CAACT,IAAV,IAAkBS,SAAS,CAACT,IAAV,CAAeW,GAAjC,GACGF,SAAS,CAACT,IAAV,CAAeW,GADlB,GAEGF,SAAS,CAACT,IALf;AAOC,IAAA,QAAQ,EAAG,EAPZ;AAQC,IAAA,OAAO,EAAG,MAAMI,QAAQ,CAAEK,SAAF,CARzB;AASC,IAAA,SAAS,EAAC,gDATX;AAUC,IAAA,KAAK,EAAGA,SAAS,CAACG,WAAV,IAAyBH,SAAS,CAACI;AAV5C,IADD,EAaC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGJ,SAAS,CAACI,KADb,CAbD,CADC,CALH,CAXD,EAqCGR,SAAS,IACV;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,MAAhB;AAAuB,IAAA,OAAO,EAAG,MAAMD,QAAQ;AAA/C,KACGT,EAAE,CAAE,MAAF,CADL,CADD,CAtCF,CADD;AA+CA;;AAED,eAAeI,oBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button, Placeholder } from '@wordpress/components';\nimport { layout } from '@wordpress/icons';\n\nfunction BlockVariationPicker( {\n\ticon = layout,\n\tlabel = __( 'Choose variation' ),\n\tinstructions = __( 'Select a variation to start with.' ),\n\tvariations,\n\tonSelect,\n\tallowSkip,\n} ) {\n\tconst classes = classnames( 'block-editor-block-variation-picker', {\n\t\t'has-many-variations': variations.length > 4,\n\t} );\n\n\treturn (\n\t\t<Placeholder\n\t\t\ticon={ icon }\n\t\t\tlabel={ label }\n\t\t\tinstructions={ instructions }\n\t\t\tclassName={ classes }\n\t\t>\n\t\t\t{ /*\n\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t */\n\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t<ul\n\t\t\t\tclassName=\"block-editor-block-variation-picker__variations\"\n\t\t\t\trole=\"list\"\n\t\t\t\taria-label={ __( 'Block variations' ) }\n\t\t\t>\n\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t<li key={ variation.name }>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\tvariation.icon && variation.icon.src\n\t\t\t\t\t\t\t\t\t? variation.icon.src\n\t\t\t\t\t\t\t\t\t: variation.icon\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ticonSize={ 48 }\n\t\t\t\t\t\t\tonClick={ () => onSelect( variation ) }\n\t\t\t\t\t\t\tclassName=\"block-editor-block-variation-picker__variation\"\n\t\t\t\t\t\t\tlabel={ variation.description || variation.title }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<span className=\"block-editor-block-variation-picker__variation-label\">\n\t\t\t\t\t\t\t{ variation.title }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t\t{ allowSkip && (\n\t\t\t\t<div className=\"block-editor-block-variation-picker__skip\">\n\t\t\t\t\t<Button variant=\"link\" onClick={ () => onSelect() }>\n\t\t\t\t\t\t{ __( 'Skip' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</Placeholder>\n\t);\n}\n\nexport default BlockVariationPicker;\n"]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { find, kebabCase } from 'lodash';
4
+ import { kebabCase } from 'lodash';
5
5
  import { colord, extend } from 'colord';
6
6
  import namesPlugin from 'colord/plugins/names';
7
7
  import a11yPlugin from 'colord/plugins/a11y';
@@ -21,9 +21,7 @@ extend([namesPlugin, a11yPlugin]);
21
21
 
22
22
  export const getColorObjectByAttributeValues = (colors, definedColor, customColor) => {
23
23
  if (definedColor) {
24
- const colorObj = find(colors, {
25
- slug: definedColor
26
- });
24
+ const colorObj = colors === null || colors === void 0 ? void 0 : colors.find(color => color.slug === definedColor);
27
25
 
28
26
  if (colorObj) {
29
27
  return colorObj;
@@ -45,9 +43,7 @@ export const getColorObjectByAttributeValues = (colors, definedColor, customColo
45
43
  */
46
44
 
47
45
  export const getColorObjectByColorValue = (colors, colorValue) => {
48
- return find(colors, {
49
- color: colorValue
50
- });
46
+ return colors === null || colors === void 0 ? void 0 : colors.find(color => color.color === colorValue);
51
47
  };
52
48
  /**
53
49
  * Returns a class based on the context a color is being used and its slug.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/colors/utils.js"],"names":["find","kebabCase","colord","extend","namesPlugin","a11yPlugin","getColorObjectByAttributeValues","colors","definedColor","customColor","colorObj","slug","color","getColorObjectByColorValue","colorValue","getColorClassName","colorContextName","colorSlug","undefined","getMostReadableColor","colordColor","getColorContrast","contrast","maxContrast","Math","max","map"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,SAAf,QAAgC,QAAhC;AACA,SAASC,MAAT,EAAiBC,MAAjB,QAA+B,QAA/B;AACA,OAAOC,WAAP,MAAwB,sBAAxB;AACA,OAAOC,UAAP,MAAuB,qBAAvB;AAEAF,MAAM,CAAE,CAAEC,WAAF,EAAeC,UAAf,CAAF,CAAN;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,+BAA+B,GAAG,CAC9CC,MAD8C,EAE9CC,YAF8C,EAG9CC,WAH8C,KAI1C;AACJ,MAAKD,YAAL,EAAoB;AACnB,UAAME,QAAQ,GAAGV,IAAI,CAAEO,MAAF,EAAU;AAAEI,MAAAA,IAAI,EAAEH;AAAR,KAAV,CAArB;;AAEA,QAAKE,QAAL,EAAgB;AACf,aAAOA,QAAP;AACA;AACD;;AACD,SAAO;AACNE,IAAAA,KAAK,EAAEH;AADD,GAAP;AAGA,CAfM;AAiBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMI,0BAA0B,GAAG,CAAEN,MAAF,EAAUO,UAAV,KAA0B;AACnE,SAAOd,IAAI,CAAEO,MAAF,EAAU;AAAEK,IAAAA,KAAK,EAAEE;AAAT,GAAV,CAAX;AACA,CAFM;AAIP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,iBAAT,CAA4BC,gBAA5B,EAA8CC,SAA9C,EAA0D;AAChE,MAAK,CAAED,gBAAF,IAAsB,CAAEC,SAA7B,EAAyC;AACxC,WAAOC,SAAP;AACA;;AAED,SAAQ,OAAOjB,SAAS,CAAEgB,SAAF,CAAe,IAAID,gBAAkB,EAA7D;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,oBAAT,CAA+BZ,MAA/B,EAAuCO,UAAvC,EAAoD;AAC1D,QAAMM,WAAW,GAAGlB,MAAM,CAAEY,UAAF,CAA1B;;AACA,QAAMO,gBAAgB,GAAG;AAAA,QAAE;AAAET,MAAAA;AAAF,KAAF;AAAA,WAAiBQ,WAAW,CAACE,QAAZ,CAAsBV,KAAtB,CAAjB;AAAA,GAAzB;;AAEA,QAAMW,WAAW,GAAGC,IAAI,CAACC,GAAL,CAAU,GAAGlB,MAAM,CAACmB,GAAP,CAAYL,gBAAZ,CAAb,CAApB;AACA,SAAOd,MAAM,CAACP,IAAP,CAAeY,KAAF,IAAaS,gBAAgB,CAAET,KAAF,CAAhB,KAA8BW,WAAxD,EACLX,KADF;AAEA","sourcesContent":["/**\n * External dependencies\n */\nimport { find, kebabCase } from 'lodash';\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\n/**\n * Provided an array of color objects as set by the theme or by the editor defaults,\n * and the values of the defined color or custom color returns a color object describing the color.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} definedColor A string containing the color slug.\n * @param {?string} customColor A string containing the customColor value.\n *\n * @return {?Object} If definedColor is passed and the name is found in colors,\n * the color object exactly as set by the theme or editor defaults is returned.\n * Otherwise, an object that just sets the color is defined.\n */\nexport const getColorObjectByAttributeValues = (\n\tcolors,\n\tdefinedColor,\n\tcustomColor\n) => {\n\tif ( definedColor ) {\n\t\tconst colorObj = find( colors, { slug: definedColor } );\n\n\t\tif ( colorObj ) {\n\t\t\treturn colorObj;\n\t\t}\n\t}\n\treturn {\n\t\tcolor: customColor,\n\t};\n};\n\n/**\n * Provided an array of color objects as set by the theme or by the editor defaults, and a color value returns the color object matching that value or undefined.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} colorValue A string containing the color value.\n *\n * @return {?Object} Color object included in the colors array whose color property equals colorValue.\n * Returns undefined if no color object matches this requirement.\n */\nexport const getColorObjectByColorValue = ( colors, colorValue ) => {\n\treturn find( colors, { color: colorValue } );\n};\n\n/**\n * Returns a class based on the context a color is being used and its slug.\n *\n * @param {string} colorContextName Context/place where color is being used e.g: background, text etc...\n * @param {string} colorSlug Slug of the color.\n *\n * @return {?string} String with the class corresponding to the color in the provided context.\n * Returns undefined if either colorContextName or colorSlug are not provided.\n */\nexport function getColorClassName( colorContextName, colorSlug ) {\n\tif ( ! colorContextName || ! colorSlug ) {\n\t\treturn undefined;\n\t}\n\n\treturn `has-${ kebabCase( colorSlug ) }-${ colorContextName }`;\n}\n\n/**\n * Given an array of color objects and a color value returns the color value of the most readable color in the array.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} colorValue A string containing the color value.\n *\n * @return {string} String with the color value of the most readable color.\n */\nexport function getMostReadableColor( colors, colorValue ) {\n\tconst colordColor = colord( colorValue );\n\tconst getColorContrast = ( { color } ) => colordColor.contrast( color );\n\n\tconst maxContrast = Math.max( ...colors.map( getColorContrast ) );\n\treturn colors.find( ( color ) => getColorContrast( color ) === maxContrast )\n\t\t.color;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/colors/utils.js"],"names":["kebabCase","colord","extend","namesPlugin","a11yPlugin","getColorObjectByAttributeValues","colors","definedColor","customColor","colorObj","find","color","slug","getColorObjectByColorValue","colorValue","getColorClassName","colorContextName","colorSlug","undefined","getMostReadableColor","colordColor","getColorContrast","contrast","maxContrast","Math","max","map"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AACA,SAASC,MAAT,EAAiBC,MAAjB,QAA+B,QAA/B;AACA,OAAOC,WAAP,MAAwB,sBAAxB;AACA,OAAOC,UAAP,MAAuB,qBAAvB;AAEAF,MAAM,CAAE,CAAEC,WAAF,EAAeC,UAAf,CAAF,CAAN;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,+BAA+B,GAAG,CAC9CC,MAD8C,EAE9CC,YAF8C,EAG9CC,WAH8C,KAI1C;AACJ,MAAKD,YAAL,EAAoB;AACnB,UAAME,QAAQ,GAAGH,MAAH,aAAGA,MAAH,uBAAGA,MAAM,CAAEI,IAAR,CACdC,KAAF,IAAaA,KAAK,CAACC,IAAN,KAAeL,YADZ,CAAjB;;AAIA,QAAKE,QAAL,EAAgB;AACf,aAAOA,QAAP;AACA;AACD;;AACD,SAAO;AACNE,IAAAA,KAAK,EAAEH;AADD,GAAP;AAGA,CAjBM;AAmBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMK,0BAA0B,GAAG,CAAEP,MAAF,EAAUQ,UAAV,KAA0B;AACnE,SAAOR,MAAP,aAAOA,MAAP,uBAAOA,MAAM,CAAEI,IAAR,CAAgBC,KAAF,IAAaA,KAAK,CAACA,KAAN,KAAgBG,UAA3C,CAAP;AACA,CAFM;AAIP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,iBAAT,CAA4BC,gBAA5B,EAA8CC,SAA9C,EAA0D;AAChE,MAAK,CAAED,gBAAF,IAAsB,CAAEC,SAA7B,EAAyC;AACxC,WAAOC,SAAP;AACA;;AAED,SAAQ,OAAOlB,SAAS,CAAEiB,SAAF,CAAe,IAAID,gBAAkB,EAA7D;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,oBAAT,CAA+Bb,MAA/B,EAAuCQ,UAAvC,EAAoD;AAC1D,QAAMM,WAAW,GAAGnB,MAAM,CAAEa,UAAF,CAA1B;;AACA,QAAMO,gBAAgB,GAAG;AAAA,QAAE;AAAEV,MAAAA;AAAF,KAAF;AAAA,WAAiBS,WAAW,CAACE,QAAZ,CAAsBX,KAAtB,CAAjB;AAAA,GAAzB;;AAEA,QAAMY,WAAW,GAAGC,IAAI,CAACC,GAAL,CAAU,GAAGnB,MAAM,CAACoB,GAAP,CAAYL,gBAAZ,CAAb,CAApB;AACA,SAAOf,MAAM,CAACI,IAAP,CAAeC,KAAF,IAAaU,gBAAgB,CAAEV,KAAF,CAAhB,KAA8BY,WAAxD,EACLZ,KADF;AAEA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\n/**\n * Provided an array of color objects as set by the theme or by the editor defaults,\n * and the values of the defined color or custom color returns a color object describing the color.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} definedColor A string containing the color slug.\n * @param {?string} customColor A string containing the customColor value.\n *\n * @return {?Object} If definedColor is passed and the name is found in colors,\n * the color object exactly as set by the theme or editor defaults is returned.\n * Otherwise, an object that just sets the color is defined.\n */\nexport const getColorObjectByAttributeValues = (\n\tcolors,\n\tdefinedColor,\n\tcustomColor\n) => {\n\tif ( definedColor ) {\n\t\tconst colorObj = colors?.find(\n\t\t\t( color ) => color.slug === definedColor\n\t\t);\n\n\t\tif ( colorObj ) {\n\t\t\treturn colorObj;\n\t\t}\n\t}\n\treturn {\n\t\tcolor: customColor,\n\t};\n};\n\n/**\n * Provided an array of color objects as set by the theme or by the editor defaults, and a color value returns the color object matching that value or undefined.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} colorValue A string containing the color value.\n *\n * @return {?Object} Color object included in the colors array whose color property equals colorValue.\n * Returns undefined if no color object matches this requirement.\n */\nexport const getColorObjectByColorValue = ( colors, colorValue ) => {\n\treturn colors?.find( ( color ) => color.color === colorValue );\n};\n\n/**\n * Returns a class based on the context a color is being used and its slug.\n *\n * @param {string} colorContextName Context/place where color is being used e.g: background, text etc...\n * @param {string} colorSlug Slug of the color.\n *\n * @return {?string} String with the class corresponding to the color in the provided context.\n * Returns undefined if either colorContextName or colorSlug are not provided.\n */\nexport function getColorClassName( colorContextName, colorSlug ) {\n\tif ( ! colorContextName || ! colorSlug ) {\n\t\treturn undefined;\n\t}\n\n\treturn `has-${ kebabCase( colorSlug ) }-${ colorContextName }`;\n}\n\n/**\n * Given an array of color objects and a color value returns the color value of the most readable color in the array.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} colorValue A string containing the color value.\n *\n * @return {string} String with the color value of the most readable color.\n */\nexport function getMostReadableColor( colors, colorValue ) {\n\tconst colordColor = colord( colorValue );\n\tconst getColorContrast = ( { color } ) => colordColor.contrast( color );\n\n\tconst maxContrast = Math.max( ...colors.map( getColorContrast ) );\n\treturn colors.find( ( color ) => getColorContrast( color ) === maxContrast )\n\t\t.color;\n}\n"]}
@@ -35,7 +35,6 @@ function ColorGradientControlInner(_ref) {
35
35
  gradients,
36
36
  disableCustomColors,
37
37
  disableCustomGradients,
38
- __experimentalHasMultipleOrigins,
39
38
  __experimentalIsRenderedInSidebar,
40
39
  className,
41
40
  label,
@@ -63,7 +62,6 @@ function ColorGradientControlInner(_ref) {
63
62
  } : onColorChange,
64
63
  colors,
65
64
  disableCustomColors,
66
- __experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins,
67
65
  __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
68
66
  clearable: clearable,
69
67
  enableAlpha: enableAlpha
@@ -77,7 +75,6 @@ function ColorGradientControlInner(_ref) {
77
75
  } : onGradientChange,
78
76
  gradients,
79
77
  disableCustomGradients,
80
- __experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins,
81
78
  __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
82
79
  clearable: clearable
83
80
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/control.js"],"names":["classnames","isEmpty","BaseControl","__experimentalVStack","VStack","TabPanel","ColorPalette","GradientPicker","useSetting","colorsAndGradientKeys","TAB_COLOR","name","title","value","TAB_GRADIENT","TABS_SETTINGS","ColorGradientControlInner","colors","gradients","disableCustomColors","disableCustomGradients","__experimentalHasMultipleOrigins","__experimentalIsRenderedInSidebar","className","label","onColorChange","onGradientChange","colorValue","gradientValue","clearable","showTitle","enableAlpha","canChooseAColor","canChooseAGradient","tabPanels","newColor","newGradient","renderPanelType","type","tab","ColorGradientControlSelect","props","colorGradientSettings","ColorGradientControl","every","key","hasOwnProperty"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SACCC,WADD,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,QAHD,EAICC,YAJD,EAKCC,cALD,QAMO,uBANP;AAQA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AAEA,MAAMC,qBAAqB,GAAG,CAC7B,QAD6B,EAE7B,qBAF6B,EAG7B,WAH6B,EAI7B,wBAJ6B,CAA9B;A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CAACG;AANrC,KASK0B,GAAF,IAAWF,eAAe,CAAEE,GAAG,CAAC1B,KAAN,CAT7B,CAXF,EAuBG,CAAEoB,kBAAF,IACDI,eAAe,CAAE3B,SAAS,CAACG,KAAZ,CAxBjB,EAyBG,CAAEmB,eAAF,IACDK,eAAe,CAAEvB,YAAY,CAACD,KAAf,CA1BjB,CADD,CAPD,CADD;AAwCA;;AAED,SAAS2B,0BAAT,CAAqCC,KAArC,EAA6C;AAC5C,QAAMC,qBAAqB,GAAG,EAA9B;AACAA,EAAAA,qBAAqB,CAACzB,MAAtB,GAA+BT,UAAU,CAAE,eAAF,CAAzC;AACAkC,EAAAA,qBAAqB,CAACxB,SAAtB,GAAkCV,UAAU,CAAE,iBAAF,CAA5C;AACAkC,EAAAA,qBAAqB,CAACvB,mBAAtB,GAA4C,CAAEX,UAAU,CAAE,cAAF,CAAxD;AACAkC,EAAAA,qBAAqB,CAACtB,sBAAtB,GAA+C,CAAEZ,UAAU,CAC1D,sBAD0D,CAA3D;AAIA,SACC,cAAC,yBAAD,eACWkC,qBADX,EACqCD,KADrC,EADD;AAKA;;AAED,SAASE,oBAAT,CAA+BF,KAA/B,EAAuC;AACtC,MACChC,qBAAqB,CAACmC,KAAtB,CAA+BC,GAAF,IAAWJ,KAAK,CAACK,cAAN,CAAsBD,GAAtB,CAAxC,CADD,EAEE;AACD,WAAO,cAAC,yBAAD,EAAgCJ,KAAhC,CAAP;AACA;;AACD,SAAO,cAAC,0BAAD,EAAiCA,KAAjC,CAAP;AACA;;AAED,eAAeE,oBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBaseControl,\n\t__experimentalVStack as VStack,\n\tTabPanel,\n\tColorPalette,\n\tGradientPicker,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../use-setting';\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nconst TAB_COLOR = {\n\tname: 'color',\n\ttitle: 'Solid',\n\tvalue: 'color',\n};\nconst TAB_GRADIENT = {\n\tname: 'gradient',\n\ttitle: 'Gradient',\n\tvalue: 'gradient',\n};\n\nconst TABS_SETTINGS = [ TAB_COLOR, TAB_GRADIENT ];\n\nfunction ColorGradientControlInner( {\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\t__experimentalHasMultipleOrigins,\n\t__experimentalIsRenderedInSidebar,\n\tclassName,\n\tlabel,\n\tonColorChange,\n\tonGradientChange,\n\tcolorValue,\n\tgradientValue,\n\tclearable,\n\tshowTitle = true,\n\tenableAlpha,\n} ) {\n\tconst canChooseAColor =\n\t\tonColorChange && ( ! isEmpty( colors ) || ! disableCustomColors );\n\tconst canChooseAGradient =\n\t\tonGradientChange &&\n\t\t( ! isEmpty( gradients ) || ! disableCustomGradients );\n\n\tif ( ! canChooseAColor && ! canChooseAGradient ) {\n\t\treturn null;\n\t}\n\n\tconst tabPanels = {\n\t\t[ TAB_COLOR.value ]: (\n\t\t\t<ColorPalette\n\t\t\t\tvalue={ colorValue }\n\t\t\t\tonChange={\n\t\t\t\t\tcanChooseAGradient\n\t\t\t\t\t\t? ( newColor ) => {\n\t\t\t\t\t\t\t\tonColorChange( newColor );\n\t\t\t\t\t\t\t\tonGradientChange();\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: onColorChange\n\t\t\t\t}\n\t\t\t\t{ ...{ colors, disableCustomColors } }\n\t\t\t\t__experimentalHasMultipleOrigins={\n\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t}\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tclearable={ clearable }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t/>\n\t\t),\n\t\t[ TAB_GRADIENT.value ]: (\n\t\t\t<GradientPicker\n\t\t\t\t__nextHasNoMargin\n\t\t\t\tvalue={ gradientValue }\n\t\t\t\tonChange={\n\t\t\t\t\tcanChooseAColor\n\t\t\t\t\t\t? ( newGradient ) => {\n\t\t\t\t\t\t\t\tonGradientChange( newGradient );\n\t\t\t\t\t\t\t\tonColorChange();\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: onGradientChange\n\t\t\t\t}\n\t\t\t\t{ ...{ gradients, disableCustomGradients } }\n\t\t\t\t__experimentalHasMultipleOrigins={\n\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t}\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tclearable={ clearable }\n\t\t\t/>\n\t\t),\n\t};\n\n\tconst renderPanelType = ( type ) => (\n\t\t<div className=\"block-editor-color-gradient-control__panel\">\n\t\t\t{ tabPanels[ type ] }\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-color-gradient-control',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<fieldset className=\"block-editor-color-gradient-control__fieldset\">\n\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t{ showTitle && (\n\t\t\t\t\t\t<legend>\n\t\t\t\t\t\t\t<div className=\"block-editor-color-gradient-control__color-indicator\">\n\t\t\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</legend>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canChooseAColor && canChooseAGradient && (\n\t\t\t\t\t\t<TabPanel\n\t\t\t\t\t\t\tclassName=\"block-editor-color-gradient-control__tabs\"\n\t\t\t\t\t\t\ttabs={ TABS_SETTINGS }\n\t\t\t\t\t\t\tinitialTabName={\n\t\t\t\t\t\t\t\tgradientValue\n\t\t\t\t\t\t\t\t\t? TAB_GRADIENT.value\n\t\t\t\t\t\t\t\t\t: !! canChooseAColor && TAB_COLOR.value\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ ( tab ) => renderPanelType( tab.value ) }\n\t\t\t\t\t\t</TabPanel>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! canChooseAGradient &&\n\t\t\t\t\t\trenderPanelType( TAB_COLOR.value ) }\n\t\t\t\t\t{ ! canChooseAColor &&\n\t\t\t\t\t\trenderPanelType( TAB_GRADIENT.value ) }\n\t\t\t\t</VStack>\n\t\t\t</fieldset>\n\t\t</BaseControl>\n\t);\n}\n\nfunction ColorGradientControlSelect( props ) {\n\tconst colorGradientSettings = {};\n\tcolorGradientSettings.colors = useSetting( 'color.palette' );\n\tcolorGradientSettings.gradients = useSetting( 'color.gradients' );\n\tcolorGradientSettings.disableCustomColors = ! useSetting( 'color.custom' );\n\tcolorGradientSettings.disableCustomGradients = ! useSetting(\n\t\t'color.customGradient'\n\t);\n\n\treturn (\n\t\t<ColorGradientControlInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n}\n\nfunction ColorGradientControl( props ) {\n\tif (\n\t\tcolorsAndGradientKeys.every( ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <ColorGradientControlInner { ...props } />;\n\t}\n\treturn <ColorGradientControlSelect { ...props } />;\n}\n\nexport default ColorGradientControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/control.js"],"names":["classnames","isEmpty","BaseControl","__experimentalVStack","VStack","TabPanel","ColorPalette","GradientPicker","useSetting","colorsAndGradientKeys","TAB_COLOR","name","title","value","TAB_GRADIENT","TABS_SETTINGS","ColorGradientControlInner","colors","gradients","disableCustomColors","disableCustomGradients","__experimentalIsRenderedInSidebar","className","label","onColorChange","onGradientChange","colorValue","gradientValue","clearable","showTitle","enableAlpha","canChooseAColor","canChooseAGradient","tabPanels","newColor","newGradient","renderPanelType","type","tab","ColorGradientControlSelect","props","colorGradientSettings","ColorGradientControl","every","key","hasOwnProperty"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SACCC,WADD,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,QAHD,EAICC,YAJD,EAKCC,cALD,QAMO,uBANP;AAQA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AAEA,MAAMC,qBAAqB,GAAG,CAC7B,QAD6B,EAE7B,qBAF6B,EAG7B,WAH6B,EAI7B,wBAJ6B,CAA9B;AAOA,MAAMC,SAAS,GAAG;AACjBC,EAAAA,IAAI,EAAE,OADW;AAEjBC,EAAAA,KAAK,EAAE,OAFU;AAGjBC,EAAAA,KAAK,EAAE;AAHU,CAAlB;AAKA,MAAMC,YAAY,GAAG;AACpBH,EAAAA,IAAI,EAAE,UADc;AAEpBC,EAAAA,KAAK,EAAE,UAFa;AAGpBC,EAAAA,KAAK,EAAE;AAHa,CAArB;AAMA,MAAME,aAAa,GAAG,CAAEL,SAAF,EAAaI,YAAb,CAAtB;;AAEA,SAASE,yBAAT,OAeI;AAAA,MAfgC;AACnCC,IAAAA,MADmC;AAEnCC,IAAAA,SAFmC;AAGnCC,IAAAA,mBAHmC;AAInCC,IAAAA,sBAJmC;AAKnCC,IAAAA,iCALmC;AAMnCC,IAAAA,SANmC;AAOnCC,IAAAA,KAPmC;AAQnCC,IAAAA,aARmC;AASnCC,IAAAA,gBATmC;AAUnCC,IAAAA,UAVmC;AAWnCC,IAAAA,aAXmC;AAYnCC,IAAAA,SAZmC;AAanCC,IAAAA,SAAS,GAAG,IAbuB;AAcnCC,IAAAA;AAdmC,GAehC;AACH,QAAMC,eAAe,GACpBP,aAAa,KAAM,CAAEvB,OAAO,CAAEgB,MAAF,CAAT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J,KAAhC,CAAP;AACA;;AACD,SAAO,cAAC,0BAAD,EAAiCA,KAAjC,CAAP;AACA;;AAED,eAAeE,oBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBaseControl,\n\t__experimentalVStack as VStack,\n\tTabPanel,\n\tColorPalette,\n\tGradientPicker,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../use-setting';\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nconst TAB_COLOR = {\n\tname: 'color',\n\ttitle: 'Solid',\n\tvalue: 'color',\n};\nconst TAB_GRADIENT = {\n\tname: 'gradient',\n\ttitle: 'Gradient',\n\tvalue: 'gradient',\n};\n\nconst TABS_SETTINGS = [ TAB_COLOR, TAB_GRADIENT ];\n\nfunction ColorGradientControlInner( {\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\t__experimentalIsRenderedInSidebar,\n\tclassName,\n\tlabel,\n\tonColorChange,\n\tonGradientChange,\n\tcolorValue,\n\tgradientValue,\n\tclearable,\n\tshowTitle = true,\n\tenableAlpha,\n} ) {\n\tconst canChooseAColor =\n\t\tonColorChange && ( ! isEmpty( colors ) || ! disableCustomColors );\n\tconst canChooseAGradient =\n\t\tonGradientChange &&\n\t\t( ! isEmpty( gradients ) || ! disableCustomGradients );\n\n\tif ( ! canChooseAColor && ! canChooseAGradient ) {\n\t\treturn null;\n\t}\n\n\tconst tabPanels = {\n\t\t[ TAB_COLOR.value ]: (\n\t\t\t<ColorPalette\n\t\t\t\tvalue={ colorValue }\n\t\t\t\tonChange={\n\t\t\t\t\tcanChooseAGradient\n\t\t\t\t\t\t? ( newColor ) => {\n\t\t\t\t\t\t\t\tonColorChange( newColor );\n\t\t\t\t\t\t\t\tonGradientChange();\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: onColorChange\n\t\t\t\t}\n\t\t\t\t{ ...{ colors, disableCustomColors } }\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tclearable={ clearable }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t/>\n\t\t),\n\t\t[ TAB_GRADIENT.value ]: (\n\t\t\t<GradientPicker\n\t\t\t\t__nextHasNoMargin\n\t\t\t\tvalue={ gradientValue }\n\t\t\t\tonChange={\n\t\t\t\t\tcanChooseAColor\n\t\t\t\t\t\t? ( newGradient ) => {\n\t\t\t\t\t\t\t\tonGradientChange( newGradient );\n\t\t\t\t\t\t\t\tonColorChange();\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: onGradientChange\n\t\t\t\t}\n\t\t\t\t{ ...{ gradients, disableCustomGradients } }\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tclearable={ clearable }\n\t\t\t/>\n\t\t),\n\t};\n\n\tconst renderPanelType = ( type ) => (\n\t\t<div className=\"block-editor-color-gradient-control__panel\">\n\t\t\t{ tabPanels[ type ] }\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-color-gradient-control',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<fieldset className=\"block-editor-color-gradient-control__fieldset\">\n\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t{ showTitle && (\n\t\t\t\t\t\t<legend>\n\t\t\t\t\t\t\t<div className=\"block-editor-color-gradient-control__color-indicator\">\n\t\t\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</legend>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canChooseAColor && canChooseAGradient && (\n\t\t\t\t\t\t<TabPanel\n\t\t\t\t\t\t\tclassName=\"block-editor-color-gradient-control__tabs\"\n\t\t\t\t\t\t\ttabs={ TABS_SETTINGS }\n\t\t\t\t\t\t\tinitialTabName={\n\t\t\t\t\t\t\t\tgradientValue\n\t\t\t\t\t\t\t\t\t? TAB_GRADIENT.value\n\t\t\t\t\t\t\t\t\t: !! canChooseAColor && TAB_COLOR.value\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ ( tab ) => renderPanelType( tab.value ) }\n\t\t\t\t\t\t</TabPanel>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! canChooseAGradient &&\n\t\t\t\t\t\trenderPanelType( TAB_COLOR.value ) }\n\t\t\t\t\t{ ! canChooseAColor &&\n\t\t\t\t\t\trenderPanelType( TAB_GRADIENT.value ) }\n\t\t\t\t</VStack>\n\t\t\t</fieldset>\n\t\t</BaseControl>\n\t);\n}\n\nfunction ColorGradientControlSelect( props ) {\n\tconst colorGradientSettings = {};\n\tcolorGradientSettings.colors = useSetting( 'color.palette' );\n\tcolorGradientSettings.gradients = useSetting( 'color.gradients' );\n\tcolorGradientSettings.disableCustomColors = ! useSetting( 'color.custom' );\n\tcolorGradientSettings.disableCustomGradients = ! useSetting(\n\t\t'color.customGradient'\n\t);\n\n\treturn (\n\t\t<ColorGradientControlInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n}\n\nfunction ColorGradientControl( props ) {\n\tif (\n\t\tcolorsAndGradientKeys.every( ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <ColorGradientControlInner { ...props } />;\n\t}\n\treturn <ColorGradientControlSelect { ...props } />;\n}\n\nexport default ColorGradientControl;\n"]}
@@ -105,7 +105,6 @@ export default function ColorGradientSettingsDropdown(_ref4) {
105
105
  enableAlpha,
106
106
  gradients,
107
107
  settings,
108
- __experimentalHasMultipleOrigins,
109
108
  __experimentalIsRenderedInSidebar,
110
109
  ...props
111
110
  } = _ref4;
@@ -135,7 +134,6 @@ export default function ColorGradientSettingsDropdown(_ref4) {
135
134
  onColorChange: setting.onColorChange,
136
135
  onGradientChange: setting.onGradientChange,
137
136
  showTitle: false,
138
- __experimentalHasMultipleOrigins,
139
137
  __experimentalIsRenderedInSidebar,
140
138
  ...setting
141
139
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/dropdown.js"],"names":["classnames","Button","ColorIndicator","Dropdown","FlexItem","__experimentalDropdownContentWrapper","DropdownContentWrapper","__experimentalHStack","HStack","__experimentalToolsPanelItem","ToolsPanelItem","ColorGradientControl","WithToolsPanelItem","setting","children","panelId","props","clearValue","colorValue","onColorChange","gradientValue","onGradientChange","label","isShownByDefault","undefined","resetAllFilter","LabeledColorIndicator","renderToggle","settings","onToggle","isOpen","toggleProps","onClick","className","ColorGradientSettingsDropdown","colors","disableCustomColors","disableCustomGradients","enableAlpha","gradients","__experimentalHasMultipleOrigins","__experimentalIsRenderedInSidebar","popoverProps","placement","offset","shift","map","index","controlProps","clearable","showTitle","toggleSettings"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,MADD,EAECC,cAFD,EAGCC,QAHD,EAICC,QAJD,EAKCC,oCAAoC,IAAIC,sBALzC,EAMCC,oBAAoB,IAAIC,MANzB,EAOCC,4BAA4B,IAAIC,cAPjC,QAQO,uBARP;AAUA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,WAAjC,C,CAEA;AACA;;AACA,MAAMC,kBAAkB,GAAG,QAAgD;AAAA,MAA9C;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,QAAX;AAAqBC,IAAAA,OAArB;AAA8B,OAAGC;AAAjC,GAA8C;;AAC1E,QAAMC,UAAU,GAAG,MAAM;AACxB,QAAKJ,OAAO,CAACK,U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AAYpB6B,MAAAA,SAAS,EAAE,KAZS;AAapBV,MAAAA,gCAboB;AAcpBC,MAAAA,iCAdoB;AAepB,SAAG5B;AAfiB,KAArB;AAiBA,UAAMsC,cAAc,GAAG;AACtBjC,MAAAA,UAAU,2BAAEL,OAAO,CAACO,aAAV,yEAA2BP,OAAO,CAACK,UADvB;AAEtBI,MAAAA,KAAK,EAAET,OAAO,CAACS;AAFO,KAAvB;AAKA,WACCT,OAAO,IACN;AACA;AACA,kBAAC,kBAAD;AACC,MAAA,GAAG,EAAGkC,KADP;AAEC,MAAA,OAAO,EAAGlC;AAFX,OAGMG,KAHN,GAKC,cAAC,QAAD;AACC,MAAA,YAAY,EAAG0B,YADhB;AAEC,MAAA,SAAS,EAAC,4DAFX;AAGC,MAAA,YAAY,EAAGf,YAAY,CAAEwB,cAAF,CAH5B;AAIC,MAAA,aAAa,EAAG,MACf,cAAC,sBAAD;AAAwB,QAAA,WAAW,EAAC;AAApC,SACC;AAAK,QAAA,SAAS,EAAC;AAAf,SACC,cAAC,oBAAD,EACMH,YADN,CADD,CADD;AALF,MALD,CAJF;AA0BA,GAjDC,CADH,CADD;AAsDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tColorIndicator,\n\tDropdown,\n\tFlexItem,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n\t__experimentalHStack as HStack,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientControl from './control';\n\n// When the `ColorGradientSettingsDropdown` controls are being rendered to a\n// `ToolsPanel` they must be wrapped in a `ToolsPanelItem`.\nconst WithToolsPanelItem = ( { setting, children, panelId, ...props } ) => {\n\tconst clearValue = () => {\n\t\tif ( setting.colorValue ) {\n\t\t\tsetting.onColorChange();\n\t\t} else if ( setting.gradientValue ) {\n\t\t\tsetting.onGradientChange();\n\t\t}\n\t};\n\treturn (\n\t\t<ToolsPanelItem\n\t\t\thasValue={ () => {\n\t\t\t\treturn !! setting.colorValue || !! setting.gradientValue;\n\t\t\t} }\n\t\t\tlabel={ setting.label }\n\t\t\tonDeselect={ clearValue }\n\t\t\tisShownByDefault={\n\t\t\t\tsetting.isShownByDefault !== undefined\n\t\t\t\t\t? setting.isShownByDefault\n\t\t\t\t\t: true\n\t\t\t}\n\t\t\t{ ...props }\n\t\t\tclassName=\"block-editor-tools-panel-color-gradient-settings__item\"\n\t\t\tpanelId={ panelId }\n\t\t\t// Pass resetAllFilter if supplied due to rendering via SlotFill\n\t\t\t// into parent ToolsPanel.\n\t\t\tresetAllFilter={ setting.resetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</ToolsPanelItem>\n\t);\n};\n\nconst LabeledColorIndicator = ( { colorValue, label } ) => (\n\t<HStack justify=\"flex-start\">\n\t\t<ColorIndicator\n\t\t\tclassName=\"block-editor-panel-color-gradient-settings__color-indicator\"\n\t\t\tcolorValue={ colorValue }\n\t\t/>\n\t\t<FlexItem\n\t\t\tclassName=\"block-editor-panel-color-gradient-settings__color-name\"\n\t\t\ttitle={ label }\n\t\t>\n\t\t\t{ label }\n\t\t</FlexItem>\n\t</HStack>\n);\n\n// Renders a color dropdown's toggle as an `Item` if it is within an `ItemGroup`\n// or as a `Button` if it isn't e.g. the controls are being rendered in\n// a `ToolsPanel`.\nconst renderToggle =\n\t( settings ) =>\n\t( { onToggle, isOpen } ) => {\n\t\tconst { colorValue, label } = settings;\n\n\t\tconst toggleProps = {\n\t\t\tonClick: onToggle,\n\t\t\tclassName: classnames(\n\t\t\t\t'block-editor-panel-color-gradient-settings__dropdown',\n\t\t\t\t{ 'is-open': isOpen }\n\t\t\t),\n\t\t\t'aria-expanded': isOpen,\n\t\t};\n\n\t\treturn (\n\t\t\t<Button { ...toggleProps }>\n\t\t\t\t<LabeledColorIndicator\n\t\t\t\t\tcolorValue={ colorValue }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t/>\n\t\t\t</Button>\n\t\t);\n\t};\n\n// Renders a collection of color controls as dropdowns. Depending upon the\n// context in which these dropdowns are being rendered, they may be wrapped\n// in an `ItemGroup` with each dropdown's toggle as an `Item`, or alternatively,\n// the may be individually wrapped in a `ToolsPanelItem` with the toggle as\n// a regular `Button`.\n//\n// For more context see: https://github.com/WordPress/gutenberg/pull/40084\nexport default function ColorGradientSettingsDropdown( {\n\tcolors,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\tenableAlpha,\n\tgradients,\n\tsettings,\n\t__experimentalHasMultipleOrigins,\n\t__experimentalIsRenderedInSidebar,\n\t...props\n} ) {\n\tlet popoverProps;\n\tif ( __experimentalIsRenderedInSidebar ) {\n\t\tpopoverProps = {\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t};\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ settings.map( ( setting, index ) => {\n\t\t\t\tconst controlProps = {\n\t\t\t\t\tclearable: false,\n\t\t\t\t\tcolorValue: setting.colorValue,\n\t\t\t\t\tcolors,\n\t\t\t\t\tdisableCustomColors,\n\t\t\t\t\tdisableCustomGradients,\n\t\t\t\t\tenableAlpha,\n\t\t\t\t\tgradientValue: setting.gradientValue,\n\t\t\t\t\tgradients,\n\t\t\t\t\tlabel: setting.label,\n\t\t\t\t\tonColorChange: setting.onColorChange,\n\t\t\t\t\tonGradientChange: setting.onGradientChange,\n\t\t\t\t\tshowTitle: false,\n\t\t\t\t\t__experimentalHasMultipleOrigins,\n\t\t\t\t\t__experimentalIsRenderedInSidebar,\n\t\t\t\t\t...setting,\n\t\t\t\t};\n\t\t\t\tconst toggleSettings = {\n\t\t\t\t\tcolorValue: setting.gradientValue ?? setting.colorValue,\n\t\t\t\t\tlabel: setting.label,\n\t\t\t\t};\n\n\t\t\t\treturn (\n\t\t\t\t\tsetting && (\n\t\t\t\t\t\t// If not in an `ItemGroup` wrap the dropdown in a\n\t\t\t\t\t\t// `ToolsPanelItem`\n\t\t\t\t\t\t<WithToolsPanelItem\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tsetting={ setting }\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-tools-panel-color-gradient-settings__dropdown\"\n\t\t\t\t\t\t\t\trenderToggle={ renderToggle( toggleSettings ) }\n\t\t\t\t\t\t\t\trenderContent={ () => (\n\t\t\t\t\t\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t\t\t\t\t\t<div className=\"block-editor-panel-color-gradient-settings__dropdown-content\">\n\t\t\t\t\t\t\t\t\t\t\t<ColorGradientControl\n\t\t\t\t\t\t\t\t\t\t\t\t{ ...controlProps }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</DropdownContentWrapper>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</WithToolsPanelItem>\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/dropdown.js"],"names":["classnames","Button","ColorIndicator","Dropdown","FlexItem","__experimentalDropdownContentWrapper","DropdownContentWrapper","__experimentalHStack","HStack","__experimentalToolsPanelItem","ToolsPanelItem","ColorGradientControl","WithToolsPanelItem","setting","children","panelId","props","clearValue","colorValue","onColorChange","gradientValue","onGradientChange","label","isShownByDefault","undefined","resetAllFilter","LabeledColorIndicator","renderToggle","settings","onToggle","isOpen","toggleProps","onClick","className","ColorGradientSettingsDropdown","colors","disableCustomColors","disableCustomGradients","enableAlpha","gradients","__experimentalIsRenderedInSidebar","popoverProps","placement","offset","shift","map","index","controlProps","clearable","showTitle","toggleSettings"],"mappings":";;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CAAc,CAAEhC,OAAF,EAAWiC,KAAX,KAAsB;AAAA;;AACrC,UAAMC,YAAY,GAAG;AACpBC,MAAAA,SAAS,EAAE,KADS;AAEpB9B,MAAAA,UAAU,EAAEL,OAAO,CAACK,UAFA;AAGpBiB,MAAAA,MAHoB;AAIpBC,MAAAA,mBAJoB;AAKpBC,MAAAA,sBALoB;AAMpBC,MAAAA,WANoB;AAOpBlB,MAAAA,aAAa,EAAEP,OAAO,CAACO,aAPH;AAQpBmB,MAAAA,SARoB;AASpBjB,MAAAA,KAAK,EAAET,OAAO,CAACS,KATK;AAUpBH,MAAAA,aAAa,EAAEN,OAAO,CAACM,aAVH;AAWpBE,MAAAA,gBAAgB,EAAER,OAAO,CAACQ,gBAXN;AAYpB4B,MAAAA,SAAS,EAAE,KAZS;AAapBT,MAAAA,iCAboB;AAcpB,SAAG3B;AAdiB,KAArB;AAgBA,UAAMqC,cAAc,GAAG;AACtBhC,MAAAA,UAAU,2BAAEL,OAAO,CAACO,aAAV,yEAA2BP,OAAO,CAACK,UADvB;AAEtBI,MAAAA,KAAK,EAAET,OAAO,CAACS;AAFO,KAAvB;AAKA,WACCT,OAAO,IACN;AACA;AACA,kBAAC,kBAAD;AACC,MAAA,GAAG,EAAGiC,KADP;AAEC,MAAA,OAAO,EAAGjC;AAFX,OAGMG,KAHN,GAKC,cAAC,QAAD;AACC,MAAA,YAAY,EAAGyB,YADhB;AAEC,MAAA,SAAS,EAAC,4DAFX;AAGC,MAAA,YAAY,EAAGd,YAAY,CAAEuB,cAAF,CAH5B;AAIC,MAAA,aAAa,EAAG,MACf,cAAC,sBAAD;AAAwB,QAAA,WAAW,EAAC;AAApC,SACC;AAAK,QAAA,SAAS,EAAC;AAAf,SACC,cAAC,oBAAD,EACMH,YADN,CADD,CADD;AALF,MALD,CAJF;AA0BA,GAhDC,CADH,CADD;AAqDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tColorIndicator,\n\tDropdown,\n\tFlexItem,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n\t__experimentalHStack as HStack,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientControl from './control';\n\n// When the `ColorGradientSettingsDropdown` controls are being rendered to a\n// `ToolsPanel` they must be wrapped in a `ToolsPanelItem`.\nconst WithToolsPanelItem = ( { setting, children, panelId, ...props } ) => {\n\tconst clearValue = () => {\n\t\tif ( setting.colorValue ) {\n\t\t\tsetting.onColorChange();\n\t\t} else if ( setting.gradientValue ) {\n\t\t\tsetting.onGradientChange();\n\t\t}\n\t};\n\treturn (\n\t\t<ToolsPanelItem\n\t\t\thasValue={ () => {\n\t\t\t\treturn !! setting.colorValue || !! setting.gradientValue;\n\t\t\t} }\n\t\t\tlabel={ setting.label }\n\t\t\tonDeselect={ clearValue }\n\t\t\tisShownByDefault={\n\t\t\t\tsetting.isShownByDefault !== undefined\n\t\t\t\t\t? setting.isShownByDefault\n\t\t\t\t\t: true\n\t\t\t}\n\t\t\t{ ...props }\n\t\t\tclassName=\"block-editor-tools-panel-color-gradient-settings__item\"\n\t\t\tpanelId={ panelId }\n\t\t\t// Pass resetAllFilter if supplied due to rendering via SlotFill\n\t\t\t// into parent ToolsPanel.\n\t\t\tresetAllFilter={ setting.resetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</ToolsPanelItem>\n\t);\n};\n\nconst LabeledColorIndicator = ( { colorValue, label } ) => (\n\t<HStack justify=\"flex-start\">\n\t\t<ColorIndicator\n\t\t\tclassName=\"block-editor-panel-color-gradient-settings__color-indicator\"\n\t\t\tcolorValue={ colorValue }\n\t\t/>\n\t\t<FlexItem\n\t\t\tclassName=\"block-editor-panel-color-gradient-settings__color-name\"\n\t\t\ttitle={ label }\n\t\t>\n\t\t\t{ label }\n\t\t</FlexItem>\n\t</HStack>\n);\n\n// Renders a color dropdown's toggle as an `Item` if it is within an `ItemGroup`\n// or as a `Button` if it isn't e.g. the controls are being rendered in\n// a `ToolsPanel`.\nconst renderToggle =\n\t( settings ) =>\n\t( { onToggle, isOpen } ) => {\n\t\tconst { colorValue, label } = settings;\n\n\t\tconst toggleProps = {\n\t\t\tonClick: onToggle,\n\t\t\tclassName: classnames(\n\t\t\t\t'block-editor-panel-color-gradient-settings__dropdown',\n\t\t\t\t{ 'is-open': isOpen }\n\t\t\t),\n\t\t\t'aria-expanded': isOpen,\n\t\t};\n\n\t\treturn (\n\t\t\t<Button { ...toggleProps }>\n\t\t\t\t<LabeledColorIndicator\n\t\t\t\t\tcolorValue={ colorValue }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t/>\n\t\t\t</Button>\n\t\t);\n\t};\n\n// Renders a collection of color controls as dropdowns. Depending upon the\n// context in which these dropdowns are being rendered, they may be wrapped\n// in an `ItemGroup` with each dropdown's toggle as an `Item`, or alternatively,\n// the may be individually wrapped in a `ToolsPanelItem` with the toggle as\n// a regular `Button`.\n//\n// For more context see: https://github.com/WordPress/gutenberg/pull/40084\nexport default function ColorGradientSettingsDropdown( {\n\tcolors,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\tenableAlpha,\n\tgradients,\n\tsettings,\n\t__experimentalIsRenderedInSidebar,\n\t...props\n} ) {\n\tlet popoverProps;\n\tif ( __experimentalIsRenderedInSidebar ) {\n\t\tpopoverProps = {\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t};\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ settings.map( ( setting, index ) => {\n\t\t\t\tconst controlProps = {\n\t\t\t\t\tclearable: false,\n\t\t\t\t\tcolorValue: setting.colorValue,\n\t\t\t\t\tcolors,\n\t\t\t\t\tdisableCustomColors,\n\t\t\t\t\tdisableCustomGradients,\n\t\t\t\t\tenableAlpha,\n\t\t\t\t\tgradientValue: setting.gradientValue,\n\t\t\t\t\tgradients,\n\t\t\t\t\tlabel: setting.label,\n\t\t\t\t\tonColorChange: setting.onColorChange,\n\t\t\t\t\tonGradientChange: setting.onGradientChange,\n\t\t\t\t\tshowTitle: false,\n\t\t\t\t\t__experimentalIsRenderedInSidebar,\n\t\t\t\t\t...setting,\n\t\t\t\t};\n\t\t\t\tconst toggleSettings = {\n\t\t\t\t\tcolorValue: setting.gradientValue ?? setting.colorValue,\n\t\t\t\t\tlabel: setting.label,\n\t\t\t\t};\n\n\t\t\t\treturn (\n\t\t\t\t\tsetting && (\n\t\t\t\t\t\t// If not in an `ItemGroup` wrap the dropdown in a\n\t\t\t\t\t\t// `ToolsPanelItem`\n\t\t\t\t\t\t<WithToolsPanelItem\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tsetting={ setting }\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-tools-panel-color-gradient-settings__dropdown\"\n\t\t\t\t\t\t\t\trenderToggle={ renderToggle( toggleSettings ) }\n\t\t\t\t\t\t\t\trenderContent={ () => (\n\t\t\t\t\t\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t\t\t\t\t\t<div className=\"block-editor-panel-color-gradient-settings__dropdown-content\">\n\t\t\t\t\t\t\t\t\t\t\t<ColorGradientControl\n\t\t\t\t\t\t\t\t\t\t\t\t{ ...controlProps }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</DropdownContentWrapper>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</WithToolsPanelItem>\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n"]}
@@ -18,9 +18,7 @@ import { useInstanceId } from '@wordpress/compose';
18
18
  */
19
19
 
20
20
  import ColorGradientSettingsDropdown from './dropdown';
21
- import useSetting from '../use-setting';
22
- import useCommonSingleMultipleSelects from './use-common-single-multiple-selects';
23
- import useMultipleOriginColorsAndGradients from './use-multiple-origin-colors-and-gradients';
21
+ import useColorsAndGradientsPalettes from './use-multiple-origin-colors-and-gradients';
24
22
  const colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients'];
25
23
  export const PanelColorGradientSettingsInner = _ref => {
26
24
  let {
@@ -33,7 +31,6 @@ export const PanelColorGradientSettingsInner = _ref => {
33
31
  settings,
34
32
  title,
35
33
  showTitle = true,
36
- __experimentalHasMultipleOrigins,
37
34
  __experimentalIsRenderedInSidebar,
38
35
  enableAlpha
39
36
  } = _ref;
@@ -77,7 +74,6 @@ export const PanelColorGradientSettingsInner = _ref => {
77
74
  gradients,
78
75
  disableCustomColors,
79
76
  disableCustomGradients,
80
- __experimentalHasMultipleOrigins,
81
77
  __experimentalIsRenderedInSidebar,
82
78
  enableAlpha
83
79
  }), !!children && createElement(Fragment, null, createElement(Spacer, {
@@ -85,15 +81,8 @@ export const PanelColorGradientSettingsInner = _ref => {
85
81
  }), " ", children));
86
82
  };
87
83
 
88
- const PanelColorGradientSettingsSingleSelect = props => {
89
- const colorGradientSettings = useCommonSingleMultipleSelects();
90
- colorGradientSettings.colors = useSetting('color.palette');
91
- colorGradientSettings.gradients = useSetting('color.gradients');
92
- return createElement(PanelColorGradientSettingsInner, _extends({}, colorGradientSettings, props));
93
- };
94
-
95
- const PanelColorGradientSettingsMultipleSelect = props => {
96
- const colorGradientSettings = useMultipleOriginColorsAndGradients();
84
+ const PanelColorGradientSettingsSelect = props => {
85
+ const colorGradientSettings = useColorsAndGradientsPalettes();
97
86
  return createElement(PanelColorGradientSettingsInner, _extends({}, colorGradientSettings, props));
98
87
  };
99
88
 
@@ -102,11 +91,7 @@ const PanelColorGradientSettings = props => {
102
91
  return createElement(PanelColorGradientSettingsInner, props);
103
92
  }
104
93
 
105
- if (props.__experimentalHasMultipleOrigins) {
106
- return createElement(PanelColorGradientSettingsMultipleSelect, props);
107
- }
108
-
109
- return createElement(PanelColorGradientSettingsSingleSelect, props);
94
+ return createElement(PanelColorGradientSettingsSelect, props);
110
95
  };
111
96
 
112
97
  export default PanelColorGradientSettings;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js"],"names":["classnames","isEmpty","__experimentalSpacer","Spacer","__experimentalToolsPanel","ToolsPanel","useRegistry","useInstanceId","ColorGradientSettingsDropdown","useSetting","useCommonSingleMultipleSelects","useMultipleOriginColorsAndGradients","colorsAndGradientKeys","PanelColorGradientSettingsInner","className","colors","gradients","disableCustomColors","disableCustomGradients","children","settings","title","showTitle","__experimentalHasMultipleOrigins","__experimentalIsRenderedInSidebar","enableAlpha","panelId","batch","every","setting","undefined","forEach","colorValue","gradientValue","onColorChange","onGradientChange","PanelColorGradientSettingsSingleSelect","props","colorGradientSettings","PanelColorGradientSettingsMultipleSelect","PanelColorGradientSettings","key","hasOwnProperty"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SACCC,oBAAoB,IAAIC,MADzB,EAECC,wBAAwB,IAAIC,UAF7B,QAGO,uBAHP;AAIA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,aAAT,QAA8B,oBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,6BAAP,MAA0C,YAA1C;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,8BAAP,MAA2C,sCAA3C;AACA,OAAOC,mCAAP,MAAgD,4CAAhD;AAEA,MAAMC,qBAAqB,GAAG,CAC7B,QAD6B,EAE7B,qBAF6B,EAG7B,WAH6B,EAI7B,wBAJ6B,CAA9B;AAOA,OAAO,MAAMC,+BAA+B,GAAG,QAaxC;AAAA,MAb0C;AAChDC,IAAAA,SADgD;AAEhDC,I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A8C;AAC7C,WAAO,cAAC,wCAAD,EAA+Cc,KAA/C,CAAP;AACA;;AACD,SAAO,cAAC,sCAAD,EAA6CA,KAA7C,CAAP;AACA,CAVD;;AAYA,eAAeG,0BAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalSpacer as Spacer,\n\t__experimentalToolsPanel as ToolsPanel,\n} from '@wordpress/components';\nimport { useRegistry } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientSettingsDropdown from './dropdown';\nimport useSetting from '../use-setting';\nimport useCommonSingleMultipleSelects from './use-common-single-multiple-selects';\nimport useMultipleOriginColorsAndGradients from './use-multiple-origin-colors-and-gradients';\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nexport const PanelColorGradientSettingsInner = ( {\n\tclassName,\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\tchildren,\n\tsettings,\n\ttitle,\n\tshowTitle = true,\n\t__experimentalHasMultipleOrigins,\n\t__experimentalIsRenderedInSidebar,\n\tenableAlpha,\n} ) => {\n\tconst panelId = useInstanceId( PanelColorGradientSettingsInner );\n\tconst { batch } = useRegistry();\n\tif (\n\t\tisEmpty( colors ) &&\n\t\tisEmpty( gradients ) &&\n\t\tdisableCustomColors &&\n\t\tdisableCustomGradients &&\n\t\tsettings?.every(\n\t\t\t( setting ) =>\n\t\t\t\tisEmpty( setting.colors ) &&\n\t\t\t\tisEmpty( setting.gradients ) &&\n\t\t\t\t( setting.disableCustomColors === undefined ||\n\t\t\t\t\tsetting.disableCustomColors ) &&\n\t\t\t\t( setting.disableCustomGradients === undefined ||\n\t\t\t\t\tsetting.disableCustomGradients )\n\t\t)\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-panel-color-gradient-settings',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\tlabel={ showTitle ? title : undefined }\n\t\t\tresetAll={ () => {\n\t\t\t\tbatch( () => {\n\t\t\t\t\tsettings.forEach(\n\t\t\t\t\t\t( {\n\t\t\t\t\t\t\tcolorValue,\n\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\tonColorChange,\n\t\t\t\t\t\t\tonGradientChange,\n\t\t\t\t\t\t} ) => {\n\t\t\t\t\t\t\tif ( colorValue ) {\n\t\t\t\t\t\t\t\tonColorChange();\n\t\t\t\t\t\t\t} else if ( gradientValue ) {\n\t\t\t\t\t\t\t\tonGradientChange();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tpanelId={ panelId }\n\t\t\t__experimentalFirstVisibleItemClass=\"first\"\n\t\t\t__experimentalLastVisibleItemClass=\"last\"\n\t\t>\n\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\tsettings={ settings }\n\t\t\t\tpanelId={ panelId }\n\t\t\t\t{ ...{\n\t\t\t\t\tcolors,\n\t\t\t\t\tgradients,\n\t\t\t\t\tdisableCustomColors,\n\t\t\t\t\tdisableCustomGradients,\n\t\t\t\t\t__experimentalHasMultipleOrigins,\n\t\t\t\t\t__experimentalIsRenderedInSidebar,\n\t\t\t\t\tenableAlpha,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ !! children && (\n\t\t\t\t<>\n\t\t\t\t\t<Spacer marginY={ 4 } /> { children }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</ToolsPanel>\n\t);\n};\n\nconst PanelColorGradientSettingsSingleSelect = ( props ) => {\n\tconst colorGradientSettings = useCommonSingleMultipleSelects();\n\tcolorGradientSettings.colors = useSetting( 'color.palette' );\n\tcolorGradientSettings.gradients = useSetting( 'color.gradients' );\n\treturn (\n\t\t<PanelColorGradientSettingsInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n};\n\nconst PanelColorGradientSettingsMultipleSelect = ( props ) => {\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\treturn (\n\t\t<PanelColorGradientSettingsInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n};\n\nconst PanelColorGradientSettings = ( props ) => {\n\tif (\n\t\tcolorsAndGradientKeys.every( ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <PanelColorGradientSettingsInner { ...props } />;\n\t}\n\tif ( props.__experimentalHasMultipleOrigins ) {\n\t\treturn <PanelColorGradientSettingsMultipleSelect { ...props } />;\n\t}\n\treturn <PanelColorGradientSettingsSingleSelect { ...props } />;\n};\n\nexport default PanelColorGradientSettings;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js"],"names":["classnames","isEmpty","__experimentalSpacer","Spacer","__experimentalToolsPanel","ToolsPanel","useRegistry","useInstanceId","ColorGradientSettingsDropdown","useColorsAndGradientsPalettes","colorsAndGradientKeys","PanelColorGradientSettingsInner","className","colors","gradients","disableCustomColors","disableCustomGradients","children","settings","title","showTitle","__experimentalIsRenderedInSidebar","enableAlpha","panelId","batch","every","setting","undefined","forEach","colorValue","gradientValue","onColorChange","onGradientChange","PanelColorGradientSettingsSelect","props","colorGradientSettings","PanelColorGradientSettings","key","hasOwnProperty"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SACCC,oBAAoB,IAAIC,MADzB,EAECC,wBAAwB,IAAIC,UAF7B,QAGO,uBAHP;AAIA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,aAAT,QAA8B,oBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,6BAAP,MAA0C,YAA1C;AACA,OAAOC,6BAAP,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L;AACDC,YAAAA,UADC;AAEDC,YAAAA,aAFC;AAGDC,YAAAA,aAHC;AAIDC,YAAAA;AAJC,WAKK;;AACN,cAAKH,UAAL,EAAkB;AACjBE,YAAAA,aAAa;AACb,WAFD,MAEO,IAAKD,aAAL,EAAqB;AAC3BE,YAAAA,gBAAgB;AAChB;AACD,SAZF;AAcA,OAfI,CAAL;AAgBA,KAvBF;AAwBC,IAAA,OAAO,EAAGT,OAxBX;AAyBC,IAAA,mCAAmC,EAAC,OAzBrC;AA0BC,IAAA,kCAAkC,EAAC;AA1BpC,KA4BC,cAAC,6BAAD;AACC,IAAA,QAAQ,EAAGL,QADZ;AAEC,IAAA,OAAO,EAAGK,OAFX;AAIEV,IAAAA,MAJF;AAKEC,IAAAA,SALF;AAMEC,IAAAA,mBANF;AAOEC,IAAAA,sBAPF;AAQEK,IAAAA,iCARF;AASEC,IAAAA;AATF,IA5BD,EAwCG,CAAC,CAAEL,QAAH,IACD,8BACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,IADD,OAC4BA,QAD5B,CAzCF,CADD;AAgDA,CAjFM;;AAmFP,MAAMgB,gCAAgC,GAAKC,KAAF,IAAa;AACrD,QAAMC,qBAAqB,GAAG1B,6BAA6B,EAA3D;AACA,SACC,cAAC,+BAAD,eACW0B,qBADX,EACqCD,KADrC,EADD;AAKA,CAPD;;AASA,MAAME,0BAA0B,GAAKF,KAAF,IAAa;AAC/C,MACCxB,qBAAqB,CAACe,KAAtB,CAA+BY,GAAF,IAAWH,KAAK,CAACI,cAAN,CAAsBD,GAAtB,CAAxC,CADD,EAEE;AACD,WAAO,cAAC,+BAAD,EAAsCH,KAAtC,CAAP;AACA;;AACD,SAAO,cAAC,gCAAD,EAAuCA,KAAvC,CAAP;AACA,CAPD;;AASA,eAAeE,0BAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalSpacer as Spacer,\n\t__experimentalToolsPanel as ToolsPanel,\n} from '@wordpress/components';\nimport { useRegistry } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientSettingsDropdown from './dropdown';\nimport useColorsAndGradientsPalettes from './use-multiple-origin-colors-and-gradients';\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nexport const PanelColorGradientSettingsInner = ( {\n\tclassName,\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\tchildren,\n\tsettings,\n\ttitle,\n\tshowTitle = true,\n\t__experimentalIsRenderedInSidebar,\n\tenableAlpha,\n} ) => {\n\tconst panelId = useInstanceId( PanelColorGradientSettingsInner );\n\tconst { batch } = useRegistry();\n\tif (\n\t\tisEmpty( colors ) &&\n\t\tisEmpty( gradients ) &&\n\t\tdisableCustomColors &&\n\t\tdisableCustomGradients &&\n\t\tsettings?.every(\n\t\t\t( setting ) =>\n\t\t\t\tisEmpty( setting.colors ) &&\n\t\t\t\tisEmpty( setting.gradients ) &&\n\t\t\t\t( setting.disableCustomColors === undefined ||\n\t\t\t\t\tsetting.disableCustomColors ) &&\n\t\t\t\t( setting.disableCustomGradients === undefined ||\n\t\t\t\t\tsetting.disableCustomGradients )\n\t\t)\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-panel-color-gradient-settings',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\tlabel={ showTitle ? title : undefined }\n\t\t\tresetAll={ () => {\n\t\t\t\tbatch( () => {\n\t\t\t\t\tsettings.forEach(\n\t\t\t\t\t\t( {\n\t\t\t\t\t\t\tcolorValue,\n\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\tonColorChange,\n\t\t\t\t\t\t\tonGradientChange,\n\t\t\t\t\t\t} ) => {\n\t\t\t\t\t\t\tif ( colorValue ) {\n\t\t\t\t\t\t\t\tonColorChange();\n\t\t\t\t\t\t\t} else if ( gradientValue ) {\n\t\t\t\t\t\t\t\tonGradientChange();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tpanelId={ panelId }\n\t\t\t__experimentalFirstVisibleItemClass=\"first\"\n\t\t\t__experimentalLastVisibleItemClass=\"last\"\n\t\t>\n\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\tsettings={ settings }\n\t\t\t\tpanelId={ panelId }\n\t\t\t\t{ ...{\n\t\t\t\t\tcolors,\n\t\t\t\t\tgradients,\n\t\t\t\t\tdisableCustomColors,\n\t\t\t\t\tdisableCustomGradients,\n\t\t\t\t\t__experimentalIsRenderedInSidebar,\n\t\t\t\t\tenableAlpha,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ !! children && (\n\t\t\t\t<>\n\t\t\t\t\t<Spacer marginY={ 4 } /> { children }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</ToolsPanel>\n\t);\n};\n\nconst PanelColorGradientSettingsSelect = ( props ) => {\n\tconst colorGradientSettings = useColorsAndGradientsPalettes();\n\treturn (\n\t\t<PanelColorGradientSettingsInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n};\n\nconst PanelColorGradientSettings = ( props ) => {\n\tif (\n\t\tcolorsAndGradientKeys.every( ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <PanelColorGradientSettingsInner { ...props } />;\n\t}\n\treturn <PanelColorGradientSettingsSelect { ...props } />;\n};\n\nexport default PanelColorGradientSettings;\n"]}
@@ -8,7 +8,6 @@ import { _x } from '@wordpress/i18n';
8
8
  */
9
9
 
10
10
  import useSetting from '../use-setting';
11
- import useCommonSingleMultipleSelects from './use-common-single-multiple-selects';
12
11
  /**
13
12
  * Retrieves color and gradient related settings.
14
13
  *
@@ -19,7 +18,10 @@ import useCommonSingleMultipleSelects from './use-common-single-multiple-selects
19
18
  */
20
19
 
21
20
  export default function useMultipleOriginColorsAndGradients() {
22
- const colorGradientSettings = useCommonSingleMultipleSelects();
21
+ const colorGradientSettings = {
22
+ disableCustomColors: !useSetting('color.custom'),
23
+ disableCustomGradients: !useSetting('color.customGradient')
24
+ };
23
25
  const customColors = useSetting('color.palette.custom');
24
26
  const themeColors = useSetting('color.palette.theme');
25
27
  const defaultColors = useSetting('color.palette.default');